* i386.cc (Output_data_plt_i386::address_for_global,
[binutils-gdb.git] / gold / ChangeLog
1 2012-10-05 Alan Modra <amodra@gmail.com>
2
3 * i386.cc (Output_data_plt_i386::address_for_global,
4 address_for_local): Add plt offset to returned value. Adjust uses.
5 * sparc.cc (Output_data_plt_sparc::address_for_global,
6 address_for_local): Likewise.
7 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
8 address_for_local): Likewise.
9 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
10 address_for_local): Likewise.
11 * target.h (Target::plt_address_for_global, plt_address_for_local):
12 Update comment.
13 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
14 (Output_data_got::Got_entry::write): Nor here.
15 * output.h: Comment fix.
16
17 2012-10-02 Jiong Wang <jiwang@tilera.com>
18
19 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
20 global_offset_table_ value for larget got.
21 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
22
23 2012-09-29 Alan Modra <amodra@gmail.com>
24
25 * powerpc.cc (Target_powerpc::iplt_): New output section.
26 (Target_powerpc::iplt_section, make_iplt_section,
27 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
28 (Target_powerpc::make_plt_entry): Handle ifunc syms.
29 Target_powerpc::plt_entry_count): Count iplt entries too.
30 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
31 reloc section in constructor. New params.
32 (Target_powerpc::make_plt_section): Create reloc section here instead.
33 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
34 functions.
35 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
36 (Output_data_glink::add_entry, find_entry): New functions to
37 deal with local syms.
38 (Glink_sym_ent): Add support for local syms.
39 (Output_data_glink::do_write): Handle ifunc plt entries.
40 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
41 (Target_powerpc::Scan::local, global): Handle ifunc syms.
42 (Target_powerpc::Relocate::relocate): Likewise.
43 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
44
45 2012-09-25 Alan Modra <amodra@gmail.com>
46
47 * object.h (Sized_relobj_file::adjust_local_symbol,
48 do_adjust_local_symbol): New functions.
49 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
50 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
51 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
52 and irregular opd entry spacing.
53 (Powerpc_relobj::do_read_relocs): Add opd size checks.
54 (Global_symbol_visitor_opd): New functor.
55 (Target_powerpc::do_finalize_sections): Omit global symbols defined
56 on deleted opd entries.
57
58 2012-09-15 Jiong Wang <jiwang@tilera.com>
59
60 * tilegx.cc: New file.
61 * Makefile.am (TARGETSOURCES): Add tilegx.cc
62 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
63 * configure.tgt: Add entries for tilegx*.
64 * configure.ac: Likewise.
65 * Makefile.in: Rebuild.
66 * configure: Likewise.
67 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
68 tilegx.
69
70 2012-09-13 Alan Modra <amodra@gmail.com>
71
72 * target-reloc.h (scan_relocs): Call scan.local for relocs
73 against symbols in discarded sections. Pass is_discarded
74 param.
75 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
76 Add is_discarded param.
77 * powerpc (Target_powerpc::Scan::local): Likewise. Use
78 is_discarded to flag opd entry as discarded. Don't emit dyn
79 relocs on such entries.
80 (Target_powerpc::Scan::global): Similarly detect and handle
81 such opd entries.
82 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
83 opd_ent_. Update all uses.
84 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
85 (Target_powerpc::relocate_section): Zero out discarded opd
86 entry relocs.
87
88 2012-09-12 Ian Lance Taylor <iant@google.com>
89
90 PR gold/14570
91 * output.cc: Rename Output_data_got template parameter from size
92 to got_size for all functions. Compile all variants of
93 Output_data_got.
94 (Output_data_got::Got_entry::write): Correct use of size for
95 symbol value. Use local_is_tls rather than casting to
96 Sized_relobj_file.
97 * object.h (class Object): Add local_is_tls and do_local_is_tls.
98 (class Sized_relobj_file): Add do_local_is_tls.
99 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
100
101 2012-09-11 Alan Modra <amodra@gmail.com>
102
103 PR gold/14566
104 * layout.cc (Layout::set_segment_offsets): When using
105 common-page-size alignment, ensure we are on a new max-page-size
106 page.
107 * output.cc (Output_segment::set_section_addresses): Use
108 abi_pagesize, not common_pagesize for relro boundary.
109 (Output_segment::set_offset): Likewise.
110
111 2012-09-11 Alan Modra <amodra@gmail.com>
112
113 * output.h (Output_data_got::add_global_tls, add_local_tls,
114 add_local_tls_pair): New functions.
115 (Output_data_got::add_local_pair_with_rel): Remove second
116 reloc param. Expand comment.
117 (Output_data_got::Got_entry): Rename use_plt_offset_ to
118 use_plt_or_tls_offset_, similarly for constructor param.
119 (Output_data_got::Got_entry::write): Add got_index param.
120 * output.cc (Output_data_got::add_global_tls, add_local_tls,
121 add_local_tls_pair): New functions.
122 (Output_data_got::Got_entry::write): Handle tls symbols
123 with use_plt_or_tls_offset_ set specially.
124 (Output_data_got::add_local_pair_with_rel): Only one reloc.
125 (Output_data_got::do_write): Replace iterator with index, pass
126 index to entry write function.
127 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
128 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
129 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
130 call.
131 * i386.cc (Target_i386::Scan::local): Likewise.
132 * sparc.cc (Target_sparc::Scan::local): Likewise.
133 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
134 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
135 do_tls_offset_for_global): New functions.
136 (Target_powerpc::Scan::local): Correct TLS relocations and got
137 entry values.
138 (Target_powerpc::Scan::global): Don't emit unnecessary
139 dynamic relocations on TLS GOT entries.
140
141 2012-09-10 Matthias Klose <doko@ubuntu.com>
142
143 * config.in: Disable sanity check for kfreebsd.
144
145 2012-09-10 Sterling Augustine <saugustine@google.com>
146
147 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
148 (Gdb_index::pubtypes_read): New parameter.
149 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
150 to calls.
151 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
152 pubtypes_object_.
153
154 2012-09-09 Alan Modra <amodra@gmail.com>
155
156 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
157 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
158 * gc.h (gc_process_relocs): Call target gc_add_reference.
159 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
160 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
161 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
162 unnecessary cast.
163 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
164 to cater for when we don't need code offset. Update use.
165 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
166 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
167 set_opd_valid): New functions.
168 (Target_powerpc::do_gc_add_reference): New function.
169 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
170 stashed refs.
171 (Target_powerpc::do_gc_mark_symbol): New function.
172
173 2012-09-06 Cary Coutant <ccoutant@google.com>
174
175 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
176 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
177 (Dwarf_die::skip_attributes): Likewise.
178 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
179 * testsuite/gdb_index_test.cc (inline_func_1): New function.
180 (main): Call it.
181 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
182
183 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
184
185 * testsuite/script_test_3.t: Add .got.plt output section
186 statement.
187 * testsuite/script_test_4.t: Likewise.
188
189 2012-09-05 Alan Modra <amodra@gmail.com>
190
191 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
192 update all uses and lose "enum" when using type.
193
194 2012-09-05 Alan Modra <amodra@gmail.com>
195
196 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
197 * configure: Regenerate.
198 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
199 (plugin_final_layout.stdout): Likewise.
200 (memory_test): Set page sizes to 0x1000.
201 * testsuite/Makefile.in: Regenerate.
202 * testsuite/discard_locals_test.sh: Add FIXME comment.
203 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
204 * testsuite/pr14265.t: Add .got output section statement.
205 * testsuite/script_test_2.t: Likewise.
206 * testsuite/script_test_3.t: Likewise.
207 * testsuite/script_test_4.t: Likewise.
208 * testsuite/script_test_5.t: Likewise.
209 * testsuite/script_test_6.t: Likewise.
210 * testsuite/script_test_7.t: Likewise.
211 * testsuite/script_test_9.t: Likewise.
212
213 2012-09-05 Alan Modra <amodra@gmail.com>
214
215 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
216 (Powerpc_relocate_functions::Status): New typedef.
217 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
218 (Target_powerpc::Scan::local): Handle REL64.
219 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
220 for REL32 and REL64.
221 (Target_powerpc::symval_for_branch): New function, extracted from..
222 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
223 checks. Report overflow errors.
224
225 2012-09-05 Alan Modra <amodra@gmail.com>
226
227 * object.h (Sized_relobj_file::emit_relocs): Delete.
228 (Sized_relobj_file::emit_relocs_reltype): Delete.
229 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
230 relocate_relocs for --emit-relocs.
231 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
232 * output.h: Update comment.
233 (Output_segment::first_section): New function.
234 (Output_segment::first_section_load_address): Use first_section.
235 * output.cc (Output_segment::first_section): New function extracted..
236 (Output_segment::first_section_load_address): ..from here. Delete.
237 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
238 * target.h (Sized_target::relocate_for_relocatable): Likewise.
239 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
240 adjust call to target.h function.
241 * i386.cc (Target_i386): Likewise.
242 * sparc.cc (Target_sparc): Likewise.
243 * x86_64.cc (Target_x86_64): Likewise.
244 * powerpc.cc (Target_powerpc): Likewise.
245 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
246 first tls section has section symbol for optimised local dynamic
247 output relocs.
248 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
249 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
250 optimised tls code.
251 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
252 Rename to relocate_relocs. Update error message.
253
254 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
255
256 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
257 --just-symbols.
258
259 2012-08-31 Alan Modra <amodra@gmail.com>
260
261 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
262 (Powerpc_relobj::toc_base_offset): New stub function.
263 (Target_powerpc): Add tp_offset, dtp_offset. Rename
264 got_mod_index_offset to tlsld_got_offset. Update all refs.
265 (Target_powerpc::Relocate::enum skip_tls): New.
266 (Target_powerpc::call_tls_get_addr_): New var.
267 (Target_powerpc::is_branch_reloc): Move to file scope.
268 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
269 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
270 New functions.
271 (Target_powerpc::enum Got_type): Delete old values, add new ones.
272 (powerpc_info): Correct common_pagesize for ppc64.
273 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
274 (Powerpc_relocate_functions): Add overflow check enums and functions.
275 Add non-shift version of rela, rela_ua. Delete all rel public
276 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
277 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
278 addr16_ha3, addr14 functions.
279 (Output_data_got_powerpc::add_constant_pair): New function.
280 (Output_data_got_powerpc::got_base_offset): Likewise.
281 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
282 (instruction constants): Sort, add some more.
283 (Output_data_glink::do_write): Add and use Address typedef. Use
284 object->toc_base_offset() stub for 64-bit.
285 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
286 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
287 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
288 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
289 Always treat .opd relocs as against locally defined symbol.
290 Correct condition for RELATIVE relocs.
291 (Target_powerpc::do_finalize_sections): Test for NULL sections.
292 (Target_powerpc::Relocate::relocate): Use plt call stub as value
293 for 32-bit syms with a plt entry. Correct ppc64 toc base
294 calculations. Handle TLS relocs, and more. Add overflow
295 checking and adjust for Powerpc_relocate_functions changes.
296 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
297 Reinstate --emit-relocs code with FIXME.
298
299 2012-08-30 Alan Modra <amodra@gmail.com>
300
301 * layout.cc (Layout::set_segment_offsets): Set p_align to
302 abi_pagesize, not common_pagesize.
303 (Layout::relaxation_loop_body): Similarly use abi_pagesize
304 to determine whether file header can go in segment.
305
306 2012-08-30 Alan Modra <amodra@gmail.com>
307
308 * output.h (Output_reloc::Output_reloc <output section>): Add
309 is_relative param. Adjust calls.
310 (Output_reloc::add_output_section_relative): New functions.
311 * output.cc (Output_reloc::Output_reloc <output section>): Handle
312 is_relative.
313 (Output_reloc::symbol_value): Handle SECTION_CODE.
314
315 2012-08-24 Sriraman Tallam <tmsriram@google.com>
316
317 * gold.cc (queue_middle_tasks): Call layout again when unique
318 segments for sections is desired.
319 * layout.cc (Layout::Layout): Initialize new members.
320 (Layout::get_output_section_flags): New function.
321 (Layout::choose_output_section): Call get_output_section_flags.
322 (Layout::layout): Make output section for mapping to a unique segment.
323 (Layout::insert_section_segment_map): New function.
324 (Layout::attach_allocated_section_to_segment): Make unique segment for
325 output sections marked so.
326 (Layout::segment_precedes): Check for unique segments when sorting.
327 * layout.h (Layout::Unique_segment_info): New struct.
328 (Layout::Section_segment_map): New typedef.
329 (Layout::insert_section_segment_map): New function.
330 (Layout::get_output_section_flags): New function.
331 (Layout::is_unique_segment_for_sections_specified): New function.
332 (Layout::set_unique_segment_for_sections_specified): New function.
333 (Layout::unique_segment_for_sections_specified_): New member.
334 (Layout::section_segment_map_): New member.
335 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
336 Rename is_gc_pass_one to is_pass_one.
337 Rename is_gc_pass_two to is_pass_two.
338 Rename is_gc_or_icf to is_two_pass.
339 Check for which pass based on whether symbols data is present.
340 Make it two pass when unique segments for sections is desired.
341 * output.cc (Output_section::Output_section): Initialize new
342 members.
343 * output.h (Output_section::is_unique_segment): New function.
344 (Output_section::set_is_unique_segment): New function.
345 (Output_section::is_unique_segment_): New member.
346 (Output_section::extra_segment_flags): New function.
347 (Output_section::set_extra_segment_flags): New function.
348 (Output_section::extra_segment_flags_): New member.
349 (Output_section::segment_alignment): New function.
350 (Output_section::set_segment_alignment): New function.
351 (Output_section::segment_alignment_): New member.
352 (Output_segment::Output_segment): Initialize is_unique_segment_.
353 (Output_segment::is_unique_segment): New function.
354 (Output_segment::set_is_unique_segment): New function.
355 (Output_segment::is_unique_segment_): New member.
356 * plugin.cc (allow_unique_segment_for_sections): New function.
357 (unique_segment_for_sections): New function.
358 (Plugin::load): Add new functions to transfer vector.
359 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
360 * Makefile.in: Regenerate.
361 * testsuite/plugin_final_layout.sh: Check if unique segment
362 functionality works.
363 * testsuite/plugin_section_order.c (onload): Check if new interfaces
364 are available.
365 (allow_unique_segment_for_sections): New global.
366 (unique_segment_for_sections): New global.
367 (claim_file_hook): Call allow_unique_segment_for_sections.
368 (all_symbols_read_hook): Call unique_segment_for_sections.
369
370 2012-08-22 Cary Coutant <ccoutant@google.com>
371
372 * layout.cc (Layout::include_section): Don't assert on GROUP
373 sections with --emit-relocs.
374
375 2012-08-21 Cary Coutant <ccoutant@google.com>
376
377 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
378 if --export-dynamic-symbol names an undef symbol.
379
380 2012-08-18 Alan Modra <amodra@gmail.com>
381
382 * powerpc.cc: Formatting and white space.
383 (Powerpc_relobj): Rename got2_section_ to special_.
384 Add opd_ent_shndx_ and opd_ent_off_ vectors.
385 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
386 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
387 (Target_powerpc): Add Address typedef and invalid_address. Use
388 throughout.
389 (Target_powerpc::is_branch_reloc): New function.
390 (Powerpc_relocate_functions): Add Address typedef, use throughout.
391 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
392 for dst_mask, value and addend.
393 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
394 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
395 (Output_data_glink::do_write): Correct toc base. Don't try to use
396 uint16_t for 24-bit offset. Use get_output_section_offset and
397 check return.
398 (Target_powerpc::Scan::local): Handle more relocs.
399 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
400 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
401 Plug in toc restoring insn after plt calls. Translate branches
402 to function descriptor symbols to corresponding entry point.
403 (Target_powerpc::relocate_for_relocatable): Check return from
404 get_output_section_offset.
405 * symtab.h: Comment typo.
406
407 2012-08-14 Ian Lance Taylor <iant@google.com>
408
409 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
410 unsupported_relocal_local to call unsupported_reloc_global.
411
412 2012-08-14 Nick Clifton <nickc@redhat.com>
413
414 PR ld/14265
415 * script-sections.cc (Sections_element::output_section_name): Add
416 keep return parameter.
417 (Output_section_element::match_name): Add keep return parameter.
418 Return the value of the keep_ member.
419 * script-sections.h (class Output_section): Update
420 output_section_name prototype.
421 * layout.cc (Layout::keep_input_section): New public member
422 function.
423 (Layout::choose_output_section): Pass keep parameter to
424 output_section_name.
425 * layout.h (class Layout): Add keep_input_section.
426 * object.cc (Sized_relobj_file::do_layout): Check for kept input
427 sections.
428 * testsuite/Makefile.am: Add a test.
429 * testsuite/Makefile.in: Regenerate.
430 * testsuite/pr14265.c: Source file for the test.
431 * testsuite/pr14265.t: Linker script for the test.
432 * testsuite/pr14265.sh: Shell script for the test.
433
434 2012-08-14 Alan Modra <amodra@gmail.com>
435
436 * target.h (Target::output_section_name): New function.
437 (Target::do_output_section_name): New function.
438 * layout.cc (Layout::choose_output_section): Call the above.
439 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
440
441 2012-08-14 Alan Modra <amodra@gmail.com>
442
443 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
444 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
445 for replace_constant call.
446 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
447 (Output_data_glink::do_print_to_mapfile): New function.
448 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
449 (Target_powerpc::Relocate::relocate): Likewise.
450
451 2012-08-14 Alan Modra <amodra@gmail.com>
452
453 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
454 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
455 (Output_data_glink::add_entry,find_entry): Remove shndx param.
456 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
457 all references to shndx_. Handle special case for R_PPC_PLTREL24
458 here.
459 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
460 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
461 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
462 here.
463 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
464 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
465
466 2012-08-12 Alan Modra <amodra@gmail.com>
467
468 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
469 (glink insn constants): Use uint32_t.
470 (Output_data_glink::add_entry): Use insert, not [] operator.
471
472 2012-08-11 Alan Modra <amodra@gmail.com>
473
474 * object.h (Sized_relobj_file::find_shdr): New function.
475 (Sized_relobj_file::find_special_sections): New function.
476 * object.cc (Sized_relobj_file::find_shdr): New function.
477 (Sized_relobj_file::find_eh_frame): Use find_shdr.
478 (Sized_relobj_file::find_special_sections): New function, split out..
479 (Sized_relobj_file::do_read_symbols): ..from here.
480 * output.h (Output_data_got::replace_constant): New function.
481 (Output_data_got::num_entries): New function.
482 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
483 (Output_data_got::got_offset): Protected rather than private.
484 (Output_data_got::replace_got_entry): New function.
485 * output.cc (Output_data_got::replace_got_entry): New function.
486 * powerpc.cc (class Powerpc_relobj): New.
487 (class Powerpc_relocate_functions): Delete all psymval variants or
488 convert to value,addend type. Delete pcrela, pcrela_unaligned.
489 Implement _ha functions using corresponding _hi function.
490 (Powerpc_relobj::find_special_sections): New function.
491 (Target_powerpc::do_make_elf_object): New function.
492 (class Output_data_got_powerpc): New.
493 (class Output_data_glink): New.
494 (class Powerpc_scan_relocatable_reloc): New.
495 Many more changes througout file.
496
497 2012-08-09 Nick Clifton <nickc@redhat.com>
498
499 * po/vi.po: Updated Vietnamese translation.
500
501 2012-08-07 Ian Lance Taylor <iant@google.com>
502
503 * layout.cc (Layout::add_target_dynamic_tags): If
504 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
505 plt_rel.
506
507 2012-07-30 Nick Clifton <nickc@redhat.com>
508
509 * po/gold.pot: Updated template.
510 * po/es.po: Updated Spanish translation.
511
512 2012-07-18 Cary Coutant <ccoutant@google.com>
513
514 PR gold/14344
515 * configure.ac: Add check for -gpubnames support.
516 * configure: Regenerate.
517 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
518 support; force -gno-pubnames.
519 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
520 support.
521 (gdb_index_test_4): New test.
522 * testsuite/Makefile.in: Regenerate.
523 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
524 * testsuite/gdb_index_test_2.sh: Likewise.
525 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
526 * testsuite/gdb_index_test_4.sh: New script.
527 * testsuite/gdb_index_test_comm.sh: New script with common code;
528 don't look for space after colon.
529
530 2012-07-16 Sriraman Tallam <tmsriram@google.com>
531
532 * gold.cc (queue_middle_tasks): Update function order only after
533 deferred objects due to plugins are processed.
534
535 2012-07-11 Ian Lance Taylor <iant@google.com>
536
537 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
538 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
539 (Target_arm::scan_reloc_for_stub): Likewise.
540 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
541 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
542 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
543 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
544 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
545
546 2012-07-10 Dodji Seketeli <dodji@redhat.com>
547 Ian Lance Taylor <iant@google.com>
548
549 PR gold/14309
550 * configure.ac: Test whether std::tr1::hash<off_t> works.
551 * gold.h: Add a specialization for std::tr1::hash<off_t> if
552 needed.
553 * output.h (class Output_fill): Add virtual destructor.
554 * configure, config.in: Rebuild.
555
556 2012-06-22 Roland McGrath <mcgrathr@google.com>
557
558 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
559
560 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
561
562 * plugin.cc (Plugin::load): Handle position independent executables.
563
564 2012-06-06 Cary Coutant <ccoutant@google.com>
565
566 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
567 add .debug_macro.
568 (lines_only_debug_sections): Likewise.
569 (gdb_fast_lookup_sections): New static array.
570 (is_gdb_debug_section): Rename formal parameter.
571 (is_lines_only_debug_section): Likewise.
572 (is_gdb_fast_lookup_section): New function.
573 (Layout::include_section): Check for ".zdebug_" prefix; pass
574 section name suffix to is_gdb_debug_section, et al.; check for
575 fast-lookup sections when building .gdb_index.
576 * options.h (--strip-debug-gdb): Update GDB version number.
577
578 2012-06-06 Cary Coutant <ccoutant@google.com>
579
580 * configure.ac: Add check for fallocate.
581 * configure: Regenerate.
582 * config.in: Regenerate.
583
584 * options.h (class General_options): Add --mmap-output-file and
585 --posix-fallocate options.
586 * output.cc: (posix_fallocate): Remove; replace with...
587 (gold_fallocate): New function.
588 (Output_file::map_no_anonymous): Call gold_fallocate.
589 (Output_file::map): Check --mmap-output-file option.
590
591 2012-06-05 Jing Yu <jingyu@google.com>
592
593 * gold.h (textdomain): Add do {} to empty while(0).
594 (bindtextdomain): Likewise.
595
596 2012-06-04 Cary Coutant <ccoutant@google.com>
597
598 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
599 has_dynsym_index.
600
601 2012-05-25 Sriraman Tallam <tmsriram@google.com>
602
603 * symtab.cc (Symbol_table::define_special_symbol):
604 Initialize *poldsym to prevent uninitialized variable errors.
605
606 2012-05-23 Cary Coutant <ccoutant@google.com>
607
608 * layout.cc (Layout::section_name_mapping): Add rules to handle
609 exact match on .data.rel.ro.local or .data.rel.ro.
610 (Layout::output_section_name): Check for exact matches.
611
612 2012-05-23 Cary Coutant <ccoutant@google.com>
613
614 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
615 more carefully.
616
617 2012-05-22 Cary Coutant <ccoutant@google.com>
618
619 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
620 object before exporting symbol.
621
622 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
623
624 * testsuite/tls_test.cc: Include "config.h" first.
625 * testsuite/tls_test_c.c: Likewise.
626
627 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
628 Nick Clifton <nickc@redhat.com>
629
630 PR 14072
631 * configure.in: Add check that sysdep.h has been included before
632 any system header files.
633 * configure: Regenerate.
634 * config.in: Regenerate.
635
636 2012-05-14 Cary Coutant <ccoutant@google.com>
637
638 * layout.cc (Layout::make_output_section): Mark .tdata section
639 as RELRO.
640 * testsuite/relro_test.cc: Add a TLS variable.
641
642 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
643
644 PR gold/14091
645 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
646 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
647 R_X86_64_64.
648
649 2012-05-08 Cary Coutant <ccoutant@google.com>
650
651 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
652 (lines_only_debug_sections): Likewise.
653
654 2012-05-02 Roland McGrath <mcgrathr@google.com>
655
656 * nacl.cc: New file.
657 * nacl.h: New file.
658 * Makefile.am (CCFILES, HFILES): Add them.
659 * Makefile.in: Regenerate.
660 * i386.cc (Output_data_plt_i386_nacl): New class.
661 (Output_data_plt_i386_nacl_exec): New class.
662 (Output_data_plt_i386_nacl_dyn): New class.
663 (Target_i386_nacl): New class.
664 (Target_selector_i386_nacl): New class.
665 (target_selector_i386): Use it instead of Target_selector_i386.
666 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
667 (Target_x86_64_nacl): New class.
668 (Target_selector_x86_64_nacl): New class.
669 (target_selector_x86_64, target_selector_x32): Use it instead of
670 Target_selector_x86_64.
671 * arm.cc (Output_data_plt_arm_nacl): New class.
672 (Target_arm_nacl): New class.
673 (Target_selector_arm_nacl): New class.
674 (target_selector_arm, target_selector_armbe): Use it instead of
675 Target_selector_arm.
676
677 * target-select.cc (select_target): Take new Input_file* and off_t
678 arguments, pass them on to recognize method of selector.
679 * object.cc (make_elf_sized_object): Update caller.
680 * parameters.cc (parameters_force_valid_target): Likewise.
681 * incremental.cc (make_sized_incremental_binary): Likewise.
682 * target-select.h: Update decl.
683 (Target_selector::recognize): Take new Input_file* argument,
684 pass it on to do_recognize.
685 (Target_selector::do_recognize): Take new Input_file* argument.
686 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
687 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
688 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
689 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
690
691 * target.h (Target::Target_info): New members isolate_execinstr
692 and rosegment_gap.
693 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
694 * arm.cc (Target_arm::arm_info): Update initializer.
695 * i386.cc (Target_i386::i386_info): Likewise.
696 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
697 * sparc.cc (Target_sparc::sparc_info): Likewise.
698 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
699 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
700 * layout.cc (Layout::attach_allocated_section_to_segment):
701 Take new const Target* argument. If target->isolate_execinstr(), act
702 like --rosegment.
703 (Layout::find_first_load_seg): Take new const Target* argument;
704 if target->isolate_execinstr(), reject PF_X segments.
705 (Layout::relaxation_loop_body): Update caller.
706 (Layout::set_segment_offsets): If target->isolate_execinstr(),
707 reset file offset to zero when we hit LOAD_SEG, and then do a second
708 loop over the segments before LOAD_SEG to reassign offsets after
709 addresses have been determined. Handle target->rosegment_gap().
710 (Layout::attach_section_to_segment): Take new const Target* argument;
711 pass it to attach_allocated_section_to_segment.
712 (Layout::make_output_section): Update caller.
713 (Layout::attach_sections_to_segments): Take new const Target* argument;
714 pass it to attach_section_to_segment.
715 * gold.cc (queue_middle_tasks): Update caller.
716 * layout.h (Layout): Update method decls with new arguments.
717
718 * arm.cc (Target_arm::Target_arm): Take optional argument for the
719 Target_info pointer to use.
720 (Target_arm::do_make_data_plt): New virtual method.
721 (Target_arm::make_data_plt): New method that calls it.
722 (Target_arm::make_plt_entry): Use it.
723 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
724 for the section alignment.
725 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
726 method.
727 (Output_data_plt_arm::first_plt_entry_offset): Call it.
728 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
729 method.
730 (Output_data_plt_arm::get_plt_entry_size): Call it.
731 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
732 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
733 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
734 method.
735 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
736 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
737 method instead of sizeof(plt_entry).
738 (Output_data_plt_arm::add_entry): Likewise.
739 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
740 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
741 than static method.
742 (Target_arm::plt_entry_size): Likewise.
743 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
744 Move to ...
745 (Output_data_plt_arm_standard): ... here, new class.
746 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
747 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
748 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
749
750 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
751 Take additional argument for the PLT entry size.
752 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
753 Use get_plt_entry_size method rather than plt_entry_size variable.
754 (Output_data_plt_x86_64::reserve_slot): Likewise.
755 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
756 (Output_data_plt_x86_64::add_entry): Likewise.
757 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
758 (Output_data_plt_x86_64::address_for_global): Likewise.
759 (Output_data_plt_x86_64::address_for_local): Likewise.
760 (Output_data_plt_x86_64::set_final_data_size): Likewise.
761 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
762 Make method non-static.
763 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
764 method.
765 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
766 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
767 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
768 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
769 virtual method.
770 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
771 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
772 virtual method.
773 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
774 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
775 virtual method.
776 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
777 (Output_data_plt_x86_64::plt_entry_size)
778 (Output_data_plt_x86_64::first_plt_entry)
779 (Output_data_plt_x86_64::plt_entry)
780 (Output_data_plt_x86_64::tlsdesc_plt_entry)
781 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
782 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
783 (Output_data_plt_x86_64_standard): ... here, new class.
784 (Target_x86_64::Target_x86_64): Take optional argument for the
785 Target_info pointer to use.
786 (Target_x86_64::do_make_data_plt): New virtual method.
787 (Target_x86_64::make_data_plt): New method to call it.
788 (Target_x86_64::init_got_plt_for_update): Use that.
789 Call this->plt_->add_eh_frame method here.
790 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
791 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
792 rather than static method.
793 (Target_x86_64::plt_entry_size): Likewise.
794 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
795 rather than plt_entry_size variable. Move guts of PLT filling to...
796 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
797 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
798 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
799
800 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
801 additional argument for the section alignment.
802 Don't do add_eh_frame_for_plt here.
803 (Output_data_plt_i386::first_plt_entry_offset): Make the method
804 non-static. Use get_plt_entry_size method rather than plt_entry_size
805 variable.
806 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
807 method.
808 (Output_data_plt_i386::get_plt_entry_size): Call it.
809 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
810 (Output_data_plt_i386::add_eh_frame): New method to call it.
811 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
812 method.
813 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
814 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
815 method.
816 (Output_data_plt_i386::fill_plt_entry): New method to call it.
817 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
818 method instead of plt_entry_size.
819 (Output_data_plt_i386::plt_entry_size)
820 (Output_data_plt_i386::plt_eh_frame_fde_size)
821 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
822 (Output_data_plt_i386_standard): ... here, new class.
823 (Output_data_plt_i386_exec): New class.
824 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
825 (Output_data_plt_i386_exec::first_plt_entry): ... here.
826 (Output_data_plt_i386::exec_plt_entry): Move to ...
827 (Output_data_plt_i386_exec::plt_entry): ... here.
828 (Output_data_plt_i386_dyn): New class.
829 (Output_data_plt_i386::first_plt_entry): Move to ...
830 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
831 (Output_data_plt_i386::dyn_plt_entry): Move to ...
832 (Output_data_plt_i386_dyn::plt_entry): ... here.
833 (Target_i386::Target_i386): Take optional argument for the Target_info
834 pointer to use.
835 (Target_i386::do_make_data_plt): New virtual method.
836 (Target_i386::make_data_plt): New method to call it.
837 (Target_i386::make_plt_section): Use that.
838 Call this->plt_->add_eh_frame method here.
839 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
840 rather than plt_entry_size variable.
841 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
842 (Output_data_plt_i386::address_for_local): Likewise.
843 (Output_data_plt_i386::do_write): Likewise.
844 Move guts of PLT filling to...
845 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
846 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
847 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
848 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
849
850 2012-05-01 Cary Coutant <ccoutant@google.com>
851
852 * dwarf_reader.cc (Dwarf_die::read_attributes)
853 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
854 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
855 * reduced_debug_output.cc
856 (Output_reduced_debug_info_section::get_die_end): Remove
857 DW_FORM_GNU_ref_index. Add default case.
858
859 2012-04-26 Mark Wielaard <mjw@redhat.com>
860
861 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
862 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
863 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
864 DW_AT_high_pc as offset from DW_AT_low_pc.
865
866 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
867 * testsuite/Makefile.in: Regenerate.
868 * testsuite/gdb_index_test_3.c: New test source file.
869 * testsuite/gdb_index_test_3.sh: New test source file.
870
871 2012-04-25 Ian Lance Taylor <iant@google.com>
872
873 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
874 pointer.
875 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
876 as a class, not a struct.
877 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
878 (Target_arm::apply_cortex_a8_workaround): Likewise.
879 * gc.h: Declare Reloc_types as a struct, not a class.
880 * object.h: Declare Symbols_data as a struct.
881 * reloc.h: Declare Read_relocs_data as a struct.
882 * target.h: Declare Relocate_info as a struct.
883
884 2012-04-24 David S. Miller <davem@davemloft.net>
885
886 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
887 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
888 and R_SPARC_WPLT30.
889
890 2012-04-24 Cary Coutant <ccoutant@google.com>
891
892 * incremental-dump.cc (find_input_containing_global): Replace
893 magic number with symbolic constant.
894 (dump_incremental_inputs): Update version number.
895 * incremental.cc (Output_section_incremental_inputs): Update version
896 number; import symbolic constants from Incremental_inputs_reader.
897 (Incremental_inputs::create_data_sections): Align relocations
898 section correctly for 64-bit targets.
899 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
900 constants; add padding.
901 (Output_section_incremental_inputs::write_header): Add assert for
902 header_size.
903 (Output_section_incremental_inputs::write_input_files): Add assert
904 for input_entry_size.
905 (Output_section_incremental_inputs::write_info_blocks): Add padding;
906 add assert for object_info_size, input_section_entry_size,
907 global_sym_entry_size.
908 * incremental.h (Incremental_inputs_reader): Add symbolic constants
909 for data structure sizes; use them.
910 (Incremental_input_entry_reader): Import symbolic constants from
911 Incremental_inputs_reader; use them.
912
913 2012-04-23 David S. Miller <davem@davemloft.net>
914
915 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
916 and elf_flags_set_.
917 (Target_sparc::Target_sparc): Initialize new fields.
918 (Target_sparc::do_make_elf_object): New function.
919 (Target_sparc::do_adjust_elf_header): New function.
920
921 2012-04-23 Cary Coutant <ccoutant@google.com>
922
923 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
924 CU range table of gdb index.
925
926 2012-04-20 David S. Miller <davem@davemloft.net>
927
928 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
929 instead of false.
930
931 2012-04-16 David S. Miller <davem@davemloft.net>
932
933 * sparc.cc (Target_sparc::got_address): New function.
934 (Sparc_relocate_functions::gdop_hix22): New function.
935 (Sparc_relocate_functions::gdop_lox10): New function.
936 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
937 relocs.
938 (Target_sparc::Scan::local): Likewise if the global symbol is not
939 preemptible and is not IFUNC.
940 (Target_sparc::Relocate::relocate): Perform GOTDATA code
941 transformations for local and non-preemptible non-IFUNC global
942 symbols.
943
944 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
945 writing out 64-bit part of ranges.
946
947 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
948 -fpic and -fpie respectively.
949 * Makefile.in: Regenerate.
950
951 * sparc.cc (class Target_sparc): Add rela_ifunc_.
952 (Target_sparc::Target_sparc): Initialize new field.
953 (Target_sparc::do_plt_section_for_global): New function.
954 (Target_sparc::do_plt_section_for_local): New function.
955 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
956 (Target_sparc::make_plt_section): New function, broken out of
957 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
958 (Target_sparc::make_plt_entry): Call make_plt_section.
959 (Target_sparc::make_local_ifunc_plt_entry): New function.
960 (Target_sparc::rela_ifunc_section): New function.
961 (Target_sparc::plt_section): Remove const.
962 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
963 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
964 and ifunc_count_ fields.
965 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
966 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
967 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
968 (Output_data_plt_sparc::rela_ifunc): New function.
969 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
970 (Output_data_plt_sparc::has_ifunc_section): New function.
971 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
972 (Output_data_plt_sparc::address_for_global): New function.
973 (Output_data_plt_sparc::address_for_local): New function.
974 (Output_data_plt_sparc::plt_index_to_offset): New function.
975 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
976 and entry_count.
977 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
978 entry_count.
979 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
980 R_SPARC_JMP_IREL to switch.
981 (Target_sparc::Scan::check_non_pic): Likewise.
982 (Target_sparc::Scan::local): Handle IFUNC symbols.
983 (Target_sparc::Scan::local): Likewise.
984 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
985 and plt_address_for_local.
986 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
987 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
988
989 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
990 (class Output_data_reloc): Adjust calls to Output_reloc_type.
991 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
992 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
993 global relocs too.
994 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
995 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
996 calls.
997 * sparc.cc (Target_sparc::Scan::global): Likewise.
998 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
999
1000 2012-04-16 Cary Coutant <ccoutant@google.com>
1001
1002 * archive.cc (Library_base::should_include_member): Check for
1003 --export-dynamic-symbol.
1004 * options.h (class General_options): Add --export-dynamic-symbol.
1005 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1006 --export-dynamic-symbol.
1007 (Symbol_table::gc_mark_undef_symbols): Likewise.
1008 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1009
1010 2012-04-12 David S. Miller <davem@davemloft.net>
1011
1012 * sparc.cc (Reloc::wdisp10): New relocation method.
1013 (Reloc::h34): Likewise.
1014 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1015 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1016 R_SPARC_WDISP10.
1017 (Target_sparc::Scan::local): Likewise.
1018 (Target_sparc::Scan::global): Likewise.
1019 (Target_sparc::Relocate::relocate): Likewise.
1020
1021 2012-04-09 Cary Coutant <ccoutant@google.com>
1022
1023 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1024 low_pc == 0.
1025
1026 2012-04-06 Ian Lance Taylor <iant@google.com>
1027
1028 * timer.cc: #include <unistd.h>.
1029
1030 2012-04-06 Roland McGrath <mcgrathr@google.com>
1031
1032 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1033 * config.in: Regenerate.
1034 * configure: Regenerate.
1035
1036 2012-04-05 Nick Clifton <nickc@redhat.com>
1037
1038 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1039 (AM_LC_MESSAGES): Add.
1040 * aclocal.m4: Regenerate.
1041 * config.in: Regenerate.
1042 * configure: Regenerate.
1043
1044 2012-03-21 Cary Coutant <ccoutant@google.com>
1045
1046 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1047 * Makefile.in: Regenerate.
1048 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1049 (Sized_elf_reloc_mapper::symbol_section): New function.
1050 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1051 (make_elf_reloc_mapper): New function.
1052 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1053 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1054 (Dwarf_abbrev_table::do_get_abbrev): New function.
1055 (Dwarf_ranges_table::read_ranges_table): New function.
1056 (Dwarf_ranges_table::read_range_list): New function.
1057 (Dwarf_pubnames_table::read_section): New function.
1058 (Dwarf_pubnames_table::read_header): New function.
1059 (Dwarf_pubnames_table::next_name): New function.
1060 (Dwarf_die::Dwarf_die): New function.
1061 (Dwarf_die::read_attributes): New function.
1062 (Dwarf_die::skip_attributes): New function.
1063 (Dwarf_die::set_name): New function.
1064 (Dwarf_die::set_linkage_name): New function.
1065 (Dwarf_die::attribute): New function.
1066 (Dwarf_die::string_attribute): New function.
1067 (Dwarf_die::int_attribute): New function.
1068 (Dwarf_die::uint_attribute): New function.
1069 (Dwarf_die::ref_attribute): New function.
1070 (Dwarf_die::child_offset): New function.
1071 (Dwarf_die::sibling_offset): New function.
1072 (Dwarf_info_reader::check_buffer): New function.
1073 (Dwarf_info_reader::parse): New function.
1074 (Dwarf_info_reader::do_parse): New function.
1075 (Dwarf_info_reader::do_read_string_table): New function.
1076 (Dwarf_info_reader::lookup_reloc): New function.
1077 (Dwarf_info_reader::get_string): New function.
1078 (Dwarf_info_reader::visit_compilation_unit): New function.
1079 (Dwarf_info_reader::visit_type_unit): New function.
1080 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1081 Sized_elf_reloc_mapper.
1082 (Sized_dwarf_line_info::symbol_section): Remove function.
1083 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1084 (Sized_dwarf_line_info::read_line_mappings): Remove object
1085 parameter, adjust callers.
1086 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1087 * dwarf_reader.h: Include <sys/types.h>.
1088 (class Track_relocs): Remove forward declaration.
1089 (class Elf_reloc_mapper): New class.
1090 (class Sized_elf_reloc_mapper): New class.
1091 (class Dwarf_abbrev_table): New class.
1092 (class Dwarf_range_list): New class.
1093 (class Dwarf_ranges_table): New class.
1094 (class Dwarf_pubnames_table): New class.
1095 (class Dwarf_die): New class.
1096 (class Dwarf_info_reader): New class.
1097 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1098 (Sized_dwarf_line_info::symbol_section): Remove member function.
1099 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1100 base class.
1101 * gdb-index.cc: New source file.
1102 * gdb-index.h: New source file.
1103 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1104 and .debug_types sections, call Layout::add_to_gdb_index.
1105 (Sized_relobj_incr::do_section_name): Implement.
1106 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1107 return type; Implement.
1108 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1109 return type.
1110 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1111 parameter list and return type.
1112 (Sized_incr_dynobj::do_section_contents): Likewise.
1113 * layout.cc: Include gdb-index.h.
1114 (Layout::Layout): Initialize gdb_index_data_.
1115 (Layout::init_fixed_output_section): Check for .gdb_index section.
1116 (Layout::add_to_gdb_index): New function. Instantiate.
1117 * layout.h: Add forward declaration for class Gdb_index.
1118 (Layout::add_to_gdb_index): New member function.
1119 (Layout::gdb_index_data_): New data member.
1120 * main.cc: Include gdb-index.h.
1121 (main): Print statistics for gdb index.
1122 * object.cc (Object::section_contents): Move code into
1123 do_section_contents.
1124 (need_decompressed_section): Check for sections needed when building
1125 gdb index.
1126 (build_compressed_section_map): Likewise.
1127 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1128 gdb index.
1129 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1130 sections; call Layout::add_to_gdb_index.
1131 (Sized_relobj_file::do_decompressed_section_contents): Call
1132 do_section_contents directly.
1133 * object.h (Object::do_section_contents): Adjust parameter list and
1134 return type.
1135 (Object::do_decompressed_section_contents): Call do_section_contents
1136 directly.
1137 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1138 return type.
1139 * options.h (class General_options): Add --gdb-index option.
1140 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1141 list and return type.
1142 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1143 * reloc.h (Track_relocs::checkpoint): New function.
1144 (Track_relocs::reset): New function.
1145
1146 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1147 New test cases.
1148 * testsuite/Makefile.in: Regenerate.
1149 * testsuite/gdb_index_test.cc: New test source file.
1150 * testsuite/gdb_index_test_1.sh: New test source file.
1151 * testsuite/gdb_index_test_2.sh: New test source file.
1152
1153 2012-03-19 Doug Kwan <dougkwan@google.com>
1154
1155 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1156 (Target_arm::do_finalize_sections): Remove code which defines
1157 __exidx_start and __exidx_end. Make symbol table parameter
1158 anonymous as it is not used.
1159 * gold.cc (queue_middle_tasks): Call target hook to define any
1160 target-specific symbols.
1161 * target.h (Target::define_standard_symbols): New method.
1162 (Target::do_define_standard_symbols): Same.
1163 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1164 * testsuite/Makefile.in: Regenerate.
1165 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1166 and __exidx_end.
1167 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1168 relocations are generated for __exidx_start and __exidx_end.
1169
1170 2012-03-16 Doug Kwan <dougkwan@google.com>
1171
1172 * testsuite/Makefile.am: Disable test initpri3b.
1173 * testsuite/Makefile.in: Regenerate.
1174
1175 2012-03-15 Doug Kwan <dougkwan@google.com>
1176
1177 * arm.cc (Target_arm::got_section): Make .got section read-only
1178 if -z now is given.
1179
1180 2012-03-15 Ian Lance Taylor <iant@google.com>
1181
1182 PR gold/13850
1183 * layout.cc (Layout::make_output_section): Correctly mark
1184 SHT_INIT_ARRAY, et. al., as relro.
1185
1186 2012-03-14 Doug Kwan <dougkwan@google.com>
1187
1188 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1189 dynamic relocations for protected symbols in shared objects.
1190
1191 2012-03-13 Ian Lance Taylor <iant@google.com>
1192
1193 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1194 keep the larger alignment.
1195
1196 2012-03-12 Cary Coutant <ccoutant@google.com>
1197
1198 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1199 handling of DW_LNE_define_file.
1200
1201 2012-03-12 Cary Coutant <ccoutant@google.com>
1202
1203 * reduced_debug_output.cc
1204 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1205 codes to switch.
1206
1207 2012-02-29 Cary Coutant <ccoutant@google.com>
1208
1209 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1210
1211 2012-02-29 Cary Coutant <ccoutant@google.com>
1212
1213 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1214 Call Object::decompressed_section_contents.
1215 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1216 New dtor.
1217 (Sized_dwarf_line_info::buffer_start_): New data member.
1218 * merge.cc (Output_merge_data::do_add_input_section): Call
1219 Object::decompressed_section_contents.
1220 (Output_merge_string::do_add_input_section): Likewise.
1221 * object.cc (need_decompressed_section): New function.
1222 (build_compressed_section_map): Decompress sections needed later.
1223 (Sized_relobj_file::do_decompressed_section_contents): New function.
1224 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1225 * object.h (Object::decompressed_section_contents): New function.
1226 (Object::discard_decompressed_sections): New function.
1227 (Object::do_decompressed_section_contents): New function.
1228 (Object::do_discard_decompressed_sections): New function.
1229 (Compressed_section_info): New type.
1230 (Compressed_section_map): Include decompressed section contents.
1231 (Sized_relobj_file::do_decompressed_section_contents): New function.
1232 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1233
1234 2012-02-16 Cary Coutant <ccoutant@google.com>
1235
1236 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1237 * testsuite/Makefile.in: Regenerate.
1238
1239 2012-02-14 Cary Coutant <ccoutant@google.com>
1240
1241 * options.cc (General_options::finalize): Disallow -pie and -static.
1242
1243 2012-02-03 Doug Kwan <dougkwan@google.com>
1244
1245 * arm.cc (Arm_relocate_functions::abs8,
1246 Arm_relocate_functions::abs16): Use
1247 Bits::has_signed_unsigned_overflow32.
1248 (Arm_relocate_functions::thm_abs8): Correct range of
1249 overflow check.
1250 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1251 in assertions.
1252
1253 2012-02-02 Doug Kwan <dougkwan@google.com>
1254
1255 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1256 position independent outputs, not just shared objects.
1257
1258 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1259
1260 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1261 * configure: Regenerated.
1262
1263 2012-01-27 Ian Lance Taylor <iant@google.com>
1264
1265 * reloc.h (Bits): New class with static functions, copied from
1266 namespace utils in arm.cc.
1267 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1268 instead.
1269
1270 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1271
1272 * incremental.cc (write_info_blocks): Correct relocation offset.
1273
1274 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1275
1276 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1277 (Relocate::tls_gd_to_le): Likewise.
1278
1279 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1280
1281 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1282
1283 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1284
1285 * configure.ac: Check if -mcmodel=medium works.
1286 * configure: Regenerated.
1287
1288 2012-01-24 Cary Coutant <ccoutant@google.com>
1289
1290 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1291 definition and ...
1292 (read_unsigned_LEB_128_x): ... this new function.
1293 (read_signed_LEB_128): Replaced with inline definition and ...
1294 (read_signed_LEB_128_x): ... this new function.
1295 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1296 (read_unsigned_LEB_128): Add inline definition.
1297 (read_signed_LEB_128_x): New function.
1298 (read_signed_LEB_128): Add inline definition.
1299 * testsuite/Makefile.am (leb128_unittest): New unit test.
1300 * testsuite/Makefile.in: Regenerate.
1301 * testsuite/leb128_unittest.cc: New unit test.
1302
1303 2012-01-23 Ian Lance Taylor <iant@google.com>
1304
1305 PR gold/13617
1306 * i386.cc (Target_i386::do_code_fill): When using a jmp
1307 instruction, pad with nop instructions.
1308 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1309
1310 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1311
1312 * x86_64.cc (gc_process_relocs): Add typename on types used in
1313 template.
1314 (scan_relocs): Likewise.
1315 (relocate_section): Likewise.
1316 (apply_relocation): Likewise.
1317
1318 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1319
1320 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1321 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1322 under x32.
1323
1324 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1325
1326 * x86_64.cc: Initial support for x32.
1327
1328 2012-01-03 Cary Coutant <ccoutant@google.com>
1329
1330 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1331 Use abstract base class for GOT.
1332 * gold/output.h (class Output_data_got_base): New abstract base class.
1333 (class Output_data_got): Derive from new base class, adjust ctors.
1334 (Output_data_got::reserve_slot): Make virtual; rename to
1335 do_reserve_slot; Adjust callers.
1336 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1337 pointer to abstract base class.
1338 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1339
1340 2011-12-18 Ian Lance Taylor <iant@google.com>
1341
1342 * object.h (Relobj::local_symbol_value): New function.
1343 (Relobj::local_plt_offset): New function.
1344 (Relobj::local_has_got_offset): New function.
1345 (Relobj::local_got_offset): New function.
1346 (Relobj::set_local_got_offset): New function.
1347 (Relobj::do_local_symbol_value): New pure virtual function.
1348 (Relobj::do_local_plt_offset): Likewise.
1349 (Relobj::do_local_has_got_offset): Likewise.
1350 (Relobj::do_local_got_offset): Likewise.
1351 (Relobj::do_set_local_got_offset): Likewise.
1352 (Sized_relobj::do_local_has_got_offset): Rename from
1353 local_has_got_offset.
1354 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1355 (Sized_relobj::do_set_local_got_offset): Rename from
1356 set_local_got_offset.
1357 (Sized_relobj_file::do_local_plt_offset): Rename from
1358 local_plt_offset.
1359 (Sized_relobj_file::do_local_symbol_value): New function.
1360 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1361 local_plt_offset.
1362 * output.cc (Output_data_got::Got_entry::write): Change object to
1363 Relobj. Use local_symbol_value.
1364 (Output_data_got::add_global_with_rel): Change rel_dyn to
1365 Output_data_reloc_generic*. Use add_global_generic.
1366 (Output_data_got::add_global_with_rela): Remove. Change all
1367 callers to use add_global_with_rel.
1368 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1369 Output_data_reloc_generic*. Use add_global_generic.
1370 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1371 callers to use add_global_pair_with_rel.
1372 (Output_data_got::add_local): Change object to Relobj*.
1373 (Output_data_got::add_local_plt): Likewise.
1374 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1375 change rel_dyn to Output_data_reloc_generic*. Use
1376 add_local_generic.
1377 (Output_data_got::add_local_with_rela): Remove. Change all
1378 callers to use all_local_with_rel.
1379 (Output_data_got::add_local_pair_with_rel): Change object to
1380 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1381 add_output_section_generic.
1382 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1383 callers to use add_local_pair_with_rel.
1384 (Output_data_got::reserve_local): Change object to Relobj*.
1385 * output.h: (class Output_data_reloc_generic): Add pure virtual
1386 declarations for add_global_generic, add_local_generic,
1387 add_output_section_generic.
1388 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1389 functions for Output_data_reloc_generic. Update declarations for
1390 changes listed in output.cc.
1391 (class Output_data_got): Change template parameter to got_size.
1392 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1393 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1394 function.
1395 (Sized_relobj_incr::do_local_plt_offset): New function.
1396 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1397 add_global_generic.
1398
1399 2011-12-17 Cary Coutant <ccoutant@google.com>
1400
1401 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1402 * resolve.cc (Symbol_table::resolve): Likewise.
1403 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1404 arrays.
1405 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1406
1407 2011-12-16 Ian Lance Taylor <iant@google.com>
1408
1409 * output.h (Output_data_reloc_generic::add): Only call
1410 add_dynamic_reloc if this is a dynamic reloc section.
1411
1412 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1413
1414 PR gold/13505
1415 * target-reloc.h (apply_relocation): Replace <64, false> with
1416 <size, big_endian>.
1417
1418 2011-11-25 Nick Clifton <nickc@redhat.com>
1419
1420 * po/it.po: New Italian translation.
1421
1422 2011-11-17 Sterling Augustine <saugustine@google.com>
1423
1424 * script.cc (script_include_directive): Implement.
1425 (read_script_file): New local variables name and search_path. Update
1426 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1427 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1428 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1429
1430 2011-11-11 Sterling Augustine <saugustine@google.com>
1431
1432 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1433 (file_or_sections_cmd): Likewise.
1434
1435 2011-11-11 Doug Kwan <dougkwan@google.com>
1436
1437 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1438 if --just-symbols is given.
1439
1440 2011-11-10 Doug Kwan <dougkwan@google.com>
1441
1442 PR gold/13362
1443 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1444 when processing data relocs.
1445 * reloc.h (Relocate_functions::rel_unaligned): New method.
1446 (Relocate_functions::pcrel_unaligned): Ditto.
1447 (Relocate_functions::rel32_unaligned): Ditto.
1448 (Relocate_functions::pcrel32_unaligned): Ditto.
1449
1450 2011-11-09 Doug Kwan <dougkwan@google.com>
1451
1452 PR gold/13362
1453 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1454 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1455 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1456 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1457 (Relocate_functions::rel_unaligned): New.
1458 (Relocate_functions::rel32_unaligned): New.
1459 * target-reloc.h (relocate_for_relocatable): Add code to handle
1460 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1461 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1462 arm_unaligned_reloc_r): New targets.
1463 * testsuite/Makefile.in: Regenerate.
1464 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1465 linking.
1466
1467 2011-11-02 Ian Lance Taylor <iant@google.com>
1468
1469 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1470 NATIVE_LINKER.
1471 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1472 * options.cc (General_options::finalize): Use library search path
1473 from configure script if specified. If not native and no sysroot,
1474 only search TOOLLIBDIR.
1475 * options.h (Search_directory::Search_directory): Change name to
1476 const std::string&.
1477 (General_options::add_to_library_path_with_sysroot): Change arg to
1478 const std::string&.
1479 * configure, Makefile.in, config.in: Rebuild.
1480
1481 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1482
1483 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1484 we are working around the ARM1176 Erratum.
1485 * options.h (General_options::fix_arm1176): Add option.
1486 * testsuite/Makefile.am: Add testcases, and keep current ones
1487 working.
1488 * testsuite/Makefile.in: Regenerate.
1489 * testsuite/arm_fix_1176.s: New file.
1490 * testsuite/arm_fix_1176.sh: Likewise.
1491
1492 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1493
1494 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1495 may_use_blx_.
1496 (Target_arm::may_use_blx): Remove method.
1497 (Target_arm::set_may_use_blx): Likewise.
1498 (Target_arm::may_use_v4t_interworking): New method.
1499 (Target_arm::may_use_v5t_interworking): Likewise.
1500 (Target_arm::may_use_blx_): Remove member variable.
1501 (Arm_relocate_functions::arm_branch_common): Check for v5T
1502 interworking.
1503 (Arm_relocate_functions::thumb_branch_common): Likewise.
1504 (Reloc_stub::stub_type_for_reloc): Likewise.
1505 (Target_arm::do_finalize_sections): Correct interworking checks.
1506 * testsuite/Makefile.am: Add new tests.
1507 * testsuite/Makefile.in: Regenerate.
1508 * testsuite/arm_farcall_arm_arm.s: New test.
1509 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1510 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1511 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1512 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1513 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1514 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1515 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1516
1517 2011-10-31 Cary Coutant <ccoutant@google.com>
1518
1519 PR gold/13023
1520 * expression.cc (Expression::eval_with_dot): Add
1521 is_section_dot_assignment parameter.
1522 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1523 absolute and assigning to dot within a section.
1524 * script-sections.cc
1525 (Output_section_element_assignment::set_section_addresses): Pass
1526 dot_section to set_if_absolute.
1527 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1528 as is_section_dot_assignment flag to eval_with_dot.
1529 (Output_section_element_dot_assignment::set_section_addresses):
1530 Likewise.
1531 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1532 parameter. Also set value if relative to dot_section; set the
1533 symbol's output_section.
1534 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1535 parameter. Adjust all callers.
1536 (Expression::eval_maybe_dot): Likewise.
1537 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1538 Adjust all callers.
1539 * testsuite/script_test_2.t: Test assignment of an absolute value
1540 to dot within an output section element.
1541
1542 2011-10-31 Cary Coutant <ccoutant@google.com>
1543
1544 * options.h (class General_options): Add --[no-]gnu-unique options.
1545 * symtab.cc (Symbol_table::sized_write_globals): Convert
1546 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1547
1548 2011-10-31 Cary Coutant <ccoutant@google.com>
1549
1550 PR gold/13359
1551 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1552 unnecessary assertion.
1553 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1554
1555 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1556
1557 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1558 gc_mark_symbol.
1559 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1560 gc_mark_symbol.
1561 Change to just keep the section associated with symbol.
1562 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1563 they are externally visible and --export-dynamic is turned on.
1564 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1565
1566 2011-10-19 Ian Lance Taylor <iant@google.com>
1567
1568 PR gold/13163
1569 * script-sections.cc
1570 (Output_section_element_dot_assignment::needs_output_section): New
1571 function.
1572
1573 2011-10-19 Ian Lance Taylor <iant@google.com>
1574
1575 PR gold/13204
1576 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1577 --section-start option was seen.
1578 * options.h (General_options::any_section_start): New function.
1579
1580 2011-10-18 David S. Miller <davem@davemloft.net>
1581
1582 PR binutils/13301
1583 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1584 member to track relocation locations that have moved during TLS
1585 reloc optimizations.
1586 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1587 (Target_sparc::Relocate::relocate): Adjust view down by 4
1588 bytes if it matches reloc_adjust_addr_.
1589 (Target_sparc::Relocate::relocate_tls): Always move the
1590 __tls_get_addr call delay slot instruction forward 4 bytes when
1591 performing relaxation.
1592
1593 2011-10-18 Cary Coutant <ccoutant@google.com>
1594
1595 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1596 (Output_file::map_no_anonymous): Check for non-zero
1597 return code from posix_fallocate.
1598
1599 2011-10-17 Cary Coutant <ccoutant@google.com>
1600
1601 PR gold/13245
1602 * plugin.cc (is_visible_from_outside): Check for symbols
1603 referenced from dynamic objects.
1604 * resolve.cc (Symbol_table::resolve): Don't count references
1605 from dynamic objects as references from real ELF files.
1606 * testsuite/plugin_test_2.sh: Adjust expected result.
1607
1608 2011-10-17 Cary Coutant <ccoutant@google.com>
1609
1610 * gold.cc: Include timer.h.
1611 (queue_middle_tasks): Stamp time.
1612 (queue_final_tasks): Likewise.
1613 * main.cc (main): Store timer in parameters. Print timers
1614 for each pass.
1615 * parameters.cc (Parameters::Parameters): Initialize timer_.
1616 (Parameters::set_timer): New function.
1617 (set_parameters_timer): New function.
1618 * parameters.h (Parameters::set_timer): New function.
1619 (Parameters::timer): New function.
1620 (Parameters::timer_): New data member.
1621 (set_parameters_timer): New function.
1622 * timer.cc (Timer::stamp): New function.
1623 (Timer::get_pass_time): New function.
1624 * timer.h (Timer::stamp): New function.
1625 (Timer::get_pass_time): New function.
1626 (Timer::pass_times_): New data member.
1627
1628 2011-10-17 Cary Coutant <ccoutant@google.com>
1629
1630 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1631 task for members of lib groups.
1632
1633 2011-10-17 Cary Coutant <ccoutant@google.com>
1634
1635 PR gold/13288
1636 * fileread.cc (File_read::find_view): Add assert.
1637 (File_read::make_view): Move bounds check (replace with assert)...
1638 (File_read::find_or_make_view): ... to here.
1639
1640 2011-10-12 Cary Coutant <ccoutant@google.com>
1641
1642 * output.cc (Output_file::open_base_file): Handle case where
1643 ::read returns less than requested size.
1644
1645 2011-10-10 Cary Coutant <ccoutant@google.com>
1646
1647 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1648 Initialize defined_count_.
1649 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1650 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1651 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1652 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1653 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1654 * incremental.h (Sized_relobj_incr::defined_count_): New data
1655 member.
1656 (Sized_incr_dynobj::defined_count_): New data member.
1657 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1658 Return zeroes instead of internal error.
1659
1660 2011-10-10 Cary Coutant <ccoutant@google.com>
1661
1662 PR gold/13249
1663 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1664 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1665 * output.h (class Output_reloc): Add use_plt_offset flag.
1666 (Output_reloc::type_): Adjust size of bit field.
1667 (Output_reloc::use_plt_offset_): New bit field.
1668 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1669 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1670 flag. Adjust all callers.
1671 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1672 creating RELATIVE relocations.
1673
1674 2011-10-10 Nick Clifton <nickc@redhat.com>
1675
1676 * po/es.po: Updated Spanish translation.
1677 * po/fi.po: Updated Finnish translation.
1678
1679 2011-10-03 Diego Novillo <dnovillo@google.com>
1680
1681 * options.cc (parse_uint): Fix dereference of RETVAL.
1682
1683 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1684
1685 * layout.h (section_order_map_): New member.
1686 (get_section_order_map): New member function.
1687 * output.cc (Output_section::add_input_section): Check for patterns
1688 only when --section-ordering-file is specified.
1689 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1690 output_sections have been formed.
1691 * layout.cc (Layout_Layout): Initialize section_order_map_.
1692 * plugin.cc (update_section_order): Store order in order_map. Do not
1693 update the order.
1694 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1695 * testsuite/Makefile.in: Regenerate.
1696 * testsuite/plugin_section_order.c: New file.
1697 * testsuite/plugin_final_layout.cc: New file.
1698 * testsuite/plugin_final_layout.sh: New file.
1699
1700 2011-09-29 Cary Coutant <ccoutant@google.com>
1701
1702 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1703 Check for NULL.
1704 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1705 symbols during incremental update.
1706 (Symbol_table::add_from_dynobj): Likewise.
1707
1708 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1709 Ian Lance Taylor <iant@google.com>
1710
1711 * symtab.cc (Symbol_table::define_special_symbol): Always
1712 canonicalize version string.
1713
1714 2011-09-26 Cary Coutant <ccoutant@google.com>
1715
1716 * gold.cc (queue_initial_tasks): Move option checks ...
1717 * options.cc (General_options::finalize): ... to here. Disable
1718 some options; make others fatal.
1719
1720 2011-09-26 Cary Coutant <ccoutant@google.com>
1721
1722 gcc PR lto/47247
1723 * plugin.cc (get_symbols_v2): New function.
1724 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1725 (is_referenced_from_outside): New function.
1726 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1727 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1728 (get_symbols): Pass version parameter.
1729 (get_symbols_v2): New function.
1730 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1731 parameter.
1732 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1733 (onload): Add LDPT_GET_SYMBOLS_V2.
1734 (all_symbols_read_hook): Use get_symbols_v2; check for
1735 LDPR_PREVAILING_DEF_IRONLY_EXP.
1736 * testsuite/plugin_test_3.sh: Update expected results.
1737
1738 2011-09-23 Simon Baldwin <simonb@google.com>
1739
1740 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1741 configuration options.
1742 * configure: Regenerate.
1743 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1744 * Makefile.in: Regenerate.
1745 * testsuite/Makefile.in: Regenerate.
1746
1747 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1748
1749 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1750
1751 2011-09-19 Cary Coutant <ccoutant@google.com>
1752
1753 * incremental.cc (can_incremental_update): Fix typo in comment.
1754 * incremental.h (can_incremental_update): Likewise.
1755
1756 2011-09-18 Cary Coutant <ccoutant@google.com>
1757
1758 * incremental.cc (can_incremental_update): New function.
1759 * incremental.h (can_incremental_update): New function.
1760 * layout.cc (Layout::init_fixed_output_section): Call it.
1761 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1762 * object.cc (Sized_relobj_file::do_layout): Call
1763 can_incremental_update.
1764
1765 2011-09-13 Cary Coutant <ccoutant@google.com>
1766
1767 * configure.ac: Check for glibc support for gnu_indirect_function
1768 support with static linking, setting automake conditional
1769 IFUNC_STATIC.
1770 * Makefile.in: Regenerate.
1771 * configure: Regenerate.
1772
1773 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1774 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1775 for IFUNC_STATIC.
1776 * testsuite/Makefile.in: Regenerate.
1777
1778 2011-09-13 Cary Coutant <ccoutant@google.com>
1779
1780 * incremental.cc (Sized_relobj_incr::do_layout): Call
1781 report_comdat_group for kept comdat sections.
1782 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1783 * testsuite/Makefile.in: Regenerate.
1784 * testsuite/incr_comdat_test_1.cc: New source file.
1785 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1786 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1787 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1788
1789 2011-09-13 Ian Lance Taylor <iant@google.com>
1790
1791 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1792 variable external_symbols_offset.
1793
1794 2011-09-12 Ian Lance Taylor <iant@google.com>
1795
1796 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1797 triggered if object has no symbols.
1798
1799 2011-09-09 David S. Miller <davem@davemloft.net>
1800
1801 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1802 (Output_fill_debug_line::do_write): Likewise.
1803
1804 2011-08-29 Cary Coutant <ccoutant@google.com>
1805
1806 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1807 casts to match formatting specs.
1808 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1809
1810 2011-08-26 Cary Coutant <ccoutant@google.com>
1811
1812 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1813 remaining hole size when allocating.
1814 (Layout::make_output_section): Set fill methods for debug sections.
1815 * layout.h (Free_list::Free_list_node): Move from private to
1816 public.
1817 (Free_list::set_min_hole_size): New function.
1818 (Free_list::begin, Free_list::end): New functions.
1819 (Free_list::min_hole_): New data member.
1820 * output.cc: Include dwarf.h.
1821 (Output_fill_debug_info::do_minimum_hole_size): New function.
1822 (Output_fill_debug_info::do_write): New function.
1823 (Output_fill_debug_line::do_minimum_hole_size): New function.
1824 (Output_fill_debug_line::do_write): New function.
1825 (Output_section::Output_section): Initialize new data member.
1826 (Output_section::set_final_data_size): Ensure patch space is larger
1827 than minimum hole size.
1828 (Output_section::do_write): Fill holes in debug sections.
1829 * output.h (Output_fill): New class.
1830 (Output_fill_debug_info): New class.
1831 (Output_fill_debug_line): New class.
1832 (Output_section::set_free_space_fill): New function.
1833 (Output_section::free_space_fill_): New data member.
1834 * testsuite/Makefile.am (incremental_test_3): Add
1835 --incremental-patch option.
1836 (incremental_test_4): Likewise.
1837 (incremental_test_5): Likewise.
1838 (incremental_test_6): Likewise.
1839 (incremental_copy_test): Likewise.
1840 (incremental_common_test_1): Likewise.
1841 * testsuite/Makefile.in: Regenerate.
1842
1843 2011-08-26 Nick Clifton <nickc@redhat.com>
1844
1845 * po/es.po: Updated Spanish translation.
1846
1847 2011-08-01 Cary Coutant <ccoutant@google.com>
1848
1849 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1850 * gold/testsuite/Makefile.in: Regenerate.
1851 * gold/testsuite/justsyms_exec.c: New source file.
1852 * gold/testsuite/justsyms_lib.c: New source file.
1853
1854 2011-08-01 Cary Coutant <ccoutant@google.com>
1855
1856 * layout.cc (Layout::set_segment_offsets): Don't realign text
1857 segment if -Ttext was specified.
1858 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1859 file type.
1860 * object.h (Sized_relobj_file::e_type): New function.
1861 (Sized_relobj_file::e_type_): New data member.
1862 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1863 base address for ET_EXEC files.
1864 * target.cc (Target::do_make_elf_object_implementation): Allow
1865 ET_EXEC files with --just-symbols option.
1866
1867 2011-07-28 Cary Coutant <ccoutant@google.com>
1868
1869 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1870 Add thread_number parameter.
1871 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1872 * workqueue-threads.cc
1873 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1874 current thread if its thread number is greater than desired thread
1875 count.
1876 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1877 Add thread_number parameter.
1878 (Workqueue::should_cancel_thread): Likewise.
1879 (Workqueue::find_runnable_or_wait): Pass thread_number to
1880 should_cancel_thread.
1881 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1882 parameter.
1883
1884 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1885
1886 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1887 only after checking if it cannot be forced local.
1888 * symtab.h (is_externally_visible): Check if the symbol is not forced
1889 local.
1890
1891 2011-07-15 Ian Lance Taylor <iant@google.com>
1892
1893 * options.h (class General_options): Add --print-output-format.
1894 Move -EL next to -EB, for better --help output.
1895 * target-select.cc: Include <cstdio>, "options.h", and
1896 "parameters.h".
1897 (Target_selector::do_target_bfd_name): New function.
1898 (print_output_format): New function.
1899 * target-select.h (class Target_selector): Update declarations.
1900 (Target_selector::target_bfd_name): New function.
1901 (print_output_format): Declare.
1902 * main.cc: Include "target-select.h".
1903 (main): Handle --print-output-format.
1904 * gold.cc: Include "target-select.h".
1905 (queue_initial_tasks): Handle --print-output-format when there are
1906 no input files.
1907 * parameters.cc (parameters_force_valid_target): Give a better
1908 error message if -EB/-EL does not match target.
1909 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1910 function.
1911
1912 2011-07-15 Ian Lance Taylor <iant@google.com>
1913
1914 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1915 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1916 (Output_data_plt_i386::do_write): Write address of .dynamic
1917 section to first entry in .got.plt section.
1918 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1919 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1920 Initialize layout_.
1921 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1922 section to first entry in .got.plt section.
1923 * layout.h (Layout::dynamic_section): New function.
1924
1925 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1926
1927 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1928 to claim_file call.
1929 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1930 input_section_position_, and input_section_glob_.
1931 (read_layout_from_file): Call function section_ordering_specified.
1932 * layout.h (is_section_ordering_specified): New function.
1933 (section_ordering_specified): New function.
1934 (section_ordering_specified_): New boolean member.
1935 * main.cc(main): Call load_plugins after layout object is defined.
1936 * output.cc (Output_section::add_input_section): Use
1937 function section_ordering_specified to check if section ordering is
1938 needed.
1939 * output.cc (Output_section::add_relaxed_input_section): Use
1940 function section_ordering_specified to check if section ordering is
1941 needed.
1942 (Output_section::update_section_layout): New function.
1943 (Output_section::sort_attached_input_sections): Check if input section
1944 must be reordered.
1945 * output.h (Output_section::update_section_layout): New function.
1946 * plugin.cc (get_section_count): New function.
1947 (get_section_type): New function.
1948 (get_section_name): New function.
1949 (get_section_contents): New function.
1950 (update_section_order): New function.
1951 (allow_section_ordering): New function.
1952 (Plugin::load): Add the new interfaces to the transfer vector.
1953 (Plugin_manager::load_plugins): New parameter.
1954 (Plugin_manager::all_symbols_read): New parameter.
1955 (Plugin_manager::claim_file): New parameter. Save the elf object for
1956 unclaimed objects.
1957 (Plugin_manager::get_elf_object): New function.
1958 (Plugin_manager::get_view): Change to directly use the bool to check
1959 if get_view is called from claim_file_hook.
1960 * plugin.h (input_objects): New function
1961 (Plugin__manager::load_plugins): New parameter.
1962 (Plugin_manager::claim_file): New parameter.
1963 (Plugin_manager::get_elf_object): New function.
1964 (Plugin_manager::in_claim_file_handler): New function.
1965 (Plugin_manager::in_claim_file_handler_): New member.
1966 (layout): New function.
1967 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1968 handler with an extra parameter. Make the elf object before calling
1969 claim_file handler.
1970 * testsuite/plugin_test.c (get_section_count): New function pointer.
1971 (get_section_type): New function pointer.
1972 (get_section_name): New function pointer.
1973 (get_section_contents): New function pointer.
1974 (update_section_order): New function pointer.
1975 (allow_section_ordering): New function pointer.
1976 (onload): Check if the new interfaces exist.
1977
1978 2011-07-13 Ian Lance Taylor <iant@google.com>
1979
1980 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1981 relro section.
1982 * x86_64.cc (Target_x86_64::got_section): Likewise.
1983 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1984 (relro_now_test_SOURCES): New variable.
1985 (relro_now_test_DEPENDENCIES): New variable.
1986 (relro_now_test_LDFLAGS): New variable.
1987 (relro_now_test_LDADD): New variable.
1988 (relro_now_test.so): New target.
1989 * testsuite/Makefile.in: Rebuild.
1990
1991 2011-07-12 Ian Lance Taylor <iant@google.com>
1992
1993 PR gold/12980
1994 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1995 GLOB_DAT relocation rather than a RELATIVE relocation for a
1996 protected symbol when creating a shared library.
1997 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1998 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1999 * testsuite/protected_main_1.cc (main): Test that protected
2000 function has same address.
2001
2002 2011-07-11 Ian Lance Taylor <iant@google.com>
2003
2004 PR gold/12979
2005 * options.h (class General_options): Add -Bgroup.
2006 * options.cc (General_options::finalize): If -Bgroup is set,
2007 default to --unresolved-symbols=report-all.
2008 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2009 * target-reloc.h (issue_undefined_symbol_error): Handle
2010 --unresolved-symbols=report-all.
2011
2012 2011-07-08 Ian Lance Taylor <iant@google.com>
2013
2014 PR gold/11985
2015 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2016 if linker script discards key sections.
2017 (Layout::create_dynamic_symtab): Likewise.
2018 (Layout::assign_local_dynsym_offsets): Likewise.
2019 (Layout::sized_create_version_sections): Likewise.
2020 (Layout::create_interp): Likewise.
2021 (Layout::finish_dynamic_section): Likewise.
2022 (Layout::set_dynamic_symbol_size): Likewise.
2023
2024 2011-07-08 Ian Lance Taylor <iant@google.com>
2025
2026 PR gold/12386
2027 * options.h (class General_options): Add --unresolved-symbols.
2028 * target-reloc.h (issue_undefined_symbol_error): Check
2029 --unresolved-symbols. Add comments.
2030
2031 2011-07-08 Ian Lance Taylor <iant@google.com>
2032
2033 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2034 expression more complex.
2035
2036 2011-07-08 Ian Lance Taylor <iant@google.com>
2037
2038 PR gold/11317
2039 * target-reloc.h (issue_undefined_symbol_error): New inline
2040 function, broken out of relocate_section.
2041 (relocate_section): Call issue_undefined_symbol_error.
2042 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2043 there is no TLS segment if we are about to issue an undefined
2044 symbol error.
2045 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2046
2047 2011-07-08 Ian Lance Taylor <iant@google.com>
2048
2049 PR gold/12279
2050 * resolve.cc (Symbol_table::should_override): Add fromtype
2051 parameter. Change all callers. Give error when linking together
2052 TLS and non-TLS symbol.
2053 (Symbol_table::should_override_with_special): Add fromtype
2054 parameter. Change all callers.
2055 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2056 there is no TLS segment if we have reported some errors.
2057 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2058
2059 2011-07-08 Ian Lance Taylor <iant@google.com>
2060
2061 PR gold/12372
2062 * target.h (Target::plt_address_for_global): New function.
2063 (Target::plt_address_for_local): New function.
2064 (Target::plt_section_for_global): Remove.
2065 (Target::plt_section_for_local): Remove.
2066 (Target::do_plt_address_for_global): New virtual function.
2067 (Target::do_plt_address_for_local): New virtual function.
2068 (Target::do_plt_section_for_global): Remove.
2069 (Target::do_plt_section_for_local): Remove.
2070 (Target::register_global_plt_entry): Add Symbol_table and Layout
2071 parameters.
2072 * output.cc (Output_data_got::Got_entry::write): Use
2073 plt_address_for_global and plt_address_for_local.
2074 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2075 address of output section.
2076 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2077 got_irelative_, and irelative_count_ fields. Update
2078 declarations.
2079 (Output_data_plt_i386::has_irelative_section): New function.
2080 (Output_data_plt_i386::entry_count): Add irelative_count_.
2081 (Output_data_plt_i386::set_final_data_size): Likewise.
2082 (class Target_i386): Add got_irelative_ and rel_irelative_
2083 fields. Update declarations.
2084 (Target_i386::Target_i386): Initialize new fields.
2085 (Target_i386::do_plt_address_for_global): New function replacing
2086 do_plt_section_for_global.
2087 (Target_i386::do_plt_address_for_local): New function replacing
2088 do_plt_section_for_local.
2089 (Target_i386::got_section): Create got_irelative_.
2090 (Target_i386::rel_irelative_section): New function.
2091 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2092 fields. Don't define __rel_iplt_{start,end}.
2093 (Output_data_plt_i386::add_entry): Add symtab and layout
2094 parameters. Change all callers. Use different PLT and GOT for
2095 IFUNC symbols.
2096 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2097 layout parameters. Change all callers. Use different PLT and
2098 GOT.
2099 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2100 (Output_data_plt_i386::rel_irelative): New function.
2101 (Output_data_plt_i386::address_for_global): New function.
2102 (Output_data_plt_i386::address_for_local): New function.
2103 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2104 IRELATIVE GOT when changing IFUNC GOT entries.
2105 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2106 reloc.
2107 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2108 if we didn't create an IRELATIVE GOT.
2109 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2110 plt_address_for_local.
2111 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2112 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2113 got_irelative_, and irelative_count_ fields. Update
2114 declarations.
2115 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2116 Initialize new fields. Remove symtab parameter. Change all
2117 callers.
2118 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2119 irelative_count_.
2120 (Output_data_plt_x86_64::has_irelative_section): New function.
2121 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2122 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2123 fields. Update declarations.
2124 (Target_x86_64::Target_x86_64): Initialize new fields.
2125 (Target_x86_64::do_plt_address_for_global): New function replacing
2126 do_plt_section_for_global.
2127 (Target_x86_64::do_plt_address_for_local): New function replacing
2128 do_plt_section_for_local.
2129 (Target_x86_64::got_section): Create got_irelative_.
2130 (Target_x86_64::rela_irelative_section): New function.
2131 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2132 all callers. Don't create __rel_iplt_{start,end}.
2133 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2134 parameters. Change all callers. Use different PLT and GOT for
2135 IFUNC symbols.
2136 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2137 layout parameters. Change all callers. Use different PLT and
2138 GOT.
2139 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2140 parameters. Change all callers. Use different PLT and GOT for
2141 IFUNC symbols.
2142 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2143 (Output_data_plt_x86_64::rela_irelative): New function.
2144 (Output_data_plt_x86_64::address_for_global): New function.
2145 (Output_data_plt_x86_64::address_for_local): New function.
2146 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2147 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2148 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2149 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2150 parameters.
2151 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2152 reloc.
2153 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2154 symbols if we didn't create an IRELATIVE GOT.
2155 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2156 plt_address_for_local.
2157 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2158 * testsuite/ifuncvar1.c: New test file.
2159 * testsuite/ifuncvar2.c: New test file.
2160 * testsuite/ifuncvar3.c: New test file.
2161 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2162 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2163 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2164 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2165 * testsuite/Makefile.in: Rebuild.
2166
2167 2011-07-07 Cary Coutant <ccoutant@google.com>
2168
2169 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2170 (two_file_test_1_ndebug.o): Likewise.
2171 (two_file_test_1b_ndebug.o): Likewise.
2172 (two_file_test_2_ndebug.o): Likewise.
2173 (two_file_test_main_ndebug.o): Likewise.
2174 (incremental_test_2): Link with no-debug versions.
2175
2176 2011-07-06 Cary Coutant <ccoutant@google.com>
2177
2178 * gold/incremental.cc
2179 (Output_section_incremental_inputs::write_info_blocks): Check for
2180 hidden and internal symbols.
2181
2182 2011-07-06 Cary Coutant <ccoutant@google.com>
2183
2184 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2185 Check disposition for startup file.
2186 (Incremental_inputs::report_command_line): Ignore
2187 --incremental-startup-unchanged option.
2188 * options.cc (General_options::parse_incremental_startup_unchanged):
2189 New function.
2190 (General_options::General_options): Initialize new data member.
2191 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2192 (General_options): Add --incremental-startup-unchanged option.
2193 (General_options::incremental_startup_disposition): New function.
2194 (General_options::incremental_startup_disposition_): New data member.
2195
2196 2011-07-06 Cary Coutant <ccoutant@google.com>
2197
2198 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2199 input file index to Script_info ctor.
2200 (Sized_incremental_binary::do_file_has_changed): Find the
2201 command-line argument for files named in scripts.
2202 * incremental.h (Script_info::Script_info): New ctor
2203 with input file index.
2204 (Script_info::input_file_index): New function.
2205 (Script_info::input_file_index_): New data member.
2206 (Incremental_binary::get_library): Add const.
2207 (Incremental_binary::get_script_info): Add const.
2208 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2209 * testsuite/Makefile.am (incremental_test_5): New test case.
2210 (incremental_test_6): New test case.
2211 * testsuite/Makefile.in: Regenerate.
2212
2213 2011-07-06 Cary Coutant <ccoutant@google.com>
2214
2215 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2216 debug output when command lines differ.
2217
2218 2011-07-06 Cary Coutant <ccoutant@google.com>
2219
2220 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2221 --incremental-patch option.
2222 * layout.cc (Free_list::allocate): Extend allocation beyond original
2223 end if enabled.
2224 (Layout::make_output_section): Mark sections that should get
2225 patch space.
2226 * options.cc (parse_percent): New function.
2227 * options.h (parse_percent): New function.
2228 (DEFINE_percent): New macro.
2229 (General_options): Add --incremental-patch option.
2230 * output.cc (Output_section::Output_section): Initialize new data
2231 members.
2232 (Output_section::add_input_section): Print section name when out
2233 of patch space.
2234 (Output_section::add_output_section_data): Likewise.
2235 (Output_section::set_final_data_size): Add patch space when
2236 doing --incremental-full.
2237 (Output_section::do_reset_address_and_file_offset): Remove patch
2238 space.
2239 (Output_segment::set_section_list_addresses): Print debug output
2240 only if --incremental-update.
2241 * output.h (Output_section::set_is_patch_space_allowed): New function.
2242 (Output_section::is_patch_space_allowed_): New data member.
2243 (Output_section::patch_space_): New data member.
2244 * parameters.cc (Parameters::incremental_full): New function.
2245 * parameters.h (Parameters::incremental_full): New function
2246 * testsuite/Makefile.am (incremental_test_2): Add test for
2247 --incremental-patch option.
2248 * testsuite/Makefile.in: Regenerate.
2249 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2250 (t18): Remove function body.
2251
2252 2011-07-05 Doug Kwan <dougkwan@google.com>
2253
2254 PR gold/12771
2255 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2256 Arm_Address type for relocation result.
2257 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2258 overflow check.
2259 (Arm_relocate_functions::abs32): Use unaligned access.
2260 (Arm_relocate_functions::rel32): Ditto.
2261 (Arm_relocate_functions::prel31): Ditto.
2262 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2263 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2264 static data relocations.
2265 * testsuite/Makefile.in: Regnerate.
2266 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2267
2268 2011-07-05 Ian Lance Taylor <iant@google.com>
2269
2270 PR gold/12392
2271 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2272 symbols if necessary.
2273 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2274
2275 2011-07-05 Ian Lance Taylor <iant@google.com>
2276
2277 PR gold/12952
2278 * resolve.cc (Symbol::override_base_with_special): Simply override
2279 version with special symbol version, ignoring previous version.
2280
2281 2011-07-05 Ian Lance Taylor <iant@google.com>
2282
2283 * object.cc (Sized_relobj_file::include_section_group): Add
2284 information to comment about signature location.
2285
2286 2011-07-02 Ian Lance Taylor <iant@google.com>
2287
2288 PR gold/12957
2289 * options.h (class General_options): Add -f and -F.
2290 * options.cc (General_options::finalize): Fatal error if -f/-F
2291 are used without -shared.
2292 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2293
2294 2011-07-02 Ian Lance Taylor <iant@google.com>
2295
2296 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2297
2298 2011-07-01 Ian Lance Taylor <iant@google.com>
2299
2300 PR gold/12525
2301 PR gold/12952
2302 * resolve.cc (Symbol::override_base_with_special): Don't override
2303 the version if the overriding symbol has a different name.
2304 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2305 all callers. If we give an error about an undefined version,
2306 define the base version if necessary.
2307 * dynobj.h (class Versions): Update declaration.
2308 * testsuite/weak_alias_test_5.cc: New file.
2309 * testsuite/weak_alias_test.script: New file.
2310 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2311 and versioned_alias have the right value, and call t2.
2312 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2313 weak_alias_test_5.so.
2314 (weak_alias_test_LDADD): Likewise.
2315 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2316 * testsuite/Makefile.in: Rebuild.
2317
2318 2011-07-01 Ian Lance Taylor <iant@google.com>
2319
2320 PR gold/12525
2321 * options.h (class General_options): Support -z notext.
2322 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2323 -Wl,-z,notext.
2324 (two_file_shared_nonpic.so): Likewise.
2325 (two_file_shared_mixed.so): Likewise.
2326 (two_file_shared_mixed_1.so): Likewise.
2327 (weak_undef_lib_nonpic.so): Likewise.
2328 (alt/weak_undef_lib_nonpic.so): Likewise.
2329 (tls_test_shared_nonpic.so): Likewise.
2330 * testsuite/Makefile.in: Rebuild.
2331
2332 2011-07-01 Ian Lance Taylor <iant@google.com>
2333
2334 PR gold/12525
2335 * configure.ac: Test whether static linking works, setting
2336 the automake conditional HAVE_STATIC.
2337 * testsuite/Makefile.am: Disable tests using -static if
2338 HAVE_STATIC is not true.
2339 * configure, testsuite/Makefile.in: Rebuild.
2340
2341 2011-07-01 Ian Lance Taylor <iant@google.com>
2342
2343 PR gold/12525
2344 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2345 Assert if we see DW_EH_PE_indirect.
2346 * target.h (Target::ehframe_datarel_base): New function.
2347 (Target::do_ehframe_datarel_base): New target function.
2348 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2349 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2350 function.
2351
2352 2011-07-01 Ian Lance Taylor <iant@google.com>
2353
2354 PR gold/12571
2355 * options.h (class General_options): Add
2356 --ld-generated-unwind-info.
2357 * ehframe.cc (Fde::write): Add address parameter. Change all
2358 callers. If associated with PLT, fill in address and size.
2359 (Cie::set_output_offset): Only add merge mapping if there is an
2360 object.
2361 (Cie::write): Add address parameter. Change all callers.
2362 (Eh_frame::add_ehframe_for_plt): New function.
2363 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2364 input_offset_ fields into union u_, with new plt field.
2365 (Fde::Fde): Adjust for new union field.
2366 (Fde::Fde) [Output_data version]: New constructor.
2367 (Fde::add_mapping): Only add merge mapping if there is an object.
2368 (class Cie): Update declarations.
2369 (class Eh_frame): Declare add_ehframe_for_plt.
2370 * layout.cc (Layout::layout_eh_frame): Break out code into
2371 make_eh_frame_section, and call it.
2372 (Layout::make_eh_frame_section): New function.
2373 (Layout::add_eh_frame_for_plt): New function.
2374 * layout.h (class Layout): Update declarations.
2375 * merge.cc (Merge_map::add_mapping): Add assertion.
2376 * i386.cc: Include "dwarf.h".
2377 (class Output_data_plt_i386): Make first_plt_entry,
2378 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2379 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2380 and plt_eh_frame_fde.
2381 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2382 boundary. Call add_eh_frame_for_plt if appropriate.
2383 * x86_64.cc: Include "dwarf.h".
2384 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2385 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2386 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2387 and plt_eh_frame_fde.
2388 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2389 appropriate.
2390
2391 2011-06-29 Ian Lance Taylor <iant@google.com>
2392
2393 PR gold/12629
2394 * object.cc (Sized_relobj_file::layout_section): Change shdr
2395 parameter to be const.
2396 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2397 out of do_layout.
2398 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2399 appropriate. Call layout_eh_frame_section.
2400 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2401 sections.
2402 * object.h (class Sized_relobj_file): Update declarations.
2403
2404 2011-06-29 Ian Lance Taylor <iant@google.com>
2405
2406 PR gold/12652
2407 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2408 modifier.
2409 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2410
2411 2011-06-29 Ian Lance Taylor <iant@google.com>
2412
2413 PR gold/12675
2414 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2415 SHT_X86_64_UNWIND.
2416 * layout.cc (Layout::layout_eh_frame): Likewise.
2417
2418 2011-06-29 Ian Lance Taylor <iant@google.com>
2419
2420 PR gold/12695
2421 * layout.cc (Layout::symtab_section_shndx): New function.
2422 * layout.h (class Layout): Declare symtab_section_shndx.
2423 * output.cc (Output_section::write_header): Call it.
2424
2425 2011-06-29 Ian Lance Taylor <iant@google.com>
2426
2427 PR gold/12818
2428 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2429 symbols which are not used in a relocation.
2430
2431 2011-06-28 Ian Lance Taylor <iant@google.com>
2432
2433 PR gold/12898
2434 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2435 script create indistinguishable segments.
2436 (Layout::set_segment_offsets): Use stable_sort when sorting
2437 segments. Pass this to Compare_segments constructor.
2438 * layout.h (class Layout): Make segment_precedes non-static.
2439 (class Compare_segments): Change from struct to class. Add
2440 layout_ field. Add constructor.
2441 * script-sections.cc
2442 (Script_sections::attach_sections_using_phdrs_clause): Rename
2443 local orphan to is_orphan. Don't report failure to put empty
2444 section in segment. On attachment failure, report name of
2445 section, and attach to first PT_LOAD segment.
2446
2447 2011-06-28 Ian Lance Taylor <iant@google.com>
2448
2449 PR gold/12934
2450 * target-select.cc (Target_selector::Target_selector): Add
2451 emulation parameter. Change all callers.
2452 (select_target_by_bfd_name): Rename from select_target_by_name.
2453 Change all callers.
2454 (select_target_by_emulation): New function.
2455 (supported_emulation_names): New function.
2456 * target-select.h (class Target_selector): Add emulation_ field.
2457 Update declarations.
2458 (Target_selector::recognize_by_bfd_name): Rename from
2459 recognize_by_name. Change all callers.
2460 (Target_selector::supported_bfd_names): Rename from
2461 supported_names. Change all callers.
2462 (Target_selector::recognize_by_emulation): New function.
2463 (Target_selector::supported_emulations): New function.
2464 (Target_selector::emulation): New function.
2465 (Target_selector::do_recognize_by_bfd_name): Rename from
2466 do_recognize_by_name. Change all callers.
2467 (Target_selector::do_supported_bfd_names): Rename from
2468 do_supported_names. Change all callers.
2469 (Target_selector::do_recognize_by_emulation): New function.
2470 (Target_selector::do_supported_emulations): New function.
2471 (select_target_by_bfd_name): Change name in declaration.
2472 (select_target_by_emulation): Declare.
2473 (supported_emulation_names): Declare.
2474 * parameters.cc (parameters_force_valid_target): Try to find
2475 target based on emulation from -m option.
2476 * options.h (class General_options): Change doc string for -m.
2477 * options.cc (help): Print emulations.
2478 (General_options::parse_V): Likewise.
2479 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2480 Add emulation parameter. Change all callers.
2481
2482 2011-06-28 Ian Lance Taylor <iant@google.com>
2483
2484 * target.h (class Target): Add osabi_ field.
2485 (Target::osabi): New function.
2486 (Target::set_osabi): New function.
2487 (Target::Target): Initialize osabi_.
2488 (Target::do_adjust_elf_header): Make pure virtual.
2489 (Sized_target::do_adjust_elf_header): Declare.
2490 * target.cc (Sized_target::do_adjust_elf_header): New function.
2491 (class Sized_target): Instantiate all versions.
2492 * freebsd.h (class Target_freebsd): Remove.
2493 (Target_selector_freebsd::do_recognize): Call set_osabi on
2494 Target.
2495 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2496 (Target_selector_freebsd::set_osabi): Remove.
2497 * i386.cc (class Target_i386): Inherit from Sized_target rather
2498 than Target_freebsd.
2499 * x86_64.cc (class Target_x86_64): Likewise.
2500
2501 2011-06-28 Ian Lance Taylor <iant@google.com>
2502
2503 * target.h (Target::can_check_for_function_pointers): Rewrite.
2504 Make non-virtual.
2505 (Target::can_icf_inline_merge_sections): Likewise.
2506 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2507 (Target::Target_info): Add can_icf_inline_merge_sections field.
2508 (Target::do_can_check_for_function_pointers): New virtual
2509 function.
2510 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2511 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2512 from can_check_for_function_pointers, move in file.
2513 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2514 section_may_have_icf_unsafe_poineters, move in file.
2515 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2516 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2517 Rename from can_check_for_function_pointers, move in file.
2518 (Target_i386::can_icf_inline_merge_sections): Remove.
2519 (Target_i386::i386_info): Initialize
2520 can_icf_inline_merge_sections.
2521 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2522 Initialize can_icf_inline_merge_sections.
2523 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2524 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2525 Rename from can_check_for_function_pointers, move in file.
2526 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2527 (Target_x86_64::x86_64_info): Initialize
2528 can_icf_inline_merge_sections.
2529 * testsuite/testfile.cc (Target_test::test_target_info):
2530 Likewise.
2531 * icf.cc (get_section_contents): Correct formatting.
2532
2533 2011-06-27 Ian Lance Taylor <iant@google.com>
2534
2535 * symtab.cc (Symbol::versioned_name): New function.
2536 (Symbol_table::add_to_final_symtab): Use versioned_name when
2537 appropriate.
2538 (Symbol_table::sized_write_symbol): Likewise.
2539 * symtab.h (class Symbol): Declare versioned_name.
2540 * stringpool.h (class Stringpool_template): Add variant of add
2541 which takes a std::basic_string.
2542 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2543 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2544 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2545 (ver_test_12.o): New target.
2546 * testsuite/Makefile.in: Rebuild.
2547
2548 2011-06-27 Doug Kwan <dougkwan@google.com>
2549
2550 * arm.cc (Arm_relocate_functions::thm_jump8,
2551 Arm_relocate_functions::thm_jump11): Use a wider signed
2552 type to compute offset.
2553 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2554 arm_thm_jump8.
2555 * testsuite/Makefile.in: Regenerate.
2556 * testsuite/arm_branch_in_range.sh: Check test results of
2557 arm_thm_jump11 and arm_thm_jump8.
2558 * testsuite/arm_thm_jump11.s: New test source file.
2559 * testsuite/arm_thm_jump11.t: New linker script.
2560 * testsuite/arm_thm_jump8.s: New test source file.
2561 * testsuite/arm_thm_jump8.t: New linker script.
2562
2563 2011-06-24 Ian Lance Taylor <iant@google.com>
2564
2565 * layout.cc: Include "object.h".
2566 (ctors_sections_in_init_array): New static variable.
2567 (Layout::is_ctors_in_init_array): New function.
2568 (Layout::layout): Add entry to ctors_sections_in_init_array if
2569 appropriate.
2570 * layout.h (class Layout): Declare is_ctors_in_init_array.
2571 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2572 is_ctors_reverse_view is set.
2573 (Sized_relobj_file::write_sections): Add layout parameter. Change
2574 all callers. Set is_ctors_reverse_view field of View_size.
2575 (Sized_relobj_file::reverse_words): New function.
2576 * object.h (Sized_relobj_file::View_size): Add
2577 is_ctors_reverse_view field.
2578 (class Sized_relobj_file): Update declarations.
2579 * testsuite/initpri3.c: New test.
2580 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2581 initpri3b.
2582 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2583 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2584 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2585 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2586 * testsuite/Makefile.in: Rebuild.
2587
2588 2011-06-24 Cary Coutant <ccoutant@google.com>
2589
2590 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2591 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2592 (debug_msg_cdebug.err): New targets.
2593 * testsuite/Makefile.in: Regenerate.
2594 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2595 Fix checks for link with shared library.
2596
2597 2011-06-24 Doug Kwan <dougkwan@google.com>
2598
2599 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2600 skip empty text sections.
2601 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2602
2603 2011-06-22 Ian Lance Taylor <iant@google.com>
2604
2605 PR gold/12910
2606 * options.h (class General_options): Add --ctors-in-init-array.
2607 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2608 friends as SHT_PROGBITS for merging sections.
2609 (Layout::layout): Remove special handling of .init_array and
2610 friends. Don't sort if doing relocatable link. Sort for .ctors
2611 and .dtors if ctors_in_init_array.
2612 (Layout::make_output_section): Force correct section types for
2613 .init_array and friends. Don't sort if doing relocatable link,
2614 Don't sort .ctors and .dtors if ctors_in_init_array.
2615 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2616 (Layout::output_section_name): Add relobj parameter. Change all
2617 callers. Handle .ctors. and .dtors. in code rather than table.
2618 Handle .ctors and .dtors if ctors_in_init_array.
2619 (Layout::match_file_name): New function, moved from output.cc.
2620 * layout.h (class Layout): Update declarations.
2621 * output.cc: Include "layout.h".
2622 (Input_section_sort_entry::get_priority): New function.
2623 (Input_section_sort_entry::match_file_name): Just call
2624 Layout::match_file_name.
2625 (Output_section::Input_section_sort_init_fini_compare::operator()):
2626 Handle .ctors and .dtors. Sort by explicit priority rather than
2627 by name.
2628 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2629 * testsuite/initpri2.c: New test.
2630 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2631 (check_PROGRAMS): Add initpri2.
2632 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2633 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2634 * configure, testsuite/Makefile.in: Rebuild.
2635
2636 2011-06-19 Ian Lance Taylor <iant@google.com>
2637
2638 PR gold/12880
2639 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2640 .interp section to a PT_INTERP segment even if we have seen a
2641 --dynamic-linker option. Don't do it if we have seen a PHDRS
2642 clause in a linker script.
2643 (Layout::finalize): Don't create a .interp section if we've
2644 already create a PT_INTERP segment.
2645 (Layout::create_interp): Always call choose_output_section (revert
2646 patch of 2011-06-17). Don't create PT_INTERP segment.
2647 * script-sections.cc
2648 (Script_sections::create_note_and_tls_segments): Add a .interp
2649 section to a PT_INTERP segment even if we have seen a
2650 --dynamic-linker option.
2651
2652 2011-06-18 Ian Lance Taylor <iant@google.com>
2653
2654 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2655 merely because a non-PT_LOAD segment has a dynamic reloc.
2656
2657 2011-06-18 Ian Lance Taylor <iant@google.com>
2658
2659 * layout.cc (Layout::finish_dynamic_section): Don't create
2660 DT_FLAGS entry if not needed.
2661
2662 2011-06-18 Ian Lance Taylor <iant@google.com>
2663
2664 PR gold/12745
2665 * layout.cc (Layout::layout_eh_frame): Correct handling of
2666 writable .eh_frame section.
2667
2668 2011-06-17 Ian Lance Taylor <iant@google.com>
2669
2670 PR gold/12893
2671 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2672 symbol is redefined with the exact same object and value.
2673
2674 2011-06-17 Ian Lance Taylor <iant@google.com>
2675
2676 PR gold/12880
2677 * layout.h (class Layout): Add interp_segment_ field.
2678 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2679 (Layout::attach_allocated_section_to_segment): If making shared
2680 library, put .interp section in PT_INTERP segment.
2681 (Layout::finalize): Also call create_interp if -dynamic-linker
2682 option was used.
2683 (Layout::create_interp): Assert that there is no PT_INTERP
2684 segment. If not using a SECTIONS clause, use make_output_section.
2685 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2686 * script-sections.cc
2687 (Script_sections::create_note_and_tls_segments): If making shared
2688 library, put .interp section in PT_INTERP segment.
2689
2690 2011-06-17 Ian Lance Taylor <iant@google.com>
2691
2692 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2693 when making a shared library.
2694
2695 2011-06-17 Ian Lance Taylor <iant@google.com>
2696
2697 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2698 parameter. Change all callers. Don't issue warning about PC32
2699 against locally defined symbol.
2700
2701 2011-06-16 Ian Lance Taylor <iant@google.com>
2702
2703 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2704 occurs in same object.
2705
2706 2011-06-14 Alan Modra <amodra@gmail.com>
2707
2708 * po/POTFILES.in: Regenerate.
2709
2710 2011-06-09 Ian Lance Taylor <iant@google.com>
2711
2712 * script-sections.cc
2713 (Orphan_output_section::set_section_addresses): For a relocatable
2714 link set address to 0.
2715
2716 2011-06-09 Cary Coutant <ccoutant@google.com>
2717
2718 PR gold/12804
2719 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2720 used with --compress-debug-sections.
2721 * gold/object.cc (Sized_relobj_file::do_layout): Report
2722 uncompressed size of compressed input sections.
2723
2724 2011-06-08 Cary Coutant <ccoutant@google.com>
2725
2726 PR gold/12804
2727 * testsuite/two_file_test_2_v1.cc: Change initialization of
2728 v2 to keep it in .data.
2729
2730 2011-06-07 Cary Coutant <ccoutant@google.com>
2731
2732 * common.cc (Symbol_table::do_allocate_commons_list): Call
2733 gold_fallback.
2734 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2735 (Errors::fallback): New function.
2736 (gold_fallback): New function.
2737 * errors.h (Errors::fallback): New function.
2738 * gold.cc (gold_exit): Change status parameter to enum; adjust
2739 all callers.
2740 (queue_initial_tasks): Call gold_fallback.
2741 * gold.h: Include cstdlib.
2742 (Exit_status): New enum type.
2743 (gold_exit): Change status parameter to enum.
2744 (gold_fallback): New function.
2745 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2746 (Layout::create_symtab_sections): Likewise.
2747 (Layout::create_shdrs): Likewise.
2748 * main.cc (main): Adjust call to gold_exit.
2749 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2750 (Output_data_got::add_got_entry_pair): Likewise.
2751 (Output_section::add_input_section): Likewise.
2752 (Output_section::add_output_section_data): Likewise.
2753 (Output_segment::set_section_list_addresses): Likewise.
2754 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2755
2756 2011-06-07 Cary Coutant <ccoutant@google.com>
2757
2758 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2759 for incremental links.
2760 * output.cc (Output_segment::set_section_list_addresses): Remove
2761 FIXME and test for TLS or BSS.
2762
2763 2011-06-07 Cary Coutant <ccoutant@google.com>
2764
2765 * testsuite/Makefile.am: Add incremental_copy_test,
2766 incremental_common_test_1.
2767 * testsuite/Makefile.in: Regenerate.
2768 * testsuite/common_test_1_v1.c: New source file.
2769 * testsuite/common_test_1_v2.c: New source file.
2770 * testsuite/copy_test_v1.cc: New source file.
2771
2772 2011-06-07 Cary Coutant <ccoutant@google.com>
2773
2774 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2775 update, allocate common from bss section's free list.
2776 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2777 linker-defined symbols.
2778 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2779 Skip GOT and PLT entries that are no longer referenced.
2780 (Output_section_incremental_inputs::write_info_blocks): Mark
2781 linker-defined symbols.
2782 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2783 * output.cc (Output_section::allocate): New function.
2784 * output.h (Output_section::allocate): New function.
2785 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2786 linker-defined symbols.
2787 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2788 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2789 (Symbol::init_base_output_data): Likewise.
2790 (Symbol::init_base_output_segment): Likewise.
2791 (Symbol::init_base_constant): Likewise.
2792 (Sized_symbol::init_output_data): Likewise.
2793 (Sized_symbol::init_output_segment): Likewise.
2794 (Sized_symbol::init_constant): Likewise.
2795 (Symbol_table::do_define_in_output_data): Likewise.
2796 (Symbol_table::do_define_in_output_segment): Likewise.
2797 (Symbol_table::do_define_as_constant): Likewise.
2798 * symtab.h (Symbol::is_predefined): New function.
2799 (Symbol::init_base_output_data): Add is_predefined parameter.
2800 (Symbol::init_base_output_segment): Likewise.
2801 (Symbol::init_base_constant): Likewise.
2802 (Symbol::is_predefined_): New data member.
2803 (Sized_symbol::init_output_data): Add is_predefined parameter.
2804 (Sized_symbol::init_output_segment): Likewise.
2805 (Sized_symbol::init_constant): Likewise.
2806 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2807
2808 2011-06-07 Cary Coutant <ccoutant@google.com>
2809
2810 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2811 instead of emit_copy_reloc.
2812 (Copy_relocs::emit_copy_reloc): Refactor.
2813 (Copy_relocs::make_copy_reloc): New function.
2814 (Copy_relocs::add_copy_reloc): Remove.
2815 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2816 section.
2817 (Copy_relocs::make_copy_reloc): New function.
2818 (Copy_relocs::add_copy_reloc): Remove.
2819 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2820 unchanged input files.
2821 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2822 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2823 Reserve BSS space for COPY relocations.
2824 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2825 (Output_section_incremental_inputs::write_info_blocks): Record
2826 whether a symbol is copied from a shared object.
2827 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2828 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2829 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2830 (Incremental_input_entry_reader::get_output_symbol_index): Add
2831 is_copy parameter.
2832 (Incremental_binary::emit_copy_relocs): New function.
2833 (Incremental_binary::do_emit_copy_relocs): New function.
2834 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2835 new data member.
2836 (Sized_incremental_binary::add_copy_reloc): New function.
2837 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2838 (Sized_incremental_binary::Copy_reloc): New struct.
2839 (Sized_incremental_binary::Copy_relocs): New typedef.
2840 (Sized_incremental_binary::copy_relocs_): New data member.
2841 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2842 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2843 * target.h (Sized_target::emit_copy_reloc): New function.
2844 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2845
2846 2011-06-02 Cary Coutant <ccoutant@google.com>
2847
2848 PR gold/12163
2849 * gold/archive.cc (Archive::Archive): Initialize new data member.
2850 (Archive::include_all_members): Return if archive has already been
2851 included.
2852 * gold/archive.h (Archive::include_all_members_): New data member.
2853
2854 2011-06-02 Nick Clifton <nickc@redhat.com>
2855
2856 * dynobj.h: Fix spelling mistake in comment.
2857 * output.cc: Likewise.
2858
2859 2011-05-31 Doug Kwan <dougkwan@google.com>
2860 Asier Llano
2861
2862 PR gold/12826
2863 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2864 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2865 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2866 redundant arm_exidx_test.so.
2867 * testsuite/Makefile.in: Regenerate.
2868 (check_SCRIPTS): Add pr12826.sh
2869 (check_DATA): Add pr12826.stdout
2870 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2871 * testsuite/pr12826.sh: New file.
2872 * testsuite/pr12826_1.s: Ditto.
2873 * testsuite/pr12826_1.s: Ditto.
2874
2875 2011-05-30 Ian Lance Taylor <iant@google.com>
2876
2877 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2878 sections.
2879
2880 2011-05-29 Ian Lance Taylor <iant@google.com>
2881
2882 PR gold/12804
2883 * testsuite/Makefile.am: Use different file name for two_file_test
2884 temporary file for each incremental test.
2885 * testsuite/Makefile.in: Rebuild.
2886
2887 2011-05-29 Ian Lance Taylor <iant@google.com>
2888
2889 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2890 binary input file is empty.
2891
2892 2011-05-27 Ian Lance Taylor <iant@google.com>
2893
2894 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2895 (ver_test_9.so): Likewise.
2896 * testsuite/Makefile.in: Rebuild.
2897
2898 2011-05-26 Cary Coutant <ccoutant@google.com>
2899
2900 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2901 * incremental.cc (Incremental_inputs::report_input_section): Fix
2902 comment, indentation.
2903 (Incremental_inputs::report_comdat_group): New function.
2904 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2905 of data for incremental input file entry.
2906 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2907 group count, COMDAT group signatures.
2908 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2909 an unchanged input file.
2910 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2911 Initialize new data member.
2912 (Incremental_object_entry::add_comdat_group): New function.
2913 (Incremental_object_entry::get_comdat_group_count): New function.
2914 (Incremental_object_entry::get_comdat_signature_key): New function.
2915 (Incremental_object_entry::groups_): New data member.
2916 (Incremental_inputs::report_comdat_group): New function.
2917 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2918 data for incremental input file entry.
2919 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2920 (Incremental_input_entry_reader::get_input_section): Adjust size of
2921 data for incremental input file entry.
2922 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2923 (Incremental_input_entry_reader::get_comdat_group_signature): New
2924 function.
2925 * object.cc (Sized_relobj::include_section_group): Report kept
2926 COMDAT groups for incremental links.
2927
2928 2011-05-24 David Meyer <pdox@google.com>
2929
2930 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2931 with name parameter. Add found_name parameter.
2932 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2933 * dirsearch.h (class Dirsearch): Update declaration.
2934
2935 2011-05-24 Ian Lance Taylor <iant@google.com>
2936
2937 * archive.cc (Library_base::should_include_member): Pull in object
2938 from archive if it defines the entry symbol.
2939 * parameters.cc (Parameters::entry): New function.
2940 * parameters.h (class Parameters): Declare entry.
2941 * output.h (class Output_file_header): Remove entry_ field.
2942 * output.cc (Output_file_header::Output_file_header): Remove entry
2943 parameter. Change all callers.
2944 (Output_file_header::entry): Use parameters->entry.
2945 * gold.cc (queue_middle_tasks): Likewise.
2946 * plugin.cc (Plugin_hook::run): Likewise.
2947
2948 2011-05-24 Cary Coutant <ccoutant@google.com>
2949
2950 * gold.cc (queue_initial_tasks): Pass incremental base filename
2951 to Output_file::open_base_file; don't print error message.
2952 * incremental-dump.cc (main): Adjust call to
2953 Output_file::open_for_modification.
2954 * incremental-dump.cc (main): Likewise.
2955 * incremental.cc (Incremental_inputs::report_command_line):
2956 Ignore --incremental-base option when comparing command lines.
2957 Ignore parameter when given as separate argument.
2958 * options.h (class General_options): Add --incremental-base.
2959 * output.cc (Output_file::Output_file):
2960 (Output_file::open_base_file): Add base_name and writable parameters;
2961 read base file into new file; print error message here.
2962 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2963 callers.
2964 * output.h (Output_file::open_for_modification): Rename to...
2965 (Output_file::open_base_file): ...this; add base_name and
2966 writable parameters; adjust all callers.
2967 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2968 callers.
2969 * testsuite/Makefile.am (incremental_test_4): Test
2970 --incremental-base.
2971 * testsuite/Makefile.in: Regenerate.
2972
2973 2011-05-24 Cary Coutant <ccoutant@google.com>
2974
2975 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2976 incremental_test_4.
2977 * testsuite/Makefile.in: Regenerate.
2978 * testsuite/two_file_test_1_v1.cc: New test source file.
2979 * testsuite/two_file_test_1b_v1.cc: New test source file.
2980 * testsuite/two_file_test_2_v1.cc: New test source file.
2981
2982 2011-05-24 Cary Coutant <ccoutant@google.com>
2983
2984 * dynobj.h (Dynobj::do_dynobj): New function.
2985 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2986 flag and soname for shared objects.
2987 * incremental.cc (Incremental_inputs::report_object): Make
2988 either Incremental_object_entry or Incremental_dynobj_entry; add
2989 soname to string table.
2990 (Incremental_inputs::report_input_section): Add assertion.
2991 (Output_section_incremental_inputs::set_final_data_size): Adjust
2992 type of input file entry for shared libraries; adjust size of
2993 shared library info entry.
2994 (Output_section_incremental_inputs::write_input_files): Write
2995 as_needed flag for shared libraries.
2996 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2997 of input file entry for shared libraries; write soname.
2998 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2999 soname from incremental info.
3000 * incremental.h (enum Incremental_input_flags): Add
3001 INCREMENTAL_INPUT_AS_NEEDED.
3002 (Incremental_input_entry::Incremental_input_entry): Initialize new
3003 data member.
3004 (Incremental_input_entry::set_as_needed): New function.
3005 (Incremental_input_entry::as_needed): New function.
3006 (Incremental_input_entry::do_dynobj_entry): New function.
3007 (Incremental_input_entry::as_needed_): New data member.
3008 (Incremental_object_entry::Incremental_object_entry): Don't check
3009 for shared library.
3010 (Incremental_object_entry::do_type): Likewise.
3011 (class Incremental_dynobj_entry): New class.
3012 (Incremental_input_entry_reader::as_needed): New function.
3013 (Incremental_input_entry_reader::get_soname): New function.
3014 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3015 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3016 size of shared library info entry.
3017 * layout.cc (Layout::finish_dynamic_section): Don't test for
3018 incremental link when adding DT_NEEDED entries.
3019 * object.h (Object::Object): Initialize new data member.
3020 (Object::dynobj): New function.
3021 (Object::set_as_needed): New function.
3022 (Object::as_needed): New function.
3023 (Object::do_dynobj): New function.
3024 (Object::as_needed_): New data member.
3025
3026 2011-05-24 Cary Coutant <ccoutant@google.com>
3027
3028 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3029 info; adjust display of GOT entries.
3030 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3031 vector of input objects; remove file_status_.
3032 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3033 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3034 got_plt reader; call target hooks to reserve GOT entries.
3035 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3036 of input file info header and GOT info entry.
3037 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3038 relocation info.
3039 (Got_plt_view_info::got_descriptor): Remove.
3040 (Got_plt_view_info::sym_index): New data member.
3041 (Got_plt_view_info::input_index): New data member.
3042 (Local_got_offset_visitor::visit): Write input file index.
3043 (Global_got_offset_visitor::visit): Write 0 for input file index.
3044 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3045 with sym_index and input_index.
3046 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3047 incremental info GOT entry; replace got_descriptor with input_index.
3048 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3049 map from input file index to object.
3050 (Sized_relobj_incr::do_layout): Replace direct data member reference
3051 with accessor function.
3052 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3053 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3054 Adjust size of input file info header.
3055 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3056 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3057 (Incremental_input_entry_reader::get_input_section): Adjust size of
3058 input file info header.
3059 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3060 of incremental info GOT entry.
3061 (Incremental_got_plt_reader::get_got_desc): Remove.
3062 (Incremental_got_plt_reader::get_got_symndx): New function.
3063 (Incremental_got_plt_reader::get_got_input_index): New function.
3064 (Sized_incremental_binary::Sized_incremental_binary): Remove
3065 file_status_; add input_objects_.
3066 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3067 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3068 (Sized_incremental_binary::file_is_unchanged): Remove.
3069 (Sized_incremental_binary::set_input_object): New function.
3070 (Sized_incremental_binary::input_object): New function.
3071 (Sized_incremental_binary::file_status_): Remove.
3072 (Sized_incremental_binary::input_objects_): New data member.
3073 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3074 references.
3075 (Sized_relobj_incr::invalid_address): Move to base class.
3076 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3077 class.
3078 (Sized_relobj_incr::do_output_section_offset): Likewise.
3079 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3080 (Sized_relobj_incr::section_offsets_): Likewise.
3081 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3082 function.
3083 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3084 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3085 with accessor function.
3086 (Sized_relobj_file::do_layout): Likewise.
3087 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3088 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3089 (Sized_relobj_file::compute_final_local_value): Replace refs to
3090 section_offsets_ with accessor function.
3091 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3092 * object.h (Relobj::Relobj): Initialize new data members.
3093 (Relobj::add_dyn_reloc): New function.
3094 (Relobj::first_dyn_reloc): New function.
3095 (Relobj::dyn_reloc_count): New function.
3096 (Relobj::first_dyn_reloc_): New data member.
3097 (Relobj::dyn_reloc_count_): New data member.
3098 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3099 references.
3100 (Sized_relobj::Address): New typedef.
3101 (Sized_relobj::invalid_address): Move here from child class.
3102 (Sized_relobj::Sized_relobj): Initialize new data members.
3103 (Sized_relobj::sized_relobj): New function.
3104 (Sized_relobj::is_output_section_offset_invalid): Move here from
3105 child class.
3106 (Sized_relobj::get_output_section_offset): Likewise.
3107 (Sized_relobj::local_has_got_offset): Likewise.
3108 (Sized_relobj::local_got_offset): Likewise.
3109 (Sized_relobj::set_local_got_offset): Likewise.
3110 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3111 (Sized_relobj::clear_got_offsets): New function.
3112 (Sized_relobj::section_offsets): Move here from child class.
3113 (Sized_relobj::do_output_section_offset): Likewise.
3114 (Sized_relobj::do_set_section_offset): Likewise.
3115 (Sized_relobj::Local_got_offsets): Likewise.
3116 (Sized_relobj::local_got_offsets_): Likewise.
3117 (Sized_relobj::section_offsets_): Likewise.
3118 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3119 references.
3120 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3121 class.
3122 (Sized_relobj_file::sized_relobj): New function
3123 (Sized_relobj_file::local_has_got_offset): Move to base class.
3124 (Sized_relobj_file::local_got_offset): Likewise.
3125 (Sized_relobj_file::set_local_got_offset): Likewise.
3126 (Sized_relobj_file::get_output_section_offset): Likewise.
3127 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3128 (Sized_relobj_file::do_output_section_offset): Likewise.
3129 (Sized_relobj_file::do_set_section_offset): Likewise.
3130 (Sized_relobj_file::Local_got_offsets): Likewise.
3131 (Sized_relobj_file::local_got_offsets_): Likewise.
3132 (Sized_relobj_file::section_offsets_): Likewise.
3133 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3134 (all constructors).
3135 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3136 (Output_reloc::get_symbol_index): Likewise.
3137 (Output_reloc::local_section_offset): Likewise.
3138 (Output_reloc::get_address): Likewise.
3139 (Output_reloc::symbol_value): Likewise.
3140 (Output_data_got::reserve_slot): Move to class definition.
3141 (Output_data_got::reserve_local): New function.
3142 (Output_data_got::reserve_slot_for_global): Remove.
3143 (Output_data_got::reserve_global): New function.
3144 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3145 (all constructors, two instantiations).
3146 (Output_reloc::get_relobj): New function (two instantiations).
3147 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3148 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3149 (Output_data_reloc::add_global): Adjust type of relobj.
3150 (Output_data_reloc::add_global_relative): Likewise.
3151 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3152 (Output_data_reloc::add_local): Likewise.
3153 (Output_data_reloc::add_local_relative): Likewise.
3154 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3155 (Output_data_reloc::add_local_section): Likewise.
3156 (Output_data_reloc::add_output_section): Likewise.
3157 (Output_data_reloc::add_absolute): Likewise.
3158 (Output_data_reloc::add_target_specific): Likewise.
3159 (Output_data_got::reserve_slot): Move definition here.
3160 (Output_data_got::reserve_local): New function.
3161 (Output_data_got::reserve_global): New function.
3162 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3163 section_offsets_ with accessor function.
3164 (Sized_relobj_file::write_sections): Likewise.
3165 (Sized_relobj_file::do_relocate_sections): Likewise.
3166 * target.h (Sized_target::reserve_local_got_entry): New function.
3167 (Sized_target::reserve_global_got_entry): New function.
3168 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3169 (Target_x86_64::reserve_global_got_entry): New function.
3170 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3171
3172 2011-05-23 Cary Coutant <ccoutant@google.com>
3173
3174 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3175 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3176 bit when checking got_type.
3177 * incremental.cc (Sized_incremental_binary::setup_readers):
3178 Store symbol table and string table locations; initialize bit vector
3179 of file status flags.
3180 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3181 unchanged files.
3182 (Sized_incremental_binary::do_process_got_plt): New function.
3183 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3184 (Output_section_incremental_inputs::set_final_data_size): Record
3185 file index for each input file.
3186 (Output_section_incremental_inputs::write_got_plt): Store file index
3187 instead of input entry offset for each GOT entry.
3188 * incremental.h
3189 (Incremental_input_entry::Incremental_input_entry): Initialize new
3190 data member.
3191 (Incremental_input_entry::set_offset): Store file index.
3192 (Incremental_input_entry::get_file_index): New function.
3193 (Incremental_input_entry::file_index_): New data member.
3194 (Incremental_binary::process_got_plt): New function.
3195 (Incremental_binary::do_process_got_plt): New function.
3196 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3197 data members.
3198 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3199 (Sized_incremental_binary::set_file_is_unchanged): New function.
3200 (Sized_incremental_binary::file_is_unchanged): New function.
3201 (Sized_incremental_binary::do_process_got_plt): New function.
3202 (Sized_incremental_binary::file_status_): New data member.
3203 (Sized_incremental_binary::main_symtab_loc_): New data member.
3204 (Sized_incremental_binary::main_strtab_loc_): New data member.
3205 * output.cc (Output_data_got::Got_entry::write): Add case
3206 RESERVED_CODE.
3207 (Output_data_got::add_global): Call add_got_entry.
3208 (Output_data_got::add_global_plt): Likewise.
3209 (Output_data_got::add_global_with_rel): Likewise.
3210 (Output_data_got::add_global_with_rela): Likewise.
3211 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3212 (Output_data_got::add_global_pair_with_rela): Likewise.
3213 (Output_data_got::add_local): Call add_got_entry.
3214 (Output_data_got::add_local_plt): Likewise.
3215 (Output_data_got::add_local_with_rel): Likewise.
3216 (Output_data_got::add_local_with_rela): Likewise.
3217 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3218 (Output_data_got::add_local_pair_with_rela): Likewise.
3219 (Output_data_got::reserve_slot): New function.
3220 (Output_data_got::reserve_slot_for_global): New function.
3221 (Output_data_got::add_got_entry): New function.
3222 (Output_data_got::add_got_entry_pair): New function.
3223 (Output_section::add_output_section_data): Edit FIXME.
3224 * output.h
3225 (Output_section_data_build::Output_section_data_build): New
3226 constructor with size parameter.
3227 (Output_data_space::Output_data_space): Likewise.
3228 (Output_data_got::Output_data_got): Initialize new data member; new
3229 constructor with size parameter.
3230 (Output_data_got::add_constant): Call add_got_entry.
3231 (Output_data_got::reserve_slot): New function.
3232 (Output_data_got::reserve_slot_for_global): New function.
3233 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3234 (Output_data_got::add_got_entry): New function.
3235 (Output_data_got::add_got_entry_pair): New function.
3236 (Output_data_got::free_list_): New data member.
3237 * target.h (Sized_target::init_got_plt_for_update): New function.
3238 (Sized_target::register_global_plt_entry): New function.
3239 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3240 Initialize new data member; call init; add constructor with PLT count.
3241 (Output_data_plt_x86_64::init): New function.
3242 (Output_data_plt_x86_64::add_relocation): New function.
3243 (Output_data_plt_x86_64::reserve_slot): New function.
3244 (Output_data_plt_x86_64::free_list_): New data member.
3245 (Target_x86_64::init_got_plt_for_update): New function.
3246 (Target_x86_64::register_global_plt_entry): New function.
3247 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3248 incremental updates.
3249 (Output_data_plt_x86_64::add_relocation): New function.
3250 * testsuite/object_unittest.cc (Object_test): Set default options.
3251
3252 2011-05-16 Ian Lance Taylor <iant@google.com>
3253
3254 * options.h (class General_options): Make -i a synonym for -r.
3255
3256 2011-05-16 Ian Lance Taylor <iant@google.com>
3257
3258 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3259
3260 2011-05-10 Cary Coutant <ccoutant@google.com>
3261
3262 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3263 strip_all (-s).
3264
3265 2011-05-06 Ian Lance Taylor <iant@google.com>
3266
3267 * layout.cc (Layout::layout): If the output section flags change,
3268 update the ordering.
3269
3270 2011-04-25 Cary Coutant <ccoutant@google.com>
3271
3272 * incremental-dump.cc (dump_incremental_inputs): Print local
3273 symbol info for each input file.
3274 * incremental.cc
3275 (Output_section_incremental_inputs::set_final_data_size): Add local
3276 symbol info to input file entries in incremental info.
3277 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3278 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3279 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3280 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3281 implementation.
3282 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3283 (Sized_incr_relobj::do_relocate): Write the local symbols.
3284 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3285 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3286 Adjust size of input file header.
3287 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3288 (Incremental_inputs_reader::get_local_symbol_count): New function.
3289 (Incremental_inputs_reader::get_input_section): Adjust size of input
3290 file header.
3291 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3292 (Sized_incr_relobj::This): New typedef.
3293 (Sized_incr_relobj::sym_size): New const data member.
3294 (Sized_incr_relobj::Local_symbol): New struct.
3295 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3296 (Sized_incr_relobj::do_local_symbol_offset): New function.
3297 (Sized_incr_relobj::local_symbol_count_): New data member.
3298 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3299 (Sized_incr_relobj::local_symbol_index_): New data member.
3300 (Sized_incr_relobj::local_symbol_offset_): New data member.
3301 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3302 (Sized_incr_relobj::local_symbols_): New data member.
3303 * object.h (Relobj::output_local_symbol_count): New function.
3304 (Relobj::local_symbol_offset): New function.
3305 (Relobj::do_output_local_symbol_count): New function.
3306 (Relobj::do_local_symbol_offset): New function.
3307 (Sized_relobj::do_output_local_symbol_count): New function.
3308 (Sized_relobj::do_local_symbol_offset): New function.
3309
3310 2011-04-22 Vladimir Simonov <sv@sw.ru>
3311
3312 * descriptors.cc (set_close_on_exec): New function.
3313 (Descriptors::open): Use set_close_on_exec.
3314 * output.cc (S_ISLNK): Define if not defined.
3315
3316 2011-04-22 Cary Coutant <ccoutant@google.com>
3317
3318 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3319 global symbol map.
3320 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3321 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3322 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3323 relocations.
3324 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3325 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3326 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3327 * incremental.h
3328 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3329 function.
3330 (Incremental_binary::apply_incremental_relocs): New function.
3331 (Incremental_binary::do_apply_incremental_relocs): New function.
3332 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3333 data member.
3334 (Sized_incremental_binary::add_global_symbol): New function.
3335 (Sized_incremental_binary::global_symbol): New function.
3336 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3337 (Sized_incremental_binary::symbol_map_): New data member.
3338 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3339 * target.h (Sized_target::apply_relocation): New function.
3340 * target-reloc.h (apply_relocation): New function.
3341 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3342
3343 2011-04-22 Doug Kwan <dougkwan@google.com>
3344
3345 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3346 flag of a SHT_ARM_EXIDX section.
3347 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3348 * testsuite/Makefile.in: Regenerate.
3349 * testsuite/arm_exidx_test.s: New file.
3350 * testsuite/arm_exidx_test.sh: Same.
3351
3352 2011-04-20 Cary Coutant <ccoutant@google.com>
3353
3354 PR gold/12689
3355 * archive.h (Incremental_archive_entry::Archive_member):
3356 Initialize arg_serial_ (second constructor).
3357
3358 2011-04-17 Ian Lance Taylor <iant@google.com>
3359
3360 * object.cc (Relocate_info::location): Simplify location string.
3361 * errors.cc (Errors::error_at_location): Don't print program
3362 name.
3363 (Errors::warning_at_location): Likewise.
3364 (Errors::undefined_symbol): Likewise.
3365 * testsuite/debug_msg.sh: Update accordingly.
3366
3367 2011-04-14 Cary Coutant <ccoutant@google.com>
3368
3369 * gold/layout.cc (Layout::symtab_section_offset): New function.
3370 * gold/layout.h (Layout::symtab_section_offset): New function.
3371 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3372
3373 2011-04-12 Ian Lance Taylor <iant@google.com>
3374
3375 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3376 with MREMAP_MAYMOVE.
3377 * output.h (class Output_file): Add map_is_allocated_ field.
3378 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3379 not available, provide stubs. If mremap is not available, #define
3380 it to gold_mremap.
3381 (MREMAP_MAYMOVE): Define if not defined.
3382 (Output_file::Output_file): Initialize map_is_allocated_.
3383 (Output_file::resize): Check map_is_allocated_.
3384 (Output_file::map_anonymous): If mmap fails, use malloc.
3385 (Output_file::unmap): Don't do anything for an anonymous map.
3386 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3387 is not available, provide stubs.
3388 (File_read::View::~View): Use free rather than delete[].
3389 (File_read::make_view): Use malloc rather than new[]. If mmap
3390 fails, use malloc.
3391 (File_read::find_or_make_view): Use malloc rather than new[].
3392 * gold.h: Remove HAVE_REMAP code.
3393 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3394 exists. Rename mremap to gold_mremap. If mmap is not available
3395 don't do anything.
3396 * configure, config.in: Rebuild.
3397
3398 2011-04-11 Ian Lance Taylor <iant@google.com>
3399
3400 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3401 initialize local variable v.
3402
3403 2011-04-11 Cary Coutant <ccoutant@google.com>
3404
3405 * archive.cc (Archive::include_member): Adjust call to
3406 report_object.
3407 (Add_archive_symbols::run): Track argument serial numbers.
3408 (Lib_group::include_member): Likewise.
3409 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3410 * archive.h (Incremental_archive_entry::Archive_member):
3411 Initialize arg_serial_.
3412 (Archive_member::arg_serial_): New data member.
3413 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3414 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3415 incremental link.
3416 (Sized_dynobj::do_for_all_local_got_entries): New function.
3417 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3418 function.
3419 * fileread.cc (get_mtime): New function.
3420 * fileread.h (get_mtime): New function.
3421 * gold.cc (queue_initial_tasks): Check for incremental update.
3422 (process_incremental_input): New function.
3423 (queue_middle_tasks): Don't force valid target for incremental
3424 update.
3425 * incremental-dump.cc (find_input_containing_global): Adjust
3426 size of symbol info entry.
3427 (dump_incremental_inputs): Dump argument serial number and
3428 in_system_directory flag; bias shndx by 1; print symbol names
3429 when dumping per-file symbol lists; use new symbol info readers.
3430 * incremental.cc
3431 (Output_section_incremental_inputs:update_data_size): New function.
3432 (Sized_incremental_binary::setup_readers): Setup input readers
3433 for each input file; build maps for files added from libraries
3434 and scripts.
3435 (Sized_incremental_binary::check_input_args): New function.
3436 (Sized_incremental_binary::do_check_inputs): Build map of argument
3437 serial numbers to input arguments.
3438 (Sized_incremental_binary::do_file_has_changed): Rename
3439 do_file_is_unchanged to this; compare file modification times.
3440 (Sized_incremental_binary::do_init_layout): New function.
3441 (Sized_incremental_binary::do_reserve_layout): New function.
3442 (Sized_incremental_binary::do_get_input_reader): Remove.
3443 (Sized_incremental_binary::get_symtab_view): New function.
3444 (Incremental_checker::can_incrementally_link_output_file): Remove.
3445 (Incremental_inputs::report_command_line): Exclude --debug options.
3446 (Incremental_inputs::report_archive_begin): Add parameter; track
3447 argument serial numbers; don't put input file entry for archive
3448 before archive members.
3449 (Incremental_inputs::report_archive_end): Put input file entry
3450 for archive after archive members.
3451 (Incremental_inputs::report_object): Add parameter; track argument
3452 serial numbers and in_system_directory flag.
3453 (Incremental_inputs::report_script): Add parameter; track argument
3454 serial numbers.
3455 (Output_section_incremental_inputs::set_final_data_size): Adjust
3456 size of symbol info entry; check for forwarding symbols.
3457 (Output_section_incremental_inputs::write_input_files): Write
3458 in_system_directory flag and argument serial number.
3459 (Output_section_incremental_inputs::write_info_blocks): Map section
3460 indices between incremental info and original input file; store
3461 input section index for each symbol.
3462 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3463 change operator() to visit().
3464 (class Global_got_offset_visitor): Likewise.
3465 (class Global_symbol_visitor_got_plt):
3466 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3467 classes.
3468 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3469 (Sized_incr_relobj::do_read_symbols): New function.
3470 (Sized_incr_relobj::do_layout): New function.
3471 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3472 (Sized_incr_relobj::do_add_symbols): New function.
3473 (Sized_incr_relobj::do_should_include_member): New function.
3474 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3475 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3476 (Sized_incr_relobj::do_section_size): New function.
3477 (Sized_incr_relobj::do_section_name): New function.
3478 (Sized_incr_relobj::do_section_contents): New function.
3479 (Sized_incr_relobj::do_section_flags): New function.
3480 (Sized_incr_relobj::do_section_entsize): New function.
3481 (Sized_incr_relobj::do_section_address): New function.
3482 (Sized_incr_relobj::do_section_type): New function.
3483 (Sized_incr_relobj::do_section_link): New function.
3484 (Sized_incr_relobj::do_section_info): New function.
3485 (Sized_incr_relobj::do_section_addralign): New function.
3486 (Sized_incr_relobj::do_initialize_xindex): New function.
3487 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3488 (Sized_incr_relobj::do_read_relocs): New function.
3489 (Sized_incr_relobj::do_gc_process_relocs): New function.
3490 (Sized_incr_relobj::do_scan_relocs): New function.
3491 (Sized_incr_relobj::do_count_local_symbols): New function.
3492 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3493 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3494 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3495 (Sized_incr_relobj::do_relocate): New function.
3496 (Sized_incr_relobj::do_set_section_offset): New function.
3497 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3498 (Sized_incr_dynobj::do_read_symbols): New function.
3499 (Sized_incr_dynobj::do_layout): New function.
3500 (Sized_incr_dynobj::do_add_symbols): New function.
3501 (Sized_incr_dynobj::do_should_include_member): New function.
3502 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3503 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3504 (Sized_incr_dynobj::do_section_size): New function.
3505 (Sized_incr_dynobj::do_section_name): New function.
3506 (Sized_incr_dynobj::do_section_contents): New function.
3507 (Sized_incr_dynobj::do_section_flags): New function.
3508 (Sized_incr_dynobj::do_section_entsize): New function.
3509 (Sized_incr_dynobj::do_section_address): New function.
3510 (Sized_incr_dynobj::do_section_type): New function.
3511 (Sized_incr_dynobj::do_section_link): New function.
3512 (Sized_incr_dynobj::do_section_info): New function.
3513 (Sized_incr_dynobj::do_section_addralign): New function.
3514 (Sized_incr_dynobj::do_initialize_xindex): New function.
3515 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3516 (make_sized_incremental_object): New function.
3517 (Incremental_library::copy_unused_symbols): New function.
3518 (Incremental_library::do_for_all_unused_symbols): New function.
3519 * incremental.h (enum Incremental_input_flags): New type.
3520 (class Incremental_checker): Remove.
3521 (Incremental_input_entry::Incremental_input_entry): Add argument
3522 serial number.
3523 (Incremental_input_entry::arg_serial): New function.
3524 (Incremental_input_entry::set_is_in_system_directory): New function.
3525 (Incremental_input_entry::is_in_system_directory): New function.
3526 (Incremental_input_entry::arg_serial_): New data member.
3527 (Incremental_input_entry::is_in_system_directory_): New data member.
3528 (class Script_info): Move here from script.h.
3529 (Script_info::Script_info): Add filename parameter.
3530 (Script_info::filename): New function.
3531 (Script_info::filename_): New data member.
3532 (Incremental_script_entry::Incremental_script_entry): Add argument
3533 serial number.
3534 (Incremental_object_entry::Incremental_object_entry): Likewise.
3535 (Incremental_object_entry::add_input_section): Build list of input
3536 sections with map to original shndx.
3537 (Incremental_object_entry::get_input_section_index): New function.
3538 (Incremental_object_entry::shndx_): New data member.
3539 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3540 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3541 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3542 serial number.
3543 (Incremental_inputs::report_archive_begin): Likewise.
3544 (Incremental_inputs::report_object): Likewise.
3545 (Incremental_inputs::report_script): Likewise.
3546 (class Incremental_global_symbol_reader): New class.
3547 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3548 and store flags and input file type.
3549 (Incremental_input_entry_reader::arg_serial): New function.
3550 (Incremental_input_entry_reader::type): Extract type from flags.
3551 (Incremental_input_entry_reader::is_in_system_directory): New function.
3552 (Incremental_input_entry_reader::get_input_section_count): Call
3553 accessor function for type.
3554 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3555 function for type; adjust size of global symbol entry.
3556 (Incremental_input_entry_reader::get_global_symbol_count): Call
3557 accessor function for type.
3558 (Incremental_input_entry_reader::get_object_count): Likewise.
3559 (Incremental_input_entry_reader::get_object_offset): Likewise.
3560 (Incremental_input_entry_reader::get_member_count): Likewise.
3561 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3562 (Incremental_input_entry_reader::get_member_offset): Likewise.
3563 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3564 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3565 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3566 (Incremental_input_entry_reader::get_global_symbol_reader): New
3567 function.
3568 (Incremental_input_entry_reader::get_output_symbol_index): New
3569 function.
3570 (Incremental_input_entry_reader::type_): Remove.
3571 (Incremental_input_entry_reader::flags_): New data member.
3572 (Incremental_inputs_reader::input_file_offset): New function.
3573 (Incremental_inputs_reader::input_file_index): New function.
3574 (Incremental_inputs_reader::input_file): Call input_file_offset.
3575 (Incremental_inputs_reader::input_file_at_offset): New function.
3576 (Incremental_relocs_reader::get_r_type): Reformat.
3577 (Incremental_relocs_reader::get_r_shndx): Reformat.
3578 (Incremental_relocs_reader::get_r_offset): Reformat.
3579 (Incremental_relocs_reader::data): New function.
3580 (Incremental_binary::Incremental_binary): Initialize new data members.
3581 (Incremental_binary::check_inputs): Add cmdline parameter.
3582 (Incremental_binary::file_is_unchanged): Remove.
3583 (Input_reader::arg_serial): New function.
3584 (Input_reader::get_unused_symbol_count): New function.
3585 (Input_reader::get_unused_symbol): New function.
3586 (Input_reader::do_arg_serial): New function.
3587 (Input_reader::do_get_unused_symbol_count): New function.
3588 (Input_reader::do_get_unused_symbol): New function.
3589 (Incremental_binary::input_file_count): New function.
3590 (Incremental_binary::get_input_reader): Change signature to use
3591 index instead of filename.
3592 (Incremental_binary::file_has_changed): New function.
3593 (Incremental_binary::get_input_argument): New function.
3594 (Incremental_binary::get_library): New function.
3595 (Incremental_binary::get_script_info): New function.
3596 (Incremental_binary::init_layout): New function.
3597 (Incremental_binary::reserve_layout): New function.
3598 (Incremental_binary::output_file): New function.
3599 (Incremental_binary::do_check_inputs): New function.
3600 (Incremental_binary::do_file_is_unchanged): Remove.
3601 (Incremental_binary::do_file_has_changed): New function.
3602 (Incremental_binary::do_init_layout): New function.
3603 (Incremental_binary::do_reserve_layout): New function.
3604 (Incremental_binary::do_input_file_count): New function.
3605 (Incremental_binary::do_get_input_reader): Change signature.
3606 (Incremental_binary::input_args_map_): New data member.
3607 (Incremental_binary::library_map_): New data member.
3608 (Incremental_binary::script_map_): New data member.
3609 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3610 new data members.
3611 (Sized_incremental_binary::output_section): New function.
3612 (Sized_incremental_binary::inputs_reader): Add const.
3613 (Sized_incremental_binary::symtab_reader): Add const.
3614 (Sized_incremental_binary::relocs_reader): Add const.
3615 (Sized_incremental_binary::got_plt_reader): Add const.
3616 (Sized_incremental_binary::get_symtab_view): New function.
3617 (Sized_incremental_binary::Inputs_reader): New typedef.
3618 (Sized_incremental_binary::Input_entry_reader): New typedef.
3619 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3620 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3621 (Sized_incremental_binary::do_file_has_changed): New function.
3622 (Sized_incremental_binary::do_init_layout): New function.
3623 (Sized_incremental_binary::do_reserve_layout): New function.
3624 (Sized_input_reader::Inputs_reader): Remove.
3625 (Sized_input_reader::Input_entry_reader): Remove.
3626 (Sized_input_reader::do_arg_serial): New function.
3627 (Sized_input_reader::do_get_unused_symbol_count): New function.
3628 (Sized_input_reader::do_get_unused_symbol): New function.
3629 (Sized_incremental_binary::do_input_file_count): New function.
3630 (Sized_incremental_binary::do_get_input_reader): Change signature;
3631 use index instead of filename.
3632 (Sized_incremental_binary::section_map_): New data member.
3633 (Sized_incremental_binary::input_entry_readers_): New data member.
3634 (class Sized_incr_relobj): New class.
3635 (class Sized_incr_dynobj): New class.
3636 (make_sized_incremental_object): New function.
3637 (class Incremental_library): New class.
3638 * layout.cc (Free_list::num_lists): New static data member.
3639 (Free_list::num_nodes): New static data member.
3640 (Free_list::num_removes): New static data member.
3641 (Free_list::num_remove_visits): New static data member.
3642 (Free_list::num_allocates): New static data member.
3643 (Free_list::num_allocate_visits): New static data member.
3644 (Free_list::init): New function.
3645 (Free_list::remove): New function.
3646 (Free_list::allocate): New function.
3647 (Free_list::dump): New function.
3648 (Free_list::print_stats): New function.
3649 (Layout_task_runner::run): Resize output file for incremental updates.
3650 (Layout::Layout): Initialize new data members.
3651 (Layout::set_incremental_base): New function.
3652 (Layout::init_fixed_output_section): New function.
3653 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3654 incremental updates.
3655 (Layout::create_gold_note): Do not create gold note section for
3656 incremental updates.
3657 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3658 for incremental updates.
3659 (Layout::set_section_offsets): For incremental updates, allocate space
3660 from free list.
3661 (Layout::create_symtab_sections): Layout with offsets relative to
3662 start of section; for incremental updates, allocate space from free
3663 list.
3664 (Layout::create_shdrs): For incremental updates, allocate space from
3665 free list.
3666 (Layout::finish_dynamic_section): For incremental updates, do not
3667 check --as-needed (fixed in subsequent patch).
3668 * layout.h (class Free_list): New class.
3669 (Layout::set_incremental_base): New function.
3670 (Layout::incremental_base): New function.
3671 (Layout::init_fixed_output_section): New function.
3672 (Layout::allocate): New function.
3673 (Layout::incremental_base_): New data member.
3674 (Layout::free_list_): New data member.
3675 * main.cc (main): Print Free_list statistics.
3676 * object.cc (Relobj::finalize_incremental_relocs): Add
3677 clear_counts parameter; clear counts only when clear_counts is set.
3678 (Sized_relobj::Sized_relobj): Initialize new base class.
3679 (Sized_relobj::do_layout): Don't report special sections.
3680 (Sized_relobj::do_for_all_local_got_entries): New function.
3681 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3682 symtab_off to all symbol table offsets.
3683 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3684 * object.h (class Got_offset_list): Move to top of file.
3685 (Object::Object): Allow case where input_file == NULL.
3686 (Object::~Object): Likewise.
3687 (Object::input_file): Assert that input_file != NULL.
3688 (Object::lock): Allow case where input_file == NULL.
3689 (Object::unlock): Likewise.
3690 (Object::is_locked): Likewise.
3691 (Object::token): Likewise.
3692 (Object::release): Likewise.
3693 (Object::is_incremental): New function.
3694 (Object::get_mtime): New function.
3695 (Object::for_all_local_got_entries): New function.
3696 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3697 (Object::set_is_in_system_directory): New function.
3698 (Object::is_in_system_directory): New function.
3699 (Object::do_is_incremental): New function.
3700 (Object::do_get_mtime): New function.
3701 (Object::do_for_all_local_got_entries): New function.
3702 (Object::is_in_system_directory_): New data member.
3703 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3704 (class Sized_relobj_base): New class.
3705 (class Sized_relobj): Derive from Sized_relobj_base.
3706 (class Sized_relobj::Symbols): Redeclare from base class.
3707 (class Sized_relobj::local_got_offset_list): Remove.
3708 (class Sized_relobj::Output_sections): Redeclare from base class.
3709 (class Sized_relobj::do_for_all_local_got_entries): New function.
3710 (class Sized_relobj::write_local_symbols): Add offset parameter.
3711 (class Sized_relobj::local_symbol_offset_): Update comment.
3712 (class Sized_relobj::local_dynsym_offset_): Update comment.
3713 * options.cc (Input_arguments::add_file): Remove const.
3714 * options.h (Input_file_argument::Input_file_argument):
3715 Initialize arg_serial_ (all constructors).
3716 (Input_file_argument::set_arg_serial): New function.
3717 (Input_file_argument::arg_serial): New function.
3718 (Input_file_argument::arg_serial_): New data member.
3719 (Input_arguments::Input_arguments): Initialize file_count_.
3720 (Input_arguments::add_file): Remove const.
3721 (Input_arguments::number_of_input_files): New function.
3722 (Input_arguments::file_count_): New data member.
3723 (Command_line::number_of_input_files): Call
3724 Input_arguments::number_of_input_files.
3725 * output.cc (Output_segment_headers::Output_segment_headers):
3726 Set current size.
3727 (Output_section::Input_section::current_data_size): New function.
3728 (Output_section::Output_section): Initialize new data members.
3729 (Output_section::add_input_section): Don't do merge sections for
3730 an incremental link; allocate space from free list for an
3731 incremental update.
3732 (Output_section::add_output_section_data): Allocate space from
3733 free list for an incremental update.
3734 (Output_section::update_data_size): New function.
3735 (Output_section::set_fixed_layout): New function.
3736 (Output_section::reserve): New function.
3737 (Output_segment::set_section_addresses): Remove const.
3738 (Output_segment::set_section_list_addresses): Remove const; allocate
3739 space from free list for an incremental update.
3740 (Output_segment::set_offset): Adjust size of RELRO segment for an
3741 incremental update.
3742 * output.h (Output_data::current_data_size): Move here from
3743 child classes.
3744 (Output_data::pre_finalize_data_size): New function.
3745 (Output_data::update_data_size): New function.
3746 (Output_section_headers::update_data_size): new function.
3747 (Output_section_data_build::current_data_size): Move to Output_data.
3748 (Output_data_strtab::update_data_size): New function.
3749 (Output_section::current_data_size): Move to Output_data.
3750 (Output_section::set_fixed_layout): New function.
3751 (Output_section::has_fixed_layout): New function.
3752 (Output_section::reserve): New function.
3753 (Output_section::update_data_size): New function.
3754 (Output_section::has_fixed_layout_): New data member.
3755 (Output_section::free_list_): New data member.
3756 (Output_segment::set_section_addresses): Remove const.
3757 (Output_segment::set_section_list_addresses): Remove const.
3758 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3759 New function.
3760 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3761 New function.
3762 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3763 parameter when calling Add_symbols constructor; store argument
3764 serial number for members of a lib group.
3765 (Add_symbols::locks): Allow case where token == NULL.
3766 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3767 (Read_member::~Read_member): New function.
3768 (Read_member::is_runnable): New function.
3769 (Read_member::locks): New function.
3770 (Read_member::run): New function.
3771 (Check_script::~Check_script): New function.
3772 (Check_script::is_runnable): New function.
3773 (Check_script::locks): New function.
3774 (Check_script::run): New function.
3775 (Check_library::~Check_library): New function.
3776 (Check_library::is_runnable): New function.
3777 (Check_library::locks): New function.
3778 (Check_library::run): New function.
3779 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3780 (Add_symbols::library_): New data member.
3781 (class Read_member): New class.
3782 (class Check_script): New class.
3783 (class Check_library): New class.
3784 * reloc.cc (Read_relocs::is_runnable): Allow case where
3785 token == NULL.
3786 (Read_relocs::locks): Likewise.
3787 (Scan_relocs::locks): Likewise.
3788 (Relocate_task::locks): Likewise.
3789 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3790 to clear counters.
3791 (Sized_relobj::incremental_relocs_scan): Fix comment.
3792 (Sized_relobj::do_relocate): Pass output file offset to
3793 write_local_symbols.
3794 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3795 from class declaration.
3796 * script.cc (read_input_script): Allocate Script_info; pass
3797 argument serial number to report_script.
3798 * script.h (class Script_info): Move to incremental.h.
3799 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3800 * symtab.h (Symbol_table::add_from_incrobj): New function.
3801 (Symbol_table::set_file_offset): New function.
3802
3803 2011-04-05 Cary Coutant <ccoutant@google.com>
3804
3805 * incremental-dump.cc (dump_incremental_inputs): Change signature
3806 to take a Sized_incremental_binary; change caller. Use readers
3807 in Sized_incremental_binary.
3808 * incremental.cc
3809 (Sized_incremental_binary::find_incremental_inputs_sections):
3810 Rename do_find_incremental_inputs_sections to this.
3811 (Sized_incremental_binary::setup_readers): New function.
3812 (Sized_incremental_binary::do_check_inputs): Check
3813 has_incremental_info_ flag; move setup code to setup_readers;
3814 use input readers.
3815 (Sized_incremental_binary::do_file_is_unchanged): New function.
3816 (Sized_incremental_binary::do_get_input_reader): New function.
3817 * incremental.h (class Incremental_binary): Move to end of file.
3818 (Incremental_binary::file_is_unchanged): New function.
3819 (Incremental_binary::do_file_is_unchanged): New function.
3820 (Incremental_binary::Input_reader): New class.
3821 (Incremental_binary::get_input_reader): New function.
3822 (class Sized_incremental_binary): Move to end of file.
3823 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3824 input section reader classes.
3825 (Sized_incremental_binary::has_incremental_info): New function.
3826 (Sized_incremental_binary::inputs_reader): New function.
3827 (Sized_incremental_binary::symtab_reader): New function.
3828 (Sized_incremental_binary::relocs_reader): New function.
3829 (Sized_incremental_binary::got_plt_reader): New function.
3830 (Sized_incremental_binary::do_file_is_unchanged): New function.
3831 (Sized_incremental_binary::Sized_input_reader): New class.
3832 (Sized_incremental_binary::get_input_reader): New function.
3833 (Sized_incremental_binary::find_incremental_inputs_sections):
3834 Rename do_find_incremental_inputs_sections to this.
3835 (Sized_incremental_binary::setup_readers): New function.
3836 (Sized_incremental_binary::has_incremental_info_): New data member.
3837 (Sized_incremental_binary::inputs_reader_): New data member.
3838 (Sized_incremental_binary::symtab_reader_): New data member.
3839 (Sized_incremental_binary::relocs_reader_): New data member.
3840 (Sized_incremental_binary::got_plt_reader_): New data member.
3841 (Sized_incremental_binary::current_input_file_): New data member.
3842
3843 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3844
3845 PR gold/12640
3846 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3847 violation.
3848
3849 2011-03-30 Cary Coutant <ccoutant@google.com>
3850
3851 * archive.cc (Archive::include_member): Adjust call to report_object.
3852 (Add_archive_symbols::run): Add script_info to call to
3853 report_archive_begin.
3854 (Lib_group::include_member): Adjust call to report_object.
3855 (Add_lib_group_symbols::run): Adjust call to report_object.
3856 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3857 blocks. Add object count for script input files.
3858 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3859 script_info parameter; change all callers.
3860 (Incremental_inputs::report_object): Add script_info parameter;
3861 change all callers.
3862 (Incremental_inputs::report_script): Store backpointer to
3863 incremental info entry.
3864 (Output_section_incremental_inputs::set_final_data_size): Record
3865 additional information for scripts.
3866 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3867 * incremental.h (Incremental_script_entry::add_object): New function.
3868 (Incremental_script_entry::get_object_count): New function.
3869 (Incremental_script_entry::get_object): New function.
3870 (Incremental_script_entry::objects_): New data member; adjust
3871 constructor.
3872 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3873 (Incremental_inputs::report_object): Add script_info parameter.
3874 (Incremental_inputs_reader::get_object_count): New function.
3875 (Incremental_inputs_reader::get_object_offset): New function.
3876 * options.cc (Input_arguments::add_file): Return reference to
3877 new input argument.
3878 * options.h (Input_argument::set_script_info): New function.
3879 (Input_argument::script_info): New function.
3880 (Input_argument::script_info_): New data member; adjust all
3881 constructors.
3882 (Input_file_group::add_file): Return reference to new input argument.
3883 (Input_file_lib::add_file): Likewise.
3884 (Input_arguments::add_file): Likewise.
3885 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3886 * script.cc (Parser_closure::Parser_closure): Add script_info
3887 parameter; adjust all callers.
3888 (Parser_closure::script_info): New function.
3889 (Parser_closure::script_info_): New data member.
3890 (read_input_script): Report scripts earlier to incremental info.
3891 (script_add_file): Set script_info in Input_argument.
3892 (script_add_library): Likewise.
3893 * script.h (Script_options::Script_info): Rewrite class.
3894
3895 2011-03-29 Cary Coutant <ccoutant@google.com>
3896
3897 * archive.cc (Library_base::should_include_member): Move
3898 method here from class Archive.
3899 (Archive::Archive): Initialize base class.
3900 (Archive::should_include_member): Move to base class.
3901 (Archive::do_for_all_unused_symbols): New function.
3902 (Add_archive_symbols::run): Remove redundant access to
3903 incremental_inputs.
3904 (Lib_group::Lib_group): Initialize base class.
3905 (Lib_group::do_filename): New function.
3906 (Lib_group::include_member): Pass pointer to Lib_group to
3907 report_object.
3908 (Lib_group::do_for_all_unused_symbols): New function.
3909 (Add_lib_group_symbols::run): Report archive information for
3910 incremental links.
3911 * archive.h (class Library_base): New base class.
3912 (class Archive): Derive from Library_base.
3913 (Archive::filename): Move to base class.
3914 (Archive::set_incremental_info): Likewise.
3915 (Archive::incremental_info): Likewise.
3916 (Archive::Should_include): Likewise.
3917 (Archive::should_include_member): Likewise.
3918 (Archive::Armap_entry): Remove.
3919 (Archive::Unused_symbol_iterator): Remove.
3920 (Archive::unused_symbols_begin): Remove.
3921 (Archive::unused_symbols_end): Remove.
3922 (Archive::do_filename): New function.
3923 (Archive::do_get_mtime): New function.
3924 (Archive::do_for_all_unused_symbols): New function.
3925 (Archive::task_): Move to base class.
3926 (Archive::incremental_info_): Likewise.
3927 (class Lib_group): Derive from Library_base.
3928 (Lib_group::do_filename): New function.
3929 (Lib_group::do_get_mtime): New function.
3930 (Lib_group::do_for_all_unused_symbols): New function.
3931 (Lib_group::task_): Move to base class.
3932 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3933 function.
3934 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3935 function.
3936 * incremental.cc (Incremental_inputs::report_archive_begin):
3937 Use Library_base; call library's get_mtime; add incremental inputs
3938 entry before members.
3939 (class Unused_symbol_visitor): New class.
3940 (Incremental_inputs::report_archive_end): Use Library_base; use
3941 visitor class to record unused symbols; don't add incremental inputs
3942 entry after members.
3943 (Incremental_inputs::report_object): Use Library_base.
3944 * incremental.h
3945 (Incremental_archive_entry::Incremental_archive_entry): Remove
3946 unused Archive parameter.
3947 (Incremental_inputs::report_archive_begin): Use Library_base.
3948 (Incremental_inputs::report_archive_end): Likewise.
3949 (Incremental_inputs::report_object): Likewise.
3950 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3951 function.
3952 * object.h (Object::for_all_global_symbols): New function.
3953 (Object::do_for_all_global_symbols): New function.
3954 (Sized_relobj::do_for_all_global_symbols): New function.
3955 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3956 function.
3957 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3958 function.
3959
3960 2011-03-27 Ian Lance Taylor <iant@google.com>
3961
3962 * archive.cc (Archive::interpret_header): Return -1 if something
3963 goes wrong. Change callers accordingly.
3964
3965 2011-03-25 Cary Coutant <ccoutant@google.com>
3966
3967 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3968 * testsuite/Makefile.in: Regenerate.
3969
3970 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3971
3972 * plugin.cc (get_view): New.
3973 (Plugin::load): Pass get_view to the plugin.
3974 (Plugin_manager::get_view): New.
3975
3976 2011-03-21 Ian Lance Taylor <iant@google.com>
3977
3978 * testsuite/final_layout.sh: Rewrite to not use dc.
3979 * testsuite/relro_test.sh: Fail if dc is not present.
3980
3981 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3982
3983 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3984 Change == to -eq.
3985 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3986 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3987 Change == to -eq.
3988 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3989 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3990
3991 2011-03-14 Ian Lance Taylor <iant@google.com>
3992
3993 * script-sections.cc (Sort_output_sections::script_compare):
3994 Rename from is_before, change return type.
3995 (Sort_output_sections::operator()): Adjust accordingly.
3996
3997 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3998
3999 PR gold/12572
4000 * testsuite/odr_violation2.cc: Add comment to make all error line
4001 numbers double digits.
4002 * testsuite/debug_msg.sh: Adjust expected errors.
4003
4004 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4005
4006 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4007 but mark earlier ones as non-canonical
4008 (offset_to_iterator): Update search target and example
4009 (do_addr2line): Return extra lines in a vector*
4010 (format_file_lineno): Extract from do_addr2line
4011 (one_addr2line): Add vector* out-param
4012 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4013 when a lineno entry appeared last for its instruction
4014 (Dwarf_line_info): Add vector* out-param
4015 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4016 * symtab.cc (Odr_violation_compare): Include the lineno in the
4017 comparison again.
4018 (linenos_from_loc): New. Combine the canonical line for an
4019 address with its other lines.
4020 (True_if_intersect): New. Helper functor to make
4021 std::set_intersection a query.
4022 (detect_odr_violations): Compare sets of lines instead of just
4023 one line for each function. This became less deterministic, but
4024 has fewer false positives.
4025 * symtab.h: Declarations.
4026 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4027 mix an optimized and non-optimized object in the same binary
4028 (odr_violation2.so): Same.
4029 * testsuite/Makefile.in: Regenerate from Makefile.am.
4030 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4031 * testsuite/debug_msg.sh: Update line numbers and add
4032 assertions.
4033 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4034 non-optimized context.
4035 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4036 isn't inlined, and use OdrDerived in an optimized context.
4037 * testsuite/odr_header1.h: Defines OdrDerived, where
4038 optimization will change the
4039 first-instruction-in-the-destructor's file and line number.
4040 * testsuite/odr_header2.h: Defines OdrBase.
4041
4042 2011-03-09 Ian Lance Taylor <iant@google.com>
4043
4044 * fileread.cc (File_read::clear_views): Don't delete the whole
4045 file view.
4046
4047 2011-03-08 Ian Lance Taylor <iant@google.com>
4048
4049 PR gold/12525
4050 * fileread.cc: #include <climits>.
4051 (GOLD_IOV_MAX): Define.
4052 (File_read::read_multiple): Limit number of entries by iov_max.
4053 * fileread.h (class File_read): Always set max_readv_entries to
4054 128.
4055
4056 2011-03-07 Ian Lance Taylor <iant@google.com>
4057
4058 PR gold/12525
4059 * options.h (class General_options): Add -dy and -dn.
4060
4061 2011-03-02 Cary Coutant <ccoutant@google.com>
4062
4063 * testsuite/script_test_9.t: Add TLS segment.
4064
4065 2011-03-02 Simon Baldwin <simonb@google.com>
4066
4067 * configure.ac: Add check for gnu_indirect_function support in
4068 the toolchain building binutils.
4069 * configure: Rebuild.
4070
4071 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4072
4073 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4074 plugin only symbols.
4075 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4076 in plugin files as not needed in the symbol table.
4077
4078 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4079
4080 * output.cc (Output_section::add_input_section): Delay fill
4081 generation for section ordering.
4082
4083 2011-02-09 Ian Lance Taylor <iant@google.com>
4084
4085 PR gold/12316
4086 * object.h (class Sized_relobj): Remove clear_local_symbols.
4087 * reloc.cc (Sized_relobj::do_relocate): Don't call
4088 clear_local_symbols.
4089
4090 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4091
4092 * plugin.cc (is_visible_from_outside): Return true for symbols
4093 in the -u option.
4094
4095 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4096
4097 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4098 filename.
4099
4100 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4101
4102 * icf.h (is_section_foldable_candidate): Change type of parameter
4103 to std::string.
4104 * icf.cc (Icf::find_identical_sections): Change type of local variable
4105 section_name to be std::string.
4106 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4107
4108 2011-01-25 Ian Lance Taylor <iant@google.com>
4109
4110 * script.cc (script_add_extern): Rewrite to use
4111 add_symbol_reference.
4112
4113 2011-01-25 Doug Kwan <dougkwan@google.com>
4114
4115 * icf.cc (get_section_contents): Always lock section's object.
4116
4117 2011-01-24 Ian Lance Taylor <iant@google.com>
4118
4119 * options.h (class General_options): Accept
4120 --no-detect-odr-violations.
4121
4122 2011-01-24 Ian Lance Taylor <iant@google.com>
4123
4124 * version.cc (version_string): Bump to 1.11.
4125
4126 2011-01-24 Ian Lance Taylor <iant@google.com>
4127
4128 * plugin.cc (class Plugin_rescan): Define new class.
4129 (Plugin_manager::claim_file): Set any_claimed_.
4130 (Plugin_manager::save_archive): New function.
4131 (Plugin_manager::save_input_group): New function.
4132 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4133 necessary.
4134 (Plugin_manager::new_undefined_symbol): New function.
4135 (Plugin_manager::rescan): New function.
4136 (Plugin_manager::rescannable_defines): New function.
4137 (Plugin_manager::add_input_file): Set any_added_.
4138 * plugin.h (class Plugin_manager): define new fields rescannable_,
4139 undefined_symbols_, any_claimed_, and any_added_. Declare
4140 Plugin_rescan as friend. Declare new functions.
4141 (Plugin_manager::Rescannable): Define type.
4142 (Plugin_manager::Rescannable_list): Define type.
4143 (Plugin_manager::Undefined_symbol_list): Define type.
4144 (Plugin_manager::Plugin_manager): Initialize new fields.
4145 * archive.cc (Archive::defines_symbol): New function.
4146 (Add_archive_symbols::run): Pass archive to plugins if any.
4147 * archive.h (class Archive): Declare defines_symbol.
4148 * readsyms.cc (Input_group::~Input_group): New function.
4149 (Finish_group::run): Pass input_group to plugins if any.
4150 * readsyms.h (class Input_group): Declare destructor.
4151 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4152 any.
4153
4154 2011-01-10 Ian Lance Taylor <iant@google.com>
4155
4156 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4157 section as relro.
4158 (Layout::set_segment_offsets): Reset increase_relro before calling
4159 set_section_addresses a second time.
4160
4161 2011-01-04 Cary Coutant <ccoutant@google.com>
4162
4163 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4164 sections before NOBITS sections.
4165
4166 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4167
4168 * version.cc (print_version): Update copyright to 2011.
4169
4170 2010-12-23 Cary Coutant <ccoutant@google.com>
4171
4172 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4173 of OS to this->add. Add OD parameter to second form of the function.
4174
4175 2010-12-20 Ian Lance Taylor <iant@google.com>
4176
4177 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4178 second of two consecutive entries with same offset.
4179
4180 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4181
4182 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4183 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4184 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4185 to avoid unneeded links against $(LDADD).
4186 * testsuite/Makefile.in: Regenerate.
4187
4188 2010-12-15 Ian Lance Taylor <iant@google.com>
4189
4190 PR gold/12324
4191 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4192 for R_X86_64_32 and R_X86_64_PC32.
4193 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4194 ver_matching_def_pic.o.
4195 (ver_matching_def_pic.o): New target.
4196
4197 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4198
4199 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4200 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4201 Move definition before File_read::View member definitions.
4202 (File_read::View::~View): Initialize and hold lock before
4203 updating current_mapped_bytes.
4204
4205 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4206
4207 * dwarf_reader.cc: Remove outdated comment.
4208 * gold-threads.cc: Fix typo in error message.
4209 * archive.cc: Fix typos in comments.
4210 * archive.h: Likewise.
4211 * arm-reloc-property.cc: Likewise.
4212 * arm-reloc-property.h: Likewise.
4213 * arm-reloc.def: Likewise.
4214 * arm.cc: Likewise.
4215 * attributes.h: Likewise.
4216 * cref.cc: Likewise.
4217 * ehframe.cc: Likewise.
4218 * fileread.h: Likewise.
4219 * gold.h: Likewise.
4220 * i386.cc: Likewise.
4221 * icf.cc: Likewise.
4222 * incremental.h: Likewise.
4223 * int_encoding.cc: Likewise.
4224 * layout.h: Likewise.
4225 * main.cc: Likewise.
4226 * merge.h: Likewise.
4227 * object.cc: Likewise.
4228 * object.h: Likewise.
4229 * options.cc: Likewise.
4230 * readsyms.cc: Likewise.
4231 * reduced_debug_output.cc: Likewise.
4232 * reloc.cc: Likewise.
4233 * script-sections.cc: Likewise.
4234 * sparc.cc: Likewise.
4235 * symtab.h: Likewise.
4236 * target-reloc.h: Likewise.
4237 * target.cc: Likewise.
4238 * target.h: Likewise.
4239 * timer.cc: Likewise.
4240 * timer.h: Likewise.
4241 * x86_64.cc: Likewise.
4242
4243 2010-12-09 Cary Coutant <ccoutant@google.com>
4244
4245 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4246 stack.
4247 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4248 parameter; change all callers.
4249 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4250 * options.h (warn_execstack): New option.
4251
4252 2010-12-07 Doug Kwan <dougkwan@google.com>
4253
4254 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4255 like function call relocations.
4256
4257 2010-12-07 Ian Lance Taylor <iant@google.com>
4258
4259 * archive.cc (Archive::get_elf_object_for_member): Permit
4260 punconfigured to be NULL.
4261 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4262 (Archive::include_member): Pass NULL to get_elf_object_for_member
4263 if we searched for the archive and this is the first included
4264 object.
4265
4266 2010-12-01 Ian Lance Taylor <iant@google.com>
4267
4268 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4269 track_relocs_type_ field.
4270 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4271 Set track_relocs_type_.
4272 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4273 contents when using RELA relocs.
4274 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4275 reloc_map_.
4276 * reloc.cc (Track_relocs::next_addend): New function.
4277 * reloc.h (class Track_relocs): Declare next_addend.
4278
4279 2010-12-01 Ian Lance Taylor <iant@google.com>
4280
4281 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4282 virtual destructor.
4283
4284 2010-12-01 Ian Lance Taylor <iant@google.com>
4285
4286 * README: Update compilers known to work and fail.
4287
4288 2010-11-23 Matthias Klose <doko@ubuntu.com>
4289
4290 * configure.in: For --enable-gold, handle value `default' instead of
4291 `both*'. Always install ld as ld.bfd, install as ld if gold is
4292 not the default.
4293 * configure: Regenerate.
4294
4295 2010-11-18 Doug Kwan <dougkwan@google.com>
4296
4297 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4298 and right_alignment to be zero. Store result alignment only if it is
4299 greater than existing alignment.
4300
4301 2010-11-16 Cary Coutant <ccoutant@google.com>
4302
4303 PR gold/12220
4304 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4305 Check for ".zdebug_line".
4306
4307 2010-11-16 Doug Kwan <dougkwan@google.com>
4308 Cary Coutant <ccoutant@google.com>
4309
4310 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4311 by reference; adjust all callers.
4312 * output.cc (Output_segment::set_section_addresses): Adjust references
4313 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4314 list is empty.
4315 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4316 end at page boundary.
4317
4318 2010-11-16 Cary Coutant <ccoutant@google.com>
4319
4320 PR gold/12220
4321 * layout.cc (Layout::choose_output_section): Transform names of
4322 compressed sections even when using a script with a SECTIONS clause.
4323 (Layout::output_section_name): Remove code to transform
4324 compressed debug section names.
4325 * output.cc (Output_section::add_input_section): Use uncompressed
4326 section size when tracking input sections.
4327
4328 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4329
4330 * symtab.h (Symbol::NON_PIC_REF): Remove.
4331 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4332 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4333 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4334 (Symbol::use_plt_offset): Take a flags argument and pass it
4335 directly to needs_dynamic_reloc. Restrict check for undefined
4336 weak symbols to function calls.
4337 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4338 (Target_arm::Scan::global): Use it.
4339 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4340 (Target_arm::Relocate::relocate): Likewise.
4341 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4342 parameter with an r_type parameter. Use get_reference_flags
4343 to get the flags.
4344 (Target_arm::Relocate::relocate): Update accordingly.
4345 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4346 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4347 (Target_i386::Scan::global): Likewise.
4348 (Target_i386::Relocate::relocate): Likewise.
4349 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4350 parameter with an r_type parameter. Use get_reference_flags
4351 to get the flags.
4352 (Target_i386::Relocate::relocate): Update accordingly.
4353 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4354 (Target_powerpc::Scan::global): Use it.
4355 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4356 (Target_powerpc::Relocate::relocate): Likewise.
4357 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4358 (Target_sparc::Scan::global): Use it.
4359 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4360 (Target_sparc::Relocate::relocate): Likewise.
4361 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4362 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4363 (Target_x86_64::Scan::global): Likewise.
4364 (Target_x86_64::Relocate::relocate): Likewise.
4365
4366 2010-11-08 Doug Kwan <dougkwan@google.com>
4367 Cary Coutant <ccoutant@google.com>
4368
4369 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4370 (Arm_exidx_merge_section::section_contents_): New data member.
4371 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4372 (Arm_input_section::~Arm_input_section): De-allocate memory.
4373 (Arm_input_section::original_contents_): New data member.
4374 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4375 in parameters instead of calling Object::section_contents without
4376 locking.
4377 (Arm_output_section::group_section): New parameter TASK. Pass it
4378 to callees that need locking objects.
4379 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4380 to lock EXIDX input sections. Fix a formatting issue. Call
4381 Arm_exidx_merged_section::build_contents to create merged section
4382 contents.
4383 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4384 to lock object of stub table owner.
4385 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4386 TEXT_SIZE to initialize data member TEXT_SIZE_.
4387 (Arm_exidx_input_section::addralign): Fix typo in comment.
4388 (Arm_exidx_input_section::text_size): New method.
4389 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4390 that require locking objects. Lock objects before scanning for stubs
4391 and updating local symbols.
4392 (Arm_input_section<big_endian>::init): Copy contents of original
4393 input section.
4394 (Arm_input_section<big_endian>::do_write): Use saved contents of
4395 original input section instead of calling Object::section_contents
4396 without locking.
4397 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4398 size without calling Object::section_size().
4399 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4400 for size. Allocate a buffer for merged EXIDX entries.
4401 (Arm_exidx_merged_section::build_contents): New method.
4402 (Arm_exidx_merged_section::do_write): Move merge section contents
4403 building code to Arm_exidx_merged_section::build_contetns. Write
4404 out contetns in buffer instead of building it on the fly.
4405 (Arm_relobj::make_exidx_input_section): Also pass text section size
4406 to Arm_exidx_input_section constructor.
4407 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4408 (Arm_dynobj::do_read_symbols): Fix memory leak.
4409 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4410 * target.h: (class Task): Add forward declaration.
4411 (Target::relax): Add new parameter TASK and pass it to
4412 Target::do_relax().
4413 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4414
4415 2010-11-05 Cary Coutant <ccoutant@google.com>
4416
4417 PR gold/10708
4418 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4419 object when reading from the file.
4420 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4421 second layout pass.
4422 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4423 when reading section contents.
4424 (get_section_contents): Likewise.
4425 (icf::find_identical_sections): Likewise.
4426 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4427 object when reading from the file.
4428 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4429 the object when doing deferred section layout.
4430
4431 2010-11-03 Nick Clifton <nickc@redhat.com>
4432
4433 PR gold/12001
4434 * script.h (class Symbol_assignment: name): New member. Returns
4435 the name of the symbol.
4436 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4437 Returns true if the given symbol name is on the list of
4438 assignments wating to be processed.
4439 * archive.cc (should_incldue_member): If the symbol is undefined,
4440 check to see if it is on the list of symbols pending assignment.
4441
4442 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4443
4444 * script-sections.cc (Script_sections::find_memory_region): Check
4445 for a NULL output section pointer.
4446
4447 2010-10-29 Doug Kwan <dougkwan@google.com>
4448
4449 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4450 Output_section::add_relaxed_input_section.
4451 * output.cc (Output_section::add_relaxed_input_section): Add new
4452 arguments LAYOUT and NAME. Set section order index.
4453 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4454 Copy section order index.
4455 * output.h (Output_section::add_relaxed_input_section): Add new
4456 arguments LAYOUT and NAME.
4457
4458 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4459
4460 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4461 NATIVE_OR_CROSS_LINKER.
4462 * testsuite/Makefile.in: Regenerate.
4463
4464 2010-10-20 Doug Kwan <dougkwan@google.com>
4465
4466 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4467 without SHF_LINK_ORDER flags.
4468 * layout.cc (Layout::choose_output_section): Do not filter
4469 SHF_LINK_ORDER flag in a relocatable link.
4470
4471 2010-10-17 Cary Coutant <ccoutant@google.com>
4472
4473 * output.h (Output_segment::set_section_addresses): Change function
4474 signature. Update all callers.
4475 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4476 sections.
4477 (Output_segment::set_section_addresses): Align after last TLS
4478 section. Add padding before last relro section instead of after.
4479
4480 2010-10-17 Doug Kwan <dougkwan@google.com>
4481
4482 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4483 GOT output section to be writable.
4484
4485 2010-10-14 Cary Coutant <ccoutant@google.com>
4486
4487 * debug.h (DEBUG_INCREMENTAL): New flag.
4488 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4489 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4490 mode.
4491 * incremental.cc (report_command_line): Ignore all forms of
4492 --incremental.
4493 * layout.cc (Layout::Layout): Check parameters for incremental link
4494 mode.
4495 * options.cc (General_options::parse_incremental): New function.
4496 (General_options::parse_no_incremental): New function.
4497 (General_options::parse_incremental_full): New function.
4498 (General_options::parse_incremental_update): New function.
4499 (General_options::incremental_mode_): New data member.
4500 (General_options::finalize): Check incremental_mode_.
4501 * options.h (General_options): Update help text for --incremental.
4502 Add --no-incremental, --incremental-full, --incremental-update.
4503 (General_options::Incremental_mode): New enum type.
4504 (General_options::incremental_mode): New function.
4505 (General_options::incremental_mode_): New data member.
4506 * parameters.cc (Parameters::incremental_mode_): New data member.
4507 (Parameters::set_options): Set incremental_mode_.
4508 (Parameters::set_incremental_full): New function.
4509 (Parameters::incremental): New function.
4510 (Parameters::incremental_update): New function.
4511 (set_parameters_incremental_full): New function.
4512 * parameters.h (Parameters::set_incremental_full): New function.
4513 (Parameters::incremental): New function.
4514 (Parameters::incremental_update): New function.
4515 (Parameters::incremental_mode_): New data member.
4516 (set_parameters_incremental_full): New function.
4517 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4518 incremental link mode.
4519 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4520 (Sized_relobj::do_relocate_sections): Likewise.
4521 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4522 option.
4523 * testsuite/Makefile.in: Regenerate.
4524 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4525
4526 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4527
4528 * script-sections.h (class Script_sections): Make
4529 Sections_elements typedef public.
4530 * script-sections.cc (class Sort_output_sections): Add elements_
4531 field. Add constructor which sets it; change all callers.
4532 (Sort_output_sections::is_before): New function.
4533 (Sort_output_sections::operator()): Call is_before.
4534 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4535 conditional.
4536 * testsuite/script_test_10.sh: New test. Test script section
4537 order.
4538 * testsuite/script_test_10.t: Likewise.
4539 * testsuite/script_test_10.s: Likewise.
4540 * testsuite/Makefile.am: Wrap the cross linker tests and the
4541 common tests into NATIVE_OR_CROSS_LINKER.
4542 (check_SCRIPTS): Add script_test_10.sh.
4543 (check_DATA): Add script_test_10.stdout.
4544 (script_test_10.o, script_test_10): New targets.
4545 (script_test_10.stdout): New target.
4546 * configure, testsuite/Makefile.in: Regenerate.
4547
4548 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4549
4550 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4551 error for the deprecated relocations.
4552 (Target_arm::Scan::global): Likewise.
4553 (Target_arm::Relocate::relocate): Likewise.
4554
4555 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4556
4557 * fileread.cc (Input_file::find_file): Initialize *found_name
4558 and *namep when using the fallback search for case 4.
4559
4560 2010-10-11 Cary Coutant <ccoutant@google.com>
4561
4562 * options.h (class General_options): Redefine -z lazy as an alias for
4563 the negation of -z now.
4564
4565 2010-10-11 Ian Lance Taylor <iant@google.com>
4566
4567 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4568 binding.
4569
4570 2010-10-06 Nick Clifton <nickc@redhat.com>
4571
4572 * script-sections.cc(class Memory_region): Remove
4573 current_lma_offset_ field. Rename current_vma_offset_ to
4574 current_offset_. Add last_section_ field.
4575 (Memory_region::get_current_vma_address): Rename to
4576 get_current_address.
4577 (Memory_region::get_current_lma_address): Delete.
4578 (Memory_region::increment_vma_offset): Rename to
4579 increment_offset.
4580 (Memory_region::increment_lma_offset): Delete.
4581 (Memory_region::attributes_compatible): New method. Returns
4582 true if the provided section is compatible with the region.
4583 (Memory_region::get_last_section): New method. Returns the last
4584 section to use the region.
4585 (Memory_region::set_last_section): New method. Stores the last
4586 section to use the region.
4587 (Script_sections::block_in_region): New method. Returns true if
4588 a block of memory is contained within a region.
4589 (Script_sections::find_memory_region): New method. Locates a
4590 memory region to be used to set a VMA or LMA address.
4591 (Output_section_definition::set_section_addresses): Add code to
4592 check for addresses set by memory regions.
4593 (Output_segment::set_section_addresses): Remove memory region
4594 walking code.
4595 (Script_sections::create_segment): Add a warning if a header
4596 segment is created outside of any region.
4597 * script-sections.h (class Script_sections): Add prototypes for
4598 find_memory_region and block_in_region methods.
4599 * testsuite/memory_test.s: Use .long instead of .word.
4600 * testsuite/memory_test.t: Add some more output sections.
4601 * testsuite/memory_test.sh: Update expected output.
4602
4603 2010-10-02 Doug Kwan <dougkwan@google.com>
4604
4605 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4606 defintion to symtab.h
4607 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4608 declaration to defintion.
4609
4610 2010-10-01 Nick Clifton <nickc@redhat.com>
4611
4612 * expression.cc (eval): Replace dummy argument with NULL.
4613 (eval_maybe_dot): Check for a NULL result section pointer.
4614 (Symbol_expression::value): Likewise.
4615 (Dot_expression::value): Likewise.
4616 (BINARY_EXPRESSION): Likewise.
4617 (Max_expression::value): Likewise.
4618 (Min_expression::value): Likewise.
4619 (Absolute_expression::value): Likewise.
4620 (Addr_expression::value_from_output_section): Likewise.
4621 (Loaddddr_expression::value_from_output_section): Likewise.
4622 (Segment_start_expression::value): Likewise.
4623 * script-sections.cc
4624 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4625 argument with NULL.
4626 (Sections_elememt_dot_assignment::set_section_addresses):
4627 Likewise.
4628 (Output_data_expression::do_write_to_buffer): Likewise.
4629 (Output_section_definition::finalize_symbols): Likewise.
4630 (Output_section_definition::set_section_addresses): Likewise.
4631
4632 2010-09-30 Doug Kwan <dougkwan@google.com>
4633
4634 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4635
4636 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4637
4638 * target.h (Target::can_icf_inline_merge_sections): New virtual
4639 function.
4640 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4641 virtual function.
4642 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4643 virtual function.
4644 * icf.cc (get_section_contents): Inline merge sections only when
4645 target allows it.
4646
4647 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4648
4649 * configure: Regenerate.
4650
4651 2010-09-17 Ian Lance Taylor <iant@google.com>
4652
4653 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4654 * testsuite/Makefile.am (memory_test.o): New target.
4655 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4656 memory_test.t.
4657 * testsuite/Makefile.in: Rebuild.
4658
4659 2010-09-17 Doug Kwan <dougkwan@google.com>
4660
4661 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4662 defintion if relocation uses GOT entries of the symbol.
4663 * testsuite/icf_safe_test.sh: Fix test.
4664 * testsuite/icf_safe_so_test.sh: Fix test.
4665
4666 2010-09-16 Cary Coutant <ccoutant@google.com>
4667
4668 * script_sections.cc (class Memory_region): Remove "NULL" from
4669 vector initializations.
4670
4671 2010-09-15 Cary Coutant <ccoutant@google.com>
4672
4673 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4674 Resolve forwarding symbols.
4675
4676 2010-09-15 Doug Kwan <dougkwan@google.com>
4677
4678 * gold/testsuite/script_test_3.t: Add ARM special sections.
4679 * gold/testsuite/script_test_4.t: Same.
4680 * gold/testsuite/script_test_5.t: Same.
4681 * gold/testsuite/script_test_6.t: Same.
4682 * gold/testsuite/script_test_7.t: Same.
4683 * gold/testsuite/script_test_7.t: Same.
4684 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4685
4686 2010-09-14 Cary Coutant <ccoutant@google.com>
4687
4688 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4689 (Target_x86_64::Relocate::relocate_tls): Replace check for
4690 saw_tls_block_reloc_ with test for executable section.
4691
4692 2010-09-12 Cary Coutant <ccoutant@google.com>
4693
4694 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4695 position-independent executables to shared libraries need dynamic
4696 relocations.
4697 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4698 position-independent executables.
4699 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4700 * testsuite/Makefile.in: Regenerate.
4701
4702 2010-09-10 Nick Clifton <nickc@redhat.com>
4703
4704 PR gold/11997
4705 * testsuite/memory_test.t: Discard any sections that are not
4706 needed.
4707
4708 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4709
4710 PR gold/11996
4711 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4712 "This::" to work around a bug in gcc 4.2.
4713
4714 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4715
4716 2010-09-09 Rafael Espindola <espindola@google.com>
4717
4718 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4719 sections with different PF_X flags in the same segment.
4720 (Layout::find_first_load_seg): Search all segments to find the first
4721 one.
4722 * options.h (rosegment): New.
4723
4724 2010-09-08 Rafael Espindola <espindola@google.com>
4725
4726 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4727
4728 2010-09-08 Doug Kwan <dougkwan@google.com>
4729
4730 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4731 (Arm_relobj::do_relocate_sections): Add new parameter for output
4732 file to match the parent.
4733 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4734 of local symbols instead of input values. Update code to track
4735 changes in gold::relocate_section.
4736 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4737 (Sized_relobj::compute_final_local_value_internal): New methods.
4738 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4739 body into private version of Sized_relobj::compute_final_local_value.
4740 Call the inline method.
4741 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4742 merged symbol value if there is one.
4743 (Symbol_value::has_output_value): New method defintiion.
4744 (Sized_relobj::Compute_final_local_value_status): New enum type.
4745 (Sized_relobj::compute_final_local_value): New methods.
4746 (Sized_relobj::compute_final_local_value_internal): New methods.
4747 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4748 and arm_cortex_a8.sh.
4749 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4750 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4751 New tests.
4752 * Makefile.in: Regenerate.
4753 * testsuite/arm_bl_out_of_range.s: Update test.
4754 * testsuite/thumb_bl_out_of_range.s: Ditto.
4755 * testsuite/thumb_blx_out_of_range.s: Ditto.
4756 * testsuite/arm_branch_out_of_range.sh: New file.
4757 * testsuite/arm_cortex_a8.sh: Ditto.
4758 * testsuite/arm_cortex_a8_b.s: Ditto.
4759 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4760 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4761 * testsuite/arm_cortex_a8_bl.s: Ditto.
4762 * testsuite/arm_cortex_a8_blx.s: Ditto.
4763 * testsuite/arm_cortex_a8_local.s: Ditto.
4764 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4765 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4766
4767 2010-09-08 Rafael Espindola <espindola@google.com>
4768
4769 * Makefile.am (memory_test.stdout): Run readelf with -W.
4770 * Makefile.in: Regenerate.
4771 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4772 64 bit output.
4773
4774 2010-09-08 Rafael Espindola <espindola@google.com>
4775
4776 * script-sections.cc (Script_sections::add_memory_region): Convert
4777 field precision to int.
4778 * script.cc (script_set_section_region, script_set_section_region):
4779 Convert field precision to int.
4780
4781 2010-09-08 Rafael Espindola <espindola@google.com>
4782
4783 * arm.cc (do_finalize_sections): Create the __exidx_start and
4784 __exdix_end symbols even when the section is missing.
4785
4786 2010-09-08 Nick Clifton <nickc@redhat.com>
4787
4788 * README: Remove claim that MEMORY is not supported.
4789 * expression.cc (script_exp_function_origin)
4790 (script_exp_function_length): Move from here to ...
4791 * script.cc: ... here.
4792 (script_set_section_region, script_add_memory)
4793 (script_parse_memory_attr, script_include_directive): New
4794 functions.
4795 * script-sections.cc
4796 (class Memory_region): New class.
4797 (class Output_section_definition): Add set_memory_region,
4798 set_section_vma, set_section_lma and get_section_name methods.
4799 (class Script_Sections): Add add_memory_region,
4800 find_memory_region, find_memory_region_origin,
4801 find_memory_region_length and set_memory_region methods.
4802 Have set_section_addresses method walk the list of set memory
4803 regions.
4804 Extend the print methos to display memory regions.
4805 * script-sections.h: Add prototypes for new methods.
4806 Add enum for MEMORY region attributes.
4807 * yyscript.y: Add support for parsing MEMORY regions.
4808 * script-c.h: Add prototypes for new functions.
4809 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4810 * testsuite/Makefile.in: Regenerate.
4811 * testsuite/memory_test.sh: New script.
4812 * testsuite/memory_test.s: New assembler source file.
4813 * testsuite/memory_test.t: New linker script.
4814
4815 2010-08-27 Doug Kwan <dougkwan@google.com>
4816
4817 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4818 reference override an existing dynamic weak reference.
4819 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4820 * testsuite/Makefile.in: Regenerate.
4821 * testsuite/dyn_weak_ref.sh: New file.
4822 * testsuite/dyn_weak_ref_1.c: Ditto.
4823 * testsuite/dyn_weak_ref_2.c: Ditto.
4824
4825 2010-08-27 Ian Lance Taylor <iant@google.com>
4826
4827 * incremental.h (class Incremental_input_entry): Add virtual
4828 destructor.
4829
4830 2010-08-27 Ian Lance Taylor <iant@google.com>
4831
4832 * testsuite/start_lib_test_3.c: Mark t3 as used.
4833
4834 2010-08-27 Nick Clifton <nickc@redhat.com>
4835
4836 * options.cc (version_script): Fix small typo in previous
4837 whitespace tidyup.
4838
4839 2010-08-25 Nick Clifton <nickc@redhat.com>
4840
4841 * archive.cc: Formatting fixes: Remove whitespace between
4842 typename and following asterisk. Remove whitespace between
4843 function name and opening parenthesis.
4844 * archive.h: Likewise.
4845 * arm.cc: Likewise.
4846 * attributes.cc: Likewise.
4847 * attributes.h: Likewise.
4848 * common.cc: Likewise.
4849 * copy-relocs.cc: Likewise.
4850 * dirsearch.h: Likewise.
4851 * dynobj.cc: Likewise.
4852 * ehframe.cc: Likewise.
4853 * ehframe.h: Likewise.
4854 * expression.cc: Likewise.
4855 * fileread.cc: Likewise.
4856 * fileread.h: Likewise.
4857 * gc.h: Likewise.
4858 * gold-threads.cc: Likewise.
4859 * gold.cc: Likewise.
4860 * i386.cc: Likewise.
4861 * icf.h: Likewise.
4862 * incremental-dump.cc: Likewise.
4863 * incremental.cc: Likewise.
4864 * layout.cc: Likewise.
4865 * layout.h: Likewise.
4866 * main.cc: Likewise.
4867 * merge.cc: Likewise.
4868 * merge.h: Likewise.
4869 * object.cc: Likewise.
4870 * object.h: Likewise.
4871 * options.cc: Likewise.
4872 * options.h: Likewise.
4873 * output.cc: Likewise.
4874 * output.h: Likewise.
4875 * plugin.cc: Likewise.
4876 * plugin.h: Likewise.
4877 * powerpc.cc: Likewise.
4878 * reloc.cc: Likewise.
4879 * script-c.h: Likewise.
4880 * script-sections.cc: Likewise.
4881 * script.cc: Likewise.
4882 * stringpool.cc: Likewise.
4883 * symtab.cc: Likewise.
4884 * symtab.h: Likewise.
4885 * target.cc: Likewise.
4886 * timer.cc: Likewise.
4887 * timer.h: Likewise.
4888 * version.cc: Likewise.
4889 * x86_64.cc: Likewise.
4890
4891 2010-08-24 Nick Clifton <nickc@redhat.com>
4892
4893 PR 11899
4894 * layout.cc (segment_precedes): Sort segments by their physical
4895 addresses, if they have been set.
4896
4897 2010-08-23 Cary Coutant <ccoutant@google.com>
4898
4899 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4900 symbols data.
4901 (Lib_group::include_member): Unlock object after deleting its
4902 symbols data.
4903 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4904 the bug fixed here.
4905
4906 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4907 Cary Coutant <ccoutant@google.com>
4908
4909 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4910 constructor, and set_blocker.
4911 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4912 readsyms_blocker_.
4913 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4914 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4915 * testsuite/Makefile.am (start_lib_test): New test case.
4916 * testsuite/Makefile.in: Regenerate.
4917 * testsuite/start_lib_test_main.c: New file.
4918 * testsuite/start_lib_test_1.c: New file.
4919 * testsuite/start_lib_test_2.c: New file.
4920 * testsuite/start_lib_test_3.c: New file.
4921
4922 2010-08-19 Ian Lance Taylor <iant@google.com>
4923
4924 * Makefile.in: Rebuild with automake 1.11.1.
4925 * aclocal.m4: Likewise.
4926 * testsuite/Makefile.in: Likewise.
4927
4928 2010-08-19 Ian Lance Taylor <iant@google.com>
4929
4930 PR 10893
4931 * i386.cc (class Output_data_plt_i386): Update declarations.
4932 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4933 local_ifuncs_ fields.
4934 (Target_i386::do_plt_section_for_global): New function.
4935 (Target_i386::do_plt_section_for_local): New function.
4936 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4937 parameter; change all callers. Initialize global_ifuncs_ and
4938 local_ifuncs_. If doing a static link define __rel_iplt_start and
4939 __rel_iplt_end.
4940 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4941 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4942 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4943 symbols.
4944 (Target_i386::make_plt_section): New function, broken out of
4945 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4946 (Target_i386::make_plt_entry): Call make_plt_section.
4947 (Target_i386::make_local_ifunc_plt_entry): New function.
4948 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4949 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4950 R_386_IRELATIVE to switch.
4951 (Target_i386::Scan::global): Likewise.
4952 (Target_i386::Relocate::relocate): Likewise.
4953 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4954 switch.
4955 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4956 (Target_x86_64::do_plt_section_for_global): New function.
4957 (Target_x86_64::do_plt_section_for_local): New function.
4958 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4959 parameter; change all callers. If doing a static link define
4960 __rela_iplt_start and __rela_iplt_end.
4961 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4962 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4963 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4964 to point to .plt.
4965 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4966 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4967 switch.
4968 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4969 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4970 R_X86_64_IRELATIVE to switch.
4971 (Target_x86_64::Scan::global): Likewise.
4972 (Target_x86_64::Relocate::relocate): Likewise.
4973 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4974 switch.
4975 * target.h (class Target): Add plt_section_for_global and
4976 plt_section_for_local functions. Add do_plt_section_for_global
4977 and do_plt_section_for_local virtual functions.
4978 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4979 clarifying comments.
4980 (Symbol::use_plt_offset): Handle IFUNC symbol.
4981 * object.cc (Sized_relobj::Sized_relobj): Initialize
4982 local_plt_offsets_.
4983 (Sized_relobj::local_has_plt_offset): New function.
4984 (Sized_relobj::local_plt_offset): New function.
4985 (Sized_relobj::set_local_plt_offset): New function.
4986 (Sized_relobj::do_count): Handle IFUNC symbol.
4987 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4988 a bit away from input_shndx_ field. Add set_is_func_symbol and
4989 is_ifunc_symbol functions.
4990 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4991 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4992 local_plt_offsets_ field.
4993 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4994 * output.h (class Output_section_data): Add non-const
4995 output_section function.
4996 (class Output_data_got): Update declarations.
4997 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4998 Add use_plt_offset parameter to global and local constructors.
4999 Change all callers. Change local_sym_index_ field to 31 bits.
5000 Change GSYM_CODE and CONSTANT_CODE accordingly.
5001 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5002 doing a static link don't set sh_link field.
5003 (Output_data_got::Got_entry::write): Use PLT offset if
5004 appropriate.
5005 (Output_data_got::add_global_plt): New function.
5006 (Output_data_got::add_local_plt): New function.
5007 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5008 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5009 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5010 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5011 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5012 IFUNC conditional.
5013 * testsuite/ifunc-sel.h: New file.
5014 * testsuite/ifuncmain1.c: New file.
5015 * testsuite/ifuncmain1vis.c: New file.
5016 * testsuite/ifuncmod1.c: New file.
5017 * testsuite/ifuncdep2.c: New file.
5018 * testsuite/ifuncmain2.c: New file.
5019 * testsuite/ifuncmain3.c: New file.
5020 * testsuite/ifuncmod3.c: New file.
5021 * testsuite/ifuncmain4.c: New file.
5022 * testsuite/ifuncmain5.c: New file.
5023 * testsuite/ifuncmod5.c: New file.
5024 * testsuite/ifuncmain6pie.c: New file.
5025 * testsuite/ifuncmod6.c: New file.
5026 * testsuite/ifuncmain7.c: New file.
5027 * configure, testsuite/Makefile.in: Rebuild.
5028
5029 2010-08-18 Ian Lance Taylor <iant@google.com>
5030
5031 * incremental.cc
5032 (Output_section_incremental_inputs::write_input_files): Add cast
5033 to avoid signed/unsigned comparison warning.
5034 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5035
5036 2010-08-12 Cary Coutant <ccoutant@google.com>
5037
5038 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5039
5040 2010-08-13 Ian Lance Taylor <iant@google.com>
5041
5042 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5043
5044 2010-08-12 Cary Coutant <ccoutant@google.com>
5045 Doug Kwan <dougkwan@google.com>
5046
5047 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5048 defintion overrides non-weak undef, remember that the original undef
5049 is not weak.
5050 * symtab.cc (Symbol_table::sized_write_global): For undef without
5051 an original weak binding, set binding to global in output.
5052 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5053 * testsuite/Makefile.in: Regenerate.
5054 * testsuite/strong_ref_weak_def.sh: New file.
5055 * testsuite/strong_ref_weak_def_1.c: Ditto.
5056 * testsuite/strong_ref_weak_def_2.c: Ditto.
5057
5058 2010-08-12 Cary Coutant <ccoutant@google.com>
5059
5060 * testsuite/incremental_test.sh: Rewrite.
5061 * testsuite/incremental_test_1.c: Rewrite.
5062 * testsuite/incremental_test_2.c: Rewrite.
5063
5064 2010-08-12 Cary Coutant <ccoutant@google.com>
5065
5066 * arm.cc (Target_arm::got_size): Add const.
5067 (Target_arm::got_entry_count): New function.
5068 (Target_arm::plt_entry_count): New function.
5069 (Target_arm::first_plt_entry_offset): New function.
5070 (Target_arm::plt_entry_size): New function.
5071 (Output_data_plt_arm::entry_count): New function.
5072 (Output_data_plt_arm::first_plt_entry_offset): New function.
5073 (Output_data_plt_arm::get_plt_entry_size): New function.
5074 * i386.cc (Target_i386::got_size): Add const.
5075 (Target_i386::got_entry_count): New function.
5076 (Target_i386::plt_entry_count): New function.
5077 (Target_i386::first_plt_entry_offset): New function.
5078 (Target_i386::plt_entry_size): New function.
5079 (Output_data_plt_i386::entry_count): New function.
5080 (Output_data_plt_i386::first_plt_entry_offset): New function.
5081 (Output_data_plt_i386::get_plt_entry_size): New function.
5082 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5083 find_incremental_inputs_sections. Dump incremental_got_plt section.
5084 * incremental.cc: Include target.h.
5085 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5086 parameter. Adjust all callers. Find incremental_got_plt section.
5087 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5088 section.
5089 (Output_section_incremental_inputs::set_final_data_size): Calculate
5090 size of incremental_got_plt section.
5091 (Output_section_incremental_inputs::do_write): Write the
5092 incremental_got_plt section.
5093 (Got_plt_view_info): New struct.
5094 (Local_got_offset_visitor): New class.
5095 (Global_got_offset_visitor): New class.
5096 (Global_symbol_visitor_got_plt): New class.
5097 (Output_section_incremental_inputs::write_got_plt): New function.
5098 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5099 Add parameter. Adjust all callers.
5100 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5101 (Incremental_inputs::got_plt_section): New function.
5102 (Incremental_inputs::got_plt_section_): New data member.
5103 (Incremental_got_plt_reader): New class.
5104 * layout.cc (Layout::create_incremental_info_sections): Add the
5105 incremental_got_plt section.
5106 * object.h (Got_offset_list::get_list): New function.
5107 (Got offset_list::for_all_got_offsets): New function.
5108 (Sized_relobj::local_got_offset_list): New function.
5109 * powerpc.cc (Target_powerpc::got_size): Add const.
5110 (Target_powerpc::got_entry_count): New function.
5111 (Target_powerpc::plt_entry_count): New function.
5112 (Target_powerpc::first_plt_entry_offset): New function.
5113 (Target_powerpc::plt_entry_size): New function.
5114 (Output_data_plt_powerpc::entry_count): New function.
5115 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5116 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5117 * sparc.cc (Target_sparc::got_size): Add const.
5118 (Target_sparc::got_entry_count): New function.
5119 (Target_sparc::plt_entry_count): New function.
5120 (Target_sparc::first_plt_entry_offset): New function.
5121 (Target_sparc::plt_entry_size): New function.
5122 (Output_data_plt_sparc::entry_count): New function.
5123 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5124 (Output_data_plt_sparc::get_plt_entry_size): New function.
5125 * symtab.h (Symbol::got_offset_list): New function.
5126 (Symbol_table::for_all_symbols): New function.
5127 * target.h (Sized_target::got_entry_count): New function.
5128 (Sized_target::plt_entry_count): New function.
5129 (Sized_target::plt_entry_size): New function.
5130 * x86_64.cc (Target_x86_64::got_size): Add const.
5131 (Target_x86_64::got_entry_count): New function.
5132 (Target_x86_64::plt_entry_count): New function.
5133 (Target_x86_64::first_plt_entry_offset): New function.
5134 (Target_x86_64::plt_entry_size): New function.
5135 (Output_data_plt_x86_64::entry_count): New function.
5136 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5137 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5138
5139 2010-08-12 Cary Coutant <ccoutant@google.com>
5140
5141 * archive.cc: Include incremental.h.
5142 (Archive::Archive): Initialize incremental_info_.
5143 (Archive::include_member): Record archive members in incremental info.
5144 (Add_archive_symbols::run): Record begin and end of an archive in
5145 incremental info.
5146 (Lib_group::include_member): Record objects in incremental info.
5147 * archive.h (Incremental_archive_entry): Forward declaration.
5148 (Archive::set_incremental_info): New member function.
5149 (Archive::incremental_info): New member function.
5150 (Archive::Unused_symbol_iterator): New class.
5151 (Archive::unused_symbols_begin): New member function.
5152 (Archive::unused_symbols_end): New member function.
5153 (Archive::incremental_info_): New data member.
5154 * incremental-dump.cc (find_input_containing_global): New function.
5155 (dump_incremental_inputs): Dump new incremental info sections.
5156 * incremental.cc: Include symtab.h.
5157 (Output_section_incremental_inputs): New class.
5158 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5159 new incremental info sections.
5160 (Sized_incremental_binary::do_check_inputs): Likewise.
5161 (Incremental_inputs::report_archive): Remove.
5162 (Incremental_inputs::report_archive_begin): New function.
5163 (Incremental_inputs::report_archive_end): New function.
5164 (Incremental_inputs::report_object): New function.
5165 (Incremental_inputs::finalize_inputs): Remove.
5166 (Incremental_inputs::report_input_section): New function.
5167 (Incremental_inputs::report_script): Rewrite.
5168 (Incremental_inputs::finalize): Do nothing but finalize string table.
5169 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5170 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5171 (Incremental_inputs::create_data_sections): New function.
5172 (Incremental_inputs::relocs_entsize): New function.
5173 (Output_section_incremental_inputs::set_final_data_size): New function.
5174 (Output_section_incremental_inputs::do_write): New function.
5175 (Output_section_incremental_inputs::write_header): New function.
5176 (Output_section_incremental_inputs::write_input_files): New function.
5177 (Output_section_incremental_inputs::write_info_blocks): New function.
5178 (Output_section_incremental_inputs::write_symtab): New function.
5179 * incremental.h (Incremental_script_entry): Forward declaration.
5180 (Incremental_object_entry): Forward declaration.
5181 (Incremental_archive_entry): Forward declaration.
5182 (Incremental_inputs): Forward declaration.
5183 (Incremental_inputs_header_data): Remove.
5184 (Incremental_inputs_header): Remove.
5185 (Incremental_inputs_header_write): Remove.
5186 (Incremental_inputs_entry_data): Remove.
5187 (Incremental_inputs_entry): Remove.
5188 (Incremental_inputs_entry_write): Remove.
5189 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5190 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5191 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5192 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5193 Likewise.
5194 (Incremental_input_entry): New class.
5195 (Incremental_script_entry): New class.
5196 (Incremental_object_entry): New class.
5197 (Incremental_archive_entry): New class.
5198 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5199 (Incremental_inputs::report_inputs): Remove.
5200 (Incremental_inputs::report_archive): Remove.
5201 (Incremental_inputs::report_archive_begin): New function.
5202 (Incremental_inputs::report_archive_end): New function.
5203 (Incremental_inputs::report_object): Change prototype.
5204 (Incremental_inputs::report_input_section): New function.
5205 (Incremental_inputs::report_script): Change prototype.
5206 (Incremental_inputs::get_reloc_count): New function.
5207 (Incremental_inputs::set_reloc_count): New function.
5208 (Incremental_inputs::create_data_sections): New function.
5209 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5210 (Incremental_inputs::inputs_section): New function.
5211 (Incremental_inputs::symtab_section): New function.
5212 (Incremental_inputs::relocs_section): New function.
5213 (Incremental_inputs::get_stringpool): Add const.
5214 (Incremental_inputs::command_line): Add const.
5215 (Incremental_inputs::inputs): Remove.
5216 (Incremental_inputs::command_line_key): New function.
5217 (Incremental_inputs::input_file_count): New function.
5218 (Incremental_inputs::input_files): New function.
5219 (Incremental_inputs::relocs_entsize): New function.
5220 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5221 (Incremental_inputs::finalize_inputs): Remove.
5222 (Incremental_inputs::Input_info): Remove.
5223 (Incremental_inputs::lock_): Remove.
5224 (Incremental_inputs::inputs_): Change type.
5225 (Incremental_inputs::inputs_map_): Remove.
5226 (Incremental_inputs::current_object_entry_): New data member.
5227 (Incremental_inputs::inputs_section_): New data member.
5228 (Incremental_inputs::symtab_section_): New data member.
5229 (Incremental_inputs::relocs_section_): New data member.
5230 (Incremental_inputs::reloc_count_): New data member.
5231 (Incremental_inputs_reader): New class.
5232 (Incremental_symtab_reader): New class.
5233 (Incremental_relocs_reader): New class.
5234 * layout.cc (Layout::finalize): Move finalization of incremental info
5235 and creation of incremental info sections to follow finalization of
5236 symbol table. Set offsets for postprocessing sections.
5237 (Layout::create_incremental_info_sections): Call
5238 Incremental_inputs::create_data_sections. Add incremental symtab
5239 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5240 sections to layout after input sections.
5241 * layout.h (struct Timespec): Forward declaration.
5242 (Layout::incremental_inputs): Add const.
5243 (Layout::create_incremental_info_sections): Add parameter.
5244 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5245 * object.cc: Include incremental.h.
5246 (Relobj::finalize_incremental_relocs): New function.
5247 (Sized_relobj::do_layout): Record input sections in incremental info.
5248 * object.h (Object::output_section): New function.
5249 (Object::output_section_offset): Moved from Relobj.
5250 (Object::get_incremental_reloc_base): New function.
5251 (Object::get_incremental_reloc_count): New function.
5252 (Object::do_output_section): New function.
5253 (Object::do_output_section_offset): Moved from Relobj.
5254 (Object::do_get_incremental_reloc_base): New function.
5255 (Object::do_get_incremental_reloc_count): New function.
5256 (Object::Object): Initialize new data members.
5257 (Relobj::output_section): Renamed do_output_section and moved to
5258 protected.
5259 (Relobj::output_section_offset): Moved to Object.
5260 (Relobj::do_get_incremental_reloc_base): New function.
5261 (Relobj::do_get_incremental_reloc_count): New function.
5262 (Relobj::allocate_incremental_reloc_counts): New function.
5263 (Relobj::count_incremental_reloc): New function.
5264 (Relobj::finalize_incremental_relocs): New function.
5265 (Relobj::next_incremental_reloc_index): New function.
5266 (Relobj::reloc_counts_): New data member.
5267 (Relobj::reloc_bases_): New data member.
5268 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5269 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5270 (Sized_relobj::incremental_relocs_scan): New function.
5271 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5272 (Sized_relobj::incremental_relocs_write): New function.
5273 (Sized_relobj::incremental_relocs_write_reltype): New function.
5274 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5275 incremental link.
5276 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5277 archives and object files elsewhere.
5278 (Add_symbols::run): Report object files here.
5279 (Finish_group::run): Report end of archive at end of group.
5280 * reloc.cc: Include layout.h, incremental.h.
5281 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5282 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5283 (Sized_relobj::incremental_relocs_scan): New function.
5284 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5285 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5286 (Sized_relobj::incremental_relocs_write): New function.
5287 (Sized_relobj::incremental_relocs_write_reltype): New function.
5288 * script.cc (read_input_script): Rewrite test for incremental link.
5289 Change call to Incremental_inputs::report_script.
5290 * symtab.h (Symbol_table::first_global_index): New function.
5291 (Symbol_table::output_count): New function.
5292
5293 2010-08-12 Doug Kwan <dougkwan@google.com>
5294
5295 * arm.cc (Target_arm::merge_object_attributes): Check command line
5296 options --no-wchar-size-warning and --no-enum-size-warning.
5297 * options.h (General_options): Add ld-compatible options
5298 --no-enum-size-warning and --no-wchar-size-warning.
5299
5300 2010-08-04 Ian Lance Taylor <iant@google.com>
5301
5302 * x86_64.cc (Target_x86_64::Scan::local): Use
5303 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5304 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5305 (Target_x86_64::Scan::global): Likewise.
5306 (Target_x86_64::Relocate::relocate): Likewise.
5307 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5308 Likewise.
5309
5310 2010-08-03 Cary Coutant <ccoutant@google.com>
5311
5312 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5313 to reserve space in merged_strings vector. Keep total input size
5314 for stats.
5315 (Output_merge_string::do_print_merge_stats): Print total input size.
5316 * merge.h (Output_merge_string): Add input_size_ field.
5317 * stringpool.cc (Stringpool_template::string_length): Move
5318 implementations out of Stringpool_template class and place in
5319 stringpool.h.
5320 * stringpool.h (string_length): Move out of Stringpool_template.
5321
5322 2010-08-03 Ian Lance Taylor <iant@google.com>
5323
5324 PR 11712
5325 * layout.cc (relaxation_loop_body): If address of load segment is
5326 set, adjust address to include headers if possible.
5327
5328 2010-08-03 Ian Lance Taylor <iant@google.com>
5329
5330 * version.cc (version_string): Bump to 1.10.
5331
5332 2010-08-03 Ian Lance Taylor <iant@google.com>
5333
5334 PR 11805
5335 * layout.h (enum Output_section_order): Define.
5336 (class Layout): Update declarations.
5337 * layout.cc (Layout::get_output_section): Add order parameter.
5338 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5339 is_first_non_relro parameters. Change all callers.
5340 (Layout::choose_output_section): Likewise.
5341 (Layout::add_output_section_data): Likewise.
5342 (Layout::make_output_section): Likewise. Set order.
5343 (Layout::default_section_order): New function.
5344 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5345 * output.cc (Output_section::Output_section): Initialize order_.
5346 Don't initialize deleted fields.
5347 (Output_segment::Output_segment): Don't initialize deleted
5348 fields.
5349 (Output_segment::add_output_section_to_load): New function
5350 replacing add_output_section. Change all callers to call this or
5351 add_output_section_to_nonload.
5352 (Output_segment::add_output_section_to_nonload): New function.
5353 (Output_segment::remove_output_section): Rewrite.
5354 (Output_segment::add_initial_output_data): Likewise.
5355 (Output_segment::has_any_data_sections): Likewise.
5356 (Output_segment::is_first_section_relro): Likewise.
5357 (Output_segment::maximum_alignment): Likewise.
5358 (Output_segment::has_dynamic_reloc): New function replacing
5359 dynamic_reloc_count. Change all callers.
5360 (Output_segment::has_dynamic_reloc_list): New function replacing
5361 dynamic_reloc_count_list. Change all callers.
5362 (Output_segment::set_section_addresses): Rewrite.
5363 (Output_segment::set_offset): Rewrite.
5364 (Output_segment::find_first_and_last_list): Remove.
5365 (Output_segment::set_tls_offsets): Rewrite.
5366 (Output_segment::first_section_load_address): Likewise.
5367 (Output_segment::output_section_count): Likewise.
5368 (Output_segment::section_with_lowest_load_address): Likewise.
5369 (Output_segment::write_section_headers): Likewise.
5370 (Output_segment::print_sections_to_map): Likewise.
5371 * output.h (class Output_data): Remove dynamic_reloc_count_
5372 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5373 (Output_data::add_dynamic_reloc): Rewrite.
5374 (Output_data::has_dynamic_reloc): New function.
5375 (Output_data::dynamic_reloc_count): Remove.
5376 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5377 is_last_relro_, is_first_non_relro_, is_interp_,
5378 is_dynamic_linker_section_ fields. Add order and set_order
5379 functions. Remove is_relro_local, set_is_relro_local,
5380 is_last_relro, set_is_last_relro, is_first_non_relro,
5381 set_is_first_non_relro functions, is_interp, set_is_interp,
5382 is_dynamic_linker_section, and set_is_dynamic_linker_section
5383 functions.
5384 (class Output_segment): Change Output_data_list from std::list to
5385 std:;vector. Add output_lists_ field. Remove output_data_ and
5386 output_bss_ fields. Update declarations.
5387
5388 2010-08-02 Ian Lance Taylor <iant@google.com>
5389
5390 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5391 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5392 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5393
5394 2010-08-02 Ian Lance Taylor <iant@google.com>
5395
5396 PR 11855
5397 * script.cc (Script_options::Script_options): Initialize
5398 symbol_definitions_ and symbol_references_.
5399 (Script_options::add_symbol_assignment): Update
5400 symbol_definitions_ and symbol_references_.
5401 (Script_options::add_symbol_reference): New function.
5402 (script_symbol): New function.
5403 * script.h (class Script_options): Add symbol_definitions_ and
5404 symbol_references_ fields.
5405 (Script_options::referenced_const_iterator): New type.
5406 (Script_options::referenced_begin): New function.
5407 (Script_options::referenced_end): New function.
5408 (Script_options::is_referenced): New function.
5409 (Script_options::any_unreferenced): New function.
5410 * script-c.h (script_symbol): Declare.
5411 * yyscript.y (exp): Call script_symbol.
5412 * symtab.cc: Include "script.h".
5413 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5414 Change all callers. Check symbols referenced by scripts.
5415 (Symbol_table::add_undefined_symbols_from_command_line): Add
5416 layout parameter. Change all callers.
5417 (Symbol_table::do_add_undefined_symbols_from_command_line):
5418 Likewise. Break out loop body. Check symbols referenced by
5419 scripts.
5420 (Symbol_table::add_undefined_symbol_from_command_line): New
5421 function broken out of
5422 do_add_undefined_symbols_from_command_line.
5423 * symtab.h (class Symbol_table): Update declarations.
5424 * archive.cc: Include "layout.h".
5425 (Archive::should_include_member): Add layout parameter. Change
5426 all callers. Check for symbol mentioned in expression.
5427 * archive.h (class Archive): Update declaration.
5428 * object.cc (Sized_relobj::do_should_include_member): Add layout
5429 parameter.
5430 * object.h (Object::should_include_member): Add layout parameter.
5431 Change all callers.
5432 (Object::do_should_include_member): Add layout parameter.
5433 (class Sized_relobj): Update declaration.
5434 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5435 parameter.
5436 * dynobj.h (class Sized_dynobj): Update declaration.
5437 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5438 layout parameter.
5439 * plugin.h (class Sized_pluginobj): Update declaration.
5440
5441 2010-08-02 Ian Lance Taylor <iant@google.com>
5442
5443 PR 11866
5444 * output.cc (Output_segment::set_offset): Search for the first and
5445 last sections rather than assuming that the list is in order.
5446 (Output_segment::find_first_and_last_list): New function.
5447 * output.h (class Output_segment): Update declarations.
5448 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5449 (relro_strip_test_SOURCES): New variable.
5450 (relro_strip_test_DEPENDENCIES): New variable.
5451 (relro_strip_test_LDFLAGS): New variable.
5452 (relro_strip_test_LDADD): New variable.
5453 (relro_strip_test.so): New target.
5454
5455 2010-08-02 Ian Lance Taylor <iant@google.com>
5456
5457 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5458 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5459 (Target_i386::got_tlsdesc_section): New function.
5460 (Target_i386::got_section): Create space for GOT entries for
5461 TLSDESC relocations.
5462 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5463 R_386_TLS_GOTDESC.
5464 (Target_i386::Scan::global): Likewise.
5465 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5466 using TLSDESC GOT.
5467 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5468 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5469 (Target_x86_64::got_tlsdesc_section): New function.
5470 (Target_x86_64::got_section): Create space for GOT entries for
5471 TLSDESC relocations.
5472 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5473 R_386_TLS_GOTDESC.
5474 (Target_x86_64::Scan::global): Likewise.
5475 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5476 using TLSDESC GOT.
5477
5478 2010-08-02 Ian Lance Taylor <iant@google.com>
5479
5480 * testsuite/final_layout.sh: Use dc to convert from hex to
5481 decimal.
5482
5483 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5484
5485 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5486 paramter to the call to gold::gc_process_relocs.
5487 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5488 paramter to the call to gold::gc_process_relocs.
5489 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5490 parameter to the call to gold::gc_process_relocs.
5491 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5492 template parameter to the call to gold::gc_process_relocs.
5493 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5494 paramter to the call to gold::gc_process_relocs.
5495 * gc.h (get_embedded_addend_size): New function.
5496 (gc_process_relocs): Save the size of the reloc for use by ICF.
5497 * icf.cc (get_section_contents): Get the addend from the text section
5498 for SHT_REL relocation sections.
5499 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5500 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5501 * int_encoding.h (read_from_pointer): New overloaded function.
5502 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5503 * testsuite/icf_sht_rel_addend_test.sh: New file.
5504 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5505 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5506
5507 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5508
5509 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5510 * Makefile.in: Regenerate.
5511 * testsuite/Makefile.in: Regenerate.
5512
5513 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5514
5515 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5516 * gold/testsuite/debug_msg.cc: Likewise.
5517 * gold/testsuite/odr_violation1.cc
5518 * gold/testsuite/odr_violation2.cc
5519
5520 2010-07-21 Cary Coutant <ccoutant@google.com>
5521
5522 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5523 string, and length fields.
5524 (Output_merge_string::Merged_strings_list): New type.
5525 (Output_merge_string::Merged_strings_lists): New typedef.
5526 (Output_merge_string): Replace merged_strings_ with
5527 merged_strings_lists_.
5528 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5529 Merged_strings_list per input object and section. Don't store pointer
5530 to the string. Don't store length with each merged string entry.
5531 (Output_merge_string::finalize_merged_data): Loop over list of merged
5532 strings lists. Recompute length of each merged string.
5533
5534 2010-07-15 Cary Coutant <ccoutant@google.com>
5535
5536 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5537 here.
5538
5539 2010-07-14 Ian Lance Taylor <iant@google.com>
5540
5541 * descriptors.cc (Descriptors::open): Report correct name in error
5542 message.
5543
5544 2010-07-13 Doug Kwan <dougkwan@google.com>
5545
5546 * arm.cc (Arm_input_section::Arm_input_section): For a
5547 SHT_ARM_EXIDX section, always keeps the input sections.
5548 (Arm_input_section::set_exidx_section_link): New method.
5549 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5550 has_errors_ to false.
5551 (Arm_exidx_input_section::has_errors,
5552 Arm_exidx_input_section::set_has_errors): New methods.
5553 (Arm_exidx_input_section::has_errors_): New data member.
5554 (Arm_relobj::get_exidx_shndx_list): New method.
5555 (Arm_output_section::append_text_sections_to_list): Do not skip
5556 section without SHF_EXECINSTR.
5557 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5558 errors.
5559 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5560 section header. Make error messages more verbose. Check for
5561 a non-executable section linked to an EXIDX section.
5562 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5563 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5564 check that there is no deferred EXIDX section if we exit early.
5565 Instead of not making an EXIDX section in case of an error, make one
5566 and set the has_errors flag of it.
5567 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5568 in a relocatable link.
5569 (Target_arm::do_relax): Look for the EXIDX output section instead of
5570 assuming that it is called .ARM.exidx.
5571 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5572 section list. Do not check for SHF_EXECINSTR section flags but
5573 skip any input section with errors.
5574 * output.cc (Output_section::Output_section): Initialize
5575 always_keeps_input_sections_ to false.
5576 (Output_section::add_input_section): Check for
5577 always_keeps_input_sections_.
5578 * output.h (Output_section::always_keeps_input_sections,
5579 Output_section::set_always_keeps_input_sections): New methods.
5580 (Output_section::always_keeps_input_sections): New data member.
5581
5582 2010-07-13 Rafael Espindola <espindola@google.com>
5583
5584 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5585 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5586
5587 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5588 Ian Lance Taylor <iant@google.com>
5589
5590 * output.h (Output_section_lookup_maps::add_merge_section):
5591 Correct check of whether value was inserted.
5592 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5593 (Output_section_lookup_maps::add_relaxed_input_section):
5594 Likewise.
5595 * arm.cc (Target_arm::got_section): Remove used local os.
5596 * i386.cc (Target_i386::got_section): Likewise.
5597 * x86_64.cc (Target_x86_64::got_section): Likewise.
5598 * sparc.cc (Target_sparc::got_section): Likewise.
5599 (Target_sparc::relocate): Remove unused local have_got_offset.
5600 * powerpc.cc (Target_powerpc::relocate): Likewise.
5601
5602 2010-07-13 Ian Lance Taylor <iant@google.com>
5603
5604 * compressed_output.cc (zlib_decompress): Fix signature in
5605 !HAVE_ZLIB_H case.
5606
5607 * archive.cc (Archive::include_member): Unlock an external member
5608 of a thin archive. Don't bother to delete an object we know is
5609 NULL.
5610
5611 2010-07-12 Cary Coutant <ccoutant@google.com>
5612
5613 * compressed_output.cc (zlib_decompress): New function.
5614 (get_uncompressed_size): New function.
5615 (decompress_input_section): New function.
5616 * compressed_output.h (get_uncompressed_size): New function.
5617 (decompress_input_section): New function.
5618 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5619 Handle compressed debug sections.
5620 * layout.cc (is_compressed_debug_section): New function.
5621 (Layout::output_section_name): Map compressed section names to
5622 canonical names.
5623 * layout.h (is_compressed_debug_section): New function.
5624 (is_debug_info_section): Recognize compressed debug sections.
5625 * merge.cc: Include compressed_output.h.
5626 (Output_merge_data::do_add_input_section): Handle compressed
5627 debug sections.
5628 (Output_merge_string::do_add_input_section): Handle compressed
5629 debug sections.
5630 * object.cc: Include compressed_output.h.
5631 (Sized_relobj::Sized_relobj): Initialize new data members.
5632 (build_compressed_section_map): New function.
5633 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5634 * object.h (Object::section_is_compressed): New method.
5635 (Object::do_section_is_compressed): New method.
5636 (Sized_relobj::Compressed_section_map): New type.
5637 (Sized_relobj::do_section_is_compressed): New method.
5638 (Sized_relobj::compressed_sections_): New data member.
5639 * output.cc (Output_section::add_input_section): Handle compressed
5640 debug sections.
5641 * reloc.cc: Include compressed_output.h.
5642 (Sized_relobj::write_sections): Handle compressed debug sections.
5643
5644 2010-07-08 Cary Coutant <ccoutant@google.com>
5645
5646 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5647 weak when resolving to a dynamic def.
5648 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5649 for weak undef/dynamic def cases. Adjust callers.
5650 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5651 undef_binding_weak_.
5652 (Symbol_table::sized_write_globals): Adjust symbol binding.
5653 (Symbol_table::sized_write_symbol): Add binding parameter.
5654 * symtab.h (Symbol::set_undef_binding): New method.
5655 (Symbol::is_undef_binding_weak): New method.
5656 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5657 (Symbol_table::should_override): Add new parameter.
5658 (Symbol_table::sized_write_symbol): Add new parameter.
5659
5660 * testsuite/weak_undef_file1.cc: Add new test case.
5661 * testsuite/weak_undef_file2.cc: Fix header comment.
5662 * testsuite/weak_undef_test.cc: Add new test case.
5663
5664 2010-06-29 Doug Kwan <dougkwan@google.com>
5665
5666 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5667 Initialize USE_SYMBOL_.
5668 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5669 definition.
5670 (Arm_reloc_property::uses_symbol_): New data member declaration.
5671 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5672 uses symbol value and symbol is undefined but not weakly undefined.
5673
5674 2010-06-28 Rafael Espindola <espindola@google.com>
5675
5676 * plugin.cc (Plugin::load): Use dlerror.
5677
5678 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5679
5680 * symtab.cc (detect_odr_violations): When reporting an ODR
5681 violation, report an object where the symbol is defined.
5682
5683 2010-06-25 Doug Kwan <dougkwan@google.com>
5684
5685 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5686 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5687 definition.
5688 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5689 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5690 target hook to detect function points.
5691 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5692 * icf.h (Icf::check_section_for_function_pointers): Change type of
5693 parameter SECTION_NAME to const reference to std::string. Use
5694 target hook to determine if section may have unsafe pointers.
5695 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5696 method definition.
5697
5698 2010-06-21 Rafael Espindola <espindola@google.com>
5699
5700 * fileread.cc (Input_file::find_fie): New
5701 (Input_file::open): Use Input_file::find_fie.
5702 * fileread.h (Input_file::find_fie): New
5703 * plugin.cc (set_extra_library_path): New.
5704 (Plugin::load): Add set_extra_library_path to the transfer vector.
5705 (Plugin_manager::set_extra_library_path): New.
5706 (Plugin_manager::add_input_file): Use the extra search path if set.
5707 (set_extra_library_path(): New.
5708 * plugin.h (Plugin_manager): Add set_extra_library_path and
5709 extra_search_path_.
5710
5711 2010-06-19 Cary Coutant <ccoutant@google.com>
5712
5713 * layout.cc (gdb_sections): Add .debug_types.
5714 (lines_only_debug_sections): Likewise.
5715
5716 2010-06-18 Rafael Espindola <espindola@google.com>
5717
5718 * plugin.cc (add_input_file,add_input_library)
5719 (Plugin_manager::add_input_file): Make filename arguments const.
5720 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5721 const.
5722
5723 2010-06-16 Doug Kwan <dougkwan@google.com>
5724
5725 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5726 .ARM.attributes section if we have not merged any input
5727 attributes sections.
5728
5729 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5730
5731 * arm.cc: Allow combining objects with no EABI version
5732 information.
5733
5734 2010-06-15 Rafael Espindola <espindola@google.com>
5735
5736 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5737
5738 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5739
5740 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5741 (struct iovec): Correct !HAVE_READV definition.
5742
5743 2010-06-10 Cary Coutant <ccoutant@google.com>
5744
5745 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5746 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5747 reloc sections.
5748 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5749
5750 PR 11683
5751 * symtab.h (Symbol::is_placeholder): New member function.
5752 * target-reloc.h (relocate_section): Check for placeholder symbols.
5753
5754 * testsuite/Makefile.am (plugin_test_8): New test.
5755 (plugin_test_9): New test.
5756 * testsuite/Makefile.in: Regenerate.
5757
5758 2010-06-09 Nick Clifton <nickc@redhat.com>
5759
5760 * yyscript.y (input_list_element): Allow strings prefixed with
5761 the '-' character. Treat these as libraries.
5762 * script.cc (script_add_library): New function. Adds a library
5763 specified by "-l<name>" found in an input script.
5764 * script-c.h: Add prototype for script_add_library.
5765
5766 2010-06-07 Doug Kwan <dougkwan@google.com>
5767
5768 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5769 Restrict stub-group size to be within long conditional branch
5770 range when working around cortex-A8 erratum.
5771
5772 2010-06-07 Damien Diederen <dd@crosstwine.com>
5773
5774 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5775 #ifdef typo.
5776
5777 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5778
5779 PR gold/11658
5780 * output.cc
5781 (Output_section::Input_section_sort_entry::compare_section_ordering):
5782 Change to return non-zero correctly.
5783 (Output_section::Input_section_sort_section_order_index_compare
5784 ::operator()): Change to fix ambiguity in comparisons.
5785
5786 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5787
5788 * gold.h (is_wildcard_string): New function.
5789 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5790 (Layout::layout_eh_frame): Ditto.
5791 (Layout::find_section_order_index): New method.
5792 (Layout::read_layout_from_file): New method.
5793 * layout.h (Layout::find_section_order_index): New method.
5794 (Layout::read_layout_from_file): New method.
5795 (Layout::input_section_position_): New private member.
5796 (Layout::input_section_glob_): New private member.
5797 * main.cc (main): Call read_layout_from_file here.
5798 * options.h (--section-ordering-file): New option.
5799 * output.cc (Output_section::input_section_order_specified_): New
5800 member.
5801 (Output_section::Output_section): Initialize new member.
5802 (Output_section::add_input_section): Add new parameter.
5803 Keep input sections when --section-ordering-file is used.
5804 (Output_section::set_final_data_size): Sort input sections when
5805 section ordering file is specified.
5806 (Output_section::Input_section_sort_entry): Add new parameter.
5807 Check sorting type.
5808 (Output_section::Input_section_sort_entry::compare_section_ordering):
5809 New method.
5810 (Output_section::Input_section_sort_compare::operator()): Change to
5811 consider section_order_index.
5812 (Output_section::Input_section_sort_init_fini_compare::operator()):
5813 Change to consider section_order_index.
5814 (Output_section::Input_section_sort_section_order_index_compare
5815 ::operator()): New method.
5816 (Output_section::sort_attached_input_sections): Change to sort
5817 according to section order when specified.
5818 (Output_section::add_input_section<32, true>): Add new parameter.
5819 (Output_section::add_input_section<64, true>): Add new parameter.
5820 (Output_section::add_input_section<32, false>): Add new parameter.
5821 (Output_section::add_input_section<64, false>): Add new parameter.
5822 * output.h (Output_section::add_input_section): Add new parameter.
5823 (Output_section::input_section_order_specified): New
5824 method.
5825 (Output_section::set_input_section_order_specified): New method.
5826 (Input_section::Input_section): Initialize section_order_index_.
5827 (Input_section::section_order_index): New method.
5828 (Input_section::set_section_order_index): New method.
5829 (Input_section::section_order_index_): New member.
5830 (Input_section::Input_section_sort_section_order_index_compare): New
5831 struct.
5832 (Output_section::input_section_order_specified_): New member.
5833 * script-sections.cc (is_wildcard_string): Delete and move modified
5834 method to gold.h.
5835 (Output_section_element_input::Output_section_element_input): Modify
5836 call to is_wildcard_string.
5837 (Output_section_element_input::Input_section_pattern
5838 ::Input_section_pattern): Ditto.
5839 (Output_section_element_input::Output_section_element_input): Ditto.
5840 * testsuite/Makefile.am (final_layout): New test case.
5841 * testsuite/Makefile.in: Regenerate.
5842 * testsuite/final_layout.cc: New file.
5843 * testsuite/final_layout.sh: New file.
5844
5845 2010-06-01 Rafael Espindola <espindola@google.com>
5846
5847 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5848
5849 2010-06-01 Rafael Espindola <espindola@google.com>
5850
5851 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5852 visibility of symbols.
5853
5854 2010-05-27 Doug Kwan <dougkwan@google.com>
5855
5856 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5857 from start of output section instead of address for a local symbol
5858 in a merged or relaxed section when doing a relocatable link.
5859
5860 2010-05-26 Rafael Espindola <espindola@google.com>
5861
5862 PR 11604
5863 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5864 adding sections the garbage collector removed.
5865 * gold/testsuite/Makefile.am: Add test.
5866 * gold/testsuite/Makefile.in: Regenerate.
5867 * gold/testsuite/plugin_test_7.sh: New.
5868 * gold/testsuite/plugin_test_7_1.c: New.
5869 * gold/testsuite/plugin_test_7_2.c: New.
5870
5871 2010-05-26 Rafael Espindola <espindola@google.com>
5872
5873 * script-sections.cc (Output_section_definition::set_section_addresses):
5874 Check for --section-start.
5875
5876 2010-05-26 Doug Kwan <dougkwan@google.com>
5877
5878 * arm.cc (Arm_scan_relocatable_relocs): New class.
5879 (Target_arm::relocate_special_relocatable): New method.
5880 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5881 (Arm_relocate_functions::thumb_branch_common): Same.
5882 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5883 instead of Default_scan_relocatable_relocs.
5884 * target-reloc.h (relocate_for_relocatable): Let target handle
5885 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5886 * target.h (Sized_target::relocate_special_relocatable): New method.
5887
5888 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5889
5890 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5891
5892 2010-05-23 Doug Kwan <dougkwan@google.com>
5893
5894 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5895 instead of a cast.
5896 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5897 with a direct branch, not a conditional branch, to a stub.
5898 * merge.cc (Output_merge_base::record_input_section): New method
5899 defintion.
5900 (Output_merge_data::do_add_input_section): Record input section if
5901 keeps-input-sections flag is set.
5902 (Output_merge_string::do_add_input_section): Ditto.
5903 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5904 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5905 INPUT_SECTIONS_.
5906 (Output_merge_base::keeps_input_sections,
5907 Output_merge_base::set_keeps_input_sections,
5908 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5909 method definitions.
5910 (Output_merge_base::Input_sections): New type declaration.
5911 (Output_merge_base::input_sections_begin,
5912 Output_merge_base::input_sections_end,
5913 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5914 (Output_merge_base::bool keeps_input_sections_,
5915 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5916 Output_merge_base::input_sections_): New data members.
5917 (Output_merge_data::do_set_keeps_input_sections): New method
5918 defintion.
5919 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5920 * output.cc (Output_section::Input_section::relobj): Move method
5921 defintion from class declaration to here and handle merge sections.
5922 (Output_section::Input_section::shndx): Ditto.
5923 (Output_section::Output_section): Remove initializations of removed
5924 data members and initialize new data member LOOKUP_MAPS_.
5925 (Output_section::add_input_section): Set keeps-input-sections flag
5926 for a newly created merge output section as appropriate. Adjust code
5927 to use Output_section_lookup_maps class.
5928 (Output_section::add_relaxed_input_section): Adjst code for lookup
5929 maps code refactoring.
5930 (Output_section::add_merge_input_section): Add a new parameter
5931 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5932 class. If adding input section to a newly created merge output
5933 section fails, remove the new merge section.
5934 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5935 Adjust code for use of the Output_section_lookup_maps class.
5936 (Output_section::find_merge_section): Ditto.
5937 (Output_section::build_lookup_maps): New method defintion.
5938 (Output_section::find_relaxed_input_section): Adjust code to use
5939 Output_section_lookup_maps class.
5940 (Output_section::get_input_sections): Export merge sections. Adjust
5941 code to use Output_section_lookup_maps class.
5942 (Output_section:::add_script_input_section): Adjust code to use
5943 Output_section_lookup_maps class. Update lookup maps for merge
5944 sections also.
5945 (Output_section::discard_states): Use Output_section_lookup_maps.
5946 (Output_section::restore_states): Same.
5947 * output.h (Merge_section_properties): Move class defintion out of
5948 Output_section.
5949 (Output_section_lookup_maps): New class.
5950 (Output_section::Input_section::is_merge_section): New method
5951 defintion.
5952 (Output_section::Input_section::relobj): Move defintion out of class
5953 defintion. Declare method only.
5954 (Output_section::Input_section::shndx): Ditto.
5955 (Output_section::Input_section::output_merge_base): New method defintion.
5956 (Output_section::Input_section::u2_.pomb): New union field.
5957 (Output_section::Merge_section_by_properties_map,
5958 Output_section::Output_section_data_by_input_section_map,
5959 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5960 Remove types.
5961 (Output_section::add_merge_input_section): Add new parameter
5962 KEEPS_INPUT_SECTIONS.
5963 (Output_section::build_lookup_maps): New method declaration.
5964 (Output_section::merge_section_map_,
5965 Output_section::merge_section_by_properties_map_,
5966 Output_section::relaxed_input_section_map_,
5967 Output_section::is_relaxed_input_section_map_valid_): Remove data
5968 members.
5969 (Output_section::lookup_maps_): New data member.
5970
5971 2010-05-21 Doug Kwan <dougkwan@google.com>
5972
5973 PR gold/11619
5974 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5975 avoid a compilation error.
5976
5977 2010-05-19 Rafael Espindola <espindola@google.com>
5978
5979 * script-sections.cc (Output_section_definition::allocate_to_segment):
5980 Update the phdrs_list even when the output section is NULL.
5981 * testsuite/Makefile.am: Add test.
5982 * testsuite/Makefile.in: Regenerate.
5983 * testsuite/script_test_9.cc: New.
5984 * testsuite/script_test_9.sh: New.
5985 * testsuite/script_test_9.t: New.
5986
5987 2010-05-19 Doug Kwan <dougkwan@google.com>
5988
5989 * arm.cc (Arm_input_section::original_size): New method.
5990 (Arm_input_section::do_addralign): Add a cast.
5991 (Arm_input_section::do_output_offset): Remove static cast.
5992 (Arm_input_section::original_addralign,
5993 Arm_input_section::original_size_): Change type to uint32_t.
5994 (Arm_input_section::init): Add safe casts for section alignment
5995 and size.
5996 (Arm_input_section::set_final_data_size): Do not set address and
5997 offset of stub table.
5998 (Arm_output_section::fix_exidx_coverage): Change use of of
5999 Output_section::Simple_input_section to that of
6000 Output_section::Input_section.
6001 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6002 except for the first pass.
6003 * output.cc (Output_section::get_input_sections): Change type of
6004 input_sections to std::list<Input_section>.
6005 (Output_section::add_script_input_section): Rename from
6006 Output_section::add_simple_input_section. Change type of SIS
6007 parameter from Simple_input_section to Input_section.
6008 * output.h (Output_section::Simple_input_section): Remove class.
6009 (Output_section::Input_section): Change class visibility to public.
6010 (Output_section::Input_section::addralign): Use stored alignments
6011 for special input sections if set.
6012 (Output_section::Input_section::set_addralign): New method.
6013 (Output_section::get_input_sections): Change parameter type from
6014 list of Simple_input_section to list of Input_section.
6015 (Output_section::add_script_input_section): Rename from
6016 Output_section::add_simple_input_section. Change first parameter's
6017 type from Simple_input_section to Input_section and remove the
6018 second and third parameters.
6019 * script-sections.cc (Input_section::Input_section_list): Change
6020 type to list of Output_section::Input_section/
6021 (Input_section_info::Input_section_info): Change parameter type of
6022 INPUT_SECTION to Output_section::Input_section.
6023 (Input_section_info::input_section): Change return type.
6024 (Input_section_info::input_section_): Change type to
6025 Output_section::Input_section.
6026 (Output_section_element_input::set_section_addresses): Adjust code
6027 to use Output_section::Input_section instead of
6028 Output_section::Simple_input_section. Adjust code for renaming
6029 of Output_section::add_simple_input_section.
6030 (Orphan_output_section::set_section_addresses): Ditto.
6031
6032 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6033
6034 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6035 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6036
6037 2010-05-18 Rafael Espindola <espindola@google.com>
6038
6039 * options.cc (General_options::finalize): Handle -nostdlib.
6040 * options.h (nostdlib): New option.
6041 * script.cc (script_add_search_dir): Handle -nostdlib.
6042
6043 2010-05-12 Doug Kwan <dougkwan@google.com>
6044
6045 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6046 attributes section only if there no attributes section after merging.
6047 (Target_arm::merge_object_attributes): Move value of
6048 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6049 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6050 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6051 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6052 and arm_attr_merge_7.stdout.
6053 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6054 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6055 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6056 arm_attr_merge_7b.o): New rules.
6057 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6058 arm_attr_merge_7
6059 * testsuite/Makefile.in: Regenerate.
6060 * testsuite/arm_attr_merge.sh: New file.
6061 * testsuite/arm_attr_merge_[67][ab].s: Same.
6062
6063 2010-05-05 Nick Clifton <nickc@redhat.com>
6064
6065 * po/es.po: Updated Spanish translation.
6066
6067 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6068
6069 * Makefile.am (install-exec-local): Properly install gold as
6070 default cross linker.
6071 * Makefile.in: Regenerated.
6072
6073 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6074 Nick Clifton <nickc@redhat.com>
6075
6076 * configure.ac (install_as_default): Define and set to false
6077 unless --enable-gold or --enable-gold=both/gold has been
6078 specified.
6079 * configure: Regenerate.
6080
6081 * Makefile.am (install-exec-local): Install the executable as
6082 'ld.gold'. If install_as_default is true then also install it as
6083 'ld'.
6084 * Makefile.in: Regenerated.
6085
6086 2010-04-24 Ian Lance Taylor <iant@google.com>
6087
6088 * layout.cc (Layout::layout_reloc): In relocatable link don't
6089 combine reloc sections for grouped sections.
6090
6091 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6092
6093 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6094 sections that are not ordinary to icf.
6095 * icf.cc (get_section_contents): Handle relocation pointing to section
6096 with no object or shndx information.
6097 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6098 * testsuite/Makefile.in: Regenerate.
6099 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6100 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6101
6102 2010-04-22 Ian Lance Taylor <iant@google.com>
6103
6104 * expression.cc (Expression::Expression_eval_info): Add
6105 result_alignment_pointer field.
6106 (Expression::eval_with_dot): Add result_alignment_pointer
6107 parameter. Change all callers.
6108 (Expression::eval_maybe_dot): Likewise.
6109 (class Binary_expression): Add alignment_pointer parameter to
6110 left_value and right_value. Change all callers.
6111 (BINARY_EXPRESSION): Set result alignment.
6112 (class Trinary_expression): Add alignment_pointer parameter to
6113 arg2_value and arg3_value. Change all callers.
6114 (Trinary_cond::value): Set result alignment.
6115 (Max_expression::value, Min_expression::value): Likewise.
6116 (Align_expression::value): Likewise.
6117 * script-sections.cc (class Sections_element): Add dot_alignment
6118 parameter to set_section_addresses virtual function. Update
6119 instantiations.
6120 (class Output_section_element): Likewise.
6121 (Script_sections::create_segments): Add dot_alignment parameter.
6122 Change all callers.
6123 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6124 (Script_sections::set_phdrs_clause_addresses): Likewise.
6125 * script-sections.h: Update declarations.
6126 * script.h: Update declarations.
6127 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6128 min_p_align.
6129 * testsuite/script_test_3.t: Set large alignment.
6130 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6131 segment has expected alignment.
6132
6133 2010-04-22 Nick Clifton <nickc@redhat.com>
6134
6135 * po/gold.pot: Updated by the Translation project.
6136 * po/vi.po: Updated Vietnamese translation.
6137
6138 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6139
6140 * testsuite/Makefile.am (check_PROGRAMS): Add
6141 icf_virtual_function_folding_test.
6142 * testsuite/Makefile.in: Regenerated.
6143
6144 2010-04-15 Andrew Haley <aph@redhat.com>
6145
6146 * options.h (merge_exidx_entries): New option.
6147 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6148 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6149 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6150 (Target_arm::merge_exidx_entries): New function.
6151 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6152 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6153 to Arm_exidx_fixup constructor.
6154 Add new arg, merge_exidx_entries.
6155 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6156 Arm_output_section::fix_exidx_coverage.
6157
6158 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6159
6160 * icf.cc (get_section_contents): Check for preemptible functions.
6161 Ignore addend when appropriate.
6162 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6163 section folded.
6164 (add_from_relobj): Check for section folded.
6165 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6166 * symtab.h (should_add_dynsym_entry): Add new parameter.
6167 * target-reloc.h (scan_relocs): Check for section folded.
6168 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6169 Check reloc types for function pointers in shared objects.
6170 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6171 case.
6172 (icf_preemptible_functions_test): New test case.
6173 (icf_string_merge_test): New test case.
6174 * testsuite.Makefile.in: Regenerate.
6175 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6176 bar_glob. Refactor code.
6177 * testsuite/icf_preemptible_functions_test.cc: New file.
6178 * testsuite/icf_preemptible_functions_test.sh: New file.
6179 * testsuite/icf_string_merge_test.cc: New file.
6180 * testsuite/icf_string_merge_test.sh: New file.
6181 * testsuite/icf_virtual_function_folding_test.cc: New file.
6182 * testsuite/icf_virtual_function_folding_test.sh: New file.
6183
6184 2010-04-14 Doug Kwan <dougkwan@google.com>
6185
6186 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6187 for local symbol recounting if we remove a section due to ICF.
6188 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6189 there are no regular objects in input.
6190
6191 2010-04-13 Doug Kwan <dougkwan@google.com>
6192
6193 * arm.cc (Arm_input_section::set_final_data_size): Compute
6194 accurate final data size instead of using current data size.
6195
6196 2010-04-09 Doug Kwan <dougkwan@google.com>
6197
6198 * layout.cc (Layout::choose_output_section): Handle script section
6199 types.
6200 (Layout::make_output_section_for_script): Add section type parameter.
6201 Handle script section types.
6202 * layout.h (Layout::make_output_section_for_script): Add section
6203 type parameter.
6204 * output.cc (Output_section::Output_section): Initialize data member
6205 is_noload_.
6206 (Output_section::do_reset_address_and_file_offset): Do not set address
6207 to 0 if section is a NOLOAD section.
6208 * output.h (Output_section::is_noload): New method.
6209 (Output_section::set_is_noload): Ditto.
6210 (Output_section::is_noload_): New data member.
6211 * script-c.h (Script_section_type): New enum type.
6212 (struct Parser_output_section_header): Add new file section_type.
6213 * script-sections.cc (Sections_element::output_section_name): Add
6214 parameter for returning script section type.
6215 (Output_section_definition::output_section_name): Ditto.
6216 (Output_section_definition::section_type)P; New method.
6217 (Output_section_definiton::script_section_type_name): Ditto.
6218 (Output_section_definition::script_section_type_): New data member.
6219 (Output_section_definition::Output_section_definition): Initialize
6220 data member Output_section_definition::script_section_type_.
6221 (Output_section_definition::create_sections): Pass script section type
6222 to Layout::make_output_section_for_script.
6223 (Output_section_definition::output_section_name): Return script
6224 section type to caller.
6225 (Output_section_definition::set_section_address): Do not advance
6226 dot value and load address if section type is NOLOAD. Set address
6227 of NOLOAD sections regardless of section flags.
6228 (Output_section_definition::print): Print section type if it is
6229 not SCRIPT_SECTION_TYPE_NONE.
6230 (Output_section_definition::section_type): New method.
6231 (Output_section_definition::script_section_type_name): Ditto.
6232 (Script_sections::output_section_name): Add new parameter
6233 PSECTION_TYPE for returning script section type. Pass it to
6234 section elements. Handle discard sections.
6235 (Sort_output_sections::operator()): Handle NOLOAD sections.
6236 * script-sections.h (Script_sections::Section_type): New enum type.
6237 (Script_sections::output_section_name): Add a new parameter for
6238 returning script section type.
6239 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6240 INFO and NOLOAD.
6241 * yyscript.y (union): Add new field SECTION_TYPE.
6242 (COPY, DSECT, INFO, NOLOAD): New tokens.
6243 (opt_address_and_section_type): Change type to output_section_header.
6244 (section_type): New non-terminal
6245 (section_header): Handle section type.
6246 (opt_address_and_section_type): Return section type value.
6247
6248 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6249
6250 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6251 * testsuite/plugin_common_test_2.c (foo): Likewise.
6252
6253 2010-04-08 Doug Kwan <dougkwan@google.com>
6254
6255 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6256 Output_merge_data.
6257 * output.cc (Output_section::add_merge_input_section): Simplify
6258 code and return status of Output_merge_base::add_input_section.
6259 Update merge section map only if Output_merge_base::add_input_section
6260 returns true.
6261
6262 2010-04-07 Doug Kwan <dougkwan@google.com>
6263
6264 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6265 if section is marked as containing instructions but has no mapping
6266 symbols.
6267 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6268 correct section index.
6269 (Arm_relobj::find_linked_text_section): Ditto.
6270
6271 2010-04-07 Cary Coutant <ccoutant@google.com>
6272
6273 * archive.cc (include_member): Destroy Read_symbols_data object before
6274 releasing file.
6275 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6276 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6277 (Read_symbols_data::~Read_symbols_data) New destructor.
6278 (Section_relocs::Section_relocs) New constructor.
6279 (Section_relocs::~Section_relocs) New destructor.
6280 (Read_relocs_data::Read_relocs_data) New constructor.
6281 (Read_relocs_data::~Read_relocs_data) New destructor.
6282 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6283 pointers to NULL after deleting.
6284
6285 2010-04-07 Doug Kwan <dougkwan@google.com>
6286
6287 * arm.cc: Replace "endianity" with "endianness" in comments.
6288 (Arm_exidx_cantunwind): Ditto.
6289 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6290 (Arm_relobj::merge_flags_and_attributes): New method.
6291 (Arm_relobj::merge_flags_and_attributes_): New data member.
6292 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6293 (Arm_relobj::scan_sections_for_stubs): Ditto.
6294 (Arm_relobj::do_read_symbols): Check to see if we really want to
6295 merge processor-specific flags and attributes. Exit early if
6296 an object is empty except for section names and the undefined symbol.
6297 (Target_arm::do_finalize_sections): Move check for ELF format to
6298 Arm_relobj::do_read_symbols. Merge processor specific flags and
6299 attributes from a regular object only when we have determined that
6300 it is aapropriate. Do not create an .ARM.attributes section in
6301 output if there is no regular input object.
6302 (Target_arm::merge_processor_specific_flags): Check
6303 --warn-mismatch before printing any error.
6304 (Target_arm::merge_object_attributes): Ditto.
6305 * gold.cc (queue_middle_tasks): Handle the case in which there is
6306 no regular object in input.
6307 * options.cc (General_options::parse_EB): New method.
6308 (General_options::parse_EL): Same.
6309 (General_options::General_options): Initialize endianness_.
6310 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6311 New options.
6312 (General_options::Endianness): New enum.
6313 (General_options::endianness): New method.
6314 (General_options::endianness_): New data member.
6315 * parameters.cc (Parameters::set_options): Check target endianness.
6316 (Parameters::set_target_once): Ditto.
6317 (Parameters::check_target_endianness): New method.
6318 (parameters_force_valid_target): If either -EL or -EB is specified,
6319 use it to define endianness of default target.
6320 * parameters.h (Parameters::check_target_endianness): New method
6321 declaration.
6322 * target.h (class Target): Change "endianity" to "endianness"
6323 in comments.
6324
6325 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6326
6327 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6328 * configure: Regenerate.
6329 * Makefile.in: Regenerate.
6330 * testsuite/Makefile.in: Regenerate.
6331
6332 2010-04-06 Cary Coutant <ccoutant@google.com>
6333
6334 gcc PR lto/42757
6335 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6336 prevailing definitions of common symbols.
6337 * testsuite/plugin_test_6.sh: New test case.
6338 * testsuite/plugin_common_test_1.c: New test case.
6339 * testsuite/plugin_common_test_2.c: New test case.
6340 * testsuite/Makefile.am (plugin_test_6): New test case.
6341 * testsuite/Makefile.in: Regenerate.
6342
6343 2010-04-06 Nick Clifton <nickc@redhat.com>
6344
6345 * po/vi.po: New Vietnamese translation.
6346
6347 2010-03-30 Doug Kwan <dougkwan@google.com>
6348
6349 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6350
6351 2010-03-25 Doug Kwan <dougkwan@google.com>
6352
6353 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6354 to avoid a conversion warning on a 32-bit host.
6355
6356 2010-03-24 Ian Lance Taylor <iant@google.com>
6357
6358 * testsuite/script_test_3.t: Add a TLS segment.
6359 * testsuite/Makefile.am (check_PROGRAMS): Add
6360 tls_phdrs_script_test.
6361 (tls_phdrs_script_test_SOURCES): Define.
6362 (tls_phdrs_script_test_DEPENDENCIES): Define.
6363 (tls_phdrs_script_test_LDFLAGS): Define.
6364 (tls_phdrs_script_test_LDADD): Define.
6365 * testsuite/Makefile.in: Rebuild.
6366
6367 2010-03-23 Cary Coutant <ccoutant@google.com>
6368
6369 * fileread.cc (find_or_make_view): Fix comment.
6370
6371 2010-03-23 Ian Lance Taylor <iant@google.com>
6372
6373 * script-sections.cc (class Orphan_section_placement): Define
6374 PLACE_TLS and PLACE_TLS_BSS.
6375 (Orphan_section_placement::Orphan_section_placement): Initialize
6376 new places.
6377 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6378 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6379 (tls_script_test_SOURCES): Define.
6380 (tls_script_test_DEPENDENCIES): Define.
6381 (tls_script_test_LDFLAGS): Define.
6382 (tls_script_test_LDADD): Define.
6383 * testsuite/Makefile.in: Rebuild.
6384
6385 2010-03-22 Doug Kwan <dougkwan@google.com>
6386
6387 * arm.cc (Arm_relocate_functions::abs8,
6388 Arm_relocate_functions::abs16): Use correct check for overflow
6389 specified in the ARM ELF specs.
6390 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6391 target of a BLX instruction specially.
6392 (Reloc_stub::stub_type_for_reloc): Ditto.
6393 (Relocate::relocate): Use symbolic names instead of numeric relocation
6394 codes to report error.
6395 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6396 workaround.
6397 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6398 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6399 thumb2_blx_out_of_range.stdout
6400 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6401 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6402 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6403 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6404 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6405 thumb2_blx_in_range, thumb2_blx_in_range.o,
6406 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6407 thumb2_blx_out_of_range.o): New rules.
6408 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6409 thumb2_blx_in_range and thumb2_blx_out_of_range.
6410 * testsuite/Makefile.in: Regenerate.
6411 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6412 * testsuite/thumb_blx_in_range.s: New file.
6413 * testsuite/thumb_blx_out_of_range.s: New file.
6414
6415 2010-03-22 Rafael Espindola <espindola@google.com>
6416
6417 * archive.cc (Should_include): Move to archive.h.
6418 (should_include_member): Make it a member of Archive.
6419 (Lib_group): New.
6420 (Add_lib_group_symbols): New.
6421 * archive.h: Include options.h.
6422 (Archive_member): Moved from Archive.
6423 (Should_include): Moved from archive.cc.
6424 (Lib_group): New.
6425 (Add_lib_group_symbols): New.
6426 * dynobj.cc (do_should_include_member): New.
6427 * dynobj.h (do_should_include_member): New.
6428 * gold.cc (queue_initial_tasks): Update call to queue.
6429 * main.cc (main): Print lib group stats.
6430 * object.cc (do_should_include_member): New.
6431 * object.h: Include archive.h.
6432 (Object::should_include_member): New.
6433 (Object::do_should_include_member): New.
6434 (Sized_relobj::do_should_include_member): New.
6435 * options.cc (General_options::parse_start_lib): New.
6436 (General_options::parse_end_lib): New.
6437 (Input_arguments::add_file): Handle lib groups.
6438 (Input_arguments::start_group): Check we are not in a lib.
6439 (Input_arguments::start_lib): New.
6440 (Input_arguments::end_lib): New.
6441 * options.h (General_options): Add start_lib and end_lib.
6442 (Input_argument::lib_): New.
6443 (Input_argument::lib): New.
6444 (Input_argument::is_lib): New.
6445 (Input_file_lib): New.
6446 (Input_arguments::in_lib_): New.
6447 (Input_arguments::in_lib): New.
6448 (Input_arguments::start_lib): New.
6449 (Input_arguments::end_lib_): New.
6450 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6451 in unused members as preempted.
6452 (Sized_pluginobj::do_should_include_member): New.
6453 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6454 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6455 return the blocker.
6456 (Read_symbols::do_whole_lib_group): New.
6457 (Read_symbols::do_lib_group): New.
6458 (Read_symbols::do_read_symbols): Handle lib groups.
6459 (Read_symbols::get_name): Handle lib groups.
6460 * readsyms.h (Read_symbols): Add an archive member pointer.
6461 (Read_symbols::do_whole_lib_group): New.
6462 (Read_symbols::do_lib_group): New.
6463 (Read_symbols::member_): New.
6464 * script.cc (read_input_script): Update call to queue_soon.
6465
6466 2010-03-19 Doug Kwan <dougkwan@google.com>
6467
6468 * arm.cc (Stub_table::Stub_table): Initialize new data members
6469 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6470 (Stub_table::add_reloc_stub): Assign stub offset and update
6471 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6472 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6473 New data members.
6474 (Stub_table::update_data_size_and_addralign): Use
6475 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6476 instead of going over all reloc stubs.
6477 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6478 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6479 Stringpool_template::offset_ to size of Stringpool_char.
6480 (Stringpool_template::new_key_offset): Remove code to initialize
6481 Stringpool_template::offset_.
6482 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6483 Stringpool_template::offset_ to zero.
6484
6485 2010-03-15 Doug Kwan <dougkwan@google.com>
6486
6487 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6488 offset_.
6489 (Stringpool_template::new_key_offset): New method.
6490 (Stringpool_template::add_string): Assign offsets when adding new
6491 strings.
6492 (Stringpool_template::set_string_offsets): Do not set string offsets
6493 when not optimizing.
6494 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6495 member size_.
6496 (Chunked_vector::clear): Clear size_.
6497 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6498 (Chunked_vector::size): Return size_.
6499 (Chunked_vector::push_back): Use size_ to find insert position.
6500 (Chunked_vector::size_): New data member.
6501 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6502 (Stringpool_template::new_key_offset): New method declaration.
6503 (Stringpool_template::offset_): New data member.
6504
6505 2010-03-15 Rafael Espindola <espindola@google.com>
6506
6507 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6508 Add_symbols' constructor.
6509 * readsyms.h (Add_symbols): Remove the input_group member.
6510
6511 2010-03-10 Ian Lance Taylor <iant@google.com>
6512
6513 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6514 target to ask whether a reference to a symbol requires a stack
6515 split.
6516 * target.h (Target::is_call_to_non_split): New function.
6517 (Target::do_is_call_to_non_split): Declare virtual function.
6518 * target.cc: Include "symtab.h".
6519 (Target::do_is_call_to_non_split): New function.
6520 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6521
6522 2010-03-10 Cary Coutant <ccoutant@google.com>
6523
6524 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6525 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6526 (File_read::open[2]): Add whole_file_view_ to list of views.
6527 (File_read::make_view): Remove test of whole_file_view_.
6528 (File_read::find_or_make_view): Create whole_file_view_ if
6529 necessary.
6530 (File_read::clear_views): Replace bool parameter with enum;
6531 adjust all callers. Don't delete views with permanent data;
6532 do delete cached views and views from archives if
6533 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6534 if clearing the corresponding view.
6535 * fileread.h (File_read::Clear_views_mode): New enum.
6536 (File_read::View::is_permanent_view): New method.
6537 (File_read::clear_views): Replace bool parameter
6538 with enum; adjust all callers.
6539 * options.h (General_options): Change keep_files_mapped option;
6540 add map_whole_files.
6541 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6542 releasing the file.
6543 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6544 the file.
6545
6546 2010-03-10 David S. Miller <davem@davemloft.net>
6547
6548 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6549
6550 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6551
6552 * icf.cc (get_section_contents): Add '@' marker after processing the
6553 merge reloc.
6554
6555 2010-03-08 Doug Kwan <dougkwan@google.com>
6556
6557 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6558 due to a conversion warning.
6559 (Arm_relobj::update_output_local_symbol_count): Check for local
6560 symbol with unset output index.
6561
6562 2010-03-05 Ian Lance Taylor <iant@google.com>
6563
6564 * options.h (class General_options): Add --spare-dynamic-tags.
6565 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6566 --spare-dynamic-tags.
6567
6568 2010-03-05 Ian Lance Taylor <iant@google.com>
6569
6570 * incremental.cc: Include "libiberty.h".
6571
6572 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6573
6574 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6575 function, is_info_ member.
6576 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6577 (Versions::Versions): Update caller.
6578 (Versions::define_base_version): Likewise.
6579 (Versions::add_def): Likewise.
6580
6581 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6582
6583 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6584 (Scan::possible_function_pointer_reloc): New function.
6585 (Scan::local_reloc_may_be_function_pointer): Change to call
6586 possible_function_pointer_reloc.
6587 (Scan::global_reloc_may_be_function_pointer): Ditto.
6588 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6589 relocations in ".data.rel.ro._ZTV" section.
6590 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6591 * testsuite/icf_safe_so_test.cc: Ditto.
6592 * testsuite/icf_safe_test.cc: Ditto.
6593 * testsuite/icf_safe_test.sh: Ditto.
6594
6595 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6596 Ian Lance Taylor <iant@google.com>
6597
6598 * target-reloc.h (relocate_section): Check the symbol table index
6599 for -1U before setting the local symbol index.
6600 (scan_relocatable_relocs): If copying the relocation, record that
6601 the local symbol is required.
6602 * object.h (Symbol_value::is_output_symtab_index_set): New
6603 function.
6604 (Symbol_value::may_be_discarded_from_output_symtab): New
6605 function.
6606 (Symbol_value::has_output_symtab_entry): New function.
6607 (Symbol_value::needs_output_symtab_entry): Remove.
6608 (Symbol_value::output_symtab_index): Make sure the symbol index is
6609 set.
6610 (Symbol_value::set_output_symtab_index): Make sure the symbol
6611 index is not set. Make sure the new index is valid.
6612 (Symbol_value::set_must_have_output_symtab_entry): New function.
6613 (Symbol_value::has_output_dynsym_entry): New function.
6614 (Symbol_value::set_output_dynsym_index): Make sure the new index
6615 is valid.
6616 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6617 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6618 local symbol if permitted.
6619 (Sized_relobj::do_finalize_local_symbols): Call
6620 is_output_symtab_index_set rather than needs_output_symtab_entry.
6621 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6622 rather than needs_output_symtab_entry. Call
6623 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6624 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6625 is_output_symtab_index_set rather than needs_output_symtab_entry.
6626 * testsuite/discard_locals_relocatable_test.c: New file.
6627 * testsuite/discard_locals_test.sh: Test -r.
6628 * testsuite/Makefile.am (check_DATA): Add
6629 discard_locals_relocatable_test1.syms,
6630 discard_local_relocatable_test2.syms.
6631 (MOSTLYCLEANFILES): Likewise. Also add
6632 discard_locals_relocatable_test1.lout and
6633 discard_locals_relocatable_test2.out.
6634 (discard_locals_relocatable_test1.syms): New target.
6635 (discard_locals_relocatable_test.o): New target.
6636 (discard_locals_relocatable_test1.out): New target.
6637 (discard_locals_relocatable_test2.syms): New target.
6638 (discard_locals_relocatable_test2.out): New target.
6639 (various): Add missing ../ld-new dependencies.
6640 * testsuite/Makefile.in: Rebuild.
6641
6642 2010-03-03 Nick Clifton <nickc@redhat.com>
6643
6644 * po/fi.po: New Finnish translation.
6645
6646 2010-03-01 Doug Kwan <dougkwan@google.com>
6647
6648 * layout.cc (Layout::Layout): Force section types of .init_array*,
6649 .preinit_array* and .fini_array* sections.
6650 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6651 Fix check of return value of std::string::find.().
6652 (Output_section::Input_section_sort_compare::operator()): Remove
6653 comment about .init_array.
6654 (Output_section::Input_section_sort_init_fini_compare::operator()):
6655 New method.
6656 (Output_section::sort_attached_input_sections): Handle .init_array
6657 and .fini_array specially.
6658 * output.h (Output_section::Inut_section_sort_compare): Update
6659 comment.
6660 (Output_section::Input_section_sort_init_fini_compare): New struct.
6661
6662 2010-02-26 Doug Kwan <dougkwan@google.com>
6663
6664 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6665 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6666 * testsuite/debug_msg.sh: Avoid matching source line number for
6667 use of global variable undef_int.
6668
6669 2010-02-26 Doug Kwan <dougkwan@google.com>
6670
6671 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6672 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6673 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6674 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6675 * options.cc (General_options::General_options): Initialize member
6676 fix_v4bx_.
6677 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6678 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6679 and rm_no_fix_v4bx.stdout
6680 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6681 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6682 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6683 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6684 and arm_no_fix_v4bx.
6685 * Makefile.in: Regenerate.
6686 * testsuite/arm_fix_v4bx.s: New file.
6687 * testsuite/arm_fix_v4bx.sh: Ditto.
6688
6689 2010-02-24 Doug Kwan <dougkwan@google.com>
6690
6691 * arm.cc (Target_arm::got_section): Make the .got section the first
6692 non RELRO section in the data segment.
6693 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6694 suffixes of section names.
6695
6696 2010-02-24 Doug Kwan <dougkwan@google.com>
6697
6698 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6699 flags and attributes merging if an input file is a binary file.
6700 * fileread.cc (Input_file::open): Record format of original file.
6701 * fileread.h (Input_file::Format): New enum type.
6702 (Input_file::Input_file): Initialize data member format_.
6703 (Input_file::format): New method definition.
6704 (Input_file::format_):: New data member.
6705
6706 2010-02-24 Doug Kwan <dougkwan@google.com>
6707
6708 * arm.cc (Arm_output_data_got): New class.
6709 (ARM_TCB_SIZE): New constant
6710 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6711 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6712 If user uses a script with a SECTIONS clause, issue only a warning
6713 for a misplaced EXIDX input section. Otherwise, issue an error.
6714 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6715 garbage collection.
6716 (Target_arm::got_mode_index_entry): Handle static linking.
6717 (Target_arm::Scan::local): Ditto.
6718 (Target_arm::Scan::global): Ditto.
6719 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6720 all incorrectly implemented relocations.
6721 (Target_arm::fix_exidx_coverage): Pass layout to
6722 Arm_output_section::fix_exidx_coverage.
6723 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6724 from ".ARM.exidx." and ".ARM.extab.".
6725
6726 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6727
6728 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6729 section if it does not already exist.
6730 * attributes.cc (Attributes_section_data::Attributes_section_data):
6731 Don't crash if size is zero.
6732
6733 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6734 Ian Lance Taylor <iant@google.com>
6735
6736 * gold.cc (queue_middle_tasks): If no input files were opened,
6737 exit.
6738 * workqueue.h (Task_function::Task_function): Assert that there is
6739 a blocker.
6740
6741 2010-02-22 Doug Kwan <dougkwan@google.com>
6742
6743 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6744 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6745 types to avoid warnings due to different uint64_t implementations
6746 on different hosts.
6747
6748 2010-02-21 Doug Kwan <dougkwan@google.com>
6749
6750 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6751 handling of the maximum backward branch offset.
6752 (Arm_relocate_functions::thumb_branch_common): Ditto.
6753 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6754 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6755 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6756 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6757 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6758 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6759 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6760 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6761 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6762 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6763 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6764 thumb2_bl_out_of_range.o): New rules.
6765 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6766 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6767 thumb2_bl_out_of_range
6768 * testsuite/Makefile.in: Regenerate.
6769 * testsuite/arm_bl_in_range.s: New file.
6770 * testsuite/arm_bl_out_of_range.s: Ditto.
6771 * testsuite/arm_branch_in_range.sh: Ditto.
6772 * testsuite/arm_branch_range.t: Ditto.
6773 * testsuite/thumb2_branch_range.t: Ditto.
6774 * testsuite/thumb_bl_in_range.s: Ditto.
6775 * testsuite/thumb_bl_out_of_range.s: Ditto.
6776 * testsuite/thumb_branch_range.t: Ditto.
6777
6778 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6779
6780 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6781 Add reloc offset information.
6782 * icf.cc (get_section_contents): Change iterators to point to the new
6783 vectors. Add reloc offset information to the contents.
6784 * icf.h (Icf::Sections_reachable_info): New typedef.
6785 (Icf::Sections_reachable_list): New typedef.
6786 (Icf::Offset_info): New typedef.
6787 (Icf::Reloc_info): New struct typedef.
6788 (Icf::Reloc_info_list): New typedef.
6789 (Icf::symbol_reloc_list): Delete method.
6790 (Icf::addend_reloc_list): Delete method.
6791 (Icf::section_reloc_list): Delete method.
6792 (Icf::reloc_info_list): New method.
6793 (Icf::reloc_info_list_): New member.
6794
6795 2010-02-19 Doug Kwan <dougkwan@google.com>
6796
6797 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6798 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6799 * arm.cc (Arm_relocation_functions): New forward declaration.
6800 (Target_arm::Target_arm): Initialize new data members
6801 got_mod_index_offset_ and tls_base_symbol_defined_.
6802 (Target_arm::Relocate::relocate_tls): New method.
6803 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6804 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6805 New methods.
6806 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6807 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6808 (Target_arm::got_mod_index_offset_,
6809 Target_arm::tls_base_symbol_defined_): New data members.
6810 (Target_arm::Scan::local, Target::Scan::global,
6811 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6812 relocations.
6813
6814 2010-02-18 Doug Kwan <dougkwan@google.com>
6815
6816 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6817 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6818 text section as a parameter becuase some broken tools may not set
6819 the link in section header.
6820 (Target_arm::has_got_section): New method.
6821 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6822 without any mapping symbol as data only. Remove warning.
6823 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6824 link in its section header, try to discover the link by inspecting the
6825 REL31 relocation at the beginning of the section.
6826 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6827 in error message.
6828 (Target_arm::Scan::global): Treat any reference to the symbol
6829 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6830
6831 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6832
6833 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6834 (Scan::global_reloc_may_be_function_pointer): New function.
6835 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6836 (Scan::global_reloc_may_be_function_pointer): New function.
6837 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6838 (Scan::global_reloc_may_be_function_pointer): New function.
6839 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6840 (Scan::global_reloc_may_be_function_pointer): New function.
6841 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6842 (Scan::global_reloc_may_be_function_pointer): New function.
6843 (Scan::possible_function_pointer_reloc): New function.
6844 (Target_x86_64::can_check_for_function_pointers): New function.
6845 * gc.h (gc_process_relocs): Scan relocation types to determine if
6846 function pointers were taken for targets that support it.
6847 * icf.cc (Icf::find_identical_sections): Include functions for
6848 folding in safe ICF whose pointer is not taken.
6849 * icf.h (Secn_fptr_taken_set): New typedef.
6850 (fptr_section_id_): New member.
6851 (section_has_function_pointers): New function.
6852 (set_section_has_function_pointers): New function.
6853 (check_section_for_function_pointers): New function.
6854 * options.h: Fix comment for safe ICF option.
6855 * target.h (can_check_for_function_pointers): New function.
6856 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6857 Modify icf_safe_test for X86-64.
6858 * testsuite/Makefile.in: Regenerate.
6859 * testsuite/icf_safe_so_test.cc: New file.
6860 * testsuite/icf_safe_so_test.sh: New file.
6861 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6862 (main): Change to take pointer to function kept_func_3.
6863 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6864 folding is done correctly for X86-64.
6865
6866 2010-02-12 David S. Miller <davem@davemloft.net>
6867
6868 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6869 is_symbolless parameter.
6870 (Output_reloc<SHT_REL>::is_symbolless): New.
6871 (Output_reloc<SHT_REL>::is_symbolless_): New.
6872 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6873 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6874 (Output_reloc<SHT_RELA>::is_symbolless): New.
6875 (Output_data_reloc::add_global): Handle is_symbolless.
6876 (Output_data_reloc::add_global_relative): Likewise.
6877 (Output_data_reloc::add_local): Likewise.
6878 (Output_data_reloc::add_local_relative): Likewise.
6879 (Output_data_reloc::add_symbolless_global_addend): New.
6880 (Output_data_reloc::add_symbolless_local_addend): New.
6881 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6882 is_symbolless.
6883 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6884 instead of ->is_relative_
6885 (Output_reloc::write): Likewise.
6886 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6887 (Output_reloc::write_rel): Simplify.
6888
6889 * sparc.cc (Target_sparc::Scan::local): Use
6890 ->add_symbolless_local_addend as needed.
6891 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6892 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6893 based upon relocation offset.
6894
6895 2010-02-11 Doug Kwan <dougkwan@google.com>
6896
6897 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6898 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6899 beginning of function.
6900 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6901 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6902 parameter is_32bit in calls to should_apply_static_reloc.
6903 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6904 (check_DATA): Add arm_abs_global.stdout.
6905 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6906 arm_abs_global.stdout): New rules.
6907 (MOSTLLYCLEANFILES): Add arm_abs_global
6908 * Makefile.in: Regenerate.
6909 * testsuite/arm_abs_global.s: New file.
6910 * testsuite/arm_abs_global.sh: Ditto.
6911 * testsuite/arm_abs_lib.s: Ditto.
6912
6913 2010-02-11 Ian Lance Taylor <iant@google.com>
6914
6915 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6916 Read_relocs task.
6917 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6918 Allocate_commons_task first.
6919 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6920 task, rather than symtab_lock_.
6921 (Gc_process_relocs::~Gc_process_relocs): New function.
6922 (Gc_process_relocs::is_runnable): Check this_blocker_.
6923 (Gc_process_relocs::locks): Use next_blocker_ rather than
6924 blocker_.
6925 (Scan_relocs::~Scan_relocs): New function.
6926 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6927 symtab_lock_.
6928 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6929 next_blocker_.
6930 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6931 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6932 constructor accordingly.
6933 (class Gc_process_relocs): Likewise.
6934 (class Scan_relocs): Likewise.
6935 * common.h (class Allocate_commons_task): Remove symtab_lock_
6936 field, and corresponding constructor parameter.
6937 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6938 symtab_lock_.
6939 (Allocate_commons_task::locks): Likewise.
6940
6941 2010-02-11 Ian Lance Taylor <iant@google.com>
6942
6943 * gold-threads.h (class Once): Define.
6944 (class Initialize_lock): Rewrite as child of Once.
6945 * gold-threads.cc (class Once_initialize): Define.
6946 (once_pointer_control): New static variable.
6947 (once_pointer, once_arg): New static variables.
6948 (c_run_once): New static function.
6949 (Once::Once, Once::run_once, Once::internal_run): New functions.
6950 (class Initialize_lock_once): Remove.
6951 (initialize_lock_control): Remove.
6952 (initialize_lock_pointer): Remove.
6953 (initialize_lock_once): Remove.
6954 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6955 (Initialize_lock::initialize): Rewrite.
6956 (Initialize_lock::do_run_once): New function.
6957 * archive.cc (Archive::interpret_header): Only clear name if it is
6958 not already empty.
6959 * fileread.cc: Include "gold-threads.h"
6960 (file_counts_lock): New static variable.
6961 (file_counts_initialize_lock): Likewise.
6962 (File_read::release): Only increment counts when using --stats.
6963 Use a lock around the increment.
6964 * parameters.cc (class Set_parameters_target_once): Define.
6965 (set_parameters_target_once): New static variable.
6966 (Parameters::Parameters): Move here from parameters.h.
6967 (Parameters::set_target): Rewrite.
6968 (Parameters::set_target_once): New function.
6969 (Parameters::clear_target): Move here and rewrite.
6970 * parameters.h (class Parameters): Update declarations. Add
6971 set_parameters_target_once_ field.
6972 (Parameters::Parameters): Move to parameters.cc.
6973 (Parameters::clear_target): Likewise.
6974 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6975 task.
6976 (Start_group::~Start_group): New function.
6977 (Start_group::is_runnable): New function.
6978 (Start_group::locks, Start_group::run): New functions.
6979 (Finish_group::run): Change saw_undefined to size_t.
6980 * readsyms.h (class Start_group): Define.
6981 (class Finish_group): Change saw_undefined_ field to size_t.
6982 (Finish_group::Finish_group): Remove saw_undefined and
6983 this_blocker parameters. Change all callers.
6984 (Finish_group::set_saw_undefined): New function.
6985 (Finish_group::set_blocker): New function.
6986 * symtab.h (class Symbol_table): Change saw_undefined to return
6987 size_t. Change saw_undefined_ field to size_t.
6988 * target-select.cc (Set_target_once::do_run_once): New function.
6989 (Target_selector::Target_selector): Initialize set_target_once_
6990 field. Don't initialize lock_ and initialize_lock_ fields.
6991 (Target_selector::instantiate_target): Rewrite.
6992 (Target_selector::set_target): New function.
6993 * target-select.h (class Set_target_once): Define.
6994 (class Target_selector): Update declarations. Make
6995 Set_target_once a friend. Remove lock_ and initialize_lock_
6996 fields. Add set_target_once_ field.
6997
6998 2010-02-10 Ian Lance Taylor <iant@google.com>
6999
7000 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7001 queueing any tasks.
7002 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7003 (queue_middle_tasks): Add all blockers before queueing any tasks.
7004 (queue_final_tasks): Likewise.
7005 * token.h (Task_token::add_blockers): New function.
7006 * object.h (Input_objects::number_of_relobjs): New function.
7007
7008 2010-02-10 Ian Lance Taylor <iant@google.com>
7009
7010 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7011 shared, not if not position independent.
7012 * x86_64.cc (Relocate::relocate_tls): Likewise.
7013 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7014 (tls_pie_pic_test): New target.
7015 * testsuite/Makefile.in: Rebuild.
7016
7017 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7018 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7019 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7020 * testsuite/Makefile.in: Rebuild.
7021
7022 2010-02-09 David S. Miller <davem@davemloft.net>
7023
7024 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7025 R_SPARC_RELATIVE using ->add_local_relative().
7026 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7027
7028 * output.h (Output_data_dynamic::add_section_size): New method
7029 that takes two Output_data objects.
7030 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7031 entry param. Handle it in initializers.
7032 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7033 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7034 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7035 arg.
7036 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7037 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7038 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7039 for dynrel_includes_plt.
7040 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7041 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7042 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7043 before .rela.plt
7044 (Target_sparc::do_finalize_sections): Update to pass true for
7045 dynrel_includes_plt.
7046 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7047 output before .rela.plt
7048 (Target_powerpc::do_finalize_sections): Update to pass true for
7049 dynrel_includes_plt when 32-bit.
7050
7051 2010-02-08 Doug Kwan <dougkwan@google.com>
7052
7053 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7054 method.
7055 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7056 Arm_relobj::scan_section_for_cortex_a8_stubs,
7057 Arm_relobj::do_relocation_section): Instead of calling
7058 Output_section::output_address, use faster
7059 Arm_relobj::simple_input_section_output_address.
7060
7061 2010-02-08 David S. Miller <davem@davemloft.net>
7062
7063 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7064 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7065 relocation helper function.
7066
7067 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7068 just like R_SPARC_GOT{10,13,22}.
7069 (Target_sparc::Scan::local): Likewise.
7070 (Target_sparc::Relocate:relocate): Likewise.
7071
7072 2010-02-06 Ian Lance Taylor <iant@google.com>
7073
7074 * configure.ac: Rewrite targetobjs duplicate removal code to use
7075 only shell constructs.
7076 * configure: Rebuild.
7077
7078 2010-02-05 Doug Kwan <dougkwan@google.com>
7079
7080 PR 11247
7081 * arm.cc (Arm_relobj::section_is_scannable): New method.
7082 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7083 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7084
7085 2010-02-04 Doug Kwan <dougkwan@google.com>
7086
7087 PR 11247
7088 * arm-reloc-property.cc (cstdio): Include.
7089 * configure.ac (targetobjs): Remove duplicates.
7090 * configure: Regenerate.
7091 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7092 big and little endian version for a given address size.
7093
7094 2010-02-03 Doug Kwan <dougkwan@google.com>
7095
7096 * arm-reloc-property.cc
7097 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7098 definition.
7099 * arm-reloc-property.h
7100 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7101 New method definition.
7102 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7103 declaration.
7104 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7105 overflow to N.
7106 (GOT_PREL): Change implemented to Y.
7107 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7108 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7109 (Arm_relocate_functions::movw_abs_nc): Remove method.
7110 (Arm_relocate_functions::movt_abs): Ditto.
7111 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7112 (Arm_relocate_functions::thm_movt_abs): Ditto.
7113 (Arm_relocate_functions::movw_rel_nc): Ditto.
7114 (Arm_relocate_functions::movw_rel): Ditto.
7115 (Arm_relocate_functions::movt_rel): Ditto.
7116 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7117 (Arm_relocate_functions:thm_movw_rel): Ditto.
7118 (Arm_relocate_functions:thm_movt_rel): Ditto.
7119 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7120 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7121 New method definitions.
7122 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7123 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7124 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7125 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7126 (Target_arm::Relocate::relocate): Check for non-static or
7127 unimplemented relocation code and exit early. Change calls to
7128 Target_arm::reloc_uses_thumb_bit and
7129 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7130 instead. Refactor code to handle similar relocations to increase
7131 code sharing. Remove check for unsupported relocation code in switch
7132 statement.
7133 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7134 relocation property table to find out size. Change error message to
7135 print out the name of a relocation code instead of the numeric value.
7136 (Target_arm::scan_reloc_for_stub): Use relocation property table
7137 instead of calling Target_arm::reloc_uses_thumb_bit().
7138
7139 2010-02-02 Doug Kwan <dougkwan@google.com>
7140
7141 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7142 types of relaxed input section.
7143
7144 2010-02-02 Doug Kwan <dougkwan@google.com>
7145
7146 * Makefile.am (HFILES): Add arm-reloc-property.h.
7147 (DEFFILES): New.
7148 (TARGETSOURCES): Add arm-reloc-property.cc
7149 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7150 (libgold_a_SOURCES): $(DEFFILES)
7151 * Makefile.in: Regenerate.
7152 * arm-reloc-property.cc: New file.
7153 * arm-reloc-property.h: New file.
7154 * arm-reloc.def: New file.
7155 * arm.cc: Update comments.
7156 (arm-reloc-property.h): New included header.
7157 (arm_reloc_property_table): New global variable.
7158 (Target_arm::do_select_as_default_target): New method definition.
7159 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7160 arm-reloc-property to targ_extra_obj.
7161 * parameters.cc (set_parameters_target): Call
7162 Target::select_as_default_target().
7163 * target.h (Target::select_as_default_target): New method definition.
7164 (Target::do_select_as_default_target): Same.
7165
7166 2010-02-01 Doug Kwan <dougkwan@google.com>
7167
7168 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7169 first_output_text_section_.
7170 (Arm_exidx_fixup::first_output_text_section): New method definition.
7171 (Arm_exidx_fixup::first_output_text_section_): New data member.
7172 (Arm_exidx_fixup::process_exidx_section): Record the first text
7173 output section seen.
7174 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7175 and entsize in output section header.
7176
7177 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7178
7179 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7180 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7181 (Arm_relocate_functions::thm_alu11): New Method.
7182 (Arm_relocate_functions::thm_pc8): New Method.
7183 (Arm_relocate_functions::thm_pc12): New Method.
7184 (Target_arm::Scan::local): Handle the relocations.
7185 (Target_arm::Scan::global): Likewise.
7186 (Target_arm::Relocate::relocate): Likewise.
7187 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7188
7189 2010-01-29 Doug Kwan <dougkwan@google.com>
7190
7191 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7192 of relocation types as ld.
7193
7194 2010-01-29 Doug Kwan <dougkwan@google.com>
7195
7196 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7197 to public.
7198 (Arm_relocate_functions::thumb_branch_common): Ditto.
7199 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7200 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7201 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7202 Arm_relocate_functions::jump24): Remove.
7203 (Target_arm::Relocate::relocate): Adjust code to call
7204 Arm_relocation_functions::arm_branch_common and
7205 Arm_relocation_functions::thumb_branch_common instead of their removed
7206 wrappers. Merge switch-cases together to reduce source code size.
7207
7208 2010-01-29 Doug Kwan <dougkwan@google.com>
7209
7210 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7211 output_local_symbol_count_needs_update_.
7212 (Arm_relobj::output_local_symbol_count_needs_update,
7213 Arm_relobj::set_output_local_symbol_count_needs_update,
7214 Arm_relobj::update_output_local_symbol_count): New methods.
7215 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7216 member.
7217 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7218 of pointed function as in a R_ARM_PREL31 relocation.
7219 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7220 for output local symbol count updating.
7221 (Target_arm::do_relax): Update output local symbol counts in objects
7222 if necessary.
7223 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7224
7225 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7226
7227 * arm.cc: Added support for the ARM relocations:
7228 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7229 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7230 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7231 movw_prel_nc).
7232 (Arm_relocate_functions::movw_rel): New method.
7233 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7234 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7235 thm_movw_prel_nc).
7236 (Arm_relocate_functions::thm_movw_rel): New method.
7237 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7238 thm_movt_prel).
7239 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7240 relocations.
7241 (Target_arm::Scan::global): Likewise.
7242 (Target_arm::Relocate::relocate): Likewise.
7243 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7244 Likewise.
7245
7246 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7247
7248 * arm.cc: Added support for ARM group relocations.
7249 (Target_arm::reloc_needs_sym_origin): New method.
7250 (Arm_relocate_functions::calc_grp_kn): New method.
7251 (Arm_relocate_functions::calc_grp_residual): New method.
7252 (Arm_relocate_functions::calc_grp_gn): New method.
7253 (Arm_relocate_functions::arm_grp_alu): New Method.
7254 (Arm_relocate_functions::arm_grp_ldr): New Method.
7255 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7256 (Arm_relocate_functions::arm_grp_ldc): New Method.
7257 (Target_arm::Scan::local): Handle the ARM group relocations.
7258 (Target_arm::Scan::global): Likewise.
7259 (Target_arm::Relocate::relocate): Likewise.
7260 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7261 Likewise.
7262
7263 2010-01-26 Doug Kwan <dougkwan@google.com>
7264
7265 * arm.cc (set): Include.
7266 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7267 pointer type.
7268 (Arm_output_section::Text_section_list): New type.
7269 (Arm_output_section::append_text_sections_to_list): New method.
7270 (Arm_output_section::fix_exidx_coverage): Ditto.
7271 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7272 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7273 Relobj::set_section_offset() instead of
7274 Sized_relobj::invalidate_section_offset().
7275 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7276 parameter for section headers. Ignore relocation sections for
7277 unallocated sections and EXIDX sections.
7278 (Target_arm::fix_exidx_coverage): New method.
7279 (Target_arm::output_section_address_less_than): New type.
7280 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7281 linked text section instead of the EXIDX section.
7282 (Arm_output_section::create_stub_group): Add an assertion to check
7283 that this is not an EXIDX output section.
7284 (Arm_output_section::append_text_sections_to_list): New method.
7285 (Arm_output_section::fix_exidx_coverage): Ditto.
7286 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7287 Arm_relobj::section_needs_reloc_stub_scanning.
7288 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7289 first pass.
7290 (Target_arm::fix_exidx_coverage): New method.
7291 * object.h (Relobj::set_output_section): New method.
7292 (Sized_relobj::invalidate_section_offset): Remove method.
7293 (Sized_relobj::do_invalidate_section_offset): Remove method.
7294 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7295
7296 2010-01-25 Doug Kwan <dougkwan@google.com>
7297
7298 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7299 Fix warning due to signed and unsigned comparison on a 32-bit host.
7300
7301 2010-01-22 Doug Kwan <dougkwan@google.com>
7302
7303 * arm.cc (Target_arm::do_relax): Record an output section for section
7304 offset adjustment it contains any stub table that has changed.
7305 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7306 offsets in an output section if necessary.
7307 * output.cc (Output_section::Output_section): Initialize
7308 section_offsets_need_adjustments_.
7309 (Output_section::add_input_section_for_script): Renamed to
7310 Output_section::add_simple_input_section.
7311 (Output_section::save_states): Add a comment.
7312 (Output_section::discard_states): New method defintion.
7313 (Output_section::adjust_section_offsets): Same.
7314 * output.h (Output_section::add_input_section_for_script): Renamed to
7315 Output_section::add_simple_input_section.
7316 (Output_section::discard_states): New method declaration.
7317 (Output_section::adjust_section_offsets): Same.
7318 (Output_section::section_offsets_need_adjustment,
7319 Output_section::set_section_offsets_need_adjustment): New method
7320 definitions.
7321 (Output_section::section_offsets_need_adjustment_): New data member.
7322 * script-sections.cc
7323 (Output_section_element_input::set_section_address): Adjust code for
7324 renaming of Output_section::add_input_section_for_script.
7325 (Orphan_output_section::set_section_address): Same.
7326
7327 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7328
7329 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7330 Fix_v4bx enum values .
7331 * gold/options.h (General_options): New option definitions.
7332 (General_options::fix_v4bx): New method.
7333 (General_options::Fix_v4bx): New enum.
7334 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7335 (General_options::parse_fix_v4bx_interworking): New method.
7336
7337 2010-01-22 Doug Kwan <dougkwan@google.com>
7338
7339 * arm.cc (Arm_exidx_fixup): New class.
7340
7341 2010-01-21 Doug Kwan <dougkwan@google.com>
7342
7343 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7344 classes.
7345 (Arm_exidx_section_offset_map): New type.
7346
7347 2010-01-21 Doug Kwan <dougkwan@google.com>
7348
7349 * arm.cc (Arm_exidx_input_section): New class.
7350 (Arm_relobj::exidx_input_section_by_link,
7351 Arm_relobj::exidx_input_section_by_shndx,
7352 Arm_relobj::make_exidx_input_section): New methods.
7353 (read_arm_attributes_section): Remove.
7354 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7355 information about them.
7356 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7357 to here.
7358
7359 2010-01-20 Doug Kwan <dougkwan@google.com>
7360
7361 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7362 Input_section_specifier to Section_id.
7363 (Target_arm::new_arm_input_section: Adjust code for change of key
7364 type.
7365 (Target_arm::find_arm_input_section): Ditto.
7366 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7367 (Section_id): Remove.
7368 (Garbage_collection::Section_id_hash): Remove.
7369 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7370 (Section_id): Remove.
7371 (Icf::Section_id_hash): Remove.
7372 * object.h (Section_id, Const_section_id, Section_id_hash,
7373 Const_section_id_hash): New type definitions.
7374 * output.cc (Output_section::add_relaxed_input_section): Change to
7375 use Const_section_id instead of Input_section_specifier as key type.
7376 (Output_section::add_merge_input_section): Ditto.
7377 (Output_section::build_relaxation_map): Change to use Section_id
7378 instead of Input_section_specifier as key type.
7379 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7380 Ditto.
7381 (Output_section::convert_input_sections_to_relaxed_sections): Change
7382 to use Const_section_id instead of Input_section_specifier as key type.
7383 (Output_section::find_merge_section): Ditto.
7384 (Output_section::find_relaxed_input_section): Ditto.
7385 * output.h (Input_section_specifier): Remove class.
7386 (Output_section::Output_section_data_by_input_section_map): Change
7387 key type to Const_section_id.
7388 (Output_section::Output_relaxed_input_section_by_input_section_map):
7389 Ditto.
7390 (Output_section::Relaxation_map): Change key type to Section_id.
7391
7392 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7393
7394 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7395 (class Arm_v4bx_stub): New class.
7396 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7397 (Stub_factory::make_arm_v4bx_stub): New method.
7398 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7399 (Stub_table::empty): Handle v4bx stubs.
7400 (Stub_table::add_arm_v4bx_stub): New method.
7401 (Stub_table::find_arm_v4bx_stub): New method.
7402 (Arm_relocate_functions::v4bx): New method.
7403 (Target_arm::fix_v4bx): New method.
7404 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7405 (Stub_table::relocate_stubs): Likewise.
7406 (Stub_table::do_write): Likewise.
7407 (Stub_table::update_data_size_and_addralign): Likewise.
7408 (Stub_table::finalize_stubs): Likewise.
7409 (Target_arm::Scan::local): Likewise.
7410 (Target_arm::Scan::global): Likewise.
7411 (Target_arm::do_finalize_sections): Likewise.
7412 (Target_arm::Relocate::relocate): Likewise.
7413 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7414 Likewise.
7415 (Target_arm::scan_reloc_for_stub): Likewise.
7416 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7417
7418 2010-01-19 Ian Lance Taylor <iant@google.com>
7419
7420 * output.cc (Output_section_headers::do_sized_write): Write large
7421 segment count to sh_info field.
7422 (Output_file_header::do_sized_write): For large segment count,
7423 write PN_XNUM to e_phnum field.
7424
7425 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7426
7427 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7428 (Arm_relocate_functions::thm_jump8): New function.
7429 (Arm_relocate_functions::thm_jump11): New function.
7430 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7431 R_ARM_THM_JUMP11.
7432 (Target_arm::Scan::global): Likewise.
7433 (Target_arm::Relocate::relocate): Likewise.
7434 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7435 Likewise.
7436
7437 2010-01-14 Doug Kwan <dougkwan@google.com>
7438
7439 * arm.cc (map, utility): Include headers.
7440 (Target_arm::apply_cortex_a8_workaround): New method.
7441 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7442 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7443 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7444 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7445 the --[no-]fix-cortex-a8 command line options.
7446 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7447 (Target_arm::relocate_stub): Use addend in instruction template.
7448 * options.h (DEFINE_bool): Set the user-set flag.
7449 (General_options): Add --[no-]-fix-cortex options.
7450 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7451 : Update fast look-up map after conversion.
7452
7453 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7454
7455 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7456 in the first pass of do_layout.
7457
7458 2010-01-13 Doug Kwan <dougkwan@google.com>
7459
7460 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7461 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7462 apparent compiler problem of not folding static constant integral
7463 data members of elfcpp::Elf_sizes<32>.
7464
7465 2010-01-13 Doug Kwan <dougkwan@google.com>
7466
7467 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7468 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7469 Arm_relobj::scan_section_for_cortex_a8_erratum,
7470 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7471 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7472 sections to scan for relocation stubs into a new method
7473 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7474 relocation and Cortex-A8 stub scanning.
7475 (Target_arm::do_relax): Force stubs to be after stubbed sections
7476 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7477 the beginning of a new relaxation pass. Update a comment.
7478 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7479
7480 2010-01-12 Ian Lance Taylor <iant@google.com>
7481
7482 * target-reloc.h (visibility_error): New inline function.
7483 (relocate_section): Call visibility_error.
7484 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7485 (MOSTLYCLEANFILES): Likewise.
7486 (protected_4_pic.o, protected_3.err): New targets.
7487 * testsuite/protected_4.cc: New file.
7488
7489 2010-01-12 Doug Kwan <dougkwan@google.com>
7490
7491 * arm.cc (Cortex_a8_reloc): New class.
7492 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7493 and cortex_a8_relocs_info_.
7494 (Target_arm::fix_cortex_a8): New method definition.
7495 (Target_arm::Cortex_a8_relocs_info): New type.
7496 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7497 New data member declarations.
7498 (Target_arm::scan_reloc_for_stub): Record information about
7499 relocations for THUMB branches that might be exempted from the
7500 Cortex-A8 workaround.
7501 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7502 at the beginning of a relaxation pass.
7503
7504 2010-01-12 Doug Kwan <dougkwan@google.com>
7505
7506 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7507 (Arm_relobj::Mapping_symbol_position,
7508 Arm_reloj::Mapping_symbol_position_less,
7509 Arm_relobj::Mapping_symbols_info): New types.
7510 (Target_arm::is_mapping_symbol_name): New method definition.
7511 (Arm_relobj::do_count_local_symbols): Save information about mapping
7512 symbols.
7513
7514 2010-01-11 Doug Kwan <dougkwan@google.com>
7515
7516 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7517 Arm_relocate_functions::thumb32_branch_upper,
7518 Arm_relocate_functions::thumb32_branch_lower,
7519 Arm_relocate_functions::thumb32_cond_branch_offset,
7520 Arm_relocate_functions::thumb32_cond_branch_upper,
7521 Arm_relocate_functions::thumb32_cond_branch_lower,
7522 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7523 branch offset encoding.
7524 (Arm_relocate_functions::thumb_branch_common): Use new branch
7525 offset encoding methods to avoid code duplication.
7526 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7527 (Stub_addend_reader::operator()): Use new branch encoding method
7528 to avoid code duplication.
7529
7530 2010-01-11 Doug Kwan <dougkwan@google.com>
7531
7532 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7533 (Target_arm::do_finalize_sections): Define special EXIDX section
7534 symbols only if referenced.
7535 * gc.h (Garbage_collection::add_reference): New method.
7536 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7537 code duplication.
7538
7539 2010-01-11 Ian Lance Taylor <iant@google.com>
7540
7541 * script.cc (Version_script_info::build_expression_list_lookup):
7542 Change complaing about duplicate wildcard match from error to
7543 warning.
7544
7545 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7546 of 2009-12-30.
7547 (Version_script_info::Version_script_info): Initialize globs_,
7548 default_version_, default_is_global_, and exact_. Don't
7549 initialize globals_ or locals_.
7550 (Version_script_info::build_lookup_tables): Build local symbols
7551 first.
7552 (Version_script_info::unquote): New function.
7553 (Version_script_info::add_exact_match): New function.
7554 (Version_script_info::build_expression_list_lookup): Remove lookup
7555 parameter. Add is_global parameter. Change all callers. Handle
7556 wildcard pattern specially. Unquote pattern. Call
7557 add_exact_match.
7558 (Version_script_info::get_name_to_match): New function.
7559 (Version_script_info::get_symbol_version): New function.
7560 (Version_script_info::get_symbol_version_helper): Remove.
7561 (Version_script_info::check_unmatched_names): Call unquote.
7562 * script.h (class Version_script_info): Change get_symbol_version
7563 to be non-inline and add is_global parameter; change all callers.
7564 Rewrite symbol_is_local. Update declarations. Define struct
7565 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7566 Remove globals_ and locals_ members. Add exact_, globs_,
7567 default_version_, is_global_.
7568 (Version_script_info::Glob): Remove pattern, add expression and
7569 is_global. Update constructor. Change all callers.
7570 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7571 default version.
7572 (Versions::symbol_section_contents): If a symbol is undefined, or
7573 defined in a dynamic object, set the version index to
7574 VER_NDX_LOCAL.
7575 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7576 symbol_is_local.
7577 (Symbol_table::add_from_pluginobj): Likewise.
7578 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7579
7580 2010-01-11 Doug Kwan <dougkwan@google.com>
7581
7582 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7583 (incremental_dump_LDADD): Add linking option for libintl.
7584 * Makefile.in: Regenerate.
7585
7586 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7587
7588 PR gold/11144
7589 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7590 instead of -Ds.
7591 * testsuite/Makefile.in: Regenerated.
7592
7593 2010-01-10 Doug Kwan <dougkwan@google.com>
7594
7595 * options.h (DEFINE_var): Use parentheses around argument varname__
7596 in macro body to avoid any unintended subsequent substitutions.
7597
7598 2010-01-10 Ian Lance Taylor <iant@google.com>
7599
7600 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7601 candidates before doing symbol resolution.
7602
7603 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7604 ODR candidates if only one is weak.
7605
7606 2010-01-08 Ian Lance Taylor <iant@google.com>
7607
7608 * script.cc (Version_script_info::build_expression_list_lookup):
7609 Don't warn about ambiguous version, just record the ambiguity.
7610 (Version_script_info::get_symbol_version_helper): Give error if
7611 version is ambiguous.
7612
7613 2010-01-08 Doug Kwan <dougkwan@google.com>
7614
7615 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7616 prev_data_size_ and prev_addralign_. Remove initializer for
7617 deleted data member has_been_changed_.
7618 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7619 to determine if the table is empty.
7620 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7621 Remove.
7622 (Stub_table::add_reloc_stub): Define method in class definition
7623 instead of just declaring it there.
7624 (Stub_table::add_cortex_a8_stub): New method definition.
7625 (Stub_table::update_data_size_and_addralign): Ditto.
7626 (Stub_table::finalize_stubs): Ditto.
7627 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7628 (Stub_table::do_addralign_): Return address alignment in the
7629 (Stub_table::do_reset_address_and_file_offset): Define method in
7630 class definition instead of declaring it there. Set current data
7631 size to be the data size of the previous pass.
7632 (Stub_table::set_final_data_size): Use current data size as the
7633 final data size.
7634 (Stub_table::relocate_stub): Change parameter type of stub from
7635 Reloc_stub pointer to Stub pointer.
7636 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7637 (Stub_table::Cortex_a8_stub_list): New typedef.
7638 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7639 Stub_table::prev_addralign_): New data member.
7640 (Arm_relobj::Arm_relobj): Initialize data member
7641 section_has_cortex_a8_workaround_.
7642 (Arm_relobj::section_has_cortex_a8_workaround,
7643 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7644 definitions.
7645 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7646 declarations.
7647 (Target_arm::relocate_stub): Change parameter type of stub from
7648 Reloc_stub pointer to Stub pointer.
7649 (Insn_template::size, Insn_template::alignment): Handle
7650 THUMB16_SPECIAL_TYPE.
7651 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7652 Stub_table::update_data_size_and_addralign,
7653 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7654 definitions.
7655 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7656 (Stub_table::do_write): Ditto.
7657 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7658
7659 2010-01-08 Ian Lance Taylor <iant@google.com>
7660
7661 PR 11108
7662 * symtab.h (class Symbol): Remove fields is_target_special_ and
7663 has_plt_offset_. Add field is_defined_in_discarded_section_.
7664 (Symbol::is_defined_in_discarded_section): New function.
7665 (Symbol::set_is_defined_in_discarded_section): New function.
7666 (Symbol::has_plt_offset): Rewrite.
7667 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7668 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7669 Don't initialize is_target_special_ or has_plt_offset_.
7670 Initialize is_defined_in_discarded_section_.
7671 (Symbol_table::add_from_relobj): If appropriate, set
7672 is_defined_in_discarded_section.
7673 * resolve.cc (Symbol::override_base_with_special): Don't test
7674 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7675 * target-reloc.h (relocate_section): Do special handling for
7676 symbols defined in discarded sections for global symbols as well
7677 as local symbols.
7678
7679 2010-01-08 Ian Lance Taylor <iant@google.com>
7680
7681 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7682 the SHT_SYMTAB case.
7683
7684 2010-01-08 Ian Lance Taylor <iant@google.com>
7685
7686 * object.cc (Sized_relobj::do_layout): Don't get confused if
7687 layout_eh_frame returns NULL.
7688
7689 2010-01-08 Ian Lance Taylor <iant@google.com>
7690
7691 PR 11084
7692 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7693 dynamic symbol table, use the normal symbol table.
7694 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7695 symbol table.
7696
7697 2010-01-08 Ian Lance Taylor <iant@google.com>
7698
7699 PR 11072
7700 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7701 sections.
7702
7703 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7704
7705 * version.cc (print_version): Change to "Copyright 2010".
7706
7707 2010-01-08 Ian Lance Taylor <iant@google.com>
7708
7709 PR 10287
7710 PR 11063
7711 * i386.cc (class Target_i386): Change return type of plt_section
7712 to be non-const.
7713 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7714 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7715 tls_desc_rel_ field.
7716 (Output_data_plt_i386::rel_tls_desc): New function.
7717 (Target_i386::rel_tls_desc_section): New function.
7718 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7719 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7720 R_386_TLS_DESC reloc in rel_tls_desc_section.
7721 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7722 Define struct Tlsdesc_info.
7723 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7724 (Target_x86_64::do_reloc_symbol_index): New function.
7725 (Target_x86_64::add_tlsdesc_info): New function.
7726 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7727 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7728 tlsdesc_rel_ field.
7729 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7730 all callers.
7731 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7732 (Target_x86_64::rela_tlsdesc_section): New function.
7733 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7734 handling.
7735 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7736 (Target_x86_64::do_reloc_addend): New function.
7737 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7738 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7739 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7740 (Output_reloc::type): New function.
7741 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7742 (Output_reloc::is_target_specific): New function.
7743 (Output_reloc::target_arg): New function.
7744 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7745 absolute relocs and target specific relocs.
7746 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7747 add_target_specific.
7748 (class Output_data_reloc) [SHT_RELA]: Likewise.
7749 * output.cc (Output_reloc::Output_reloc): Add four new versions
7750 for absolute relocs and target specific relocs.
7751 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7752 (Output_reloc::get_symbol_index): Likewise.
7753 (Output_reloc::local_section_offset): Check that local_sym_index_
7754 is not TARGET_CODE or 0.
7755 (Output_reloc::symbol_value): Likewise.
7756 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7757 reloc.
7758 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7759 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7760 functions.
7761 * layout.cc (add_target_dynamic_tags): Use output section for
7762 DT_PLTRELSZ and DT_JMPREL.
7763
7764 2010-01-07 Ian Lance Taylor <iant@google.com>
7765
7766 PR 11061
7767 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7768 function.
7769 (class Output_data_reloc_generic): Define.
7770 (class Output_data_reloc_base): Change base class to
7771 Output_data_reloc_generic. Change add() method to call
7772 bump_relative_reloc_count for a relative reloc. Remove
7773 sort_relocs_ field.
7774 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7775 to sort_relocs().
7776 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7777 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7778 appropriate.
7779 * layout.h (class Layout): Update declaration.
7780
7781 2010-01-07 Ian Lance Taylor <iant@google.com>
7782
7783 * output.h (class Output_data): Add const version of
7784 output_section and do_output_section.
7785 (class Output_section_data): Add const version of
7786 do_output_section.
7787 (class Output_section): Likewise.
7788 * layout.cc (Layout::add_target_dynamic_tags): New function.
7789 * layout.h (class Layout): Update declarations.
7790 * arm.cc (Target_arm::do_finalize_sections): Use
7791 add_target_dynamic_tags.
7792 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7793 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7794 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7795 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7796
7797 2010-01-07 Ian Lance Taylor <iant@google.com>
7798
7799 PR 11042
7800 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7801 object as needed.
7802
7803 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7804 Ian Lance Taylor <iant@google.com>
7805
7806 PR 11019
7807 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7808 Xindex::read_symtab_xindex.
7809
7810 2010-01-07 Doug Kwan <dougkwan@google.com>
7811
7812 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7813 (Insn_template::thumb16_bcond_insn): New method declaration.
7814 (Insn_template): Fix spelling.
7815 (Stub::thumb16_special): New method declaration.
7816 (Stub::do_write): Define virtual method which was previously pure
7817 virtual.
7818 (Stub::do_thumb16_special): New method declaration.
7819 (Stub::do_fixed_endian_write): New template member.
7820 (Reloc_stub::do_write): Remove.
7821 (Reloc_stub::do_fixed_endian_write): Remove.
7822 (Cortex_a8_stub): New class definition.
7823 (Stub_factory::make_cortex_a8_stub): New method definition.
7824 (Stub_factory::Stub_factory): Add missing static storage class
7825 qualifier for elf32_arm_stub_a8_veneer_blx.
7826
7827 2010-01-07 Ian Lance Taylor <iant@google.com>
7828
7829 PR 10980
7830 * options.h (class General_options): Add --warn-unresolved-symbols
7831 and --error-unresolved-symbols.
7832 * errors.cc (Errors::undefined_symbol): Implement
7833 --warn-unresolved-symbols.
7834
7835 * options.h (class General_options): Add -z text and -z textoff.
7836 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7837
7838 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7839
7840 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7841 (Garbage_collection::cident_sections): New function.
7842 (Garbage_collection::add_cident_section): New function.
7843 (Garbage_collection::cident_sections_): New member.
7844 (gc_process_relocs): Add references to sections whose names are C
7845 identifiers.
7846 * gold.h (cident_section_start_prefix): New constant.
7847 (cident_section_stop_prefix): New constant.
7848 (is_cident): New function.
7849 * layout.cc (Layout::define_section_symbols): Replace string constants
7850 with the newly defined constants.
7851 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7852 C identifiers.
7853 * testsuite/Makefile.am: Add gc_orphan_section_test.
7854 * testsuite/Makefile.in: Regenerate.
7855 * testsuite/gc_orphan_section_test.cc: New file.
7856 * testsuite/gc_orphan_section_test.sh: New file.
7857
7858 2010-01-06 Ian Lance Taylor <iant@google.com>
7859
7860 PR 10980
7861 * options.h (class General_options): Add --warn-shared-textrel.
7862 * layout.cc (Layout::finish_dynamic_section): Implement
7863 --warn-shared-textrel.
7864
7865 PR 10980
7866 * options.h (class General_options): Add --warn-multiple-gp.
7867
7868 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7869
7870 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7871 $(THREADSLIB) and $(LIBDL).
7872 * Makefile.in: Rebuild.
7873
7874 2010-01-06 Ian Lance Taylor <iant@google.com>
7875
7876 PR 10980
7877 * options.cc (General_options::parse_section_start): New function.
7878 (General_options::section_start): New function.
7879 (General_options::General_options): Initialize all members.
7880 * options.h: Include <map>
7881 (class General_options): Add --section-start. Add section_starts_
7882 member.
7883 * layout.cc (Layout::attach_allocated_section_to_segment): If
7884 --section-start was used, set the address of the segment. Remove
7885 local sort_sections.
7886 (Layout::relaxation_loop_body): If the address of the load segment
7887 has been set by --section-start, don't use it.
7888 * output.h (Output_segment::update_flags_for_output_section): New
7889 function.
7890 * output.cc (Output_segment::add_output_section): Call
7891 update_flags_for_output_section.
7892
7893 2010-01-05 Ian Lance Taylor <iant@google.com>
7894
7895 PR 10980
7896 * options.h (class General_options): Add --undefined-version.
7897 * script.cc (struct Version_expression): Add was_matched_by_symbol
7898 field.
7899 (Version_script_info::matched_symbol): New function.
7900 (Version_script_info::get_symbol_version_helper): Call
7901 matched_symbol.
7902 (Version_script_info::check_unmatched_names): New function.
7903 * script.h (class Version_script_info): Update declarations.
7904 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7905
7906 * options.h (class General_options): Use DEFINE_bool_alias for
7907 allow_multiple_definition.
7908 * resolve.cc (Symbol_table::should_override): Don't test
7909 allow_multiple_definition.
7910
7911 PR 10980
7912 * options.h (class General_options): Add --cref.
7913 * main.cc (main): Print cref table if --cref. Don't close mapfile
7914 until after printing cref table.
7915 * cref.cc: Include "symtab.h".
7916 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7917 (Cref_table_compare::operator()): New function.
7918 (Cref_inputs::gather_cref): New function.
7919 (filecol): New static const.
7920 (Cref_inputs::print_cref): New function.
7921 (Cref::print_cref): New function.
7922 * cref.h: Include <cstdio>.
7923 (class Cref): Update declarations.
7924 * mapfile.h (Mapfile::file): New function.
7925 * object.h (class Object): Define Symbols. Declare virtual
7926 do_get_global_symbols.
7927 (Object::get_global_symbols): New function.
7928 * object.cc (Input_objects::add_object): Pass object to cref_ if
7929 --cref.
7930 (Input_objects::archive_start): Likewise.
7931 (Input_objects::archive_stop): Likewise.
7932 (Input_objects::print_cref): New function.
7933 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7934 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7935 --cref.
7936 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7937 function.
7938 * plugin.h (class Sized_pluginobj): Update declarations.
7939
7940 2010-01-05 Ian Lance Taylor <iant@google.com>
7941
7942 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7943 to is_default_version. Rename insdef to insdefault.
7944 (Symbol_table::add_from_relobj): Rename def to is_default_version
7945 and local to is_forced_local.
7946 (Symbol_table::add_from_pluginobj): Likewise.
7947 (Symbol_table::add_from_dynobj): Likewise.
7948 (Symbol_table::define_special_symbol): Rename insdef to
7949 insdefault.
7950
7951 2010-01-04 Ian Lance Taylor <iant@google.com>
7952
7953 PR 10980
7954 * options.h (class General_options): Add
7955 --allow-multiple-definition and -z muldefs.
7956 * resolve.cc (Symbol_table::should_override): Don't warn about a
7957 multiple symbol definition if --allow-multiple-definition or -z
7958 muldefs.
7959
7960 PR 10980
7961 * options.h (class General_options): Add --add-needed and
7962 --copy-dt-needed-entries. Tweak --as-needed help entry.
7963 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7964 error if --copy-dt-needed-entries aka --add-needed is used and
7965 would cause a change in behaviour.
7966
7967 PR 10980
7968 * options.h (class General_options): Add -G as a short version of
7969 --shared. Add no-op options -assert, -g, and -i.
7970
7971 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7972
7973 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7974 check for .text or .gnu.linkonce.t sections.
7975 * icf.cc (Icf::find_identical_sections): Ditto.
7976 Change the detection for mangled function name within the section
7977 name.
7978 * icf.h (is_section_foldable_candidate): New function.
7979
7980 2009-12-30 Ian Lance Taylor <iant@google.com>
7981
7982 PR 10980
7983 * options.h (class General_options): Permit two dashes with
7984 --retain-symbols-file.
7985
7986 2009-12-30 Ian Lance Taylor <iant@google.com>
7987
7988 PR 10979
7989 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7990 don't put the file header and segment headers in the text
7991 segment.
7992
7993 PR 10979
7994 * common.cc (Sort_commons::operator()): Stabilize sort when both
7995 entries are NULL.
7996 (Symbol_table::do_allocate_commons_list): When allocating common
7997 symbols, skip a symbol which is no longer common.
7998 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7999 an object before checking its type.
8000 * testsuite/common_test_2.c: New file.
8001 * testsuite/common_test_3.c: New file.
8002 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8003 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8004 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8005 (common_test_2_pic.o, common_test_2.so): New targets.
8006 (common_test_3_pic.o, common_test_3.so): New targets.
8007 * testsuite/Makefile.in: Rebuild.
8008
8009 PR 10979
8010 * script.cc (read_input_script): If we see a new SECTIONS clause,
8011 and we have added an input section, give an error.
8012 * layout.h (class Layout): Add have_added_input_section function.
8013 Add have_added_input_section_ field.
8014 * layout.cc (Layout::Layout): Initialize
8015 have_added_input_section_.
8016 (Layout::layout): Set have_added_input_section_.
8017 (Layout::layout_eh_frame): Likewise.
8018
8019 2009-12-30 Ian Lance Taylor <iant@google.com>
8020
8021 PR 10931
8022 * options.h (class General_options): Add --sort-common option.
8023 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8024 * common.cc (Sort_common): Add sort_order parameter to
8025 constructor. Add sort_order_ field.
8026 (Sort_commons::operator): Check sort_order_.
8027 (Symbol_table::allocate_commons): Determine the sort order.
8028 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8029 Change all callers.
8030 (Symbol_table::do_allocate_commons_list): Likewise.
8031
8032 2009-12-30 Ian Lance Taylor <iant@google.com>
8033
8034 PR 10916
8035 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8036 symbols from this object, don't change the visibility of an
8037 undefined symbol.
8038 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8039
8040 2009-12-30 Ian Lance Taylor <iant@google.com>
8041
8042 PR 10861
8043 * script.h (class Version_script_info): Define Language enum.
8044 Update declarations. Define Glob, Exact, and Lookup types. Add
8045 new fields globals_, locals_, and is_finalized_.
8046 * script.cc: Various formatting fixes.
8047 (class Parser_closure): Change language_stack_ from a vector of
8048 std::string to one of Version_script_info::Language. Adjust all
8049 uses accordingly.
8050 (class Lazy_demangler): Remove.
8051 (struct Version_expression): Change language from std::string to
8052 Version_script_info::Language.
8053 (Version_script_info::Version_script_info): New function.
8054 (Version_script_info::~Version_script_info): Don't call clear.
8055 (Version_script_info::finalize): New function.
8056 (Version_script_info::build_lookup_tables): New function.
8057 (Version_script_info::build_expression_list_lookup): New
8058 function.
8059 (Version_script_info::get_symbol_version_helper): Rewrite to use
8060 lookup tables.
8061 (Version_script_info::print_expression_list): Adjust to use
8062 Version_script_info::Language.
8063 (script_push_lex_into_version_mode): Check that the version script
8064 has not been finalized.
8065 (version_script_push_lang): Change language string to
8066 Version_script_info::Language.
8067 * options.cc (Command_line::version_script): New function.
8068 * options.h (class General_options): Add finalize_dynamic_list
8069 function. Change version_script from declaration to definition.
8070 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8071 * testsuite/version_script.map: Remove duplicate def of foo.
8072 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8073 version_script.map.
8074 * testsuite/Makefile.in: Rebuild.
8075
8076 2009-12-30 Ian Lance Taylor <iant@google.com>
8077
8078 PR 10843
8079 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8080 if the input symbol index is 0, make the output symbol index 0.
8081
8082 2009-12-30 Ian Lance Taylor <iant@google.com>
8083
8084 PR 10670
8085 * options.h (class General_options): Add -x/--discard-all.
8086 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8087 --discard-all. If the local symbol needs a dynamic entry, check
8088 that before handling --discard-locals.
8089
8090 2009-12-30 Ian Lance Taylor <iant@google.com>
8091
8092 PR 10450
8093 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8094 flags to PF_R.
8095 (Output_segment::add_output_section): Don't change the flags if
8096 the type is PT_TLS.
8097
8098 PR 10450
8099 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8100 GNU hash table if they need a dynamic value. Otherwise, don't add
8101 them if they are defined in a dynamic object or are forced local.
8102
8103 2009-12-29 Ian Lance Taylor <iant@google.com>
8104
8105 PR 10450
8106 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8107 .gnu.hash table for a 32-bit target.
8108
8109 PR 10450
8110 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8111 regular and a dynamic object only needs a dynamic symbol table
8112 entry if it is externally visible.
8113
8114 PR 10450
8115 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8116 constructor. Add global_offset_table_ field.
8117 (Target_i386::got_section): Set global_offset_table_.
8118 (Target_i386::do_finalize_sections): Set global_offset_table_
8119 size.
8120 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8121 in constructor. Add global_offset_table_ field.
8122 (Target_x86_64::got_section): Set global_offset_table_.
8123 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8124 size.
8125
8126 * layout.cc (Layout::Layout): Initialize increase_relro_.
8127 (Layout::get_output_section): Add is_relro, is_last_relro, and
8128 is_first_non_relro parameters. Change all callers.
8129 (Layout::choose_output_section): Likewise.
8130 (Layout::add_output_section_data): Likewise.
8131 (Layout::make_output_section): Likewise.
8132 (Layout::set_segment_offsets): Clear increase_relro when using a
8133 linker script.
8134 * layout.h (class Layout): Add increase_relro method. Add
8135 increase_relro_ field. Update declarations.
8136 * output.cc (Output_section::Output_section): Initialize
8137 is_last_relro_ and is_first_non_relro_.
8138 (Output_segment::add_output_section): Group relro sections is
8139 do_sort is true. Handle is_last_relro and is_first_non_relro.
8140 (Output_segment::maximum_alignment): Remove relro handling.
8141 (Output_segment::set_section_addresses): Add increase_relro
8142 parameter. Change all callers. Add initial alignment to align
8143 relro sections on separate page. Remove old relro handling.
8144 (Output_segment::set_section_list_addresses): Remove in_relro
8145 parameter. Change all callers.
8146 (Output_segment::set_offset): Add increase parameter. Change all
8147 callers. Remove old relro handling.
8148 * output.h (class Output_section): Add new methods: is_last_relro,
8149 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8150 Add is_last_relro_ and is_first_non_relro_ fields.
8151 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8152 Create separate .got.plt section. Call increase_relro.
8153 * x86_64.cc (Target_x86_64::got_section): Likewise.
8154 * testsuite/relro_script_test.t: Add .got.plt.
8155
8156 PR 10450
8157 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8158 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8159 (Layout::finalize): Call set_dynamic_symbol_size.
8160 (Layout::set_dynamic_symbol_size): New function.
8161 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8162 set_dynamic_symbol_size.
8163
8164 PR 10450
8165 * output.h (class Output_section): Add is_entsize_zero_ field.
8166 * output.cc (Output_section::Output_section): Initialize
8167 is_entsize_zero_.
8168 (Output_section::set_entsize): If two different entsizes are
8169 requested, force it to zero.
8170 (Output_section::add_input_section): Set flags for .debug_str
8171 before updating section flags. Set entsize.
8172 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8173 and SHF_STRING if all input sections have those flags.
8174
8175 2009-12-29 Rafael Espindola <espindola@google.com>
8176
8177 * main.cc (main): Fix the sys time reporting.
8178 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8179 reporting.
8180
8181 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8182
8183 * options.cc (General_options::parse_version): Allow -v to exit
8184 without an error if there is nothing to link.
8185
8186 2009-12-29 Ian Lance Taylor <iant@google.com>
8187
8188 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8189 using a version of gcc before 4.1.
8190 * configure: Rebuild.
8191
8192 2009-12-28 Chris Demetriou <cgd@google.com>
8193
8194 * attributes.cc (Output_attributes_section_data::do_write): Use
8195 std::vector::front rather than std::vector::data.
8196
8197 2009-12-28 Ian Lance Taylor <iant@google.com>
8198
8199 * symtab.h (class Symbol_table): Add enum Defined.
8200 * resolve.cc (Symbol_table::should_override): Add defined
8201 parameter. Change all callers. Test whether object is NULL
8202 before calling a method on it.
8203 (Symbol_table::report_resolve_problem): Add defined parameter.
8204 Change all callers.
8205 (Symbol_table::should_override_with_special): Likewise.
8206 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8207 parameter. Change all callers.
8208 (Symbol_table::do_define_in_output_data): Likewise.
8209 (Symbol_table::define_in_output_segment): Likewise.
8210 (Symbol_table::do_define_in_output_segment): Likewise.
8211 (Symbol_table::define_as_constant): Likewise.
8212 (Symbol_table::do_define_as_constant): Likewise.
8213 * script.h (class Symbol_assignment): Add is_defsym parameter to
8214 constructor; change all callers.
8215 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8216 parameter. Change all callers. Add is_defsym_ field.
8217 (class Parser_closure): Add parsing_defsym parameter to
8218 constructor; change all callers. Add parsing_defsym accessor
8219 function. Add parsing_defsym_ field.
8220
8221 2009-12-28 Ian Lance Taylor <iant@google.com>
8222
8223 * gold.cc (queue_middle_tasks): Fix formatting.
8224 * object.cc (Relobj::is_section_name_included): Likewise.
8225
8226 2009-12-23 Ian Lance Taylor <iant@google.com>
8227
8228 * i386.cc (Target_i386::do_calls_non_split): Recognize
8229 -fsplit-stack prologue for a function with a static chain.
8230 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8231 -fsplit-stack prologue when using %r11.
8232
8233 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8234
8235 * options.cc (General_options::parse_version): Make -v continue and do
8236 the link like GNU ld does.
8237
8238 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8239
8240 * Makefile.am (CCFILES): Add timer.cc.
8241 (HFILES): Add timer.h.
8242 * configure.ac: Check for sysconf and times.
8243 * main.cc: include timer.h.
8244 (main): Use Timer instead of get_run_time.
8245 * timer.cc: New.
8246 * timer.h: New.
8247 * workqueue.cc: include timer.h.
8248 (Workqueue::find_and_run_task):
8249 Report user, sys and wall time.
8250 * Makefile.in: Regenerate.
8251 * config.in: Regenerate.
8252 * configure: Regenerate.
8253
8254 2009-12-16 Doug Kwan <dougkwan@google.com>
8255
8256 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8257 sections.
8258 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8259 relaxed input sections.
8260 * output.cc (Output_section::find_relaxed_input_section): Change
8261 return type to Output_relaxed_input_section pointer. Adjust code
8262 for new type of relaxed_input_section_map_.
8263 * output.h (Output_section::find_relaxed_input_section): Change
8264 return type to Output_relaxed_input_section pointer.
8265 (Output_section::Output_relaxed_input_section_by_input_section_map):
8266 New type.
8267 (Output_section::relaxed_input_section_map_): Change type to
8268 Output_section::Output_relaxed_input_section_by_input_section_map.
8269 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8270 input section.
8271
8272 2009-12-15 Ian Lance Taylor <iant@google.com>
8273
8274 * layout.cc (Layout::create_shstrtab): Only write out after input
8275 sections if we are compressing debug sections.
8276
8277 2009-12-15 Ian Lance Taylor <iant@google.com>
8278
8279 * archive.cc (Archive::add_symbols): Only look up a symbol without
8280 a version if there is, in fact, a version.
8281
8282 2009-12-14 Ian Lance Taylor <iant@google.com>
8283
8284 Revert -Wshadow changes, all changes from:
8285 2009-12-11 Doug Kwan <dougkwan@google.com>
8286 2009-12-11 Nick Clifton <nickc@redhat.com>
8287 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8288
8289 2009-12-11 Doug Kwan <dougkwan@google.com>
8290
8291 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8292 due to -Wshadow.
8293 * attributes.cc (Object_attribute::size): Ditto.
8294 (Attributes_section_data::size): Ditto.
8295 (Attributes_section_data::Attributes_section_data): Ditto.
8296 (Output_attributes_section_data::do_write): Ditto.
8297 * attributes.h (Object_attribute::set_type): Ditto.
8298 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8299
8300 2009-12-11 Nick Clifton <nickc@redhat.com>
8301
8302 * archive.cc: Fix shadowed variable warnings.
8303 * arm.cc: Likewise.
8304 * compressed_output.cc: Likewise.
8305 * compressed_output.h: Likewise.
8306 * configure: Likewise.
8307 * dwarf_reader.cc: Likewise.
8308 * dynobj.cc: Likewise.
8309 * dynobj.h: Likewise.
8310 * ehframe.cc: Likewise.
8311 * ehframe.h: Likewise.
8312 * errors.cc: Likewise.
8313 * expression.cc: Likewise.
8314 * fileread.cc: Likewise.
8315 * fileread.h: Likewise.
8316 * freebsd.h: Likewise.
8317 * i386.cc: Likewise.
8318 * icf.cc: Likewise.
8319 * incremental.h: Likewise.
8320 * layout.cc: Likewise.
8321 * layout.h: Likewise.
8322 * mapfile.cc: Likewise.
8323 * merge.cc: Likewise.
8324 * merge.h: Likewise.
8325 * object.cc: Likewise.
8326 * object.h: Likewise.
8327 * options.h: Likewise.
8328 * output.cc: Likewise.
8329 * output.h: Likewise.
8330 * parameters.cc: Likewise.
8331 * plugin.cc: Likewise.
8332 * powerpc.cc: Likewise.
8333 * reduced_debug_output.cc: Likewise.
8334 * reduced_debug_output.h: Likewise.
8335 * reloc.cc: Likewise.
8336 * reloc.h: Likewise.
8337 * resolve.cc: Likewise.
8338 * script-sections.cc: Likewise.
8339 * script.cc: Likewise.
8340 * script.h: Likewise.
8341 * sparc.cc: Likewise.
8342 * symtab.cc: Likewise.
8343 * symtab.h: Likewise.
8344 * target-select.cc: Likewise.
8345 * target-select.h: Likewise.
8346 * token.h: Likewise.
8347 * workqueue.cc: Likewise.
8348 * workqueue.h: Likewise.
8349 * x86_64.cc: Likewise.
8350
8351 2009-12-10 Doug Kwan <dougkwan@google.com>
8352
8353 * arm.cc (attributes.h): New include.
8354 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8355 (Arm_relobj::~Arm_relobj): Delete object pointed by
8356 attributes_section_data_.
8357 (Arm_relobj::attributes_section_data): New method definition.
8358 (Arm_relobj::attributes_section_data_): New data member declaration.
8359 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8360 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8361 attributes_section_data_.
8362 (Arm_dynobj::attributes_section_data): New method definition.
8363 (Arm_dynobj::attributes_section_data_): New data member declaration.
8364 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8365 initialization value of may_use_blx_ to false.
8366 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8367 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8368 object attributes to compute results instead of hard-coding.
8369 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8370 Target_arm::get_secondary_compatible_arch,
8371 Target_arm::set_secondary_compatible_arch
8372 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8373 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8374 New method declarations.
8375 (Target_arm::get_aeabi_object_attribute): New method definition.
8376 (Target_arm::attributes_section_data_): New data member declaration.
8377 (read_arm_attributes_section): New template definition.
8378 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8379 (Arm_dynobj::do_read_symbols): Ditto.
8380 (Target_arm::do_finalize_sections): Merge attributes sections from
8381 input. Check for BLX use after attributes section merging.
8382 Fix __exidx_start and __exidx_end visibility. Create an
8383 .ARM.attributes section if necessary.
8384 (Target_arm::get_secondary_compatible_arch,
8385 Target_arm::set_secondary_compatible_arch,
8386 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8387 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8388 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8389 New method definitions.
8390
8391 2009-12-09 Ian Lance Taylor <iant@google.com>
8392
8393 * plugin.cc (Plugin::load): Don't cast from void* to a function
8394 pointer.
8395
8396 2009-12-09 Ian Lance Taylor <iant@google.com>
8397
8398 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8399 information fields.
8400
8401 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8402
8403 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8404 Replace two_file_shared_1.so with two_file_shared_2.so.
8405 * testsuite/Makefile.in: Regenerated.
8406
8407 2009-12-08 Doug Kwan <dougkwan@google.com>
8408
8409 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8410 (HFILES): Add attributes.h and int_encoding.h.
8411 * Makefile.in: Regenerate.
8412 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8413 function definitions to int_encoding.cc
8414 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8415 prototypes to int_encoding.h
8416 * reduced_debug_output.cc (int_encoding.h): New include.
8417 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8418 function definitions to int_encoding.cc
8419 (insert_into_vector, read_from_pointer): Move template definitions to
8420 int_encoding.h
8421 * attributes.cc: New file.
8422 * attributes.h: New file.
8423 * int_encoding.cc: New file.
8424 * int_encoding.h: New file.
8425
8426 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8427
8428 PR gold/11055
8429 * incremental-dump.cc (dump_incremental_inputs): New.
8430 (main): Use dump_incremental_inputs.
8431
8432 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8433
8434 PR gold/10893
8435 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8436 checking elfcpp::STT_FUNC.
8437 (Target_i386::Relocate::relocate): Likewise.
8438 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8439
8440 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8441 symbols from shared libraries into normal FUNC symbols.
8442
8443 * symtab.h (Symbol): Add is_func and use it.
8444
8445 2009-12-05 Doug Kwan <dougkwan@google.com>
8446
8447 * arm.cc (Target_arm::arm_info): Initialize new fields
8448 attributes_section and attributes_vendor.
8449 * i386.cc (Target_i386::i386_info): Same.
8450 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8451 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8452 fields attributes_section and attributes_vendor.
8453 * sparc.cc (Target_sparc::sparc_info): Same.
8454 * target.h (Target::attributes_section, Target::attributes_vendor,
8455 Target::is_attributes_section, Target::attribute_arg_type,
8456 Target::attributes_order): New method definitions.
8457 (Target::Target_info::attributes_section,
8458 Target::Target_info::attributes_vendor): New fields.
8459 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8460 virtual method definitions.
8461 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8462 attributes_section and attributes_vendor.
8463 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8464
8465 2009-12-05 Doug Kwan <dougkwan@google.com>
8466
8467 * arm.cc: Update comments about interworking and stub generation.
8468 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8469 considered as non-PIC.
8470 (Arm_relocate_functions::base_abs): Fix formatting.
8471 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8472 of function to use GOT entry address instead of offset.
8473 (Target_arm::Scan::global): Issue an error if a symbol would need a
8474 PLT does not get one because it is untyped. Remove code to create
8475 dynamic symbols for relative branches.
8476 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8477 takes unsigned integer instead of boolean.
8478
8479 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8480
8481 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8482 (two_file_test_LDADD): Likewise.
8483 (common_test_1_LDADD): Likewise.
8484 (exception_test_LDADD) Likewise.
8485 (weak_test_LDADD): Likewise.
8486 (many_sections_test_LDADD): Likewise.
8487 (initpri1_LDADD): Likewise.
8488 (script_test_1_LDADD): Likewise.
8489 (script_test_2_LDADD): Likewise.
8490 (justsyms_LDADD): Likewise.
8491 (binary_test_LDADD): Likewise.
8492 (large_LDADD): Likewise.
8493 * testsuite/Makefile.in: Regenerated.
8494
8495 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8496
8497 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8498 (Symbol_table::override_with_special): Likewise.
8499 (Symbol_table::add_from_object): Likewise.
8500
8501 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8502
8503 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8504 Don't set the data_offset twice.
8505
8506 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8507
8508 * testsuite/Makefile.in: Regenerate.
8509
8510 2009-12-03 Doug Kwan <dougkwan@google.com>
8511
8512 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8513 (Target_arm::do_finalize_sections): Add parameter for symbol table
8514 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8515 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8516 parameter for symbol table pointer.
8517 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8518 an additional parameter for a pointer to symbol table.
8519 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8520 parameter for a symbol table pointer.
8521 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8522 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8523 Ditto.
8524 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8525 parameter for a symbol table pointer.
8526
8527 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8528
8529 * incremental.cc (Incremental_inputs_header)
8530 (Incremental_inputs_header_write, Incremental_inputs_entry)
8531 (Incremental_inputs_entry_write): Move ...
8532 * incremental.h (Incremental_inputs_header)
8533 (Incremental_inputs_header_write, Incremental_inputs_entry)
8534 (Incremental_inputs_entry_write): here.
8535
8536 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8537
8538 * incremental.cc (make_sized_incremental_binary): Set the target.
8539 Error if it is incompatible.
8540 * output.h (Output_file): Add filename method.
8541
8542 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8543
8544 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8545 from the get_* methods.
8546
8547 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8548
8549 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8550 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8551 Write 0 for the data_offset of scripts.
8552
8553 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8554
8555 * testsuite/Makefile.am: Add the incremental_test.sh test.
8556 * testsuite/incremental_test.sh: New.
8557 * testsuite/incremental_test_1.c: New.
8558 * testsuite/incremental_test_2.c: New.
8559
8560 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8561
8562 * incremental-dump.cc (main): Fix typos.
8563
8564 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8565
8566 PR gold/11025
8567 * incremental-dump.cc (main): Use llu to print 64 bit values.
8568
8569 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8570 H.J. Lu <hongjiu.lu@intel.com>
8571
8572 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8573 $(LIBDL).
8574 (incremental_dump_LDADD): Likewise.
8575 * Makefile.in: Regenerated.
8576
8577 2009-11-25 Doug Kwan <dougkwan@google.com>
8578
8579 Revert:
8580
8581 2009-11-25 Doug Kwan <dougkwan@google.com>
8582
8583 * arm.cc (Target_arm::Target_arm): Move method definition
8584 outside of class definition. Add code to handle
8585 --target1-rel, --target1-abs and --target2= options.
8586 (Target_arm::get_reloc_reloc_type): Change method to be
8587 non-static and const.
8588 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8589 New data member declaration.
8590 (Target_arm::Scan::local, Target_arm::Scan::global,
8591 Target_arm::Relocate::relocate,
8592 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8593 Adjust call to Target_arm::get_real_reloc_type.
8594 (Target_arm::get_real_reloc_type): Use command line options
8595 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8596 * options.h (--target1-rel, --target1-abs, --target2): New
8597 ARM-only options.
8598
8599 2009-11-25 Doug Kwan <dougkwan@google.com>
8600
8601 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8602 class definition. Add code to handle --target1-rel, --target1-abs
8603 and --target2= options.
8604 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8605 and const.
8606 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8607 member declaration.
8608 (Target_arm::Scan::local, Target_arm::Scan::global,
8609 Target_arm::Relocate::relocate,
8610 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8611 call to Target_arm::get_real_reloc_type.
8612 (Target_arm::get_real_reloc_type): Use command line options to
8613 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8614 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8615 options.
8616
8617 2009-11-25 Doug Kwan <dougkwan@google.com>
8618
8619 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8620 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8621 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8622 formatting.
8623 (Arm_relocate_functions::thm_call): Replace body with a call to
8624 Arm_relocate_functions::thumb_branch_common.
8625 (Arm_relocate_functions::thm_jump24,
8626 Arm_relocate_functions::thm_xpc22): New method definitions.
8627 (Arm_relocate_functions::thumb_branch_common): New method definition.
8628 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8629 operator.
8630 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8631 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8632
8633 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8634
8635 * Makefile.am: Build incremental-dump
8636 * Makefile.in: Regenerate.
8637 * incremental-dump.cc: New.
8638 * incremental.cc (Incremental_inputs_header_data,
8639 Incremental_inputs_entry_data): Move to incremental.h
8640 * incremental.h: (Incremental_inputs_header_data,
8641 Incremental_inputs_entry_data): Move from incremental.cc
8642
8643 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8644
8645 * incremental.cc (Incremental_inputs_header,
8646 Incremental_inputs_header_write, Incremental_inputs_entry,
8647 Incremental_inputs_entry_write): Add a typedef with the data type.
8648
8649 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8650
8651 * incremental.cc (Incremental_inputs_header,
8652 Incremental_inputs_header_write, Incremental_inputs_entry,
8653 Incremental_inputs_entry_write): Update comment about which
8654 type has the filed descriptions.
8655
8656 2009-11-15 Doug Kwan <dougkwan@google.com>
8657
8658 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8659 (Arm_relocate_functions::arm_branch_common): Change method defintion
8660 in class definition to a method declaration and update list of formal
8661 parameters.
8662 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8663 Arm_relocation_functions::jump24): Adjust call to
8664 Arm_relocate_functions::arm_branch_common. Update list of formal
8665 parameters.
8666 (Arm_relocate_functions::xpc25): New method definition.
8667 (Arm_relocate_functions::arm_branch_common): Move method defintion
8668 out from class definition. Use stubs for mode-switching and extending
8669 branch ranges.
8670 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8671 specially. Change code to enable use of stubs in ARM branches.
8672
8673 2009-11-10 Doug Kwan <dougkwan@google.com>
8674
8675 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8676 in method declaration.
8677 (Target_arm::relocate_stub): New method declaration.
8678 (Target_arm::default_target): Change to return a pointer instead of
8679 a const reference.
8680 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8681 Target_arm::default_target.
8682 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8683 method definition.
8684 (Target_arm::relocate_section): Adjust view.
8685 (Target_arm::relocate_stub): New method definition.
8686
8687 2009-11-10 Doug Kwan <dougkwan@google.com>
8688
8689 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8690 a format warning.
8691 * incremental.cc (open_incremental_binary): Initialized local
8692 variables to avoid warnings.
8693 * object.cc (make_elf_object): Ditto.
8694 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8695 a format warning.
8696
8697 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8698
8699 PR gold/10930
8700 * testsuite/plugin_test.c: Include "config.h".
8701
8702 2009-11-09 Doug Kwan <dougkwan@google.com>
8703
8704 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8705 (arm_symbol_value): Remove.
8706 (Arm_relocate_functions::arm_branch_common,
8707 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8708 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8709 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8710 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8711 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8712 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8713 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8714 Arm_relocate_functions::thm_mobw_abs_nc,
8715 Arm_relocate_functions::thm_mov_abs,
8716 Arm_relocate_functions::movw_prel_nc,
8717 Arm_relocate_functions::thm_movt_abs,
8718 Arm_relocate_functions::movt_prel,
8719 Arm_relocate_functions::thm_movw_prel_nc,
8720 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8721 (Target_arm::Relocate::relocate): Only decompose address into two
8722 parts if relocation type uses the thumb-bit and pass the actual
8723 bit instead of a flag indicating that the thumb-bit is used. Adjust
8724 calls to methods in Arm_relocate_functions for this change.
8725
8726 2009-11-08 Ian Lance Taylor <iant@google.com>
8727
8728 PR 10925
8729 * reloc.cc: Instantiate
8730 Sized_relobj::initialize_input_to_output_maps and
8731 Sized_relobj:free_input_to_output_maps.
8732
8733 2009-11-06 Ian Lance Taylor <iant@google.com>
8734
8735 PR 10876
8736 * defstd.cc (in_segment): Set only_if_ref true for "end".
8737
8738 2009-11-06 Doug Kwan <dougkwan@google.com>
8739
8740 * arm.cc (class Reloc_stub): Correct a comment.
8741 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8742 (Target_arm::scan_section_for_stubs): New method declaration.
8743 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8744 Change methods from private to protected.
8745 (Target_arm::do_may_relax): New method definition.
8746 (Target_arm::do_relax, Target_arm::group_sections,
8747 Target_arm::scan_reloc_for_stub,
8748 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8749 (Target_arm::arm_input_section_map_): New data member declaration.
8750 (Target_arm::scan_reloc_for_stub,
8751 Target_arm::scan_reloc_section_for_stubs,
8752 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8753 Target_arm::do_relax): New method definitions.
8754
8755 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8756
8757 * configure.ac: Check for (struct stat)::st_mtim
8758 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8759 * config.in: Regenerate.
8760 * configure: Regenerate.
8761
8762 2009-11-05 Ian Lance Taylor <iant@google.com>
8763
8764 PR 10910
8765 * output.cc (Output_segment::add_output_section): Add missing
8766 return statement.
8767
8768 2009-11-04 Ian Lance Taylor <iant@google.com>
8769
8770 PR 10880
8771 * object.h (class Object): Add is_needed and set_is_needed
8772 methods. Add is_needed_ field. Make bool fields into bitfields.
8773 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8774 defined in a dynamic object and referenced by a regular object,
8775 set is_needed for the dynamic object.
8776 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8777 if the file is marked with as_needed and it is not needed.
8778
8779 2009-11-04 Ian Lance Taylor <iant@google.com>
8780
8781 PR 10887
8782 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8783 tags if data is discarded by linker script.
8784 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8785 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8786 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8787 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8788
8789 2009-11-04 Ian Lance Taylor <iant@google.com>
8790
8791 * layout.cc (Layout::get_output_section): Add is_interp and
8792 is_dynamic_linker_section parameters. Change all callers.
8793 (Layout::choose_output_section): Likewise.
8794 (Layout::make_output_section): Likewise.
8795 (Layout::add_output_section_data): Add is_dynamic_linker_section
8796 parameter. Change all callers.
8797 * layout.h (class Layout): Update declarations.
8798 * output.h (class Output_section): Add is_interp, set_is_interp,
8799 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8800 Add is_interp_, is_dynamic_linker_section_ fields. Change
8801 generate_code_fills_at_write_ to a bitfield.
8802 * output.cc (Output_section::Output_sections): Initialize new
8803 fields.
8804 (Output_segment::add_output_section): Add do_sort parameter.
8805 Change all callers.
8806
8807 2009-11-03 Ian Lance Taylor <iant@google.com>
8808
8809 PR 10860
8810 * options.h (class General_options): Add --warn-common.
8811 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8812 merging two common symbols.
8813 (Symbol_table::should_override): Handle --warn-common when merging
8814 a common symbol with a defined symbol. Use report_resolve_problem
8815 for multiple definitions.
8816 (Symbol_table::report_resolve_problem): New function.
8817 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8818
8819 2009-11-03 Doug Kwan <dougkwan@google.com>
8820
8821 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8822 stub_factory_.
8823 (Target_arm::stub_factory): New method definition.
8824 (Target_arm::new_arm_input_section,
8825 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8826 Target_arm::reloc_uses_thumb_bit): New method declarations.
8827 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8828 New type definitions.
8829 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8830 member declarations.
8831 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8832 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8833 New method definitions.
8834
8835 2009-11-03 Ian Lance Taylor <iant@google.com>
8836
8837 * options.h (class General_options): Add --warn_constructors.
8838
8839 2009-11-03 Ian Lance Taylor <iant@google.com>
8840
8841 PR 10893
8842 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8843 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8844
8845 2009-11-03 Ian Lance Taylor <iant@google.com>
8846
8847 PR 10895
8848 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8849 --msgid-bugs-address.
8850 (install-pdf): New target.
8851 (install-data_yes): Look up one directory to find mkinstalldirs.
8852
8853 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8854
8855 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8856 tree.
8857
8858 2009-10-30 Doug Kwan <dougkwan@google.com>
8859
8860 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8861
8862 2009-10-30 Doug Kwan <dougkwan@google.com>
8863
8864 * arm.cc (Stub_addend_reader): New struct template definition
8865 and partial specializations.
8866 (Stub_addend_reader::operator()): New method definition for a
8867 partially specialized template.
8868
8869 2009-10-30 Doug Kwan <dougkwan@google.com>
8870
8871 * arm.cc (Arm_relobj::processor_specific_flags): New method
8872 definition.
8873 (Arm_relobj::do_read_symbols): New method declaration.
8874 (Arm_relobj::processor_specific_flags_): New data member declaration.
8875 (Arm_dynobj): New class definition.
8876 (Target_arm::do_finalize_sections): Add input_objects parameter.
8877 (Target_arm::do_adjust_elf_header): New method declaration.
8878 (Target_arm::are_eabi_versions_compatible,
8879 (Target_arm::merge_processor_specific_flags): New method declaration.
8880 (Target_arm::do_make_elf_object): New overloaded method definitions
8881 and declaration.
8882 (Arm_relobj::do_read_symbols): New method definition.
8883 (Arm_dynobj::do_read_symbols): Ditto.
8884 (Target_arm::do_finalize_sections): Add input_objects parameters.
8885 Merge processor-specific flags from all input objects.
8886 (Target_arm::are_eabi_versions_compatible,
8887 Target_arm::merge_processor_specific_flags,
8888 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8889 New method definitions.
8890 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8891 Input_objects pointer type parameter.
8892 * layout.cc (Layout::finalize): Pass input objects to target's.
8893 finalize_sections function.
8894 * output.cc (Output_file_header::do_sized_write): Set ELF file
8895 header's processor-specific flags.
8896 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8897 Input_objects pointer type parameter.
8898 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8899 * target.h (Input_objects): New forward class declaration.
8900 (Target::processor_specific_flags,
8901 Target::are_processor_specific_flags_sect): New method definitions.
8902 (Target::finalize_sections): Add input_objects parameter.
8903 (Target::Target): Initialize processor_specific_flags_ and
8904 are_processor_specific_flags_set_.
8905 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8906 parameter.
8907 (Target::set_processor_specific_flags): New method definition.
8908 (Target::processor_specific_flags_,
8909 Target::are_processor_specific_flags_set_): New data member
8910 declarations.
8911 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8912 Input_objects pointer type parameter.
8913
8914 2009-10-30 Doug Kwan <dougkwan@google.com>
8915
8916 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8917
8918 2009-10-28 Ian Lance Taylor <iant@google.com>
8919
8920 * object.h (class Relobj): Drop options parameter from
8921 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8922 do_scan_relocs, do_relocate. Change all callers.
8923 (class Sized_relobj): Drop options parameters from
8924 do_gc_process_relocs, do_scan_relocs, do_relocate,
8925 do_relocate_sections, relocate_sections, emit_relocs_scan,
8926 emit_relocs_scan_reltype. Change all callers.
8927 (struct Relocate_info): Remove options field and all references to
8928 it.
8929 * reloc.h (class Read_relocs): Remove options constructor
8930 parameter and options_ field. Change all callers.
8931 (class Gc_process_relocs, class Scan_relocs): Likewise.
8932 (class Relocate_task): Likewise.
8933 * target-reloc.h (scan_relocs): Remove options parameter. Change
8934 all callers.
8935 (scan_relocatable_relocs): Likewise.
8936 * target.h (class Sized_target): Remove options parameter from
8937 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8938 all callers.
8939 * gc.h (gc_process_relocs): Remove options parameter. Change all
8940 callers.
8941 * arm.cc: Update functions to remove options parameters.
8942 * i386.cc: Likewise.
8943 * powerpc.cc: Likewise.
8944 * sparc.cc: Likewise.
8945 * x86_64.cc: Likewise.
8946 * testsuite/testfile.cc: Likewise.
8947
8948 2009-10-28 Doug Kwan <dougkwan@google.com>
8949
8950 * arm.cc (Arm_relobj): New class definition.
8951 (Arm_relobj::scan_sections_for_stubs,
8952 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8953 New method definitions.
8954
8955 2009-10-28 Cary Coutant <ccoutant@google.com>
8956
8957 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8958 (Plugin::cleanup_done_): New member.
8959 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8960 (Plugin_manager::cleanup_done_): Remove.
8961 (Plugin_manager::add_input_file): Edit error message.
8962 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8963 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8964
8965 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8966
8967 * fileread.cc: (File_read::View::~View): Use the new
8968 data_ownership_ filed.
8969 (File_read::~File_read): Dispose the new whole_file_view_.
8970 (File_read::open): Mmap the whole file if needed.
8971 (File_read::open): Use whole_file_view_ instead of contents_.
8972 (File_read::find_view): Use whole_file_view_ if applicable.
8973 (File_read::do_read): Use whole_file_view_ instead of contents_.
8974 (File_read::make_view): Use whole_file_view_ instead of contents_,
8975 update File_read::View::View call.
8976 (File_read::find_or_make_view): Update File_read::View::View
8977 call.
8978 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8979 remove contents_
8980 (File_read::View::Data_ownership): New enum.
8981 (File_read::View::View): Replace bool mapped_ with Data_ownership
8982 argument.
8983 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8984 (File_read::View::data_ownership_): New field.
8985 (File_read::contents_): Remove (replaced by whole_file_view_).
8986 (File_read::whole_file_view_): New field.
8987 * options.h (class General_options): Add --keep-files-mapped.
8988
8989 2009-10-27 Cary Coutant <ccoutant@google.com>
8990
8991 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8992 * testsuite/Makefile.am (plugin_test_5): New test case.
8993 * testsuite/Makefile.in: Regenerate.
8994
8995 2009-10-25 Doug Kwan <dougkwan@google.com>
8996
8997 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8998 from private to protected to allow access by child class.
8999 (Sized_relobj::do_relocate_sections): New method declaration.
9000 (Sized_relobj::relocate_sections): Virtualize.
9001 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9002 Sized_relobj::relocate_sections. Instantiate template explicitly
9003 for different target sizes and endianity.
9004
9005 2009-10-24 Doug Kwan <dougkwan@google.com>
9006
9007 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9008 (Arm_input_section::as_arm_input_section): New method.
9009 (Arm_output_section): New class definition.
9010 (Arm_output_section::create_stub_group,
9011 Arm_output_section::group_sections): New method definitions.
9012
9013 2009-10-22 Doug Kwan <dougkwan@google.com>
9014
9015 * arm.cc (Arm_input_section): New class definition.
9016 (Arm_input_section::init, Arm_input_section:do_write,
9017 Arm_input_section::set_final_data_size,
9018 Arm_input_section::do_reset_address_and_file_offset): New method
9019 definitions.
9020
9021 2009-10-21 Doug Kwan <dougkwan@google.com>
9022
9023 * arm.cc (Stub_table, Arm_input_section): New forward class
9024 declarations.
9025 (Stub_table): New class defintion.
9026 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9027 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9028 New method definition.
9029
9030 2009-10-21 Doug Kwan <dougkwan@google.com>
9031
9032 * arm.cc: Update copyright comments.
9033 (Target_arm): New forward class template declaration.
9034 (Arm_address): New type.
9035 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9036 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9037 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9038 constants.
9039 (Insn_template): Same.
9040 (DEF_STUBS): New macro.
9041 (Stub_type): New enum type.
9042 (Stub_template): New class definition.
9043 (Stub): Same.
9044 (Reloc_stub): Same.
9045 (Stub_factory): Same.
9046 (Target_arm::Target_arm): Initialize may_use_blx_ and
9047 should_force_pic_veneer_.
9048 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9049 Target_arm::should_force_pic_veneer,
9050 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9051 Target_arm::using_thumb_only, Target_arm:;default_target): New
9052 method defintions.
9053 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9054 New data member declarations.
9055 (Insn_template::size, Insn_template::alignment): New method defintions.
9056 (Stub_template::Stub_template): New method definition.
9057 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9058 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9059 (Stub_factory::Stub_factory): New method definition.
9060 * gold.h (string_hash): New template.
9061 * output.h (Input_section_specifier::hash_value): Use
9062 gold::string_hash.
9063 (Input_section_specifier::string_hash): Remove.
9064 * stringpool.cc (Stringpool_template::string_hash): Use
9065 gold::string_hash.
9066
9067 2009-10-20 Doug Kwan <dougkwan@google.com>
9068
9069 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9070 symbols of relaxed input sections.
9071 * output.h (Output_section::find_relaxed_input_section): Make
9072 method public.
9073
9074 2009-10-16 Doug Kwan <dougkwan@google.com>
9075
9076 * dynobj.cc (Versions::Versions): Initialize version_script_.
9077 Only insert base version symbol definition for a shared object
9078 if version script defines any version versions.
9079 (Versions::define_base_version): New method definition.
9080 (Versions::add_def): Check that base version is not needed.
9081 (Versions::add_need): Define base version lazily.
9082 * dynobj.h (Versions::define_base_version): New method declaration.
9083 (Versions::needs_base_version_): New data member declaration.
9084 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9085 (check_DATA): Add no_version_test.stdout.
9086 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9087 New make rules.
9088 * testsuite/Makefile.in: Regenerate.
9089 * testsuite/no_version_test.c: New file.
9090 * testsuite/no_version_test.sh: Ditto.
9091
9092 2009-10-16 Doug Kwan <dougkwan@google.com>
9093
9094 * expression.cc (class Segment_start_expression): New class definition.
9095 (Segment_start_expression::value): New method definition.
9096 (script_exp_function_segment_start): Return a new
9097 Segment_start_expression.
9098 * gold/script-c.h (script_saw_segment_start_expression): New function
9099 prototype.
9100 * script-sections.cc (Script_sections::Script_sections): Initialize
9101 SAW_SEGMENT_START_EXPRESSION_ to false.
9102 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9103 and -Tbbs options to specify section addresses if given in
9104 command line and no SEGMENT_START expression is seen in a script.
9105 * script-sections.h (Script_sections::saw_segment_start_expression,
9106 Script_sections::set_saw_segment_start_expression): New method
9107 definition.
9108 (Script_sections::saw_segment_start_expression_): New data member
9109 declaration.
9110 * script.cc (script_saw_segment_start_expression): New function.
9111 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9112 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9113 script_test_7.sh and script_test_8.sh.
9114 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9115 script_test_8.stdout.
9116 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9117 (script_test_6, script_test_6.stdout, script_test_7,
9118 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9119 * Makefile.in: Regenerate.
9120 * testsuite/script_test_6.sh: New file.
9121 * testsuite/script_test_6.t: Same.
9122 * testsuite/script_test_7.sh: Same.
9123 * testsuite/script_test_7.t: Same.
9124 * testsuite/script_test_8.sh: Same.
9125
9126 2009-10-16 Doug Kwan <dougkwan@google.com>
9127
9128 * output.cc (Output_segment::set_section_list_address): Cast
9129 expressions to unsigned long long type to avoid format warnings.
9130
9131 2009-10-15 Ian Lance Taylor <iant@google.com>
9132
9133 * script.cc (Script_options::add_symbol_assignment): Always add a
9134 dot assignment to script_sections_.
9135 * script-sections.cc (Script_sections::add_dot_assignment):
9136 Initialize if necessary.
9137
9138 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9139 program headers with no load segment if there is a linker script.
9140
9141 * layout.cc (Layout::set_segment_offsets): Align the file offset
9142 to the segment aligment for -N or -n with no load segment.
9143 * output.cc (Output_segment::add_output_section): Don't crash if
9144 the first section is a TLS section.
9145 (Output_segment::set_section_list_addresses): Print an error
9146 message if the address moves backward in a linker script.
9147 * script-sections.cc
9148 (Output_section_element_input::set_section_addresses): Don't
9149 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9150 (Orphan_output_section::set_section_addresses): Likewise.
9151
9152 2009-10-15 Doug Kwan <dougkwan@google.com>
9153
9154 * layout.cc (Layout::finish_dynamic_section): Generate tags
9155 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9156 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9157 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9158
9159 2009-10-14 Ian Lance Taylor <iant@google.com>
9160
9161 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9162 fields.
9163 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9164 data_shdr fields of relinfo.
9165 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9166 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9167 R_386_TLS_LDO_32, adjust based on section flags.
9168 (Target_i386::Relocate::fix_up_ldo): Remove.
9169
9170 2009-10-13 Ian Lance Taylor <iant@google.com>
9171
9172 Add support for -pie.
9173 * options.h (class General_options): Add -pie and
9174 --pic-executable.
9175 (General_options::output_is_position_independent): Test -pie.
9176 (General_options::output_is_executable): Return true if not shared
9177 and not relocatable.
9178 (General_options::output_is_pie): Remove.
9179 * options.cc (General_options::finalize): Reject incompatible uses
9180 of -pie.
9181 * gold.cc (queue_middle_tasks): A -pie link is not static.
9182 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9183 * symtab.cc (Symbol::final_value_is_known): Return false if
9184 output_is_position_independent.
9185 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9186 output_is_position_independent.
9187 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9188 output_is_position_independent.
9189 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9190 output_is_position_independent.
9191 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9192 two_file_pie_test.
9193 (basic_pie_test.o, basic_pie_test): New targets.
9194 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9195 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9196 (two_file_pie_test): New target.
9197 * testsuite/Makefile.in: Rebuild.
9198 * README: Remove note saying that -pie is not supported.
9199
9200 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9201
9202 * options.h (class General_options): Add -init and -fini.
9203 * layout.cc (Layout::finish_dynamic_section): Emit
9204 given init and fini functions.
9205
9206 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9207
9208 * gc.h (gc_process_relocs): Check if icf is enabled using new
9209 function.
9210 * gold.cc (queue_initial_tasks): Likewise.
9211 (queue_middle_tasks): Likewise.
9212 * object.cc (do_layout): Likewise.
9213 * symtab.cc (is_section_folded): Likewise.
9214 * main.cc (main): Likewise.
9215 * reloc.cc (Read_relocs::run): Likewise.
9216 (Sized_relobj::do_scan_relocs): Likewise.
9217 * icf.cc (is_function_ctor_or_dtor): New function.
9218 (Icf::find_identical_sections): Check if function is ctor or dtor when
9219 safe icf is chosen.
9220 * options.h (General_options::icf): Change option to be an enum.
9221 (Icf_status): New enum.
9222 (icf_enabled): New method.
9223 (icf_safe_folding): New method.
9224 (set_icf_status): New method.
9225 (icf_status_): New variable.
9226 * (options.cc) (General_options::finalize): Set icf_status_.
9227 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9228 icf_test and icf_keep_unique_test to use the --icf enum flag.
9229 * testsuite/icf_safe_test.sh: New file.
9230 * testsuite/icf_safe_test.cc: New file.
9231
9232 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9233
9234 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9235 includes to gc.h and icf.h.
9236 * arm.cc: Include gc.h.
9237 * gold.cc: Likewise.
9238 * i386.cc: Likewise.
9239 * powerpc.cc: Likewise.
9240 * sparc.cc: Likewise.
9241 * x86_64.cc: Likewise.
9242 * gc.h: Include icf.h.
9243
9244 2009-10-11 Ian Lance Taylor <iant@google.com>
9245
9246 * plugin.cc: Include "gold.h" before other header files.
9247
9248 2009-10-10 Chris Demetriou <cgd@google.com>
9249
9250 * options.h (Input_file_argument::Input_file_type): New enum.
9251 (Input_file_argument::is_lib_): Replace with...
9252 (Input_file_argument::type_): New member.
9253 (Input_file_argument::Input_file_argument): Take Input_file_type
9254 'type' rather than boolean 'is_lib' as second argument.
9255 (Input_file_argument::is_lib): Use type_.
9256 (Input_file_argument::is_searched_file): New function.
9257 (Input_file_argument::may_need_search): Handle is_searched_file.
9258 * options.cc (General_options::parse_library): Support -l:filename.
9259 (General_options::parse_just_symbols): Update for Input_file_argument
9260 changes.
9261 (Command_line::process): Likewise.
9262 * archive.cc (Archive::get_file_and_offset): Likewise.
9263 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9264 * script.cc (read_script_file, script_add_file): Likewise.
9265 * fileread.cc (Input_file::Input_file): Likewise.
9266 (Input_file::will_search_for): Handle is_searched_file.
9267 (Input_file::open): Likewise.
9268 * readsyms.cc (Read_symbols::get_name): Likewise.
9269 * testsuite/Makefile.am (searched_file_test): New test.
9270 * testsuite/Makefile.in: Regenerate.
9271 * testsuite/searched_file_test.cc: New file.
9272 * testsuite/searched_file_test_lib.cc: New file.
9273
9274 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9275 Ian Lance Taylor <iant@google.com>
9276
9277 * descriptor.cc: Include <cstdio> and "binary-io.h".
9278 (Descriptors::open): Open the files in binary mode always.
9279 * script.cc (Lex::get_token): Treat \r as whitespace.
9280
9281 2009-10-09 Ian Lance Taylor <iant@google.com>
9282
9283 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9284
9285 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9286 Ian Lance Taylor <iant@google.com>
9287
9288 * configure.ac: Check for readv function also.
9289 * fileread.cc (readv): Define if not HAVE_READV.
9290 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9291 does not exist.
9292 * config.in: Regenerate.
9293 * configure: Regenerate.
9294
9295 2009-10-09 Doug Kwan <dougkwan@google.com>
9296
9297 * layout.cc (Layout::make_output_section): Call target hook to make
9298 ordinary output section.
9299 (Layout::finalize): Adjust parameter list of call the
9300 Target::may_relax().
9301 * layout.h (class Layout::section_list): New method.
9302 * merge.h (Output_merge_base::entsize): Change visibility to public.
9303 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9304 New methods.
9305 (Output_merge_string::do_is_string): New method.
9306 * object.cc (Sized_relobj::do_setup): renamed from
9307 Sized_relobj::set_up.
9308 * object.h (Sized_relobj::adjust_shndx,
9309 Sized_relobj::initializ_input_to_output_maps,
9310 Sized_relobj::free_input_to_output_maps): Change visibilities to
9311 protected.
9312 (Sized_relobj::setup): Virtualize.
9313 (Sized_relobj::do_setup): New method declaration.
9314 (Sized_relobj::invalidate_section_offset,
9315 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9316 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9317 * options.cc (parse_int): New function.
9318 * options.h (parse_int): New declaration.
9319 (DEFINE_int): New macro.
9320 (stub_group_size): New option.
9321 * output.cc (Output_section::Output_section): Initialize memebers
9322 merge_section_map_, merge_section_by_properties_map_,
9323 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9324 (Output_section::add_input_section): Handled deferred code-fill
9325 generation and remove an old comment.
9326 (Output_section::add_relaxed_input_section): New method definition.
9327 (Output_section::add_merge_input_section): Use merge section by
9328 properties map to speed to search. Update merge section maps
9329 as appropriate.
9330 (Output_section::build_relaxation_map): New method definition.
9331 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9332 Same.
9333 (Output_section::relax_input_section): Renamed to
9334 Output_section::convert_input_sections_to_relaxed_sections and change
9335 interface to take a vector of pointers to relaxed sections.
9336 (Output_section::find_merge_section,
9337 Output_section::find_relaxed_input_section): New method definitions.
9338 (Output_section::is_input_address_mapped,
9339 Output_section::output_offset, Output_section::output_address):
9340 Use output section data maps to speed up searching.
9341 (Output_section::find_starting_output_address): Add comments.
9342 (Output_section::do_write,
9343 Output_section::write_to_postprocessing_buffer): Do code-fill
9344 generation as appropriate.
9345 (Output_section::get_input_sections): Invalidate relaxed input section
9346 map.
9347 (Output_section::restore_states): Adjust type of checkpoint .
9348 Invalidate relaxed input section map.
9349 * output.h (Output_merge_base): New class declaration.
9350 (Input_section_specifier): New class defintion.
9351 (class Output_relaxed_input_section) Change base class to
9352 Output_section_data_build.
9353 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9354 base class initializer.
9355 (Output_section::add_relaxed_input_section): New method declaration.
9356 (Output_section::Input_section): Change visibility to protected.
9357 (Output_section::Input_section::relobj,
9358 Output_section::Input_section::shndx): Handle relaxed input sections.
9359 Output_section::input_sections) Change visibility to protected. Also
9360 define overload to return a non-const pointer.
9361 (Output_section::Merge_section_properties): New class defintion.
9362 (Output_section::Merge_section_by_properties_map,
9363 Output_section::Output_section_data_by_input_section_map,
9364 Output_section::Relaxation_map): New types.
9365 (Output_section::relax_input_section): Rename method to
9366 Output_section::convert_input_sections_to_relaxed_sections and change
9367 interface to take a vector of relaxed section pointers.
9368 (Output_section::find_merge_section,
9369 Output_section::find_relaxed_input_section,
9370 Output_section::build_relaxation_map,
9371 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9372 New method declarations.
9373 (Output_section::merge_section_map_
9374 Output_section::merge_section_by_properties_map_,
9375 Output_section::relaxed_input_section_map_,
9376 Output_section::is_relaxed_input_section_map_valid_,
9377 Output_section::generate_code_fills_at_write_): New data members.
9378 * script-sections.cc
9379 (Output_section_element_input::set_section_addresses): Call
9380 current_data_size and addralign methods of relaxed input sections.
9381 (Orphan_output_section::set_section_addresses): Call current_data_size
9382 and addralign methods of relaxed input sections.
9383 * symtab.cc (Symbol_table::compute_final_value): Extract template
9384 from the body of Symbol_table::sized_finalize_symbol.
9385 (Symbol_table::sized_finalized_symbol): Call
9386 Symbol_table::compute_final_value.
9387 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9388 (Symbol_table::compute_final_value): New templated method declaration.
9389 * target.cc (Target::do_make_output_section): New method defintion.
9390 * target.h (Target::make_output_section): New method declaration.
9391 (Target::relax): Add more parameters for input objects, symbol table
9392 and layout. Adjust call to do_relax.
9393 (Target::do_make_output_section): New method declaration.
9394 (Target::do_relax): Add parameters for input objects, symbol table
9395 and layout.
9396
9397 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9398
9399 * pread.c: Include stdio.h.
9400
9401 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9402
9403 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9404 defined.
9405
9406 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9407
9408 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9409 Change read_shndx type to unsigned int.
9410 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9411 int.
9412 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9413 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9414 Change read_shndx type to unsigned int.
9415 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9416 int.
9417 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9418 * layout.cc (Layout::create_symtab_sections): Cast the result of
9419 local_symcount * symsize to off_t in the gold_assert.
9420
9421 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9422
9423 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9424 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9425 R_ARM_BASE_ABS.
9426 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9427 (Arm_relocate_functions::thm_abs5): New function.
9428 (Arm_relocate_functions::abs12): New function.
9429 (Arm_relocate_functions::abs16): New function.
9430 (Arm_relocate_functions::base_abs): New function.
9431 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9432 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9433 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9434 R_ARM_BASE_ABS.
9435 (Scan::global): Likewise.
9436 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9437 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9438 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9439 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9440 R_ARM_BASE_ABS.
9441
9442 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9443
9444 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9445 (Arm_relocate_functions::movt_prel): New function.
9446 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9447 (Arm_relocate_functions::thm_movt_prel): New function.
9448 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9449 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9450 (Scan::global, Relocate::relocate): Likewise.
9451 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9452
9453 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9454
9455 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9456 Incremental_checker.
9457 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9458 unsigned int.
9459 (class Incremental_inputs_header): New class.
9460 (Incremental_inputs_header_writer): Edit comment.
9461 (Incremental_inputs_entry): New class.
9462 (Incremental_inputs_entry_writer): Edit comment.
9463 (Sized_incremental_binary::do_find_incremental_inputs_section):
9464 Add *strtab_shndx parameter, fill it.
9465 (Sized_incremental_binary::do_check_inputs): New method.
9466 (Incremental_checker::can_incrementally_link_output_file): Use
9467 Sized_incremental_binary::check_inputs.
9468 (Incremental_inputs::report_command_line): Save command line in
9469 command_line_.
9470 * incremental.h:
9471 (Incremental_binary::find_incremental_inputs_section): New
9472 method.
9473 (Incremental_binary::do_find_incremental_inputs_section): Add
9474 strtab_shndx parameter.
9475 (Incremental_binary::do_check_inputs): New pure virtual method.
9476 (Sized_incremental_binary::do_check_inputs): Declare.
9477 (Incremental_checker::Incremental_checker): Add incremental_inputs
9478 parameter, use it to initialize incremental_inputs_.
9479 (Incremental_checker::incremental_inputs_): New field.
9480 (Incremental_checker::command_line): New method.
9481 (Incremental_checker::inputs): New method.
9482 (Incremental_checker::command_line_): New field.
9483
9484 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9485
9486 * incremental.cc: Include <cstdarg> and "target-select.h".
9487 (vexplain_no_incremental): New function.
9488 (explain_no_incremental): New function.
9489 (Incremental_binary::error): New method.
9490 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9491 method.
9492 (make_sized_incremental_binary): New function.
9493 (open_incremental_binary): New function.
9494 (can_incrementally_link_file): Add checks if output is ELF and has
9495 inputs section.
9496 * incremental.h: Include "elfcpp_file.h" and "output.h".
9497 (Incremental_binary): New class.
9498 (Sized_incremental_binary): New class.
9499 (open_incremental_binary): Declare.
9500 * object.cc (is_elf_object): Use
9501 elfcpp::Elf_recognizer::is_elf_file.
9502 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9503 * output.h (Output_file::filesize): New method.
9504
9505 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9506
9507 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9508 New function.
9509 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9510 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9511 function.
9512 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9513 function.
9514 (Arm_relocate_functions::movw_abs_nc): New function.
9515 (Arm_relocate_functions::movt_abs): New function.
9516 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9517 (Arm_relocate_functions::thm_movt_abs): New function.
9518 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9519 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9520 (Scan::global): Likewise.
9521 (Relocate::relocate): Likewise.
9522 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9523
9524 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9525
9526 * arm.cc (Arm_relocate_functions::got_prel) New function.
9527 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9528 (Relocate::relocate): Likewise.
9529 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9530
9531 2009-10-06 Ian Lance Taylor <iant@google.com>
9532
9533 * options.h (class General_options): Define
9534 split_stack_adjust_size parameter.
9535 * object.h (class Object): Add uses_split_stack_ and
9536 has_no_split_stack_ fields. Add uses_split_stack and
9537 has_no_split_stack accessor functions. Declare
9538 handle_split_stack_section.
9539 (class Reloc_symbol_changes): Define.
9540 (class Sized_relobj): Define Function_offsets. Declare
9541 split_stack_adjust, split_stack_adjust_reltype, and
9542 find_functions.
9543 * object.cc (Object::handle_split_stack_section): New function.
9544 (Sized_relobj::do_layout): Call handle_split_stack_section.
9545 * dynobj.cc (Sized_dynobj::do_layout): Call
9546 handle_split_stack_section.
9547 * reloc.cc (Sized_relobj::relocate_sections): Call
9548 split_stack_adjust for executable sections in split_stack
9549 objects. Pass reloc_map to relocate_section.
9550 (Sized_relobj::split_stack_adjust): New function.
9551 (Sized_relobj::split_stack_adjust_reltype): New function.
9552 (Sized_relobj::find_functions): New function.
9553 * target-reloc.h: Include "object.h".
9554 (relocate_section): Add reloc_symbol_changes parameter. Change
9555 all callers.
9556 * target.h (class Target): Add calls_non_split method. Declare
9557 do_calls_non_split virtual method. Declare match_view and
9558 set_view_to_nop.
9559 * target.cc: Include "elfcpp.h".
9560 (Target::do_calls_non_split): New function.
9561 (Target::match_view): New function.
9562 (Target::set_view_to_nop): New function.
9563 * gold.cc (queue_middle_tasks): Give an error if mixing
9564 split-stack and non-split-stack objects with -r.
9565 * i386.cc (Target_i386::relocate_section): Add
9566 reloc_symbol_changes parameter.
9567 (Target_i386::do_calls_non_split): New function.
9568 * x86_64.cc (Target_x86_64::relocate_section): Add
9569 reloc_symbol_changes parameter.
9570 (Target_x86_64::do_calls_non_split): New function.
9571 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9572 parameter.
9573 * powerpc.cc (Target_powerpc::relocate_section): Add
9574 reloc_symbol_changes parameter.
9575 * sparc.cc (Target_sparc::relocate_section): Add
9576 reloc_symbol_changes parameter.
9577 * configure.ac: Call AM_CONDITIONAL for the default target.
9578 * configure: Rebuild.
9579 * testsuite/Makefile.am (TEST_AS): New variable.
9580 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9581 (check_DATA): Add split_i386 and split_x86_64 files.
9582 (SPLIT_DEFSYMS): Define.
9583 (split_i386_[1234n].o): New targets.
9584 (split_i386_[124]): New targets.
9585 (split_i386_[1234r].stdout): New targets.
9586 (split_x86_64_[1234n].o): New targets.
9587 (split_x86_64_[124]): New targets.
9588 (split_x86_64_[1234r].stdout): New targets.
9589 (MOSTLYCLEANFILES): Add new executables.
9590 * testsuite/split_i386.sh: New file.
9591 * testsuite/split_x86_64.sh: New file.
9592 * testsuite/split_i386_1.s: New file.
9593 * testsuite/split_i386_2.s: New file.
9594 * testsuite/split_i386_3.s: New file.
9595 * testsuite/split_i386_4.s: New file.
9596 * testsuite/split_i386_n.s: New file.
9597 * testsuite/split_x86_64_1.s: New file.
9598 * testsuite/split_x86_64_2.s: New file.
9599 * testsuite/split_x86_64_3.s: New file.
9600 * testsuite/split_x86_64_4.s: New file.
9601 * testsuite/split_x86_64_n.s: New file.
9602 * testsuite/testfile.cc (Target_test): Update relocation_section
9603 function.
9604 * testsuite/Makefile.in: Rebuild.
9605
9606 2009-10-06 Ian Lance Taylor <iant@google.com>
9607
9608 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9609 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9610 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9611 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9612 the address on ldo_addrs_.
9613 (Target_i386::Relocate::fix_up_ldo): New function.
9614
9615 2009-10-06 Rafael Espindola <espindola@google.com>
9616
9617 * plugin.cc (add_input_library): New.
9618 (Plugin::load): Add add_input_library to tv.
9619 (Plugin_manager::add_input_file): Add the is_lib argument.
9620 (add_input_file): Update call to Plugin_manager::add_input_file.
9621 (add_input_library): New.
9622 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9623
9624 2009-09-30 Doug Kwan <dougkwan@google.com>
9625
9626 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9627 symbol and call Symbol::may_need_copy_reloc to determine if
9628 a copy reloc is needed.
9629 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9630 nocopyreloc is given in command line.
9631 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9632 given in command line.
9633 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9634 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9635 of the removed Target_i386::may_need_copy_reloc.
9636 * options.h (copyreloc): New option with default value false.
9637 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9638 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9639 instead of the removed Target_powerpc::may_need_copy_reloc.
9640 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9641 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9642 instead of the removed Target_sparc::may_need_copy_reloc.
9643 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9644 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9645 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9646 instead of the removed Target_x86_64::may_need_copy_reloc.
9647
9648 2009-09-30 Ian Lance Taylor <iant@google.com>
9649
9650 * object.h (class Object): Remove target_ field, and target,
9651 sized_target, and set_target methods.
9652 (Object::sized_target): Remove.
9653 (class Sized_relobj): Update declarations. Remove sized_target.
9654 * object.cc (Sized_relobj::setup): Remove target parameter.
9655 Change all callers.
9656 (Input_objects::add_object): Don't do anything with the target.
9657 (make_elf_sized_object): Add punconfigured parameter. Change all
9658 callers. Set or test parameter target.
9659 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9660 Change all callers.
9661 * parameters.cc (Parameters::set_target): Change parameter type to
9662 be non-const.
9663 (Parameters::default_target): Remove.
9664 (set_parameters_target): Change parameter type to be non-const.
9665 (parameters_force_valid_target): New function.
9666 (parameters_clear_target): New function.
9667 * parameters.h (class Parameters): Update declarations. Remove
9668 default_target method. Add sized_target and clear_target
9669 methods. Change target_ to be non-const.
9670 (set_parameters_target): Update declaration.
9671 (parameters_force_valid_target): Declare.
9672 (parameters_clear_target): Declare.
9673 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9674 as NULL if we aren't searching.
9675 (Add_symbols::run): Don't check for compatible target.
9676 * fileread.cc (Input_file::open_binary): Call
9677 parameters_force_valid_target.
9678 * gold.cc (queue_middle_tasks): Likewise.
9679 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9680 set_target on object.
9681 * dynobj.h (class Sized_dynobj): Update declarations.
9682 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9683 make_elf_object returns NULL.
9684 (Archive::include_member): Don't check whether object target is
9685 compatible.
9686 * output.cc (Output_section::add_input_section): Get target from
9687 parameters.
9688 (Output_section::relax_input_section): Likewise.
9689 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9690 parameters.
9691 (Sized_relobj::do_scan_relocs): Likewise.
9692 (Sized_relobj::relocate_sections): Likewise.
9693 * resolve.cc (Symbol_table::resolve): Likewise.
9694 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9695 parameter. Change all callers.
9696 (Symbol_table::add_from_object): Get target from parameters.
9697 (Symbol_table::add_from_relobj): Don't check object target.
9698 (Symbol_table::add_from_dynobj): Likewise.
9699 (Symbol_table::define_special_symbol): Get target from
9700 parameters.
9701 * symtab.h (class Symbol_table): Update declaration.
9702 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9703 parameter. Change all callers. Clear parameter target.
9704 (Binary_test): Test target here.
9705 * testsuite/object_unittest.cc (gold_testsuite): Remove
9706 target_test_pointer parameter. Change all callers.
9707 (Object_test): Test target here.
9708
9709 2009-09-26 Ian Lance Taylor <iant@google.com>
9710
9711 * testsuite/initpri1.c: Don't try to use constructor priorities if
9712 compiling with gcc before 4.3.
9713
9714 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9715
9716 * testsuite/retain_symbols_file_test.sh (check_present): Change
9717 output file name to retain_symbols_file_test.stdout.
9718 (check_absent): Likewise.
9719
9720 2009-09-18 Craig Silverstein <csilvers@google.com>
9721
9722 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9723 * options.cc: Include <cerrno> and <fstream>.
9724 (General_options::finalize): Parse -retain-symbols-file tag.
9725 * options.h: New flag.
9726 (General_options): New method should_retain_symbol, new
9727 variable symbols_to_retain.
9728 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9729 should_retain_symbol map.
9730 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9731 * testsuite/Makefile.in: Regenerate.
9732 * testsuite/retain_symbols_file_test.sh: New file.
9733
9734 2009-09-18 Nick Clifton <nickc@redhat.com>
9735
9736 * po/es.po: Updated Spanish translation.
9737
9738 2009-09-17 Doug Kwan <dougkwan@google.com>
9739
9740 * debug.h (DEBUG_RELAXATION): New constant.
9741 (DEBUG_ALL): Add DEBUG_RELAXATION.
9742 (debug_string_to_enum): Add relaxation debug option.
9743 * layout.cc
9744 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9745 Layout::Relaxation_debug_check::read_sections,
9746 Layout::Relaxation_debug_check::read_sections): New method definitions.
9747 (Layout::Layout): Initialize data members
9748 record_output_section_data_from_scrips_,
9749 script_output_section_data_list_ and relaxation_debug_check_.
9750 (Layout::save_segments, Layout::restore_segments,
9751 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9752 Layout::relaxation_loop_body): New method definitions.
9753 (Layout::finalize): Support relaxation. Move section layout code to
9754 Layout::relaxation_loop_body.
9755 (Layout::set_asection_address_from_script): Move code for orphan
9756 section placement out.
9757 (Layout::place_orphan_sections_in_script): New method definition.
9758 * layout.h (Output_segment_headers, Output_file_header):
9759 New forward class declarations.
9760 (Layout::~Layout): Define.
9761 (Layout::new_output_section_data_from_script): New method definition.
9762 (Layout::place_orphan_sections_in_script): New method declaration.
9763 (Layout::Segment_states): New type declaration.
9764 (Layout::save_segments, Layout::restore_segments,
9765 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9766 Layout::relaxation_loop_body): New method declarations.
9767 (Layout::Output_section_data_list): New type declaration.
9768 (Layout::Relaxation_debug_check): New class definition.
9769 (Layout::record_output_section_data_from_script_,
9770 Layout::script_output_section_data_list_, Layout::segment_states_,
9771 Layout::relaxation_debug_check_): New data members.
9772 * output.cc: (Output_section_headers::do_size): New method definition.
9773 (Output_section_headers::Output_section_headers): Move size
9774 computation to Output_section_headers::do_size.
9775 (Output_segment_headers::do_size): New method definition.
9776 (Output_file_header::Output_file_header): Move size computation to
9777 Output_file_header::do_size and call it.
9778 (Output_file_header::do_size): New method definition.
9779 (Output_data_group::Output_data_group): Adjust call to
9780 Output_section_data.
9781 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9782 (Output_symtab_xindex::do_write): Add array bound check.
9783 (Output_section::Input_section::print_to_mapfile): Handle
9784 RELAXED_INPUT_SECTION_CODE.
9785 (Output_section::Output_section): Initialize data member checkpoint_.
9786 (Output_section::~Output_section): Delete checkpoint object pointed
9787 by checkpoint_.
9788 (Output_section::add_input_section): Always add an Input_section if
9789 relaxing.
9790 (Output_section::add_merge_input_section): Add assert.
9791 (Output_section::relax_input_section): New method definition.
9792 (Output_section::set_final_data_size): Set load address to zero for
9793 an unallocated section.
9794 (Output_section::do_address_and_file_offset_have_reset_values):
9795 New method definition.
9796 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9797 Handle relaxed input section.
9798 (Output_section::sort_attached_input_sections): Checkpoint input
9799 section list lazily.
9800 (Output_section::get_input_sections): Change type of input_sections to
9801 list of Simple_input_section pointers. Checkpoint input section list
9802 lazily. Also handle relaxed input sections.
9803 (Output_section::add_input_section_for_script): Take a reference to
9804 a Simple_input_section object instead of Relobj pointer and section
9805 index as parameter. Handle relaxed input sections.
9806 (Output_section::save_states, Output_section::restore_states): New
9807 method definitions.
9808 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9809 (Output_data::is_data_size_fixed): New method definition.
9810 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9811 if it is fixed.
9812 (Output_data::address_and_file_offset_have_reset_values): New method
9813 definition.
9814 (Output_data::do_address_and_file_offset_have_reset_values): New method
9815 definition.
9816 (Output_data::set_data_size): Check that data size is not fixed.
9817 (Output_data::fix_data_size): New method definition.
9818 (Output_data::is_data_size_fixed_): New data member.
9819 (Output_section_headers::set_final_data_size): New method definition.
9820 (Output_section_headers::do_size): New method declaration.
9821 (Output_segment_headers::set_final_data_size): New method definition.
9822 (Output_segment_headers::do_size): New method declaration.
9823 (Output_file_header::set_final_data_size)::New method definition.
9824 (Output_file_header::do_size)::New method declaration.
9825 (Output_section_data::Output_section_data): Add new parameter
9826 is_data_size_fixed and use it to fix data size.
9827 (Output_data_const::Output_data_const): Adjust call to base class
9828 constructor and fix data size.
9829 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9830 base class constructor and fix data size.
9831 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9832 base class constructor and fix data size.
9833 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9834 class constructor and fix data size.
9835 (Output_data_group::set_final_data_size): New method definition.
9836 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9837 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9838 class constructor and fix data size.
9839 (Output_relaxed_input_section): New class definition.
9840 (Output_section::Simple_input_section): New class definition.
9841 (Output_section::get_input_sections): Adjust parameter list.
9842 (Output_section::add_input_section_for_script): Same.
9843 (Output_section::save_states, Output_section::restore_states,
9844 Output_section::do_address_and_file_offset_have_reset_values,
9845 (Output_section::Input_section::Input_section): Handle
9846 RELAXED_INPUT_SECTION_CODE. Add new overload for
9847 Output_relaxed_input_section.
9848 (Output_section::Input_section::is_input_section,
9849 Output_section::Input_section::set_output_section): Handle relaxed
9850 input section.
9851 (Output_section::Input_section::is_relaxed_input_section,
9852 Output_section::Input_section::output_section_data,
9853 Output_section::Input_section::relaxed_input_section): New method
9854 definitions.
9855 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9856 value.
9857 (Output_section::Input_section::u1_): Update comments.
9858 (Output_section::Input_section::u2_): Add new union member poris.
9859 (Output_section::Checkpoint_output_section): New classs definition.
9860 (Output_section::relax_input_section): New method declaration.
9861 (Output_section::checkpoint_): New data member.
9862 (Output_segment): Update comments.
9863 (Output_segment::Output_segment): Un-privatize copy constructor.
9864 (Output_segment::operator=): Un-privatize.
9865 * script-sections.cc (Output_section_element::Input_section_list):
9866 Change element type to Output_section::Simple_input_section.
9867 (Output_section_element_dot_assignment::set_section_addresses):
9868 Register output section data for relaxation clean up.
9869 (Output_data_exression::Output_data_expression): Adjust call to base
9870 constructor to fix data size.
9871 (Output_section_element_data::set_section_addresses): Register
9872 Output_data_expression object for relaxation clean up.
9873 (struct Input_section_info): Replace Relobj pointer and section index
9874 pair with Output_section::Simple_input_section and Convert struct to a
9875 class.
9876 (Input_section_sorter::operator()): Adjust access to
9877 Input_section_info data member to use accessors.
9878 (Output_section_element_input::set_section_addresses): Use layout
9879 parameter. Adjust code to use Output_section::Simple_input_section
9880 and Input_secction_info classes. Register filler for relaxation
9881 clean up.
9882 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9883 and section index pair with Output_section::Simple_input_section
9884 class. Adjust code accordingly.
9885 (Phdrs_element::release_segment): New method definition.
9886 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9887 segment list.
9888 (Script_sections::release_segments): New method definition.
9889 * gold/script-sections.h (Script_sections::release_segments): New
9890 method declaration.
9891 * gold/target.h (Target::may_relax, Target::relax,
9892 Target::do_may_relax, Target::do_relax): New method definitions.
9893
9894 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9895
9896 * arm.cc (has_signed_unsigned_overflow): New function.
9897 (Arm_relocate_functions::abs8): New function.
9898 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9899 (Target_arm::Scan::global): Likewise.
9900 (Target_arm::relocate::relocate): Likewise.
9901 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9902 Likewise.
9903
9904 2009-09-16 Cary Coutant <ccoutant@google.com>
9905
9906 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9907 * testsuite/Makefile.in: Regenerate.
9908
9909 2009-09-11 Nick Clifton <nickc@redhat.com>
9910
9911 * po/gold.pot: Updated by the Translation project.
9912
9913 2009-09-08 Cary Coutant <ccoutant@google.com>
9914
9915 * output.cc (Output_file::open): Add execute permission to empty file.
9916 * testsuite/Makefile.am (permission_test): New test.
9917 * testsuite/Makefile.in: Regenerate.
9918
9919 2009-09-02 Ian Lance Taylor <iant@google.com>
9920
9921 * output.cc (Output_file::resize): Call map_no_anonymous rather
9922 than map.
9923
9924 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9925
9926 * gold.cc: Include "incremental.h".
9927 (queue_initial_tasks): Call Incremental_checker methods.
9928 * incremental.cc: Include "output.h".
9929 (Incremental_checker::can_incrementally_link_output_file): New
9930 method.
9931 * incremental.h (Incremental_checker): New class.
9932
9933 * output.cc (Output_file::open_for_modification): New method.
9934 (Output_file::map_anonymous): Changed return type to bool. Record
9935 map in base_ field.
9936 (Output_file::map_no_anonymous): New method, broken out of map.
9937 (Output_file::map): Use map_no_anonymous and map_anonymous.
9938 * output.h (class Output_file): Update declarations.
9939
9940 2009-08-24 Cary Coutant <ccoutant@google.com>
9941
9942 * options.h (Command_line::Pre_options): New class.
9943 (Command_line::pre_options): New member.
9944 * options.cc (gold::options::ready_to_register): New variable.
9945 (One_option::register_option): Do nothing if not registering options.
9946 Assert if same short option registered twice.
9947 (General_options::General_options): Turn off option registration when
9948 done constructing.
9949 (Command_line::Pre_options::Pre_options): New constructor.
9950
9951 2009-08-24 Cary Coutant <ccoutant@google.com>
9952
9953 * options.h (General_options::no_keep_memory): Remove incorrect
9954 short option.
9955
9956 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9957
9958 * Makefile.am (am__skiplex, am__skipyacc): New.
9959 * Makefile.in: Regenerate.
9960
9961 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9962
9963 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9964 (INCLUDES): ... this.
9965 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9966 (AM_CPPFLAGS): Renamed from ...
9967 (INCLUDE): ... this.
9968 * Makefile.in, testsuite/Makefile.in: Regenerate.
9969
9970 * Makefile.in: Regenerate.
9971 * aclocal.m4: Likewise.
9972 * config.in: Likewise.
9973 * configure: Likewise.
9974 * testsuite/Makefile.in: Likewise.
9975
9976 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9977 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9978 * Makefile.in: Regenerate.
9979 * testsuite/Makefile.in: Regenerate.
9980
9981 2009-08-19 Cary Coutant <ccoutant@google.com>
9982
9983 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9984 symbols in shared libraries overridden by hidden or internal symbols
9985 in the main program.
9986
9987 2009-08-19 Chris Demetriou <cgd@google.com>
9988
9989 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9990 checking source file names in error messages.
9991
9992 2009-08-18 Doug Kwan <dougkwan@google.com>
9993
9994 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9995 an elcpp::Ehdr as parameter. Adjust call to set_target.
9996 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9997 an elfcpp::Ehdr as parameter.
9998 * object.cc (Object::set_target): Remove the version that looks up
9999 a target and sets it.
10000 (Sized_relobj::setup): Take a Target object instead of
10001 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10002 (make_elf_sized_object): Find target and ask target to
10003 make an ELF object.
10004 * object.h: (Object::set_target): Remove the version that looks up
10005 a target and sets it.
10006 (Sized_relobj::setup): Take a Target object instead of
10007 an elfcpp:Ehdr as parameter.
10008 * target.cc: Include dynobj.h.
10009 (Target::do_make_elf_object_implementation): New.
10010 (Target::do_make_elf_object): New.
10011 * target.h (Target::make_elf_object): New template declaration.
10012 (Target::do_make_elf_object): New method declarations.
10013 (Target::do_make_elf_object_implementation): New template declaration.
10014
10015 2009-08-14 Ian Lance Taylor <iant@google.com>
10016
10017 * gold.h (FUNCTION_NAME): Define.
10018 (gold_unreachable): Use FUNCTION_NAME.
10019
10020 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10021
10022 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10023 symbol in the --keep-unique list is not found.
10024
10025 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10026
10027 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10028 been maked as --keep-unique.
10029 (Icf::unfold_section): New function.
10030 * icf.h (Icf::unfold_section): New function.
10031 * options.h (General_options::keep_unique): New option.
10032 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10033 * testsuite/Makefile.in: Regenerate.
10034 * testsuite/icf_keep_unique_test.sh: New file.
10035 * testsuite/icf_keep_unique_test.cc: New file.
10036
10037 2009-08-12 Cary Coutant <ccoutant@google.com>
10038
10039 PR 10471
10040 * resolve.cc (Symbol_table::resolve): Check for references from
10041 dynamic objects to hidden and internal symbols.
10042 * testsuite/Makefile.am (hidden_test.sh): New test.
10043 * testsuite/Makefile.in: Regenerate.
10044 * testsuite/hidden_test.sh: New script.
10045 * testsuite/hidden_test_1.c: New test source.
10046 * testsuite/hidden_test_main.c: New test source.
10047
10048 2009-08-11 Doug Kwan <dougkwan@google.com>
10049
10050 * arm.cc: Update comments.
10051 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10052 segment to locate the .ARM.exidx section if present.
10053
10054 2009-08-09 Doug Kwan <dougkwan@google.com>
10055
10056 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10057 patch.
10058
10059 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10060 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10061 compiler warnings.
10062
10063 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10064
10065 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10066 valid tls_segment only for non-debug-section relocations.
10067 * testsuite/Makefile.am: Add gc_tls_test.
10068 * testsuite/Makefile.in: Regenerate.
10069 * testsuite/gc_tls_test.cc: New file.
10070 * testsuite/gc_tls_test.sh: New file.
10071
10072 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10073
10074 * icf.cc: New file.
10075 * icf.h: New file.
10076 * Makefile.am (CCFILES): Add icf.cc.
10077 (HFILES): Add icf.h
10078 * Makefile.in: Regenerate.
10079 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10080 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10081 section, symbol and addend information for the relocs.
10082 * gold.cc (queue_middle_tasks): Call identical code folding.
10083 * gold.h: Add defines for multimap.
10084 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10085 to the call of finalize_local_symbols.
10086 * main.cc (main): Create object of class Icf.
10087 * object.cc (Sized_relobj::do_layout): Allow this function to be
10088 called twice during icf.
10089 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10090 to sections marked as identical by icf.
10091 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10092 when available.
10093 (Sized_relobj::do_section_entsize): New function.
10094 * object.h (Object::section_entsize): New function.
10095 (Object::do_section_entsize): New pure virtual function.
10096 (Relobj::finalize_local_symbols): Add new parameter.
10097 (Relobj::do_section_entsize): New function.
10098 * options.h (General_options::icf): New option.
10099 (General_options::icf_iterations): New option.
10100 (General_options::print_icf_sections): New option.
10101 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10102 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10103 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10104 icf.
10105 * symtab.cc (Symbol_table::is_section_folded): New function.
10106 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10107 to sections marked as identical by icf.
10108 * symtab.h (Symbol_table::set_icf): New function.
10109 (Symbol_table::icf): New function.
10110 (Symbol_table::is_section_folded): New function.
10111 (Symbol_table::icf_): New data member.
10112 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10113 * testsuite/Makefile.am: Add commands to build icf_test.
10114 * testsuite/Makefile.in: Regenerate.
10115 * testsuite/icf_test.sh: New file.
10116 * testsuite/icf_test.cc: New file.
10117
10118 2009-07-24 Chris Demetriou <cgd@google.com>
10119
10120 * layout.cc (is_compressible_debug_section): Fix incorrect
10121 comment about compressed section names.
10122
10123 2009-07-20 Ian Lance Taylor <ian@airs.com>
10124
10125 PR 10419
10126 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10127
10128 2009-07-16 Ian Lance Taylor <iant@google.com>
10129
10130 PR 10400
10131 * layout.h: #include <map>.
10132 (class Kept_section): Change from struct to class. Add accessors
10133 and setters. Add section size to Comdat_group mapping. Change
10134 Comdat_group to std::map. Add is_comdat_ field. Add
10135 linkonce_size field in union.
10136 (class Layout): Update declaration of find_or_add_kept_section.
10137 Don't declare find_kept_object.
10138 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10139 parameter. Add object, shndx, is_comdat, and is_group_name
10140 parameters. Change all callers. Adjust for new Kept_section.
10141 (Layout::find_kept_object): Remove.
10142 * object.cc (Sized_relobj::include_section_group): Update use of
10143 Kept_section. Rename secnum to shndx. Only record
10144 Kept_comdat_section if sections are the same size.
10145 (Sized_relobj::include_linkonce_section): Update use of
10146 Kept_section. Only record Kept_comdat_section if sections are the
10147 same size. Set size of linkonce section.
10148 (Sized_relobj::map_to_kept_section): Update call to
10149 get_kept_comdat_section.
10150 * object.h (class Sized_relobj): Rename fields in
10151 Kept_comdat_section to drop trailing underscores; change object
10152 field to Relobj*. Change Kept_comdat_section_table to store
10153 struct rather than pointer.
10154 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10155 Add kept_object and kept_shndx parameters. Change all callers.
10156 (Sized_relobj::get_kept_comdat_section): Change return type to
10157 bool. Add kept_object and kept_shndx parameters. Change all
10158 callers.
10159 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10160 Layout::find_or_add_kept_section.
10161
10162 2009-07-09 Ian Lance Taylor <iant@google.com>
10163
10164 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10165 Reserve space in the hash table.
10166
10167 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10168
10169 * fileread.cc (File_read::get_mtime): New method.
10170 * fileread.h (Timespec): New structure.
10171 (File_read::get_mtime): New method.
10172 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10173 Renamed from timestamp_nsec.
10174 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10175 Elf_Xword.
10176 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10177 timestamp_nsec.
10178 (Incremental_inputs::report_archive): Save mtime; style fix.
10179 (Incremental_inputs::report_obejct): Save mtime; style fix.
10180 (Incremental_inputs::report_script): Save mtime; style fix.
10181 (Incremental_inputs::finalize_inputs): Style fix.
10182 (Incremental_inputs::finalize): Style fix.
10183 (Incremental_inputs::create_input_section_data): Store inputs
10184 mtime.
10185 * incremental.h (Incremental_inputs::report_script): Add mtime
10186 argument.
10187 (Incremental_inputs::Input_info::Input_info): Intialize only one
10188 union member.
10189 (Incremental_inputs::Input_info::archive): Move to nameless
10190 union.
10191 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10192 (Incremental_inputs::Input_info::script): Move to nameless union.
10193 (Incremental_inputs::mtime): New field.
10194 * script.cc (read_input_script): Pass file mtime to
10195 Incremental_input.
10196 * script.h (Script_info::inputs): Style fix.
10197
10198 2009-07-01 Ian Lance Taylor <ian@airs.com>
10199
10200 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10201 instead of 32.
10202
10203 2009-06-24 Ian Lance Taylor <iant@google.com>
10204
10205 PR 10156
10206 * layout.cc (Layout::choose_output_section): If we find an
10207 existing section, update the flags.
10208 (Layout::create_notes): New function, broken out of
10209 Layout::finalize.
10210 (Layout::finalize): Don't create note sections.
10211 (Layout::create_note): Don't crash if linker script discards
10212 section.
10213 (Layout::create_gold_note): Likewise.
10214 (Layout::create_build_id): Likewise. Don't set
10215 after_input_sections on the section.
10216 (Layout::create_executable_stack_info): Remove target parameter.
10217 Change caller.
10218 * layout.h (class Layout): Declare create_notes. Update
10219 declaration of create_executable_stack_info.
10220 * gold.cc (queue_middle_tasks): Call create_notes.
10221 * output.cc (Output_section::update_flags_for_input_section): Move
10222 here from output.h. If SHF_ALLOC flag is newly set, mark address
10223 invalid.
10224 * output.h (Output_data::mark_address_invalid): New function.
10225 (class Output_section): Only declare, not define,
10226 update_flags_for_input_section. Remove set_flags.
10227
10228 2009-06-24 Ian Lance Taylor <iant@google.com>
10229
10230 * script-sections.cc (Output_section_definition::
10231 set_section_addresses): Rename shadowing local load_address to
10232 laddr.
10233
10234 2009-06-24 Ian Lance Taylor <iant@google.com>
10235
10236 PR 10244
10237 * reloc.cc (relocate_sections): Skip empty relocation sections.
10238
10239 2009-06-23 Ian Lance Taylor <iant@google.com>
10240
10241 PR 10156
10242 * layout.cc (Layout::create_note): Use choose_output_section
10243 rather than make_output_section.
10244
10245 2009-06-23 Ian Lance Taylor <iant@google.com>
10246
10247 PR 10237
10248 * options.cc (General_options::parse_V): Set printed_version_.
10249 (General_options::General_options): Initialize printed_version_.
10250 * options.h (class General_options): Add printed_version_ field.
10251 * gold.cc (queue_initial_tasks): If there are no input files,
10252 don't give a fatal error if we printed the version information.
10253 (queue_middle_tasks): If using -r with a shared object, give a
10254 fatal error rather than an ordinary error.
10255
10256 2009-06-23 Ian Lance Taylor <iant@google.com>
10257
10258 PR 10219
10259 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10260 (Layout::make_output_section): Set have_stabstr_section_ if we see
10261 a .stab*str section.
10262 (Layout::finalize): Call link_stabs_sections.
10263 (Layout::link_stabs_sections): New file.
10264 * layout.h (class Layout): Add have_stabstr_section_ field.
10265 Declare link_stabs_sections.
10266
10267 2009-06-23 Doug Kwan <dougkwan@google.com>
10268
10269 * Makefile.am (libgold_a_LIBADD): New.
10270 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10271 * Makefile.in: Regenerate.
10272 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10273 * configure: Regenerate.
10274 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10275 * fileread.cc: Include sys/state.h
10276 * gold.h: Declare memmem and strndup if found missing.
10277 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10278
10279 2009-06-23 Ian Lance Taylor <iant@google.com>
10280
10281 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10282 * configure: Rebuild.
10283
10284 2009-06-23 Ian Lance Taylor <iant@google.com>
10285
10286 PR 10147
10287 * object.cc (Object::section_contents): Don't try to get a view if
10288 the section has length zero.
10289 (Object::handle_gnu_warning_section): If the section is empty, use
10290 the name of the section as the warning.
10291
10292 2009-06-23 Ian Lance Taylor <iant@google.com>
10293
10294 PR 10133
10295 * stringpool.h (class Stringpool_template): Add optimize_ field.
10296 (Stringpool_template::set_optimize): New function.
10297 * stringpool.cc (Stringpool_template::Stringpool_template):
10298 Initialize optimize_ field.
10299 (Stringpool_template::set_string_offsets): Test local optimize
10300 fild rather than parameter.
10301 * layout.cc (Layout::Layout): Call set_optimize on the section
10302 name stringpool.
10303
10304 2009-06-22 Ian Lance Taylor <iant@google.com>
10305
10306 PR 10030
10307 * yyscript.y: Parse TARGET.
10308 * script.cc (script_set_target): New function.
10309 * script-c.h (script_set_target): Declare.
10310 * options.cc (General_options::string_to_object_format): Rename
10311 from string_to_object_format in anonymous namespace. Change
10312 callers.
10313 * options.h (class General_options): Declare
10314 string_to_object_format.
10315
10316 2009-06-22 Ian Lance Taylor <iant@google.com>
10317
10318 * script-sections.cc (Script_sections::create_segments): Don't put
10319 program headers in a PT_LOAD segment if -n or -N.
10320
10321 2009-06-22 Ian Lance Taylor <iant@google.com>
10322
10323 PR 10141
10324 * options.h (class General_options): Add -z lazy and -z now. Sort
10325 -z options into alphabetical order.
10326 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10327
10328 2009-06-21 Ian Lance Taylor <iant@google.com>
10329
10330 * layout.cc (Layout::make_output_section): Call
10331 Target::new_output_section.
10332 (Layout::attach_allocated_section_to_segment): Put large section
10333 sections in a separate load segment with the large segment flag
10334 set.
10335 (Layout::segment_precedes): Sort large data segments after other
10336 load segments.
10337 (align_file_offset): New static function.
10338 (Layout::set_segment_offsets): Use align_file_offset.
10339 * output.h (class Output_section): Add is_small_section_ and
10340 is_large_section_ fields.
10341 (Output_section::is_small_section): New function.
10342 (Output_section::set_is_small_section): New function.
10343 (Output_section::is_large_section): New function.
10344 (Output_section::set_is_large_section): New function.
10345 (Output_section::is_large_data_section): New function.
10346 (class Output_segment): Add is_large_data_segment_ field.
10347 (Output_segment::is_large_data_segment): New function.
10348 (Output_segment::set_is_large_data_segment): New function.
10349 * output.cc (Output_section::Output_section): Initialize new
10350 fields.
10351 (Output_segment::Output_segment): Likewise.
10352 (Output_segment::add_output_section): Add assertion that large
10353 data sections always go in large data segments. Force small data
10354 sections to the end of the list of data sections. Force small BSS
10355 sections to the start of the list of BSS sections. For large BSS
10356 sections to the end of the list of BSS sections.
10357 * symtab.h (class Symbol): Declare is_common_shndx.
10358 (Symbol::is_defined): Check Symbol::is_common_shndx.
10359 (Symbol::is_common): Likewise.
10360 (class Symbol_table): Define enum Commons_section_type. Update
10361 declarations. Add small_commons_ and large_commons_ fields.
10362 * symtab.cc (Symbol::is_common_shndx): New function.
10363 (Symbol_table::Symbol_table): Initialize new fields.
10364 (Symbol_table::add_from_object): Put small and large common
10365 symbols in the right list.
10366 (Symbol_table::sized_finalized_symbol): Check
10367 Symbol::is_common_shndx.
10368 (Symbol_table::sized_write_globals): Likewise.
10369 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10370 common symbol lists. Don't call do_allocate_commons_list if the
10371 list is empty.
10372 (Symbol_table::do_allocate_commons_list): Remove is_tls
10373 parameter. Add comons_section_type parameter. Change all
10374 callers. Handle small and large common symbols.
10375 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10376 Symbol::is_common_shndx.
10377 * resolve.cc (symbol_to_bits): Likewise.
10378 * target.h (Target::small_common_shndx): New function.
10379 (Target::small_common_section_flags): New function.
10380 (Target::large_common_shndx): New function.
10381 (Target::large_common_section_flags): New function.
10382 (Target::new_output_section): New function.
10383 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10384 small_common_section_flags, and large_common_section_flags
10385 fields.
10386 (Target::do_new_output_section): New virtual function.
10387 * arm.cc (Target_arm::arm_info): Initialize new fields.
10388 * i386.cc (Target_i386::i386_info): Likewise.
10389 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10390 Likewise.
10391 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10392 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10393 (Target_x86_64::do_new_output_section): New function.
10394 * configure.ac: Define conditional MCMODEL_MEDIUM.
10395 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10396 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10397 (large_LDFLAGS): Define.
10398 * testsuite/large.c: New file.
10399 * testsuite/testfile.cc (Target_test::test_target_info):
10400 Initialize new fields.
10401 * configure, testsuite/Makefile.in: Rebuild.
10402
10403 2009-06-05 Doug Kwan <dougkwan@google.com>
10404
10405 * Makefile.am (CCFILES): Add target.cc.
10406 * Makefile.in: Regenerate.
10407 * i386.cc (class Target_i386): Define new virtual method to
10408 override do_is_local_label_name in parent.
10409 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10410 local symbols if --discard-locals or -X is given.
10411 * options.h (class General_options): Declare new options
10412 '--discard-locals' and '-X' for discarding locals.
10413 * target.h (class Target): Define new methods is_local_label_name.
10414 Declare new virtual method do_is_local_label_name.
10415 * target.cc: New file.
10416 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10417 (check_SCRIPTS): Add discard_locals_test.sh.
10418 (check_DATA): Add discard_local_tests.syms.
10419 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10420 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10421 * testsuite/Makefile.in: Regenerate.
10422 * testsuite/discard_locals_test.c: New file.
10423 * testsuite/discard_locals_test.sh: Same.
10424
10425 2009-06-05 Doug Kwan <dougkwan@google.com>
10426
10427 * object.cc (Sized_relobj::Sized_relobj): Initialize
10428 discarded_eh_frame_shndx_ to -1U.
10429 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10430 section.
10431 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10432 a discarded .eh_frame section.
10433 (Sized_relobj::do_finalize_local_symbols): Ditto.
10434 * object.h (class Sized_relobj): Declare new member
10435 discarded_eh_frame_shndx_.
10436 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10437 (local_labels_test.o, local_labels_test): New rules.
10438 * testsuite/Makefile.in: Regenerate.
10439
10440 2009-06-04 Doug Kwan <dougkwan@google.com>
10441
10442 * layout.cc (Layout::section_name_mapping): Add mapping for
10443 special ARM sections.
10444
10445 2009-06-03 Doug Kwan <dougkwan@google.com>
10446
10447 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10448 (utils::has_overflow): Same.
10449
10450 2009-06-03 Ian Lance Taylor <iant@google.com>
10451
10452 * layout.cc (Layout::section_name_mapping): New array, replacing
10453 Layout::linkonce_mapping.
10454 (Layout::section_name_mapping_count): New variable, replacing
10455 Layout::linkonce_mapping_count.
10456 (Layout::linkonce_output_name): Remove.
10457 (Layout::output_section_name): Rewrite.
10458 * layout.h (class Layout): Rename Linkonce_mapping to
10459 Section_name_mapping, linkonce_mapping to section_name_mapping,
10460 linkonce_mapping_count to section_name_mapping_count. Don't
10461 declare linkonce_output_name.
10462
10463 2009-06-03 Doug Kwan <dougkwan@google.com>
10464
10465 * gold/arm.cc (namespace utils): New.
10466 (Target_arm::reloc_is_non_pic): Define new method.
10467 (class Arm_relocate_functions): New.
10468 (Target_arm::Relocate::relocate): Handle relocation types used by
10469 Android.
10470
10471 2009-06-03 Ian Lance Taylor <iant@google.com>
10472
10473 * arm.cc (Target_arm::scan::global): Use || instead of |.
10474
10475 2009-06-02 Doug Kwan <dougkwan@google.com>
10476
10477 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10478 issued_non_pic_error_.
10479 (class Target_arm::Scan): Declare new method check_non_pic.
10480 Define new method symbol_needs_plt_entry.
10481 Declare new data member issued_non_pic_error_.
10482 (class Target_arm::Relocate): Declare new method
10483 should_apply_static_reloc.
10484 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10485 (Target_arm::Scan::check_non_pic): Define new method.
10486 (Target_arm::Scan::local): Handle a small subset of reloc types used
10487 by Android.
10488 (Target_arm::Scan::local): Same.
10489 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10490
10491 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10492
10493 * incremental.cc (Incremental_inputs::report_command_line): Filter
10494 out --incremental-* options.
10495
10496 2009-05-29 Doug Kwan <dougkwan@google.com>
10497
10498 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10499 template class.
10500 (class Target_arm): Update comment.
10501 (Target_arm::Target_arm): Initialize new data members GOT_,
10502 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10503 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10504 and Target_arm::rel_dyn_section.
10505 Declare new_enum Target_arm::Got_type.
10506 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10507 and DYNBSS_.
10508 Update commments for member do_dynsym_value.
10509 (Target_arm::got_size, Target_arm::plt_section,
10510 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10511 new methods inside class defintion.
10512 (Target_arm::got_section): Define new method.
10513 (Target_arm::rel_dyn_section): Same.
10514 (Output_data_plt_arm): New template class.
10515 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10516 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10517 (Output_data_plt_arm::add_entry): Same.
10518 (Output_data_plt_arm::first_plt_entry): Define new
10519 static data member for PLT instruction template.
10520 (Output_data_plt_arm::plt_entry): Same.
10521 (Output_data_plt_arm::do_write): Define new method.
10522 (Target_arm::make_plt_entry): Same.
10523 (Target_arm::do_finalize_sections): Same.
10524 (Target_arm::do_dynsym_value): Same.
10525
10526 2009-05-28 Doug Kwan <dougkwan@google.com>
10527
10528 * Makefile.am (TARGETSOURCES): Add arm.cc.
10529 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10530 * Makefile.in: Regenerate.
10531 * arm.cc: New file.
10532 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10533
10534 2009-05-26 Doug Kwan <dougkwan@google.com>
10535
10536 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10537 (General_options::check_excluded_libs): Strip off directories in
10538 archive name before matching like GNU ld does.
10539 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10540 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10541 (exclude_libs_test_LDFLAGS): Add linker option
10542 -Wl,--exclude-libs,libexclude_libs_test_3
10543 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10544 an explicit archive without using -l.
10545 (alt/libexclude_libs_test_3.a): New make rule.
10546 * testsuite/Makefile.in: Regenerate.
10547 * testsuite/exclude_libs_test.c : Declare lib3_default().
10548 (main): Call it.
10549 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10550 * exclude_libs_test_3.c: New file.
10551
10552 2009-05-26 Nick Clifton <nickc@redhat.com>
10553
10554 * po/id.po: New Indonesian translation.
10555 * po/gold.pot: Updated template file.
10556
10557 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10558
10559 * testsuite/Makefile.am: Add -ffunction-sections to compile
10560 gc_comdat_test files. Add -Wl,--gc-sections to build
10561 gc_comdat_test.
10562 * testsuite/Makefile.in: Regenerate.
10563 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10564
10565 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10566
10567 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10568 kept comdat section was garbage collected.
10569 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10570 * testsuite/Makefile.in: Regenerate.
10571 * testsuite/gc_comdat_test.sh: New file.
10572 * testsuite/gc_comdat_test_1.cc: New file.
10573 * testsuite/gc_comdat_test_2.cc: New file.
10574
10575 2009-05-19 Doug Kwan <dougkwan@google.com>
10576
10577 * archive.cc (Archive::Archive): Move constructor from archive.h
10578 to here. Initialize no_export_.
10579 (Archive::get_elf_object_for_member): Set no_export flag of object.
10580 * archive.h (Archive::Archive): Move constructor body to
10581 archive.cc.
10582 (Archive::no_export): New method.
10583 (Archive::no_export_): New field.
10584 * object.h (Object::Object): Initialize no_export_ to false.
10585 (Object::no_export, Object::set_no_export): New methods.
10586 (Object::no_export_): New field.
10587 * options.cc (General_options::parse_exclude_libs): New method.
10588 (General_options::check_excluded_libs) Same.
10589 * options.h (exclude_libs): New option.
10590 (General_options::check_excluded_libs): New method declaration.
10591 (General_options::excluded_libs_): New field.
10592 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10593 default or protected visibility if an object has no-export flag set.
10594 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10595 (check_SCRIPTS): Add exclude_libs_test.sh.
10596 (check_DATA): Add exclude_libs_test.syms.
10597 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10598 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10599 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10600 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10601 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10602 libexclude_libs_test_2.a): New rules.
10603 * testsuite/Makefile.in: Regenerate.
10604 * testsuite/exclude_libs_test.c: New file.
10605 * testsuite/exclude_libs_test.sh: Ditto.
10606 * testsuite/exclude_libs_test_1.c: Ditto.
10607 * testsuite/exclude_libs_test_2.c: Ditto.
10608
10609 2009-05-15 Ian Lance Taylor <iant@google.com>
10610
10611 * configure.ac: Check for declarations for cases where libiberty.h
10612 checks HAVE_DECL_xxx.
10613 * configure, config.in: Rebuild.
10614
10615 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10616
10617 * gold.h (Incremental_argument_list): Remove (invalid) forward
10618 declaration.
10619 * incremental.cc (Incremental_inputs::report_achive): New method.
10620 (Incremental_inputs::report_object): New method.
10621 (Incremental_inputs::report_script): New method.
10622 (Incremental_inputs::finalize_inputs): New method.
10623 (Incremental_inputs::finalize): Call finalize_inputs().
10624 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10625 Create inputs entries.
10626 * incremental.h (Incremental_input_type): New enum.
10627 (Incremental_inputs::Incremental_input): Initialize new fields.
10628 (Incremental_inputs::report_inputs): New method.
10629 (Incremental_inputs::report_achive): New method.
10630 (Incremental_inputs::report_object): New method.
10631 (Incremental_inputs::report_script): New method.
10632 (Incremental_inputs::finalize_inputs): New method.
10633 (Incremental_inputs::Input_info): New struct.
10634 (Incremental_inputs::Input_info_map): New typedef.
10635 (Incremental_inputs::lock_): New field.
10636 (Incremental_inputs::Inputs_): New field.
10637 (Incremental_inputs::Inputs_map): New field.
10638 * main.cc (main): Call Incremental_input::report_inputs.
10639 * options.h (Input_argument_list): Typedef moved from
10640 Input_arguments.
10641 (Input_file_group::Files): Remove, use ::Input_argument_list.
10642 (Input_file_group::Input_argument_list): Remove, use
10643 ::Input_argument_list.
10644 * plugin.cc (Plugin_manager::add_input_file): Add error in
10645 incremental build.
10646 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10647 functions.
10648 * script.cc (read_input_script): Call
10649 Incremental_input::report_script.
10650 * script.h (Script_info): New class.
10651
10652 2009-04-27 Ian Lance Taylor <iant@google.com>
10653
10654 * x86_64.cc (do_adjust_output_section): Set entsize to
10655 plt_entry_size.
10656
10657 2009-04-23 Elliott Hughes <enh@google.com>
10658
10659 * output.cc (Output_file::close): After short writes, continue
10660 writing from the correct offset in the buffer being written.
10661
10662 2009-04-23 Chris Demetriou <cgd@google.com>
10663
10664 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10665 * configure: Regenerate.
10666 * config.in: Regenerate.
10667 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10668 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10669
10670 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10671
10672 * incremental.cc (Incremental_inputs_header_data): Renamed from
10673 Incremental_input_header_data.
10674 (Incremental_inputs_header_data::data_size): New field.
10675 (Incremental_inputs_header_data::put_input_file_count): Renamed
10676 from input_file_count.
10677 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10678 from command_line_offset.
10679 (Incremental_inputs_header_data::put_reserved): Renamed from
10680 put_reserved.
10681 (Incremental_inputs_entry_data): Renamed from
10682 Incremental_input_entry_data.
10683 (Incremental_inputs_entry_data::data_size): New field.
10684 (Incremental_inputs::report_command_line): New method.
10685 (Incremental_inputs::finalize): New method.
10686 (Incremental_inputs::create_incremental_inputs_data): New method.
10687 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10688 * incremental.h: New file.
10689 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10690 (Layout::finalize): Create incremental inputs section in
10691 incremental builds.
10692 (Layout::create_incremental_info_sections): New method.
10693 * layout.h (Layout::incremental_inputs): New method.
10694 (Layout::create_incremental_info_sections): New method.
10695 (Layout::incremental_inputs_): New field.
10696 * main.cc (main): Notify Incremental_input of the command line.
10697
10698 2009-04-01 Ian Lance Taylor <iant@google.com>
10699 Mikolaj Zalewski <mikolajz@google.com>
10700
10701 * gold.h (reserve_unordered_map): Define, three versions, one for
10702 each version of Unordered_map.
10703 * layout.cc (Layout::Layout): Remove options parameter. Add
10704 number_of_input_files parameter. Don't initialize options_.
10705 Initialize number_of_input_files_ and resized_signatures_. Move
10706 sections_are_attached_.
10707 (Layout::layout_group): Reserve space for group_signatures_.
10708 (Layout::find_or_add_kept_section): Change name parameter to be a
10709 reference. Resize signatures_ map when it gets large enough.
10710 (Layout::layout_eh_frame): Use parameters->options() instead of
10711 this->options_.
10712 (Layout::make_output_section): Likewise.
10713 (Layout::attach_allocated_section_to_segment): Likewise.
10714 (Layout::finalize, Layout::create_executable_stack): Likewise.
10715 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10716 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10717 * layout.h (class Layout): Update declarations. Remove options_
10718 field. Add number_of_input_files_ and resized_signatures_
10719 fields. Move sections_are_attached_ field.
10720 * main.cc (main): Pass number of input files to Layout
10721 constructor. Don't pass options.
10722
10723 2009-03-30 Ian Lance Taylor <iant@google.com>
10724
10725 * ffsll.c (ffsll): Correct implementation.
10726
10727 2009-03-27 Ian Lance Taylor <iant@google.com>
10728
10729 * ffsll.c: New file.
10730 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10731 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10732 * ftruncate.c (ftruncate): Declare before definition.
10733 * mremap.c (mremap): Likewise.
10734 * pread.c (pread): Likewise.
10735 * configure, Makefile.in, config.in: Rebuild.
10736
10737 * mremap.c: New file.
10738 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10739 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10740 (mremap): Declare if HAVE_MREMAP is not defined.
10741 * configure, Makefile.in, config.in: Rebuild.
10742
10743 2009-03-27 Cary Coutant <ccoutant@google.com>
10744
10745 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10746 position independent.
10747 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10748 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10749
10750 2009-03-24 Cary Coutant <ccoutant@google.com>
10751
10752 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10753 an executable.
10754 (needs_dynamic_reloc): Likewise.
10755
10756 2009-03-24 Ian Lance Taylor <iant@google.com>
10757
10758 * yyscript.y (file_cmd): Recognize EXTERN.
10759 (extern_name_list, extern_name_list_body): New nonterminals.
10760 * script.cc (script_add_extern): Define.
10761 * script-c.h (script_add_extern): Declare.
10762
10763 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10764
10765 * object.cc (is_elf_object): Define.
10766 * object.h (is_elf_object): Declare.
10767 * archive.cc (Archive::get_elf_object_for_member): Call
10768 is_elf_object.
10769 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10770
10771 2009-03-24 Elliott Hughes <enh@google.com>
10772
10773 * output.cc (Output_file::map_anonymous): Define.
10774 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10775 try an anonymous one. Report the size if the mmap fails.
10776 * output.h (class Output_file): Declare map_anonymous.
10777
10778 2009-03-24 Ian Lance Taylor <iant@google.com>
10779
10780 * target-select.cc (instantiate_target): Don't acquire the lock if
10781 the instantiated_target_ field has already been set.
10782
10783 2009-03-23 Ian Lance Taylor <iant@google.com>
10784
10785 * gold-threads.h (class Initialize_lock): Define.
10786 * gold-threads.cc (class Initialize_lock_once): Define.
10787 (initialize_lock_control): New static variable.
10788 (initialize_lock_pointer): New static variable.
10789 (initialize_lock_once): New static function.
10790 (Initialize_lock::Initialize_lock): Define.
10791 (Initialize_lock::initialize): Define.
10792 * target-select.h: Include "gold-threads.h".
10793 (class Target_selector): Add lock_ and initialize_lock_ fields.
10794 Don't define instantiate_target, just declare it.
10795 * target-select.cc (Target_selector::Target_selector): Initialize
10796 new fields.
10797 (Target_selector::instantiate_target): Define.
10798 * descriptors.h: Include "gold-threads.h".
10799 (class Descriptors): Add initialize_lock_ field.
10800 * descriptors.cc (Descriptors::Descriptors): Initialize new
10801 field.
10802 (Descriptors::open): Use initialize_lock_ field
10803 * errors.h (class Errors): Add initialize_lock_ field.
10804 * errors.cc (Errors::Errors): Initialize new field.
10805 (Errors::initialize_lock): Use initialize_lock_ field.
10806 * powerpc.cc (class Target_selector_powerpc): Remove
10807 instantiated_target_ field. In do_recognize call
10808 instantiate_target rather than do_instantiate_target. In
10809 do_instantiate_target just allocate a new target.
10810 * sparc.cc (class Target_selector_sparc): Likewise.
10811
10812 * freebsd.h: New file.
10813 * i386.cc: Include "freebsd.h".
10814 (Target_i386): Derive from Target_freebsd rather than
10815 Sized_target.
10816 (Target_selector_i386): Derive from Target_selector_freebsd rather
10817 than Target_selector.
10818 * x86_64.cc: Include "freebsd.h".
10819 (Target_x86_64): Derive from Target_freebsd rather than
10820 Sized_target.
10821 (Target_selector_x86_64): Derive from Target_selector_freebsd
10822 rather than Target_selector.
10823 * target.h (class Target): Add adjust_elf_header and
10824 do_adjust_elf_header.
10825 * output.cc (Output_file_header:: do_sized_write): Call target
10826 adjust_elf_header routine.
10827 * configure.tgt: Set targ_osabi.
10828 * configure.ac: Define GOLD_DEFAULT_OSABI.
10829 * parameters.cc (Parameters::default_target): Pass
10830 GOLD_DEFAULT_OSABI to select_target.
10831 * target-select.h (class Target_selector): Make instantiate_target
10832 protected rather than private.
10833 * Makefile.am (HFILES): Add freebsd.h.
10834 * configure, Makefile.in, config.in: Rebuild.
10835
10836 * merge.cc (do_add_input_section): Correct pend value. Change
10837 message about last entry not being null terminated from error to
10838 warning.
10839
10840 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10841
10842 * incremental.cc: New file.
10843 * Makefile.am (CCFILES): Add incremental.cc.
10844 * Makefile.in: Rebuild.
10845
10846 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10847
10848 * layout.cc (Layout::output_section_name): Preserve names
10849 of '.note.' sections.
10850
10851 2009-03-19 Ian Lance Taylor <iant@google.com>
10852
10853 * descriptors.cc (Descriptors::open): Check that the options are
10854 valid before using them.
10855
10856 2009-03-18 Ian Lance Taylor <iant@google.com>
10857
10858 * script-sections.h: Include <list>.
10859 (class Script_sections): Change Sections_elements from std::vector
10860 to std::list. Typedef public Elements_iterator. Add
10861 orphan_section_placement_, data_segment_align_start_, and
10862 saw_data_segment_align_ fields. Remove data_segment_align_index_
10863 field.
10864 * script-sections.cc (class Orphan_section_placement): New class.
10865 (class Sections_element): Add virtual functions is_relro and
10866 orphan_section_init. Remove virtual function place_orphan_here.
10867 (class Output_section_definition): Add is_relro and
10868 orphan_section_init. Remove place_orphan_here.
10869 (class Orphan_output_section): Likewise.
10870 (Script_sections::Script_sections): Update for field changes.
10871 (Script_sections::data_segment_align): Set saw_data_segment_align_
10872 and data_segment_align_start_, not data_segment_align_index.
10873 (Script_sections::data_segment_relro_end): Check
10874 saw_data_segment_align_. Use data_segment_align_start_ rather
10875 than data_segment_align_index_.
10876 (Script_sections::place_orphan): Rewrite to use
10877 Orphan_section_placement.
10878
10879 2009-03-17 Ian Lance Taylor <iant@google.com>
10880
10881 * archive.cc (Archive::add_symbols): Check for a version attached
10882 to the symbol name in the archive map.
10883 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10884 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10885 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10886 (ver_test_11.a): New target.
10887 * testsuite/Makefile.in: Rebuild.
10888
10889 * configure.ac: Check for chsize and posix_fallocate. Replace
10890 ftruncate.
10891 * ftruncate.c: New file, from gnulib.
10892 * output.cc (posix_fallocate): Define dummy version if not
10893 HAVE_POSIX_FALLOCATE.
10894 (Output_file::map): Call posix_fallocate rather than lseek and
10895 write.
10896 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10897 * configure, Makefile.in, config.in: Rebuild.
10898
10899 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10900
10901 * layout.h (Layout::create_note): Add section_name parameter.
10902 * layout.cc (Layout::create_note): Likewise.
10903 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10904
10905 2009-03-17 Ian Lance Taylor <iant@google.com>
10906
10907 * descriptors.cc: Include "options.h".
10908 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10909 (Descriptors::open): Always use O_CLOEXEC when opening a new
10910 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10911 then set FD_CLOEXEC.
10912
10913 * sparc.cc (class Target_sparc): Add has_got_section.
10914 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10915 make sure we have a GOT section.
10916
10917 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10918 (Target_sparc::Scan::local): Likewise.
10919 (Target_sparc::Scan::global): Likewise.
10920 (Target_sparc::Relocate::relocate): Likewise.
10921 (Target_sparc::Relocate::relocate_tls): Likewise.
10922
10923 * symtab.cc (Symbol_table::define_default_version): New function,
10924 broken out of add_from_object.
10925 (Symbol_table::add_from_object): Call define_default_version.
10926 (Symbol_table::define_special_symbol): Add resolve_oldsym
10927 parameter. Change all callers. If the version for a symbol comes
10928 from a version script, resolve it with the symbol with the same
10929 name with no version. Also add the symbol without a version if
10930 appropriate.
10931 (do_define_in_output_data): If resolving with oldsym, don't delete
10932 sym.
10933 (do_define_in_output_segment): Likewise.
10934 (do_define_as_constant): Likewise.
10935 * symtab.h (class Symbol_table): Update declarations.
10936
10937 2009-03-13 Ian Lance Taylor <iant@google.com>
10938
10939 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10940 (Read_symbols::requeue): New function.
10941 (Read_symbols::do_read_symbols): If make_elf_object fails because
10942 the target type is not configured, and the file was searched for,
10943 issue a warning and retry with the next directory.
10944 (Add_symbols::run): If the file has an incompatible format, and
10945 it was searched for, requeue the Read_symbols task. On error,
10946 release the object.
10947 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10948 dirindex parameter to constructor. Change all callers. Declare
10949 incompatible_warning and requeue.
10950 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10951 input_argument_ and input_group_ fields. Add them to
10952 constructor. Change all callers.
10953 (class Read_script): Add dirindex_ field. Add it to constructor.
10954 Change all callers.
10955 * archive.cc (Archive::setup): Remove input_objects parameter.
10956 Change all callers.
10957 (Archive::get_file_and_offset): Likewise.
10958 (Archive::read_all_symbols): Likewise.
10959 (Archive::read_symbols): Likewise.
10960 (Archive::get_elf_object_for_member): Remove input_objects
10961 parameter. Add punconfigured parameter. Change all callers.
10962 (Archive::add_symbols): Change return type to bool. Check return
10963 value of include_member.
10964 (Archive::include_all_members): Likewise.
10965 (Archive::include_member): Change return type to bool. Return
10966 false if first included object has incompatible target. Set
10967 included_member_ field.
10968 (Add_archive_symbols::run): If add_symbols returns false, requeue
10969 Read_symbols task.
10970 * archive.h (class Archive): Add included_member_ field.
10971 Initialize it in constructor. Add input_file and searched_for
10972 methods. Update declarations.
10973 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10974 input_argument_ fields. Add them to constructor. Change all
10975 callers.
10976 * script.cc: Include "target-select.h".
10977 (class Parser_closure): Add skip_on_incompatible_target_ and
10978 found_incompatible_target_ fields. Add
10979 skip_on_incompatible_target parameter to constructor. Change all
10980 callers. Add methods skip_on_incompatible_target,
10981 clear_skip_on_incompatible_target, found_incompatible_target, and
10982 set_found_incompatible_target.
10983 (read_input_script): Add dirindex parameter. Change all callers.
10984 If parser finds an incompatible target, requeue Read_symbols
10985 task.
10986 (script_set_symbol): Clear skip_on_incompatible_target in
10987 closure.
10988 (script_add_assertion, script_parse_option): Likewise.
10989 (script_start_sections, script_add_phdr): Likewise.
10990 (script_check_output_format): New function.
10991 * script.h (read_input_script): Update declaration.
10992 * script-c.h (script_check_output_format): Declare.
10993 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10994 (ignore_cmd): Remove OUTPUT_FORMAT.
10995 * fileread.cc (Input_file::Input_file): Add explicit this.
10996 (Input_file::will_search_for): New function.
10997 (Input_file::open): Add pindex parameter. Change all callers.
10998 * fileread.h (class Input_file): Add input_file_argument method.
10999 Declare will_search_for. Update declarations.
11000 * object.cc (make_elf_object): Add punconfigured parameter.
11001 Change all callers.
11002 * object.h (class Object): Make input_file public. Add
11003 searched_for method.
11004 (make_elf_object): Update declaration.
11005 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11006 restart search.
11007 * dirsearch.h (class Dirsearch): Update declaration.
11008 * options.h (class General_options): Add --warn-search-mismatch.
11009 * parameters.cc (Parameters::is_compatible_target): New function.
11010 * parameters.h (class Parameters): Declare is_compatible_target.
11011 * workqueue.cc (Workqueue::add_blocker): New function.
11012 * workqueue.h (class Workqueue): Declare add_blocker.
11013
11014 * fileread.cc (Input_file::open): Remove options parameter.
11015 Change all callers.
11016 (Input_file::open_binary): Likewise.
11017 * script.cc (read_input_script): Likewise.
11018 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11019 options parameter from constructor. Change all callers.
11020 (class Read_script): Likewise.
11021 * fileread.h (class Input_file): Update declarations.
11022 * script.h (read_input_script): Update declaration.
11023
11024 2009-03-10 Nick Clifton <nickc@redhat.com>
11025
11026 * po/es.po: New Spanish translation.
11027
11028 2009-03-06 Cary Coutant <ccoutant@google.com>
11029
11030 * options.cc (parse_short_option): Keep dash_z from registering itself.
11031
11032 2009-03-03 Ian Lance Taylor <iant@google.com>
11033
11034 PR 9918
11035 * target-reloc.h (relocate_section): Pass output_section to
11036 relocate.
11037 * i386.cc (Target_i386::should_apply_static_reloc): Add
11038 output_section parameter. Change all callers.
11039 (Target_i386::Relocate::relocate): Add output_section parameter.
11040 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11041 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11042 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11043 * testsuite/two_file_shared.sh: New script.
11044 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11045 (check_DATA): Add two_file_shared.dbg.
11046 (two_file_shared.dbg): New target.
11047 * testsuite/Makefile.in: Rebuild.
11048
11049 2009-03-01 Ian Lance Taylor <iant@google.com>
11050
11051 * configure.ac: Check for byteswap.h.
11052 * configure: Rebuild.
11053 * config.in: Rebuild.
11054
11055 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11056
11057 * layout.cc (Layout::find_or_add_kept_section): New function.
11058 (Layout::add_comdat): Removed.
11059 * layout.h (struct Kept_section): Move out of class Layout.
11060 Remove trailing underscores from field names. Add group_sections
11061 field. Rename group_ field to is_group. Change all uses.
11062 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11063 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11064 comdat_groups_ field.
11065 (Sized_relobj::include_section_group): Use
11066 find_or_add_kept_section and Kept_section::group_sections.
11067 (Sized_relobj::include_linkonce_section): Likewise.
11068 * object.cc (class Sized_relobj): Don't define Comdat_group or
11069 Comdat_group_table. Remove find_comdat_group and
11070 add_comdat_group. Remove comdat_groups_ field.
11071 * plugin.cc (include_comdat_group): Use
11072 Layout::find_or_add_kept_section.
11073
11074 2009-02-28 Ian Lance Taylor <iant@google.com>
11075
11076 * README: --gc-sections and map files are now supported. Document
11077 some build requirements.
11078
11079 PR 6992
11080 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11081 relocatable link set the value of the section symbol to zero.
11082 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11083 relocatable link don't include the section address in the local
11084 symbol value.
11085
11086 2009-02-27 Ian Lance Taylor <iant@google.com>
11087
11088 PR 6811
11089 * options.h (class Search_directory): Add is_system_directory.
11090 (class General_options): Declare is_in_system_directory.
11091 * options.cc (get_relative_sysroot): Make static.
11092 (get_default_sysroot): Make static.
11093 (General_optoins::is_in_system_directory): New function.
11094 * fileread.cc (Input_file::is_in_system_directory): New function.
11095 * fileread.h (class Input_file): Declare is_in_system_directory.
11096 * object.h (class Object): Add is_in_system_directory.
11097 (class Input_objects): Remove system_library_directory_ field.
11098 * object.cc (Input_objects::add_object): Don't set
11099 system_library_directory_.
11100 (input_objects::found_in_system_library_directory): Remove.
11101 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11102 parameter. Change all callers.
11103 (Symbol_table::sized_write_globals): Likewise.
11104 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11105 Call Object::is_in_system_directory.
11106 * symtab.h (class Symbol_table): Update declarations.
11107
11108 PR 5990
11109 * descriptors.h (Open_descriptor): Add is_on_stack field.
11110 * descriptors.cc (Descriptors::open): If the descriptor is on the
11111 top of the stack, remove it. Initialize is_on_stack field.
11112 (Descriptors::release): Only add pod to stack if it is not on the
11113 stack already.
11114 (Descriptors::close_some_descriptor): Clear stack_next and
11115 is_on_stack fields.
11116
11117 PR 7091
11118 * output.cc (Output_section::find_starting_output_address): Rename
11119 from starting_output_address; add PADDR parameter; change return
11120 type.
11121 * output.h (class Output_section): Declare
11122 find_starting_output_address instead of starting_output_address.
11123 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11124 section symbol for which we can't find a merge section.
11125
11126 PR 9836
11127 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11128 hidden or internal, force the symbol to be local.
11129 * resolve.cc (Symbol::override_visibility): Define.
11130 (Symbol::override_base): Use override_visibility.
11131 (Symbol_table::resolve): Likewise.
11132 (Symbol::override_base_with_special): Likewise.
11133 (Symbol_table::override_with_special): If the visibility is hidden
11134 or internal, force the symbol to be local.
11135 * symtab.h (class Symbol): Add set_visibility and
11136 override_visibility.
11137 * testsuite/ver_test_1.sh: New file.
11138 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11139 (check_DATA): Add ver_test_1.syms.
11140 (ver_test_1.syms): New target.
11141 * testsuite/Makefile.in: Rebuild.
11142
11143 2009-02-25 Cary Coutant <ccoutant@google.com>
11144
11145 * layout.cc (Layout::choose_output_section): Don't rename sections
11146 when using a linker script that has a SECTIONS clause.
11147 * Makefile.in: Regenerate.
11148
11149 * testsuite/Makefile.am (script_test_5.sh): New test case.
11150 * testsuite/Makefile.in: Regenerate.
11151 * testsuite/script_test_5.cc: New file.
11152 * testsuite/script_test_5.sh: New file.
11153 * testsuite/script_test_5.t: New file.
11154
11155 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11156
11157 * archive.cc (Archive::include_member): Update calls to add_symbols.
11158 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11159 the Layout argument.
11160 * dynobj.h (do_add_symbols): Add the Layout argument.
11161 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11162 Layout argument.
11163 * object.h (Object::add_symbols): Add the Layout argument.
11164 (Object::do_add_symbols): Add the Layout argument.
11165 (Sized_relobj::do_add_symbols): Add the Layout argument.
11166 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11167 Unify the two versions.
11168 (Add_plugin_symbols): Remove.
11169 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11170 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11171 (Add_plugin_symbols): Remove.
11172 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11173 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11174 (Add_symbols::run): Make it work with Pulginobj.
11175
11176 2009-02-06 Ian Lance Taylor <iant@google.com>
11177
11178 * object.cc (Sized_relobj::do_layout): Make info message start
11179 with lower case letter.
11180
11181 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11182
11183 * binary.cc: Fix file comment.
11184
11185 * options.h (enum Incremental_disposition): Define.
11186 (class General_options): Add new options: --incremental,
11187 --incremental_changed, --incremental_unchanged,
11188 --incremental_unknown. Add incremental_disposition_ and
11189 implicit_incremental_ fields.
11190 (General_options::incremental_disposition): New function.
11191 (class Position_dependent_options): Add incremental_disposition
11192 option.
11193 (Position_dependent_options::copy_from_options): Set incremental
11194 dispositions.
11195 * options.cc (General_options::parse_incremental_changed): New
11196 function.
11197 (General_options::parse_incremental_unchanged): New function.
11198 (General_options::parse_incremental_unknown): New function.
11199 (General_options::General_options): Initialize new fields
11200 incremental_disposition_ and implicit_incremental_.
11201 (General_options::finalize): Check for uasge of --incremental-*
11202 without --incremental.
11203
11204 2009-02-06 Chris Demetriou <cgd@google.com>
11205
11206 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11207 pointer and to report location as the file name associated with
11208 the symbol.
11209 (gold_undefined_symbol_at_location): New function to replace the
11210 old gold_undefined_symbol functionality.
11211 * target-reloc.h (relocate_section): Update to use
11212 gold_undefined_symbol_at_location.
11213 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11214 Call gold_undefined_symbol function rather than gold_error.
11215 * errors.h (Errors::undefined_symbol): Take location as a
11216 string, rather than calculating it from a relocation.
11217 * errors.cc (Errors::fatal): Print "fatal error:" before the
11218 formatted message.
11219 (Errors::error, Errors::error_at_location): Print "error: "
11220 before the formatted message.
11221 (Errors::undefined_symbol): Take location as a string, rather
11222 than calculating it from a relocation.
11223 (gold_undefined_symbol_at_location): New function akin to
11224 old gold_undefined_symbol, calculates location from relocation.
11225 (gold_undefined_symbol): Change to take only a Symbol pointer
11226 and to report location as the file name associated with the symbol.
11227 * testsuite/debug_msg.sh: Update for changed error messages.
11228 * testsuite/undef_symbol.sh: Likewise.
11229
11230 2009-02-04 Duncan Sands <baldrick@free.fr>
11231
11232 PR 9812
11233 * reduced_debug_output.h
11234 (Output_reduced_debug_abbrev_section::failed): Use format for
11235 gold_warning.
11236 (Output_reduced_debug_info_section::faild): Likewise.
11237
11238 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11239
11240 * script.cc (Lazy_demangler): New class.
11241 (Version_script_info::get_symbol_version_helper): Demangle a
11242 symbol only once.
11243
11244 2009-01-29 Cary Coutant <ccoutant@google.com>
11245
11246 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11247 to __tls_get_addr.
11248 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11249
11250 2009-01-28 Ian Lance Taylor <iant@google.com>
11251
11252 * version.cc (version_string): Bump to 1.9.
11253
11254 * gold.h: Include <cstring> and <stdint.h>.
11255 * version.cc: Include <cstdio>.
11256 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11257 warning.
11258 * reduced_debug_output.cc (insert_into_vector): Rename from
11259 Insert_into_vector; change all callers. Use Swap_unaligned to
11260 avoid aliasing issue; remove union since it is unnecessary.
11261
11262 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11263
11264 * Makefile.am (CCFILES): Add gc.cc.
11265 (HFILES): Add gc.h.
11266 * Makefile.in: Regenerate.
11267 * gold.cc (Gc_runner): New class.
11268 (queue_initial_tasks): Call garbage collection related tasks
11269 when corresponding options are invoked.
11270 (queue_middle_gc_tasks): New function.
11271 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11272 processed early before laying out sections during garbage collection.
11273 * gold.h (queue_middle_gc_tasks): New function.
11274 (is_prefix_of): Move from "layout.cc".
11275 * i386.cc (Target_i386::gc_process_relocs): New function.
11276 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11277 * main.cc (main): Create object of class "Garbage_collection".
11278 * object.cc (Relobj::copy_symbols_data): New function.
11279 (Relobj::is_section_name_included): New function.
11280 (Sized_relobj::do_layout): Allow this function to be called twice
11281 during garbage collection and defer layout of section during the
11282 first call.
11283 * object.h (Relobj::get_symbols_data): New function.
11284 (Relobj::is_section_name_included): New function.
11285 (Relobj::copy_symbols_data): New function.
11286 (Relobj::set_symbols_data): New function.
11287 (Relobj::get_relocs_data): New function.
11288 (Relobj::set_relocs_data): New function.
11289 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11290 (Relobj::gc_process_relocs): New function.
11291 (Relobj::do_gc_process_relocs): New pure virtual function.
11292 (Relobj::sd_): New data member.
11293 (Sized_relobj::is_output_section_offset_invalid): New function.
11294 (Sized_relobj::do_gc_process_relocs): New function.
11295 * options.h (General_options::gc_sections): Modify to not be a no-op.
11296 (General_options::print_gc_sections): New option.
11297 * plugin.cc (Plugin_finish::run): Remove function call to
11298 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11299 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11300 * reloc.cc (Read_relocs::run): Add task to process relocs and
11301 determine unreferenced sections when doing garbage collection.
11302 (Gc_process_relocs): New class.
11303 (Sized_relobj::do_gc_process_relocs): New function.
11304 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11305 sections that are garbage collected.
11306 * reloc.h (Gc_process_relocs): New class.
11307 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11308 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11309 symbols whose corresponding sections are garbage collected.
11310 (Symbol_table::Symbol_table): Add new parameter for the garbage
11311 collection object.
11312 (Symbol_table::gc_mark_undef_symbols): New function.
11313 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11314 (Symbol_table::gc_mark_dyn_syms): New function.
11315 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11316 as garbage.
11317 (Symbol_table::add_from_object): Likewise.
11318 (Symbol_table::add_from_relobj): When building shared objects, do not
11319 treat externally visible symbols as garbage.
11320 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11321 table information for static and relocatable links.
11322 * symtab.h (Symbol_table::set_gc): New function.
11323 (Symbol_table::gc): New function.
11324 (Symbol_table::gc_mark_undef_symbols): New function.
11325 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11326 (Symbol_table::gc_mark_dyn_syms): New function.
11327 (Symbol_table::gc_): New data member.
11328 * target.h (Sized_target::gc_process_relocs): New pure virtual
11329 function.
11330 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11331 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11332
11333 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11334
11335 * options.h (General_options::gc_sections): Define as a no-op for now.
11336 (General_options::no_keep_memory): Ditto.
11337 (General_options::Bshareable): Define.
11338 * options.cc (General_options::finalize): Honor -Bshareable.
11339
11340 2009-01-20 Andreas Schwab <schwab@suse.de>
11341
11342 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11343 read the value in the contents, since we don't use it. Use the
11344 template endianness when writing.
11345 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11346
11347 2009-01-19 Andreas Schwab <schwab@suse.de>
11348
11349 * configure.tgt (powerpc64-*): Fix targ_obj.
11350
11351 2009-01-15 Ian Lance Taylor <iant@google.com>
11352
11353 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11354 local symbols when stripping all symbols.
11355
11356 2009-01-14 Cary Coutant <ccoutant@google.com>
11357
11358 * output.cc (Output_reloc): Add explicit instantiations.
11359
11360 2009-01-14 Cary Coutant <ccoutant@google.com>
11361
11362 * archive.cc (Archive::get_elf_object_for_member): Remove call
11363 to File_read::claim_for_plugin.
11364 * descriptors.cc (Descriptors::open): Remove reference to
11365 is_claimed.
11366 (Descriptors::claim_for_plugin): Remove.
11367 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11368 (Descriptors::is_claimed): Remove.
11369 (claim_descriptor_for_plugin): Remove.
11370 * fileread.cc (File_read::claim_for_plugin): Remove.
11371 * fileread.h (File_read::claim_for_plugin): Remove.
11372 (File_read::descriptor): Reopen descriptor if necessary.
11373 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11374 (Plugin_manager::all_symbols_read): Add task parameter. Change
11375 all callers.
11376 (Plugin_manager::get_input_file): New function.
11377 (Plugin_manager::release_input_file): New function.
11378 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11379 corresponding data member.
11380 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11381 and pass to base constructor. Change all callers.
11382 (get_input_file, release_input_file): New functions.
11383 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11384 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11385 (Plugin_manager::all_symbols_read): Add task parameter.
11386 (Plugin_manager::get_input_file): New function.
11387 (Plugin_manager::release_input_file): New function.
11388 (Plugin_manager::task_): New data member.
11389 (Pluginobj::Pluginobj): Add filesize parameter.
11390 (Pluginobj::filename): New function.
11391 (Pluginobj::descriptor): New function.
11392 (Pluginobj::filesize): New function.
11393 (Pluginobj::filesize_): New data member.
11394 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11395 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11396 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11397
11398 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11399 with archive libraries.
11400 * testsuite/Makefile.in: Regenerate.
11401 * testsuite/plugin_test.c (struct sym_info): New type.
11402 (get_input_file, release_input_file): New static variables.
11403 (onload): Capture new transfer vector entries.
11404 (claim_file_hook): Stop reading at end of file according to filesize.
11405 Factor out parsing of readelf output into separate function.
11406 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11407 APIs and get the source file name from the symbol table. Convert
11408 source file name to corresponding object file name. Print info
11409 message when adding new input files.
11410 (parse_readelf_line): New function.
11411 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11412 * testsuite/plugin_test_2.sh: Likewise.
11413 * testsuite/plugin_test_3.sh: Likewise.
11414 * testsuite/plugin_test_4.sh: New test case.
11415
11416 2009-01-07 Ian Lance Taylor <iant@google.com>
11417
11418 * version.cc (version_string): Bump to 1.8.
11419
11420 2008-12-23 Cary Coutant <ccoutant@google.com>
11421
11422 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11423 * plugin.cc (Plugin_manager::finish): Rename as
11424 layout_deferred_objects. Move cleanup to separate function.
11425 (Plugin_manager::cleanup): New function.
11426 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11427 separately.
11428 * plugin.h (Plugin_manager::finish): Rename as
11429 layout_deferred_objects.
11430 (Plugin_manager::cleanup): New function.
11431 (Plugin_manager::cleanup_done): New field.
11432
11433 2008-12-23 Cary Coutant <ccoutant@google.com>
11434
11435 * plugin.cc (is_visible_from_outside): New function.
11436 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11437 so we don't return "IR only" status for exported symbols or -r links.
11438
11439 * testsuite/Makefile.am (plugin_test_3): New test case.
11440 * testsuite/Makefile.in: Regenerate.
11441 * testsuite/plugin_test_3.sh: New file.
11442
11443 2008-12-22 Cary Coutant <ccoutant@google.com>
11444
11445 * object.cc (Sized_relobj::layout_section): New function.
11446 (Sized_relobj::do_layout): Defer layout of input sections until after
11447 plugin has provided replacement files.
11448 (Sized_relobj::do_layout_deferred_sections): New function.
11449 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11450 (Relobj::layout_deferred_sections): New function.
11451 (Relobj::do_layout_deferred_sections): New function.
11452 (Sized_relobj::do_layout_deferred_sections): New function.
11453 (Sized_relobj::layout_section): New function.
11454 (Sized_relobj::Deferred_layout): New structure.
11455 (Sized_relobj::deferred_layout_): New field.
11456 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11457 Change all callers. Layout deferred sections.
11458 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11459 references.
11460 (Plugin_hook::run): Move code from do_plugin_hook inline.
11461 (Plugin_hook::do_plugin_hook): Remove.
11462 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11463 (Plugin_manager::finish): Renamed, was cleanup.
11464 (Plugin_manager::should_defer_layout): New function.
11465 (Plugin_manager::add_deferred_layout_object): New function.
11466 (Plugin_manager::Deferred_layout_list): New type.
11467 (Plugin_manager::deferred_layout_objects_): New field.
11468 (Plugin_hook::do_plugin_hook): Remove.
11469
11470 2008-12-17 Ian Lance Taylor <iant@google.com>
11471
11472 * options.h (class General_options): Add --no case for
11473 --export-dynamic.
11474
11475 2008-12-16 Cary Coutant <ccoutant@google.com>
11476
11477 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11478 vector.
11479 (Plugin_manager::claim_file): Create plugin object even if
11480 plugin did not call the add_symbols callback.
11481 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11482 asking for more symbols than were added.
11483 * testsuite/Makefile.am (plugin_test_1): Add test case with
11484 no global symbols.
11485 (empty.syms): New target.
11486 * testsuite/Makefile.in: Regenerate.
11487 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11488 message. Don't call add_symbols if no globals.
11489 (all_symbols_read_hook): Don't provide replacement for empty
11490 claimed file.
11491
11492 2008-12-12 Ian Lance Taylor <iant@google.com>
11493
11494 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11495 r_type == 0 for a local symbol with r_sym == 0.
11496 (scan_relocatable_relocs): Pass r_sym to
11497 local_non_section_strategy.
11498 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11499 r_sym parameter.
11500
11501 * configure.ac: Update test for TLS descriptors: they are
11502 supported as of glibc 2.9.
11503 * configure: Rebuild.
11504
11505 2008-12-11 Ian Lance Taylor <iant@google.com>
11506
11507 PR 7091
11508 * target-reloc.h (Default_scan_relocatable_relocs): For each
11509 function, map r_type == 0 to RELOC_DISCARD.
11510
11511 2008-12-10 Cary Coutant <ccoutant@google.com>
11512
11513 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11514 object to override a kept COMDAT group from a plugin object.
11515
11516 2008-12-09 Ian Lance Taylor <iant@google.com>
11517
11518 PR 7088
11519 * yyscript.y (file_cmd): Handle INPUT.
11520
11521 * testsuite/initpri1.c: Change all declarations to be full
11522 prototypes by adding void, to avoid compiler warnings.
11523
11524 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11525
11526 * options.cc (General_options::parse_plugin_opt): New.
11527 (General_options::add_plugin): The argument now is just the filename.
11528 (General_options::add_plugin_option): New.
11529 * options.h (plugin_opt): New.
11530 (add_plugin): Change argument name.
11531 (add_plugin_option): New.
11532 * plugin.cc (Plugin::load): Don't parse the plugin option.
11533 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11534 (Plugin::add_option): New.
11535 (Plugin::args_): Change type.
11536 (Plugin::filename_): New.
11537 (Plugin_manager::add_plugin_option): New.
11538 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11539 * testsuite/Makefile.in: Regenerate.
11540
11541 2008-12-05 Cary Coutant <ccoutant@google.com>
11542
11543 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11544 Handle --strip-lto-sections option.
11545 * options.h (strip_lto_sections): New option.
11546
11547 2008-12-01 Cary Coutant <ccoutant@google.com>
11548
11549 * plugin.cc (ld_plugin_message): Change format parameter to const.
11550 Fix mismatch between new[] and delete.
11551
11552 2008-11-14 Cary Coutant <ccoutant@google.com>
11553
11554 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11555 instead of -1U.
11556
11557 2008-11-05 Craig Silverstein <csilvers@google.com>
11558
11559 * options.cc (General_options::parse_dynamic_list): New function.
11560 * options.h (General_options): New flags dynamic_list,
11561 dynamic_list_data, dynamic_list_cpp_new, and
11562 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11563 (General_options::in_dynamic_list): New function.
11564 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11565 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11566 (Lex::can_continue_name): Likewise.
11567 (yylex): Likewise.
11568 (read_script_file): New parameter script_options.
11569 (read_dynamic_list): New function.
11570 (Script_options::define_dynamic_list): New function.
11571 (dynamic_list_keyword_parsecodes): New variable.
11572 (dynamic_list_keywords): New variable.
11573 * script.h (Script_options::define_dynamic_list): New function
11574 prototype.
11575 (read_dynamic_list): New function prototype.
11576 * symtab.cc (strprefix): New macro.
11577 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11578 dynamic_list_data, dynamic_list_cpp_new, and
11579 dynamic_list_cpp_typeinfo.
11580 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11581 (dynamic_list_expr): New rule.
11582 (dynamic_list_nodes): Likewise.
11583 (dynamic_list_node): Likewise.
11584 * testsuite/Makefile.am (dynamic_list): New test.
11585 * testsuite/Makefile.in: Regenerated.
11586 * testsuite/dynamic_list.t: New file.
11587 * testsuite/dynamic_list.sh: New file.
11588
11589 2008-11-05 Craig Silverstein <csilvers@google.com>
11590
11591 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11592 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11593 (t11_last): Likewise.
11594 * testsuite/ver_test_6.c (main): Likewise.
11595
11596 2008-10-07 Cary Coutant <ccoutant@google.com>
11597
11598 * options.c (General_options::finalize): Add check for -static and
11599 -shared.
11600 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11601 is not empty.
11602
11603 2008-10-02 Cary Coutant <ccoutant@google.com>
11604
11605 * plugin.cc (make_sized_plugin_object): Fix conditional
11606 compilation to work when not all targets are enabled.
11607
11608 2008-09-29 Cary Coutant <ccoutant@google.com>
11609
11610 * archive.cc (Archive::get_file_and_offset): Use filename instead
11611 of name to get library path.
11612 (Archive::include_member): Unlock external member of a thin archive.
11613
11614 * testsuite/Makefile.am (TEST_AR): New variable.
11615 (thin_archive_test_1): New test.
11616 (thin_archive_test_2): New test.
11617 * testsuite/Makefile.in: Regenerate.
11618 * testsuite/thin_archive_main.cc: New file.
11619 * testsuite/thin_archive_test_1.cc: New file.
11620 * testsuite/thin_archive_test_2.cc: New file.
11621 * testsuite/thin_archive_test_3.cc: New file.
11622 * testsuite/thin_archive_test_4.cc: New file.
11623
11624 2008-09-29 Cary Coutant <ccoutant@google.com>
11625
11626 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11627 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11628 instead of -1U.
11629 (Sized_relobj::do_finalize_local_symbols): Likewise.
11630 (Sized_relobj::map_to_kept_section): Likewise.
11631 * object.h (Sized_relobj::invalid_address): New constant.
11632 (Sized_relobj::do_output_section_offset): Check for invalid_address
11633 and return -1ULL.
11634 * output.cc (Output_reloc::local_section_offset): Use constant
11635 invalid_address instead of -1U.
11636 (Output_reloc::get_address): Likewise.
11637 (Output_section::output_address): Change -1U to -1ULL.
11638 * output.h (Output_reloc::invalid_address): New constant.
11639 * reloc.cc (Sized_relobj::write_sections): Use constant
11640 invalid_address instead of -1U.
11641 (Sized_relobj::relocate_sections): Likewise.
11642 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11643 values for merge sections.
11644 * target-reloc.h (relocate_for_relocatable): Use constant
11645 invalid_address instead of -1U.
11646
11647 2008-09-19 Cary Coutant <ccoutant@google.com>
11648
11649 Add plugin functionality for link-time optimization (LTO).
11650 * configure.ac (plugins): Add --enable-plugins option.
11651 * configure: Regenerate.
11652 * config.in: Regenerate.
11653 * Makefile.am (LIBDL): New variable.
11654 (CCFILES): Add plugin.cc.
11655 (HFILES): Add plugin.h.
11656 (ldadd_var): Add LIBDL.
11657 * Makefile.in: Regenerate.
11658
11659 * archive.cc: Include "plugin.h".
11660 (Archive::setup): Don't preread archive symbols when using a plugin.
11661 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11662 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11663 files.
11664 (Archive::include_member): Add symbols from plugin objects.
11665 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11666 * descriptors.cc (Descriptors::open): Check for file descriptors
11667 abandoned by plugins.
11668 (Descriptors::claim_for_plugin): New function.
11669 * descriptors.h (Descriptors::claim_for_plugin): New function.
11670 (Open_descriptor::is_claimed): New field.
11671 (claim_descriptor_for_plugin): New function.
11672 * fileread.cc (File_read::claim_for_plugin): New function.
11673 * fileread.h (File_read::claim_for_plugin): New function.
11674 (File_read::descriptor): New function.
11675 * gold.cc: Include "plugin.h".
11676 (queue_initial_tasks): Add task to call plugin hooks for generating
11677 new object files.
11678 * main.cc: Include "plugin.h".
11679 (main): Load plugin libraries.
11680 * object.h (Pluginobj): Declare.
11681 (Object::pluginobj): New function.
11682 (Object::do_pluginobj): New function.
11683 (Object::set_target): New function.
11684 * options.cc: Include "plugin.h".
11685 (General_options::parse_plugin): New function.
11686 (General_options::General_options): Initialize plugins_ field.
11687 (General_options::add_plugin): New function.
11688 * options.h (Plugin_manager): Declare.
11689 (General_options): Add --plugin option.
11690 (General_options::has_plugins): New function.
11691 (General_options::plugins): New function.
11692 (General_options::add_plugin): New function.
11693 (General_options::plugins_): New field.
11694 * plugin.cc: New file.
11695 * plugin.h: New file.
11696 * readsyms.cc: Include "plugin.h".
11697 (Read_symbols::do_read_symbols): Check for archive before checking
11698 for ELF file. Call plugin hooks to claim files.
11699 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11700 from a real object file; force override when processing replacement
11701 files.
11702 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11703 (Symbol::init_base_object): Likewise.
11704 (Symbol::init_base_output_data): Likewise.
11705 (Symbol::init_base_output_segment): Likewise.
11706 (Symbol::init_base_constant): Likewise.
11707 (Symbol::init_base_undefined): Likewise.
11708 (Symbol::output_section): Assert that object is not a plugin.
11709 (Symbol_table::add_from_pluginobj): New function.
11710 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11711 undefined.
11712 (Symbol_table::sized_write_globals): Likewise.
11713 (Symbol_table::add_from_pluginobj): Instantiate template.
11714 * symtab.h (Sized_pluginobj): Declare.
11715 (Symbol::in_real_elf): New function.
11716 (Symbol::set_in_real_elf): New function.
11717 (Symbol::in_real_elf_): New field.
11718 (Symbol_table::add_from_pluginobj): New function.
11719
11720 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11721 (LIBDL): New variable.
11722 (LDADD): Add LIBDL.
11723 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11724 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11725 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11726 (MOSTLYCLEANFILES): Likewise.
11727 * testsuite/Makefile.in: Regenerate.
11728 * testsuite/plugin_test.c: New file.
11729 * testsuite/plugin_test_1.sh: New file.
11730 * testsuite/plugin_test_2.sh: New file.
11731
11732 2008-09-16 Ian Lance Taylor <iant@google.com>
11733
11734 * target-reloc.h (relocate_section): Check whether a symbol is
11735 defined by the ABI before reporting an undefined symbol error.
11736 * target.h (Target::is_defined_by_abi): Make parameter const.
11737 (Target::do_is_defined_by_abi): Likewise.
11738 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11739 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11740 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11741 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11742 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11743 * testsuite/Makefile.in: Rebuild.
11744
11745 * fileread.cc (make_view): Add casts to avoid warning.
11746
11747 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11748
11749 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11750 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11751
11752 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11753
11754 * options.h (General_options::output_is_executable): New.
11755 (General_options::output_is_pie): New.
11756 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11757 for shared libraries.
11758 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11759
11760 2008-09-11 Chris Demetriou <cgd@google.com>
11761
11762 * options.h (origin): New -z option.
11763 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11764 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11765 in DT_FLAGS_1.
11766
11767 2008-09-05 Cary Coutant <ccoutant@google.com>
11768
11769 * fileread.cc (File_read::make_view): Add check for attempt to map
11770 beyond end of file.
11771
11772 2008-09-05 Cary Coutant <ccoutant@google.com>
11773
11774 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11775 explicit instantiations.
11776
11777 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11778
11779 PR gold/6858
11780 * options.cc (General_options::finalize): Allow undefined symbols
11781 in shlibs if linking -shared.
11782
11783 PR gold/6859
11784 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11785 symbols as not needing a dynsym entry.
11786
11787 2008-08-20 Craig Silverstein <csilvers@google.com>
11788
11789 * fileread.cc (File_read::open): Do not lock the file unless it
11790 was successfully opened.
11791
11792 2008-08-14 Cary Coutant <ccoutant@google.com>
11793
11794 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11795 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11796 * testsuite/tls_test.cc (struct int128): 128-bit struct
11797 for testing TLS relocs with non-zero addend.
11798 (v12): New TLS variable.
11799 (t12): New test.
11800 (t_last): Add check for v12.
11801 * testsuite/tls_test.h (t12): New function.
11802 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11803
11804 2008-08-13 Ian Lance Taylor <iant@google.com>
11805
11806 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11807 set tls_segment_ or relro_segment_.
11808 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11809 when appropriate.
11810 * output.h (Output_section::clear_is_relro): New function.
11811 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11812 sections specially even when output_data_ is empty.
11813 (Output_segment::maximum_alignment): When first section is relro,
11814 only force alignment for PT_LOAD segments.
11815 * script.cc (script_data_segment_align): New function.
11816 (script_data_segment_relro_end): New function.
11817 * script-c.h (script_data_segment_align): Declare.
11818 (script_data_segment_relro_end): Declare.
11819 * script-sections.h (class Script_sections): Declare
11820 data_segment_align and data_segment_relro_end. Add fields
11821 segment_align_index_ and saw_relro_end_.
11822 * script-sections.cc (class Sections_element): Add set_is_relro
11823 virtual function. Add new bool* parameter to place_orphan_here.
11824 Add get_output_section virtual function.
11825 (class Output_section_definition): Add set_is_relro. Add new
11826 bool* parameter to place_orphan_here. Add get_output_section.
11827 Add is_relro_ field.
11828 (Output_section_definition::Output_section_definition): Initialize
11829 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11830 and is_relro_ fields.
11831 (Output_section_definition::place_orphan_here): Add is_relro
11832 parameter.
11833 (Output_section_definition::set_section_addresses): Set relro for
11834 output section.
11835 (Output_section_definition::alternate_constraint): Likewise.
11836 (class Orphan_output_section): Add new bool* parameter to
11837 place_orphan_here. Add get_output_section.
11838 (Orphan_output_section::place_orphan_here): Add is_relro
11839 parameter.
11840 (Script_sections::Script_sections): Initialize
11841 data_segment_align_index_ and saw_relro_end_.
11842 (Script_sections::data_segment_align): New function.
11843 (Script_sections::data_segment_relro_end): New function.
11844 (Script_sections::place_orphan): Set or clear is_relro.
11845 (Script_sections::set_section_addresses): Force alignment of first
11846 TLS section.
11847 * yyscript.y (exp): Call script_data_segment_align and
11848 script_data_segment_relro_end.
11849 * testsuite/relro_script_test.t: New file.
11850 * testsuite/relro_test.cc (using_script): Declare.
11851 (t1, t2): Test using_script.
11852 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11853 (relro_script_test_SOURCES): Define.
11854 (relro_script_test_DEPENDENCIES): Define.
11855 (relro_script_test_LDFLAGS): Define.
11856 (relro_script_test_LDADD): Define.
11857 (relro_script_test.so): New target.
11858 * testsuite/Makefile.in: Rebuild.
11859
11860 2008-08-06 Cary Coutant <ccoutant@google.com>
11861
11862 * archive.cc (Archive::total_archives, Archive::total_members)
11863 (Archive::total_members_loaded): New variables.
11864 (Archive::setup): Add parameter. Add option to preread
11865 archive symbols.
11866 (Archive::read_armap): Add counter.
11867 (Archive::get_file_and_offset): New function.
11868 (Archive::get_elf_object_for_member): New function.
11869 (Archive::read_all_symbols): New function.
11870 (Archive::read_symbols): New function.
11871 (Archive::add_symbols): Add counters.
11872 (Archive::include_all_members): Use armap to find members if it's
11873 already built.
11874 (Archive::include_member): Skip reading symbols if already read.
11875 Factored code into Archive::get_file_and_offset and
11876 Archive::get_elf_object_for_member. Changed call to
11877 Mapfile::report_include_archive_member.
11878 (Archive::print_stats): New function.
11879 * archive.h: Declare Object and Read_symbols_data classes.
11880 (Archive::Archive): Add initializers for new members.
11881 (Archive::setup): Add parameter.
11882 (Archive::print_stats): New function.
11883 (Archive::total_archives, Archive::total_members)
11884 (Archive::total_members_loaded): New variables.
11885 (Archive::get_file_and_offset): New function.
11886 (Archive::get_elf_object_for_member): New function.
11887 (Archive::read_all_symbols): New function.
11888 (Archive::read_symbols): New function.
11889 (Archive::Archive_member): New class.
11890 (Archive::members_): New member.
11891 (Archive::num_members_): New member.
11892 * main.cc: Include archive.h.
11893 (main): Call Archive::print_stats.
11894 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11895 archive parameter; member_name is now the fully-decorated name.
11896 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11897 * options.h: (General_options): Add --preread-archive-symbols option.
11898 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11899 Archive::setup.
11900
11901 2008-08-04 Ian Lance Taylor <iant@google.com>
11902
11903 * symtab.h (Symbol::use_plt_offset): New function.
11904 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11905 * powerpc.cc (Relocate::relocate): Likewise.
11906 * sparc.cc (Relocate::relocate): Likewise.
11907 * x86_64.cc (Relocate::relocate): Likewise.
11908 * testsuite/weak_plt.sh: New test.
11909 * testsuite/weak_plt_main.cc: New test.
11910 * testsuite/weak_plt_shared.cc: New test.
11911 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11912 (check_PROGRAMS): Add weak_plt.
11913 (check_DATA): Add weak_plt_shared.so.
11914 (weak_plt_main_pic.o, weak_plt): New targets.
11915 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11916 * testsuite/Makefile.in: Rebuild.
11917
11918 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11919 gcctestdir/ld.
11920 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11921 * testsuite/Makefile.in: Rebuild.
11922
11923 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11924
11925 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11926 * Makefile.in: Regenerate.
11927 * po/POTFILES.in: Regenerate.
11928
11929 2008-07-29 Ian Lance Taylor <iant@google.com>
11930
11931 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11932 symbols before other symbols.
11933 * testsuite/script_test_2.cc (test_addr): Declare.
11934 (test_addr_alias): Declare.
11935 (main): Check that test_addr and test_addr_alias have the right
11936 values.
11937 * testsuite/script_test_2.t: Define test_addr_alias and
11938 test_addr.
11939
11940 2008-07-24 Ian Lance Taylor <iant@google.com>
11941
11942 PR 5990
11943 * descriptors.cc: New file.
11944 * descriptors.h: New file.
11945 * gold-threads.h (class Hold_optional_lock): New class.
11946 * fileread.cc: Include "descriptors.h".
11947 (File_read::~File_read): Release descriptor rather than closing
11948 it.
11949 (File_read::open) [file]: Call open_descriptor rather than open.
11950 Set is_descriptor_opened_.
11951 (File_read::open) [memory]: Assert that descriptor is not open.
11952 (File_read::reopen_descriptor): New function.
11953 (File_read::release): Release descriptor.
11954 (File_read::do_read): Make non-const. Reopen descriptor.
11955 (File_read::read): Make non-const.
11956 (File_read::make_view): Reopen descriptor.
11957 (File_read::do_readv): Likewise.
11958 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11959 Update declarations.
11960 * layout.cc: Include "descriptors.h".
11961 (Layout::create_build_id): Use open_descriptor rather than open.
11962 * output.cc: Include "descriptors.h".
11963 (Output_file::open): Use open_descriptor rather than open.
11964 * archive.cc (Archive::const_iterator): Change Archive to be
11965 non-const.
11966 (Archive::begin, Archive::end): Make non-const.
11967 (Archive::count_members): Likewise.
11968 * archive.h (class Archive): Update declarations.
11969 * object.h (Object::read): Make non-const.
11970 * Makefile.am (CCFILES): Add descriptors.cc.
11971 (HFILES): Add descriptors.h.
11972 * Makefile.in: Rebuild.
11973
11974 PR 6716
11975 * gold.h: Always include <clocale>. Add Solaris workarounds
11976 following code in binutils/sysdep.h.
11977
11978 PR 6048
11979 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11980 this->eh_frame_hdr_ is NULL before using it.
11981
11982 * dynobj.cc (Versions::Versions): Update comment.
11983
11984 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11985 the base version name.
11986
11987 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11988 array size plus one.
11989 (Stringpool_template::set_string_offsets): Subtract one from key
11990 before using it as an array index.
11991 (Stringpool_template::get_offset_with_length): Likewise.
11992 (Stringpool_template::write_to_buffer): Likewise.
11993 * stringpool.h (Stringpool_template::get_offset_from_key):
11994 Likewise.
11995
11996 2008-07-23 Ian Lance Taylor <iant@google.com>
11997
11998 PR 6658
11999 * object.h (Merged_symbol_value::value): Do our best to handle a
12000 negative addend.
12001
12002 PR 6647
12003 * script.cc (Version_script_info::get_versions): Don't add empty
12004 version tag to return value.
12005 (Version_script_info::get_symbol_version_helper): Change return
12006 type to bool. Add pversion parameter. Change all callers.
12007 (script_register_vers_node): Don't require a non-NULL tag.
12008 * script.h (class Version_script_info): Update declarations.
12009 (Version_script_info::get_symbol_version): Change return type to
12010 bool. Add version parameter. Change all callers.
12011 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12012 handling. Handle an empty version from a version script.
12013 (Symbol_table::define_special_symbol): Likewise.
12014 * testsuite/ver_test_10.script: New file.
12015 * testsuite/ver_test_10.sh: New file.
12016 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12017 (check_DATA): Add ver_test_10.syms.
12018 (ver_test_10.syms, ver_test_10.so): New target.
12019 * testsuite/Makefile.in: Rebuild.
12020
12021 2008-07-23 Simon Baldwin <simonb@google.com>
12022
12023 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12024 to zero for undefined symbols from dynamic libraries.
12025
12026 2008-07-23 Ian Lance Taylor <iant@google.com>
12027
12028 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12029 Change all callers.
12030 * symtab.h (class Symbol_table): Update declaration.
12031 * testsuite/ver_test_9.cc: New file.
12032 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12033 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12034 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12035 (ver_test_9.so, ver_test_9.o): New targets.
12036 * testsuite/Makefile.in: Rebuild.
12037
12038 2008-07-22 Ian Lance Taylor <iant@google.com>
12039
12040 * options.h (class General_options): Define --check-sections.
12041 * layout.cc (Layout::set_segment_offsets): Handle
12042 --check-sections.
12043
12044 * options.h (class General_options): Define -n/--nmagic and
12045 -N/--omagic.
12046 * options.cc (General_options::finalize): For -n/--nmagic or
12047 -N/--omagic, set -static.
12048 * layout.cc (Layout::attach_allocated_section_to_segment): If
12049 -N/--omagic, don't put read-only and read-write sections in
12050 different segments.
12051 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12052 finding a read-only segment.
12053 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12054 don't set the minimum segment alignment to the common page size,
12055 and don't set the file offset to the address modulo the page size.
12056 * script-sections.cc (Script_sections::create_segments): If
12057 -n/--omagic, don't put read-only and read-write sections in
12058 different segments.
12059
12060 * cref.cc: New file.
12061 * cref.h: New file.
12062 * options.h (class General_options): Add --print-symbol-counts.
12063 * main.cc (main): Issue defined symbol report if requested.
12064 * archive.cc (Archive::interpret_header): Make into a const member
12065 function.
12066 (Archive::add_symbols): Call Input_objects::archive_start and
12067 archive_stop.
12068 (Archive::const_iterator): Define new class.
12069 (Archive::begin, Archive::end): New functions.
12070 (Archive::include_all_members): Rewrite to use iterator.
12071 (Archive::count_members): New function.
12072 * archive.h (class Archive): Update declarations.
12073 (Archive::filename): New function.
12074 * object.cc: Include "cref.h".
12075 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12076 (Sized_relobj::do_get_global_symbol_counts): New function.
12077 (Input_objects::add_object): Add object to cross-referencer.
12078 (Input_objects::archive_start): New function.
12079 (Input_objects::archive_stop): New function.
12080 (Input_objects::print_symbol_counts): New function.
12081 * object.h: Declare Cref and Archive.
12082 (Object::get_global_symbol_counts): New function.
12083 (Object::do_get_global_symbol_counts): New pure virtual function.
12084 (class Sized_relobj): Add defined_count_ field. Update
12085 declarations.
12086 (class Input_objects): Add cref_ field. Update constructor.
12087 Update declarations.
12088 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12089 defined_count_.
12090 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12091 symbol counts.
12092 (Sized_dynobj::do_get_global_symbol_counts): New function.
12093 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12094 defined_count_. Update declarations. Define Symbols typedef.
12095 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12096 parameter. Change all callers.
12097 (Symbol_table::add_from_dynobj): Add sympointers and defined
12098 parameters. Change all callers.
12099 * symtab.h (class Symbol_table): Update declarations.
12100 * Makefile.am (CCFILES): Add cref.cc.
12101 (HFILES): Add cref.h.
12102 * Makefile.in: Rebuild.
12103
12104 2008-07-22 Simon Baldwin <simonb@google.com>
12105
12106 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12107 to zero when writing undefined symbols.
12108
12109 2008-07-22 Ian Lance Taylor <iant@google.com>
12110
12111 * output.cc (Output_section::add_input_section): Don't try to
12112 merge empty merge sections.
12113
12114 2008-07-21 Craig Silverstein <csilvers@google.com>
12115
12116 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12117 Include symbol version in error message.
12118
12119 2008-07-20 Chris Demetriou <cgd@google.com>
12120
12121 * configure.ac (gold_cv_c_random_seed): New configured variable.
12122 (RANDOM_SEED_CFLAGS): New substituted variable.
12123 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12124 * configure: Rebuild.
12125 * Makefile.in: Likewise.
12126 * testsuite/Makefile.in: Likewise.
12127
12128 2008-07-18 Ian Lance Taylor <iant@google.com>
12129
12130 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12131 where we see NAME/NULL and NAME/VERSION as separate symbols.
12132 * testsuite/ver_test_main.cc (main): Call t4.
12133 (t4, t4_2a): Define.
12134 * testsuite/ver_test_2.cc (t4_2): Define.
12135 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12136 * testsuite/ver_test_4.cc (t4_2a): Define.
12137 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12138 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12139
12140 2008-07-17 Ian Lance Taylor <iant@google.com>
12141
12142 * dynobj.cc (Versions::add_def): If we give an error about a
12143 missing version, go ahead and create the version anyhow.
12144
12145 2008-07-10 Ian Lance Taylor <iant@google.com>
12146
12147 Handle output sections with more than 0x7fffffff bytes.
12148 * object.h (class Relobj): Change map_to_output_ to
12149 output_sections_, and just keep a section pointer. Change all
12150 uses. Move comdat group support to Sized_relobj.
12151 (Relobj::is_section_specially_mapped): Remove.
12152 (Relobj::output_section): Remove poff parameter. Change all
12153 callers.
12154 (Relobj::output_section_offset): New function.
12155 (Relobj::set_section_offset): Rewrite.
12156 (Relobj::map_to_output): Remove.
12157 (Relobj::output_sections): New function.
12158 (Relobj::do_output_section_offset): New pure virtual function.
12159 (Relobj::do_set_section_offset): Likewise.
12160 (class Sized_relobj): Add section_offsets_ field. Add comdat
12161 group support from Relobj. Update declarations.
12162 (Sized_relobj::get_output_section_offset): New function.
12163 (Sized_relobj::do_output_section_offset): New function.
12164 (Sized_relobj::do_set_section_offset): New function.
12165 * object.cc (Relobj::output_section_address): Remove.
12166 (Sized_relobj::Sized_relobj): Initialize new fields.
12167 (Sized_relobj::include_section_group): Cast find_kept_object to
12168 Sized_relobj.
12169 (Sized_relobj::include_linkonce_section): Likewise.
12170 (Sized_relobj::do_layout): Use separate arrays for output section
12171 and output offset.
12172 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12173 output_sections.
12174 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12175 output_sections and section_offsets.
12176 (Sized_relobj::write_local_symbols): Likewise.
12177 (map_to_kept_section): Compute output address directly.
12178 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12179 output_sections and section_offsets.
12180 (Sized_relobj::write_sections): Likewise.
12181 (Sized_relobj::relocate_sections): Likewise.
12182 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12183 * output.h (class Output_reloc): Update declarations. Change
12184 u2_.relobj to Sized_relobj*.
12185 (class Output_data_reloc): Change add functions to use
12186 Sized_relobj*.
12187 * output.cc (Output_reloc::Output_reloc): Change relobj to
12188 Sized_relobj*.
12189 (Output_reloc::local_section_offset): Change return type to
12190 Elf_Addr. Use get_output_section_offset.
12191 (Output_reloc::get_address): Likewise.
12192 (Output_section::is_input_address_mapped): Don't call
12193 is_section_specially_mapped.
12194 (Output_section::output_offset): Likewise.
12195 (Output_section::output_address): Likewise.
12196 (Output_section::starting_output_address): Likewise.
12197 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12198 parameter to Sized_relobj*.
12199 (Copy_relocs::need_copy_reloc): Likewise.
12200 (Copy_relocs::save): Likewise.
12201 * copy-relocs.h (class Copy_relocs): Update declarations.
12202 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12203 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12204 * target-reloc.h (relocate_for_relocatable): Change
12205 offset_in_output_section type to Elf_Addr. Change code that uses
12206 it as well.
12207 * layout.cc (Layout::layout): Always set *off.
12208 * mapfile.cc (Mapfile::print_input_section): Use
12209 output_section_offset.
12210 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12211 Sized_relobj*.
12212 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12213 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12214 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12215
12216 2008-07-03 Ian Lance Taylor <iant@google.com>
12217
12218 * layout.cc (Layout::include_section): Do not discard unrecognized
12219 SHT_STRTAB sections.
12220
12221 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12222
12223 * script.cc (Lex::can_continue_name): Make '?' allowable in
12224 version-script names.
12225 * testsuite/version_script.map: Change glob pattern to use '?'
12226
12227 2008-06-30 Manish Singh <yosh@gimp.org>
12228
12229 PR 6585
12230 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12231 Correct typo.
12232
12233 2008-06-30 Ian Lance Taylor <iant@google.com>
12234
12235 PR 6660
12236 PR 6682
12237 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12238 versions]: Don't try to read the value in the contents, since we
12239 don't use it. Use the template endianness when writing.
12240
12241 2008-06-25 Cary Coutant <ccoutant@google.com>
12242
12243 * fileread.cc (File_read::make_view): Assert on zero-length view.
12244 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12245 symbol table when there are no symbols to read.
12246
12247 2008-06-23 Craig Silverstein <csilvers@google.com>
12248
12249 * version.cc (version_string): Bump to 1.7
12250
12251 2008-06-18 Craig Silverstein <csilvers@google.com>
12252
12253 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12254 constant 0xFFFF to type Valtype.
12255 (Powerpc_relocate_functions::rel16_ha): Likewise.
12256
12257 2008-06-17 Ian Lance Taylor <iant@google.com>
12258
12259 * output.h (Output_section::Input_section): Initialize p2align_ to
12260 zero for Output_section_data constructors.
12261 (Output_section::Input_section::addralign): If not an input
12262 section, return the alignment of the Output_section_data.
12263 * testsuite/copy_test.cc: New file.
12264 * testsuite/copy_test_1.cc: New file.
12265 * testsuite/copy_test_2.cc: New file.
12266 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12267 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12268 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12269 (copy_test_1_pic.o, copy_test_1.so): New targets.
12270 (copy_test_2_pic.o, copy_test_2.so): New targets.
12271 * testsuite/Makefile.in: Rebuild.
12272
12273 * script-sections.cc (Script_sections::place_orphan): Initialize
12274 local variable exact.
12275
12276 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12277
12278 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12279
12280 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12281 David S. Miller <davem@davemloft.net>
12282
12283 * powerpc.cc: New file.
12284 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12285 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12286 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12287 * Makefile.in: Rebuild.
12288
12289 2008-06-09 Ian Lance Taylor <iant@google.com>
12290
12291 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12292 <exception>.
12293 (throwing, orig_terminate): New static variables.
12294 (terminate_handler): New static function.
12295 (t2): Set terminate handler.
12296
12297 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12298
12299 PR 6584
12300 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12301 alignment.
12302
12303 2008-05-30 Cary Coutant <ccoutant@google.com>
12304
12305 * archive.cc (Archive::include_all_members) Correct to step
12306 over symbol table and extended name table in thin archives.
12307
12308 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12309
12310 PR 6407
12311 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12312 calculation.
12313
12314 2008-05-28 Caleb Howe <cshowe@google.com>
12315
12316 * reduced_debug_output.cc: New file.
12317 * reduced_debug_output.h: New file.
12318 * options.h (class General_options): Add --strip-debug-non-line.
12319 * options.cc (General_options::finalize): Add strip_debug_non_line
12320 to the strip heirarchy.
12321 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12322 fields.
12323 * layout.cc: Include "reduced_debug_output.h".
12324 (Layout::Layout): Initialize new fields.
12325 (line_only_debug_sections): New static array.
12326 (is_lines_only_debug_sections): New static inline function.
12327 (Layout::include_section): Handle --strip-debug-non-line.
12328 (Layout::make_output_section): If --strip-debug-non-line, build
12329 new output sections for .debug_abbrev and .debug_info.
12330 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12331 gold. Warn about possible overflow.
12332 (read_signed_LEB_128): Likewise.
12333 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12334 (read_signed_LEB_128): Declare.
12335 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12336 (HFILES): Add reduced_debug_output.h.
12337 * Makefile.in: Rebuild.
12338
12339 2008-05-21 Ian Lance Taylor <iant@google.com>
12340
12341 * mapfile.cc: New file.
12342 * mapfile.h: New file.
12343 * options.h (class General_options): Add -M/--print-map and -Map.
12344 * options.cc (General_options::finalize): Make -M equivalent to
12345 -Map -.
12346 * main.cc: Include <cstdio> and "mapfile.h".
12347 (main): Open mapfile if requested.
12348 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12349 constructor. Change caller.
12350 (queue_initial_tasks): Add mapfile parameter. Change caller.
12351 (queue_middle_tasks): Likewise.
12352 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12353 declarations.
12354 * archive.cc: Include "mapfile.h".
12355 (Archive::add_symbols): Add mapfile parameter. Change all
12356 callers. Pass mapfile, symbol, and reason to include_member.
12357 (Archive::include_all_members): Add mapfile parameter. Change all
12358 callers.
12359 (Archive::include_member): Add mapfile, sym, and why parameters.
12360 Change all callers. Report inclusion to map file.
12361 * archive.h: Include "fileread.h".
12362 (class Archive): Update declarations.
12363 (Archive::file): New const method.
12364 (class Add_archive_symbols): Add mapfile_ field. Update
12365 constructor. Change all callers.
12366 * readsyms.h (class Read_symbols): Likewise.
12367 (class Finish_group): Likewise.
12368 (class Read_script): Likewise.
12369 * common.cc: Include "mapfile.h".
12370 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12371 all callers.
12372 (Symbol_table::do_allocate_commons): Likewise.
12373 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12374 symbol allocation to mapfile.
12375 * common.h (class Allocate_commons_task): Add mapfile_ field.
12376 Update constructor. Change all callers.
12377 * symtab.h (class Symbol_table): Update declarations.
12378 * layout.cc: Include "mapfile.h".
12379 (Layout_task_runner::run): Print information to mapfile.
12380 (Layout::create_gold_note): Change Output_data_fixed_space to
12381 Output_data_zero_fill.
12382 (Layout::create_build_id): Likewise.
12383 (Layout::print_to_mapfile): New function.
12384 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12385 constructor. Change caller.
12386 (class Layout): Declare print_to_mapfile.
12387 * output.cc (Output_section::Input_section::print_to_mapfile): New
12388 function.
12389 (Output_section::add_input_section): If producing a map, always
12390 add to input_sections_ list.
12391 (Output_section::do_print_to_mapfile): New function.
12392 (Output_segment::print_sections_to_mapfile): New function.
12393 (Output_segment::print_section_list_to_mapfile): New function.
12394 * output.h: Include "mapfile.h".
12395 (Output_data::print_to_mapfile): New function.
12396 (Output_data::do_print_to_mapfile): New virtual function.
12397 (Output_segment_headers::do_print_to_mapfile): New function.
12398 (Output_file_header::do_print_to_mapfile): New function.
12399 (Output_data_const::do_print_to_mapfile): New function.
12400 (class Output_data_const_buffer): Add map_name_ field. Update
12401 constructor. Change all callers. Add do_print_to_mapfile
12402 function.
12403 (class Output_data_fixed_space): Likewise.
12404 (class Output_data_space): Likewise.
12405 (class Output_data_zero_fill): New class.
12406 (Output_data_strtab::do_print_to_mapfile): New function.
12407 (Output_data_reloc_base::do_print_to_mapfile): New function.
12408 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12409 (Output_data_group::do_print_to_mapfile): New function.
12410 (Output_data_got::do_print_to_mapfile): New function.
12411 (Output_data_dynamic::do_print_to_mapfile): New function.
12412 (Output_symtab_xindex::do_print_to_mapfile): New function.
12413 (class Output_section): Declare do_print_to_mapflie. Declare
12414 print_to_mapfile in Input_section.
12415 (class Output_segment): Declare new functions.
12416 * object.h (Sized_relobj::symbol_count): New function.
12417 * script-sections.cc
12418 (Output_section_element_dot_assignment::set_section_addresses):
12419 Change Output_data_fixed_space to Output_data_zero_fill.
12420 (Output_data_expression::do_print_to_mapfile): New function.
12421 * script.cc (read_input_script): Add mapfile parameter. Change
12422 all callers.
12423 * script.h (read_input_script): Update declaration.
12424 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12425 (Eh_frame::do_print_to_mapfile): New function.
12426 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12427 (Output_merge_string::do_print_to_mapfile): New function.
12428 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12429 function.
12430 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12431 function.
12432 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12433 function.
12434 * Makefile.am (CCFILES): Add mapfile.cc.
12435 (HFILES): Add mapfile.h.
12436 * Makefile.in: Rebuild.
12437
12438 2008-05-19 Ian Lance Taylor <iant@google.com>
12439
12440 * options.h (class General_options): Add -z relro.
12441 * layout.cc (Layout::Layout): Initialize relro_segment_.
12442 (Layout::add_output_section_data): Return the output section.
12443 (Layout::make_output_section): Rcognize relro sections and mark
12444 them appropriately.
12445 (Layout::attach_allocated_section_to_segment): Put relro sections
12446 in a PT_GNU_RELRO segment.
12447 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12448 section as relro.
12449 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12450 PT_TLS segments.
12451 (Layout::linkonce_mapping): Map d.rel.ro.local to
12452 .data.rel.ro.local.
12453 (Layout::output_section_name): Us .data.rel.ro.local for any
12454 section which begins with that.
12455 * layout.h (class Layout): Update add_output_section_data
12456 declaration. Add relro_segment_ field.
12457 * output.cc (Output_section::Output_section): Initialize is_relro_
12458 and is_relro_local_ fields.
12459 (Output_segment::add_output_section): Group relro sections.
12460 (Output_segment::is_first_section_relro): New function.
12461 (Output_segment::maximum_alignment): If there is a relro section,
12462 align the segment to the common page size.
12463 (Output_segment::set_section_addresses): Track whether we are
12464 looking at relro sections. If the last section is a relro
12465 section, align to the common page size.
12466 (Output_segment::set_section_list_addresses): Add in_relro
12467 parameter. Change all callers. Align to the page size when
12468 moving from relro to non-relro section.
12469 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12470 segment.
12471 * output.h (class Output_section): Add is_relro_ and
12472 is_relro_local_ fields.
12473 (Output_section::is_relro): New function.
12474 (Output_section::set_is_relro): New function.
12475 (Output_section::is_relro_local): New function.
12476 (Output_section::set_is_relro_local): New function.
12477 (class Output_segment): Update declarations.
12478 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12479 * sparc.cc (Target_sparc::got_section): Likewise.
12480 * x86_64.cc (Target_x86_64::got_section): Likewise.
12481 * testsuite/relro_test_main.cc: New file.
12482 * testsuite/relro_test.cc: New file.
12483 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12484 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12485 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12486 (relro_test.so, relro_test_pic.o): New targets.
12487 * testsuite/Makefile.in: Rebuild.
12488
12489 2008-05-16 Ian Lance Taylor <iant@google.com>
12490
12491 * output.cc (Output_segment::add_output_section): Remove front
12492 parameter.
12493 * output.h (class Output_segment): Remove
12494 add_initial_output_section and overloaded add_output_section.
12495 Update declaration of remaining add_output_section.
12496 * layout.cc (Layout::create_interp): Call add_output_section
12497 rather than add_initial_output_section.
12498 (Layout::finish_dynamic_section): Likewise.
12499
12500 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12501 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12502 know the dynamic type.
12503 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12504 field. Initialize it in constructor.
12505 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12506 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12507 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12508 reloc.
12509
12510 * output.cc (Output_reloc::get_address): Change return type to
12511 Elf_Addr.
12512 * output.h (class Output_reloc): Update get_address declaration.
12513 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12514 for section addresses.
12515
12516 2008-05-09 Ian Lance Taylor <iant@google.com>
12517
12518 PR 6493
12519 * gold.cc (gold_nomem): Use return value of write.
12520
12521 2008-05-08 Ian Lance Taylor <iant@google.com>
12522
12523 * symtab.c (Symbol::init_base_output_data): Add version
12524 parameter. Change all callers.
12525 (Symbol::init_base_output_segment): Likewise.
12526 (Symbol::init_base_constant): Likewise.
12527 (Symbol::init_base_undefined): Likewise.
12528 (Sized_symbol::init_output_data): Likewise.
12529 (Sized_symbol::init_output_segment): Likewise.
12530 (Sized_symbol::init_constant): Likewise.
12531 (Sized_symbol::init_undefined): Likewise.
12532 (Symbol_table::do_define_in_output_data): If the new symbol has a
12533 version, mark it as the default.
12534 (Symbol_table::do_define_in_output_segment): Likewise.
12535 (Symbol_table::do_define_as_constant): Likewise.
12536 * symtab.h (class Symbol): Update declarations.
12537 (class Sized_symbol): Likewise.
12538 * resolve.cc (Symbol::override_version): New function.
12539 (Symbol::override_base): Call override_version.
12540 (Symbol::override_base_with_special): Likewise.
12541 * testsuite/ver_script_8.script: New file.
12542 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12543 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12544 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12545 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12546
12547 2008-05-06 Ian Lance Taylor <iant@google.com>
12548
12549 PR 6049
12550 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12551 functions.
12552 (class General_options): Remove existing --undefined, and add
12553 --no-undefined instead. Add new --undefined as synonym for -u.
12554 * archive.cc (Archive::add_symbols): Check whether symbol was
12555 named with -u.
12556 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12557 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12558 all uses. Add IS_UNDEFINED. Update declarations to split
12559 different versions of init_base. Declare init_base_undefined.
12560 (Symbol::is_defined): Handle IS_UNDEFINED.
12561 (Symbol::is_undefined): Likewise.
12562 (Symbol::is_weak_undefined): Call is_undefined.
12563 (Symbol::is_absolute): Handle IS_CONSTANT.
12564 (class Sized_symbol): Update declarations to split different
12565 versions of init. Declare init_undefined.
12566 (class Symbol_table): Declare new functions.
12567 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12568 Change all callers.
12569 (Symbol::init_base_output_data): Likewise.
12570 (Symbol::init_base_output_segment): Likewise.
12571 (Symbol::init_base_constant): Likewise.
12572 (Symbol::init_base_undefined): New function.
12573 (Sized_symbol::init_object): Rename from init. Change all
12574 callers.
12575 (Sized_symbol::init_output_data): Likewise.
12576 (Sized_symbol::init_output_segment): Likewise.
12577 (Sized_symbol::init_constant): Likewise.
12578 (Sized_symbol::init_undefined): New function.
12579 (Symbol_table::add_undefined_symbols_from_command_line): New
12580 function.
12581 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12582 function.
12583 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12584 (Symbol::output_section): Likewise.
12585 (Symbol::set_output_section): Likewise.
12586 (Symbol_table::sized_finalize_symbol): Likewise.
12587 (Symbol_table::sized_write_globals): Likewise.
12588 * resolve.cc (Symbol_table::should_override): Likewise.
12589 (Symbol::override_base_with_special): Likewise.
12590
12591 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12592 symbol, change it to have default visibility.
12593 * testsuite/protected_1.cc: New file.
12594 * testsuite/protected_2.cc: New file.
12595 * testsuite/protected_3.cc: New file.
12596 * testsuite/protected_main_1.cc: New file.
12597 * testsuite/protected_main_2.cc: New file.
12598 * testsuite/protected_main_3.cc: New file.
12599 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12600 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12601 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12602 (protected_1.so): New target.
12603 (protected_1_pic.o, protected_2_pic.o): New targets.
12604 (protected_3_pic.o): New target.
12605 (check_PROGRAMS): Add protected_2.
12606 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12607 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12608 * testsuite/Makefile.in: Rebuild.
12609
12610 * options.h (DEFINE_var): Add set_user_set_##varname__.
12611 (DEFINE_bool_alias): New macro.
12612 (class General_options): Define -Bstatic using DEFINE_bool_alias
12613 rather than DEFINE_special. Add --undefined as an alias for -z
12614 defs.
12615 * options.cc (General_options::parse_Bstatic): Remove.
12616
12617 * options.h (class General_options): Add --fatal-warnings.
12618 * main.cc (main): Implement --fatal-warnings.
12619 * errors.h (Errors::warning_count): New function.
12620
12621 * options.h (class General_options): Add -Bsymbolic-functions.
12622 * symtab.h (Symbol::is_preemptible): Check for
12623 -Bsymbolic-functions.
12624
12625 2008-05-05 Ian Lance Taylor <iant@google.com>
12626
12627 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12628 as noVARNAME rather than no-VARNAME.
12629 (class General_options): Add option -z combreloc.
12630 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12631 get_address.
12632 (Output_reloc::sort_before) [SHT_REL]: New function.
12633 (Output_reloc::sort_before) [SHT_RELA]: New function.
12634 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12635 Sort_relocs_comparison.
12636 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12637 parameter. Change all callers.
12638 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12639 sort_relocs parameter. Change all callers.
12640 * output.cc (Output_reloc::get_address): New function, broken out
12641 of write_rel.
12642 (Output_reloc::write_rel): Call it.
12643 (Output_reloc::compare): New function.
12644 (Output_data_reloc_base::do_write): Optionally sort relocs.
12645
12646 * configure.ac: If targ_extra_obj is set, link it in.
12647 * configure.tgt: Initialize all variables.
12648 (x86_64*): Set targ_extra_obj and targ_extra_size.
12649 * configure: Rebuild.
12650
12651 * object.cc (Sized_relobj::include_section_group): Adjust section
12652 indexes read from group data. Build vector to pass to
12653 layout_group.
12654 * layout.cc (Layout::layout_group): Add flags and shndxes
12655 parameters. Remove contents parameter. Change caller. Update
12656 explicit instantiations.
12657 * layout.h (class Layout): Update layout_group declaration.
12658 * output.cc (Output_data_group::Output_data_group): Add flags and
12659 input_shndxes parameters. Remove contents parameter. Change
12660 caller.
12661 (Output_data_group::do_write): Change input_sections_ to
12662 input_shndxes_.
12663 * output.h (class Output_data_group): Update constructor
12664 declaration. Rename input_sections_ to input_shndxes_.
12665 * testsuite/many_sections_test.cc: Add template.
12666
12667 2008-04-30 Cary Coutant <ccoutant@google.com>
12668
12669 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12670
12671 * layout.cc (Layout::include_section): Refactored check for debug
12672 info section.
12673 (Layout::add_comdat): Add new parameters. Change type
12674 of signature parameter. Add object and shndx to signatures table.
12675 (Layout::find_kept_object): New function.
12676 * layout.h: Include <cstring>.
12677 (Layout::is_debug_info_section): New function.
12678 (Layout::add_comdat): Add new parameters.
12679 (Layout::find_kept_object): New function.
12680 (Layout::Kept_section): New struct.
12681 (Layout::Signatures): Change type of map range.
12682 * object.cc (Relobj::output_section_address): New function.
12683 (Sized_relobj::include_section_group): Add new parameters. Change
12684 calls to Layout::add_comdat. Change to build table of kept comdat
12685 groups and table mapping discarded sections to kept sections.
12686 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12687 (Sized_relobj::do_layout): Change calls to include_section_group and
12688 include_linkonce_section.
12689 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12690 value to zero when section is discarded.
12691 (Sized_relobj::map_to_kept_section): New function.
12692 * object.h (Relobj::output_section_address): New function.
12693 (Relobj::Comdat_group): New type.
12694 (Relobj::find_comdat_group): New function.
12695 (Relobj::Comdat_group_table): New type.
12696 (Relobj::Kept_comdat_section): New type.
12697 (Relobj::Kept_comdat_section_table): New type.
12698 (Relobj::add_comdat_group): New function.
12699 (Relobj::set_kept_comdat_section): New function.
12700 (Relobj::get_kept_comdat_section): New function.
12701 (Relobj::comdat_groups_): New field.
12702 (Relobj::kept_comdat_sections_): New field.
12703 (Symbol_value::input_value): Update comment.
12704 (Sized_relobj::map_to_kept_section) New function.
12705 (Sized_relobj::include_linkonce_section): Add new parameter.
12706 * target-reloc.h (Comdat_behavior): New type.
12707 (get_comdat_behavior): New function.
12708 (relocate_section): Add code to map a discarded section to the
12709 corresponding kept section when applying a relocation.
12710
12711 2008-04-30 Craig Silverstein <csilvers@google.com>
12712
12713 * dwarf_reader.cc (next_generation_count): New static var.
12714 (Addr2line_cache_entry): New struct.
12715 (addr2line_cache): New static var.
12716 (Dwarf_line_info::one_addr2line): Added caching.
12717 (Dwarf_line_info::clear_addr2line_cache): New function.
12718 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12719 cache-size parameter.
12720 (Dwarf_line_info::one_addr2line_cache): New function.
12721 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12722 new cache-size argument to one_addr2line(), and clear cache.
12723
12724 2008-04-28 Cary Coutant <ccoutant@google.com>
12725
12726 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12727 R_386_PC8 relocations.
12728
12729 2008-04-23 Ian Lance Taylor <iant@google.com>
12730
12731 * object.cc (Sized_relobj::include_section_group): Check for
12732 invalid section group.
12733
12734 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12735 header size.
12736
12737 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12738 than read for file header.
12739 * archive.cc (Archive::include_member): Likewise.
12740
12741 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12742
12743 * aclocal.m4: Regenerate.
12744 * configure: Regenerate.
12745
12746 2008-04-19 Ian Lance Taylor <iant@google.com>
12747
12748 * version.cc (version_string): Bump to 1.6.
12749
12750 * testsuite/Makefile.am (many_sections_r_test): New target.
12751 (many_sections_r_test_SOURCES): Remove.
12752 (many_sections_r_test_DEPENDENCIES): Remove.
12753 (many_sections_r_test_LDFLAGS): Remove.
12754 (many_sections_r_test_LDADD): Remove.
12755
12756 * object.cc (Sized_relobj::do_add_symbols): Always pass
12757 local_symbol_count_ to add_from_relobj.
12758
12759 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12760 every thousand variables.
12761 * testsuite/Makefile.in: Rebuild.
12762
12763 * object.cc (Xindex::initialize_symtab_xindex): New function.
12764 (Xindex::read_symtab_xindex): New function.
12765 (Xindex::sym_xindex_to_shndx): New function.
12766 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12767 available.
12768 (Sized_relobj::do_initialize_xindex): New function.
12769 (Sized_relobj::do_read_symbols): Adjust section links.
12770 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12771 parameter. Change all callers.
12772 (Sized_relobj::include_section_group): Adjust section links and
12773 symbol section indexes.
12774 (Sized_relobj::do_layout): Adjust section links.
12775 (Sized_relobj::do_count_local_symbols): Adjust section links and
12776 symbol section indexes.
12777 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12778 ordinary and special symbols.
12779 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12780 dynsym_xindex parameters. Change all callers. Adjust section
12781 links. Use SHN_XINDEX when needed.
12782 (Sized_relobj::get_symbol_location_info): Adjust section links.
12783 Don't get fooled by special symbols.
12784 * object.h (class Xindex): Define.
12785 (class Object): Add xindex_ parameter. Declare virtual functoin
12786 do_initialize_xindex.
12787 (Object::adjust_sym_shndx): New function.
12788 (Object::set_xindex): New protected function.
12789 (class Symbol_value): Add is_ordinary_shndx_ field.
12790 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12791 (Symbol_value::value): Assert ordinary section.
12792 (Symbol_value::initialize_input_to_output_map): Likewise.
12793 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12794 Change all callers.
12795 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12796 all callers.
12797 (class Sized_relobj): Update declarations.
12798 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12799 parameter. Change all callers.
12800 (Sized_relobj::adjust_shndx): New function.
12801 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12802 field.
12803 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12804 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12805 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12806 (Sized_dynobj::read_dynsym_section): Adjust section links.
12807 (Sized_dynobj::read_dynamic): Likewise.
12808 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12809 section links.
12810 (Sized_dynobj::do_initialize_xindex): New function.
12811 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12812 do_initialize_xindex.
12813 (Sized_dynobj::adjust_shndx): New function.
12814 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12815 dynsym_xindex_ fields.
12816 (Layout::finalize): Add a call to set_section_indexes before
12817 creating the symtab sections.
12818 (Layout::set_section_indexes): Don't do anything if the section
12819 already has a section index.
12820 (Layout::create_symtab_sections): Add shnum parameter. Change
12821 caller. Create .symtab_shndx section if needed.
12822 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12823 caller.
12824 (Layout::allocated_output_section_count): New function.
12825 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12826 needed.
12827 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12828 fields. Update declarations.
12829 (Layout::symtab_xindex): New function.
12830 (Layout::dynsym_xindex): New function.
12831 (class Write_symbols_task): Add layout_ field.
12832 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12833 Change caller.
12834 * output.cc (Output_section_headers::Output_section_headers): Add
12835 shstrtab_section parameter. Change all callers.
12836 (Output_section_headers::do_sized_write): Store overflow values
12837 for section count and section string table section index in
12838 section header zero.
12839 (Output_file_header::do_sized_write): Check for overflow of
12840 section count and section string table section index.
12841 (Output_symtab_xindex::do_write): New function.
12842 (Output_symtab_xindex::endian_do_write): New function.
12843 * output.h (class Output_section_headers): Add shstrtab_section_.
12844 Update declarations.
12845 (class Output_symtab_xindex): Define.
12846 (Output_section::has_out_shndx): New function.
12847 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12848 field.
12849 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12850 Change all callers.
12851 (Sized_symbol::init): Likewise.
12852 (Symbol::output_section): Check for ordinary symbol.
12853 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12854 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12855 callers.
12856 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12857 Change all callers. Simplify handling of symbols from sections
12858 not included in the link.
12859 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12860 distinction.
12861 (Weak_alias_sorter::operator()): Assert that symbols are
12862 ordinary.
12863 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12864 distinction.
12865 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12866 parameters. Change all callers.
12867 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12868 symbol distinction. Use SHN_XINDEX when needed.
12869 (Symbol_table::write_section_symbol): Add symtab_xindex
12870 parameter. Change all callers.
12871 (Symbol_table::sized_write_section_symbol): Likewise. Use
12872 SHN_XINDEX when needed.
12873 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12874 declarations.
12875 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12876 (Symbol::is_defined): Check is_ordinary.
12877 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12878 (Symbol::is_absolute, Symbol::is_common): Likewise.
12879 (class Sized_symbol): Update declarations.
12880 (class Symbol_table): Update declarations.
12881 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12882 parameters. Change all callers.
12883 (Sized_symbol::override): Likewise.
12884 (Symbol_table::override): Likewise.
12885 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12886 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12887 is_ordinary, and orig_st_shndx parameters. Change all callers.
12888 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12889 to be in an ordinary section.
12890 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12891 object and is_ordinary parameters. Change all callers.
12892 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12893 Change all callers. Don't add undefined or non-ordinary symbols
12894 to reloc_map_.
12895 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12896 Change all callers.
12897 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12898 declarations.
12899 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12900 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12901 (Sized_relobj::relocate_sections): Likewise.
12902 * target-reloc.h (scan_relocs): Adjust section symbol index.
12903 (scan_relocatable_relocs): Likewise.
12904 * i386.cc (Scan::local): Check for ordinary symbols.
12905 * sparc.cc (Scan::local): Likewise.
12906 * x86_64.cc (Scan::local): Likewise.
12907 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12908 to symbol_section_and_value.
12909 * testsuite/many_sections_test.cc: New file.
12910 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12911 (check_PROGRAMS): Add many_sections_test.
12912 (many_sections_test_SOURCES): Define.
12913 (many_sections_test_DEPENDENCIES): Define.
12914 (many_sections_test_LDFLAGS): Define.
12915 (BUILT_SOURCES): Add many_sections_define.h.
12916 (many_sections_define.h): New target.
12917 (BUILT_SOURCES): Add many_sections_check.h.
12918 (many_sections_check.h): New target.
12919 (check_PROGRAMS): Add many_sections_r_test.
12920 (many_sections_r_test_SOURCES): Define.
12921 (many_sections_r_test_DEPENDENCIES): Define.
12922 (many_sections_r_test_LDFLAGS): Define.
12923 (many_sections_r_test_LDADD): Define.
12924 (many_sections_r_test.o): New target.
12925 * testsuite/Makefile.in: Rebuild.
12926
12927 2008-04-17 Cary Coutant <ccoutant@google.com>
12928
12929 * errors.cc (Errors::info): New function.
12930 (gold_info): New function.
12931 * errors.h (Errors::info): New function.
12932 * gold.h (gold_info): New function.
12933 * object.cc (Input_objects::add_object): Print trace output.
12934 * options.cc (options::parse_set): New function.
12935 (General_options::parse_wrap): Deleted.
12936 (General_options::General_options): Deleted initializer.
12937 * options.h (options::String_set): New typedef.
12938 (options::parse_set): New function.
12939 (DEFINE_set): New macro.
12940 (General_options::wrap): Changed to use DEFINE_set. Changed
12941 callers of any_wrap_symbols and is_wrap_symbol.
12942 (General_options::trace, General_options::trace_symbol):
12943 New options.
12944 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12945 (General_options::wrap_symbols_): Deleted.
12946 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12947
12948 2008-04-17 David S. Miller <davem@davemloft.net>
12949
12950 * options.cc (General_options::parse_V): New function.
12951 * options.h: Add entries for -V and -Qy.
12952
12953 2008-04-17 Ian Lance Taylor <iant@google.com>
12954
12955 * common.cc (Symbol_table::allocate_commons): Remove options
12956 parameter. Change caller.
12957 (Symbol_table::do_allocate_commons): Remove options parameter.
12958 Change caller. Just call do_allocate_commons_list twice.
12959 (Symbol_table::do_allocate_commons_list): New function, broken out
12960 of do_allocate_commons.
12961 * common.h (class Allocate_commons_task): Remove options_ field.
12962 Update constructor.
12963 * symtab.cc (Symbol_table::Symbol_table): Initialize
12964 tls_commons_.
12965 (Symbol_table::add_from_object): Put TLS common symbols on
12966 tls_commons_ list.
12967 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12968 which are IN_OUTPUT_DATA.
12969 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12970 allocate_commons and do_allocate_commons declarations. Declare
12971 do_allocate_commons_list.
12972 * gold.cc (queue_middle_tasks): Update creation of
12973 Allocate_commons_task to not pass options.
12974 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12975 (TLS_TEST_C_FLAGS): New variable.
12976 (tls_test_c_pic.o): New target.
12977 (tls_test_shared.so): Link in tls_test_c_pic.o.
12978 (tls_test_c_pic_ie.o): New target.
12979 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12980 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12981 (tls_test_c.o): New target.
12982 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12983 (tls_pic_test_LDADD): Likewise.
12984 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12985 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12986 (tls_test_c_gnu2.o): New target.
12987 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12988 tls_test_c_gnu2.o.
12989 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12990 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12991 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12992 * testsuite/tls_test.cc: Include "config.h".
12993 (t_last): Call t11_last.
12994 * testsuite/tls_test.h (t11, t11_last): Declare.
12995 * testsuite/tls_test_c.c: New file.
12996 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12997 * configure.ac: Check for OpenMP support.
12998 * configure, config.in, Makefile.in: Rebuild.
12999 * testsuite/Makefile.in: Rebuild.
13000
13001 2008-04-16 Cary Coutant <ccoutant@google.com>
13002
13003 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13004 (Target_i386::tls_base_symbol_defined_): New field.
13005 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13006 (Target_i386::Scan::global): Likewise.
13007 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13008 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13009 (Target_x86_64::tls_base_symbol_defined_): New field.
13010 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13011 (Target_x86_64::Scan::global): Likewise.
13012
13013 2008-04-16 Cary Coutant <ccoutant@google.com>
13014
13015 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13016 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13017 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13018 building shared libraries.
13019 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13020 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13021 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13022 * testsuite/Makefile.in: Rebuild.
13023 * testsuite/weak_undef.h: New file.
13024 * testsuite/weak_undef_file1.cc: Add extra test cases.
13025 * testsuite/weak_undef_file2.cc: Likewise.
13026 * testsuite/weak_undef_test.cc: Likewise.
13027
13028 2008-04-16 David S. Miller <davem@davemloft.net>
13029
13030 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13031 Add issued_non_pic_error_ field. Declare check_non_pic.
13032 (Target_sparc::Scan::check_non_pic): New function.
13033 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13034 (Target_sparc::Scan::global): Likewise.
13035
13036 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13037 * configure: Rebuild.
13038
13039 * options.h (DEFINE_enable): New macro.
13040 (new_dtags): New enable option.
13041 (initfirst, interpose, loadfltr, nodefaultlib,
13042 nodelete, nodlopen, nodump): New -z options.
13043 * layout.cc (Layout:finish_dynamic_section): If new
13044 dtags enabled, emit DT_RUNPATH. Also, emit a
13045 DT_FLAGS_1 containing any specified -z flags.
13046
13047 2008-04-16 Ian Lance Taylor <iant@google.com>
13048
13049 * copy-relocs.cc: New file.
13050 * copy-relocs.h: New file.
13051 * reloc.cc: Remove Copy_relocs code.
13052 * reloc.h: Likewise.
13053 * reloc-types.h (struct Reloc_types) [both versions]: Add
13054 get_reloc_addend_noerror.
13055 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13056 variants of add_global which take an addend which must be zero.
13057 * i386.cc: Include "copy-relocs.h".
13058 (class Target_i386): Change type of copy_relocs_ to variable,
13059 update initializer.
13060 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13061 Change all callers.
13062 (Target_i386::do_finalize_sections): Change handling of
13063 copy_relocs_.
13064 * sparc.cc: Include "copy-relocs.h".
13065 (class Target_sparc): Change type of copy_relocs_ to variable,
13066 update initializer.
13067 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13068 Change all callers.
13069 (Target_sparc::do_finalize_sections): Change handling of
13070 copy_relocs_.
13071 * x86_64.cc: Include "copy-relocs.h".
13072 (class Target_x86_64): Change type of copy_relocs_ to variable,
13073 update initializer.
13074 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13075 class. Change all callers.
13076 (Target_x86_64::do_finalize_sections): Change handling of
13077 copy_relocs_.
13078 * Makefile.am (CCFILES): Add copy-relocs.cc.
13079 (HFILES): Add copy-relocs.h.
13080
13081 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13082
13083 * testsuite/script_test_4.sh: Permit leading zeroes.
13084
13085 2008-04-15 Ian Lance Taylor <iant@google.com>
13086
13087 * script-sections.cc (Script_sections::create_segments): Use
13088 header_size_adjustment even when there is enough room for the
13089 headers.
13090 * testsuite/script_test_4.sh: New file.
13091 * testsuite/script_test_4.t: New file.
13092 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13093 (check_DATA): Add script_test_4.stdout.
13094 (MOSTLYCLEANFILES): Likewise.
13095 (script_test_4): New target.
13096 (script_test_4.stdout): New target.
13097 * testsuite/Makefile.in: Rebuild.
13098
13099 * sparc.cc: Add definitions for Output_data_plt_sparc class
13100 constants.
13101
13102 2008-04-14 David S. Miller <davem@davemloft.net>
13103
13104 * sparc.cc: New file.
13105 * Makefile.am (TARGETSOURCES): Add sparc.cc
13106 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13107 * configure.tgt: Document targ_extra_size and
13108 targ_extra_big_endian. Add entries for sparc-* and
13109 sparc64-*.
13110 * configure.ac: Handle targ_extra_size and
13111 targ_extra_big_endian.
13112 * Makefile.in: Rebuild.
13113 * configure: Likewise.
13114 * po/POTFILES.in: Likewise.
13115 * po/gold.pot: Likewise.
13116
13117 2008-04-14 Ian Lance Taylor <iant@google.com>
13118
13119 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13120 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13121 in the name/type/flags to section mapping. Don't call
13122 allocate_output_section.
13123 (Layout::choose_output_section): Change parameter from adjust_name
13124 to is_input_section. Don't permit input sections after sections
13125 are attached to segments. Don't call allocate_output_section.
13126 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13127 not write_enable_output_section.
13128 (Layout::make_output_section): Don't push to
13129 unattached_section_list_ nor call attach_to_segment. Call
13130 attach_section_to_segment if sections are attached.
13131 (Layout::attach_sections_to_segments): New function.
13132 (Layout::attach_section_to_segment): New function.
13133 (Layout::attach_allocated_section_to_segment): Rename from
13134 attach_to_segment. Remove flags parameter.
13135 (Layout::allocate_output_section): Remove function.
13136 (Layout::write_enable_output_section): Remove function.
13137 * layout.h (class Layout): Update for above changes. Add new
13138 field sections_are_attached_.
13139 * output.h (Output_section::update_flags_for_input_section): New
13140 function.
13141 * output.cc (Output_section::add_input_section): Call
13142 update_flags_for_input_section.
13143 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13144
13145 2008-04-11 Cary Coutant <ccoutant@google.com>
13146
13147 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13148 thought unnecessary.
13149 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13150
13151 2008-04-11 Ian Lance Taylor <iant@google.com>
13152
13153 * output.h (class Output_section_data): Remove inline definition
13154 of set_addralign.
13155 * output.cc (Output_section_data::set_addralign): New function.
13156
13157 2008-04-11 Cary Coutant <ccoutant@google.com>
13158
13159 Add support for TLS descriptors for i386 and x86_64.
13160 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13161 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13162 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13163 GOT_TYPE_TLS_DESC.
13164 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13165 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13166 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13167 relocations.
13168 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13169 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13170 Fix problem with initial-exec relocations.
13171 (Target_i386::Relocate::relocate_tls): Likewise.
13172 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13173 relaxation.
13174 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13175 support for section-plus-offset dynamic table entries.
13176 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13177 (Output_data_dynamic::Dynamic_entry): Add support for
13178 section-plus-offset dynamic table entries.
13179 (Output_data_dynamic::Classification): Likewise.
13180 (Output_data_dynamic::classification_): Renamed offset_.
13181 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13182 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13183 (Target_x86_64::make_plt_section): New function.
13184 (Target_x86_64::reserve_tlsdesc_entries): New function.
13185 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13186 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13187 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13188 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13189 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13190 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13191 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13192 add extra PLT entry for TLS descriptors.
13193 (Output_data_plt_x86_64::got_): New field.
13194 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13195 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13196 fields.
13197 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13198 descriptors.
13199 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13200 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13201 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13202 R_386_TLS_DESC_CALL relocations.
13203 (Target_x86_64::Scan::global): Likewise.
13204 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13205 for TLS descriptors.
13206 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13207 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13208 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13209 GD-to-IE relaxation.
13210 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13211 and TLS_DESCRIPTORS.
13212 * Makefile.in: Rebuild.
13213 * configure: Rebuild.
13214 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13215 (tls_test_shared2.so): New target.
13216 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13217 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13218 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13219 (tls_shared_gd_to_ie_test_LDADD): New variable.
13220 (tls_shared_gnu2_gd_to_ie_test): New target.
13221 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13222 New targets.
13223 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13224 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13225 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13226 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13227 (tls_shared_gnu2_test): New target.
13228 (tls_test_gnu2_shared.so): New target.
13229 (tls_shared_gnu2_test_SOURCES): New variable.
13230 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13231 (tls_shared_gnu2_test_LDFLAGS): New variable.
13232 (tls_shared_gnu2_test_LDADD): New variable.
13233 * testsuite/Makefile.in: Rebuild.
13234 * testsuite/Makefile.
13235
13236 2008-04-11 Ian Lance Taylor <iant@google.com>
13237
13238 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13239 justsyms.t.
13240 * testsuite/Makefile.in: Rebuild.
13241
13242 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13243 long.
13244 * testsuite/script_test_2.cc (main): Adjust test.
13245
13246 2008-04-11 David S. Miller <davem@davemloft.net>
13247 Ian Lance Taylor <iant@google.com>
13248
13249 * options.h (General_options): Add entries for '-Y' and
13250 '-relax'.
13251 * options.cc (General_options:finalize): If -Y was used, add those
13252 entries to the library path instead of the default "/lib" and
13253 "/usr/lib".
13254
13255 2008-04-11 David S. Miller <davem@davemloft.net>
13256
13257 * testsuite/justsyms.t: Start at 0x100.
13258 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13259 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13260 long.
13261 * testsuite/script_test_2.cc: Adjust string and section length
13262 checks.
13263
13264 2008-04-09 Ian Lance Taylor <iant@google.com>
13265
13266 PR gold/5996
13267 * script-sections.cc (Sections_element::allocate_to_segment): Add
13268 orphan parameter.
13269 (Output_section_definition::allocate_to_segment): Likewise.
13270 (Orphan_output_section::allocate_to_segment): Likewise.
13271 (Script_sections::attach_sections_using_phdrs_clause): Don't
13272 propagate non-PT_LOAD segments to orphan sections.
13273 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13274 readelf rather than objdump.
13275 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13276 .interp section and PT_INTERP segment are the same size.
13277 * testsuite/Makefile.in: Rebuild.
13278
13279 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13280 aliases for symbols defined in the same object.
13281 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13282 (weak_alias_test_SOURCES): New variable.
13283 (weak_alias_test_DEPENDENCIES): New variable.
13284 (weak_alias_test_LDFLAGS): New variable.
13285 (weak_alias_test_LDADD): New variable.
13286 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13287 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13288 (weak_alias_test_3.o): New target.
13289 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13290 * testsuite/weak_alias_test_main.cc: New file.
13291 * testsuite/weak_alias_test_1.cc: New file.
13292 * testsuite/weak_alias_test_2.cc: New file.
13293 * testsuite/weak_alias_test_3.cc: New file.
13294
13295 2008-04-08 Ian Lance Taylor <iant@google.com>
13296
13297 * options.h (class General_options): Add --noinhibit-exec option.
13298 * main.cc (main): Check --noinhibit-exec.
13299
13300 * options.h (class General_options): Define --wrap as a special
13301 option. Add wrap_symbols_ field.
13302 (General_options::any_wrap_symbols): New function.
13303 (General_options::is_wrap_symbol): New function.
13304 * options.cc (General_options::parse_wrap): New function.
13305 (General_options::General_options): Initialize wrap_symbols_.
13306 * symtab.cc (Symbol_table::wrap_symbol): New function.
13307 (Symbol_table::add_from_object): Handle --wrap.
13308 * symtab.h (class Symbol_table): Declare wrap_symbol.
13309 * target.h (Target::wrap_char): New function.
13310 (Target::Target_info): Add wrap_char field.
13311 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13312 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13313 * testsuite/testfile.cc (Target_test::test_target_info):
13314 Likewise.
13315
13316 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13317 there is one.
13318
13319 * layout.h (class Layout): Add added_eh_frame_data_ field.
13320 * layout.cc (Layout::Layout): Initialize new field.
13321 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13322 output section until we find a section we merged successfully.
13323 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13324 that the size be non-zero.
13325
13326 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13327 qualifier.
13328
13329 2008-04-08 Craig Silverstein <csilvers@google.com>
13330
13331 * configure.ac: Export new conditional variable HAVE_ZLIB.
13332 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13333 on HAVE_ZLIB.
13334 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13335 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13336
13337 2008-04-07 Ian Lance Taylor <iant@google.com>
13338
13339 * version.cc (version_string): Set to "1.5".
13340
13341 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13342 Add issued_non_pic_error_ field. Declare check_non_pic.
13343 (Target_x86_64::Scan::check_non_pic): New function.
13344 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13345 (Target_x86_64::Scan::global): Likewise.
13346
13347 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13348 addend parameter. Change caller. Handle merge sections.
13349 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13350 Address to Addend. Don't add in the result of
13351 local_section_offset, pass down the addend and use the returned
13352 value.
13353 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13354 Update declarations of local_section_offset and symbol_value.
13355 * testsuite/two_file_test_1.cc (t18): New function.
13356 * testsuite/two_file_test_2.cc (f18): New function.
13357 * testsuite/two_file_test_main.cc (main): Call t18.
13358 * testsuite/two_file_test.h (t18, f18): Declare.
13359
13360 * configure.ac: Don't test for objdump, c++filt, or readelf.
13361 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13362 conditionals.
13363 (TEST_READELF): New variable.
13364 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13365 (check_PROGRAMS): Add two_file_strip_test.
13366 (two_file_strip_test): New target.
13367 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13368 (two_file_same_shared_strip_test_SOURCES): New variable.
13369 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13370 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13371 (two_file_same_shared_strip_test_LDADD): New variable.
13372 (two_file_shared_strip.so): New target.
13373 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13374 (ver_test_5.syms, ver_test_7.syms): Likewise.
13375 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13376 (strip_test_3.stdout): Use TEST_OBJDUMP.
13377 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13378
13379 2008-04-04 Cary Coutant <ccoutant@google.com>
13380
13381 * symtab.h (Symbol::is_weak_undefined): New function.
13382 (Symbol::is_strong_undefined): New function.
13383 (Symbol::is_absolute): New function.
13384 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13385 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13386 absolute symbols.
13387 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13388 (weak_undef_test): New target.
13389 * testsuite/Makefile.in: Rebuild.
13390 * testsuite/weak_undef_file1.cc: New file.
13391 * testsuite/weak_undef_file2.cc: New file.
13392 * testsuite/weak_undef_test.cc: New file.
13393
13394 2008-04-03 Craig Silverstein <csilvers@google.com>
13395
13396 * compressed_output.h (class Output_compressed_section): Use
13397 unsigned buffer.
13398 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13399 add zlib header.
13400 (zlib_compressed_suffix): Removed.
13401 (Output_compressed_section::set_final_data_size): Use unsigned
13402 buffers.
13403 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13404 Fix linker invocation.
13405 (flagstest_o_specialfile_and_compress_debug_sections):
13406 Likewise.
13407 * testsuite/Makefile.in: Regenerated.
13408
13409 2008-04-02 David S. Miller <davem@davemloft.net>
13410
13411 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13412 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13413
13414 2008-04-02 Craig Silverstein <csilvers@google.com>
13415
13416 * TODO: New file.
13417
13418 2008-04-02 Ian Lance Taylor <iant@google.com>
13419
13420 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13421 parameters. Update for new key type to views_. Change all
13422 callers.
13423 (File_read::read): Adjust for byteshift in returned view.
13424 (File_read::add_view): New function, broken out of
13425 find_and_make_view.
13426 (File_read::make_view): New function, broken out of
13427 find_and_make_view.
13428 (File_read::find_or_make_view): Add offset and aligned
13429 parameters. Rewrite accordingly. Change all callers.
13430 (File_read::get_view): Add offset and aligned parameters. Adjust
13431 for byteshift in return value.
13432 (File_read::get_lasting_view): Likewise.
13433 * fileread.h (class File_read): Update declarations.
13434 (class File_read::View): Add byteshift_ field. Add byteshift to
13435 constructor. Add byteshift method.
13436 * archive.h (Archive::clear_uncached_views): New function.
13437 (Archive::get_view): Add aligned parameter. Change all callers.
13438 * object.h (Object::get_view): Add aligned parameter. Change all
13439 callers.
13440 (Object::get_lasting_view): Likewise.
13441
13442 * fileread.cc (File_read::release): Don't call clear_views if
13443 there are multiple objects.
13444 * fileread.h (File_read::clear_uncached_views): New function.
13445 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13446 on the archive.
13447
13448 2008-03-31 Cary Coutant <ccoutant@google.com>
13449
13450 Add thin archive support.
13451 * archive.cc (Archive::armagt): New const.
13452 (Archive::setup): Remove task parameter and calls to unlock.
13453 (Archive::unlock_nested_archives): New function.
13454 (Archive::read_header): Add nested_off parameter. Change
13455 all callers.
13456 (Archive::interpret_header): Likewise.
13457 (Archive::include_all_members): Change to handle thin
13458 archives.
13459 (Archive::include_member): Likewise.
13460 * archive.h (Archive::Archive): Add new parameters and
13461 initializers.
13462 (Archive::armagt): New const.
13463 (Archive::setup): Remove task parameter.
13464 (Archive::unlock_nested_archives): New function.
13465 (Archive::read_header): Add nested_off parameter.
13466 (Archive::interpret_header): Likewise.
13467 (Archive::Nested_archive_table): New typedef.
13468 (Archive::is_thin_archive_): New field.
13469 (Archive::nested_archives_): New field.
13470 (Archive::options_): New field.
13471 (Archive::dirpath_): New field.
13472 (Archive::task_): New field.
13473 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13474 for thin archives. Pass additional parameters to
13475 Archive::Archive. Unlock the archive file after calling
13476 Archive::setup.
13477
13478 2008-03-29 Ian Lance Taylor <iant@google.com>
13479
13480 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13481 version symbol to be local.
13482 * testsuite/ver_test_4.sh: New file.
13483 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13484 (check_DATA): Add ver_test_4.syms.
13485 (ver_test_4.syms): New target.
13486 * testsuite/Makefile.in: Rebuild.
13487
13488 * output.cc
13489 (Output_section::Input_section_sort_entry::has_priority): New
13490 function.
13491 (Output_section::Input_section_sort_entry::match_file_name): New
13492 function.
13493 (Output_section::Input_section_sort_entry::match_section_name):
13494 Remove.
13495 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13496 Remove.
13497 (Output_section::Input_section_sort_entry::match_section_file):
13498 Remove.
13499 (Output_section::Input_section_sort_compare::operator()): Rewrite
13500 using new Input_section_sort_entry functions. Sort crtbegin and
13501 crtend first. Sort sections with no priority before sections with
13502 a priority.
13503 * testsuite/initpri1.c (d3): Check j != 4.
13504 (cd5): New constructor/destructor function.
13505 (main): Check j != 2.
13506
13507 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13508 new symbol when resolving, don't call set_is_default.
13509 * testsuite/ver_test_7.cc: New file.
13510 * testsuite/ver_test_7.sh: New file.
13511 * testsuite/Makefile.am (ver_test_7.so): New target.
13512 (ver_test_7.o): New target.
13513 (check_SCRIPTS): Add ver_test_7.sh.
13514 (check_DATA): Add ver_test_7.syms.
13515 (ver_test_7.syms): New target.
13516
13517 2008-03-28 Ian Lance Taylor <iant@google.com>
13518
13519 * layout.cc (Layout::layout): If we see an input section with a
13520 name that needs sorting, set the must_sort flag for the output
13521 section.
13522 (Layout::make_output_section): If the name of the output section
13523 indicates that it might require sorting, set the may_sort flag.
13524 * output.h (Output_section::may_sort_attached_input_sections): New
13525 function.
13526 (Output_section::set_may_sort_attached_input_sections): New
13527 function.
13528 (Output_section::must_sort_attached_input_sections): New
13529 function.
13530 (Output_section::set_must_sort_attached_input_sections): New
13531 function.
13532 (class Output_section): Declare Input_section_sort_entry. Define
13533 Input_section_sort_compare. Declare
13534 sort_attached_input_sections. Add new fields:
13535 may_sort_attached_input_sections_,
13536 must_sort_attached_input_sections_,
13537 attached_input_sections_are_sorted_.
13538 * output.cc (Output_section::Output_section): Initialize new
13539 fields.
13540 (Output_section::add_input_section): Add an entry to
13541 input_sections_ if may_sort or must_sort are true.
13542 (Output_section::set_final_data_size): Call
13543 sort_attached_input_sections if necessary.
13544 (Output_section::Input_section_sort_entry): Define new class.
13545 (Output_section::Input_section_sort_compare::operator()): New
13546 function.
13547 (Output_section::sort_attached_input_sections): New function.
13548 * configure.ac: Check whether the compiler supports constructor
13549 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13550 * testsuite/initpri1.c: New file.
13551 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13552 CONSTRUCTOR_PRIORITY.
13553 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13554 (initpri1_LDFLAGS): New variable.
13555 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13556
13557 2008-03-27 Ian Lance Taylor <iant@google.com>
13558
13559 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13560 * testsuite/common_test_1.c: New file.
13561 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13562 (common_test_1_SOURCES): New variable.
13563 (common_test_1_DEPENDENCIES): New variable.
13564 (common_test_1_LDFLAGS): New variable.
13565
13566 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13567 and commons_ correctly when NAME/VERSION does not override
13568 NAME/NULL.
13569 * testsuite/ver_test_6.c: New file.
13570 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13571 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13572 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13573
13574 2008-03-26 Ian Lance Taylor <iant@google.com>
13575
13576 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13577 of an undefined symbol from a version script.
13578 * testsuite/Makefile.am (ver_test_5.so): New target.
13579 (ver_test_5.o): New target.
13580 (check_SCRIPTS): Add ver_test_5.sh.
13581 (check_DATA): Add ver_test_5.syms.
13582 (ver_test_5.syms): New target.
13583 * testsuite/ver_test_5.cc: New file.
13584 * testsuite/ver_test_5.script: New file.
13585 * testsuite/ver_test_5.sh: New file.
13586 * Makefile.in, testsuite/Makefile.in: Rebuild.
13587
13588 PR gold/5986
13589 Fix problems building gold with gcc 4.3.0.
13590 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13591 (gold_error_at_location, gold_warning_at_location): Use it.
13592 * configure.ac: Check whether we can compile and use a template
13593 function with a printf attribute.
13594 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13595 when jumping over bytes.
13596 * object.cc: Instantiate Object::read_section_data.
13597 * debug.h: Include <cstring>
13598 * dwarf_reader.cc: Include <algorithm>
13599 * main.cc: Include <cstring>.
13600 * options.cc: Include <cstring>.
13601 * output.cc: Include <cstring>.
13602 * script.cc: Include <cstring>.
13603 * script.h: Include <string>.
13604 * symtab.cc: Include <cstring> and <algorithm>.
13605 * target-select.cc: Include <cstring>.
13606 * version.cc: Include <string>.
13607 * testsuite/testmain.cc: Include <cstdlib>.
13608 * configure, config.in: Rebuild.
13609
13610 2008-03-25 Ian Lance Taylor <iant@google.com>
13611
13612 * options.cc: Include "../bfd/bfdver.h".
13613 (options::help): Print bug reporting address.
13614
13615 * version.cc (print_version): Adjust output for current value of
13616 BFD_VERSION_STRING.
13617
13618 * NEWS: New file.
13619
13620 * options.cc (options::help): Print list of supported targets.
13621 * target-select.h: Include <vector>.
13622 (class Target_selector): Make machine_, size_, and is_big_endian_
13623 fields const. Add bfd_name_ and instantiated_target_ fields.
13624 (Target_selector::Target_selector): Add bfd_name parameter.
13625 (Target_selector::recognize): Make non-virtual, call
13626 do_recognize.
13627 (Target_selector::recognize_by_name): Make non-virtual, call
13628 do_recognize_by_name.
13629 (Target_selector::supported_names): New function.
13630 (Target_selector::bfd_name): New function.
13631 (Target_selector::do_instantiate_target): New pure virtual
13632 function.
13633 (Target_selector::do_recognize): New virtual function.
13634 (Target_selector::do_recognize_by_name): New virtual function.
13635 (Target_selector::instantiate_target): New private function.
13636 (supported_target_names): Declare.
13637 * target-select.cc (Target_selector::Target_selector): Update for
13638 new parameter and fields.
13639 (select_target_by_name): Check that the name matches before
13640 calling recognize_by_name.
13641 (supported_target_names): New function.
13642 * i386.cc (class Target_selector_i386): Update Target_selector
13643 constructor call. Remove recognize and recognize_by_name. Add
13644 do_instantiate_target.
13645 * x86_64.cc (class Target_selector_x86_64): Likewise.
13646 * testsuite/testfile.cc (class Target_selector_test): Update for
13647 changes to Target_selector.
13648
13649 * README: Rewrite, with some notes on unsupported features.
13650
13651 2008-03-24 Cary Coutant <ccoutant@google.com>
13652
13653 * i386.cc (Target_i386::Got_type): New enum declaration.
13654 (Target_i386::Scan::local): Updated callers of Output_data_got
13655 member functions.
13656 (Target_i386::Scan::global): Likewise.
13657 (Target_i386::Relocate::relocate): Likewise.
13658 (Target_i386::Relocate::relocate_tls): Likewise.
13659 * object.h (Got_offset_list): New class.
13660 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13661 (Sized_relobj::local_got_offset): Likewise.
13662 (Sized_relobj::set_local_got_offset): Likewise.
13663 (Sized_relobj::local_has_tls_got_offset): Removed.
13664 (Sized_relobj::local_tls_got_offset): Removed.
13665 (Sized_relobj::set_local_tls_got_offset): Removed.
13666 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13667 * output.cc (Output_data_got::add_global): Added got_type parameter.
13668 (Output_data_got::add_global_with_rel): Likewise.
13669 (Output_data_got::add_global_with_rela): Likewise.
13670 (Output_data_got::add_global_pair_with_rel): New function.
13671 (Output_data_got::add_global_pair_with_rela): New function.
13672 (Output_data_got::add_local): Added got_type parameter.
13673 (Output_data_got::add_local_with_rel): Likewise.
13674 (Output_data_got::add_local_with_rela): Likewise.
13675 (Output_data_got::add_local_pair_with_rel): New function.
13676 (Output_data_got::add_local_pair_with_rela): New function.
13677 (Output_data_got::add_global_tls): Removed.
13678 (Output_data_got::add_global_tls_with_rel): Removed.
13679 (Output_data_got::add_global_tls_with_rela): Removed.
13680 (Output_data_got::add_local_tls): Removed.
13681 (Output_data_got::add_local_tls_with_rel): Removed.
13682 (Output_data_got::add_local_tls_with_rela): Removed.
13683 * output.h (Output_data_got::add_global): Added got_type parameter.
13684 (Output_data_got::add_global_with_rel): Likewise.
13685 (Output_data_got::add_global_with_rela): Likewise.
13686 (Output_data_got::add_global_pair_with_rel): New function.
13687 (Output_data_got::add_global_pair_with_rela): New function.
13688 (Output_data_got::add_local): Added got_type parameter.
13689 (Output_data_got::add_local_with_rel): Likewise.
13690 (Output_data_got::add_local_with_rela): Likewise.
13691 (Output_data_got::add_local_pair_with_rel): New function.
13692 (Output_data_got::add_local_pair_with_rela): New function.
13693 (Output_data_got::add_global_tls): Removed.
13694 (Output_data_got::add_global_tls_with_rel): Removed.
13695 (Output_data_got::add_global_tls_with_rela): Removed.
13696 (Output_data_got::add_local_tls): Removed.
13697 (Output_data_got::add_local_tls_with_rel): Removed.
13698 (Output_data_got::add_local_tls_with_rela): Removed.
13699 * resolve.cc (Symbol::override_base_with_special): Removed
13700 reference to has_got_offset_ field.
13701 * symtab.cc (Symbol::init_fields): Replaced initialization
13702 of got_offset_ with got_offsets_. Removed initialization
13703 of has_got_offset_
13704 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13705 (Symbol::got_offset): Likewise.
13706 (Symbol::set_got_offset): Likewise.
13707 (Symbol::has_tls_got_offset): Removed.
13708 (Symbol::tls_got_offset): Removed.
13709 (Symbol::set_tls_got_offset): Removed.
13710 (Symbol::got_offset_): Removed.
13711 (Symbol::tls_mod_got_offset_): Removed.
13712 (Symbol::tls_pair_got_offset_): Removed.
13713 (Symbol::got_offsets_): New field.
13714 (Symbol::has_got_offset): Removed.
13715 (Symbol::has_tls_mod_got_offset): Removed.
13716 (Symbol::has_tls_pair_got_offset): Removed.
13717 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13718 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13719 member functions.
13720 (Target_x86_64::Scan::global): Likewise.
13721 (Target_x86_64::Relocate::relocate): Likewise.
13722 (Target_x86_64::Relocate::relocate_tls): Likewise.
13723
13724 2008-03-25 Ben Elliston <bje@au.ibm.com>
13725
13726 * yyscript.y: Fix spelling error in comment.
13727
13728 2008-03-24 Ian Lance Taylor <iant@google.com>
13729
13730 * options.h (class General_options): Define build_id option.
13731 * layout.h (class Layout): Declare write_build_id, create_note,
13732 create_build_id. Add build_id_note_ member.
13733 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13734 "libiberty.h", "md5.h", "sha1.h".
13735 (Layout::Layout): Initialize eh_frame_data_,
13736 eh_frame_hdr_section_, and build_id_note_.
13737 (Layout::finalize): Call create_build_id.
13738 (Layout::create_note): New function, broken out of
13739 Layout::create_gold_note.
13740 (Layout::create_gold_note): Call create_note.
13741 (Layout::create_build_id): New function.
13742 (Layout::write_build_id): New function.
13743 (Close_task_runner::run): Call write_build_id.
13744
13745 * x86_64.cc: Correct license to GPLv3.
13746
13747 2008-03-23 Ian Lance Taylor <iant@google.com>
13748
13749 * options.cc: Include "demangle.h".
13750 (parse_optional_string): New function.
13751 (parse_long_option): Handle takes_optional_argument.
13752 (parse_short_option): Update dash_z initializer. Handle
13753 takes_optional_argument.
13754 (General_options::General_options): Initialize do_demangle_.
13755 (General_options::finalize): Set do_demangle_. Handle demangling
13756 style.
13757 * options.h (parse_optional_string): Declare.
13758 (struct One_option): Add optional_arg field. Update constructor.
13759 Update call constructor calls. Add takes_optional_argument
13760 function.
13761 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13762 (DEFINE_optional_string): Define.
13763 (General_options::demangle): Change from DEFINE_bool to
13764 DEFINE_optional_string.
13765 (General_options::no_demangle): New function.
13766 (General_options::do_demangle): New function.
13767 (General_options::set_do_demangle): New function.
13768 (General_options::execstack_status_): Move definition to end of
13769 class definition.
13770 (General_options::static_): Likewise.
13771 (General_options::do_demangle_): New field.
13772 * object.cc (big_endian>::get_symbol_location_info): Call
13773 Options::do_demangle, not Options::demangle.
13774 * symtab.cc (demangle): Likewise.
13775
13776 2008-03-22 Ian Lance Taylor <iant@google.com>
13777
13778 * gold.h: Include <cstddef> and <sys/types.h>
13779 * options.h: Include <cstring>.
13780
13781 2008-03-21 Ian Lance Taylor <iant@google.com>
13782
13783 * Added source code to GNU binutils.