* target-reloc.h (scan_relocs): Call scan.local for relocs
[binutils-gdb.git] / gold / ChangeLog
1 2012-09-13 Alan Modra <amodra@gmail.com>
2
3 * target-reloc.h (scan_relocs): Call scan.local for relocs
4 against symbols in discarded sections. Pass is_discarded
5 param.
6 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
7 Add is_discarded param.
8 * powerpc (Target_powerpc::Scan::local): Likewise. Use
9 is_discarded to flag opd entry as discarded. Don't emit dyn
10 relocs on such entries.
11 (Target_powerpc::Scan::global): Similarly detect and handle
12 such opd entries.
13 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
14 opd_ent_. Update all uses.
15 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
16 (Target_powerpc::relocate_section): Zero out discarded opd
17 entry relocs.
18
19 2012-09-12 Ian Lance Taylor <iant@google.com>
20
21 PR gold/14570
22 * output.cc: Rename Output_data_got template parameter from size
23 to got_size for all functions. Compile all variants of
24 Output_data_got.
25 (Output_data_got::Got_entry::write): Correct use of size for
26 symbol value. Use local_is_tls rather than casting to
27 Sized_relobj_file.
28 * object.h (class Object): Add local_is_tls and do_local_is_tls.
29 (class Sized_relobj_file): Add do_local_is_tls.
30 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
31
32 2012-09-11 Alan Modra <amodra@gmail.com>
33
34 PR gold/14566
35 * layout.cc (Layout::set_segment_offsets): When using
36 common-page-size alignment, ensure we are on a new max-page-size
37 page.
38 * output.cc (Output_segment::set_section_addresses): Use
39 abi_pagesize, not common_pagesize for relro boundary.
40 (Output_segment::set_offset): Likewise.
41
42 2012-09-11 Alan Modra <amodra@gmail.com>
43
44 * output.h (Output_data_got::add_global_tls, add_local_tls,
45 add_local_tls_pair): New functions.
46 (Output_data_got::add_local_pair_with_rel): Remove second
47 reloc param. Expand comment.
48 (Output_data_got::Got_entry): Rename use_plt_offset_ to
49 use_plt_or_tls_offset_, similarly for constructor param.
50 (Output_data_got::Got_entry::write): Add got_index param.
51 * output.cc (Output_data_got::add_global_tls, add_local_tls,
52 add_local_tls_pair): New functions.
53 (Output_data_got::Got_entry::write): Handle tls symbols
54 with use_plt_or_tls_offset_ set specially.
55 (Output_data_got::add_local_pair_with_rel): Only one reloc.
56 (Output_data_got::do_write): Replace iterator with index, pass
57 index to entry write function.
58 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
59 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
60 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
61 call.
62 * i386.cc (Target_i386::Scan::local): Likewise.
63 * sparc.cc (Target_sparc::Scan::local): Likewise.
64 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
65 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
66 do_tls_offset_for_global): New functions.
67 (Target_powerpc::Scan::local): Correct TLS relocations and got
68 entry values.
69 (Target_powerpc::Scan::global): Don't emit unnecessary
70 dynamic relocations on TLS GOT entries.
71
72 2012-09-10 Matthias Klose <doko@ubuntu.com>
73
74 * config.in: Disable sanity check for kfreebsd.
75
76 2012-09-10 Sterling Augustine <saugustine@google.com>
77
78 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
79 (Gdb_index::pubtypes_read): New parameter.
80 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
81 to calls.
82 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
83 pubtypes_object_.
84
85 2012-09-09 Alan Modra <amodra@gmail.com>
86
87 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
88 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
89 * gc.h (gc_process_relocs): Call target gc_add_reference.
90 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
91 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
92 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
93 unnecessary cast.
94 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
95 to cater for when we don't need code offset. Update use.
96 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
97 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
98 set_opd_valid): New functions.
99 (Target_powerpc::do_gc_add_reference): New function.
100 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
101 stashed refs.
102 (Target_powerpc::do_gc_mark_symbol): New function.
103
104 2012-09-06 Cary Coutant <ccoutant@google.com>
105
106 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
107 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
108 (Dwarf_die::skip_attributes): Likewise.
109 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
110 * testsuite/gdb_index_test.cc (inline_func_1): New function.
111 (main): Call it.
112 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
113
114 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
115
116 * testsuite/script_test_3.t: Add .got.plt output section
117 statement.
118 * testsuite/script_test_4.t: Likewise.
119
120 2012-09-05 Alan Modra <amodra@gmail.com>
121
122 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
123 update all uses and lose "enum" when using type.
124
125 2012-09-05 Alan Modra <amodra@gmail.com>
126
127 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
128 * configure: Regenerate.
129 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
130 (plugin_final_layout.stdout): Likewise.
131 (memory_test): Set page sizes to 0x1000.
132 * testsuite/Makefile.in: Regenerate.
133 * testsuite/discard_locals_test.sh: Add FIXME comment.
134 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
135 * testsuite/pr14265.t: Add .got output section statement.
136 * testsuite/script_test_2.t: Likewise.
137 * testsuite/script_test_3.t: Likewise.
138 * testsuite/script_test_4.t: Likewise.
139 * testsuite/script_test_5.t: Likewise.
140 * testsuite/script_test_6.t: Likewise.
141 * testsuite/script_test_7.t: Likewise.
142 * testsuite/script_test_9.t: Likewise.
143
144 2012-09-05 Alan Modra <amodra@gmail.com>
145
146 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
147 (Powerpc_relocate_functions::Status): New typedef.
148 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
149 (Target_powerpc::Scan::local): Handle REL64.
150 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
151 for REL32 and REL64.
152 (Target_powerpc::symval_for_branch): New function, extracted from..
153 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
154 checks. Report overflow errors.
155
156 2012-09-05 Alan Modra <amodra@gmail.com>
157
158 * object.h (Sized_relobj_file::emit_relocs): Delete.
159 (Sized_relobj_file::emit_relocs_reltype): Delete.
160 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
161 relocate_relocs for --emit-relocs.
162 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
163 * output.h: Update comment.
164 (Output_segment::first_section): New function.
165 (Output_segment::first_section_load_address): Use first_section.
166 * output.cc (Output_segment::first_section): New function extracted..
167 (Output_segment::first_section_load_address): ..from here. Delete.
168 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
169 * target.h (Sized_target::relocate_for_relocatable): Likewise.
170 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
171 adjust call to target.h function.
172 * i386.cc (Target_i386): Likewise.
173 * sparc.cc (Target_sparc): Likewise.
174 * x86_64.cc (Target_x86_64): Likewise.
175 * powerpc.cc (Target_powerpc): Likewise.
176 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
177 first tls section has section symbol for optimised local dynamic
178 output relocs.
179 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
180 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
181 optimised tls code.
182 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
183 Rename to relocate_relocs. Update error message.
184
185 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
186
187 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
188 --just-symbols.
189
190 2012-08-31 Alan Modra <amodra@gmail.com>
191
192 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
193 (Powerpc_relobj::toc_base_offset): New stub function.
194 (Target_powerpc): Add tp_offset, dtp_offset. Rename
195 got_mod_index_offset to tlsld_got_offset. Update all refs.
196 (Target_powerpc::Relocate::enum skip_tls): New.
197 (Target_powerpc::call_tls_get_addr_): New var.
198 (Target_powerpc::is_branch_reloc): Move to file scope.
199 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
200 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
201 New functions.
202 (Target_powerpc::enum Got_type): Delete old values, add new ones.
203 (powerpc_info): Correct common_pagesize for ppc64.
204 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
205 (Powerpc_relocate_functions): Add overflow check enums and functions.
206 Add non-shift version of rela, rela_ua. Delete all rel public
207 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
208 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
209 addr16_ha3, addr14 functions.
210 (Output_data_got_powerpc::add_constant_pair): New function.
211 (Output_data_got_powerpc::got_base_offset): Likewise.
212 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
213 (instruction constants): Sort, add some more.
214 (Output_data_glink::do_write): Add and use Address typedef. Use
215 object->toc_base_offset() stub for 64-bit.
216 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
217 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
218 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
219 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
220 Always treat .opd relocs as against locally defined symbol.
221 Correct condition for RELATIVE relocs.
222 (Target_powerpc::do_finalize_sections): Test for NULL sections.
223 (Target_powerpc::Relocate::relocate): Use plt call stub as value
224 for 32-bit syms with a plt entry. Correct ppc64 toc base
225 calculations. Handle TLS relocs, and more. Add overflow
226 checking and adjust for Powerpc_relocate_functions changes.
227 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
228 Reinstate --emit-relocs code with FIXME.
229
230 2012-08-30 Alan Modra <amodra@gmail.com>
231
232 * layout.cc (Layout::set_segment_offsets): Set p_align to
233 abi_pagesize, not common_pagesize.
234 (Layout::relaxation_loop_body): Similarly use abi_pagesize
235 to determine whether file header can go in segment.
236
237 2012-08-30 Alan Modra <amodra@gmail.com>
238
239 * output.h (Output_reloc::Output_reloc <output section>): Add
240 is_relative param. Adjust calls.
241 (Output_reloc::add_output_section_relative): New functions.
242 * output.cc (Output_reloc::Output_reloc <output section>): Handle
243 is_relative.
244 (Output_reloc::symbol_value): Handle SECTION_CODE.
245
246 2012-08-24 Sriraman Tallam <tmsriram@google.com>
247
248 * gold.cc (queue_middle_tasks): Call layout again when unique
249 segments for sections is desired.
250 * layout.cc (Layout::Layout): Initialize new members.
251 (Layout::get_output_section_flags): New function.
252 (Layout::choose_output_section): Call get_output_section_flags.
253 (Layout::layout): Make output section for mapping to a unique segment.
254 (Layout::insert_section_segment_map): New function.
255 (Layout::attach_allocated_section_to_segment): Make unique segment for
256 output sections marked so.
257 (Layout::segment_precedes): Check for unique segments when sorting.
258 * layout.h (Layout::Unique_segment_info): New struct.
259 (Layout::Section_segment_map): New typedef.
260 (Layout::insert_section_segment_map): New function.
261 (Layout::get_output_section_flags): New function.
262 (Layout::is_unique_segment_for_sections_specified): New function.
263 (Layout::set_unique_segment_for_sections_specified): New function.
264 (Layout::unique_segment_for_sections_specified_): New member.
265 (Layout::section_segment_map_): New member.
266 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
267 Rename is_gc_pass_one to is_pass_one.
268 Rename is_gc_pass_two to is_pass_two.
269 Rename is_gc_or_icf to is_two_pass.
270 Check for which pass based on whether symbols data is present.
271 Make it two pass when unique segments for sections is desired.
272 * output.cc (Output_section::Output_section): Initialize new
273 members.
274 * output.h (Output_section::is_unique_segment): New function.
275 (Output_section::set_is_unique_segment): New function.
276 (Output_section::is_unique_segment_): New member.
277 (Output_section::extra_segment_flags): New function.
278 (Output_section::set_extra_segment_flags): New function.
279 (Output_section::extra_segment_flags_): New member.
280 (Output_section::segment_alignment): New function.
281 (Output_section::set_segment_alignment): New function.
282 (Output_section::segment_alignment_): New member.
283 (Output_segment::Output_segment): Initialize is_unique_segment_.
284 (Output_segment::is_unique_segment): New function.
285 (Output_segment::set_is_unique_segment): New function.
286 (Output_segment::is_unique_segment_): New member.
287 * plugin.cc (allow_unique_segment_for_sections): New function.
288 (unique_segment_for_sections): New function.
289 (Plugin::load): Add new functions to transfer vector.
290 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
291 * Makefile.in: Regenerate.
292 * testsuite/plugin_final_layout.sh: Check if unique segment
293 functionality works.
294 * testsuite/plugin_section_order.c (onload): Check if new interfaces
295 are available.
296 (allow_unique_segment_for_sections): New global.
297 (unique_segment_for_sections): New global.
298 (claim_file_hook): Call allow_unique_segment_for_sections.
299 (all_symbols_read_hook): Call unique_segment_for_sections.
300
301 2012-08-22 Cary Coutant <ccoutant@google.com>
302
303 * layout.cc (Layout::include_section): Don't assert on GROUP
304 sections with --emit-relocs.
305
306 2012-08-21 Cary Coutant <ccoutant@google.com>
307
308 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
309 if --export-dynamic-symbol names an undef symbol.
310
311 2012-08-18 Alan Modra <amodra@gmail.com>
312
313 * powerpc.cc: Formatting and white space.
314 (Powerpc_relobj): Rename got2_section_ to special_.
315 Add opd_ent_shndx_ and opd_ent_off_ vectors.
316 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
317 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
318 (Target_powerpc): Add Address typedef and invalid_address. Use
319 throughout.
320 (Target_powerpc::is_branch_reloc): New function.
321 (Powerpc_relocate_functions): Add Address typedef, use throughout.
322 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
323 for dst_mask, value and addend.
324 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
325 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
326 (Output_data_glink::do_write): Correct toc base. Don't try to use
327 uint16_t for 24-bit offset. Use get_output_section_offset and
328 check return.
329 (Target_powerpc::Scan::local): Handle more relocs.
330 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
331 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
332 Plug in toc restoring insn after plt calls. Translate branches
333 to function descriptor symbols to corresponding entry point.
334 (Target_powerpc::relocate_for_relocatable): Check return from
335 get_output_section_offset.
336 * symtab.h: Comment typo.
337
338 2012-08-14 Ian Lance Taylor <iant@google.com>
339
340 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
341 unsupported_relocal_local to call unsupported_reloc_global.
342
343 2012-08-14 Nick Clifton <nickc@redhat.com>
344
345 PR ld/14265
346 * script-sections.cc (Sections_element::output_section_name): Add
347 keep return parameter.
348 (Output_section_element::match_name): Add keep return parameter.
349 Return the value of the keep_ member.
350 * script-sections.h (class Output_section): Update
351 output_section_name prototype.
352 * layout.cc (Layout::keep_input_section): New public member
353 function.
354 (Layout::choose_output_section): Pass keep parameter to
355 output_section_name.
356 * layout.h (class Layout): Add keep_input_section.
357 * object.cc (Sized_relobj_file::do_layout): Check for kept input
358 sections.
359 * testsuite/Makefile.am: Add a test.
360 * testsuite/Makefile.in: Regenerate.
361 * testsuite/pr14265.c: Source file for the test.
362 * testsuite/pr14265.t: Linker script for the test.
363 * testsuite/pr14265.sh: Shell script for the test.
364
365 2012-08-14 Alan Modra <amodra@gmail.com>
366
367 * target.h (Target::output_section_name): New function.
368 (Target::do_output_section_name): New function.
369 * layout.cc (Layout::choose_output_section): Call the above.
370 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
371
372 2012-08-14 Alan Modra <amodra@gmail.com>
373
374 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
375 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
376 for replace_constant call.
377 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
378 (Output_data_glink::do_print_to_mapfile): New function.
379 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
380 (Target_powerpc::Relocate::relocate): Likewise.
381
382 2012-08-14 Alan Modra <amodra@gmail.com>
383
384 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
385 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
386 (Output_data_glink::add_entry,find_entry): Remove shndx param.
387 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
388 all references to shndx_. Handle special case for R_PPC_PLTREL24
389 here.
390 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
391 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
392 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
393 here.
394 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
395 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
396
397 2012-08-12 Alan Modra <amodra@gmail.com>
398
399 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
400 (glink insn constants): Use uint32_t.
401 (Output_data_glink::add_entry): Use insert, not [] operator.
402
403 2012-08-11 Alan Modra <amodra@gmail.com>
404
405 * object.h (Sized_relobj_file::find_shdr): New function.
406 (Sized_relobj_file::find_special_sections): New function.
407 * object.cc (Sized_relobj_file::find_shdr): New function.
408 (Sized_relobj_file::find_eh_frame): Use find_shdr.
409 (Sized_relobj_file::find_special_sections): New function, split out..
410 (Sized_relobj_file::do_read_symbols): ..from here.
411 * output.h (Output_data_got::replace_constant): New function.
412 (Output_data_got::num_entries): New function.
413 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
414 (Output_data_got::got_offset): Protected rather than private.
415 (Output_data_got::replace_got_entry): New function.
416 * output.cc (Output_data_got::replace_got_entry): New function.
417 * powerpc.cc (class Powerpc_relobj): New.
418 (class Powerpc_relocate_functions): Delete all psymval variants or
419 convert to value,addend type. Delete pcrela, pcrela_unaligned.
420 Implement _ha functions using corresponding _hi function.
421 (Powerpc_relobj::find_special_sections): New function.
422 (Target_powerpc::do_make_elf_object): New function.
423 (class Output_data_got_powerpc): New.
424 (class Output_data_glink): New.
425 (class Powerpc_scan_relocatable_reloc): New.
426 Many more changes througout file.
427
428 2012-08-09 Nick Clifton <nickc@redhat.com>
429
430 * po/vi.po: Updated Vietnamese translation.
431
432 2012-08-07 Ian Lance Taylor <iant@google.com>
433
434 * layout.cc (Layout::add_target_dynamic_tags): If
435 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
436 plt_rel.
437
438 2012-07-30 Nick Clifton <nickc@redhat.com>
439
440 * po/gold.pot: Updated template.
441 * po/es.po: Updated Spanish translation.
442
443 2012-07-18 Cary Coutant <ccoutant@google.com>
444
445 PR gold/14344
446 * configure.ac: Add check for -gpubnames support.
447 * configure: Regenerate.
448 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
449 support; force -gno-pubnames.
450 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
451 support.
452 (gdb_index_test_4): New test.
453 * testsuite/Makefile.in: Regenerate.
454 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
455 * testsuite/gdb_index_test_2.sh: Likewise.
456 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
457 * testsuite/gdb_index_test_4.sh: New script.
458 * testsuite/gdb_index_test_comm.sh: New script with common code;
459 don't look for space after colon.
460
461 2012-07-16 Sriraman Tallam <tmsriram@google.com>
462
463 * gold.cc (queue_middle_tasks): Update function order only after
464 deferred objects due to plugins are processed.
465
466 2012-07-11 Ian Lance Taylor <iant@google.com>
467
468 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
469 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
470 (Target_arm::scan_reloc_for_stub): Likewise.
471 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
472 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
473 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
474 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
475 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
476
477 2012-07-10 Dodji Seketeli <dodji@redhat.com>
478 Ian Lance Taylor <iant@google.com>
479
480 PR gold/14309
481 * configure.ac: Test whether std::tr1::hash<off_t> works.
482 * gold.h: Add a specialization for std::tr1::hash<off_t> if
483 needed.
484 * output.h (class Output_fill): Add virtual destructor.
485 * configure, config.in: Rebuild.
486
487 2012-06-22 Roland McGrath <mcgrathr@google.com>
488
489 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
490
491 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
492
493 * plugin.cc (Plugin::load): Handle position independent executables.
494
495 2012-06-06 Cary Coutant <ccoutant@google.com>
496
497 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
498 add .debug_macro.
499 (lines_only_debug_sections): Likewise.
500 (gdb_fast_lookup_sections): New static array.
501 (is_gdb_debug_section): Rename formal parameter.
502 (is_lines_only_debug_section): Likewise.
503 (is_gdb_fast_lookup_section): New function.
504 (Layout::include_section): Check for ".zdebug_" prefix; pass
505 section name suffix to is_gdb_debug_section, et al.; check for
506 fast-lookup sections when building .gdb_index.
507 * options.h (--strip-debug-gdb): Update GDB version number.
508
509 2012-06-06 Cary Coutant <ccoutant@google.com>
510
511 * configure.ac: Add check for fallocate.
512 * configure: Regenerate.
513 * config.in: Regenerate.
514
515 * options.h (class General_options): Add --mmap-output-file and
516 --posix-fallocate options.
517 * output.cc: (posix_fallocate): Remove; replace with...
518 (gold_fallocate): New function.
519 (Output_file::map_no_anonymous): Call gold_fallocate.
520 (Output_file::map): Check --mmap-output-file option.
521
522 2012-06-05 Jing Yu <jingyu@google.com>
523
524 * gold.h (textdomain): Add do {} to empty while(0).
525 (bindtextdomain): Likewise.
526
527 2012-06-04 Cary Coutant <ccoutant@google.com>
528
529 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
530 has_dynsym_index.
531
532 2012-05-25 Sriraman Tallam <tmsriram@google.com>
533
534 * symtab.cc (Symbol_table::define_special_symbol):
535 Initialize *poldsym to prevent uninitialized variable errors.
536
537 2012-05-23 Cary Coutant <ccoutant@google.com>
538
539 * layout.cc (Layout::section_name_mapping): Add rules to handle
540 exact match on .data.rel.ro.local or .data.rel.ro.
541 (Layout::output_section_name): Check for exact matches.
542
543 2012-05-23 Cary Coutant <ccoutant@google.com>
544
545 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
546 more carefully.
547
548 2012-05-22 Cary Coutant <ccoutant@google.com>
549
550 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
551 object before exporting symbol.
552
553 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
554
555 * testsuite/tls_test.cc: Include "config.h" first.
556 * testsuite/tls_test_c.c: Likewise.
557
558 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
559 Nick Clifton <nickc@redhat.com>
560
561 PR 14072
562 * configure.in: Add check that sysdep.h has been included before
563 any system header files.
564 * configure: Regenerate.
565 * config.in: Regenerate.
566
567 2012-05-14 Cary Coutant <ccoutant@google.com>
568
569 * layout.cc (Layout::make_output_section): Mark .tdata section
570 as RELRO.
571 * testsuite/relro_test.cc: Add a TLS variable.
572
573 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
574
575 PR gold/14091
576 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
577 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
578 R_X86_64_64.
579
580 2012-05-08 Cary Coutant <ccoutant@google.com>
581
582 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
583 (lines_only_debug_sections): Likewise.
584
585 2012-05-02 Roland McGrath <mcgrathr@google.com>
586
587 * nacl.cc: New file.
588 * nacl.h: New file.
589 * Makefile.am (CCFILES, HFILES): Add them.
590 * Makefile.in: Regenerate.
591 * i386.cc (Output_data_plt_i386_nacl): New class.
592 (Output_data_plt_i386_nacl_exec): New class.
593 (Output_data_plt_i386_nacl_dyn): New class.
594 (Target_i386_nacl): New class.
595 (Target_selector_i386_nacl): New class.
596 (target_selector_i386): Use it instead of Target_selector_i386.
597 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
598 (Target_x86_64_nacl): New class.
599 (Target_selector_x86_64_nacl): New class.
600 (target_selector_x86_64, target_selector_x32): Use it instead of
601 Target_selector_x86_64.
602 * arm.cc (Output_data_plt_arm_nacl): New class.
603 (Target_arm_nacl): New class.
604 (Target_selector_arm_nacl): New class.
605 (target_selector_arm, target_selector_armbe): Use it instead of
606 Target_selector_arm.
607
608 * target-select.cc (select_target): Take new Input_file* and off_t
609 arguments, pass them on to recognize method of selector.
610 * object.cc (make_elf_sized_object): Update caller.
611 * parameters.cc (parameters_force_valid_target): Likewise.
612 * incremental.cc (make_sized_incremental_binary): Likewise.
613 * target-select.h: Update decl.
614 (Target_selector::recognize): Take new Input_file* argument,
615 pass it on to do_recognize.
616 (Target_selector::do_recognize): Take new Input_file* argument.
617 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
618 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
619 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
620 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
621
622 * target.h (Target::Target_info): New members isolate_execinstr
623 and rosegment_gap.
624 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
625 * arm.cc (Target_arm::arm_info): Update initializer.
626 * i386.cc (Target_i386::i386_info): Likewise.
627 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
628 * sparc.cc (Target_sparc::sparc_info): Likewise.
629 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
630 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
631 * layout.cc (Layout::attach_allocated_section_to_segment):
632 Take new const Target* argument. If target->isolate_execinstr(), act
633 like --rosegment.
634 (Layout::find_first_load_seg): Take new const Target* argument;
635 if target->isolate_execinstr(), reject PF_X segments.
636 (Layout::relaxation_loop_body): Update caller.
637 (Layout::set_segment_offsets): If target->isolate_execinstr(),
638 reset file offset to zero when we hit LOAD_SEG, and then do a second
639 loop over the segments before LOAD_SEG to reassign offsets after
640 addresses have been determined. Handle target->rosegment_gap().
641 (Layout::attach_section_to_segment): Take new const Target* argument;
642 pass it to attach_allocated_section_to_segment.
643 (Layout::make_output_section): Update caller.
644 (Layout::attach_sections_to_segments): Take new const Target* argument;
645 pass it to attach_section_to_segment.
646 * gold.cc (queue_middle_tasks): Update caller.
647 * layout.h (Layout): Update method decls with new arguments.
648
649 * arm.cc (Target_arm::Target_arm): Take optional argument for the
650 Target_info pointer to use.
651 (Target_arm::do_make_data_plt): New virtual method.
652 (Target_arm::make_data_plt): New method that calls it.
653 (Target_arm::make_plt_entry): Use it.
654 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
655 for the section alignment.
656 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
657 method.
658 (Output_data_plt_arm::first_plt_entry_offset): Call it.
659 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
660 method.
661 (Output_data_plt_arm::get_plt_entry_size): Call it.
662 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
663 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
664 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
665 method.
666 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
667 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
668 method instead of sizeof(plt_entry).
669 (Output_data_plt_arm::add_entry): Likewise.
670 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
671 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
672 than static method.
673 (Target_arm::plt_entry_size): Likewise.
674 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
675 Move to ...
676 (Output_data_plt_arm_standard): ... here, new class.
677 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
678 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
679 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
680
681 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
682 Take additional argument for the PLT entry size.
683 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
684 Use get_plt_entry_size method rather than plt_entry_size variable.
685 (Output_data_plt_x86_64::reserve_slot): Likewise.
686 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
687 (Output_data_plt_x86_64::add_entry): Likewise.
688 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
689 (Output_data_plt_x86_64::address_for_global): Likewise.
690 (Output_data_plt_x86_64::address_for_local): Likewise.
691 (Output_data_plt_x86_64::set_final_data_size): Likewise.
692 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
693 Make method non-static.
694 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
695 method.
696 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
697 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
698 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
699 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
700 virtual method.
701 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
702 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
703 virtual method.
704 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
705 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
706 virtual method.
707 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
708 (Output_data_plt_x86_64::plt_entry_size)
709 (Output_data_plt_x86_64::first_plt_entry)
710 (Output_data_plt_x86_64::plt_entry)
711 (Output_data_plt_x86_64::tlsdesc_plt_entry)
712 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
713 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
714 (Output_data_plt_x86_64_standard): ... here, new class.
715 (Target_x86_64::Target_x86_64): Take optional argument for the
716 Target_info pointer to use.
717 (Target_x86_64::do_make_data_plt): New virtual method.
718 (Target_x86_64::make_data_plt): New method to call it.
719 (Target_x86_64::init_got_plt_for_update): Use that.
720 Call this->plt_->add_eh_frame method here.
721 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
722 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
723 rather than static method.
724 (Target_x86_64::plt_entry_size): Likewise.
725 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
726 rather than plt_entry_size variable. Move guts of PLT filling to...
727 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
728 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
729 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
730
731 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
732 additional argument for the section alignment.
733 Don't do add_eh_frame_for_plt here.
734 (Output_data_plt_i386::first_plt_entry_offset): Make the method
735 non-static. Use get_plt_entry_size method rather than plt_entry_size
736 variable.
737 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
738 method.
739 (Output_data_plt_i386::get_plt_entry_size): Call it.
740 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
741 (Output_data_plt_i386::add_eh_frame): New method to call it.
742 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
743 method.
744 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
745 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
746 method.
747 (Output_data_plt_i386::fill_plt_entry): New method to call it.
748 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
749 method instead of plt_entry_size.
750 (Output_data_plt_i386::plt_entry_size)
751 (Output_data_plt_i386::plt_eh_frame_fde_size)
752 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
753 (Output_data_plt_i386_standard): ... here, new class.
754 (Output_data_plt_i386_exec): New class.
755 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
756 (Output_data_plt_i386_exec::first_plt_entry): ... here.
757 (Output_data_plt_i386::exec_plt_entry): Move to ...
758 (Output_data_plt_i386_exec::plt_entry): ... here.
759 (Output_data_plt_i386_dyn): New class.
760 (Output_data_plt_i386::first_plt_entry): Move to ...
761 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
762 (Output_data_plt_i386::dyn_plt_entry): Move to ...
763 (Output_data_plt_i386_dyn::plt_entry): ... here.
764 (Target_i386::Target_i386): Take optional argument for the Target_info
765 pointer to use.
766 (Target_i386::do_make_data_plt): New virtual method.
767 (Target_i386::make_data_plt): New method to call it.
768 (Target_i386::make_plt_section): Use that.
769 Call this->plt_->add_eh_frame method here.
770 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
771 rather than plt_entry_size variable.
772 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
773 (Output_data_plt_i386::address_for_local): Likewise.
774 (Output_data_plt_i386::do_write): Likewise.
775 Move guts of PLT filling to...
776 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
777 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
778 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
779 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
780
781 2012-05-01 Cary Coutant <ccoutant@google.com>
782
783 * dwarf_reader.cc (Dwarf_die::read_attributes)
784 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
785 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
786 * reduced_debug_output.cc
787 (Output_reduced_debug_info_section::get_die_end): Remove
788 DW_FORM_GNU_ref_index. Add default case.
789
790 2012-04-26 Mark Wielaard <mjw@redhat.com>
791
792 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
793 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
794 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
795 DW_AT_high_pc as offset from DW_AT_low_pc.
796
797 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
798 * testsuite/Makefile.in: Regenerate.
799 * testsuite/gdb_index_test_3.c: New test source file.
800 * testsuite/gdb_index_test_3.sh: New test source file.
801
802 2012-04-25 Ian Lance Taylor <iant@google.com>
803
804 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
805 pointer.
806 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
807 as a class, not a struct.
808 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
809 (Target_arm::apply_cortex_a8_workaround): Likewise.
810 * gc.h: Declare Reloc_types as a struct, not a class.
811 * object.h: Declare Symbols_data as a struct.
812 * reloc.h: Declare Read_relocs_data as a struct.
813 * target.h: Declare Relocate_info as a struct.
814
815 2012-04-24 David S. Miller <davem@davemloft.net>
816
817 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
818 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
819 and R_SPARC_WPLT30.
820
821 2012-04-24 Cary Coutant <ccoutant@google.com>
822
823 * incremental-dump.cc (find_input_containing_global): Replace
824 magic number with symbolic constant.
825 (dump_incremental_inputs): Update version number.
826 * incremental.cc (Output_section_incremental_inputs): Update version
827 number; import symbolic constants from Incremental_inputs_reader.
828 (Incremental_inputs::create_data_sections): Align relocations
829 section correctly for 64-bit targets.
830 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
831 constants; add padding.
832 (Output_section_incremental_inputs::write_header): Add assert for
833 header_size.
834 (Output_section_incremental_inputs::write_input_files): Add assert
835 for input_entry_size.
836 (Output_section_incremental_inputs::write_info_blocks): Add padding;
837 add assert for object_info_size, input_section_entry_size,
838 global_sym_entry_size.
839 * incremental.h (Incremental_inputs_reader): Add symbolic constants
840 for data structure sizes; use them.
841 (Incremental_input_entry_reader): Import symbolic constants from
842 Incremental_inputs_reader; use them.
843
844 2012-04-23 David S. Miller <davem@davemloft.net>
845
846 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
847 and elf_flags_set_.
848 (Target_sparc::Target_sparc): Initialize new fields.
849 (Target_sparc::do_make_elf_object): New function.
850 (Target_sparc::do_adjust_elf_header): New function.
851
852 2012-04-23 Cary Coutant <ccoutant@google.com>
853
854 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
855 CU range table of gdb index.
856
857 2012-04-20 David S. Miller <davem@davemloft.net>
858
859 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
860 instead of false.
861
862 2012-04-16 David S. Miller <davem@davemloft.net>
863
864 * sparc.cc (Target_sparc::got_address): New function.
865 (Sparc_relocate_functions::gdop_hix22): New function.
866 (Sparc_relocate_functions::gdop_lox10): New function.
867 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
868 relocs.
869 (Target_sparc::Scan::local): Likewise if the global symbol is not
870 preemptible and is not IFUNC.
871 (Target_sparc::Relocate::relocate): Perform GOTDATA code
872 transformations for local and non-preemptible non-IFUNC global
873 symbols.
874
875 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
876 writing out 64-bit part of ranges.
877
878 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
879 -fpic and -fpie respectively.
880 * Makefile.in: Regenerate.
881
882 * sparc.cc (class Target_sparc): Add rela_ifunc_.
883 (Target_sparc::Target_sparc): Initialize new field.
884 (Target_sparc::do_plt_section_for_global): New function.
885 (Target_sparc::do_plt_section_for_local): New function.
886 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
887 (Target_sparc::make_plt_section): New function, broken out of
888 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
889 (Target_sparc::make_plt_entry): Call make_plt_section.
890 (Target_sparc::make_local_ifunc_plt_entry): New function.
891 (Target_sparc::rela_ifunc_section): New function.
892 (Target_sparc::plt_section): Remove const.
893 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
894 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
895 and ifunc_count_ fields.
896 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
897 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
898 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
899 (Output_data_plt_sparc::rela_ifunc): New function.
900 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
901 (Output_data_plt_sparc::has_ifunc_section): New function.
902 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
903 (Output_data_plt_sparc::address_for_global): New function.
904 (Output_data_plt_sparc::address_for_local): New function.
905 (Output_data_plt_sparc::plt_index_to_offset): New function.
906 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
907 and entry_count.
908 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
909 entry_count.
910 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
911 R_SPARC_JMP_IREL to switch.
912 (Target_sparc::Scan::check_non_pic): Likewise.
913 (Target_sparc::Scan::local): Handle IFUNC symbols.
914 (Target_sparc::Scan::local): Likewise.
915 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
916 and plt_address_for_local.
917 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
918 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
919
920 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
921 (class Output_data_reloc): Adjust calls to Output_reloc_type.
922 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
923 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
924 global relocs too.
925 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
926 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
927 calls.
928 * sparc.cc (Target_sparc::Scan::global): Likewise.
929 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
930
931 2012-04-16 Cary Coutant <ccoutant@google.com>
932
933 * archive.cc (Library_base::should_include_member): Check for
934 --export-dynamic-symbol.
935 * options.h (class General_options): Add --export-dynamic-symbol.
936 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
937 --export-dynamic-symbol.
938 (Symbol_table::gc_mark_undef_symbols): Likewise.
939 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
940
941 2012-04-12 David S. Miller <davem@davemloft.net>
942
943 * sparc.cc (Reloc::wdisp10): New relocation method.
944 (Reloc::h34): Likewise.
945 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
946 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
947 R_SPARC_WDISP10.
948 (Target_sparc::Scan::local): Likewise.
949 (Target_sparc::Scan::global): Likewise.
950 (Target_sparc::Relocate::relocate): Likewise.
951
952 2012-04-09 Cary Coutant <ccoutant@google.com>
953
954 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
955 low_pc == 0.
956
957 2012-04-06 Ian Lance Taylor <iant@google.com>
958
959 * timer.cc: #include <unistd.h>.
960
961 2012-04-06 Roland McGrath <mcgrathr@google.com>
962
963 * configure.in (AC_CHECK_HEADERS): Add locale.h.
964 * config.in: Regenerate.
965 * configure: Regenerate.
966
967 2012-04-05 Nick Clifton <nickc@redhat.com>
968
969 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
970 (AM_LC_MESSAGES): Add.
971 * aclocal.m4: Regenerate.
972 * config.in: Regenerate.
973 * configure: Regenerate.
974
975 2012-03-21 Cary Coutant <ccoutant@google.com>
976
977 * Makefile.am: Add gdb-index.cc, gdb-index.h.
978 * Makefile.in: Regenerate.
979 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
980 (Sized_elf_reloc_mapper::symbol_section): New function.
981 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
982 (make_elf_reloc_mapper): New function.
983 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
984 (Dwarf_abbrev_table::do_read_abbrevs): New function.
985 (Dwarf_abbrev_table::do_get_abbrev): New function.
986 (Dwarf_ranges_table::read_ranges_table): New function.
987 (Dwarf_ranges_table::read_range_list): New function.
988 (Dwarf_pubnames_table::read_section): New function.
989 (Dwarf_pubnames_table::read_header): New function.
990 (Dwarf_pubnames_table::next_name): New function.
991 (Dwarf_die::Dwarf_die): New function.
992 (Dwarf_die::read_attributes): New function.
993 (Dwarf_die::skip_attributes): New function.
994 (Dwarf_die::set_name): New function.
995 (Dwarf_die::set_linkage_name): New function.
996 (Dwarf_die::attribute): New function.
997 (Dwarf_die::string_attribute): New function.
998 (Dwarf_die::int_attribute): New function.
999 (Dwarf_die::uint_attribute): New function.
1000 (Dwarf_die::ref_attribute): New function.
1001 (Dwarf_die::child_offset): New function.
1002 (Dwarf_die::sibling_offset): New function.
1003 (Dwarf_info_reader::check_buffer): New function.
1004 (Dwarf_info_reader::parse): New function.
1005 (Dwarf_info_reader::do_parse): New function.
1006 (Dwarf_info_reader::do_read_string_table): New function.
1007 (Dwarf_info_reader::lookup_reloc): New function.
1008 (Dwarf_info_reader::get_string): New function.
1009 (Dwarf_info_reader::visit_compilation_unit): New function.
1010 (Dwarf_info_reader::visit_type_unit): New function.
1011 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1012 Sized_elf_reloc_mapper.
1013 (Sized_dwarf_line_info::symbol_section): Remove function.
1014 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1015 (Sized_dwarf_line_info::read_line_mappings): Remove object
1016 parameter, adjust callers.
1017 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1018 * dwarf_reader.h: Include <sys/types.h>.
1019 (class Track_relocs): Remove forward declaration.
1020 (class Elf_reloc_mapper): New class.
1021 (class Sized_elf_reloc_mapper): New class.
1022 (class Dwarf_abbrev_table): New class.
1023 (class Dwarf_range_list): New class.
1024 (class Dwarf_ranges_table): New class.
1025 (class Dwarf_pubnames_table): New class.
1026 (class Dwarf_die): New class.
1027 (class Dwarf_info_reader): New class.
1028 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1029 (Sized_dwarf_line_info::symbol_section): Remove member function.
1030 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1031 base class.
1032 * gdb-index.cc: New source file.
1033 * gdb-index.h: New source file.
1034 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1035 and .debug_types sections, call Layout::add_to_gdb_index.
1036 (Sized_relobj_incr::do_section_name): Implement.
1037 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1038 return type; Implement.
1039 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1040 return type.
1041 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1042 parameter list and return type.
1043 (Sized_incr_dynobj::do_section_contents): Likewise.
1044 * layout.cc: Include gdb-index.h.
1045 (Layout::Layout): Initialize gdb_index_data_.
1046 (Layout::init_fixed_output_section): Check for .gdb_index section.
1047 (Layout::add_to_gdb_index): New function. Instantiate.
1048 * layout.h: Add forward declaration for class Gdb_index.
1049 (Layout::add_to_gdb_index): New member function.
1050 (Layout::gdb_index_data_): New data member.
1051 * main.cc: Include gdb-index.h.
1052 (main): Print statistics for gdb index.
1053 * object.cc (Object::section_contents): Move code into
1054 do_section_contents.
1055 (need_decompressed_section): Check for sections needed when building
1056 gdb index.
1057 (build_compressed_section_map): Likewise.
1058 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1059 gdb index.
1060 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1061 sections; call Layout::add_to_gdb_index.
1062 (Sized_relobj_file::do_decompressed_section_contents): Call
1063 do_section_contents directly.
1064 * object.h (Object::do_section_contents): Adjust parameter list and
1065 return type.
1066 (Object::do_decompressed_section_contents): Call do_section_contents
1067 directly.
1068 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1069 return type.
1070 * options.h (class General_options): Add --gdb-index option.
1071 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1072 list and return type.
1073 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1074 * reloc.h (Track_relocs::checkpoint): New function.
1075 (Track_relocs::reset): New function.
1076
1077 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1078 New test cases.
1079 * testsuite/Makefile.in: Regenerate.
1080 * testsuite/gdb_index_test.cc: New test source file.
1081 * testsuite/gdb_index_test_1.sh: New test source file.
1082 * testsuite/gdb_index_test_2.sh: New test source file.
1083
1084 2012-03-19 Doug Kwan <dougkwan@google.com>
1085
1086 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1087 (Target_arm::do_finalize_sections): Remove code which defines
1088 __exidx_start and __exidx_end. Make symbol table parameter
1089 anonymous as it is not used.
1090 * gold.cc (queue_middle_tasks): Call target hook to define any
1091 target-specific symbols.
1092 * target.h (Target::define_standard_symbols): New method.
1093 (Target::do_define_standard_symbols): Same.
1094 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1095 * testsuite/Makefile.in: Regenerate.
1096 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1097 and __exidx_end.
1098 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1099 relocations are generated for __exidx_start and __exidx_end.
1100
1101 2012-03-16 Doug Kwan <dougkwan@google.com>
1102
1103 * testsuite/Makefile.am: Disable test initpri3b.
1104 * testsuite/Makefile.in: Regenerate.
1105
1106 2012-03-15 Doug Kwan <dougkwan@google.com>
1107
1108 * arm.cc (Target_arm::got_section): Make .got section read-only
1109 if -z now is given.
1110
1111 2012-03-15 Ian Lance Taylor <iant@google.com>
1112
1113 PR gold/13850
1114 * layout.cc (Layout::make_output_section): Correctly mark
1115 SHT_INIT_ARRAY, et. al., as relro.
1116
1117 2012-03-14 Doug Kwan <dougkwan@google.com>
1118
1119 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1120 dynamic relocations for protected symbols in shared objects.
1121
1122 2012-03-13 Ian Lance Taylor <iant@google.com>
1123
1124 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1125 keep the larger alignment.
1126
1127 2012-03-12 Cary Coutant <ccoutant@google.com>
1128
1129 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1130 handling of DW_LNE_define_file.
1131
1132 2012-03-12 Cary Coutant <ccoutant@google.com>
1133
1134 * reduced_debug_output.cc
1135 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1136 codes to switch.
1137
1138 2012-02-29 Cary Coutant <ccoutant@google.com>
1139
1140 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1141
1142 2012-02-29 Cary Coutant <ccoutant@google.com>
1143
1144 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1145 Call Object::decompressed_section_contents.
1146 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1147 New dtor.
1148 (Sized_dwarf_line_info::buffer_start_): New data member.
1149 * merge.cc (Output_merge_data::do_add_input_section): Call
1150 Object::decompressed_section_contents.
1151 (Output_merge_string::do_add_input_section): Likewise.
1152 * object.cc (need_decompressed_section): New function.
1153 (build_compressed_section_map): Decompress sections needed later.
1154 (Sized_relobj_file::do_decompressed_section_contents): New function.
1155 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1156 * object.h (Object::decompressed_section_contents): New function.
1157 (Object::discard_decompressed_sections): New function.
1158 (Object::do_decompressed_section_contents): New function.
1159 (Object::do_discard_decompressed_sections): New function.
1160 (Compressed_section_info): New type.
1161 (Compressed_section_map): Include decompressed section contents.
1162 (Sized_relobj_file::do_decompressed_section_contents): New function.
1163 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1164
1165 2012-02-16 Cary Coutant <ccoutant@google.com>
1166
1167 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1168 * testsuite/Makefile.in: Regenerate.
1169
1170 2012-02-14 Cary Coutant <ccoutant@google.com>
1171
1172 * options.cc (General_options::finalize): Disallow -pie and -static.
1173
1174 2012-02-03 Doug Kwan <dougkwan@google.com>
1175
1176 * arm.cc (Arm_relocate_functions::abs8,
1177 Arm_relocate_functions::abs16): Use
1178 Bits::has_signed_unsigned_overflow32.
1179 (Arm_relocate_functions::thm_abs8): Correct range of
1180 overflow check.
1181 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1182 in assertions.
1183
1184 2012-02-02 Doug Kwan <dougkwan@google.com>
1185
1186 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1187 position independent outputs, not just shared objects.
1188
1189 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1190
1191 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1192 * configure: Regenerated.
1193
1194 2012-01-27 Ian Lance Taylor <iant@google.com>
1195
1196 * reloc.h (Bits): New class with static functions, copied from
1197 namespace utils in arm.cc.
1198 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1199 instead.
1200
1201 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1202
1203 * incremental.cc (write_info_blocks): Correct relocation offset.
1204
1205 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1206
1207 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1208 (Relocate::tls_gd_to_le): Likewise.
1209
1210 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1211
1212 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1213
1214 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1215
1216 * configure.ac: Check if -mcmodel=medium works.
1217 * configure: Regenerated.
1218
1219 2012-01-24 Cary Coutant <ccoutant@google.com>
1220
1221 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1222 definition and ...
1223 (read_unsigned_LEB_128_x): ... this new function.
1224 (read_signed_LEB_128): Replaced with inline definition and ...
1225 (read_signed_LEB_128_x): ... this new function.
1226 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1227 (read_unsigned_LEB_128): Add inline definition.
1228 (read_signed_LEB_128_x): New function.
1229 (read_signed_LEB_128): Add inline definition.
1230 * testsuite/Makefile.am (leb128_unittest): New unit test.
1231 * testsuite/Makefile.in: Regenerate.
1232 * testsuite/leb128_unittest.cc: New unit test.
1233
1234 2012-01-23 Ian Lance Taylor <iant@google.com>
1235
1236 PR gold/13617
1237 * i386.cc (Target_i386::do_code_fill): When using a jmp
1238 instruction, pad with nop instructions.
1239 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1240
1241 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1242
1243 * x86_64.cc (gc_process_relocs): Add typename on types used in
1244 template.
1245 (scan_relocs): Likewise.
1246 (relocate_section): Likewise.
1247 (apply_relocation): Likewise.
1248
1249 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1250
1251 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1252 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1253 under x32.
1254
1255 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1256
1257 * x86_64.cc: Initial support for x32.
1258
1259 2012-01-03 Cary Coutant <ccoutant@google.com>
1260
1261 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1262 Use abstract base class for GOT.
1263 * gold/output.h (class Output_data_got_base): New abstract base class.
1264 (class Output_data_got): Derive from new base class, adjust ctors.
1265 (Output_data_got::reserve_slot): Make virtual; rename to
1266 do_reserve_slot; Adjust callers.
1267 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1268 pointer to abstract base class.
1269 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1270
1271 2011-12-18 Ian Lance Taylor <iant@google.com>
1272
1273 * object.h (Relobj::local_symbol_value): New function.
1274 (Relobj::local_plt_offset): New function.
1275 (Relobj::local_has_got_offset): New function.
1276 (Relobj::local_got_offset): New function.
1277 (Relobj::set_local_got_offset): New function.
1278 (Relobj::do_local_symbol_value): New pure virtual function.
1279 (Relobj::do_local_plt_offset): Likewise.
1280 (Relobj::do_local_has_got_offset): Likewise.
1281 (Relobj::do_local_got_offset): Likewise.
1282 (Relobj::do_set_local_got_offset): Likewise.
1283 (Sized_relobj::do_local_has_got_offset): Rename from
1284 local_has_got_offset.
1285 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1286 (Sized_relobj::do_set_local_got_offset): Rename from
1287 set_local_got_offset.
1288 (Sized_relobj_file::do_local_plt_offset): Rename from
1289 local_plt_offset.
1290 (Sized_relobj_file::do_local_symbol_value): New function.
1291 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1292 local_plt_offset.
1293 * output.cc (Output_data_got::Got_entry::write): Change object to
1294 Relobj. Use local_symbol_value.
1295 (Output_data_got::add_global_with_rel): Change rel_dyn to
1296 Output_data_reloc_generic*. Use add_global_generic.
1297 (Output_data_got::add_global_with_rela): Remove. Change all
1298 callers to use add_global_with_rel.
1299 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1300 Output_data_reloc_generic*. Use add_global_generic.
1301 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1302 callers to use add_global_pair_with_rel.
1303 (Output_data_got::add_local): Change object to Relobj*.
1304 (Output_data_got::add_local_plt): Likewise.
1305 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1306 change rel_dyn to Output_data_reloc_generic*. Use
1307 add_local_generic.
1308 (Output_data_got::add_local_with_rela): Remove. Change all
1309 callers to use all_local_with_rel.
1310 (Output_data_got::add_local_pair_with_rel): Change object to
1311 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1312 add_output_section_generic.
1313 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1314 callers to use add_local_pair_with_rel.
1315 (Output_data_got::reserve_local): Change object to Relobj*.
1316 * output.h: (class Output_data_reloc_generic): Add pure virtual
1317 declarations for add_global_generic, add_local_generic,
1318 add_output_section_generic.
1319 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1320 functions for Output_data_reloc_generic. Update declarations for
1321 changes listed in output.cc.
1322 (class Output_data_got): Change template parameter to got_size.
1323 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1324 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1325 function.
1326 (Sized_relobj_incr::do_local_plt_offset): New function.
1327 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1328 add_global_generic.
1329
1330 2011-12-17 Cary Coutant <ccoutant@google.com>
1331
1332 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1333 * resolve.cc (Symbol_table::resolve): Likewise.
1334 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1335 arrays.
1336 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1337
1338 2011-12-16 Ian Lance Taylor <iant@google.com>
1339
1340 * output.h (Output_data_reloc_generic::add): Only call
1341 add_dynamic_reloc if this is a dynamic reloc section.
1342
1343 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1344
1345 PR gold/13505
1346 * target-reloc.h (apply_relocation): Replace <64, false> with
1347 <size, big_endian>.
1348
1349 2011-11-25 Nick Clifton <nickc@redhat.com>
1350
1351 * po/it.po: New Italian translation.
1352
1353 2011-11-17 Sterling Augustine <saugustine@google.com>
1354
1355 * script.cc (script_include_directive): Implement.
1356 (read_script_file): New local variables name and search_path. Update
1357 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1358 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1359 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1360
1361 2011-11-11 Sterling Augustine <saugustine@google.com>
1362
1363 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1364 (file_or_sections_cmd): Likewise.
1365
1366 2011-11-11 Doug Kwan <dougkwan@google.com>
1367
1368 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1369 if --just-symbols is given.
1370
1371 2011-11-10 Doug Kwan <dougkwan@google.com>
1372
1373 PR gold/13362
1374 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1375 when processing data relocs.
1376 * reloc.h (Relocate_functions::rel_unaligned): New method.
1377 (Relocate_functions::pcrel_unaligned): Ditto.
1378 (Relocate_functions::rel32_unaligned): Ditto.
1379 (Relocate_functions::pcrel32_unaligned): Ditto.
1380
1381 2011-11-09 Doug Kwan <dougkwan@google.com>
1382
1383 PR gold/13362
1384 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1385 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1386 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1387 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1388 (Relocate_functions::rel_unaligned): New.
1389 (Relocate_functions::rel32_unaligned): New.
1390 * target-reloc.h (relocate_for_relocatable): Add code to handle
1391 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1392 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1393 arm_unaligned_reloc_r): New targets.
1394 * testsuite/Makefile.in: Regenerate.
1395 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1396 linking.
1397
1398 2011-11-02 Ian Lance Taylor <iant@google.com>
1399
1400 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1401 NATIVE_LINKER.
1402 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1403 * options.cc (General_options::finalize): Use library search path
1404 from configure script if specified. If not native and no sysroot,
1405 only search TOOLLIBDIR.
1406 * options.h (Search_directory::Search_directory): Change name to
1407 const std::string&.
1408 (General_options::add_to_library_path_with_sysroot): Change arg to
1409 const std::string&.
1410 * configure, Makefile.in, config.in: Rebuild.
1411
1412 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1413
1414 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1415 we are working around the ARM1176 Erratum.
1416 * options.h (General_options::fix_arm1176): Add option.
1417 * testsuite/Makefile.am: Add testcases, and keep current ones
1418 working.
1419 * testsuite/Makefile.in: Regenerate.
1420 * testsuite/arm_fix_1176.s: New file.
1421 * testsuite/arm_fix_1176.sh: Likewise.
1422
1423 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1424
1425 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1426 may_use_blx_.
1427 (Target_arm::may_use_blx): Remove method.
1428 (Target_arm::set_may_use_blx): Likewise.
1429 (Target_arm::may_use_v4t_interworking): New method.
1430 (Target_arm::may_use_v5t_interworking): Likewise.
1431 (Target_arm::may_use_blx_): Remove member variable.
1432 (Arm_relocate_functions::arm_branch_common): Check for v5T
1433 interworking.
1434 (Arm_relocate_functions::thumb_branch_common): Likewise.
1435 (Reloc_stub::stub_type_for_reloc): Likewise.
1436 (Target_arm::do_finalize_sections): Correct interworking checks.
1437 * testsuite/Makefile.am: Add new tests.
1438 * testsuite/Makefile.in: Regenerate.
1439 * testsuite/arm_farcall_arm_arm.s: New test.
1440 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1441 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1442 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1443 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1444 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1445 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1446 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1447
1448 2011-10-31 Cary Coutant <ccoutant@google.com>
1449
1450 PR gold/13023
1451 * expression.cc (Expression::eval_with_dot): Add
1452 is_section_dot_assignment parameter.
1453 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1454 absolute and assigning to dot within a section.
1455 * script-sections.cc
1456 (Output_section_element_assignment::set_section_addresses): Pass
1457 dot_section to set_if_absolute.
1458 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1459 as is_section_dot_assignment flag to eval_with_dot.
1460 (Output_section_element_dot_assignment::set_section_addresses):
1461 Likewise.
1462 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1463 parameter. Also set value if relative to dot_section; set the
1464 symbol's output_section.
1465 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1466 parameter. Adjust all callers.
1467 (Expression::eval_maybe_dot): Likewise.
1468 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1469 Adjust all callers.
1470 * testsuite/script_test_2.t: Test assignment of an absolute value
1471 to dot within an output section element.
1472
1473 2011-10-31 Cary Coutant <ccoutant@google.com>
1474
1475 * options.h (class General_options): Add --[no-]gnu-unique options.
1476 * symtab.cc (Symbol_table::sized_write_globals): Convert
1477 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1478
1479 2011-10-31 Cary Coutant <ccoutant@google.com>
1480
1481 PR gold/13359
1482 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1483 unnecessary assertion.
1484 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1485
1486 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1487
1488 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1489 gc_mark_symbol.
1490 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1491 gc_mark_symbol.
1492 Change to just keep the section associated with symbol.
1493 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1494 they are externally visible and --export-dynamic is turned on.
1495 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1496
1497 2011-10-19 Ian Lance Taylor <iant@google.com>
1498
1499 PR gold/13163
1500 * script-sections.cc
1501 (Output_section_element_dot_assignment::needs_output_section): New
1502 function.
1503
1504 2011-10-19 Ian Lance Taylor <iant@google.com>
1505
1506 PR gold/13204
1507 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1508 --section-start option was seen.
1509 * options.h (General_options::any_section_start): New function.
1510
1511 2011-10-18 David S. Miller <davem@davemloft.net>
1512
1513 PR binutils/13301
1514 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1515 member to track relocation locations that have moved during TLS
1516 reloc optimizations.
1517 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1518 (Target_sparc::Relocate::relocate): Adjust view down by 4
1519 bytes if it matches reloc_adjust_addr_.
1520 (Target_sparc::Relocate::relocate_tls): Always move the
1521 __tls_get_addr call delay slot instruction forward 4 bytes when
1522 performing relaxation.
1523
1524 2011-10-18 Cary Coutant <ccoutant@google.com>
1525
1526 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1527 (Output_file::map_no_anonymous): Check for non-zero
1528 return code from posix_fallocate.
1529
1530 2011-10-17 Cary Coutant <ccoutant@google.com>
1531
1532 PR gold/13245
1533 * plugin.cc (is_visible_from_outside): Check for symbols
1534 referenced from dynamic objects.
1535 * resolve.cc (Symbol_table::resolve): Don't count references
1536 from dynamic objects as references from real ELF files.
1537 * testsuite/plugin_test_2.sh: Adjust expected result.
1538
1539 2011-10-17 Cary Coutant <ccoutant@google.com>
1540
1541 * gold.cc: Include timer.h.
1542 (queue_middle_tasks): Stamp time.
1543 (queue_final_tasks): Likewise.
1544 * main.cc (main): Store timer in parameters. Print timers
1545 for each pass.
1546 * parameters.cc (Parameters::Parameters): Initialize timer_.
1547 (Parameters::set_timer): New function.
1548 (set_parameters_timer): New function.
1549 * parameters.h (Parameters::set_timer): New function.
1550 (Parameters::timer): New function.
1551 (Parameters::timer_): New data member.
1552 (set_parameters_timer): New function.
1553 * timer.cc (Timer::stamp): New function.
1554 (Timer::get_pass_time): New function.
1555 * timer.h (Timer::stamp): New function.
1556 (Timer::get_pass_time): New function.
1557 (Timer::pass_times_): New data member.
1558
1559 2011-10-17 Cary Coutant <ccoutant@google.com>
1560
1561 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1562 task for members of lib groups.
1563
1564 2011-10-17 Cary Coutant <ccoutant@google.com>
1565
1566 PR gold/13288
1567 * fileread.cc (File_read::find_view): Add assert.
1568 (File_read::make_view): Move bounds check (replace with assert)...
1569 (File_read::find_or_make_view): ... to here.
1570
1571 2011-10-12 Cary Coutant <ccoutant@google.com>
1572
1573 * output.cc (Output_file::open_base_file): Handle case where
1574 ::read returns less than requested size.
1575
1576 2011-10-10 Cary Coutant <ccoutant@google.com>
1577
1578 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1579 Initialize defined_count_.
1580 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1581 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1582 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1583 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1584 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1585 * incremental.h (Sized_relobj_incr::defined_count_): New data
1586 member.
1587 (Sized_incr_dynobj::defined_count_): New data member.
1588 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1589 Return zeroes instead of internal error.
1590
1591 2011-10-10 Cary Coutant <ccoutant@google.com>
1592
1593 PR gold/13249
1594 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1595 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1596 * output.h (class Output_reloc): Add use_plt_offset flag.
1597 (Output_reloc::type_): Adjust size of bit field.
1598 (Output_reloc::use_plt_offset_): New bit field.
1599 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1600 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1601 flag. Adjust all callers.
1602 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1603 creating RELATIVE relocations.
1604
1605 2011-10-10 Nick Clifton <nickc@redhat.com>
1606
1607 * po/es.po: Updated Spanish translation.
1608 * po/fi.po: Updated Finnish translation.
1609
1610 2011-10-03 Diego Novillo <dnovillo@google.com>
1611
1612 * options.cc (parse_uint): Fix dereference of RETVAL.
1613
1614 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1615
1616 * layout.h (section_order_map_): New member.
1617 (get_section_order_map): New member function.
1618 * output.cc (Output_section::add_input_section): Check for patterns
1619 only when --section-ordering-file is specified.
1620 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1621 output_sections have been formed.
1622 * layout.cc (Layout_Layout): Initialize section_order_map_.
1623 * plugin.cc (update_section_order): Store order in order_map. Do not
1624 update the order.
1625 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1626 * testsuite/Makefile.in: Regenerate.
1627 * testsuite/plugin_section_order.c: New file.
1628 * testsuite/plugin_final_layout.cc: New file.
1629 * testsuite/plugin_final_layout.sh: New file.
1630
1631 2011-09-29 Cary Coutant <ccoutant@google.com>
1632
1633 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1634 Check for NULL.
1635 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1636 symbols during incremental update.
1637 (Symbol_table::add_from_dynobj): Likewise.
1638
1639 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1640 Ian Lance Taylor <iant@google.com>
1641
1642 * symtab.cc (Symbol_table::define_special_symbol): Always
1643 canonicalize version string.
1644
1645 2011-09-26 Cary Coutant <ccoutant@google.com>
1646
1647 * gold.cc (queue_initial_tasks): Move option checks ...
1648 * options.cc (General_options::finalize): ... to here. Disable
1649 some options; make others fatal.
1650
1651 2011-09-26 Cary Coutant <ccoutant@google.com>
1652
1653 gcc PR lto/47247
1654 * plugin.cc (get_symbols_v2): New function.
1655 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1656 (is_referenced_from_outside): New function.
1657 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1658 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1659 (get_symbols): Pass version parameter.
1660 (get_symbols_v2): New function.
1661 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1662 parameter.
1663 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1664 (onload): Add LDPT_GET_SYMBOLS_V2.
1665 (all_symbols_read_hook): Use get_symbols_v2; check for
1666 LDPR_PREVAILING_DEF_IRONLY_EXP.
1667 * testsuite/plugin_test_3.sh: Update expected results.
1668
1669 2011-09-23 Simon Baldwin <simonb@google.com>
1670
1671 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1672 configuration options.
1673 * configure: Regenerate.
1674 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1675 * Makefile.in: Regenerate.
1676 * testsuite/Makefile.in: Regenerate.
1677
1678 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1679
1680 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1681
1682 2011-09-19 Cary Coutant <ccoutant@google.com>
1683
1684 * incremental.cc (can_incremental_update): Fix typo in comment.
1685 * incremental.h (can_incremental_update): Likewise.
1686
1687 2011-09-18 Cary Coutant <ccoutant@google.com>
1688
1689 * incremental.cc (can_incremental_update): New function.
1690 * incremental.h (can_incremental_update): New function.
1691 * layout.cc (Layout::init_fixed_output_section): Call it.
1692 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1693 * object.cc (Sized_relobj_file::do_layout): Call
1694 can_incremental_update.
1695
1696 2011-09-13 Cary Coutant <ccoutant@google.com>
1697
1698 * configure.ac: Check for glibc support for gnu_indirect_function
1699 support with static linking, setting automake conditional
1700 IFUNC_STATIC.
1701 * Makefile.in: Regenerate.
1702 * configure: Regenerate.
1703
1704 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1705 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1706 for IFUNC_STATIC.
1707 * testsuite/Makefile.in: Regenerate.
1708
1709 2011-09-13 Cary Coutant <ccoutant@google.com>
1710
1711 * incremental.cc (Sized_relobj_incr::do_layout): Call
1712 report_comdat_group for kept comdat sections.
1713 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1714 * testsuite/Makefile.in: Regenerate.
1715 * testsuite/incr_comdat_test_1.cc: New source file.
1716 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1717 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1718 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1719
1720 2011-09-13 Ian Lance Taylor <iant@google.com>
1721
1722 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1723 variable external_symbols_offset.
1724
1725 2011-09-12 Ian Lance Taylor <iant@google.com>
1726
1727 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1728 triggered if object has no symbols.
1729
1730 2011-09-09 David S. Miller <davem@davemloft.net>
1731
1732 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1733 (Output_fill_debug_line::do_write): Likewise.
1734
1735 2011-08-29 Cary Coutant <ccoutant@google.com>
1736
1737 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1738 casts to match formatting specs.
1739 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1740
1741 2011-08-26 Cary Coutant <ccoutant@google.com>
1742
1743 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1744 remaining hole size when allocating.
1745 (Layout::make_output_section): Set fill methods for debug sections.
1746 * layout.h (Free_list::Free_list_node): Move from private to
1747 public.
1748 (Free_list::set_min_hole_size): New function.
1749 (Free_list::begin, Free_list::end): New functions.
1750 (Free_list::min_hole_): New data member.
1751 * output.cc: Include dwarf.h.
1752 (Output_fill_debug_info::do_minimum_hole_size): New function.
1753 (Output_fill_debug_info::do_write): New function.
1754 (Output_fill_debug_line::do_minimum_hole_size): New function.
1755 (Output_fill_debug_line::do_write): New function.
1756 (Output_section::Output_section): Initialize new data member.
1757 (Output_section::set_final_data_size): Ensure patch space is larger
1758 than minimum hole size.
1759 (Output_section::do_write): Fill holes in debug sections.
1760 * output.h (Output_fill): New class.
1761 (Output_fill_debug_info): New class.
1762 (Output_fill_debug_line): New class.
1763 (Output_section::set_free_space_fill): New function.
1764 (Output_section::free_space_fill_): New data member.
1765 * testsuite/Makefile.am (incremental_test_3): Add
1766 --incremental-patch option.
1767 (incremental_test_4): Likewise.
1768 (incremental_test_5): Likewise.
1769 (incremental_test_6): Likewise.
1770 (incremental_copy_test): Likewise.
1771 (incremental_common_test_1): Likewise.
1772 * testsuite/Makefile.in: Regenerate.
1773
1774 2011-08-26 Nick Clifton <nickc@redhat.com>
1775
1776 * po/es.po: Updated Spanish translation.
1777
1778 2011-08-01 Cary Coutant <ccoutant@google.com>
1779
1780 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1781 * gold/testsuite/Makefile.in: Regenerate.
1782 * gold/testsuite/justsyms_exec.c: New source file.
1783 * gold/testsuite/justsyms_lib.c: New source file.
1784
1785 2011-08-01 Cary Coutant <ccoutant@google.com>
1786
1787 * layout.cc (Layout::set_segment_offsets): Don't realign text
1788 segment if -Ttext was specified.
1789 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1790 file type.
1791 * object.h (Sized_relobj_file::e_type): New function.
1792 (Sized_relobj_file::e_type_): New data member.
1793 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1794 base address for ET_EXEC files.
1795 * target.cc (Target::do_make_elf_object_implementation): Allow
1796 ET_EXEC files with --just-symbols option.
1797
1798 2011-07-28 Cary Coutant <ccoutant@google.com>
1799
1800 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1801 Add thread_number parameter.
1802 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1803 * workqueue-threads.cc
1804 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1805 current thread if its thread number is greater than desired thread
1806 count.
1807 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1808 Add thread_number parameter.
1809 (Workqueue::should_cancel_thread): Likewise.
1810 (Workqueue::find_runnable_or_wait): Pass thread_number to
1811 should_cancel_thread.
1812 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1813 parameter.
1814
1815 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1816
1817 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1818 only after checking if it cannot be forced local.
1819 * symtab.h (is_externally_visible): Check if the symbol is not forced
1820 local.
1821
1822 2011-07-15 Ian Lance Taylor <iant@google.com>
1823
1824 * options.h (class General_options): Add --print-output-format.
1825 Move -EL next to -EB, for better --help output.
1826 * target-select.cc: Include <cstdio>, "options.h", and
1827 "parameters.h".
1828 (Target_selector::do_target_bfd_name): New function.
1829 (print_output_format): New function.
1830 * target-select.h (class Target_selector): Update declarations.
1831 (Target_selector::target_bfd_name): New function.
1832 (print_output_format): Declare.
1833 * main.cc: Include "target-select.h".
1834 (main): Handle --print-output-format.
1835 * gold.cc: Include "target-select.h".
1836 (queue_initial_tasks): Handle --print-output-format when there are
1837 no input files.
1838 * parameters.cc (parameters_force_valid_target): Give a better
1839 error message if -EB/-EL does not match target.
1840 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1841 function.
1842
1843 2011-07-15 Ian Lance Taylor <iant@google.com>
1844
1845 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1846 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1847 (Output_data_plt_i386::do_write): Write address of .dynamic
1848 section to first entry in .got.plt section.
1849 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1850 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1851 Initialize layout_.
1852 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1853 section to first entry in .got.plt section.
1854 * layout.h (Layout::dynamic_section): New function.
1855
1856 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1857
1858 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1859 to claim_file call.
1860 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1861 input_section_position_, and input_section_glob_.
1862 (read_layout_from_file): Call function section_ordering_specified.
1863 * layout.h (is_section_ordering_specified): New function.
1864 (section_ordering_specified): New function.
1865 (section_ordering_specified_): New boolean member.
1866 * main.cc(main): Call load_plugins after layout object is defined.
1867 * output.cc (Output_section::add_input_section): Use
1868 function section_ordering_specified to check if section ordering is
1869 needed.
1870 * output.cc (Output_section::add_relaxed_input_section): Use
1871 function section_ordering_specified to check if section ordering is
1872 needed.
1873 (Output_section::update_section_layout): New function.
1874 (Output_section::sort_attached_input_sections): Check if input section
1875 must be reordered.
1876 * output.h (Output_section::update_section_layout): New function.
1877 * plugin.cc (get_section_count): New function.
1878 (get_section_type): New function.
1879 (get_section_name): New function.
1880 (get_section_contents): New function.
1881 (update_section_order): New function.
1882 (allow_section_ordering): New function.
1883 (Plugin::load): Add the new interfaces to the transfer vector.
1884 (Plugin_manager::load_plugins): New parameter.
1885 (Plugin_manager::all_symbols_read): New parameter.
1886 (Plugin_manager::claim_file): New parameter. Save the elf object for
1887 unclaimed objects.
1888 (Plugin_manager::get_elf_object): New function.
1889 (Plugin_manager::get_view): Change to directly use the bool to check
1890 if get_view is called from claim_file_hook.
1891 * plugin.h (input_objects): New function
1892 (Plugin__manager::load_plugins): New parameter.
1893 (Plugin_manager::claim_file): New parameter.
1894 (Plugin_manager::get_elf_object): New function.
1895 (Plugin_manager::in_claim_file_handler): New function.
1896 (Plugin_manager::in_claim_file_handler_): New member.
1897 (layout): New function.
1898 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1899 handler with an extra parameter. Make the elf object before calling
1900 claim_file handler.
1901 * testsuite/plugin_test.c (get_section_count): New function pointer.
1902 (get_section_type): New function pointer.
1903 (get_section_name): New function pointer.
1904 (get_section_contents): New function pointer.
1905 (update_section_order): New function pointer.
1906 (allow_section_ordering): New function pointer.
1907 (onload): Check if the new interfaces exist.
1908
1909 2011-07-13 Ian Lance Taylor <iant@google.com>
1910
1911 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1912 relro section.
1913 * x86_64.cc (Target_x86_64::got_section): Likewise.
1914 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1915 (relro_now_test_SOURCES): New variable.
1916 (relro_now_test_DEPENDENCIES): New variable.
1917 (relro_now_test_LDFLAGS): New variable.
1918 (relro_now_test_LDADD): New variable.
1919 (relro_now_test.so): New target.
1920 * testsuite/Makefile.in: Rebuild.
1921
1922 2011-07-12 Ian Lance Taylor <iant@google.com>
1923
1924 PR gold/12980
1925 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1926 GLOB_DAT relocation rather than a RELATIVE relocation for a
1927 protected symbol when creating a shared library.
1928 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1929 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1930 * testsuite/protected_main_1.cc (main): Test that protected
1931 function has same address.
1932
1933 2011-07-11 Ian Lance Taylor <iant@google.com>
1934
1935 PR gold/12979
1936 * options.h (class General_options): Add -Bgroup.
1937 * options.cc (General_options::finalize): If -Bgroup is set,
1938 default to --unresolved-symbols=report-all.
1939 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1940 * target-reloc.h (issue_undefined_symbol_error): Handle
1941 --unresolved-symbols=report-all.
1942
1943 2011-07-08 Ian Lance Taylor <iant@google.com>
1944
1945 PR gold/11985
1946 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1947 if linker script discards key sections.
1948 (Layout::create_dynamic_symtab): Likewise.
1949 (Layout::assign_local_dynsym_offsets): Likewise.
1950 (Layout::sized_create_version_sections): Likewise.
1951 (Layout::create_interp): Likewise.
1952 (Layout::finish_dynamic_section): Likewise.
1953 (Layout::set_dynamic_symbol_size): Likewise.
1954
1955 2011-07-08 Ian Lance Taylor <iant@google.com>
1956
1957 PR gold/12386
1958 * options.h (class General_options): Add --unresolved-symbols.
1959 * target-reloc.h (issue_undefined_symbol_error): Check
1960 --unresolved-symbols. Add comments.
1961
1962 2011-07-08 Ian Lance Taylor <iant@google.com>
1963
1964 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1965 expression more complex.
1966
1967 2011-07-08 Ian Lance Taylor <iant@google.com>
1968
1969 PR gold/11317
1970 * target-reloc.h (issue_undefined_symbol_error): New inline
1971 function, broken out of relocate_section.
1972 (relocate_section): Call issue_undefined_symbol_error.
1973 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1974 there is no TLS segment if we are about to issue an undefined
1975 symbol error.
1976 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1977
1978 2011-07-08 Ian Lance Taylor <iant@google.com>
1979
1980 PR gold/12279
1981 * resolve.cc (Symbol_table::should_override): Add fromtype
1982 parameter. Change all callers. Give error when linking together
1983 TLS and non-TLS symbol.
1984 (Symbol_table::should_override_with_special): Add fromtype
1985 parameter. Change all callers.
1986 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1987 there is no TLS segment if we have reported some errors.
1988 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1989
1990 2011-07-08 Ian Lance Taylor <iant@google.com>
1991
1992 PR gold/12372
1993 * target.h (Target::plt_address_for_global): New function.
1994 (Target::plt_address_for_local): New function.
1995 (Target::plt_section_for_global): Remove.
1996 (Target::plt_section_for_local): Remove.
1997 (Target::do_plt_address_for_global): New virtual function.
1998 (Target::do_plt_address_for_local): New virtual function.
1999 (Target::do_plt_section_for_global): Remove.
2000 (Target::do_plt_section_for_local): Remove.
2001 (Target::register_global_plt_entry): Add Symbol_table and Layout
2002 parameters.
2003 * output.cc (Output_data_got::Got_entry::write): Use
2004 plt_address_for_global and plt_address_for_local.
2005 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2006 address of output section.
2007 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2008 got_irelative_, and irelative_count_ fields. Update
2009 declarations.
2010 (Output_data_plt_i386::has_irelative_section): New function.
2011 (Output_data_plt_i386::entry_count): Add irelative_count_.
2012 (Output_data_plt_i386::set_final_data_size): Likewise.
2013 (class Target_i386): Add got_irelative_ and rel_irelative_
2014 fields. Update declarations.
2015 (Target_i386::Target_i386): Initialize new fields.
2016 (Target_i386::do_plt_address_for_global): New function replacing
2017 do_plt_section_for_global.
2018 (Target_i386::do_plt_address_for_local): New function replacing
2019 do_plt_section_for_local.
2020 (Target_i386::got_section): Create got_irelative_.
2021 (Target_i386::rel_irelative_section): New function.
2022 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2023 fields. Don't define __rel_iplt_{start,end}.
2024 (Output_data_plt_i386::add_entry): Add symtab and layout
2025 parameters. Change all callers. Use different PLT and GOT for
2026 IFUNC symbols.
2027 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2028 layout parameters. Change all callers. Use different PLT and
2029 GOT.
2030 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2031 (Output_data_plt_i386::rel_irelative): New function.
2032 (Output_data_plt_i386::address_for_global): New function.
2033 (Output_data_plt_i386::address_for_local): New function.
2034 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2035 IRELATIVE GOT when changing IFUNC GOT entries.
2036 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2037 reloc.
2038 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2039 if we didn't create an IRELATIVE GOT.
2040 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2041 plt_address_for_local.
2042 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2043 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2044 got_irelative_, and irelative_count_ fields. Update
2045 declarations.
2046 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2047 Initialize new fields. Remove symtab parameter. Change all
2048 callers.
2049 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2050 irelative_count_.
2051 (Output_data_plt_x86_64::has_irelative_section): New function.
2052 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2053 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2054 fields. Update declarations.
2055 (Target_x86_64::Target_x86_64): Initialize new fields.
2056 (Target_x86_64::do_plt_address_for_global): New function replacing
2057 do_plt_section_for_global.
2058 (Target_x86_64::do_plt_address_for_local): New function replacing
2059 do_plt_section_for_local.
2060 (Target_x86_64::got_section): Create got_irelative_.
2061 (Target_x86_64::rela_irelative_section): New function.
2062 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2063 all callers. Don't create __rel_iplt_{start,end}.
2064 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2065 parameters. Change all callers. Use different PLT and GOT for
2066 IFUNC symbols.
2067 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2068 layout parameters. Change all callers. Use different PLT and
2069 GOT.
2070 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2071 parameters. Change all callers. Use different PLT and GOT for
2072 IFUNC symbols.
2073 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2074 (Output_data_plt_x86_64::rela_irelative): New function.
2075 (Output_data_plt_x86_64::address_for_global): New function.
2076 (Output_data_plt_x86_64::address_for_local): New function.
2077 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2078 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2079 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2080 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2081 parameters.
2082 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2083 reloc.
2084 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2085 symbols if we didn't create an IRELATIVE GOT.
2086 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2087 plt_address_for_local.
2088 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2089 * testsuite/ifuncvar1.c: New test file.
2090 * testsuite/ifuncvar2.c: New test file.
2091 * testsuite/ifuncvar3.c: New test file.
2092 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2093 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2094 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2095 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2096 * testsuite/Makefile.in: Rebuild.
2097
2098 2011-07-07 Cary Coutant <ccoutant@google.com>
2099
2100 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2101 (two_file_test_1_ndebug.o): Likewise.
2102 (two_file_test_1b_ndebug.o): Likewise.
2103 (two_file_test_2_ndebug.o): Likewise.
2104 (two_file_test_main_ndebug.o): Likewise.
2105 (incremental_test_2): Link with no-debug versions.
2106
2107 2011-07-06 Cary Coutant <ccoutant@google.com>
2108
2109 * gold/incremental.cc
2110 (Output_section_incremental_inputs::write_info_blocks): Check for
2111 hidden and internal symbols.
2112
2113 2011-07-06 Cary Coutant <ccoutant@google.com>
2114
2115 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2116 Check disposition for startup file.
2117 (Incremental_inputs::report_command_line): Ignore
2118 --incremental-startup-unchanged option.
2119 * options.cc (General_options::parse_incremental_startup_unchanged):
2120 New function.
2121 (General_options::General_options): Initialize new data member.
2122 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2123 (General_options): Add --incremental-startup-unchanged option.
2124 (General_options::incremental_startup_disposition): New function.
2125 (General_options::incremental_startup_disposition_): New data member.
2126
2127 2011-07-06 Cary Coutant <ccoutant@google.com>
2128
2129 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2130 input file index to Script_info ctor.
2131 (Sized_incremental_binary::do_file_has_changed): Find the
2132 command-line argument for files named in scripts.
2133 * incremental.h (Script_info::Script_info): New ctor
2134 with input file index.
2135 (Script_info::input_file_index): New function.
2136 (Script_info::input_file_index_): New data member.
2137 (Incremental_binary::get_library): Add const.
2138 (Incremental_binary::get_script_info): Add const.
2139 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2140 * testsuite/Makefile.am (incremental_test_5): New test case.
2141 (incremental_test_6): New test case.
2142 * testsuite/Makefile.in: Regenerate.
2143
2144 2011-07-06 Cary Coutant <ccoutant@google.com>
2145
2146 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2147 debug output when command lines differ.
2148
2149 2011-07-06 Cary Coutant <ccoutant@google.com>
2150
2151 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2152 --incremental-patch option.
2153 * layout.cc (Free_list::allocate): Extend allocation beyond original
2154 end if enabled.
2155 (Layout::make_output_section): Mark sections that should get
2156 patch space.
2157 * options.cc (parse_percent): New function.
2158 * options.h (parse_percent): New function.
2159 (DEFINE_percent): New macro.
2160 (General_options): Add --incremental-patch option.
2161 * output.cc (Output_section::Output_section): Initialize new data
2162 members.
2163 (Output_section::add_input_section): Print section name when out
2164 of patch space.
2165 (Output_section::add_output_section_data): Likewise.
2166 (Output_section::set_final_data_size): Add patch space when
2167 doing --incremental-full.
2168 (Output_section::do_reset_address_and_file_offset): Remove patch
2169 space.
2170 (Output_segment::set_section_list_addresses): Print debug output
2171 only if --incremental-update.
2172 * output.h (Output_section::set_is_patch_space_allowed): New function.
2173 (Output_section::is_patch_space_allowed_): New data member.
2174 (Output_section::patch_space_): New data member.
2175 * parameters.cc (Parameters::incremental_full): New function.
2176 * parameters.h (Parameters::incremental_full): New function
2177 * testsuite/Makefile.am (incremental_test_2): Add test for
2178 --incremental-patch option.
2179 * testsuite/Makefile.in: Regenerate.
2180 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2181 (t18): Remove function body.
2182
2183 2011-07-05 Doug Kwan <dougkwan@google.com>
2184
2185 PR gold/12771
2186 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2187 Arm_Address type for relocation result.
2188 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2189 overflow check.
2190 (Arm_relocate_functions::abs32): Use unaligned access.
2191 (Arm_relocate_functions::rel32): Ditto.
2192 (Arm_relocate_functions::prel31): Ditto.
2193 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2194 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2195 static data relocations.
2196 * testsuite/Makefile.in: Regnerate.
2197 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2198
2199 2011-07-05 Ian Lance Taylor <iant@google.com>
2200
2201 PR gold/12392
2202 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2203 symbols if necessary.
2204 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2205
2206 2011-07-05 Ian Lance Taylor <iant@google.com>
2207
2208 PR gold/12952
2209 * resolve.cc (Symbol::override_base_with_special): Simply override
2210 version with special symbol version, ignoring previous version.
2211
2212 2011-07-05 Ian Lance Taylor <iant@google.com>
2213
2214 * object.cc (Sized_relobj_file::include_section_group): Add
2215 information to comment about signature location.
2216
2217 2011-07-02 Ian Lance Taylor <iant@google.com>
2218
2219 PR gold/12957
2220 * options.h (class General_options): Add -f and -F.
2221 * options.cc (General_options::finalize): Fatal error if -f/-F
2222 are used without -shared.
2223 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2224
2225 2011-07-02 Ian Lance Taylor <iant@google.com>
2226
2227 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2228
2229 2011-07-01 Ian Lance Taylor <iant@google.com>
2230
2231 PR gold/12525
2232 PR gold/12952
2233 * resolve.cc (Symbol::override_base_with_special): Don't override
2234 the version if the overriding symbol has a different name.
2235 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2236 all callers. If we give an error about an undefined version,
2237 define the base version if necessary.
2238 * dynobj.h (class Versions): Update declaration.
2239 * testsuite/weak_alias_test_5.cc: New file.
2240 * testsuite/weak_alias_test.script: New file.
2241 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2242 and versioned_alias have the right value, and call t2.
2243 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2244 weak_alias_test_5.so.
2245 (weak_alias_test_LDADD): Likewise.
2246 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2247 * testsuite/Makefile.in: Rebuild.
2248
2249 2011-07-01 Ian Lance Taylor <iant@google.com>
2250
2251 PR gold/12525
2252 * options.h (class General_options): Support -z notext.
2253 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2254 -Wl,-z,notext.
2255 (two_file_shared_nonpic.so): Likewise.
2256 (two_file_shared_mixed.so): Likewise.
2257 (two_file_shared_mixed_1.so): Likewise.
2258 (weak_undef_lib_nonpic.so): Likewise.
2259 (alt/weak_undef_lib_nonpic.so): Likewise.
2260 (tls_test_shared_nonpic.so): Likewise.
2261 * testsuite/Makefile.in: Rebuild.
2262
2263 2011-07-01 Ian Lance Taylor <iant@google.com>
2264
2265 PR gold/12525
2266 * configure.ac: Test whether static linking works, setting
2267 the automake conditional HAVE_STATIC.
2268 * testsuite/Makefile.am: Disable tests using -static if
2269 HAVE_STATIC is not true.
2270 * configure, testsuite/Makefile.in: Rebuild.
2271
2272 2011-07-01 Ian Lance Taylor <iant@google.com>
2273
2274 PR gold/12525
2275 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2276 Assert if we see DW_EH_PE_indirect.
2277 * target.h (Target::ehframe_datarel_base): New function.
2278 (Target::do_ehframe_datarel_base): New target function.
2279 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2280 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2281 function.
2282
2283 2011-07-01 Ian Lance Taylor <iant@google.com>
2284
2285 PR gold/12571
2286 * options.h (class General_options): Add
2287 --ld-generated-unwind-info.
2288 * ehframe.cc (Fde::write): Add address parameter. Change all
2289 callers. If associated with PLT, fill in address and size.
2290 (Cie::set_output_offset): Only add merge mapping if there is an
2291 object.
2292 (Cie::write): Add address parameter. Change all callers.
2293 (Eh_frame::add_ehframe_for_plt): New function.
2294 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2295 input_offset_ fields into union u_, with new plt field.
2296 (Fde::Fde): Adjust for new union field.
2297 (Fde::Fde) [Output_data version]: New constructor.
2298 (Fde::add_mapping): Only add merge mapping if there is an object.
2299 (class Cie): Update declarations.
2300 (class Eh_frame): Declare add_ehframe_for_plt.
2301 * layout.cc (Layout::layout_eh_frame): Break out code into
2302 make_eh_frame_section, and call it.
2303 (Layout::make_eh_frame_section): New function.
2304 (Layout::add_eh_frame_for_plt): New function.
2305 * layout.h (class Layout): Update declarations.
2306 * merge.cc (Merge_map::add_mapping): Add assertion.
2307 * i386.cc: Include "dwarf.h".
2308 (class Output_data_plt_i386): Make first_plt_entry,
2309 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2310 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2311 and plt_eh_frame_fde.
2312 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2313 boundary. Call add_eh_frame_for_plt if appropriate.
2314 * x86_64.cc: Include "dwarf.h".
2315 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2316 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2317 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2318 and plt_eh_frame_fde.
2319 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2320 appropriate.
2321
2322 2011-06-29 Ian Lance Taylor <iant@google.com>
2323
2324 PR gold/12629
2325 * object.cc (Sized_relobj_file::layout_section): Change shdr
2326 parameter to be const.
2327 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2328 out of do_layout.
2329 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2330 appropriate. Call layout_eh_frame_section.
2331 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2332 sections.
2333 * object.h (class Sized_relobj_file): Update declarations.
2334
2335 2011-06-29 Ian Lance Taylor <iant@google.com>
2336
2337 PR gold/12652
2338 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2339 modifier.
2340 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2341
2342 2011-06-29 Ian Lance Taylor <iant@google.com>
2343
2344 PR gold/12675
2345 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2346 SHT_X86_64_UNWIND.
2347 * layout.cc (Layout::layout_eh_frame): Likewise.
2348
2349 2011-06-29 Ian Lance Taylor <iant@google.com>
2350
2351 PR gold/12695
2352 * layout.cc (Layout::symtab_section_shndx): New function.
2353 * layout.h (class Layout): Declare symtab_section_shndx.
2354 * output.cc (Output_section::write_header): Call it.
2355
2356 2011-06-29 Ian Lance Taylor <iant@google.com>
2357
2358 PR gold/12818
2359 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2360 symbols which are not used in a relocation.
2361
2362 2011-06-28 Ian Lance Taylor <iant@google.com>
2363
2364 PR gold/12898
2365 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2366 script create indistinguishable segments.
2367 (Layout::set_segment_offsets): Use stable_sort when sorting
2368 segments. Pass this to Compare_segments constructor.
2369 * layout.h (class Layout): Make segment_precedes non-static.
2370 (class Compare_segments): Change from struct to class. Add
2371 layout_ field. Add constructor.
2372 * script-sections.cc
2373 (Script_sections::attach_sections_using_phdrs_clause): Rename
2374 local orphan to is_orphan. Don't report failure to put empty
2375 section in segment. On attachment failure, report name of
2376 section, and attach to first PT_LOAD segment.
2377
2378 2011-06-28 Ian Lance Taylor <iant@google.com>
2379
2380 PR gold/12934
2381 * target-select.cc (Target_selector::Target_selector): Add
2382 emulation parameter. Change all callers.
2383 (select_target_by_bfd_name): Rename from select_target_by_name.
2384 Change all callers.
2385 (select_target_by_emulation): New function.
2386 (supported_emulation_names): New function.
2387 * target-select.h (class Target_selector): Add emulation_ field.
2388 Update declarations.
2389 (Target_selector::recognize_by_bfd_name): Rename from
2390 recognize_by_name. Change all callers.
2391 (Target_selector::supported_bfd_names): Rename from
2392 supported_names. Change all callers.
2393 (Target_selector::recognize_by_emulation): New function.
2394 (Target_selector::supported_emulations): New function.
2395 (Target_selector::emulation): New function.
2396 (Target_selector::do_recognize_by_bfd_name): Rename from
2397 do_recognize_by_name. Change all callers.
2398 (Target_selector::do_supported_bfd_names): Rename from
2399 do_supported_names. Change all callers.
2400 (Target_selector::do_recognize_by_emulation): New function.
2401 (Target_selector::do_supported_emulations): New function.
2402 (select_target_by_bfd_name): Change name in declaration.
2403 (select_target_by_emulation): Declare.
2404 (supported_emulation_names): Declare.
2405 * parameters.cc (parameters_force_valid_target): Try to find
2406 target based on emulation from -m option.
2407 * options.h (class General_options): Change doc string for -m.
2408 * options.cc (help): Print emulations.
2409 (General_options::parse_V): Likewise.
2410 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2411 Add emulation parameter. Change all callers.
2412
2413 2011-06-28 Ian Lance Taylor <iant@google.com>
2414
2415 * target.h (class Target): Add osabi_ field.
2416 (Target::osabi): New function.
2417 (Target::set_osabi): New function.
2418 (Target::Target): Initialize osabi_.
2419 (Target::do_adjust_elf_header): Make pure virtual.
2420 (Sized_target::do_adjust_elf_header): Declare.
2421 * target.cc (Sized_target::do_adjust_elf_header): New function.
2422 (class Sized_target): Instantiate all versions.
2423 * freebsd.h (class Target_freebsd): Remove.
2424 (Target_selector_freebsd::do_recognize): Call set_osabi on
2425 Target.
2426 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2427 (Target_selector_freebsd::set_osabi): Remove.
2428 * i386.cc (class Target_i386): Inherit from Sized_target rather
2429 than Target_freebsd.
2430 * x86_64.cc (class Target_x86_64): Likewise.
2431
2432 2011-06-28 Ian Lance Taylor <iant@google.com>
2433
2434 * target.h (Target::can_check_for_function_pointers): Rewrite.
2435 Make non-virtual.
2436 (Target::can_icf_inline_merge_sections): Likewise.
2437 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2438 (Target::Target_info): Add can_icf_inline_merge_sections field.
2439 (Target::do_can_check_for_function_pointers): New virtual
2440 function.
2441 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2442 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2443 from can_check_for_function_pointers, move in file.
2444 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2445 section_may_have_icf_unsafe_poineters, move in file.
2446 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2447 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2448 Rename from can_check_for_function_pointers, move in file.
2449 (Target_i386::can_icf_inline_merge_sections): Remove.
2450 (Target_i386::i386_info): Initialize
2451 can_icf_inline_merge_sections.
2452 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2453 Initialize can_icf_inline_merge_sections.
2454 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2455 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2456 Rename from can_check_for_function_pointers, move in file.
2457 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2458 (Target_x86_64::x86_64_info): Initialize
2459 can_icf_inline_merge_sections.
2460 * testsuite/testfile.cc (Target_test::test_target_info):
2461 Likewise.
2462 * icf.cc (get_section_contents): Correct formatting.
2463
2464 2011-06-27 Ian Lance Taylor <iant@google.com>
2465
2466 * symtab.cc (Symbol::versioned_name): New function.
2467 (Symbol_table::add_to_final_symtab): Use versioned_name when
2468 appropriate.
2469 (Symbol_table::sized_write_symbol): Likewise.
2470 * symtab.h (class Symbol): Declare versioned_name.
2471 * stringpool.h (class Stringpool_template): Add variant of add
2472 which takes a std::basic_string.
2473 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2474 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2475 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2476 (ver_test_12.o): New target.
2477 * testsuite/Makefile.in: Rebuild.
2478
2479 2011-06-27 Doug Kwan <dougkwan@google.com>
2480
2481 * arm.cc (Arm_relocate_functions::thm_jump8,
2482 Arm_relocate_functions::thm_jump11): Use a wider signed
2483 type to compute offset.
2484 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2485 arm_thm_jump8.
2486 * testsuite/Makefile.in: Regenerate.
2487 * testsuite/arm_branch_in_range.sh: Check test results of
2488 arm_thm_jump11 and arm_thm_jump8.
2489 * testsuite/arm_thm_jump11.s: New test source file.
2490 * testsuite/arm_thm_jump11.t: New linker script.
2491 * testsuite/arm_thm_jump8.s: New test source file.
2492 * testsuite/arm_thm_jump8.t: New linker script.
2493
2494 2011-06-24 Ian Lance Taylor <iant@google.com>
2495
2496 * layout.cc: Include "object.h".
2497 (ctors_sections_in_init_array): New static variable.
2498 (Layout::is_ctors_in_init_array): New function.
2499 (Layout::layout): Add entry to ctors_sections_in_init_array if
2500 appropriate.
2501 * layout.h (class Layout): Declare is_ctors_in_init_array.
2502 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2503 is_ctors_reverse_view is set.
2504 (Sized_relobj_file::write_sections): Add layout parameter. Change
2505 all callers. Set is_ctors_reverse_view field of View_size.
2506 (Sized_relobj_file::reverse_words): New function.
2507 * object.h (Sized_relobj_file::View_size): Add
2508 is_ctors_reverse_view field.
2509 (class Sized_relobj_file): Update declarations.
2510 * testsuite/initpri3.c: New test.
2511 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2512 initpri3b.
2513 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2514 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2515 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2516 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2517 * testsuite/Makefile.in: Rebuild.
2518
2519 2011-06-24 Cary Coutant <ccoutant@google.com>
2520
2521 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2522 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2523 (debug_msg_cdebug.err): New targets.
2524 * testsuite/Makefile.in: Regenerate.
2525 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2526 Fix checks for link with shared library.
2527
2528 2011-06-24 Doug Kwan <dougkwan@google.com>
2529
2530 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2531 skip empty text sections.
2532 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2533
2534 2011-06-22 Ian Lance Taylor <iant@google.com>
2535
2536 PR gold/12910
2537 * options.h (class General_options): Add --ctors-in-init-array.
2538 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2539 friends as SHT_PROGBITS for merging sections.
2540 (Layout::layout): Remove special handling of .init_array and
2541 friends. Don't sort if doing relocatable link. Sort for .ctors
2542 and .dtors if ctors_in_init_array.
2543 (Layout::make_output_section): Force correct section types for
2544 .init_array and friends. Don't sort if doing relocatable link,
2545 Don't sort .ctors and .dtors if ctors_in_init_array.
2546 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2547 (Layout::output_section_name): Add relobj parameter. Change all
2548 callers. Handle .ctors. and .dtors. in code rather than table.
2549 Handle .ctors and .dtors if ctors_in_init_array.
2550 (Layout::match_file_name): New function, moved from output.cc.
2551 * layout.h (class Layout): Update declarations.
2552 * output.cc: Include "layout.h".
2553 (Input_section_sort_entry::get_priority): New function.
2554 (Input_section_sort_entry::match_file_name): Just call
2555 Layout::match_file_name.
2556 (Output_section::Input_section_sort_init_fini_compare::operator()):
2557 Handle .ctors and .dtors. Sort by explicit priority rather than
2558 by name.
2559 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2560 * testsuite/initpri2.c: New test.
2561 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2562 (check_PROGRAMS): Add initpri2.
2563 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2564 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2565 * configure, testsuite/Makefile.in: Rebuild.
2566
2567 2011-06-19 Ian Lance Taylor <iant@google.com>
2568
2569 PR gold/12880
2570 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2571 .interp section to a PT_INTERP segment even if we have seen a
2572 --dynamic-linker option. Don't do it if we have seen a PHDRS
2573 clause in a linker script.
2574 (Layout::finalize): Don't create a .interp section if we've
2575 already create a PT_INTERP segment.
2576 (Layout::create_interp): Always call choose_output_section (revert
2577 patch of 2011-06-17). Don't create PT_INTERP segment.
2578 * script-sections.cc
2579 (Script_sections::create_note_and_tls_segments): Add a .interp
2580 section to a PT_INTERP segment even if we have seen a
2581 --dynamic-linker option.
2582
2583 2011-06-18 Ian Lance Taylor <iant@google.com>
2584
2585 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2586 merely because a non-PT_LOAD segment has a dynamic reloc.
2587
2588 2011-06-18 Ian Lance Taylor <iant@google.com>
2589
2590 * layout.cc (Layout::finish_dynamic_section): Don't create
2591 DT_FLAGS entry if not needed.
2592
2593 2011-06-18 Ian Lance Taylor <iant@google.com>
2594
2595 PR gold/12745
2596 * layout.cc (Layout::layout_eh_frame): Correct handling of
2597 writable .eh_frame section.
2598
2599 2011-06-17 Ian Lance Taylor <iant@google.com>
2600
2601 PR gold/12893
2602 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2603 symbol is redefined with the exact same object and value.
2604
2605 2011-06-17 Ian Lance Taylor <iant@google.com>
2606
2607 PR gold/12880
2608 * layout.h (class Layout): Add interp_segment_ field.
2609 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2610 (Layout::attach_allocated_section_to_segment): If making shared
2611 library, put .interp section in PT_INTERP segment.
2612 (Layout::finalize): Also call create_interp if -dynamic-linker
2613 option was used.
2614 (Layout::create_interp): Assert that there is no PT_INTERP
2615 segment. If not using a SECTIONS clause, use make_output_section.
2616 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2617 * script-sections.cc
2618 (Script_sections::create_note_and_tls_segments): If making shared
2619 library, put .interp section in PT_INTERP segment.
2620
2621 2011-06-17 Ian Lance Taylor <iant@google.com>
2622
2623 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2624 when making a shared library.
2625
2626 2011-06-17 Ian Lance Taylor <iant@google.com>
2627
2628 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2629 parameter. Change all callers. Don't issue warning about PC32
2630 against locally defined symbol.
2631
2632 2011-06-16 Ian Lance Taylor <iant@google.com>
2633
2634 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2635 occurs in same object.
2636
2637 2011-06-14 Alan Modra <amodra@gmail.com>
2638
2639 * po/POTFILES.in: Regenerate.
2640
2641 2011-06-09 Ian Lance Taylor <iant@google.com>
2642
2643 * script-sections.cc
2644 (Orphan_output_section::set_section_addresses): For a relocatable
2645 link set address to 0.
2646
2647 2011-06-09 Cary Coutant <ccoutant@google.com>
2648
2649 PR gold/12804
2650 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2651 used with --compress-debug-sections.
2652 * gold/object.cc (Sized_relobj_file::do_layout): Report
2653 uncompressed size of compressed input sections.
2654
2655 2011-06-08 Cary Coutant <ccoutant@google.com>
2656
2657 PR gold/12804
2658 * testsuite/two_file_test_2_v1.cc: Change initialization of
2659 v2 to keep it in .data.
2660
2661 2011-06-07 Cary Coutant <ccoutant@google.com>
2662
2663 * common.cc (Symbol_table::do_allocate_commons_list): Call
2664 gold_fallback.
2665 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2666 (Errors::fallback): New function.
2667 (gold_fallback): New function.
2668 * errors.h (Errors::fallback): New function.
2669 * gold.cc (gold_exit): Change status parameter to enum; adjust
2670 all callers.
2671 (queue_initial_tasks): Call gold_fallback.
2672 * gold.h: Include cstdlib.
2673 (Exit_status): New enum type.
2674 (gold_exit): Change status parameter to enum.
2675 (gold_fallback): New function.
2676 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2677 (Layout::create_symtab_sections): Likewise.
2678 (Layout::create_shdrs): Likewise.
2679 * main.cc (main): Adjust call to gold_exit.
2680 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2681 (Output_data_got::add_got_entry_pair): Likewise.
2682 (Output_section::add_input_section): Likewise.
2683 (Output_section::add_output_section_data): Likewise.
2684 (Output_segment::set_section_list_addresses): Likewise.
2685 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2686
2687 2011-06-07 Cary Coutant <ccoutant@google.com>
2688
2689 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2690 for incremental links.
2691 * output.cc (Output_segment::set_section_list_addresses): Remove
2692 FIXME and test for TLS or BSS.
2693
2694 2011-06-07 Cary Coutant <ccoutant@google.com>
2695
2696 * testsuite/Makefile.am: Add incremental_copy_test,
2697 incremental_common_test_1.
2698 * testsuite/Makefile.in: Regenerate.
2699 * testsuite/common_test_1_v1.c: New source file.
2700 * testsuite/common_test_1_v2.c: New source file.
2701 * testsuite/copy_test_v1.cc: New source file.
2702
2703 2011-06-07 Cary Coutant <ccoutant@google.com>
2704
2705 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2706 update, allocate common from bss section's free list.
2707 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2708 linker-defined symbols.
2709 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2710 Skip GOT and PLT entries that are no longer referenced.
2711 (Output_section_incremental_inputs::write_info_blocks): Mark
2712 linker-defined symbols.
2713 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2714 * output.cc (Output_section::allocate): New function.
2715 * output.h (Output_section::allocate): New function.
2716 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2717 linker-defined symbols.
2718 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2719 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2720 (Symbol::init_base_output_data): Likewise.
2721 (Symbol::init_base_output_segment): Likewise.
2722 (Symbol::init_base_constant): Likewise.
2723 (Sized_symbol::init_output_data): Likewise.
2724 (Sized_symbol::init_output_segment): Likewise.
2725 (Sized_symbol::init_constant): Likewise.
2726 (Symbol_table::do_define_in_output_data): Likewise.
2727 (Symbol_table::do_define_in_output_segment): Likewise.
2728 (Symbol_table::do_define_as_constant): Likewise.
2729 * symtab.h (Symbol::is_predefined): New function.
2730 (Symbol::init_base_output_data): Add is_predefined parameter.
2731 (Symbol::init_base_output_segment): Likewise.
2732 (Symbol::init_base_constant): Likewise.
2733 (Symbol::is_predefined_): New data member.
2734 (Sized_symbol::init_output_data): Add is_predefined parameter.
2735 (Sized_symbol::init_output_segment): Likewise.
2736 (Sized_symbol::init_constant): Likewise.
2737 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2738
2739 2011-06-07 Cary Coutant <ccoutant@google.com>
2740
2741 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2742 instead of emit_copy_reloc.
2743 (Copy_relocs::emit_copy_reloc): Refactor.
2744 (Copy_relocs::make_copy_reloc): New function.
2745 (Copy_relocs::add_copy_reloc): Remove.
2746 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2747 section.
2748 (Copy_relocs::make_copy_reloc): New function.
2749 (Copy_relocs::add_copy_reloc): Remove.
2750 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2751 unchanged input files.
2752 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2753 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2754 Reserve BSS space for COPY relocations.
2755 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2756 (Output_section_incremental_inputs::write_info_blocks): Record
2757 whether a symbol is copied from a shared object.
2758 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2759 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2760 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2761 (Incremental_input_entry_reader::get_output_symbol_index): Add
2762 is_copy parameter.
2763 (Incremental_binary::emit_copy_relocs): New function.
2764 (Incremental_binary::do_emit_copy_relocs): New function.
2765 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2766 new data member.
2767 (Sized_incremental_binary::add_copy_reloc): New function.
2768 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2769 (Sized_incremental_binary::Copy_reloc): New struct.
2770 (Sized_incremental_binary::Copy_relocs): New typedef.
2771 (Sized_incremental_binary::copy_relocs_): New data member.
2772 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2773 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2774 * target.h (Sized_target::emit_copy_reloc): New function.
2775 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2776
2777 2011-06-02 Cary Coutant <ccoutant@google.com>
2778
2779 PR gold/12163
2780 * gold/archive.cc (Archive::Archive): Initialize new data member.
2781 (Archive::include_all_members): Return if archive has already been
2782 included.
2783 * gold/archive.h (Archive::include_all_members_): New data member.
2784
2785 2011-06-02 Nick Clifton <nickc@redhat.com>
2786
2787 * dynobj.h: Fix spelling mistake in comment.
2788 * output.cc: Likewise.
2789
2790 2011-05-31 Doug Kwan <dougkwan@google.com>
2791 Asier Llano
2792
2793 PR gold/12826
2794 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2795 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2796 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2797 redundant arm_exidx_test.so.
2798 * testsuite/Makefile.in: Regenerate.
2799 (check_SCRIPTS): Add pr12826.sh
2800 (check_DATA): Add pr12826.stdout
2801 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2802 * testsuite/pr12826.sh: New file.
2803 * testsuite/pr12826_1.s: Ditto.
2804 * testsuite/pr12826_1.s: Ditto.
2805
2806 2011-05-30 Ian Lance Taylor <iant@google.com>
2807
2808 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2809 sections.
2810
2811 2011-05-29 Ian Lance Taylor <iant@google.com>
2812
2813 PR gold/12804
2814 * testsuite/Makefile.am: Use different file name for two_file_test
2815 temporary file for each incremental test.
2816 * testsuite/Makefile.in: Rebuild.
2817
2818 2011-05-29 Ian Lance Taylor <iant@google.com>
2819
2820 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2821 binary input file is empty.
2822
2823 2011-05-27 Ian Lance Taylor <iant@google.com>
2824
2825 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2826 (ver_test_9.so): Likewise.
2827 * testsuite/Makefile.in: Rebuild.
2828
2829 2011-05-26 Cary Coutant <ccoutant@google.com>
2830
2831 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2832 * incremental.cc (Incremental_inputs::report_input_section): Fix
2833 comment, indentation.
2834 (Incremental_inputs::report_comdat_group): New function.
2835 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2836 of data for incremental input file entry.
2837 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2838 group count, COMDAT group signatures.
2839 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2840 an unchanged input file.
2841 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2842 Initialize new data member.
2843 (Incremental_object_entry::add_comdat_group): New function.
2844 (Incremental_object_entry::get_comdat_group_count): New function.
2845 (Incremental_object_entry::get_comdat_signature_key): New function.
2846 (Incremental_object_entry::groups_): New data member.
2847 (Incremental_inputs::report_comdat_group): New function.
2848 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2849 data for incremental input file entry.
2850 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2851 (Incremental_input_entry_reader::get_input_section): Adjust size of
2852 data for incremental input file entry.
2853 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2854 (Incremental_input_entry_reader::get_comdat_group_signature): New
2855 function.
2856 * object.cc (Sized_relobj::include_section_group): Report kept
2857 COMDAT groups for incremental links.
2858
2859 2011-05-24 David Meyer <pdox@google.com>
2860
2861 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2862 with name parameter. Add found_name parameter.
2863 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2864 * dirsearch.h (class Dirsearch): Update declaration.
2865
2866 2011-05-24 Ian Lance Taylor <iant@google.com>
2867
2868 * archive.cc (Library_base::should_include_member): Pull in object
2869 from archive if it defines the entry symbol.
2870 * parameters.cc (Parameters::entry): New function.
2871 * parameters.h (class Parameters): Declare entry.
2872 * output.h (class Output_file_header): Remove entry_ field.
2873 * output.cc (Output_file_header::Output_file_header): Remove entry
2874 parameter. Change all callers.
2875 (Output_file_header::entry): Use parameters->entry.
2876 * gold.cc (queue_middle_tasks): Likewise.
2877 * plugin.cc (Plugin_hook::run): Likewise.
2878
2879 2011-05-24 Cary Coutant <ccoutant@google.com>
2880
2881 * gold.cc (queue_initial_tasks): Pass incremental base filename
2882 to Output_file::open_base_file; don't print error message.
2883 * incremental-dump.cc (main): Adjust call to
2884 Output_file::open_for_modification.
2885 * incremental-dump.cc (main): Likewise.
2886 * incremental.cc (Incremental_inputs::report_command_line):
2887 Ignore --incremental-base option when comparing command lines.
2888 Ignore parameter when given as separate argument.
2889 * options.h (class General_options): Add --incremental-base.
2890 * output.cc (Output_file::Output_file):
2891 (Output_file::open_base_file): Add base_name and writable parameters;
2892 read base file into new file; print error message here.
2893 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2894 callers.
2895 * output.h (Output_file::open_for_modification): Rename to...
2896 (Output_file::open_base_file): ...this; add base_name and
2897 writable parameters; adjust all callers.
2898 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2899 callers.
2900 * testsuite/Makefile.am (incremental_test_4): Test
2901 --incremental-base.
2902 * testsuite/Makefile.in: Regenerate.
2903
2904 2011-05-24 Cary Coutant <ccoutant@google.com>
2905
2906 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2907 incremental_test_4.
2908 * testsuite/Makefile.in: Regenerate.
2909 * testsuite/two_file_test_1_v1.cc: New test source file.
2910 * testsuite/two_file_test_1b_v1.cc: New test source file.
2911 * testsuite/two_file_test_2_v1.cc: New test source file.
2912
2913 2011-05-24 Cary Coutant <ccoutant@google.com>
2914
2915 * dynobj.h (Dynobj::do_dynobj): New function.
2916 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2917 flag and soname for shared objects.
2918 * incremental.cc (Incremental_inputs::report_object): Make
2919 either Incremental_object_entry or Incremental_dynobj_entry; add
2920 soname to string table.
2921 (Incremental_inputs::report_input_section): Add assertion.
2922 (Output_section_incremental_inputs::set_final_data_size): Adjust
2923 type of input file entry for shared libraries; adjust size of
2924 shared library info entry.
2925 (Output_section_incremental_inputs::write_input_files): Write
2926 as_needed flag for shared libraries.
2927 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2928 of input file entry for shared libraries; write soname.
2929 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2930 soname from incremental info.
2931 * incremental.h (enum Incremental_input_flags): Add
2932 INCREMENTAL_INPUT_AS_NEEDED.
2933 (Incremental_input_entry::Incremental_input_entry): Initialize new
2934 data member.
2935 (Incremental_input_entry::set_as_needed): New function.
2936 (Incremental_input_entry::as_needed): New function.
2937 (Incremental_input_entry::do_dynobj_entry): New function.
2938 (Incremental_input_entry::as_needed_): New data member.
2939 (Incremental_object_entry::Incremental_object_entry): Don't check
2940 for shared library.
2941 (Incremental_object_entry::do_type): Likewise.
2942 (class Incremental_dynobj_entry): New class.
2943 (Incremental_input_entry_reader::as_needed): New function.
2944 (Incremental_input_entry_reader::get_soname): New function.
2945 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2946 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2947 size of shared library info entry.
2948 * layout.cc (Layout::finish_dynamic_section): Don't test for
2949 incremental link when adding DT_NEEDED entries.
2950 * object.h (Object::Object): Initialize new data member.
2951 (Object::dynobj): New function.
2952 (Object::set_as_needed): New function.
2953 (Object::as_needed): New function.
2954 (Object::do_dynobj): New function.
2955 (Object::as_needed_): New data member.
2956
2957 2011-05-24 Cary Coutant <ccoutant@google.com>
2958
2959 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2960 info; adjust display of GOT entries.
2961 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2962 vector of input objects; remove file_status_.
2963 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2964 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2965 got_plt reader; call target hooks to reserve GOT entries.
2966 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2967 of input file info header and GOT info entry.
2968 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2969 relocation info.
2970 (Got_plt_view_info::got_descriptor): Remove.
2971 (Got_plt_view_info::sym_index): New data member.
2972 (Got_plt_view_info::input_index): New data member.
2973 (Local_got_offset_visitor::visit): Write input file index.
2974 (Global_got_offset_visitor::visit): Write 0 for input file index.
2975 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2976 with sym_index and input_index.
2977 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2978 incremental info GOT entry; replace got_descriptor with input_index.
2979 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2980 map from input file index to object.
2981 (Sized_relobj_incr::do_layout): Replace direct data member reference
2982 with accessor function.
2983 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2984 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2985 Adjust size of input file info header.
2986 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2987 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2988 (Incremental_input_entry_reader::get_input_section): Adjust size of
2989 input file info header.
2990 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2991 of incremental info GOT entry.
2992 (Incremental_got_plt_reader::get_got_desc): Remove.
2993 (Incremental_got_plt_reader::get_got_symndx): New function.
2994 (Incremental_got_plt_reader::get_got_input_index): New function.
2995 (Sized_incremental_binary::Sized_incremental_binary): Remove
2996 file_status_; add input_objects_.
2997 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2998 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2999 (Sized_incremental_binary::file_is_unchanged): Remove.
3000 (Sized_incremental_binary::set_input_object): New function.
3001 (Sized_incremental_binary::input_object): New function.
3002 (Sized_incremental_binary::file_status_): Remove.
3003 (Sized_incremental_binary::input_objects_): New data member.
3004 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3005 references.
3006 (Sized_relobj_incr::invalid_address): Move to base class.
3007 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3008 class.
3009 (Sized_relobj_incr::do_output_section_offset): Likewise.
3010 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3011 (Sized_relobj_incr::section_offsets_): Likewise.
3012 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3013 function.
3014 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3015 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3016 with accessor function.
3017 (Sized_relobj_file::do_layout): Likewise.
3018 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3019 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3020 (Sized_relobj_file::compute_final_local_value): Replace refs to
3021 section_offsets_ with accessor function.
3022 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3023 * object.h (Relobj::Relobj): Initialize new data members.
3024 (Relobj::add_dyn_reloc): New function.
3025 (Relobj::first_dyn_reloc): New function.
3026 (Relobj::dyn_reloc_count): New function.
3027 (Relobj::first_dyn_reloc_): New data member.
3028 (Relobj::dyn_reloc_count_): New data member.
3029 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3030 references.
3031 (Sized_relobj::Address): New typedef.
3032 (Sized_relobj::invalid_address): Move here from child class.
3033 (Sized_relobj::Sized_relobj): Initialize new data members.
3034 (Sized_relobj::sized_relobj): New function.
3035 (Sized_relobj::is_output_section_offset_invalid): Move here from
3036 child class.
3037 (Sized_relobj::get_output_section_offset): Likewise.
3038 (Sized_relobj::local_has_got_offset): Likewise.
3039 (Sized_relobj::local_got_offset): Likewise.
3040 (Sized_relobj::set_local_got_offset): Likewise.
3041 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3042 (Sized_relobj::clear_got_offsets): New function.
3043 (Sized_relobj::section_offsets): Move here from child class.
3044 (Sized_relobj::do_output_section_offset): Likewise.
3045 (Sized_relobj::do_set_section_offset): Likewise.
3046 (Sized_relobj::Local_got_offsets): Likewise.
3047 (Sized_relobj::local_got_offsets_): Likewise.
3048 (Sized_relobj::section_offsets_): Likewise.
3049 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3050 references.
3051 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3052 class.
3053 (Sized_relobj_file::sized_relobj): New function
3054 (Sized_relobj_file::local_has_got_offset): Move to base class.
3055 (Sized_relobj_file::local_got_offset): Likewise.
3056 (Sized_relobj_file::set_local_got_offset): Likewise.
3057 (Sized_relobj_file::get_output_section_offset): Likewise.
3058 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3059 (Sized_relobj_file::do_output_section_offset): Likewise.
3060 (Sized_relobj_file::do_set_section_offset): Likewise.
3061 (Sized_relobj_file::Local_got_offsets): Likewise.
3062 (Sized_relobj_file::local_got_offsets_): Likewise.
3063 (Sized_relobj_file::section_offsets_): Likewise.
3064 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3065 (all constructors).
3066 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3067 (Output_reloc::get_symbol_index): Likewise.
3068 (Output_reloc::local_section_offset): Likewise.
3069 (Output_reloc::get_address): Likewise.
3070 (Output_reloc::symbol_value): Likewise.
3071 (Output_data_got::reserve_slot): Move to class definition.
3072 (Output_data_got::reserve_local): New function.
3073 (Output_data_got::reserve_slot_for_global): Remove.
3074 (Output_data_got::reserve_global): New function.
3075 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3076 (all constructors, two instantiations).
3077 (Output_reloc::get_relobj): New function (two instantiations).
3078 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3079 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3080 (Output_data_reloc::add_global): Adjust type of relobj.
3081 (Output_data_reloc::add_global_relative): Likewise.
3082 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3083 (Output_data_reloc::add_local): Likewise.
3084 (Output_data_reloc::add_local_relative): Likewise.
3085 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3086 (Output_data_reloc::add_local_section): Likewise.
3087 (Output_data_reloc::add_output_section): Likewise.
3088 (Output_data_reloc::add_absolute): Likewise.
3089 (Output_data_reloc::add_target_specific): Likewise.
3090 (Output_data_got::reserve_slot): Move definition here.
3091 (Output_data_got::reserve_local): New function.
3092 (Output_data_got::reserve_global): New function.
3093 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3094 section_offsets_ with accessor function.
3095 (Sized_relobj_file::write_sections): Likewise.
3096 (Sized_relobj_file::do_relocate_sections): Likewise.
3097 * target.h (Sized_target::reserve_local_got_entry): New function.
3098 (Sized_target::reserve_global_got_entry): New function.
3099 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3100 (Target_x86_64::reserve_global_got_entry): New function.
3101 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3102
3103 2011-05-23 Cary Coutant <ccoutant@google.com>
3104
3105 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3106 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3107 bit when checking got_type.
3108 * incremental.cc (Sized_incremental_binary::setup_readers):
3109 Store symbol table and string table locations; initialize bit vector
3110 of file status flags.
3111 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3112 unchanged files.
3113 (Sized_incremental_binary::do_process_got_plt): New function.
3114 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3115 (Output_section_incremental_inputs::set_final_data_size): Record
3116 file index for each input file.
3117 (Output_section_incremental_inputs::write_got_plt): Store file index
3118 instead of input entry offset for each GOT entry.
3119 * incremental.h
3120 (Incremental_input_entry::Incremental_input_entry): Initialize new
3121 data member.
3122 (Incremental_input_entry::set_offset): Store file index.
3123 (Incremental_input_entry::get_file_index): New function.
3124 (Incremental_input_entry::file_index_): New data member.
3125 (Incremental_binary::process_got_plt): New function.
3126 (Incremental_binary::do_process_got_plt): New function.
3127 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3128 data members.
3129 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3130 (Sized_incremental_binary::set_file_is_unchanged): New function.
3131 (Sized_incremental_binary::file_is_unchanged): New function.
3132 (Sized_incremental_binary::do_process_got_plt): New function.
3133 (Sized_incremental_binary::file_status_): New data member.
3134 (Sized_incremental_binary::main_symtab_loc_): New data member.
3135 (Sized_incremental_binary::main_strtab_loc_): New data member.
3136 * output.cc (Output_data_got::Got_entry::write): Add case
3137 RESERVED_CODE.
3138 (Output_data_got::add_global): Call add_got_entry.
3139 (Output_data_got::add_global_plt): Likewise.
3140 (Output_data_got::add_global_with_rel): Likewise.
3141 (Output_data_got::add_global_with_rela): Likewise.
3142 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3143 (Output_data_got::add_global_pair_with_rela): Likewise.
3144 (Output_data_got::add_local): Call add_got_entry.
3145 (Output_data_got::add_local_plt): Likewise.
3146 (Output_data_got::add_local_with_rel): Likewise.
3147 (Output_data_got::add_local_with_rela): Likewise.
3148 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3149 (Output_data_got::add_local_pair_with_rela): Likewise.
3150 (Output_data_got::reserve_slot): New function.
3151 (Output_data_got::reserve_slot_for_global): New function.
3152 (Output_data_got::add_got_entry): New function.
3153 (Output_data_got::add_got_entry_pair): New function.
3154 (Output_section::add_output_section_data): Edit FIXME.
3155 * output.h
3156 (Output_section_data_build::Output_section_data_build): New
3157 constructor with size parameter.
3158 (Output_data_space::Output_data_space): Likewise.
3159 (Output_data_got::Output_data_got): Initialize new data member; new
3160 constructor with size parameter.
3161 (Output_data_got::add_constant): Call add_got_entry.
3162 (Output_data_got::reserve_slot): New function.
3163 (Output_data_got::reserve_slot_for_global): New function.
3164 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3165 (Output_data_got::add_got_entry): New function.
3166 (Output_data_got::add_got_entry_pair): New function.
3167 (Output_data_got::free_list_): New data member.
3168 * target.h (Sized_target::init_got_plt_for_update): New function.
3169 (Sized_target::register_global_plt_entry): New function.
3170 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3171 Initialize new data member; call init; add constructor with PLT count.
3172 (Output_data_plt_x86_64::init): New function.
3173 (Output_data_plt_x86_64::add_relocation): New function.
3174 (Output_data_plt_x86_64::reserve_slot): New function.
3175 (Output_data_plt_x86_64::free_list_): New data member.
3176 (Target_x86_64::init_got_plt_for_update): New function.
3177 (Target_x86_64::register_global_plt_entry): New function.
3178 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3179 incremental updates.
3180 (Output_data_plt_x86_64::add_relocation): New function.
3181 * testsuite/object_unittest.cc (Object_test): Set default options.
3182
3183 2011-05-16 Ian Lance Taylor <iant@google.com>
3184
3185 * options.h (class General_options): Make -i a synonym for -r.
3186
3187 2011-05-16 Ian Lance Taylor <iant@google.com>
3188
3189 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3190
3191 2011-05-10 Cary Coutant <ccoutant@google.com>
3192
3193 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3194 strip_all (-s).
3195
3196 2011-05-06 Ian Lance Taylor <iant@google.com>
3197
3198 * layout.cc (Layout::layout): If the output section flags change,
3199 update the ordering.
3200
3201 2011-04-25 Cary Coutant <ccoutant@google.com>
3202
3203 * incremental-dump.cc (dump_incremental_inputs): Print local
3204 symbol info for each input file.
3205 * incremental.cc
3206 (Output_section_incremental_inputs::set_final_data_size): Add local
3207 symbol info to input file entries in incremental info.
3208 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3209 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3210 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3211 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3212 implementation.
3213 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3214 (Sized_incr_relobj::do_relocate): Write the local symbols.
3215 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3216 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3217 Adjust size of input file header.
3218 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3219 (Incremental_inputs_reader::get_local_symbol_count): New function.
3220 (Incremental_inputs_reader::get_input_section): Adjust size of input
3221 file header.
3222 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3223 (Sized_incr_relobj::This): New typedef.
3224 (Sized_incr_relobj::sym_size): New const data member.
3225 (Sized_incr_relobj::Local_symbol): New struct.
3226 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3227 (Sized_incr_relobj::do_local_symbol_offset): New function.
3228 (Sized_incr_relobj::local_symbol_count_): New data member.
3229 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3230 (Sized_incr_relobj::local_symbol_index_): New data member.
3231 (Sized_incr_relobj::local_symbol_offset_): New data member.
3232 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3233 (Sized_incr_relobj::local_symbols_): New data member.
3234 * object.h (Relobj::output_local_symbol_count): New function.
3235 (Relobj::local_symbol_offset): New function.
3236 (Relobj::do_output_local_symbol_count): New function.
3237 (Relobj::do_local_symbol_offset): New function.
3238 (Sized_relobj::do_output_local_symbol_count): New function.
3239 (Sized_relobj::do_local_symbol_offset): New function.
3240
3241 2011-04-22 Vladimir Simonov <sv@sw.ru>
3242
3243 * descriptors.cc (set_close_on_exec): New function.
3244 (Descriptors::open): Use set_close_on_exec.
3245 * output.cc (S_ISLNK): Define if not defined.
3246
3247 2011-04-22 Cary Coutant <ccoutant@google.com>
3248
3249 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3250 global symbol map.
3251 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3252 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3253 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3254 relocations.
3255 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3256 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3257 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3258 * incremental.h
3259 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3260 function.
3261 (Incremental_binary::apply_incremental_relocs): New function.
3262 (Incremental_binary::do_apply_incremental_relocs): New function.
3263 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3264 data member.
3265 (Sized_incremental_binary::add_global_symbol): New function.
3266 (Sized_incremental_binary::global_symbol): New function.
3267 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3268 (Sized_incremental_binary::symbol_map_): New data member.
3269 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3270 * target.h (Sized_target::apply_relocation): New function.
3271 * target-reloc.h (apply_relocation): New function.
3272 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3273
3274 2011-04-22 Doug Kwan <dougkwan@google.com>
3275
3276 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3277 flag of a SHT_ARM_EXIDX section.
3278 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3279 * testsuite/Makefile.in: Regenerate.
3280 * testsuite/arm_exidx_test.s: New file.
3281 * testsuite/arm_exidx_test.sh: Same.
3282
3283 2011-04-20 Cary Coutant <ccoutant@google.com>
3284
3285 PR gold/12689
3286 * archive.h (Incremental_archive_entry::Archive_member):
3287 Initialize arg_serial_ (second constructor).
3288
3289 2011-04-17 Ian Lance Taylor <iant@google.com>
3290
3291 * object.cc (Relocate_info::location): Simplify location string.
3292 * errors.cc (Errors::error_at_location): Don't print program
3293 name.
3294 (Errors::warning_at_location): Likewise.
3295 (Errors::undefined_symbol): Likewise.
3296 * testsuite/debug_msg.sh: Update accordingly.
3297
3298 2011-04-14 Cary Coutant <ccoutant@google.com>
3299
3300 * gold/layout.cc (Layout::symtab_section_offset): New function.
3301 * gold/layout.h (Layout::symtab_section_offset): New function.
3302 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3303
3304 2011-04-12 Ian Lance Taylor <iant@google.com>
3305
3306 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3307 with MREMAP_MAYMOVE.
3308 * output.h (class Output_file): Add map_is_allocated_ field.
3309 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3310 not available, provide stubs. If mremap is not available, #define
3311 it to gold_mremap.
3312 (MREMAP_MAYMOVE): Define if not defined.
3313 (Output_file::Output_file): Initialize map_is_allocated_.
3314 (Output_file::resize): Check map_is_allocated_.
3315 (Output_file::map_anonymous): If mmap fails, use malloc.
3316 (Output_file::unmap): Don't do anything for an anonymous map.
3317 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3318 is not available, provide stubs.
3319 (File_read::View::~View): Use free rather than delete[].
3320 (File_read::make_view): Use malloc rather than new[]. If mmap
3321 fails, use malloc.
3322 (File_read::find_or_make_view): Use malloc rather than new[].
3323 * gold.h: Remove HAVE_REMAP code.
3324 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3325 exists. Rename mremap to gold_mremap. If mmap is not available
3326 don't do anything.
3327 * configure, config.in: Rebuild.
3328
3329 2011-04-11 Ian Lance Taylor <iant@google.com>
3330
3331 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3332 initialize local variable v.
3333
3334 2011-04-11 Cary Coutant <ccoutant@google.com>
3335
3336 * archive.cc (Archive::include_member): Adjust call to
3337 report_object.
3338 (Add_archive_symbols::run): Track argument serial numbers.
3339 (Lib_group::include_member): Likewise.
3340 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3341 * archive.h (Incremental_archive_entry::Archive_member):
3342 Initialize arg_serial_.
3343 (Archive_member::arg_serial_): New data member.
3344 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3345 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3346 incremental link.
3347 (Sized_dynobj::do_for_all_local_got_entries): New function.
3348 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3349 function.
3350 * fileread.cc (get_mtime): New function.
3351 * fileread.h (get_mtime): New function.
3352 * gold.cc (queue_initial_tasks): Check for incremental update.
3353 (process_incremental_input): New function.
3354 (queue_middle_tasks): Don't force valid target for incremental
3355 update.
3356 * incremental-dump.cc (find_input_containing_global): Adjust
3357 size of symbol info entry.
3358 (dump_incremental_inputs): Dump argument serial number and
3359 in_system_directory flag; bias shndx by 1; print symbol names
3360 when dumping per-file symbol lists; use new symbol info readers.
3361 * incremental.cc
3362 (Output_section_incremental_inputs:update_data_size): New function.
3363 (Sized_incremental_binary::setup_readers): Setup input readers
3364 for each input file; build maps for files added from libraries
3365 and scripts.
3366 (Sized_incremental_binary::check_input_args): New function.
3367 (Sized_incremental_binary::do_check_inputs): Build map of argument
3368 serial numbers to input arguments.
3369 (Sized_incremental_binary::do_file_has_changed): Rename
3370 do_file_is_unchanged to this; compare file modification times.
3371 (Sized_incremental_binary::do_init_layout): New function.
3372 (Sized_incremental_binary::do_reserve_layout): New function.
3373 (Sized_incremental_binary::do_get_input_reader): Remove.
3374 (Sized_incremental_binary::get_symtab_view): New function.
3375 (Incremental_checker::can_incrementally_link_output_file): Remove.
3376 (Incremental_inputs::report_command_line): Exclude --debug options.
3377 (Incremental_inputs::report_archive_begin): Add parameter; track
3378 argument serial numbers; don't put input file entry for archive
3379 before archive members.
3380 (Incremental_inputs::report_archive_end): Put input file entry
3381 for archive after archive members.
3382 (Incremental_inputs::report_object): Add parameter; track argument
3383 serial numbers and in_system_directory flag.
3384 (Incremental_inputs::report_script): Add parameter; track argument
3385 serial numbers.
3386 (Output_section_incremental_inputs::set_final_data_size): Adjust
3387 size of symbol info entry; check for forwarding symbols.
3388 (Output_section_incremental_inputs::write_input_files): Write
3389 in_system_directory flag and argument serial number.
3390 (Output_section_incremental_inputs::write_info_blocks): Map section
3391 indices between incremental info and original input file; store
3392 input section index for each symbol.
3393 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3394 change operator() to visit().
3395 (class Global_got_offset_visitor): Likewise.
3396 (class Global_symbol_visitor_got_plt):
3397 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3398 classes.
3399 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3400 (Sized_incr_relobj::do_read_symbols): New function.
3401 (Sized_incr_relobj::do_layout): New function.
3402 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3403 (Sized_incr_relobj::do_add_symbols): New function.
3404 (Sized_incr_relobj::do_should_include_member): New function.
3405 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3406 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3407 (Sized_incr_relobj::do_section_size): New function.
3408 (Sized_incr_relobj::do_section_name): New function.
3409 (Sized_incr_relobj::do_section_contents): New function.
3410 (Sized_incr_relobj::do_section_flags): New function.
3411 (Sized_incr_relobj::do_section_entsize): New function.
3412 (Sized_incr_relobj::do_section_address): New function.
3413 (Sized_incr_relobj::do_section_type): New function.
3414 (Sized_incr_relobj::do_section_link): New function.
3415 (Sized_incr_relobj::do_section_info): New function.
3416 (Sized_incr_relobj::do_section_addralign): New function.
3417 (Sized_incr_relobj::do_initialize_xindex): New function.
3418 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3419 (Sized_incr_relobj::do_read_relocs): New function.
3420 (Sized_incr_relobj::do_gc_process_relocs): New function.
3421 (Sized_incr_relobj::do_scan_relocs): New function.
3422 (Sized_incr_relobj::do_count_local_symbols): New function.
3423 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3424 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3425 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3426 (Sized_incr_relobj::do_relocate): New function.
3427 (Sized_incr_relobj::do_set_section_offset): New function.
3428 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3429 (Sized_incr_dynobj::do_read_symbols): New function.
3430 (Sized_incr_dynobj::do_layout): New function.
3431 (Sized_incr_dynobj::do_add_symbols): New function.
3432 (Sized_incr_dynobj::do_should_include_member): New function.
3433 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3434 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3435 (Sized_incr_dynobj::do_section_size): New function.
3436 (Sized_incr_dynobj::do_section_name): New function.
3437 (Sized_incr_dynobj::do_section_contents): New function.
3438 (Sized_incr_dynobj::do_section_flags): New function.
3439 (Sized_incr_dynobj::do_section_entsize): New function.
3440 (Sized_incr_dynobj::do_section_address): New function.
3441 (Sized_incr_dynobj::do_section_type): New function.
3442 (Sized_incr_dynobj::do_section_link): New function.
3443 (Sized_incr_dynobj::do_section_info): New function.
3444 (Sized_incr_dynobj::do_section_addralign): New function.
3445 (Sized_incr_dynobj::do_initialize_xindex): New function.
3446 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3447 (make_sized_incremental_object): New function.
3448 (Incremental_library::copy_unused_symbols): New function.
3449 (Incremental_library::do_for_all_unused_symbols): New function.
3450 * incremental.h (enum Incremental_input_flags): New type.
3451 (class Incremental_checker): Remove.
3452 (Incremental_input_entry::Incremental_input_entry): Add argument
3453 serial number.
3454 (Incremental_input_entry::arg_serial): New function.
3455 (Incremental_input_entry::set_is_in_system_directory): New function.
3456 (Incremental_input_entry::is_in_system_directory): New function.
3457 (Incremental_input_entry::arg_serial_): New data member.
3458 (Incremental_input_entry::is_in_system_directory_): New data member.
3459 (class Script_info): Move here from script.h.
3460 (Script_info::Script_info): Add filename parameter.
3461 (Script_info::filename): New function.
3462 (Script_info::filename_): New data member.
3463 (Incremental_script_entry::Incremental_script_entry): Add argument
3464 serial number.
3465 (Incremental_object_entry::Incremental_object_entry): Likewise.
3466 (Incremental_object_entry::add_input_section): Build list of input
3467 sections with map to original shndx.
3468 (Incremental_object_entry::get_input_section_index): New function.
3469 (Incremental_object_entry::shndx_): New data member.
3470 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3471 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3472 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3473 serial number.
3474 (Incremental_inputs::report_archive_begin): Likewise.
3475 (Incremental_inputs::report_object): Likewise.
3476 (Incremental_inputs::report_script): Likewise.
3477 (class Incremental_global_symbol_reader): New class.
3478 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3479 and store flags and input file type.
3480 (Incremental_input_entry_reader::arg_serial): New function.
3481 (Incremental_input_entry_reader::type): Extract type from flags.
3482 (Incremental_input_entry_reader::is_in_system_directory): New function.
3483 (Incremental_input_entry_reader::get_input_section_count): Call
3484 accessor function for type.
3485 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3486 function for type; adjust size of global symbol entry.
3487 (Incremental_input_entry_reader::get_global_symbol_count): Call
3488 accessor function for type.
3489 (Incremental_input_entry_reader::get_object_count): Likewise.
3490 (Incremental_input_entry_reader::get_object_offset): Likewise.
3491 (Incremental_input_entry_reader::get_member_count): Likewise.
3492 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3493 (Incremental_input_entry_reader::get_member_offset): Likewise.
3494 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3495 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3496 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3497 (Incremental_input_entry_reader::get_global_symbol_reader): New
3498 function.
3499 (Incremental_input_entry_reader::get_output_symbol_index): New
3500 function.
3501 (Incremental_input_entry_reader::type_): Remove.
3502 (Incremental_input_entry_reader::flags_): New data member.
3503 (Incremental_inputs_reader::input_file_offset): New function.
3504 (Incremental_inputs_reader::input_file_index): New function.
3505 (Incremental_inputs_reader::input_file): Call input_file_offset.
3506 (Incremental_inputs_reader::input_file_at_offset): New function.
3507 (Incremental_relocs_reader::get_r_type): Reformat.
3508 (Incremental_relocs_reader::get_r_shndx): Reformat.
3509 (Incremental_relocs_reader::get_r_offset): Reformat.
3510 (Incremental_relocs_reader::data): New function.
3511 (Incremental_binary::Incremental_binary): Initialize new data members.
3512 (Incremental_binary::check_inputs): Add cmdline parameter.
3513 (Incremental_binary::file_is_unchanged): Remove.
3514 (Input_reader::arg_serial): New function.
3515 (Input_reader::get_unused_symbol_count): New function.
3516 (Input_reader::get_unused_symbol): New function.
3517 (Input_reader::do_arg_serial): New function.
3518 (Input_reader::do_get_unused_symbol_count): New function.
3519 (Input_reader::do_get_unused_symbol): New function.
3520 (Incremental_binary::input_file_count): New function.
3521 (Incremental_binary::get_input_reader): Change signature to use
3522 index instead of filename.
3523 (Incremental_binary::file_has_changed): New function.
3524 (Incremental_binary::get_input_argument): New function.
3525 (Incremental_binary::get_library): New function.
3526 (Incremental_binary::get_script_info): New function.
3527 (Incremental_binary::init_layout): New function.
3528 (Incremental_binary::reserve_layout): New function.
3529 (Incremental_binary::output_file): New function.
3530 (Incremental_binary::do_check_inputs): New function.
3531 (Incremental_binary::do_file_is_unchanged): Remove.
3532 (Incremental_binary::do_file_has_changed): New function.
3533 (Incremental_binary::do_init_layout): New function.
3534 (Incremental_binary::do_reserve_layout): New function.
3535 (Incremental_binary::do_input_file_count): New function.
3536 (Incremental_binary::do_get_input_reader): Change signature.
3537 (Incremental_binary::input_args_map_): New data member.
3538 (Incremental_binary::library_map_): New data member.
3539 (Incremental_binary::script_map_): New data member.
3540 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3541 new data members.
3542 (Sized_incremental_binary::output_section): New function.
3543 (Sized_incremental_binary::inputs_reader): Add const.
3544 (Sized_incremental_binary::symtab_reader): Add const.
3545 (Sized_incremental_binary::relocs_reader): Add const.
3546 (Sized_incremental_binary::got_plt_reader): Add const.
3547 (Sized_incremental_binary::get_symtab_view): New function.
3548 (Sized_incremental_binary::Inputs_reader): New typedef.
3549 (Sized_incremental_binary::Input_entry_reader): New typedef.
3550 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3551 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3552 (Sized_incremental_binary::do_file_has_changed): New function.
3553 (Sized_incremental_binary::do_init_layout): New function.
3554 (Sized_incremental_binary::do_reserve_layout): New function.
3555 (Sized_input_reader::Inputs_reader): Remove.
3556 (Sized_input_reader::Input_entry_reader): Remove.
3557 (Sized_input_reader::do_arg_serial): New function.
3558 (Sized_input_reader::do_get_unused_symbol_count): New function.
3559 (Sized_input_reader::do_get_unused_symbol): New function.
3560 (Sized_incremental_binary::do_input_file_count): New function.
3561 (Sized_incremental_binary::do_get_input_reader): Change signature;
3562 use index instead of filename.
3563 (Sized_incremental_binary::section_map_): New data member.
3564 (Sized_incremental_binary::input_entry_readers_): New data member.
3565 (class Sized_incr_relobj): New class.
3566 (class Sized_incr_dynobj): New class.
3567 (make_sized_incremental_object): New function.
3568 (class Incremental_library): New class.
3569 * layout.cc (Free_list::num_lists): New static data member.
3570 (Free_list::num_nodes): New static data member.
3571 (Free_list::num_removes): New static data member.
3572 (Free_list::num_remove_visits): New static data member.
3573 (Free_list::num_allocates): New static data member.
3574 (Free_list::num_allocate_visits): New static data member.
3575 (Free_list::init): New function.
3576 (Free_list::remove): New function.
3577 (Free_list::allocate): New function.
3578 (Free_list::dump): New function.
3579 (Free_list::print_stats): New function.
3580 (Layout_task_runner::run): Resize output file for incremental updates.
3581 (Layout::Layout): Initialize new data members.
3582 (Layout::set_incremental_base): New function.
3583 (Layout::init_fixed_output_section): New function.
3584 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3585 incremental updates.
3586 (Layout::create_gold_note): Do not create gold note section for
3587 incremental updates.
3588 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3589 for incremental updates.
3590 (Layout::set_section_offsets): For incremental updates, allocate space
3591 from free list.
3592 (Layout::create_symtab_sections): Layout with offsets relative to
3593 start of section; for incremental updates, allocate space from free
3594 list.
3595 (Layout::create_shdrs): For incremental updates, allocate space from
3596 free list.
3597 (Layout::finish_dynamic_section): For incremental updates, do not
3598 check --as-needed (fixed in subsequent patch).
3599 * layout.h (class Free_list): New class.
3600 (Layout::set_incremental_base): New function.
3601 (Layout::incremental_base): New function.
3602 (Layout::init_fixed_output_section): New function.
3603 (Layout::allocate): New function.
3604 (Layout::incremental_base_): New data member.
3605 (Layout::free_list_): New data member.
3606 * main.cc (main): Print Free_list statistics.
3607 * object.cc (Relobj::finalize_incremental_relocs): Add
3608 clear_counts parameter; clear counts only when clear_counts is set.
3609 (Sized_relobj::Sized_relobj): Initialize new base class.
3610 (Sized_relobj::do_layout): Don't report special sections.
3611 (Sized_relobj::do_for_all_local_got_entries): New function.
3612 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3613 symtab_off to all symbol table offsets.
3614 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3615 * object.h (class Got_offset_list): Move to top of file.
3616 (Object::Object): Allow case where input_file == NULL.
3617 (Object::~Object): Likewise.
3618 (Object::input_file): Assert that input_file != NULL.
3619 (Object::lock): Allow case where input_file == NULL.
3620 (Object::unlock): Likewise.
3621 (Object::is_locked): Likewise.
3622 (Object::token): Likewise.
3623 (Object::release): Likewise.
3624 (Object::is_incremental): New function.
3625 (Object::get_mtime): New function.
3626 (Object::for_all_local_got_entries): New function.
3627 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3628 (Object::set_is_in_system_directory): New function.
3629 (Object::is_in_system_directory): New function.
3630 (Object::do_is_incremental): New function.
3631 (Object::do_get_mtime): New function.
3632 (Object::do_for_all_local_got_entries): New function.
3633 (Object::is_in_system_directory_): New data member.
3634 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3635 (class Sized_relobj_base): New class.
3636 (class Sized_relobj): Derive from Sized_relobj_base.
3637 (class Sized_relobj::Symbols): Redeclare from base class.
3638 (class Sized_relobj::local_got_offset_list): Remove.
3639 (class Sized_relobj::Output_sections): Redeclare from base class.
3640 (class Sized_relobj::do_for_all_local_got_entries): New function.
3641 (class Sized_relobj::write_local_symbols): Add offset parameter.
3642 (class Sized_relobj::local_symbol_offset_): Update comment.
3643 (class Sized_relobj::local_dynsym_offset_): Update comment.
3644 * options.cc (Input_arguments::add_file): Remove const.
3645 * options.h (Input_file_argument::Input_file_argument):
3646 Initialize arg_serial_ (all constructors).
3647 (Input_file_argument::set_arg_serial): New function.
3648 (Input_file_argument::arg_serial): New function.
3649 (Input_file_argument::arg_serial_): New data member.
3650 (Input_arguments::Input_arguments): Initialize file_count_.
3651 (Input_arguments::add_file): Remove const.
3652 (Input_arguments::number_of_input_files): New function.
3653 (Input_arguments::file_count_): New data member.
3654 (Command_line::number_of_input_files): Call
3655 Input_arguments::number_of_input_files.
3656 * output.cc (Output_segment_headers::Output_segment_headers):
3657 Set current size.
3658 (Output_section::Input_section::current_data_size): New function.
3659 (Output_section::Output_section): Initialize new data members.
3660 (Output_section::add_input_section): Don't do merge sections for
3661 an incremental link; allocate space from free list for an
3662 incremental update.
3663 (Output_section::add_output_section_data): Allocate space from
3664 free list for an incremental update.
3665 (Output_section::update_data_size): New function.
3666 (Output_section::set_fixed_layout): New function.
3667 (Output_section::reserve): New function.
3668 (Output_segment::set_section_addresses): Remove const.
3669 (Output_segment::set_section_list_addresses): Remove const; allocate
3670 space from free list for an incremental update.
3671 (Output_segment::set_offset): Adjust size of RELRO segment for an
3672 incremental update.
3673 * output.h (Output_data::current_data_size): Move here from
3674 child classes.
3675 (Output_data::pre_finalize_data_size): New function.
3676 (Output_data::update_data_size): New function.
3677 (Output_section_headers::update_data_size): new function.
3678 (Output_section_data_build::current_data_size): Move to Output_data.
3679 (Output_data_strtab::update_data_size): New function.
3680 (Output_section::current_data_size): Move to Output_data.
3681 (Output_section::set_fixed_layout): New function.
3682 (Output_section::has_fixed_layout): New function.
3683 (Output_section::reserve): New function.
3684 (Output_section::update_data_size): New function.
3685 (Output_section::has_fixed_layout_): New data member.
3686 (Output_section::free_list_): New data member.
3687 (Output_segment::set_section_addresses): Remove const.
3688 (Output_segment::set_section_list_addresses): Remove const.
3689 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3690 New function.
3691 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3692 New function.
3693 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3694 parameter when calling Add_symbols constructor; store argument
3695 serial number for members of a lib group.
3696 (Add_symbols::locks): Allow case where token == NULL.
3697 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3698 (Read_member::~Read_member): New function.
3699 (Read_member::is_runnable): New function.
3700 (Read_member::locks): New function.
3701 (Read_member::run): New function.
3702 (Check_script::~Check_script): New function.
3703 (Check_script::is_runnable): New function.
3704 (Check_script::locks): New function.
3705 (Check_script::run): New function.
3706 (Check_library::~Check_library): New function.
3707 (Check_library::is_runnable): New function.
3708 (Check_library::locks): New function.
3709 (Check_library::run): New function.
3710 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3711 (Add_symbols::library_): New data member.
3712 (class Read_member): New class.
3713 (class Check_script): New class.
3714 (class Check_library): New class.
3715 * reloc.cc (Read_relocs::is_runnable): Allow case where
3716 token == NULL.
3717 (Read_relocs::locks): Likewise.
3718 (Scan_relocs::locks): Likewise.
3719 (Relocate_task::locks): Likewise.
3720 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3721 to clear counters.
3722 (Sized_relobj::incremental_relocs_scan): Fix comment.
3723 (Sized_relobj::do_relocate): Pass output file offset to
3724 write_local_symbols.
3725 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3726 from class declaration.
3727 * script.cc (read_input_script): Allocate Script_info; pass
3728 argument serial number to report_script.
3729 * script.h (class Script_info): Move to incremental.h.
3730 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3731 * symtab.h (Symbol_table::add_from_incrobj): New function.
3732 (Symbol_table::set_file_offset): New function.
3733
3734 2011-04-05 Cary Coutant <ccoutant@google.com>
3735
3736 * incremental-dump.cc (dump_incremental_inputs): Change signature
3737 to take a Sized_incremental_binary; change caller. Use readers
3738 in Sized_incremental_binary.
3739 * incremental.cc
3740 (Sized_incremental_binary::find_incremental_inputs_sections):
3741 Rename do_find_incremental_inputs_sections to this.
3742 (Sized_incremental_binary::setup_readers): New function.
3743 (Sized_incremental_binary::do_check_inputs): Check
3744 has_incremental_info_ flag; move setup code to setup_readers;
3745 use input readers.
3746 (Sized_incremental_binary::do_file_is_unchanged): New function.
3747 (Sized_incremental_binary::do_get_input_reader): New function.
3748 * incremental.h (class Incremental_binary): Move to end of file.
3749 (Incremental_binary::file_is_unchanged): New function.
3750 (Incremental_binary::do_file_is_unchanged): New function.
3751 (Incremental_binary::Input_reader): New class.
3752 (Incremental_binary::get_input_reader): New function.
3753 (class Sized_incremental_binary): Move to end of file.
3754 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3755 input section reader classes.
3756 (Sized_incremental_binary::has_incremental_info): New function.
3757 (Sized_incremental_binary::inputs_reader): New function.
3758 (Sized_incremental_binary::symtab_reader): New function.
3759 (Sized_incremental_binary::relocs_reader): New function.
3760 (Sized_incremental_binary::got_plt_reader): New function.
3761 (Sized_incremental_binary::do_file_is_unchanged): New function.
3762 (Sized_incremental_binary::Sized_input_reader): New class.
3763 (Sized_incremental_binary::get_input_reader): New function.
3764 (Sized_incremental_binary::find_incremental_inputs_sections):
3765 Rename do_find_incremental_inputs_sections to this.
3766 (Sized_incremental_binary::setup_readers): New function.
3767 (Sized_incremental_binary::has_incremental_info_): New data member.
3768 (Sized_incremental_binary::inputs_reader_): New data member.
3769 (Sized_incremental_binary::symtab_reader_): New data member.
3770 (Sized_incremental_binary::relocs_reader_): New data member.
3771 (Sized_incremental_binary::got_plt_reader_): New data member.
3772 (Sized_incremental_binary::current_input_file_): New data member.
3773
3774 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3775
3776 PR gold/12640
3777 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3778 violation.
3779
3780 2011-03-30 Cary Coutant <ccoutant@google.com>
3781
3782 * archive.cc (Archive::include_member): Adjust call to report_object.
3783 (Add_archive_symbols::run): Add script_info to call to
3784 report_archive_begin.
3785 (Lib_group::include_member): Adjust call to report_object.
3786 (Add_lib_group_symbols::run): Adjust call to report_object.
3787 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3788 blocks. Add object count for script input files.
3789 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3790 script_info parameter; change all callers.
3791 (Incremental_inputs::report_object): Add script_info parameter;
3792 change all callers.
3793 (Incremental_inputs::report_script): Store backpointer to
3794 incremental info entry.
3795 (Output_section_incremental_inputs::set_final_data_size): Record
3796 additional information for scripts.
3797 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3798 * incremental.h (Incremental_script_entry::add_object): New function.
3799 (Incremental_script_entry::get_object_count): New function.
3800 (Incremental_script_entry::get_object): New function.
3801 (Incremental_script_entry::objects_): New data member; adjust
3802 constructor.
3803 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3804 (Incremental_inputs::report_object): Add script_info parameter.
3805 (Incremental_inputs_reader::get_object_count): New function.
3806 (Incremental_inputs_reader::get_object_offset): New function.
3807 * options.cc (Input_arguments::add_file): Return reference to
3808 new input argument.
3809 * options.h (Input_argument::set_script_info): New function.
3810 (Input_argument::script_info): New function.
3811 (Input_argument::script_info_): New data member; adjust all
3812 constructors.
3813 (Input_file_group::add_file): Return reference to new input argument.
3814 (Input_file_lib::add_file): Likewise.
3815 (Input_arguments::add_file): Likewise.
3816 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3817 * script.cc (Parser_closure::Parser_closure): Add script_info
3818 parameter; adjust all callers.
3819 (Parser_closure::script_info): New function.
3820 (Parser_closure::script_info_): New data member.
3821 (read_input_script): Report scripts earlier to incremental info.
3822 (script_add_file): Set script_info in Input_argument.
3823 (script_add_library): Likewise.
3824 * script.h (Script_options::Script_info): Rewrite class.
3825
3826 2011-03-29 Cary Coutant <ccoutant@google.com>
3827
3828 * archive.cc (Library_base::should_include_member): Move
3829 method here from class Archive.
3830 (Archive::Archive): Initialize base class.
3831 (Archive::should_include_member): Move to base class.
3832 (Archive::do_for_all_unused_symbols): New function.
3833 (Add_archive_symbols::run): Remove redundant access to
3834 incremental_inputs.
3835 (Lib_group::Lib_group): Initialize base class.
3836 (Lib_group::do_filename): New function.
3837 (Lib_group::include_member): Pass pointer to Lib_group to
3838 report_object.
3839 (Lib_group::do_for_all_unused_symbols): New function.
3840 (Add_lib_group_symbols::run): Report archive information for
3841 incremental links.
3842 * archive.h (class Library_base): New base class.
3843 (class Archive): Derive from Library_base.
3844 (Archive::filename): Move to base class.
3845 (Archive::set_incremental_info): Likewise.
3846 (Archive::incremental_info): Likewise.
3847 (Archive::Should_include): Likewise.
3848 (Archive::should_include_member): Likewise.
3849 (Archive::Armap_entry): Remove.
3850 (Archive::Unused_symbol_iterator): Remove.
3851 (Archive::unused_symbols_begin): Remove.
3852 (Archive::unused_symbols_end): Remove.
3853 (Archive::do_filename): New function.
3854 (Archive::do_get_mtime): New function.
3855 (Archive::do_for_all_unused_symbols): New function.
3856 (Archive::task_): Move to base class.
3857 (Archive::incremental_info_): Likewise.
3858 (class Lib_group): Derive from Library_base.
3859 (Lib_group::do_filename): New function.
3860 (Lib_group::do_get_mtime): New function.
3861 (Lib_group::do_for_all_unused_symbols): New function.
3862 (Lib_group::task_): Move to base class.
3863 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3864 function.
3865 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3866 function.
3867 * incremental.cc (Incremental_inputs::report_archive_begin):
3868 Use Library_base; call library's get_mtime; add incremental inputs
3869 entry before members.
3870 (class Unused_symbol_visitor): New class.
3871 (Incremental_inputs::report_archive_end): Use Library_base; use
3872 visitor class to record unused symbols; don't add incremental inputs
3873 entry after members.
3874 (Incremental_inputs::report_object): Use Library_base.
3875 * incremental.h
3876 (Incremental_archive_entry::Incremental_archive_entry): Remove
3877 unused Archive parameter.
3878 (Incremental_inputs::report_archive_begin): Use Library_base.
3879 (Incremental_inputs::report_archive_end): Likewise.
3880 (Incremental_inputs::report_object): Likewise.
3881 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3882 function.
3883 * object.h (Object::for_all_global_symbols): New function.
3884 (Object::do_for_all_global_symbols): New function.
3885 (Sized_relobj::do_for_all_global_symbols): New function.
3886 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3887 function.
3888 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3889 function.
3890
3891 2011-03-27 Ian Lance Taylor <iant@google.com>
3892
3893 * archive.cc (Archive::interpret_header): Return -1 if something
3894 goes wrong. Change callers accordingly.
3895
3896 2011-03-25 Cary Coutant <ccoutant@google.com>
3897
3898 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3899 * testsuite/Makefile.in: Regenerate.
3900
3901 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3902
3903 * plugin.cc (get_view): New.
3904 (Plugin::load): Pass get_view to the plugin.
3905 (Plugin_manager::get_view): New.
3906
3907 2011-03-21 Ian Lance Taylor <iant@google.com>
3908
3909 * testsuite/final_layout.sh: Rewrite to not use dc.
3910 * testsuite/relro_test.sh: Fail if dc is not present.
3911
3912 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3913
3914 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3915 Change == to -eq.
3916 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3917 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3918 Change == to -eq.
3919 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3920 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3921
3922 2011-03-14 Ian Lance Taylor <iant@google.com>
3923
3924 * script-sections.cc (Sort_output_sections::script_compare):
3925 Rename from is_before, change return type.
3926 (Sort_output_sections::operator()): Adjust accordingly.
3927
3928 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3929
3930 PR gold/12572
3931 * testsuite/odr_violation2.cc: Add comment to make all error line
3932 numbers double digits.
3933 * testsuite/debug_msg.sh: Adjust expected errors.
3934
3935 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3936
3937 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3938 but mark earlier ones as non-canonical
3939 (offset_to_iterator): Update search target and example
3940 (do_addr2line): Return extra lines in a vector*
3941 (format_file_lineno): Extract from do_addr2line
3942 (one_addr2line): Add vector* out-param
3943 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3944 when a lineno entry appeared last for its instruction
3945 (Dwarf_line_info): Add vector* out-param
3946 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3947 * symtab.cc (Odr_violation_compare): Include the lineno in the
3948 comparison again.
3949 (linenos_from_loc): New. Combine the canonical line for an
3950 address with its other lines.
3951 (True_if_intersect): New. Helper functor to make
3952 std::set_intersection a query.
3953 (detect_odr_violations): Compare sets of lines instead of just
3954 one line for each function. This became less deterministic, but
3955 has fewer false positives.
3956 * symtab.h: Declarations.
3957 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3958 mix an optimized and non-optimized object in the same binary
3959 (odr_violation2.so): Same.
3960 * testsuite/Makefile.in: Regenerate from Makefile.am.
3961 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3962 * testsuite/debug_msg.sh: Update line numbers and add
3963 assertions.
3964 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3965 non-optimized context.
3966 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3967 isn't inlined, and use OdrDerived in an optimized context.
3968 * testsuite/odr_header1.h: Defines OdrDerived, where
3969 optimization will change the
3970 first-instruction-in-the-destructor's file and line number.
3971 * testsuite/odr_header2.h: Defines OdrBase.
3972
3973 2011-03-09 Ian Lance Taylor <iant@google.com>
3974
3975 * fileread.cc (File_read::clear_views): Don't delete the whole
3976 file view.
3977
3978 2011-03-08 Ian Lance Taylor <iant@google.com>
3979
3980 PR gold/12525
3981 * fileread.cc: #include <climits>.
3982 (GOLD_IOV_MAX): Define.
3983 (File_read::read_multiple): Limit number of entries by iov_max.
3984 * fileread.h (class File_read): Always set max_readv_entries to
3985 128.
3986
3987 2011-03-07 Ian Lance Taylor <iant@google.com>
3988
3989 PR gold/12525
3990 * options.h (class General_options): Add -dy and -dn.
3991
3992 2011-03-02 Cary Coutant <ccoutant@google.com>
3993
3994 * testsuite/script_test_9.t: Add TLS segment.
3995
3996 2011-03-02 Simon Baldwin <simonb@google.com>
3997
3998 * configure.ac: Add check for gnu_indirect_function support in
3999 the toolchain building binutils.
4000 * configure: Rebuild.
4001
4002 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4003
4004 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4005 plugin only symbols.
4006 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4007 in plugin files as not needed in the symbol table.
4008
4009 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4010
4011 * output.cc (Output_section::add_input_section): Delay fill
4012 generation for section ordering.
4013
4014 2011-02-09 Ian Lance Taylor <iant@google.com>
4015
4016 PR gold/12316
4017 * object.h (class Sized_relobj): Remove clear_local_symbols.
4018 * reloc.cc (Sized_relobj::do_relocate): Don't call
4019 clear_local_symbols.
4020
4021 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4022
4023 * plugin.cc (is_visible_from_outside): Return true for symbols
4024 in the -u option.
4025
4026 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4027
4028 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4029 filename.
4030
4031 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4032
4033 * icf.h (is_section_foldable_candidate): Change type of parameter
4034 to std::string.
4035 * icf.cc (Icf::find_identical_sections): Change type of local variable
4036 section_name to be std::string.
4037 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4038
4039 2011-01-25 Ian Lance Taylor <iant@google.com>
4040
4041 * script.cc (script_add_extern): Rewrite to use
4042 add_symbol_reference.
4043
4044 2011-01-25 Doug Kwan <dougkwan@google.com>
4045
4046 * icf.cc (get_section_contents): Always lock section's object.
4047
4048 2011-01-24 Ian Lance Taylor <iant@google.com>
4049
4050 * options.h (class General_options): Accept
4051 --no-detect-odr-violations.
4052
4053 2011-01-24 Ian Lance Taylor <iant@google.com>
4054
4055 * version.cc (version_string): Bump to 1.11.
4056
4057 2011-01-24 Ian Lance Taylor <iant@google.com>
4058
4059 * plugin.cc (class Plugin_rescan): Define new class.
4060 (Plugin_manager::claim_file): Set any_claimed_.
4061 (Plugin_manager::save_archive): New function.
4062 (Plugin_manager::save_input_group): New function.
4063 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4064 necessary.
4065 (Plugin_manager::new_undefined_symbol): New function.
4066 (Plugin_manager::rescan): New function.
4067 (Plugin_manager::rescannable_defines): New function.
4068 (Plugin_manager::add_input_file): Set any_added_.
4069 * plugin.h (class Plugin_manager): define new fields rescannable_,
4070 undefined_symbols_, any_claimed_, and any_added_. Declare
4071 Plugin_rescan as friend. Declare new functions.
4072 (Plugin_manager::Rescannable): Define type.
4073 (Plugin_manager::Rescannable_list): Define type.
4074 (Plugin_manager::Undefined_symbol_list): Define type.
4075 (Plugin_manager::Plugin_manager): Initialize new fields.
4076 * archive.cc (Archive::defines_symbol): New function.
4077 (Add_archive_symbols::run): Pass archive to plugins if any.
4078 * archive.h (class Archive): Declare defines_symbol.
4079 * readsyms.cc (Input_group::~Input_group): New function.
4080 (Finish_group::run): Pass input_group to plugins if any.
4081 * readsyms.h (class Input_group): Declare destructor.
4082 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4083 any.
4084
4085 2011-01-10 Ian Lance Taylor <iant@google.com>
4086
4087 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4088 section as relro.
4089 (Layout::set_segment_offsets): Reset increase_relro before calling
4090 set_section_addresses a second time.
4091
4092 2011-01-04 Cary Coutant <ccoutant@google.com>
4093
4094 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4095 sections before NOBITS sections.
4096
4097 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4098
4099 * version.cc (print_version): Update copyright to 2011.
4100
4101 2010-12-23 Cary Coutant <ccoutant@google.com>
4102
4103 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4104 of OS to this->add. Add OD parameter to second form of the function.
4105
4106 2010-12-20 Ian Lance Taylor <iant@google.com>
4107
4108 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4109 second of two consecutive entries with same offset.
4110
4111 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4112
4113 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4114 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4115 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4116 to avoid unneeded links against $(LDADD).
4117 * testsuite/Makefile.in: Regenerate.
4118
4119 2010-12-15 Ian Lance Taylor <iant@google.com>
4120
4121 PR gold/12324
4122 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4123 for R_X86_64_32 and R_X86_64_PC32.
4124 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4125 ver_matching_def_pic.o.
4126 (ver_matching_def_pic.o): New target.
4127
4128 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4129
4130 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4131 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4132 Move definition before File_read::View member definitions.
4133 (File_read::View::~View): Initialize and hold lock before
4134 updating current_mapped_bytes.
4135
4136 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4137
4138 * dwarf_reader.cc: Remove outdated comment.
4139 * gold-threads.cc: Fix typo in error message.
4140 * archive.cc: Fix typos in comments.
4141 * archive.h: Likewise.
4142 * arm-reloc-property.cc: Likewise.
4143 * arm-reloc-property.h: Likewise.
4144 * arm-reloc.def: Likewise.
4145 * arm.cc: Likewise.
4146 * attributes.h: Likewise.
4147 * cref.cc: Likewise.
4148 * ehframe.cc: Likewise.
4149 * fileread.h: Likewise.
4150 * gold.h: Likewise.
4151 * i386.cc: Likewise.
4152 * icf.cc: Likewise.
4153 * incremental.h: Likewise.
4154 * int_encoding.cc: Likewise.
4155 * layout.h: Likewise.
4156 * main.cc: Likewise.
4157 * merge.h: Likewise.
4158 * object.cc: Likewise.
4159 * object.h: Likewise.
4160 * options.cc: Likewise.
4161 * readsyms.cc: Likewise.
4162 * reduced_debug_output.cc: Likewise.
4163 * reloc.cc: Likewise.
4164 * script-sections.cc: Likewise.
4165 * sparc.cc: Likewise.
4166 * symtab.h: Likewise.
4167 * target-reloc.h: Likewise.
4168 * target.cc: Likewise.
4169 * target.h: Likewise.
4170 * timer.cc: Likewise.
4171 * timer.h: Likewise.
4172 * x86_64.cc: Likewise.
4173
4174 2010-12-09 Cary Coutant <ccoutant@google.com>
4175
4176 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4177 stack.
4178 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4179 parameter; change all callers.
4180 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4181 * options.h (warn_execstack): New option.
4182
4183 2010-12-07 Doug Kwan <dougkwan@google.com>
4184
4185 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4186 like function call relocations.
4187
4188 2010-12-07 Ian Lance Taylor <iant@google.com>
4189
4190 * archive.cc (Archive::get_elf_object_for_member): Permit
4191 punconfigured to be NULL.
4192 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4193 (Archive::include_member): Pass NULL to get_elf_object_for_member
4194 if we searched for the archive and this is the first included
4195 object.
4196
4197 2010-12-01 Ian Lance Taylor <iant@google.com>
4198
4199 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4200 track_relocs_type_ field.
4201 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4202 Set track_relocs_type_.
4203 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4204 contents when using RELA relocs.
4205 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4206 reloc_map_.
4207 * reloc.cc (Track_relocs::next_addend): New function.
4208 * reloc.h (class Track_relocs): Declare next_addend.
4209
4210 2010-12-01 Ian Lance Taylor <iant@google.com>
4211
4212 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4213 virtual destructor.
4214
4215 2010-12-01 Ian Lance Taylor <iant@google.com>
4216
4217 * README: Update compilers known to work and fail.
4218
4219 2010-11-23 Matthias Klose <doko@ubuntu.com>
4220
4221 * configure.in: For --enable-gold, handle value `default' instead of
4222 `both*'. Always install ld as ld.bfd, install as ld if gold is
4223 not the default.
4224 * configure: Regenerate.
4225
4226 2010-11-18 Doug Kwan <dougkwan@google.com>
4227
4228 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4229 and right_alignment to be zero. Store result alignment only if it is
4230 greater than existing alignment.
4231
4232 2010-11-16 Cary Coutant <ccoutant@google.com>
4233
4234 PR gold/12220
4235 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4236 Check for ".zdebug_line".
4237
4238 2010-11-16 Doug Kwan <dougkwan@google.com>
4239 Cary Coutant <ccoutant@google.com>
4240
4241 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4242 by reference; adjust all callers.
4243 * output.cc (Output_segment::set_section_addresses): Adjust references
4244 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4245 list is empty.
4246 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4247 end at page boundary.
4248
4249 2010-11-16 Cary Coutant <ccoutant@google.com>
4250
4251 PR gold/12220
4252 * layout.cc (Layout::choose_output_section): Transform names of
4253 compressed sections even when using a script with a SECTIONS clause.
4254 (Layout::output_section_name): Remove code to transform
4255 compressed debug section names.
4256 * output.cc (Output_section::add_input_section): Use uncompressed
4257 section size when tracking input sections.
4258
4259 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4260
4261 * symtab.h (Symbol::NON_PIC_REF): Remove.
4262 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4263 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4264 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4265 (Symbol::use_plt_offset): Take a flags argument and pass it
4266 directly to needs_dynamic_reloc. Restrict check for undefined
4267 weak symbols to function calls.
4268 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4269 (Target_arm::Scan::global): Use it.
4270 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4271 (Target_arm::Relocate::relocate): Likewise.
4272 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4273 parameter with an r_type parameter. Use get_reference_flags
4274 to get the flags.
4275 (Target_arm::Relocate::relocate): Update accordingly.
4276 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4277 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4278 (Target_i386::Scan::global): Likewise.
4279 (Target_i386::Relocate::relocate): Likewise.
4280 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4281 parameter with an r_type parameter. Use get_reference_flags
4282 to get the flags.
4283 (Target_i386::Relocate::relocate): Update accordingly.
4284 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4285 (Target_powerpc::Scan::global): Use it.
4286 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4287 (Target_powerpc::Relocate::relocate): Likewise.
4288 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4289 (Target_sparc::Scan::global): Use it.
4290 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4291 (Target_sparc::Relocate::relocate): Likewise.
4292 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4293 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4294 (Target_x86_64::Scan::global): Likewise.
4295 (Target_x86_64::Relocate::relocate): Likewise.
4296
4297 2010-11-08 Doug Kwan <dougkwan@google.com>
4298 Cary Coutant <ccoutant@google.com>
4299
4300 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4301 (Arm_exidx_merge_section::section_contents_): New data member.
4302 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4303 (Arm_input_section::~Arm_input_section): De-allocate memory.
4304 (Arm_input_section::original_contents_): New data member.
4305 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4306 in parameters instead of calling Object::section_contents without
4307 locking.
4308 (Arm_output_section::group_section): New parameter TASK. Pass it
4309 to callees that need locking objects.
4310 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4311 to lock EXIDX input sections. Fix a formatting issue. Call
4312 Arm_exidx_merged_section::build_contents to create merged section
4313 contents.
4314 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4315 to lock object of stub table owner.
4316 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4317 TEXT_SIZE to initialize data member TEXT_SIZE_.
4318 (Arm_exidx_input_section::addralign): Fix typo in comment.
4319 (Arm_exidx_input_section::text_size): New method.
4320 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4321 that require locking objects. Lock objects before scanning for stubs
4322 and updating local symbols.
4323 (Arm_input_section<big_endian>::init): Copy contents of original
4324 input section.
4325 (Arm_input_section<big_endian>::do_write): Use saved contents of
4326 original input section instead of calling Object::section_contents
4327 without locking.
4328 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4329 size without calling Object::section_size().
4330 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4331 for size. Allocate a buffer for merged EXIDX entries.
4332 (Arm_exidx_merged_section::build_contents): New method.
4333 (Arm_exidx_merged_section::do_write): Move merge section contents
4334 building code to Arm_exidx_merged_section::build_contetns. Write
4335 out contetns in buffer instead of building it on the fly.
4336 (Arm_relobj::make_exidx_input_section): Also pass text section size
4337 to Arm_exidx_input_section constructor.
4338 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4339 (Arm_dynobj::do_read_symbols): Fix memory leak.
4340 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4341 * target.h: (class Task): Add forward declaration.
4342 (Target::relax): Add new parameter TASK and pass it to
4343 Target::do_relax().
4344 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4345
4346 2010-11-05 Cary Coutant <ccoutant@google.com>
4347
4348 PR gold/10708
4349 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4350 object when reading from the file.
4351 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4352 second layout pass.
4353 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4354 when reading section contents.
4355 (get_section_contents): Likewise.
4356 (icf::find_identical_sections): Likewise.
4357 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4358 object when reading from the file.
4359 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4360 the object when doing deferred section layout.
4361
4362 2010-11-03 Nick Clifton <nickc@redhat.com>
4363
4364 PR gold/12001
4365 * script.h (class Symbol_assignment: name): New member. Returns
4366 the name of the symbol.
4367 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4368 Returns true if the given symbol name is on the list of
4369 assignments wating to be processed.
4370 * archive.cc (should_incldue_member): If the symbol is undefined,
4371 check to see if it is on the list of symbols pending assignment.
4372
4373 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4374
4375 * script-sections.cc (Script_sections::find_memory_region): Check
4376 for a NULL output section pointer.
4377
4378 2010-10-29 Doug Kwan <dougkwan@google.com>
4379
4380 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4381 Output_section::add_relaxed_input_section.
4382 * output.cc (Output_section::add_relaxed_input_section): Add new
4383 arguments LAYOUT and NAME. Set section order index.
4384 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4385 Copy section order index.
4386 * output.h (Output_section::add_relaxed_input_section): Add new
4387 arguments LAYOUT and NAME.
4388
4389 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4390
4391 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4392 NATIVE_OR_CROSS_LINKER.
4393 * testsuite/Makefile.in: Regenerate.
4394
4395 2010-10-20 Doug Kwan <dougkwan@google.com>
4396
4397 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4398 without SHF_LINK_ORDER flags.
4399 * layout.cc (Layout::choose_output_section): Do not filter
4400 SHF_LINK_ORDER flag in a relocatable link.
4401
4402 2010-10-17 Cary Coutant <ccoutant@google.com>
4403
4404 * output.h (Output_segment::set_section_addresses): Change function
4405 signature. Update all callers.
4406 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4407 sections.
4408 (Output_segment::set_section_addresses): Align after last TLS
4409 section. Add padding before last relro section instead of after.
4410
4411 2010-10-17 Doug Kwan <dougkwan@google.com>
4412
4413 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4414 GOT output section to be writable.
4415
4416 2010-10-14 Cary Coutant <ccoutant@google.com>
4417
4418 * debug.h (DEBUG_INCREMENTAL): New flag.
4419 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4420 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4421 mode.
4422 * incremental.cc (report_command_line): Ignore all forms of
4423 --incremental.
4424 * layout.cc (Layout::Layout): Check parameters for incremental link
4425 mode.
4426 * options.cc (General_options::parse_incremental): New function.
4427 (General_options::parse_no_incremental): New function.
4428 (General_options::parse_incremental_full): New function.
4429 (General_options::parse_incremental_update): New function.
4430 (General_options::incremental_mode_): New data member.
4431 (General_options::finalize): Check incremental_mode_.
4432 * options.h (General_options): Update help text for --incremental.
4433 Add --no-incremental, --incremental-full, --incremental-update.
4434 (General_options::Incremental_mode): New enum type.
4435 (General_options::incremental_mode): New function.
4436 (General_options::incremental_mode_): New data member.
4437 * parameters.cc (Parameters::incremental_mode_): New data member.
4438 (Parameters::set_options): Set incremental_mode_.
4439 (Parameters::set_incremental_full): New function.
4440 (Parameters::incremental): New function.
4441 (Parameters::incremental_update): New function.
4442 (set_parameters_incremental_full): New function.
4443 * parameters.h (Parameters::set_incremental_full): New function.
4444 (Parameters::incremental): New function.
4445 (Parameters::incremental_update): New function.
4446 (Parameters::incremental_mode_): New data member.
4447 (set_parameters_incremental_full): New function.
4448 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4449 incremental link mode.
4450 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4451 (Sized_relobj::do_relocate_sections): Likewise.
4452 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4453 option.
4454 * testsuite/Makefile.in: Regenerate.
4455 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4456
4457 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4458
4459 * script-sections.h (class Script_sections): Make
4460 Sections_elements typedef public.
4461 * script-sections.cc (class Sort_output_sections): Add elements_
4462 field. Add constructor which sets it; change all callers.
4463 (Sort_output_sections::is_before): New function.
4464 (Sort_output_sections::operator()): Call is_before.
4465 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4466 conditional.
4467 * testsuite/script_test_10.sh: New test. Test script section
4468 order.
4469 * testsuite/script_test_10.t: Likewise.
4470 * testsuite/script_test_10.s: Likewise.
4471 * testsuite/Makefile.am: Wrap the cross linker tests and the
4472 common tests into NATIVE_OR_CROSS_LINKER.
4473 (check_SCRIPTS): Add script_test_10.sh.
4474 (check_DATA): Add script_test_10.stdout.
4475 (script_test_10.o, script_test_10): New targets.
4476 (script_test_10.stdout): New target.
4477 * configure, testsuite/Makefile.in: Regenerate.
4478
4479 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4480
4481 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4482 error for the deprecated relocations.
4483 (Target_arm::Scan::global): Likewise.
4484 (Target_arm::Relocate::relocate): Likewise.
4485
4486 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4487
4488 * fileread.cc (Input_file::find_file): Initialize *found_name
4489 and *namep when using the fallback search for case 4.
4490
4491 2010-10-11 Cary Coutant <ccoutant@google.com>
4492
4493 * options.h (class General_options): Redefine -z lazy as an alias for
4494 the negation of -z now.
4495
4496 2010-10-11 Ian Lance Taylor <iant@google.com>
4497
4498 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4499 binding.
4500
4501 2010-10-06 Nick Clifton <nickc@redhat.com>
4502
4503 * script-sections.cc(class Memory_region): Remove
4504 current_lma_offset_ field. Rename current_vma_offset_ to
4505 current_offset_. Add last_section_ field.
4506 (Memory_region::get_current_vma_address): Rename to
4507 get_current_address.
4508 (Memory_region::get_current_lma_address): Delete.
4509 (Memory_region::increment_vma_offset): Rename to
4510 increment_offset.
4511 (Memory_region::increment_lma_offset): Delete.
4512 (Memory_region::attributes_compatible): New method. Returns
4513 true if the provided section is compatible with the region.
4514 (Memory_region::get_last_section): New method. Returns the last
4515 section to use the region.
4516 (Memory_region::set_last_section): New method. Stores the last
4517 section to use the region.
4518 (Script_sections::block_in_region): New method. Returns true if
4519 a block of memory is contained within a region.
4520 (Script_sections::find_memory_region): New method. Locates a
4521 memory region to be used to set a VMA or LMA address.
4522 (Output_section_definition::set_section_addresses): Add code to
4523 check for addresses set by memory regions.
4524 (Output_segment::set_section_addresses): Remove memory region
4525 walking code.
4526 (Script_sections::create_segment): Add a warning if a header
4527 segment is created outside of any region.
4528 * script-sections.h (class Script_sections): Add prototypes for
4529 find_memory_region and block_in_region methods.
4530 * testsuite/memory_test.s: Use .long instead of .word.
4531 * testsuite/memory_test.t: Add some more output sections.
4532 * testsuite/memory_test.sh: Update expected output.
4533
4534 2010-10-02 Doug Kwan <dougkwan@google.com>
4535
4536 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4537 defintion to symtab.h
4538 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4539 declaration to defintion.
4540
4541 2010-10-01 Nick Clifton <nickc@redhat.com>
4542
4543 * expression.cc (eval): Replace dummy argument with NULL.
4544 (eval_maybe_dot): Check for a NULL result section pointer.
4545 (Symbol_expression::value): Likewise.
4546 (Dot_expression::value): Likewise.
4547 (BINARY_EXPRESSION): Likewise.
4548 (Max_expression::value): Likewise.
4549 (Min_expression::value): Likewise.
4550 (Absolute_expression::value): Likewise.
4551 (Addr_expression::value_from_output_section): Likewise.
4552 (Loaddddr_expression::value_from_output_section): Likewise.
4553 (Segment_start_expression::value): Likewise.
4554 * script-sections.cc
4555 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4556 argument with NULL.
4557 (Sections_elememt_dot_assignment::set_section_addresses):
4558 Likewise.
4559 (Output_data_expression::do_write_to_buffer): Likewise.
4560 (Output_section_definition::finalize_symbols): Likewise.
4561 (Output_section_definition::set_section_addresses): Likewise.
4562
4563 2010-09-30 Doug Kwan <dougkwan@google.com>
4564
4565 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4566
4567 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4568
4569 * target.h (Target::can_icf_inline_merge_sections): New virtual
4570 function.
4571 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4572 virtual function.
4573 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4574 virtual function.
4575 * icf.cc (get_section_contents): Inline merge sections only when
4576 target allows it.
4577
4578 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4579
4580 * configure: Regenerate.
4581
4582 2010-09-17 Ian Lance Taylor <iant@google.com>
4583
4584 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4585 * testsuite/Makefile.am (memory_test.o): New target.
4586 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4587 memory_test.t.
4588 * testsuite/Makefile.in: Rebuild.
4589
4590 2010-09-17 Doug Kwan <dougkwan@google.com>
4591
4592 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4593 defintion if relocation uses GOT entries of the symbol.
4594 * testsuite/icf_safe_test.sh: Fix test.
4595 * testsuite/icf_safe_so_test.sh: Fix test.
4596
4597 2010-09-16 Cary Coutant <ccoutant@google.com>
4598
4599 * script_sections.cc (class Memory_region): Remove "NULL" from
4600 vector initializations.
4601
4602 2010-09-15 Cary Coutant <ccoutant@google.com>
4603
4604 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4605 Resolve forwarding symbols.
4606
4607 2010-09-15 Doug Kwan <dougkwan@google.com>
4608
4609 * gold/testsuite/script_test_3.t: Add ARM special sections.
4610 * gold/testsuite/script_test_4.t: Same.
4611 * gold/testsuite/script_test_5.t: Same.
4612 * gold/testsuite/script_test_6.t: Same.
4613 * gold/testsuite/script_test_7.t: Same.
4614 * gold/testsuite/script_test_7.t: Same.
4615 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4616
4617 2010-09-14 Cary Coutant <ccoutant@google.com>
4618
4619 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4620 (Target_x86_64::Relocate::relocate_tls): Replace check for
4621 saw_tls_block_reloc_ with test for executable section.
4622
4623 2010-09-12 Cary Coutant <ccoutant@google.com>
4624
4625 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4626 position-independent executables to shared libraries need dynamic
4627 relocations.
4628 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4629 position-independent executables.
4630 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4631 * testsuite/Makefile.in: Regenerate.
4632
4633 2010-09-10 Nick Clifton <nickc@redhat.com>
4634
4635 PR gold/11997
4636 * testsuite/memory_test.t: Discard any sections that are not
4637 needed.
4638
4639 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4640
4641 PR gold/11996
4642 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4643 "This::" to work around a bug in gcc 4.2.
4644
4645 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4646
4647 2010-09-09 Rafael Espindola <espindola@google.com>
4648
4649 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4650 sections with different PF_X flags in the same segment.
4651 (Layout::find_first_load_seg): Search all segments to find the first
4652 one.
4653 * options.h (rosegment): New.
4654
4655 2010-09-08 Rafael Espindola <espindola@google.com>
4656
4657 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4658
4659 2010-09-08 Doug Kwan <dougkwan@google.com>
4660
4661 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4662 (Arm_relobj::do_relocate_sections): Add new parameter for output
4663 file to match the parent.
4664 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4665 of local symbols instead of input values. Update code to track
4666 changes in gold::relocate_section.
4667 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4668 (Sized_relobj::compute_final_local_value_internal): New methods.
4669 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4670 body into private version of Sized_relobj::compute_final_local_value.
4671 Call the inline method.
4672 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4673 merged symbol value if there is one.
4674 (Symbol_value::has_output_value): New method defintiion.
4675 (Sized_relobj::Compute_final_local_value_status): New enum type.
4676 (Sized_relobj::compute_final_local_value): New methods.
4677 (Sized_relobj::compute_final_local_value_internal): New methods.
4678 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4679 and arm_cortex_a8.sh.
4680 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4681 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4682 New tests.
4683 * Makefile.in: Regenerate.
4684 * testsuite/arm_bl_out_of_range.s: Update test.
4685 * testsuite/thumb_bl_out_of_range.s: Ditto.
4686 * testsuite/thumb_blx_out_of_range.s: Ditto.
4687 * testsuite/arm_branch_out_of_range.sh: New file.
4688 * testsuite/arm_cortex_a8.sh: Ditto.
4689 * testsuite/arm_cortex_a8_b.s: Ditto.
4690 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4691 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4692 * testsuite/arm_cortex_a8_bl.s: Ditto.
4693 * testsuite/arm_cortex_a8_blx.s: Ditto.
4694 * testsuite/arm_cortex_a8_local.s: Ditto.
4695 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4696 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4697
4698 2010-09-08 Rafael Espindola <espindola@google.com>
4699
4700 * Makefile.am (memory_test.stdout): Run readelf with -W.
4701 * Makefile.in: Regenerate.
4702 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4703 64 bit output.
4704
4705 2010-09-08 Rafael Espindola <espindola@google.com>
4706
4707 * script-sections.cc (Script_sections::add_memory_region): Convert
4708 field precision to int.
4709 * script.cc (script_set_section_region, script_set_section_region):
4710 Convert field precision to int.
4711
4712 2010-09-08 Rafael Espindola <espindola@google.com>
4713
4714 * arm.cc (do_finalize_sections): Create the __exidx_start and
4715 __exdix_end symbols even when the section is missing.
4716
4717 2010-09-08 Nick Clifton <nickc@redhat.com>
4718
4719 * README: Remove claim that MEMORY is not supported.
4720 * expression.cc (script_exp_function_origin)
4721 (script_exp_function_length): Move from here to ...
4722 * script.cc: ... here.
4723 (script_set_section_region, script_add_memory)
4724 (script_parse_memory_attr, script_include_directive): New
4725 functions.
4726 * script-sections.cc
4727 (class Memory_region): New class.
4728 (class Output_section_definition): Add set_memory_region,
4729 set_section_vma, set_section_lma and get_section_name methods.
4730 (class Script_Sections): Add add_memory_region,
4731 find_memory_region, find_memory_region_origin,
4732 find_memory_region_length and set_memory_region methods.
4733 Have set_section_addresses method walk the list of set memory
4734 regions.
4735 Extend the print methos to display memory regions.
4736 * script-sections.h: Add prototypes for new methods.
4737 Add enum for MEMORY region attributes.
4738 * yyscript.y: Add support for parsing MEMORY regions.
4739 * script-c.h: Add prototypes for new functions.
4740 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4741 * testsuite/Makefile.in: Regenerate.
4742 * testsuite/memory_test.sh: New script.
4743 * testsuite/memory_test.s: New assembler source file.
4744 * testsuite/memory_test.t: New linker script.
4745
4746 2010-08-27 Doug Kwan <dougkwan@google.com>
4747
4748 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4749 reference override an existing dynamic weak reference.
4750 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4751 * testsuite/Makefile.in: Regenerate.
4752 * testsuite/dyn_weak_ref.sh: New file.
4753 * testsuite/dyn_weak_ref_1.c: Ditto.
4754 * testsuite/dyn_weak_ref_2.c: Ditto.
4755
4756 2010-08-27 Ian Lance Taylor <iant@google.com>
4757
4758 * incremental.h (class Incremental_input_entry): Add virtual
4759 destructor.
4760
4761 2010-08-27 Ian Lance Taylor <iant@google.com>
4762
4763 * testsuite/start_lib_test_3.c: Mark t3 as used.
4764
4765 2010-08-27 Nick Clifton <nickc@redhat.com>
4766
4767 * options.cc (version_script): Fix small typo in previous
4768 whitespace tidyup.
4769
4770 2010-08-25 Nick Clifton <nickc@redhat.com>
4771
4772 * archive.cc: Formatting fixes: Remove whitespace between
4773 typename and following asterisk. Remove whitespace between
4774 function name and opening parenthesis.
4775 * archive.h: Likewise.
4776 * arm.cc: Likewise.
4777 * attributes.cc: Likewise.
4778 * attributes.h: Likewise.
4779 * common.cc: Likewise.
4780 * copy-relocs.cc: Likewise.
4781 * dirsearch.h: Likewise.
4782 * dynobj.cc: Likewise.
4783 * ehframe.cc: Likewise.
4784 * ehframe.h: Likewise.
4785 * expression.cc: Likewise.
4786 * fileread.cc: Likewise.
4787 * fileread.h: Likewise.
4788 * gc.h: Likewise.
4789 * gold-threads.cc: Likewise.
4790 * gold.cc: Likewise.
4791 * i386.cc: Likewise.
4792 * icf.h: Likewise.
4793 * incremental-dump.cc: Likewise.
4794 * incremental.cc: Likewise.
4795 * layout.cc: Likewise.
4796 * layout.h: Likewise.
4797 * main.cc: Likewise.
4798 * merge.cc: Likewise.
4799 * merge.h: Likewise.
4800 * object.cc: Likewise.
4801 * object.h: Likewise.
4802 * options.cc: Likewise.
4803 * options.h: Likewise.
4804 * output.cc: Likewise.
4805 * output.h: Likewise.
4806 * plugin.cc: Likewise.
4807 * plugin.h: Likewise.
4808 * powerpc.cc: Likewise.
4809 * reloc.cc: Likewise.
4810 * script-c.h: Likewise.
4811 * script-sections.cc: Likewise.
4812 * script.cc: Likewise.
4813 * stringpool.cc: Likewise.
4814 * symtab.cc: Likewise.
4815 * symtab.h: Likewise.
4816 * target.cc: Likewise.
4817 * timer.cc: Likewise.
4818 * timer.h: Likewise.
4819 * version.cc: Likewise.
4820 * x86_64.cc: Likewise.
4821
4822 2010-08-24 Nick Clifton <nickc@redhat.com>
4823
4824 PR 11899
4825 * layout.cc (segment_precedes): Sort segments by their physical
4826 addresses, if they have been set.
4827
4828 2010-08-23 Cary Coutant <ccoutant@google.com>
4829
4830 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4831 symbols data.
4832 (Lib_group::include_member): Unlock object after deleting its
4833 symbols data.
4834 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4835 the bug fixed here.
4836
4837 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4838 Cary Coutant <ccoutant@google.com>
4839
4840 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4841 constructor, and set_blocker.
4842 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4843 readsyms_blocker_.
4844 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4845 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4846 * testsuite/Makefile.am (start_lib_test): New test case.
4847 * testsuite/Makefile.in: Regenerate.
4848 * testsuite/start_lib_test_main.c: New file.
4849 * testsuite/start_lib_test_1.c: New file.
4850 * testsuite/start_lib_test_2.c: New file.
4851 * testsuite/start_lib_test_3.c: New file.
4852
4853 2010-08-19 Ian Lance Taylor <iant@google.com>
4854
4855 * Makefile.in: Rebuild with automake 1.11.1.
4856 * aclocal.m4: Likewise.
4857 * testsuite/Makefile.in: Likewise.
4858
4859 2010-08-19 Ian Lance Taylor <iant@google.com>
4860
4861 PR 10893
4862 * i386.cc (class Output_data_plt_i386): Update declarations.
4863 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4864 local_ifuncs_ fields.
4865 (Target_i386::do_plt_section_for_global): New function.
4866 (Target_i386::do_plt_section_for_local): New function.
4867 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4868 parameter; change all callers. Initialize global_ifuncs_ and
4869 local_ifuncs_. If doing a static link define __rel_iplt_start and
4870 __rel_iplt_end.
4871 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4872 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4873 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4874 symbols.
4875 (Target_i386::make_plt_section): New function, broken out of
4876 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4877 (Target_i386::make_plt_entry): Call make_plt_section.
4878 (Target_i386::make_local_ifunc_plt_entry): New function.
4879 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4880 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4881 R_386_IRELATIVE to switch.
4882 (Target_i386::Scan::global): Likewise.
4883 (Target_i386::Relocate::relocate): Likewise.
4884 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4885 switch.
4886 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4887 (Target_x86_64::do_plt_section_for_global): New function.
4888 (Target_x86_64::do_plt_section_for_local): New function.
4889 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4890 parameter; change all callers. If doing a static link define
4891 __rela_iplt_start and __rela_iplt_end.
4892 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4893 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4894 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4895 to point to .plt.
4896 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4897 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4898 switch.
4899 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4900 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4901 R_X86_64_IRELATIVE to switch.
4902 (Target_x86_64::Scan::global): Likewise.
4903 (Target_x86_64::Relocate::relocate): Likewise.
4904 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4905 switch.
4906 * target.h (class Target): Add plt_section_for_global and
4907 plt_section_for_local functions. Add do_plt_section_for_global
4908 and do_plt_section_for_local virtual functions.
4909 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4910 clarifying comments.
4911 (Symbol::use_plt_offset): Handle IFUNC symbol.
4912 * object.cc (Sized_relobj::Sized_relobj): Initialize
4913 local_plt_offsets_.
4914 (Sized_relobj::local_has_plt_offset): New function.
4915 (Sized_relobj::local_plt_offset): New function.
4916 (Sized_relobj::set_local_plt_offset): New function.
4917 (Sized_relobj::do_count): Handle IFUNC symbol.
4918 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4919 a bit away from input_shndx_ field. Add set_is_func_symbol and
4920 is_ifunc_symbol functions.
4921 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4922 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4923 local_plt_offsets_ field.
4924 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4925 * output.h (class Output_section_data): Add non-const
4926 output_section function.
4927 (class Output_data_got): Update declarations.
4928 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4929 Add use_plt_offset parameter to global and local constructors.
4930 Change all callers. Change local_sym_index_ field to 31 bits.
4931 Change GSYM_CODE and CONSTANT_CODE accordingly.
4932 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4933 doing a static link don't set sh_link field.
4934 (Output_data_got::Got_entry::write): Use PLT offset if
4935 appropriate.
4936 (Output_data_got::add_global_plt): New function.
4937 (Output_data_got::add_local_plt): New function.
4938 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4939 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4940 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4941 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4942 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4943 IFUNC conditional.
4944 * testsuite/ifunc-sel.h: New file.
4945 * testsuite/ifuncmain1.c: New file.
4946 * testsuite/ifuncmain1vis.c: New file.
4947 * testsuite/ifuncmod1.c: New file.
4948 * testsuite/ifuncdep2.c: New file.
4949 * testsuite/ifuncmain2.c: New file.
4950 * testsuite/ifuncmain3.c: New file.
4951 * testsuite/ifuncmod3.c: New file.
4952 * testsuite/ifuncmain4.c: New file.
4953 * testsuite/ifuncmain5.c: New file.
4954 * testsuite/ifuncmod5.c: New file.
4955 * testsuite/ifuncmain6pie.c: New file.
4956 * testsuite/ifuncmod6.c: New file.
4957 * testsuite/ifuncmain7.c: New file.
4958 * configure, testsuite/Makefile.in: Rebuild.
4959
4960 2010-08-18 Ian Lance Taylor <iant@google.com>
4961
4962 * incremental.cc
4963 (Output_section_incremental_inputs::write_input_files): Add cast
4964 to avoid signed/unsigned comparison warning.
4965 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4966
4967 2010-08-12 Cary Coutant <ccoutant@google.com>
4968
4969 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4970
4971 2010-08-13 Ian Lance Taylor <iant@google.com>
4972
4973 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4974
4975 2010-08-12 Cary Coutant <ccoutant@google.com>
4976 Doug Kwan <dougkwan@google.com>
4977
4978 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4979 defintion overrides non-weak undef, remember that the original undef
4980 is not weak.
4981 * symtab.cc (Symbol_table::sized_write_global): For undef without
4982 an original weak binding, set binding to global in output.
4983 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4984 * testsuite/Makefile.in: Regenerate.
4985 * testsuite/strong_ref_weak_def.sh: New file.
4986 * testsuite/strong_ref_weak_def_1.c: Ditto.
4987 * testsuite/strong_ref_weak_def_2.c: Ditto.
4988
4989 2010-08-12 Cary Coutant <ccoutant@google.com>
4990
4991 * testsuite/incremental_test.sh: Rewrite.
4992 * testsuite/incremental_test_1.c: Rewrite.
4993 * testsuite/incremental_test_2.c: Rewrite.
4994
4995 2010-08-12 Cary Coutant <ccoutant@google.com>
4996
4997 * arm.cc (Target_arm::got_size): Add const.
4998 (Target_arm::got_entry_count): New function.
4999 (Target_arm::plt_entry_count): New function.
5000 (Target_arm::first_plt_entry_offset): New function.
5001 (Target_arm::plt_entry_size): New function.
5002 (Output_data_plt_arm::entry_count): New function.
5003 (Output_data_plt_arm::first_plt_entry_offset): New function.
5004 (Output_data_plt_arm::get_plt_entry_size): New function.
5005 * i386.cc (Target_i386::got_size): Add const.
5006 (Target_i386::got_entry_count): New function.
5007 (Target_i386::plt_entry_count): New function.
5008 (Target_i386::first_plt_entry_offset): New function.
5009 (Target_i386::plt_entry_size): New function.
5010 (Output_data_plt_i386::entry_count): New function.
5011 (Output_data_plt_i386::first_plt_entry_offset): New function.
5012 (Output_data_plt_i386::get_plt_entry_size): New function.
5013 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5014 find_incremental_inputs_sections. Dump incremental_got_plt section.
5015 * incremental.cc: Include target.h.
5016 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5017 parameter. Adjust all callers. Find incremental_got_plt section.
5018 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5019 section.
5020 (Output_section_incremental_inputs::set_final_data_size): Calculate
5021 size of incremental_got_plt section.
5022 (Output_section_incremental_inputs::do_write): Write the
5023 incremental_got_plt section.
5024 (Got_plt_view_info): New struct.
5025 (Local_got_offset_visitor): New class.
5026 (Global_got_offset_visitor): New class.
5027 (Global_symbol_visitor_got_plt): New class.
5028 (Output_section_incremental_inputs::write_got_plt): New function.
5029 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5030 Add parameter. Adjust all callers.
5031 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5032 (Incremental_inputs::got_plt_section): New function.
5033 (Incremental_inputs::got_plt_section_): New data member.
5034 (Incremental_got_plt_reader): New class.
5035 * layout.cc (Layout::create_incremental_info_sections): Add the
5036 incremental_got_plt section.
5037 * object.h (Got_offset_list::get_list): New function.
5038 (Got offset_list::for_all_got_offsets): New function.
5039 (Sized_relobj::local_got_offset_list): New function.
5040 * powerpc.cc (Target_powerpc::got_size): Add const.
5041 (Target_powerpc::got_entry_count): New function.
5042 (Target_powerpc::plt_entry_count): New function.
5043 (Target_powerpc::first_plt_entry_offset): New function.
5044 (Target_powerpc::plt_entry_size): New function.
5045 (Output_data_plt_powerpc::entry_count): New function.
5046 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5047 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5048 * sparc.cc (Target_sparc::got_size): Add const.
5049 (Target_sparc::got_entry_count): New function.
5050 (Target_sparc::plt_entry_count): New function.
5051 (Target_sparc::first_plt_entry_offset): New function.
5052 (Target_sparc::plt_entry_size): New function.
5053 (Output_data_plt_sparc::entry_count): New function.
5054 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5055 (Output_data_plt_sparc::get_plt_entry_size): New function.
5056 * symtab.h (Symbol::got_offset_list): New function.
5057 (Symbol_table::for_all_symbols): New function.
5058 * target.h (Sized_target::got_entry_count): New function.
5059 (Sized_target::plt_entry_count): New function.
5060 (Sized_target::plt_entry_size): New function.
5061 * x86_64.cc (Target_x86_64::got_size): Add const.
5062 (Target_x86_64::got_entry_count): New function.
5063 (Target_x86_64::plt_entry_count): New function.
5064 (Target_x86_64::first_plt_entry_offset): New function.
5065 (Target_x86_64::plt_entry_size): New function.
5066 (Output_data_plt_x86_64::entry_count): New function.
5067 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5068 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5069
5070 2010-08-12 Cary Coutant <ccoutant@google.com>
5071
5072 * archive.cc: Include incremental.h.
5073 (Archive::Archive): Initialize incremental_info_.
5074 (Archive::include_member): Record archive members in incremental info.
5075 (Add_archive_symbols::run): Record begin and end of an archive in
5076 incremental info.
5077 (Lib_group::include_member): Record objects in incremental info.
5078 * archive.h (Incremental_archive_entry): Forward declaration.
5079 (Archive::set_incremental_info): New member function.
5080 (Archive::incremental_info): New member function.
5081 (Archive::Unused_symbol_iterator): New class.
5082 (Archive::unused_symbols_begin): New member function.
5083 (Archive::unused_symbols_end): New member function.
5084 (Archive::incremental_info_): New data member.
5085 * incremental-dump.cc (find_input_containing_global): New function.
5086 (dump_incremental_inputs): Dump new incremental info sections.
5087 * incremental.cc: Include symtab.h.
5088 (Output_section_incremental_inputs): New class.
5089 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5090 new incremental info sections.
5091 (Sized_incremental_binary::do_check_inputs): Likewise.
5092 (Incremental_inputs::report_archive): Remove.
5093 (Incremental_inputs::report_archive_begin): New function.
5094 (Incremental_inputs::report_archive_end): New function.
5095 (Incremental_inputs::report_object): New function.
5096 (Incremental_inputs::finalize_inputs): Remove.
5097 (Incremental_inputs::report_input_section): New function.
5098 (Incremental_inputs::report_script): Rewrite.
5099 (Incremental_inputs::finalize): Do nothing but finalize string table.
5100 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5101 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5102 (Incremental_inputs::create_data_sections): New function.
5103 (Incremental_inputs::relocs_entsize): New function.
5104 (Output_section_incremental_inputs::set_final_data_size): New function.
5105 (Output_section_incremental_inputs::do_write): New function.
5106 (Output_section_incremental_inputs::write_header): New function.
5107 (Output_section_incremental_inputs::write_input_files): New function.
5108 (Output_section_incremental_inputs::write_info_blocks): New function.
5109 (Output_section_incremental_inputs::write_symtab): New function.
5110 * incremental.h (Incremental_script_entry): Forward declaration.
5111 (Incremental_object_entry): Forward declaration.
5112 (Incremental_archive_entry): Forward declaration.
5113 (Incremental_inputs): Forward declaration.
5114 (Incremental_inputs_header_data): Remove.
5115 (Incremental_inputs_header): Remove.
5116 (Incremental_inputs_header_write): Remove.
5117 (Incremental_inputs_entry_data): Remove.
5118 (Incremental_inputs_entry): Remove.
5119 (Incremental_inputs_entry_write): Remove.
5120 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5121 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5122 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5123 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5124 Likewise.
5125 (Incremental_input_entry): New class.
5126 (Incremental_script_entry): New class.
5127 (Incremental_object_entry): New class.
5128 (Incremental_archive_entry): New class.
5129 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5130 (Incremental_inputs::report_inputs): Remove.
5131 (Incremental_inputs::report_archive): Remove.
5132 (Incremental_inputs::report_archive_begin): New function.
5133 (Incremental_inputs::report_archive_end): New function.
5134 (Incremental_inputs::report_object): Change prototype.
5135 (Incremental_inputs::report_input_section): New function.
5136 (Incremental_inputs::report_script): Change prototype.
5137 (Incremental_inputs::get_reloc_count): New function.
5138 (Incremental_inputs::set_reloc_count): New function.
5139 (Incremental_inputs::create_data_sections): New function.
5140 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5141 (Incremental_inputs::inputs_section): New function.
5142 (Incremental_inputs::symtab_section): New function.
5143 (Incremental_inputs::relocs_section): New function.
5144 (Incremental_inputs::get_stringpool): Add const.
5145 (Incremental_inputs::command_line): Add const.
5146 (Incremental_inputs::inputs): Remove.
5147 (Incremental_inputs::command_line_key): New function.
5148 (Incremental_inputs::input_file_count): New function.
5149 (Incremental_inputs::input_files): New function.
5150 (Incremental_inputs::relocs_entsize): New function.
5151 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5152 (Incremental_inputs::finalize_inputs): Remove.
5153 (Incremental_inputs::Input_info): Remove.
5154 (Incremental_inputs::lock_): Remove.
5155 (Incremental_inputs::inputs_): Change type.
5156 (Incremental_inputs::inputs_map_): Remove.
5157 (Incremental_inputs::current_object_entry_): New data member.
5158 (Incremental_inputs::inputs_section_): New data member.
5159 (Incremental_inputs::symtab_section_): New data member.
5160 (Incremental_inputs::relocs_section_): New data member.
5161 (Incremental_inputs::reloc_count_): New data member.
5162 (Incremental_inputs_reader): New class.
5163 (Incremental_symtab_reader): New class.
5164 (Incremental_relocs_reader): New class.
5165 * layout.cc (Layout::finalize): Move finalization of incremental info
5166 and creation of incremental info sections to follow finalization of
5167 symbol table. Set offsets for postprocessing sections.
5168 (Layout::create_incremental_info_sections): Call
5169 Incremental_inputs::create_data_sections. Add incremental symtab
5170 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5171 sections to layout after input sections.
5172 * layout.h (struct Timespec): Forward declaration.
5173 (Layout::incremental_inputs): Add const.
5174 (Layout::create_incremental_info_sections): Add parameter.
5175 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5176 * object.cc: Include incremental.h.
5177 (Relobj::finalize_incremental_relocs): New function.
5178 (Sized_relobj::do_layout): Record input sections in incremental info.
5179 * object.h (Object::output_section): New function.
5180 (Object::output_section_offset): Moved from Relobj.
5181 (Object::get_incremental_reloc_base): New function.
5182 (Object::get_incremental_reloc_count): New function.
5183 (Object::do_output_section): New function.
5184 (Object::do_output_section_offset): Moved from Relobj.
5185 (Object::do_get_incremental_reloc_base): New function.
5186 (Object::do_get_incremental_reloc_count): New function.
5187 (Object::Object): Initialize new data members.
5188 (Relobj::output_section): Renamed do_output_section and moved to
5189 protected.
5190 (Relobj::output_section_offset): Moved to Object.
5191 (Relobj::do_get_incremental_reloc_base): New function.
5192 (Relobj::do_get_incremental_reloc_count): New function.
5193 (Relobj::allocate_incremental_reloc_counts): New function.
5194 (Relobj::count_incremental_reloc): New function.
5195 (Relobj::finalize_incremental_relocs): New function.
5196 (Relobj::next_incremental_reloc_index): New function.
5197 (Relobj::reloc_counts_): New data member.
5198 (Relobj::reloc_bases_): New data member.
5199 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5200 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5201 (Sized_relobj::incremental_relocs_scan): New function.
5202 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5203 (Sized_relobj::incremental_relocs_write): New function.
5204 (Sized_relobj::incremental_relocs_write_reltype): New function.
5205 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5206 incremental link.
5207 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5208 archives and object files elsewhere.
5209 (Add_symbols::run): Report object files here.
5210 (Finish_group::run): Report end of archive at end of group.
5211 * reloc.cc: Include layout.h, incremental.h.
5212 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5213 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5214 (Sized_relobj::incremental_relocs_scan): New function.
5215 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5216 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5217 (Sized_relobj::incremental_relocs_write): New function.
5218 (Sized_relobj::incremental_relocs_write_reltype): New function.
5219 * script.cc (read_input_script): Rewrite test for incremental link.
5220 Change call to Incremental_inputs::report_script.
5221 * symtab.h (Symbol_table::first_global_index): New function.
5222 (Symbol_table::output_count): New function.
5223
5224 2010-08-12 Doug Kwan <dougkwan@google.com>
5225
5226 * arm.cc (Target_arm::merge_object_attributes): Check command line
5227 options --no-wchar-size-warning and --no-enum-size-warning.
5228 * options.h (General_options): Add ld-compatible options
5229 --no-enum-size-warning and --no-wchar-size-warning.
5230
5231 2010-08-04 Ian Lance Taylor <iant@google.com>
5232
5233 * x86_64.cc (Target_x86_64::Scan::local): Use
5234 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5235 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5236 (Target_x86_64::Scan::global): Likewise.
5237 (Target_x86_64::Relocate::relocate): Likewise.
5238 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5239 Likewise.
5240
5241 2010-08-03 Cary Coutant <ccoutant@google.com>
5242
5243 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5244 to reserve space in merged_strings vector. Keep total input size
5245 for stats.
5246 (Output_merge_string::do_print_merge_stats): Print total input size.
5247 * merge.h (Output_merge_string): Add input_size_ field.
5248 * stringpool.cc (Stringpool_template::string_length): Move
5249 implementations out of Stringpool_template class and place in
5250 stringpool.h.
5251 * stringpool.h (string_length): Move out of Stringpool_template.
5252
5253 2010-08-03 Ian Lance Taylor <iant@google.com>
5254
5255 PR 11712
5256 * layout.cc (relaxation_loop_body): If address of load segment is
5257 set, adjust address to include headers if possible.
5258
5259 2010-08-03 Ian Lance Taylor <iant@google.com>
5260
5261 * version.cc (version_string): Bump to 1.10.
5262
5263 2010-08-03 Ian Lance Taylor <iant@google.com>
5264
5265 PR 11805
5266 * layout.h (enum Output_section_order): Define.
5267 (class Layout): Update declarations.
5268 * layout.cc (Layout::get_output_section): Add order parameter.
5269 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5270 is_first_non_relro parameters. Change all callers.
5271 (Layout::choose_output_section): Likewise.
5272 (Layout::add_output_section_data): Likewise.
5273 (Layout::make_output_section): Likewise. Set order.
5274 (Layout::default_section_order): New function.
5275 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5276 * output.cc (Output_section::Output_section): Initialize order_.
5277 Don't initialize deleted fields.
5278 (Output_segment::Output_segment): Don't initialize deleted
5279 fields.
5280 (Output_segment::add_output_section_to_load): New function
5281 replacing add_output_section. Change all callers to call this or
5282 add_output_section_to_nonload.
5283 (Output_segment::add_output_section_to_nonload): New function.
5284 (Output_segment::remove_output_section): Rewrite.
5285 (Output_segment::add_initial_output_data): Likewise.
5286 (Output_segment::has_any_data_sections): Likewise.
5287 (Output_segment::is_first_section_relro): Likewise.
5288 (Output_segment::maximum_alignment): Likewise.
5289 (Output_segment::has_dynamic_reloc): New function replacing
5290 dynamic_reloc_count. Change all callers.
5291 (Output_segment::has_dynamic_reloc_list): New function replacing
5292 dynamic_reloc_count_list. Change all callers.
5293 (Output_segment::set_section_addresses): Rewrite.
5294 (Output_segment::set_offset): Rewrite.
5295 (Output_segment::find_first_and_last_list): Remove.
5296 (Output_segment::set_tls_offsets): Rewrite.
5297 (Output_segment::first_section_load_address): Likewise.
5298 (Output_segment::output_section_count): Likewise.
5299 (Output_segment::section_with_lowest_load_address): Likewise.
5300 (Output_segment::write_section_headers): Likewise.
5301 (Output_segment::print_sections_to_map): Likewise.
5302 * output.h (class Output_data): Remove dynamic_reloc_count_
5303 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5304 (Output_data::add_dynamic_reloc): Rewrite.
5305 (Output_data::has_dynamic_reloc): New function.
5306 (Output_data::dynamic_reloc_count): Remove.
5307 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5308 is_last_relro_, is_first_non_relro_, is_interp_,
5309 is_dynamic_linker_section_ fields. Add order and set_order
5310 functions. Remove is_relro_local, set_is_relro_local,
5311 is_last_relro, set_is_last_relro, is_first_non_relro,
5312 set_is_first_non_relro functions, is_interp, set_is_interp,
5313 is_dynamic_linker_section, and set_is_dynamic_linker_section
5314 functions.
5315 (class Output_segment): Change Output_data_list from std::list to
5316 std:;vector. Add output_lists_ field. Remove output_data_ and
5317 output_bss_ fields. Update declarations.
5318
5319 2010-08-02 Ian Lance Taylor <iant@google.com>
5320
5321 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5322 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5323 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5324
5325 2010-08-02 Ian Lance Taylor <iant@google.com>
5326
5327 PR 11855
5328 * script.cc (Script_options::Script_options): Initialize
5329 symbol_definitions_ and symbol_references_.
5330 (Script_options::add_symbol_assignment): Update
5331 symbol_definitions_ and symbol_references_.
5332 (Script_options::add_symbol_reference): New function.
5333 (script_symbol): New function.
5334 * script.h (class Script_options): Add symbol_definitions_ and
5335 symbol_references_ fields.
5336 (Script_options::referenced_const_iterator): New type.
5337 (Script_options::referenced_begin): New function.
5338 (Script_options::referenced_end): New function.
5339 (Script_options::is_referenced): New function.
5340 (Script_options::any_unreferenced): New function.
5341 * script-c.h (script_symbol): Declare.
5342 * yyscript.y (exp): Call script_symbol.
5343 * symtab.cc: Include "script.h".
5344 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5345 Change all callers. Check symbols referenced by scripts.
5346 (Symbol_table::add_undefined_symbols_from_command_line): Add
5347 layout parameter. Change all callers.
5348 (Symbol_table::do_add_undefined_symbols_from_command_line):
5349 Likewise. Break out loop body. Check symbols referenced by
5350 scripts.
5351 (Symbol_table::add_undefined_symbol_from_command_line): New
5352 function broken out of
5353 do_add_undefined_symbols_from_command_line.
5354 * symtab.h (class Symbol_table): Update declarations.
5355 * archive.cc: Include "layout.h".
5356 (Archive::should_include_member): Add layout parameter. Change
5357 all callers. Check for symbol mentioned in expression.
5358 * archive.h (class Archive): Update declaration.
5359 * object.cc (Sized_relobj::do_should_include_member): Add layout
5360 parameter.
5361 * object.h (Object::should_include_member): Add layout parameter.
5362 Change all callers.
5363 (Object::do_should_include_member): Add layout parameter.
5364 (class Sized_relobj): Update declaration.
5365 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5366 parameter.
5367 * dynobj.h (class Sized_dynobj): Update declaration.
5368 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5369 layout parameter.
5370 * plugin.h (class Sized_pluginobj): Update declaration.
5371
5372 2010-08-02 Ian Lance Taylor <iant@google.com>
5373
5374 PR 11866
5375 * output.cc (Output_segment::set_offset): Search for the first and
5376 last sections rather than assuming that the list is in order.
5377 (Output_segment::find_first_and_last_list): New function.
5378 * output.h (class Output_segment): Update declarations.
5379 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5380 (relro_strip_test_SOURCES): New variable.
5381 (relro_strip_test_DEPENDENCIES): New variable.
5382 (relro_strip_test_LDFLAGS): New variable.
5383 (relro_strip_test_LDADD): New variable.
5384 (relro_strip_test.so): New target.
5385
5386 2010-08-02 Ian Lance Taylor <iant@google.com>
5387
5388 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5389 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5390 (Target_i386::got_tlsdesc_section): New function.
5391 (Target_i386::got_section): Create space for GOT entries for
5392 TLSDESC relocations.
5393 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5394 R_386_TLS_GOTDESC.
5395 (Target_i386::Scan::global): Likewise.
5396 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5397 using TLSDESC GOT.
5398 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5399 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5400 (Target_x86_64::got_tlsdesc_section): New function.
5401 (Target_x86_64::got_section): Create space for GOT entries for
5402 TLSDESC relocations.
5403 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5404 R_386_TLS_GOTDESC.
5405 (Target_x86_64::Scan::global): Likewise.
5406 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5407 using TLSDESC GOT.
5408
5409 2010-08-02 Ian Lance Taylor <iant@google.com>
5410
5411 * testsuite/final_layout.sh: Use dc to convert from hex to
5412 decimal.
5413
5414 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5415
5416 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5417 paramter to the call to gold::gc_process_relocs.
5418 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5419 paramter to the call to gold::gc_process_relocs.
5420 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5421 parameter to the call to gold::gc_process_relocs.
5422 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5423 template parameter to the call to gold::gc_process_relocs.
5424 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5425 paramter to the call to gold::gc_process_relocs.
5426 * gc.h (get_embedded_addend_size): New function.
5427 (gc_process_relocs): Save the size of the reloc for use by ICF.
5428 * icf.cc (get_section_contents): Get the addend from the text section
5429 for SHT_REL relocation sections.
5430 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5431 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5432 * int_encoding.h (read_from_pointer): New overloaded function.
5433 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5434 * testsuite/icf_sht_rel_addend_test.sh: New file.
5435 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5436 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5437
5438 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5439
5440 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5441 * Makefile.in: Regenerate.
5442 * testsuite/Makefile.in: Regenerate.
5443
5444 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5445
5446 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5447 * gold/testsuite/debug_msg.cc: Likewise.
5448 * gold/testsuite/odr_violation1.cc
5449 * gold/testsuite/odr_violation2.cc
5450
5451 2010-07-21 Cary Coutant <ccoutant@google.com>
5452
5453 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5454 string, and length fields.
5455 (Output_merge_string::Merged_strings_list): New type.
5456 (Output_merge_string::Merged_strings_lists): New typedef.
5457 (Output_merge_string): Replace merged_strings_ with
5458 merged_strings_lists_.
5459 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5460 Merged_strings_list per input object and section. Don't store pointer
5461 to the string. Don't store length with each merged string entry.
5462 (Output_merge_string::finalize_merged_data): Loop over list of merged
5463 strings lists. Recompute length of each merged string.
5464
5465 2010-07-15 Cary Coutant <ccoutant@google.com>
5466
5467 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5468 here.
5469
5470 2010-07-14 Ian Lance Taylor <iant@google.com>
5471
5472 * descriptors.cc (Descriptors::open): Report correct name in error
5473 message.
5474
5475 2010-07-13 Doug Kwan <dougkwan@google.com>
5476
5477 * arm.cc (Arm_input_section::Arm_input_section): For a
5478 SHT_ARM_EXIDX section, always keeps the input sections.
5479 (Arm_input_section::set_exidx_section_link): New method.
5480 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5481 has_errors_ to false.
5482 (Arm_exidx_input_section::has_errors,
5483 Arm_exidx_input_section::set_has_errors): New methods.
5484 (Arm_exidx_input_section::has_errors_): New data member.
5485 (Arm_relobj::get_exidx_shndx_list): New method.
5486 (Arm_output_section::append_text_sections_to_list): Do not skip
5487 section without SHF_EXECINSTR.
5488 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5489 errors.
5490 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5491 section header. Make error messages more verbose. Check for
5492 a non-executable section linked to an EXIDX section.
5493 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5494 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5495 check that there is no deferred EXIDX section if we exit early.
5496 Instead of not making an EXIDX section in case of an error, make one
5497 and set the has_errors flag of it.
5498 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5499 in a relocatable link.
5500 (Target_arm::do_relax): Look for the EXIDX output section instead of
5501 assuming that it is called .ARM.exidx.
5502 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5503 section list. Do not check for SHF_EXECINSTR section flags but
5504 skip any input section with errors.
5505 * output.cc (Output_section::Output_section): Initialize
5506 always_keeps_input_sections_ to false.
5507 (Output_section::add_input_section): Check for
5508 always_keeps_input_sections_.
5509 * output.h (Output_section::always_keeps_input_sections,
5510 Output_section::set_always_keeps_input_sections): New methods.
5511 (Output_section::always_keeps_input_sections): New data member.
5512
5513 2010-07-13 Rafael Espindola <espindola@google.com>
5514
5515 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5516 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5517
5518 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5519 Ian Lance Taylor <iant@google.com>
5520
5521 * output.h (Output_section_lookup_maps::add_merge_section):
5522 Correct check of whether value was inserted.
5523 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5524 (Output_section_lookup_maps::add_relaxed_input_section):
5525 Likewise.
5526 * arm.cc (Target_arm::got_section): Remove used local os.
5527 * i386.cc (Target_i386::got_section): Likewise.
5528 * x86_64.cc (Target_x86_64::got_section): Likewise.
5529 * sparc.cc (Target_sparc::got_section): Likewise.
5530 (Target_sparc::relocate): Remove unused local have_got_offset.
5531 * powerpc.cc (Target_powerpc::relocate): Likewise.
5532
5533 2010-07-13 Ian Lance Taylor <iant@google.com>
5534
5535 * compressed_output.cc (zlib_decompress): Fix signature in
5536 !HAVE_ZLIB_H case.
5537
5538 * archive.cc (Archive::include_member): Unlock an external member
5539 of a thin archive. Don't bother to delete an object we know is
5540 NULL.
5541
5542 2010-07-12 Cary Coutant <ccoutant@google.com>
5543
5544 * compressed_output.cc (zlib_decompress): New function.
5545 (get_uncompressed_size): New function.
5546 (decompress_input_section): New function.
5547 * compressed_output.h (get_uncompressed_size): New function.
5548 (decompress_input_section): New function.
5549 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5550 Handle compressed debug sections.
5551 * layout.cc (is_compressed_debug_section): New function.
5552 (Layout::output_section_name): Map compressed section names to
5553 canonical names.
5554 * layout.h (is_compressed_debug_section): New function.
5555 (is_debug_info_section): Recognize compressed debug sections.
5556 * merge.cc: Include compressed_output.h.
5557 (Output_merge_data::do_add_input_section): Handle compressed
5558 debug sections.
5559 (Output_merge_string::do_add_input_section): Handle compressed
5560 debug sections.
5561 * object.cc: Include compressed_output.h.
5562 (Sized_relobj::Sized_relobj): Initialize new data members.
5563 (build_compressed_section_map): New function.
5564 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5565 * object.h (Object::section_is_compressed): New method.
5566 (Object::do_section_is_compressed): New method.
5567 (Sized_relobj::Compressed_section_map): New type.
5568 (Sized_relobj::do_section_is_compressed): New method.
5569 (Sized_relobj::compressed_sections_): New data member.
5570 * output.cc (Output_section::add_input_section): Handle compressed
5571 debug sections.
5572 * reloc.cc: Include compressed_output.h.
5573 (Sized_relobj::write_sections): Handle compressed debug sections.
5574
5575 2010-07-08 Cary Coutant <ccoutant@google.com>
5576
5577 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5578 weak when resolving to a dynamic def.
5579 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5580 for weak undef/dynamic def cases. Adjust callers.
5581 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5582 undef_binding_weak_.
5583 (Symbol_table::sized_write_globals): Adjust symbol binding.
5584 (Symbol_table::sized_write_symbol): Add binding parameter.
5585 * symtab.h (Symbol::set_undef_binding): New method.
5586 (Symbol::is_undef_binding_weak): New method.
5587 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5588 (Symbol_table::should_override): Add new parameter.
5589 (Symbol_table::sized_write_symbol): Add new parameter.
5590
5591 * testsuite/weak_undef_file1.cc: Add new test case.
5592 * testsuite/weak_undef_file2.cc: Fix header comment.
5593 * testsuite/weak_undef_test.cc: Add new test case.
5594
5595 2010-06-29 Doug Kwan <dougkwan@google.com>
5596
5597 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5598 Initialize USE_SYMBOL_.
5599 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5600 definition.
5601 (Arm_reloc_property::uses_symbol_): New data member declaration.
5602 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5603 uses symbol value and symbol is undefined but not weakly undefined.
5604
5605 2010-06-28 Rafael Espindola <espindola@google.com>
5606
5607 * plugin.cc (Plugin::load): Use dlerror.
5608
5609 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5610
5611 * symtab.cc (detect_odr_violations): When reporting an ODR
5612 violation, report an object where the symbol is defined.
5613
5614 2010-06-25 Doug Kwan <dougkwan@google.com>
5615
5616 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5617 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5618 definition.
5619 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5620 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5621 target hook to detect function points.
5622 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5623 * icf.h (Icf::check_section_for_function_pointers): Change type of
5624 parameter SECTION_NAME to const reference to std::string. Use
5625 target hook to determine if section may have unsafe pointers.
5626 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5627 method definition.
5628
5629 2010-06-21 Rafael Espindola <espindola@google.com>
5630
5631 * fileread.cc (Input_file::find_fie): New
5632 (Input_file::open): Use Input_file::find_fie.
5633 * fileread.h (Input_file::find_fie): New
5634 * plugin.cc (set_extra_library_path): New.
5635 (Plugin::load): Add set_extra_library_path to the transfer vector.
5636 (Plugin_manager::set_extra_library_path): New.
5637 (Plugin_manager::add_input_file): Use the extra search path if set.
5638 (set_extra_library_path(): New.
5639 * plugin.h (Plugin_manager): Add set_extra_library_path and
5640 extra_search_path_.
5641
5642 2010-06-19 Cary Coutant <ccoutant@google.com>
5643
5644 * layout.cc (gdb_sections): Add .debug_types.
5645 (lines_only_debug_sections): Likewise.
5646
5647 2010-06-18 Rafael Espindola <espindola@google.com>
5648
5649 * plugin.cc (add_input_file,add_input_library)
5650 (Plugin_manager::add_input_file): Make filename arguments const.
5651 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5652 const.
5653
5654 2010-06-16 Doug Kwan <dougkwan@google.com>
5655
5656 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5657 .ARM.attributes section if we have not merged any input
5658 attributes sections.
5659
5660 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5661
5662 * arm.cc: Allow combining objects with no EABI version
5663 information.
5664
5665 2010-06-15 Rafael Espindola <espindola@google.com>
5666
5667 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5668
5669 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5670
5671 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5672 (struct iovec): Correct !HAVE_READV definition.
5673
5674 2010-06-10 Cary Coutant <ccoutant@google.com>
5675
5676 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5677 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5678 reloc sections.
5679 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5680
5681 PR 11683
5682 * symtab.h (Symbol::is_placeholder): New member function.
5683 * target-reloc.h (relocate_section): Check for placeholder symbols.
5684
5685 * testsuite/Makefile.am (plugin_test_8): New test.
5686 (plugin_test_9): New test.
5687 * testsuite/Makefile.in: Regenerate.
5688
5689 2010-06-09 Nick Clifton <nickc@redhat.com>
5690
5691 * yyscript.y (input_list_element): Allow strings prefixed with
5692 the '-' character. Treat these as libraries.
5693 * script.cc (script_add_library): New function. Adds a library
5694 specified by "-l<name>" found in an input script.
5695 * script-c.h: Add prototype for script_add_library.
5696
5697 2010-06-07 Doug Kwan <dougkwan@google.com>
5698
5699 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5700 Restrict stub-group size to be within long conditional branch
5701 range when working around cortex-A8 erratum.
5702
5703 2010-06-07 Damien Diederen <dd@crosstwine.com>
5704
5705 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5706 #ifdef typo.
5707
5708 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5709
5710 PR gold/11658
5711 * output.cc
5712 (Output_section::Input_section_sort_entry::compare_section_ordering):
5713 Change to return non-zero correctly.
5714 (Output_section::Input_section_sort_section_order_index_compare
5715 ::operator()): Change to fix ambiguity in comparisons.
5716
5717 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5718
5719 * gold.h (is_wildcard_string): New function.
5720 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5721 (Layout::layout_eh_frame): Ditto.
5722 (Layout::find_section_order_index): New method.
5723 (Layout::read_layout_from_file): New method.
5724 * layout.h (Layout::find_section_order_index): New method.
5725 (Layout::read_layout_from_file): New method.
5726 (Layout::input_section_position_): New private member.
5727 (Layout::input_section_glob_): New private member.
5728 * main.cc (main): Call read_layout_from_file here.
5729 * options.h (--section-ordering-file): New option.
5730 * output.cc (Output_section::input_section_order_specified_): New
5731 member.
5732 (Output_section::Output_section): Initialize new member.
5733 (Output_section::add_input_section): Add new parameter.
5734 Keep input sections when --section-ordering-file is used.
5735 (Output_section::set_final_data_size): Sort input sections when
5736 section ordering file is specified.
5737 (Output_section::Input_section_sort_entry): Add new parameter.
5738 Check sorting type.
5739 (Output_section::Input_section_sort_entry::compare_section_ordering):
5740 New method.
5741 (Output_section::Input_section_sort_compare::operator()): Change to
5742 consider section_order_index.
5743 (Output_section::Input_section_sort_init_fini_compare::operator()):
5744 Change to consider section_order_index.
5745 (Output_section::Input_section_sort_section_order_index_compare
5746 ::operator()): New method.
5747 (Output_section::sort_attached_input_sections): Change to sort
5748 according to section order when specified.
5749 (Output_section::add_input_section<32, true>): Add new parameter.
5750 (Output_section::add_input_section<64, true>): Add new parameter.
5751 (Output_section::add_input_section<32, false>): Add new parameter.
5752 (Output_section::add_input_section<64, false>): Add new parameter.
5753 * output.h (Output_section::add_input_section): Add new parameter.
5754 (Output_section::input_section_order_specified): New
5755 method.
5756 (Output_section::set_input_section_order_specified): New method.
5757 (Input_section::Input_section): Initialize section_order_index_.
5758 (Input_section::section_order_index): New method.
5759 (Input_section::set_section_order_index): New method.
5760 (Input_section::section_order_index_): New member.
5761 (Input_section::Input_section_sort_section_order_index_compare): New
5762 struct.
5763 (Output_section::input_section_order_specified_): New member.
5764 * script-sections.cc (is_wildcard_string): Delete and move modified
5765 method to gold.h.
5766 (Output_section_element_input::Output_section_element_input): Modify
5767 call to is_wildcard_string.
5768 (Output_section_element_input::Input_section_pattern
5769 ::Input_section_pattern): Ditto.
5770 (Output_section_element_input::Output_section_element_input): Ditto.
5771 * testsuite/Makefile.am (final_layout): New test case.
5772 * testsuite/Makefile.in: Regenerate.
5773 * testsuite/final_layout.cc: New file.
5774 * testsuite/final_layout.sh: New file.
5775
5776 2010-06-01 Rafael Espindola <espindola@google.com>
5777
5778 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5779
5780 2010-06-01 Rafael Espindola <espindola@google.com>
5781
5782 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5783 visibility of symbols.
5784
5785 2010-05-27 Doug Kwan <dougkwan@google.com>
5786
5787 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5788 from start of output section instead of address for a local symbol
5789 in a merged or relaxed section when doing a relocatable link.
5790
5791 2010-05-26 Rafael Espindola <espindola@google.com>
5792
5793 PR 11604
5794 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5795 adding sections the garbage collector removed.
5796 * gold/testsuite/Makefile.am: Add test.
5797 * gold/testsuite/Makefile.in: Regenerate.
5798 * gold/testsuite/plugin_test_7.sh: New.
5799 * gold/testsuite/plugin_test_7_1.c: New.
5800 * gold/testsuite/plugin_test_7_2.c: New.
5801
5802 2010-05-26 Rafael Espindola <espindola@google.com>
5803
5804 * script-sections.cc (Output_section_definition::set_section_addresses):
5805 Check for --section-start.
5806
5807 2010-05-26 Doug Kwan <dougkwan@google.com>
5808
5809 * arm.cc (Arm_scan_relocatable_relocs): New class.
5810 (Target_arm::relocate_special_relocatable): New method.
5811 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5812 (Arm_relocate_functions::thumb_branch_common): Same.
5813 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5814 instead of Default_scan_relocatable_relocs.
5815 * target-reloc.h (relocate_for_relocatable): Let target handle
5816 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5817 * target.h (Sized_target::relocate_special_relocatable): New method.
5818
5819 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5820
5821 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5822
5823 2010-05-23 Doug Kwan <dougkwan@google.com>
5824
5825 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5826 instead of a cast.
5827 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5828 with a direct branch, not a conditional branch, to a stub.
5829 * merge.cc (Output_merge_base::record_input_section): New method
5830 defintion.
5831 (Output_merge_data::do_add_input_section): Record input section if
5832 keeps-input-sections flag is set.
5833 (Output_merge_string::do_add_input_section): Ditto.
5834 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5835 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5836 INPUT_SECTIONS_.
5837 (Output_merge_base::keeps_input_sections,
5838 Output_merge_base::set_keeps_input_sections,
5839 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5840 method definitions.
5841 (Output_merge_base::Input_sections): New type declaration.
5842 (Output_merge_base::input_sections_begin,
5843 Output_merge_base::input_sections_end,
5844 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5845 (Output_merge_base::bool keeps_input_sections_,
5846 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5847 Output_merge_base::input_sections_): New data members.
5848 (Output_merge_data::do_set_keeps_input_sections): New method
5849 defintion.
5850 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5851 * output.cc (Output_section::Input_section::relobj): Move method
5852 defintion from class declaration to here and handle merge sections.
5853 (Output_section::Input_section::shndx): Ditto.
5854 (Output_section::Output_section): Remove initializations of removed
5855 data members and initialize new data member LOOKUP_MAPS_.
5856 (Output_section::add_input_section): Set keeps-input-sections flag
5857 for a newly created merge output section as appropriate. Adjust code
5858 to use Output_section_lookup_maps class.
5859 (Output_section::add_relaxed_input_section): Adjst code for lookup
5860 maps code refactoring.
5861 (Output_section::add_merge_input_section): Add a new parameter
5862 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5863 class. If adding input section to a newly created merge output
5864 section fails, remove the new merge section.
5865 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5866 Adjust code for use of the Output_section_lookup_maps class.
5867 (Output_section::find_merge_section): Ditto.
5868 (Output_section::build_lookup_maps): New method defintion.
5869 (Output_section::find_relaxed_input_section): Adjust code to use
5870 Output_section_lookup_maps class.
5871 (Output_section::get_input_sections): Export merge sections. Adjust
5872 code to use Output_section_lookup_maps class.
5873 (Output_section:::add_script_input_section): Adjust code to use
5874 Output_section_lookup_maps class. Update lookup maps for merge
5875 sections also.
5876 (Output_section::discard_states): Use Output_section_lookup_maps.
5877 (Output_section::restore_states): Same.
5878 * output.h (Merge_section_properties): Move class defintion out of
5879 Output_section.
5880 (Output_section_lookup_maps): New class.
5881 (Output_section::Input_section::is_merge_section): New method
5882 defintion.
5883 (Output_section::Input_section::relobj): Move defintion out of class
5884 defintion. Declare method only.
5885 (Output_section::Input_section::shndx): Ditto.
5886 (Output_section::Input_section::output_merge_base): New method defintion.
5887 (Output_section::Input_section::u2_.pomb): New union field.
5888 (Output_section::Merge_section_by_properties_map,
5889 Output_section::Output_section_data_by_input_section_map,
5890 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5891 Remove types.
5892 (Output_section::add_merge_input_section): Add new parameter
5893 KEEPS_INPUT_SECTIONS.
5894 (Output_section::build_lookup_maps): New method declaration.
5895 (Output_section::merge_section_map_,
5896 Output_section::merge_section_by_properties_map_,
5897 Output_section::relaxed_input_section_map_,
5898 Output_section::is_relaxed_input_section_map_valid_): Remove data
5899 members.
5900 (Output_section::lookup_maps_): New data member.
5901
5902 2010-05-21 Doug Kwan <dougkwan@google.com>
5903
5904 PR gold/11619
5905 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5906 avoid a compilation error.
5907
5908 2010-05-19 Rafael Espindola <espindola@google.com>
5909
5910 * script-sections.cc (Output_section_definition::allocate_to_segment):
5911 Update the phdrs_list even when the output section is NULL.
5912 * testsuite/Makefile.am: Add test.
5913 * testsuite/Makefile.in: Regenerate.
5914 * testsuite/script_test_9.cc: New.
5915 * testsuite/script_test_9.sh: New.
5916 * testsuite/script_test_9.t: New.
5917
5918 2010-05-19 Doug Kwan <dougkwan@google.com>
5919
5920 * arm.cc (Arm_input_section::original_size): New method.
5921 (Arm_input_section::do_addralign): Add a cast.
5922 (Arm_input_section::do_output_offset): Remove static cast.
5923 (Arm_input_section::original_addralign,
5924 Arm_input_section::original_size_): Change type to uint32_t.
5925 (Arm_input_section::init): Add safe casts for section alignment
5926 and size.
5927 (Arm_input_section::set_final_data_size): Do not set address and
5928 offset of stub table.
5929 (Arm_output_section::fix_exidx_coverage): Change use of of
5930 Output_section::Simple_input_section to that of
5931 Output_section::Input_section.
5932 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5933 except for the first pass.
5934 * output.cc (Output_section::get_input_sections): Change type of
5935 input_sections to std::list<Input_section>.
5936 (Output_section::add_script_input_section): Rename from
5937 Output_section::add_simple_input_section. Change type of SIS
5938 parameter from Simple_input_section to Input_section.
5939 * output.h (Output_section::Simple_input_section): Remove class.
5940 (Output_section::Input_section): Change class visibility to public.
5941 (Output_section::Input_section::addralign): Use stored alignments
5942 for special input sections if set.
5943 (Output_section::Input_section::set_addralign): New method.
5944 (Output_section::get_input_sections): Change parameter type from
5945 list of Simple_input_section to list of Input_section.
5946 (Output_section::add_script_input_section): Rename from
5947 Output_section::add_simple_input_section. Change first parameter's
5948 type from Simple_input_section to Input_section and remove the
5949 second and third parameters.
5950 * script-sections.cc (Input_section::Input_section_list): Change
5951 type to list of Output_section::Input_section/
5952 (Input_section_info::Input_section_info): Change parameter type of
5953 INPUT_SECTION to Output_section::Input_section.
5954 (Input_section_info::input_section): Change return type.
5955 (Input_section_info::input_section_): Change type to
5956 Output_section::Input_section.
5957 (Output_section_element_input::set_section_addresses): Adjust code
5958 to use Output_section::Input_section instead of
5959 Output_section::Simple_input_section. Adjust code for renaming
5960 of Output_section::add_simple_input_section.
5961 (Orphan_output_section::set_section_addresses): Ditto.
5962
5963 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5964
5965 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5966 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5967
5968 2010-05-18 Rafael Espindola <espindola@google.com>
5969
5970 * options.cc (General_options::finalize): Handle -nostdlib.
5971 * options.h (nostdlib): New option.
5972 * script.cc (script_add_search_dir): Handle -nostdlib.
5973
5974 2010-05-12 Doug Kwan <dougkwan@google.com>
5975
5976 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5977 attributes section only if there no attributes section after merging.
5978 (Target_arm::merge_object_attributes): Move value of
5979 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5980 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5981 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5982 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5983 and arm_attr_merge_7.stdout.
5984 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5985 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5986 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5987 arm_attr_merge_7b.o): New rules.
5988 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5989 arm_attr_merge_7
5990 * testsuite/Makefile.in: Regenerate.
5991 * testsuite/arm_attr_merge.sh: New file.
5992 * testsuite/arm_attr_merge_[67][ab].s: Same.
5993
5994 2010-05-05 Nick Clifton <nickc@redhat.com>
5995
5996 * po/es.po: Updated Spanish translation.
5997
5998 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5999
6000 * Makefile.am (install-exec-local): Properly install gold as
6001 default cross linker.
6002 * Makefile.in: Regenerated.
6003
6004 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6005 Nick Clifton <nickc@redhat.com>
6006
6007 * configure.ac (install_as_default): Define and set to false
6008 unless --enable-gold or --enable-gold=both/gold has been
6009 specified.
6010 * configure: Regenerate.
6011
6012 * Makefile.am (install-exec-local): Install the executable as
6013 'ld.gold'. If install_as_default is true then also install it as
6014 'ld'.
6015 * Makefile.in: Regenerated.
6016
6017 2010-04-24 Ian Lance Taylor <iant@google.com>
6018
6019 * layout.cc (Layout::layout_reloc): In relocatable link don't
6020 combine reloc sections for grouped sections.
6021
6022 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6023
6024 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6025 sections that are not ordinary to icf.
6026 * icf.cc (get_section_contents): Handle relocation pointing to section
6027 with no object or shndx information.
6028 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6029 * testsuite/Makefile.in: Regenerate.
6030 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6031 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6032
6033 2010-04-22 Ian Lance Taylor <iant@google.com>
6034
6035 * expression.cc (Expression::Expression_eval_info): Add
6036 result_alignment_pointer field.
6037 (Expression::eval_with_dot): Add result_alignment_pointer
6038 parameter. Change all callers.
6039 (Expression::eval_maybe_dot): Likewise.
6040 (class Binary_expression): Add alignment_pointer parameter to
6041 left_value and right_value. Change all callers.
6042 (BINARY_EXPRESSION): Set result alignment.
6043 (class Trinary_expression): Add alignment_pointer parameter to
6044 arg2_value and arg3_value. Change all callers.
6045 (Trinary_cond::value): Set result alignment.
6046 (Max_expression::value, Min_expression::value): Likewise.
6047 (Align_expression::value): Likewise.
6048 * script-sections.cc (class Sections_element): Add dot_alignment
6049 parameter to set_section_addresses virtual function. Update
6050 instantiations.
6051 (class Output_section_element): Likewise.
6052 (Script_sections::create_segments): Add dot_alignment parameter.
6053 Change all callers.
6054 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6055 (Script_sections::set_phdrs_clause_addresses): Likewise.
6056 * script-sections.h: Update declarations.
6057 * script.h: Update declarations.
6058 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6059 min_p_align.
6060 * testsuite/script_test_3.t: Set large alignment.
6061 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6062 segment has expected alignment.
6063
6064 2010-04-22 Nick Clifton <nickc@redhat.com>
6065
6066 * po/gold.pot: Updated by the Translation project.
6067 * po/vi.po: Updated Vietnamese translation.
6068
6069 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6070
6071 * testsuite/Makefile.am (check_PROGRAMS): Add
6072 icf_virtual_function_folding_test.
6073 * testsuite/Makefile.in: Regenerated.
6074
6075 2010-04-15 Andrew Haley <aph@redhat.com>
6076
6077 * options.h (merge_exidx_entries): New option.
6078 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6079 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6080 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6081 (Target_arm::merge_exidx_entries): New function.
6082 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6083 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6084 to Arm_exidx_fixup constructor.
6085 Add new arg, merge_exidx_entries.
6086 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6087 Arm_output_section::fix_exidx_coverage.
6088
6089 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6090
6091 * icf.cc (get_section_contents): Check for preemptible functions.
6092 Ignore addend when appropriate.
6093 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6094 section folded.
6095 (add_from_relobj): Check for section folded.
6096 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6097 * symtab.h (should_add_dynsym_entry): Add new parameter.
6098 * target-reloc.h (scan_relocs): Check for section folded.
6099 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6100 Check reloc types for function pointers in shared objects.
6101 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6102 case.
6103 (icf_preemptible_functions_test): New test case.
6104 (icf_string_merge_test): New test case.
6105 * testsuite.Makefile.in: Regenerate.
6106 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6107 bar_glob. Refactor code.
6108 * testsuite/icf_preemptible_functions_test.cc: New file.
6109 * testsuite/icf_preemptible_functions_test.sh: New file.
6110 * testsuite/icf_string_merge_test.cc: New file.
6111 * testsuite/icf_string_merge_test.sh: New file.
6112 * testsuite/icf_virtual_function_folding_test.cc: New file.
6113 * testsuite/icf_virtual_function_folding_test.sh: New file.
6114
6115 2010-04-14 Doug Kwan <dougkwan@google.com>
6116
6117 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6118 for local symbol recounting if we remove a section due to ICF.
6119 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6120 there are no regular objects in input.
6121
6122 2010-04-13 Doug Kwan <dougkwan@google.com>
6123
6124 * arm.cc (Arm_input_section::set_final_data_size): Compute
6125 accurate final data size instead of using current data size.
6126
6127 2010-04-09 Doug Kwan <dougkwan@google.com>
6128
6129 * layout.cc (Layout::choose_output_section): Handle script section
6130 types.
6131 (Layout::make_output_section_for_script): Add section type parameter.
6132 Handle script section types.
6133 * layout.h (Layout::make_output_section_for_script): Add section
6134 type parameter.
6135 * output.cc (Output_section::Output_section): Initialize data member
6136 is_noload_.
6137 (Output_section::do_reset_address_and_file_offset): Do not set address
6138 to 0 if section is a NOLOAD section.
6139 * output.h (Output_section::is_noload): New method.
6140 (Output_section::set_is_noload): Ditto.
6141 (Output_section::is_noload_): New data member.
6142 * script-c.h (Script_section_type): New enum type.
6143 (struct Parser_output_section_header): Add new file section_type.
6144 * script-sections.cc (Sections_element::output_section_name): Add
6145 parameter for returning script section type.
6146 (Output_section_definition::output_section_name): Ditto.
6147 (Output_section_definition::section_type)P; New method.
6148 (Output_section_definiton::script_section_type_name): Ditto.
6149 (Output_section_definition::script_section_type_): New data member.
6150 (Output_section_definition::Output_section_definition): Initialize
6151 data member Output_section_definition::script_section_type_.
6152 (Output_section_definition::create_sections): Pass script section type
6153 to Layout::make_output_section_for_script.
6154 (Output_section_definition::output_section_name): Return script
6155 section type to caller.
6156 (Output_section_definition::set_section_address): Do not advance
6157 dot value and load address if section type is NOLOAD. Set address
6158 of NOLOAD sections regardless of section flags.
6159 (Output_section_definition::print): Print section type if it is
6160 not SCRIPT_SECTION_TYPE_NONE.
6161 (Output_section_definition::section_type): New method.
6162 (Output_section_definition::script_section_type_name): Ditto.
6163 (Script_sections::output_section_name): Add new parameter
6164 PSECTION_TYPE for returning script section type. Pass it to
6165 section elements. Handle discard sections.
6166 (Sort_output_sections::operator()): Handle NOLOAD sections.
6167 * script-sections.h (Script_sections::Section_type): New enum type.
6168 (Script_sections::output_section_name): Add a new parameter for
6169 returning script section type.
6170 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6171 INFO and NOLOAD.
6172 * yyscript.y (union): Add new field SECTION_TYPE.
6173 (COPY, DSECT, INFO, NOLOAD): New tokens.
6174 (opt_address_and_section_type): Change type to output_section_header.
6175 (section_type): New non-terminal
6176 (section_header): Handle section type.
6177 (opt_address_and_section_type): Return section type value.
6178
6179 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6180
6181 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6182 * testsuite/plugin_common_test_2.c (foo): Likewise.
6183
6184 2010-04-08 Doug Kwan <dougkwan@google.com>
6185
6186 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6187 Output_merge_data.
6188 * output.cc (Output_section::add_merge_input_section): Simplify
6189 code and return status of Output_merge_base::add_input_section.
6190 Update merge section map only if Output_merge_base::add_input_section
6191 returns true.
6192
6193 2010-04-07 Doug Kwan <dougkwan@google.com>
6194
6195 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6196 if section is marked as containing instructions but has no mapping
6197 symbols.
6198 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6199 correct section index.
6200 (Arm_relobj::find_linked_text_section): Ditto.
6201
6202 2010-04-07 Cary Coutant <ccoutant@google.com>
6203
6204 * archive.cc (include_member): Destroy Read_symbols_data object before
6205 releasing file.
6206 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6207 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6208 (Read_symbols_data::~Read_symbols_data) New destructor.
6209 (Section_relocs::Section_relocs) New constructor.
6210 (Section_relocs::~Section_relocs) New destructor.
6211 (Read_relocs_data::Read_relocs_data) New constructor.
6212 (Read_relocs_data::~Read_relocs_data) New destructor.
6213 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6214 pointers to NULL after deleting.
6215
6216 2010-04-07 Doug Kwan <dougkwan@google.com>
6217
6218 * arm.cc: Replace "endianity" with "endianness" in comments.
6219 (Arm_exidx_cantunwind): Ditto.
6220 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6221 (Arm_relobj::merge_flags_and_attributes): New method.
6222 (Arm_relobj::merge_flags_and_attributes_): New data member.
6223 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6224 (Arm_relobj::scan_sections_for_stubs): Ditto.
6225 (Arm_relobj::do_read_symbols): Check to see if we really want to
6226 merge processor-specific flags and attributes. Exit early if
6227 an object is empty except for section names and the undefined symbol.
6228 (Target_arm::do_finalize_sections): Move check for ELF format to
6229 Arm_relobj::do_read_symbols. Merge processor specific flags and
6230 attributes from a regular object only when we have determined that
6231 it is aapropriate. Do not create an .ARM.attributes section in
6232 output if there is no regular input object.
6233 (Target_arm::merge_processor_specific_flags): Check
6234 --warn-mismatch before printing any error.
6235 (Target_arm::merge_object_attributes): Ditto.
6236 * gold.cc (queue_middle_tasks): Handle the case in which there is
6237 no regular object in input.
6238 * options.cc (General_options::parse_EB): New method.
6239 (General_options::parse_EL): Same.
6240 (General_options::General_options): Initialize endianness_.
6241 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6242 New options.
6243 (General_options::Endianness): New enum.
6244 (General_options::endianness): New method.
6245 (General_options::endianness_): New data member.
6246 * parameters.cc (Parameters::set_options): Check target endianness.
6247 (Parameters::set_target_once): Ditto.
6248 (Parameters::check_target_endianness): New method.
6249 (parameters_force_valid_target): If either -EL or -EB is specified,
6250 use it to define endianness of default target.
6251 * parameters.h (Parameters::check_target_endianness): New method
6252 declaration.
6253 * target.h (class Target): Change "endianity" to "endianness"
6254 in comments.
6255
6256 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6257
6258 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6259 * configure: Regenerate.
6260 * Makefile.in: Regenerate.
6261 * testsuite/Makefile.in: Regenerate.
6262
6263 2010-04-06 Cary Coutant <ccoutant@google.com>
6264
6265 gcc PR lto/42757
6266 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6267 prevailing definitions of common symbols.
6268 * testsuite/plugin_test_6.sh: New test case.
6269 * testsuite/plugin_common_test_1.c: New test case.
6270 * testsuite/plugin_common_test_2.c: New test case.
6271 * testsuite/Makefile.am (plugin_test_6): New test case.
6272 * testsuite/Makefile.in: Regenerate.
6273
6274 2010-04-06 Nick Clifton <nickc@redhat.com>
6275
6276 * po/vi.po: New Vietnamese translation.
6277
6278 2010-03-30 Doug Kwan <dougkwan@google.com>
6279
6280 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6281
6282 2010-03-25 Doug Kwan <dougkwan@google.com>
6283
6284 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6285 to avoid a conversion warning on a 32-bit host.
6286
6287 2010-03-24 Ian Lance Taylor <iant@google.com>
6288
6289 * testsuite/script_test_3.t: Add a TLS segment.
6290 * testsuite/Makefile.am (check_PROGRAMS): Add
6291 tls_phdrs_script_test.
6292 (tls_phdrs_script_test_SOURCES): Define.
6293 (tls_phdrs_script_test_DEPENDENCIES): Define.
6294 (tls_phdrs_script_test_LDFLAGS): Define.
6295 (tls_phdrs_script_test_LDADD): Define.
6296 * testsuite/Makefile.in: Rebuild.
6297
6298 2010-03-23 Cary Coutant <ccoutant@google.com>
6299
6300 * fileread.cc (find_or_make_view): Fix comment.
6301
6302 2010-03-23 Ian Lance Taylor <iant@google.com>
6303
6304 * script-sections.cc (class Orphan_section_placement): Define
6305 PLACE_TLS and PLACE_TLS_BSS.
6306 (Orphan_section_placement::Orphan_section_placement): Initialize
6307 new places.
6308 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6309 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6310 (tls_script_test_SOURCES): Define.
6311 (tls_script_test_DEPENDENCIES): Define.
6312 (tls_script_test_LDFLAGS): Define.
6313 (tls_script_test_LDADD): Define.
6314 * testsuite/Makefile.in: Rebuild.
6315
6316 2010-03-22 Doug Kwan <dougkwan@google.com>
6317
6318 * arm.cc (Arm_relocate_functions::abs8,
6319 Arm_relocate_functions::abs16): Use correct check for overflow
6320 specified in the ARM ELF specs.
6321 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6322 target of a BLX instruction specially.
6323 (Reloc_stub::stub_type_for_reloc): Ditto.
6324 (Relocate::relocate): Use symbolic names instead of numeric relocation
6325 codes to report error.
6326 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6327 workaround.
6328 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6329 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6330 thumb2_blx_out_of_range.stdout
6331 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6332 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6333 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6334 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6335 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6336 thumb2_blx_in_range, thumb2_blx_in_range.o,
6337 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6338 thumb2_blx_out_of_range.o): New rules.
6339 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6340 thumb2_blx_in_range and thumb2_blx_out_of_range.
6341 * testsuite/Makefile.in: Regenerate.
6342 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6343 * testsuite/thumb_blx_in_range.s: New file.
6344 * testsuite/thumb_blx_out_of_range.s: New file.
6345
6346 2010-03-22 Rafael Espindola <espindola@google.com>
6347
6348 * archive.cc (Should_include): Move to archive.h.
6349 (should_include_member): Make it a member of Archive.
6350 (Lib_group): New.
6351 (Add_lib_group_symbols): New.
6352 * archive.h: Include options.h.
6353 (Archive_member): Moved from Archive.
6354 (Should_include): Moved from archive.cc.
6355 (Lib_group): New.
6356 (Add_lib_group_symbols): New.
6357 * dynobj.cc (do_should_include_member): New.
6358 * dynobj.h (do_should_include_member): New.
6359 * gold.cc (queue_initial_tasks): Update call to queue.
6360 * main.cc (main): Print lib group stats.
6361 * object.cc (do_should_include_member): New.
6362 * object.h: Include archive.h.
6363 (Object::should_include_member): New.
6364 (Object::do_should_include_member): New.
6365 (Sized_relobj::do_should_include_member): New.
6366 * options.cc (General_options::parse_start_lib): New.
6367 (General_options::parse_end_lib): New.
6368 (Input_arguments::add_file): Handle lib groups.
6369 (Input_arguments::start_group): Check we are not in a lib.
6370 (Input_arguments::start_lib): New.
6371 (Input_arguments::end_lib): New.
6372 * options.h (General_options): Add start_lib and end_lib.
6373 (Input_argument::lib_): New.
6374 (Input_argument::lib): New.
6375 (Input_argument::is_lib): New.
6376 (Input_file_lib): New.
6377 (Input_arguments::in_lib_): New.
6378 (Input_arguments::in_lib): New.
6379 (Input_arguments::start_lib): New.
6380 (Input_arguments::end_lib_): New.
6381 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6382 in unused members as preempted.
6383 (Sized_pluginobj::do_should_include_member): New.
6384 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6385 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6386 return the blocker.
6387 (Read_symbols::do_whole_lib_group): New.
6388 (Read_symbols::do_lib_group): New.
6389 (Read_symbols::do_read_symbols): Handle lib groups.
6390 (Read_symbols::get_name): Handle lib groups.
6391 * readsyms.h (Read_symbols): Add an archive member pointer.
6392 (Read_symbols::do_whole_lib_group): New.
6393 (Read_symbols::do_lib_group): New.
6394 (Read_symbols::member_): New.
6395 * script.cc (read_input_script): Update call to queue_soon.
6396
6397 2010-03-19 Doug Kwan <dougkwan@google.com>
6398
6399 * arm.cc (Stub_table::Stub_table): Initialize new data members
6400 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6401 (Stub_table::add_reloc_stub): Assign stub offset and update
6402 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6403 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6404 New data members.
6405 (Stub_table::update_data_size_and_addralign): Use
6406 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6407 instead of going over all reloc stubs.
6408 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6409 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6410 Stringpool_template::offset_ to size of Stringpool_char.
6411 (Stringpool_template::new_key_offset): Remove code to initialize
6412 Stringpool_template::offset_.
6413 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6414 Stringpool_template::offset_ to zero.
6415
6416 2010-03-15 Doug Kwan <dougkwan@google.com>
6417
6418 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6419 offset_.
6420 (Stringpool_template::new_key_offset): New method.
6421 (Stringpool_template::add_string): Assign offsets when adding new
6422 strings.
6423 (Stringpool_template::set_string_offsets): Do not set string offsets
6424 when not optimizing.
6425 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6426 member size_.
6427 (Chunked_vector::clear): Clear size_.
6428 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6429 (Chunked_vector::size): Return size_.
6430 (Chunked_vector::push_back): Use size_ to find insert position.
6431 (Chunked_vector::size_): New data member.
6432 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6433 (Stringpool_template::new_key_offset): New method declaration.
6434 (Stringpool_template::offset_): New data member.
6435
6436 2010-03-15 Rafael Espindola <espindola@google.com>
6437
6438 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6439 Add_symbols' constructor.
6440 * readsyms.h (Add_symbols): Remove the input_group member.
6441
6442 2010-03-10 Ian Lance Taylor <iant@google.com>
6443
6444 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6445 target to ask whether a reference to a symbol requires a stack
6446 split.
6447 * target.h (Target::is_call_to_non_split): New function.
6448 (Target::do_is_call_to_non_split): Declare virtual function.
6449 * target.cc: Include "symtab.h".
6450 (Target::do_is_call_to_non_split): New function.
6451 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6452
6453 2010-03-10 Cary Coutant <ccoutant@google.com>
6454
6455 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6456 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6457 (File_read::open[2]): Add whole_file_view_ to list of views.
6458 (File_read::make_view): Remove test of whole_file_view_.
6459 (File_read::find_or_make_view): Create whole_file_view_ if
6460 necessary.
6461 (File_read::clear_views): Replace bool parameter with enum;
6462 adjust all callers. Don't delete views with permanent data;
6463 do delete cached views and views from archives if
6464 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6465 if clearing the corresponding view.
6466 * fileread.h (File_read::Clear_views_mode): New enum.
6467 (File_read::View::is_permanent_view): New method.
6468 (File_read::clear_views): Replace bool parameter
6469 with enum; adjust all callers.
6470 * options.h (General_options): Change keep_files_mapped option;
6471 add map_whole_files.
6472 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6473 releasing the file.
6474 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6475 the file.
6476
6477 2010-03-10 David S. Miller <davem@davemloft.net>
6478
6479 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6480
6481 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6482
6483 * icf.cc (get_section_contents): Add '@' marker after processing the
6484 merge reloc.
6485
6486 2010-03-08 Doug Kwan <dougkwan@google.com>
6487
6488 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6489 due to a conversion warning.
6490 (Arm_relobj::update_output_local_symbol_count): Check for local
6491 symbol with unset output index.
6492
6493 2010-03-05 Ian Lance Taylor <iant@google.com>
6494
6495 * options.h (class General_options): Add --spare-dynamic-tags.
6496 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6497 --spare-dynamic-tags.
6498
6499 2010-03-05 Ian Lance Taylor <iant@google.com>
6500
6501 * incremental.cc: Include "libiberty.h".
6502
6503 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6504
6505 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6506 function, is_info_ member.
6507 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6508 (Versions::Versions): Update caller.
6509 (Versions::define_base_version): Likewise.
6510 (Versions::add_def): Likewise.
6511
6512 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6513
6514 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6515 (Scan::possible_function_pointer_reloc): New function.
6516 (Scan::local_reloc_may_be_function_pointer): Change to call
6517 possible_function_pointer_reloc.
6518 (Scan::global_reloc_may_be_function_pointer): Ditto.
6519 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6520 relocations in ".data.rel.ro._ZTV" section.
6521 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6522 * testsuite/icf_safe_so_test.cc: Ditto.
6523 * testsuite/icf_safe_test.cc: Ditto.
6524 * testsuite/icf_safe_test.sh: Ditto.
6525
6526 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6527 Ian Lance Taylor <iant@google.com>
6528
6529 * target-reloc.h (relocate_section): Check the symbol table index
6530 for -1U before setting the local symbol index.
6531 (scan_relocatable_relocs): If copying the relocation, record that
6532 the local symbol is required.
6533 * object.h (Symbol_value::is_output_symtab_index_set): New
6534 function.
6535 (Symbol_value::may_be_discarded_from_output_symtab): New
6536 function.
6537 (Symbol_value::has_output_symtab_entry): New function.
6538 (Symbol_value::needs_output_symtab_entry): Remove.
6539 (Symbol_value::output_symtab_index): Make sure the symbol index is
6540 set.
6541 (Symbol_value::set_output_symtab_index): Make sure the symbol
6542 index is not set. Make sure the new index is valid.
6543 (Symbol_value::set_must_have_output_symtab_entry): New function.
6544 (Symbol_value::has_output_dynsym_entry): New function.
6545 (Symbol_value::set_output_dynsym_index): Make sure the new index
6546 is valid.
6547 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6548 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6549 local symbol if permitted.
6550 (Sized_relobj::do_finalize_local_symbols): Call
6551 is_output_symtab_index_set rather than needs_output_symtab_entry.
6552 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6553 rather than needs_output_symtab_entry. Call
6554 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6555 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6556 is_output_symtab_index_set rather than needs_output_symtab_entry.
6557 * testsuite/discard_locals_relocatable_test.c: New file.
6558 * testsuite/discard_locals_test.sh: Test -r.
6559 * testsuite/Makefile.am (check_DATA): Add
6560 discard_locals_relocatable_test1.syms,
6561 discard_local_relocatable_test2.syms.
6562 (MOSTLYCLEANFILES): Likewise. Also add
6563 discard_locals_relocatable_test1.lout and
6564 discard_locals_relocatable_test2.out.
6565 (discard_locals_relocatable_test1.syms): New target.
6566 (discard_locals_relocatable_test.o): New target.
6567 (discard_locals_relocatable_test1.out): New target.
6568 (discard_locals_relocatable_test2.syms): New target.
6569 (discard_locals_relocatable_test2.out): New target.
6570 (various): Add missing ../ld-new dependencies.
6571 * testsuite/Makefile.in: Rebuild.
6572
6573 2010-03-03 Nick Clifton <nickc@redhat.com>
6574
6575 * po/fi.po: New Finnish translation.
6576
6577 2010-03-01 Doug Kwan <dougkwan@google.com>
6578
6579 * layout.cc (Layout::Layout): Force section types of .init_array*,
6580 .preinit_array* and .fini_array* sections.
6581 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6582 Fix check of return value of std::string::find.().
6583 (Output_section::Input_section_sort_compare::operator()): Remove
6584 comment about .init_array.
6585 (Output_section::Input_section_sort_init_fini_compare::operator()):
6586 New method.
6587 (Output_section::sort_attached_input_sections): Handle .init_array
6588 and .fini_array specially.
6589 * output.h (Output_section::Inut_section_sort_compare): Update
6590 comment.
6591 (Output_section::Input_section_sort_init_fini_compare): New struct.
6592
6593 2010-02-26 Doug Kwan <dougkwan@google.com>
6594
6595 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6596 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6597 * testsuite/debug_msg.sh: Avoid matching source line number for
6598 use of global variable undef_int.
6599
6600 2010-02-26 Doug Kwan <dougkwan@google.com>
6601
6602 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6603 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6604 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6605 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6606 * options.cc (General_options::General_options): Initialize member
6607 fix_v4bx_.
6608 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6609 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6610 and rm_no_fix_v4bx.stdout
6611 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6612 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6613 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6614 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6615 and arm_no_fix_v4bx.
6616 * Makefile.in: Regenerate.
6617 * testsuite/arm_fix_v4bx.s: New file.
6618 * testsuite/arm_fix_v4bx.sh: Ditto.
6619
6620 2010-02-24 Doug Kwan <dougkwan@google.com>
6621
6622 * arm.cc (Target_arm::got_section): Make the .got section the first
6623 non RELRO section in the data segment.
6624 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6625 suffixes of section names.
6626
6627 2010-02-24 Doug Kwan <dougkwan@google.com>
6628
6629 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6630 flags and attributes merging if an input file is a binary file.
6631 * fileread.cc (Input_file::open): Record format of original file.
6632 * fileread.h (Input_file::Format): New enum type.
6633 (Input_file::Input_file): Initialize data member format_.
6634 (Input_file::format): New method definition.
6635 (Input_file::format_):: New data member.
6636
6637 2010-02-24 Doug Kwan <dougkwan@google.com>
6638
6639 * arm.cc (Arm_output_data_got): New class.
6640 (ARM_TCB_SIZE): New constant
6641 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6642 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6643 If user uses a script with a SECTIONS clause, issue only a warning
6644 for a misplaced EXIDX input section. Otherwise, issue an error.
6645 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6646 garbage collection.
6647 (Target_arm::got_mode_index_entry): Handle static linking.
6648 (Target_arm::Scan::local): Ditto.
6649 (Target_arm::Scan::global): Ditto.
6650 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6651 all incorrectly implemented relocations.
6652 (Target_arm::fix_exidx_coverage): Pass layout to
6653 Arm_output_section::fix_exidx_coverage.
6654 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6655 from ".ARM.exidx." and ".ARM.extab.".
6656
6657 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6658
6659 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6660 section if it does not already exist.
6661 * attributes.cc (Attributes_section_data::Attributes_section_data):
6662 Don't crash if size is zero.
6663
6664 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6665 Ian Lance Taylor <iant@google.com>
6666
6667 * gold.cc (queue_middle_tasks): If no input files were opened,
6668 exit.
6669 * workqueue.h (Task_function::Task_function): Assert that there is
6670 a blocker.
6671
6672 2010-02-22 Doug Kwan <dougkwan@google.com>
6673
6674 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6675 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6676 types to avoid warnings due to different uint64_t implementations
6677 on different hosts.
6678
6679 2010-02-21 Doug Kwan <dougkwan@google.com>
6680
6681 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6682 handling of the maximum backward branch offset.
6683 (Arm_relocate_functions::thumb_branch_common): Ditto.
6684 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6685 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6686 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6687 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6688 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6689 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6690 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6691 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6692 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6693 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6694 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6695 thumb2_bl_out_of_range.o): New rules.
6696 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6697 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6698 thumb2_bl_out_of_range
6699 * testsuite/Makefile.in: Regenerate.
6700 * testsuite/arm_bl_in_range.s: New file.
6701 * testsuite/arm_bl_out_of_range.s: Ditto.
6702 * testsuite/arm_branch_in_range.sh: Ditto.
6703 * testsuite/arm_branch_range.t: Ditto.
6704 * testsuite/thumb2_branch_range.t: Ditto.
6705 * testsuite/thumb_bl_in_range.s: Ditto.
6706 * testsuite/thumb_bl_out_of_range.s: Ditto.
6707 * testsuite/thumb_branch_range.t: Ditto.
6708
6709 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6710
6711 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6712 Add reloc offset information.
6713 * icf.cc (get_section_contents): Change iterators to point to the new
6714 vectors. Add reloc offset information to the contents.
6715 * icf.h (Icf::Sections_reachable_info): New typedef.
6716 (Icf::Sections_reachable_list): New typedef.
6717 (Icf::Offset_info): New typedef.
6718 (Icf::Reloc_info): New struct typedef.
6719 (Icf::Reloc_info_list): New typedef.
6720 (Icf::symbol_reloc_list): Delete method.
6721 (Icf::addend_reloc_list): Delete method.
6722 (Icf::section_reloc_list): Delete method.
6723 (Icf::reloc_info_list): New method.
6724 (Icf::reloc_info_list_): New member.
6725
6726 2010-02-19 Doug Kwan <dougkwan@google.com>
6727
6728 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6729 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6730 * arm.cc (Arm_relocation_functions): New forward declaration.
6731 (Target_arm::Target_arm): Initialize new data members
6732 got_mod_index_offset_ and tls_base_symbol_defined_.
6733 (Target_arm::Relocate::relocate_tls): New method.
6734 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6735 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6736 New methods.
6737 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6738 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6739 (Target_arm::got_mod_index_offset_,
6740 Target_arm::tls_base_symbol_defined_): New data members.
6741 (Target_arm::Scan::local, Target::Scan::global,
6742 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6743 relocations.
6744
6745 2010-02-18 Doug Kwan <dougkwan@google.com>
6746
6747 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6748 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6749 text section as a parameter becuase some broken tools may not set
6750 the link in section header.
6751 (Target_arm::has_got_section): New method.
6752 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6753 without any mapping symbol as data only. Remove warning.
6754 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6755 link in its section header, try to discover the link by inspecting the
6756 REL31 relocation at the beginning of the section.
6757 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6758 in error message.
6759 (Target_arm::Scan::global): Treat any reference to the symbol
6760 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6761
6762 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6763
6764 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6765 (Scan::global_reloc_may_be_function_pointer): New function.
6766 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6767 (Scan::global_reloc_may_be_function_pointer): New function.
6768 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6769 (Scan::global_reloc_may_be_function_pointer): New function.
6770 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6771 (Scan::global_reloc_may_be_function_pointer): New function.
6772 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6773 (Scan::global_reloc_may_be_function_pointer): New function.
6774 (Scan::possible_function_pointer_reloc): New function.
6775 (Target_x86_64::can_check_for_function_pointers): New function.
6776 * gc.h (gc_process_relocs): Scan relocation types to determine if
6777 function pointers were taken for targets that support it.
6778 * icf.cc (Icf::find_identical_sections): Include functions for
6779 folding in safe ICF whose pointer is not taken.
6780 * icf.h (Secn_fptr_taken_set): New typedef.
6781 (fptr_section_id_): New member.
6782 (section_has_function_pointers): New function.
6783 (set_section_has_function_pointers): New function.
6784 (check_section_for_function_pointers): New function.
6785 * options.h: Fix comment for safe ICF option.
6786 * target.h (can_check_for_function_pointers): New function.
6787 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6788 Modify icf_safe_test for X86-64.
6789 * testsuite/Makefile.in: Regenerate.
6790 * testsuite/icf_safe_so_test.cc: New file.
6791 * testsuite/icf_safe_so_test.sh: New file.
6792 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6793 (main): Change to take pointer to function kept_func_3.
6794 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6795 folding is done correctly for X86-64.
6796
6797 2010-02-12 David S. Miller <davem@davemloft.net>
6798
6799 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6800 is_symbolless parameter.
6801 (Output_reloc<SHT_REL>::is_symbolless): New.
6802 (Output_reloc<SHT_REL>::is_symbolless_): New.
6803 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6804 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6805 (Output_reloc<SHT_RELA>::is_symbolless): New.
6806 (Output_data_reloc::add_global): Handle is_symbolless.
6807 (Output_data_reloc::add_global_relative): Likewise.
6808 (Output_data_reloc::add_local): Likewise.
6809 (Output_data_reloc::add_local_relative): Likewise.
6810 (Output_data_reloc::add_symbolless_global_addend): New.
6811 (Output_data_reloc::add_symbolless_local_addend): New.
6812 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6813 is_symbolless.
6814 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6815 instead of ->is_relative_
6816 (Output_reloc::write): Likewise.
6817 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6818 (Output_reloc::write_rel): Simplify.
6819
6820 * sparc.cc (Target_sparc::Scan::local): Use
6821 ->add_symbolless_local_addend as needed.
6822 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6823 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6824 based upon relocation offset.
6825
6826 2010-02-11 Doug Kwan <dougkwan@google.com>
6827
6828 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6829 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6830 beginning of function.
6831 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6832 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6833 parameter is_32bit in calls to should_apply_static_reloc.
6834 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6835 (check_DATA): Add arm_abs_global.stdout.
6836 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6837 arm_abs_global.stdout): New rules.
6838 (MOSTLLYCLEANFILES): Add arm_abs_global
6839 * Makefile.in: Regenerate.
6840 * testsuite/arm_abs_global.s: New file.
6841 * testsuite/arm_abs_global.sh: Ditto.
6842 * testsuite/arm_abs_lib.s: Ditto.
6843
6844 2010-02-11 Ian Lance Taylor <iant@google.com>
6845
6846 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6847 Read_relocs task.
6848 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6849 Allocate_commons_task first.
6850 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6851 task, rather than symtab_lock_.
6852 (Gc_process_relocs::~Gc_process_relocs): New function.
6853 (Gc_process_relocs::is_runnable): Check this_blocker_.
6854 (Gc_process_relocs::locks): Use next_blocker_ rather than
6855 blocker_.
6856 (Scan_relocs::~Scan_relocs): New function.
6857 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6858 symtab_lock_.
6859 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6860 next_blocker_.
6861 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6862 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6863 constructor accordingly.
6864 (class Gc_process_relocs): Likewise.
6865 (class Scan_relocs): Likewise.
6866 * common.h (class Allocate_commons_task): Remove symtab_lock_
6867 field, and corresponding constructor parameter.
6868 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6869 symtab_lock_.
6870 (Allocate_commons_task::locks): Likewise.
6871
6872 2010-02-11 Ian Lance Taylor <iant@google.com>
6873
6874 * gold-threads.h (class Once): Define.
6875 (class Initialize_lock): Rewrite as child of Once.
6876 * gold-threads.cc (class Once_initialize): Define.
6877 (once_pointer_control): New static variable.
6878 (once_pointer, once_arg): New static variables.
6879 (c_run_once): New static function.
6880 (Once::Once, Once::run_once, Once::internal_run): New functions.
6881 (class Initialize_lock_once): Remove.
6882 (initialize_lock_control): Remove.
6883 (initialize_lock_pointer): Remove.
6884 (initialize_lock_once): Remove.
6885 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6886 (Initialize_lock::initialize): Rewrite.
6887 (Initialize_lock::do_run_once): New function.
6888 * archive.cc (Archive::interpret_header): Only clear name if it is
6889 not already empty.
6890 * fileread.cc: Include "gold-threads.h"
6891 (file_counts_lock): New static variable.
6892 (file_counts_initialize_lock): Likewise.
6893 (File_read::release): Only increment counts when using --stats.
6894 Use a lock around the increment.
6895 * parameters.cc (class Set_parameters_target_once): Define.
6896 (set_parameters_target_once): New static variable.
6897 (Parameters::Parameters): Move here from parameters.h.
6898 (Parameters::set_target): Rewrite.
6899 (Parameters::set_target_once): New function.
6900 (Parameters::clear_target): Move here and rewrite.
6901 * parameters.h (class Parameters): Update declarations. Add
6902 set_parameters_target_once_ field.
6903 (Parameters::Parameters): Move to parameters.cc.
6904 (Parameters::clear_target): Likewise.
6905 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6906 task.
6907 (Start_group::~Start_group): New function.
6908 (Start_group::is_runnable): New function.
6909 (Start_group::locks, Start_group::run): New functions.
6910 (Finish_group::run): Change saw_undefined to size_t.
6911 * readsyms.h (class Start_group): Define.
6912 (class Finish_group): Change saw_undefined_ field to size_t.
6913 (Finish_group::Finish_group): Remove saw_undefined and
6914 this_blocker parameters. Change all callers.
6915 (Finish_group::set_saw_undefined): New function.
6916 (Finish_group::set_blocker): New function.
6917 * symtab.h (class Symbol_table): Change saw_undefined to return
6918 size_t. Change saw_undefined_ field to size_t.
6919 * target-select.cc (Set_target_once::do_run_once): New function.
6920 (Target_selector::Target_selector): Initialize set_target_once_
6921 field. Don't initialize lock_ and initialize_lock_ fields.
6922 (Target_selector::instantiate_target): Rewrite.
6923 (Target_selector::set_target): New function.
6924 * target-select.h (class Set_target_once): Define.
6925 (class Target_selector): Update declarations. Make
6926 Set_target_once a friend. Remove lock_ and initialize_lock_
6927 fields. Add set_target_once_ field.
6928
6929 2010-02-10 Ian Lance Taylor <iant@google.com>
6930
6931 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6932 queueing any tasks.
6933 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6934 (queue_middle_tasks): Add all blockers before queueing any tasks.
6935 (queue_final_tasks): Likewise.
6936 * token.h (Task_token::add_blockers): New function.
6937 * object.h (Input_objects::number_of_relobjs): New function.
6938
6939 2010-02-10 Ian Lance Taylor <iant@google.com>
6940
6941 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6942 shared, not if not position independent.
6943 * x86_64.cc (Relocate::relocate_tls): Likewise.
6944 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6945 (tls_pie_pic_test): New target.
6946 * testsuite/Makefile.in: Rebuild.
6947
6948 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6949 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6950 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6951 * testsuite/Makefile.in: Rebuild.
6952
6953 2010-02-09 David S. Miller <davem@davemloft.net>
6954
6955 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6956 R_SPARC_RELATIVE using ->add_local_relative().
6957 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6958
6959 * output.h (Output_data_dynamic::add_section_size): New method
6960 that takes two Output_data objects.
6961 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6962 entry param. Handle it in initializers.
6963 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6964 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6965 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6966 arg.
6967 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6968 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6969 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6970 for dynrel_includes_plt.
6971 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6972 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6973 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6974 before .rela.plt
6975 (Target_sparc::do_finalize_sections): Update to pass true for
6976 dynrel_includes_plt.
6977 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6978 output before .rela.plt
6979 (Target_powerpc::do_finalize_sections): Update to pass true for
6980 dynrel_includes_plt when 32-bit.
6981
6982 2010-02-08 Doug Kwan <dougkwan@google.com>
6983
6984 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6985 method.
6986 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6987 Arm_relobj::scan_section_for_cortex_a8_stubs,
6988 Arm_relobj::do_relocation_section): Instead of calling
6989 Output_section::output_address, use faster
6990 Arm_relobj::simple_input_section_output_address.
6991
6992 2010-02-08 David S. Miller <davem@davemloft.net>
6993
6994 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6995 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6996 relocation helper function.
6997
6998 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6999 just like R_SPARC_GOT{10,13,22}.
7000 (Target_sparc::Scan::local): Likewise.
7001 (Target_sparc::Relocate:relocate): Likewise.
7002
7003 2010-02-06 Ian Lance Taylor <iant@google.com>
7004
7005 * configure.ac: Rewrite targetobjs duplicate removal code to use
7006 only shell constructs.
7007 * configure: Rebuild.
7008
7009 2010-02-05 Doug Kwan <dougkwan@google.com>
7010
7011 PR 11247
7012 * arm.cc (Arm_relobj::section_is_scannable): New method.
7013 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7014 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7015
7016 2010-02-04 Doug Kwan <dougkwan@google.com>
7017
7018 PR 11247
7019 * arm-reloc-property.cc (cstdio): Include.
7020 * configure.ac (targetobjs): Remove duplicates.
7021 * configure: Regenerate.
7022 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7023 big and little endian version for a given address size.
7024
7025 2010-02-03 Doug Kwan <dougkwan@google.com>
7026
7027 * arm-reloc-property.cc
7028 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7029 definition.
7030 * arm-reloc-property.h
7031 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7032 New method definition.
7033 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7034 declaration.
7035 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7036 overflow to N.
7037 (GOT_PREL): Change implemented to Y.
7038 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7039 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7040 (Arm_relocate_functions::movw_abs_nc): Remove method.
7041 (Arm_relocate_functions::movt_abs): Ditto.
7042 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7043 (Arm_relocate_functions::thm_movt_abs): Ditto.
7044 (Arm_relocate_functions::movw_rel_nc): Ditto.
7045 (Arm_relocate_functions::movw_rel): Ditto.
7046 (Arm_relocate_functions::movt_rel): Ditto.
7047 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7048 (Arm_relocate_functions:thm_movw_rel): Ditto.
7049 (Arm_relocate_functions:thm_movt_rel): Ditto.
7050 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7051 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7052 New method definitions.
7053 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7054 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7055 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7056 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7057 (Target_arm::Relocate::relocate): Check for non-static or
7058 unimplemented relocation code and exit early. Change calls to
7059 Target_arm::reloc_uses_thumb_bit and
7060 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7061 instead. Refactor code to handle similar relocations to increase
7062 code sharing. Remove check for unsupported relocation code in switch
7063 statement.
7064 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7065 relocation property table to find out size. Change error message to
7066 print out the name of a relocation code instead of the numeric value.
7067 (Target_arm::scan_reloc_for_stub): Use relocation property table
7068 instead of calling Target_arm::reloc_uses_thumb_bit().
7069
7070 2010-02-02 Doug Kwan <dougkwan@google.com>
7071
7072 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7073 types of relaxed input section.
7074
7075 2010-02-02 Doug Kwan <dougkwan@google.com>
7076
7077 * Makefile.am (HFILES): Add arm-reloc-property.h.
7078 (DEFFILES): New.
7079 (TARGETSOURCES): Add arm-reloc-property.cc
7080 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7081 (libgold_a_SOURCES): $(DEFFILES)
7082 * Makefile.in: Regenerate.
7083 * arm-reloc-property.cc: New file.
7084 * arm-reloc-property.h: New file.
7085 * arm-reloc.def: New file.
7086 * arm.cc: Update comments.
7087 (arm-reloc-property.h): New included header.
7088 (arm_reloc_property_table): New global variable.
7089 (Target_arm::do_select_as_default_target): New method definition.
7090 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7091 arm-reloc-property to targ_extra_obj.
7092 * parameters.cc (set_parameters_target): Call
7093 Target::select_as_default_target().
7094 * target.h (Target::select_as_default_target): New method definition.
7095 (Target::do_select_as_default_target): Same.
7096
7097 2010-02-01 Doug Kwan <dougkwan@google.com>
7098
7099 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7100 first_output_text_section_.
7101 (Arm_exidx_fixup::first_output_text_section): New method definition.
7102 (Arm_exidx_fixup::first_output_text_section_): New data member.
7103 (Arm_exidx_fixup::process_exidx_section): Record the first text
7104 output section seen.
7105 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7106 and entsize in output section header.
7107
7108 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7109
7110 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7111 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7112 (Arm_relocate_functions::thm_alu11): New Method.
7113 (Arm_relocate_functions::thm_pc8): New Method.
7114 (Arm_relocate_functions::thm_pc12): New Method.
7115 (Target_arm::Scan::local): Handle the relocations.
7116 (Target_arm::Scan::global): Likewise.
7117 (Target_arm::Relocate::relocate): Likewise.
7118 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7119
7120 2010-01-29 Doug Kwan <dougkwan@google.com>
7121
7122 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7123 of relocation types as ld.
7124
7125 2010-01-29 Doug Kwan <dougkwan@google.com>
7126
7127 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7128 to public.
7129 (Arm_relocate_functions::thumb_branch_common): Ditto.
7130 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7131 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7132 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7133 Arm_relocate_functions::jump24): Remove.
7134 (Target_arm::Relocate::relocate): Adjust code to call
7135 Arm_relocation_functions::arm_branch_common and
7136 Arm_relocation_functions::thumb_branch_common instead of their removed
7137 wrappers. Merge switch-cases together to reduce source code size.
7138
7139 2010-01-29 Doug Kwan <dougkwan@google.com>
7140
7141 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7142 output_local_symbol_count_needs_update_.
7143 (Arm_relobj::output_local_symbol_count_needs_update,
7144 Arm_relobj::set_output_local_symbol_count_needs_update,
7145 Arm_relobj::update_output_local_symbol_count): New methods.
7146 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7147 member.
7148 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7149 of pointed function as in a R_ARM_PREL31 relocation.
7150 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7151 for output local symbol count updating.
7152 (Target_arm::do_relax): Update output local symbol counts in objects
7153 if necessary.
7154 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7155
7156 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7157
7158 * arm.cc: Added support for the ARM relocations:
7159 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7160 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7161 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7162 movw_prel_nc).
7163 (Arm_relocate_functions::movw_rel): New method.
7164 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7165 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7166 thm_movw_prel_nc).
7167 (Arm_relocate_functions::thm_movw_rel): New method.
7168 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7169 thm_movt_prel).
7170 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7171 relocations.
7172 (Target_arm::Scan::global): Likewise.
7173 (Target_arm::Relocate::relocate): Likewise.
7174 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7175 Likewise.
7176
7177 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7178
7179 * arm.cc: Added support for ARM group relocations.
7180 (Target_arm::reloc_needs_sym_origin): New method.
7181 (Arm_relocate_functions::calc_grp_kn): New method.
7182 (Arm_relocate_functions::calc_grp_residual): New method.
7183 (Arm_relocate_functions::calc_grp_gn): New method.
7184 (Arm_relocate_functions::arm_grp_alu): New Method.
7185 (Arm_relocate_functions::arm_grp_ldr): New Method.
7186 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7187 (Arm_relocate_functions::arm_grp_ldc): New Method.
7188 (Target_arm::Scan::local): Handle the ARM group relocations.
7189 (Target_arm::Scan::global): Likewise.
7190 (Target_arm::Relocate::relocate): Likewise.
7191 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7192 Likewise.
7193
7194 2010-01-26 Doug Kwan <dougkwan@google.com>
7195
7196 * arm.cc (set): Include.
7197 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7198 pointer type.
7199 (Arm_output_section::Text_section_list): New type.
7200 (Arm_output_section::append_text_sections_to_list): New method.
7201 (Arm_output_section::fix_exidx_coverage): Ditto.
7202 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7203 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7204 Relobj::set_section_offset() instead of
7205 Sized_relobj::invalidate_section_offset().
7206 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7207 parameter for section headers. Ignore relocation sections for
7208 unallocated sections and EXIDX sections.
7209 (Target_arm::fix_exidx_coverage): New method.
7210 (Target_arm::output_section_address_less_than): New type.
7211 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7212 linked text section instead of the EXIDX section.
7213 (Arm_output_section::create_stub_group): Add an assertion to check
7214 that this is not an EXIDX output section.
7215 (Arm_output_section::append_text_sections_to_list): New method.
7216 (Arm_output_section::fix_exidx_coverage): Ditto.
7217 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7218 Arm_relobj::section_needs_reloc_stub_scanning.
7219 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7220 first pass.
7221 (Target_arm::fix_exidx_coverage): New method.
7222 * object.h (Relobj::set_output_section): New method.
7223 (Sized_relobj::invalidate_section_offset): Remove method.
7224 (Sized_relobj::do_invalidate_section_offset): Remove method.
7225 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7226
7227 2010-01-25 Doug Kwan <dougkwan@google.com>
7228
7229 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7230 Fix warning due to signed and unsigned comparison on a 32-bit host.
7231
7232 2010-01-22 Doug Kwan <dougkwan@google.com>
7233
7234 * arm.cc (Target_arm::do_relax): Record an output section for section
7235 offset adjustment it contains any stub table that has changed.
7236 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7237 offsets in an output section if necessary.
7238 * output.cc (Output_section::Output_section): Initialize
7239 section_offsets_need_adjustments_.
7240 (Output_section::add_input_section_for_script): Renamed to
7241 Output_section::add_simple_input_section.
7242 (Output_section::save_states): Add a comment.
7243 (Output_section::discard_states): New method defintion.
7244 (Output_section::adjust_section_offsets): Same.
7245 * output.h (Output_section::add_input_section_for_script): Renamed to
7246 Output_section::add_simple_input_section.
7247 (Output_section::discard_states): New method declaration.
7248 (Output_section::adjust_section_offsets): Same.
7249 (Output_section::section_offsets_need_adjustment,
7250 Output_section::set_section_offsets_need_adjustment): New method
7251 definitions.
7252 (Output_section::section_offsets_need_adjustment_): New data member.
7253 * script-sections.cc
7254 (Output_section_element_input::set_section_address): Adjust code for
7255 renaming of Output_section::add_input_section_for_script.
7256 (Orphan_output_section::set_section_address): Same.
7257
7258 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7259
7260 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7261 Fix_v4bx enum values .
7262 * gold/options.h (General_options): New option definitions.
7263 (General_options::fix_v4bx): New method.
7264 (General_options::Fix_v4bx): New enum.
7265 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7266 (General_options::parse_fix_v4bx_interworking): New method.
7267
7268 2010-01-22 Doug Kwan <dougkwan@google.com>
7269
7270 * arm.cc (Arm_exidx_fixup): New class.
7271
7272 2010-01-21 Doug Kwan <dougkwan@google.com>
7273
7274 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7275 classes.
7276 (Arm_exidx_section_offset_map): New type.
7277
7278 2010-01-21 Doug Kwan <dougkwan@google.com>
7279
7280 * arm.cc (Arm_exidx_input_section): New class.
7281 (Arm_relobj::exidx_input_section_by_link,
7282 Arm_relobj::exidx_input_section_by_shndx,
7283 Arm_relobj::make_exidx_input_section): New methods.
7284 (read_arm_attributes_section): Remove.
7285 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7286 information about them.
7287 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7288 to here.
7289
7290 2010-01-20 Doug Kwan <dougkwan@google.com>
7291
7292 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7293 Input_section_specifier to Section_id.
7294 (Target_arm::new_arm_input_section: Adjust code for change of key
7295 type.
7296 (Target_arm::find_arm_input_section): Ditto.
7297 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7298 (Section_id): Remove.
7299 (Garbage_collection::Section_id_hash): Remove.
7300 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7301 (Section_id): Remove.
7302 (Icf::Section_id_hash): Remove.
7303 * object.h (Section_id, Const_section_id, Section_id_hash,
7304 Const_section_id_hash): New type definitions.
7305 * output.cc (Output_section::add_relaxed_input_section): Change to
7306 use Const_section_id instead of Input_section_specifier as key type.
7307 (Output_section::add_merge_input_section): Ditto.
7308 (Output_section::build_relaxation_map): Change to use Section_id
7309 instead of Input_section_specifier as key type.
7310 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7311 Ditto.
7312 (Output_section::convert_input_sections_to_relaxed_sections): Change
7313 to use Const_section_id instead of Input_section_specifier as key type.
7314 (Output_section::find_merge_section): Ditto.
7315 (Output_section::find_relaxed_input_section): Ditto.
7316 * output.h (Input_section_specifier): Remove class.
7317 (Output_section::Output_section_data_by_input_section_map): Change
7318 key type to Const_section_id.
7319 (Output_section::Output_relaxed_input_section_by_input_section_map):
7320 Ditto.
7321 (Output_section::Relaxation_map): Change key type to Section_id.
7322
7323 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7324
7325 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7326 (class Arm_v4bx_stub): New class.
7327 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7328 (Stub_factory::make_arm_v4bx_stub): New method.
7329 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7330 (Stub_table::empty): Handle v4bx stubs.
7331 (Stub_table::add_arm_v4bx_stub): New method.
7332 (Stub_table::find_arm_v4bx_stub): New method.
7333 (Arm_relocate_functions::v4bx): New method.
7334 (Target_arm::fix_v4bx): New method.
7335 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7336 (Stub_table::relocate_stubs): Likewise.
7337 (Stub_table::do_write): Likewise.
7338 (Stub_table::update_data_size_and_addralign): Likewise.
7339 (Stub_table::finalize_stubs): Likewise.
7340 (Target_arm::Scan::local): Likewise.
7341 (Target_arm::Scan::global): Likewise.
7342 (Target_arm::do_finalize_sections): Likewise.
7343 (Target_arm::Relocate::relocate): Likewise.
7344 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7345 Likewise.
7346 (Target_arm::scan_reloc_for_stub): Likewise.
7347 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7348
7349 2010-01-19 Ian Lance Taylor <iant@google.com>
7350
7351 * output.cc (Output_section_headers::do_sized_write): Write large
7352 segment count to sh_info field.
7353 (Output_file_header::do_sized_write): For large segment count,
7354 write PN_XNUM to e_phnum field.
7355
7356 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7357
7358 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7359 (Arm_relocate_functions::thm_jump8): New function.
7360 (Arm_relocate_functions::thm_jump11): New function.
7361 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7362 R_ARM_THM_JUMP11.
7363 (Target_arm::Scan::global): Likewise.
7364 (Target_arm::Relocate::relocate): Likewise.
7365 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7366 Likewise.
7367
7368 2010-01-14 Doug Kwan <dougkwan@google.com>
7369
7370 * arm.cc (map, utility): Include headers.
7371 (Target_arm::apply_cortex_a8_workaround): New method.
7372 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7373 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7374 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7375 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7376 the --[no-]fix-cortex-a8 command line options.
7377 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7378 (Target_arm::relocate_stub): Use addend in instruction template.
7379 * options.h (DEFINE_bool): Set the user-set flag.
7380 (General_options): Add --[no-]-fix-cortex options.
7381 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7382 : Update fast look-up map after conversion.
7383
7384 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7385
7386 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7387 in the first pass of do_layout.
7388
7389 2010-01-13 Doug Kwan <dougkwan@google.com>
7390
7391 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7392 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7393 apparent compiler problem of not folding static constant integral
7394 data members of elfcpp::Elf_sizes<32>.
7395
7396 2010-01-13 Doug Kwan <dougkwan@google.com>
7397
7398 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7399 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7400 Arm_relobj::scan_section_for_cortex_a8_erratum,
7401 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7402 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7403 sections to scan for relocation stubs into a new method
7404 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7405 relocation and Cortex-A8 stub scanning.
7406 (Target_arm::do_relax): Force stubs to be after stubbed sections
7407 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7408 the beginning of a new relaxation pass. Update a comment.
7409 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7410
7411 2010-01-12 Ian Lance Taylor <iant@google.com>
7412
7413 * target-reloc.h (visibility_error): New inline function.
7414 (relocate_section): Call visibility_error.
7415 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7416 (MOSTLYCLEANFILES): Likewise.
7417 (protected_4_pic.o, protected_3.err): New targets.
7418 * testsuite/protected_4.cc: New file.
7419
7420 2010-01-12 Doug Kwan <dougkwan@google.com>
7421
7422 * arm.cc (Cortex_a8_reloc): New class.
7423 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7424 and cortex_a8_relocs_info_.
7425 (Target_arm::fix_cortex_a8): New method definition.
7426 (Target_arm::Cortex_a8_relocs_info): New type.
7427 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7428 New data member declarations.
7429 (Target_arm::scan_reloc_for_stub): Record information about
7430 relocations for THUMB branches that might be exempted from the
7431 Cortex-A8 workaround.
7432 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7433 at the beginning of a relaxation pass.
7434
7435 2010-01-12 Doug Kwan <dougkwan@google.com>
7436
7437 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7438 (Arm_relobj::Mapping_symbol_position,
7439 Arm_reloj::Mapping_symbol_position_less,
7440 Arm_relobj::Mapping_symbols_info): New types.
7441 (Target_arm::is_mapping_symbol_name): New method definition.
7442 (Arm_relobj::do_count_local_symbols): Save information about mapping
7443 symbols.
7444
7445 2010-01-11 Doug Kwan <dougkwan@google.com>
7446
7447 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7448 Arm_relocate_functions::thumb32_branch_upper,
7449 Arm_relocate_functions::thumb32_branch_lower,
7450 Arm_relocate_functions::thumb32_cond_branch_offset,
7451 Arm_relocate_functions::thumb32_cond_branch_upper,
7452 Arm_relocate_functions::thumb32_cond_branch_lower,
7453 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7454 branch offset encoding.
7455 (Arm_relocate_functions::thumb_branch_common): Use new branch
7456 offset encoding methods to avoid code duplication.
7457 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7458 (Stub_addend_reader::operator()): Use new branch encoding method
7459 to avoid code duplication.
7460
7461 2010-01-11 Doug Kwan <dougkwan@google.com>
7462
7463 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7464 (Target_arm::do_finalize_sections): Define special EXIDX section
7465 symbols only if referenced.
7466 * gc.h (Garbage_collection::add_reference): New method.
7467 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7468 code duplication.
7469
7470 2010-01-11 Ian Lance Taylor <iant@google.com>
7471
7472 * script.cc (Version_script_info::build_expression_list_lookup):
7473 Change complaing about duplicate wildcard match from error to
7474 warning.
7475
7476 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7477 of 2009-12-30.
7478 (Version_script_info::Version_script_info): Initialize globs_,
7479 default_version_, default_is_global_, and exact_. Don't
7480 initialize globals_ or locals_.
7481 (Version_script_info::build_lookup_tables): Build local symbols
7482 first.
7483 (Version_script_info::unquote): New function.
7484 (Version_script_info::add_exact_match): New function.
7485 (Version_script_info::build_expression_list_lookup): Remove lookup
7486 parameter. Add is_global parameter. Change all callers. Handle
7487 wildcard pattern specially. Unquote pattern. Call
7488 add_exact_match.
7489 (Version_script_info::get_name_to_match): New function.
7490 (Version_script_info::get_symbol_version): New function.
7491 (Version_script_info::get_symbol_version_helper): Remove.
7492 (Version_script_info::check_unmatched_names): Call unquote.
7493 * script.h (class Version_script_info): Change get_symbol_version
7494 to be non-inline and add is_global parameter; change all callers.
7495 Rewrite symbol_is_local. Update declarations. Define struct
7496 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7497 Remove globals_ and locals_ members. Add exact_, globs_,
7498 default_version_, is_global_.
7499 (Version_script_info::Glob): Remove pattern, add expression and
7500 is_global. Update constructor. Change all callers.
7501 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7502 default version.
7503 (Versions::symbol_section_contents): If a symbol is undefined, or
7504 defined in a dynamic object, set the version index to
7505 VER_NDX_LOCAL.
7506 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7507 symbol_is_local.
7508 (Symbol_table::add_from_pluginobj): Likewise.
7509 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7510
7511 2010-01-11 Doug Kwan <dougkwan@google.com>
7512
7513 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7514 (incremental_dump_LDADD): Add linking option for libintl.
7515 * Makefile.in: Regenerate.
7516
7517 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7518
7519 PR gold/11144
7520 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7521 instead of -Ds.
7522 * testsuite/Makefile.in: Regenerated.
7523
7524 2010-01-10 Doug Kwan <dougkwan@google.com>
7525
7526 * options.h (DEFINE_var): Use parentheses around argument varname__
7527 in macro body to avoid any unintended subsequent substitutions.
7528
7529 2010-01-10 Ian Lance Taylor <iant@google.com>
7530
7531 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7532 candidates before doing symbol resolution.
7533
7534 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7535 ODR candidates if only one is weak.
7536
7537 2010-01-08 Ian Lance Taylor <iant@google.com>
7538
7539 * script.cc (Version_script_info::build_expression_list_lookup):
7540 Don't warn about ambiguous version, just record the ambiguity.
7541 (Version_script_info::get_symbol_version_helper): Give error if
7542 version is ambiguous.
7543
7544 2010-01-08 Doug Kwan <dougkwan@google.com>
7545
7546 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7547 prev_data_size_ and prev_addralign_. Remove initializer for
7548 deleted data member has_been_changed_.
7549 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7550 to determine if the table is empty.
7551 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7552 Remove.
7553 (Stub_table::add_reloc_stub): Define method in class definition
7554 instead of just declaring it there.
7555 (Stub_table::add_cortex_a8_stub): New method definition.
7556 (Stub_table::update_data_size_and_addralign): Ditto.
7557 (Stub_table::finalize_stubs): Ditto.
7558 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7559 (Stub_table::do_addralign_): Return address alignment in the
7560 (Stub_table::do_reset_address_and_file_offset): Define method in
7561 class definition instead of declaring it there. Set current data
7562 size to be the data size of the previous pass.
7563 (Stub_table::set_final_data_size): Use current data size as the
7564 final data size.
7565 (Stub_table::relocate_stub): Change parameter type of stub from
7566 Reloc_stub pointer to Stub pointer.
7567 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7568 (Stub_table::Cortex_a8_stub_list): New typedef.
7569 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7570 Stub_table::prev_addralign_): New data member.
7571 (Arm_relobj::Arm_relobj): Initialize data member
7572 section_has_cortex_a8_workaround_.
7573 (Arm_relobj::section_has_cortex_a8_workaround,
7574 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7575 definitions.
7576 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7577 declarations.
7578 (Target_arm::relocate_stub): Change parameter type of stub from
7579 Reloc_stub pointer to Stub pointer.
7580 (Insn_template::size, Insn_template::alignment): Handle
7581 THUMB16_SPECIAL_TYPE.
7582 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7583 Stub_table::update_data_size_and_addralign,
7584 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7585 definitions.
7586 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7587 (Stub_table::do_write): Ditto.
7588 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7589
7590 2010-01-08 Ian Lance Taylor <iant@google.com>
7591
7592 PR 11108
7593 * symtab.h (class Symbol): Remove fields is_target_special_ and
7594 has_plt_offset_. Add field is_defined_in_discarded_section_.
7595 (Symbol::is_defined_in_discarded_section): New function.
7596 (Symbol::set_is_defined_in_discarded_section): New function.
7597 (Symbol::has_plt_offset): Rewrite.
7598 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7599 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7600 Don't initialize is_target_special_ or has_plt_offset_.
7601 Initialize is_defined_in_discarded_section_.
7602 (Symbol_table::add_from_relobj): If appropriate, set
7603 is_defined_in_discarded_section.
7604 * resolve.cc (Symbol::override_base_with_special): Don't test
7605 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7606 * target-reloc.h (relocate_section): Do special handling for
7607 symbols defined in discarded sections for global symbols as well
7608 as local symbols.
7609
7610 2010-01-08 Ian Lance Taylor <iant@google.com>
7611
7612 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7613 the SHT_SYMTAB case.
7614
7615 2010-01-08 Ian Lance Taylor <iant@google.com>
7616
7617 * object.cc (Sized_relobj::do_layout): Don't get confused if
7618 layout_eh_frame returns NULL.
7619
7620 2010-01-08 Ian Lance Taylor <iant@google.com>
7621
7622 PR 11084
7623 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7624 dynamic symbol table, use the normal symbol table.
7625 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7626 symbol table.
7627
7628 2010-01-08 Ian Lance Taylor <iant@google.com>
7629
7630 PR 11072
7631 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7632 sections.
7633
7634 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7635
7636 * version.cc (print_version): Change to "Copyright 2010".
7637
7638 2010-01-08 Ian Lance Taylor <iant@google.com>
7639
7640 PR 10287
7641 PR 11063
7642 * i386.cc (class Target_i386): Change return type of plt_section
7643 to be non-const.
7644 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7645 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7646 tls_desc_rel_ field.
7647 (Output_data_plt_i386::rel_tls_desc): New function.
7648 (Target_i386::rel_tls_desc_section): New function.
7649 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7650 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7651 R_386_TLS_DESC reloc in rel_tls_desc_section.
7652 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7653 Define struct Tlsdesc_info.
7654 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7655 (Target_x86_64::do_reloc_symbol_index): New function.
7656 (Target_x86_64::add_tlsdesc_info): New function.
7657 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7658 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7659 tlsdesc_rel_ field.
7660 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7661 all callers.
7662 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7663 (Target_x86_64::rela_tlsdesc_section): New function.
7664 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7665 handling.
7666 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7667 (Target_x86_64::do_reloc_addend): New function.
7668 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7669 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7670 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7671 (Output_reloc::type): New function.
7672 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7673 (Output_reloc::is_target_specific): New function.
7674 (Output_reloc::target_arg): New function.
7675 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7676 absolute relocs and target specific relocs.
7677 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7678 add_target_specific.
7679 (class Output_data_reloc) [SHT_RELA]: Likewise.
7680 * output.cc (Output_reloc::Output_reloc): Add four new versions
7681 for absolute relocs and target specific relocs.
7682 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7683 (Output_reloc::get_symbol_index): Likewise.
7684 (Output_reloc::local_section_offset): Check that local_sym_index_
7685 is not TARGET_CODE or 0.
7686 (Output_reloc::symbol_value): Likewise.
7687 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7688 reloc.
7689 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7690 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7691 functions.
7692 * layout.cc (add_target_dynamic_tags): Use output section for
7693 DT_PLTRELSZ and DT_JMPREL.
7694
7695 2010-01-07 Ian Lance Taylor <iant@google.com>
7696
7697 PR 11061
7698 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7699 function.
7700 (class Output_data_reloc_generic): Define.
7701 (class Output_data_reloc_base): Change base class to
7702 Output_data_reloc_generic. Change add() method to call
7703 bump_relative_reloc_count for a relative reloc. Remove
7704 sort_relocs_ field.
7705 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7706 to sort_relocs().
7707 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7708 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7709 appropriate.
7710 * layout.h (class Layout): Update declaration.
7711
7712 2010-01-07 Ian Lance Taylor <iant@google.com>
7713
7714 * output.h (class Output_data): Add const version of
7715 output_section and do_output_section.
7716 (class Output_section_data): Add const version of
7717 do_output_section.
7718 (class Output_section): Likewise.
7719 * layout.cc (Layout::add_target_dynamic_tags): New function.
7720 * layout.h (class Layout): Update declarations.
7721 * arm.cc (Target_arm::do_finalize_sections): Use
7722 add_target_dynamic_tags.
7723 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7724 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7725 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7726 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7727
7728 2010-01-07 Ian Lance Taylor <iant@google.com>
7729
7730 PR 11042
7731 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7732 object as needed.
7733
7734 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7735 Ian Lance Taylor <iant@google.com>
7736
7737 PR 11019
7738 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7739 Xindex::read_symtab_xindex.
7740
7741 2010-01-07 Doug Kwan <dougkwan@google.com>
7742
7743 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7744 (Insn_template::thumb16_bcond_insn): New method declaration.
7745 (Insn_template): Fix spelling.
7746 (Stub::thumb16_special): New method declaration.
7747 (Stub::do_write): Define virtual method which was previously pure
7748 virtual.
7749 (Stub::do_thumb16_special): New method declaration.
7750 (Stub::do_fixed_endian_write): New template member.
7751 (Reloc_stub::do_write): Remove.
7752 (Reloc_stub::do_fixed_endian_write): Remove.
7753 (Cortex_a8_stub): New class definition.
7754 (Stub_factory::make_cortex_a8_stub): New method definition.
7755 (Stub_factory::Stub_factory): Add missing static storage class
7756 qualifier for elf32_arm_stub_a8_veneer_blx.
7757
7758 2010-01-07 Ian Lance Taylor <iant@google.com>
7759
7760 PR 10980
7761 * options.h (class General_options): Add --warn-unresolved-symbols
7762 and --error-unresolved-symbols.
7763 * errors.cc (Errors::undefined_symbol): Implement
7764 --warn-unresolved-symbols.
7765
7766 * options.h (class General_options): Add -z text and -z textoff.
7767 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7768
7769 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7770
7771 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7772 (Garbage_collection::cident_sections): New function.
7773 (Garbage_collection::add_cident_section): New function.
7774 (Garbage_collection::cident_sections_): New member.
7775 (gc_process_relocs): Add references to sections whose names are C
7776 identifiers.
7777 * gold.h (cident_section_start_prefix): New constant.
7778 (cident_section_stop_prefix): New constant.
7779 (is_cident): New function.
7780 * layout.cc (Layout::define_section_symbols): Replace string constants
7781 with the newly defined constants.
7782 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7783 C identifiers.
7784 * testsuite/Makefile.am: Add gc_orphan_section_test.
7785 * testsuite/Makefile.in: Regenerate.
7786 * testsuite/gc_orphan_section_test.cc: New file.
7787 * testsuite/gc_orphan_section_test.sh: New file.
7788
7789 2010-01-06 Ian Lance Taylor <iant@google.com>
7790
7791 PR 10980
7792 * options.h (class General_options): Add --warn-shared-textrel.
7793 * layout.cc (Layout::finish_dynamic_section): Implement
7794 --warn-shared-textrel.
7795
7796 PR 10980
7797 * options.h (class General_options): Add --warn-multiple-gp.
7798
7799 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7800
7801 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7802 $(THREADSLIB) and $(LIBDL).
7803 * Makefile.in: Rebuild.
7804
7805 2010-01-06 Ian Lance Taylor <iant@google.com>
7806
7807 PR 10980
7808 * options.cc (General_options::parse_section_start): New function.
7809 (General_options::section_start): New function.
7810 (General_options::General_options): Initialize all members.
7811 * options.h: Include <map>
7812 (class General_options): Add --section-start. Add section_starts_
7813 member.
7814 * layout.cc (Layout::attach_allocated_section_to_segment): If
7815 --section-start was used, set the address of the segment. Remove
7816 local sort_sections.
7817 (Layout::relaxation_loop_body): If the address of the load segment
7818 has been set by --section-start, don't use it.
7819 * output.h (Output_segment::update_flags_for_output_section): New
7820 function.
7821 * output.cc (Output_segment::add_output_section): Call
7822 update_flags_for_output_section.
7823
7824 2010-01-05 Ian Lance Taylor <iant@google.com>
7825
7826 PR 10980
7827 * options.h (class General_options): Add --undefined-version.
7828 * script.cc (struct Version_expression): Add was_matched_by_symbol
7829 field.
7830 (Version_script_info::matched_symbol): New function.
7831 (Version_script_info::get_symbol_version_helper): Call
7832 matched_symbol.
7833 (Version_script_info::check_unmatched_names): New function.
7834 * script.h (class Version_script_info): Update declarations.
7835 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7836
7837 * options.h (class General_options): Use DEFINE_bool_alias for
7838 allow_multiple_definition.
7839 * resolve.cc (Symbol_table::should_override): Don't test
7840 allow_multiple_definition.
7841
7842 PR 10980
7843 * options.h (class General_options): Add --cref.
7844 * main.cc (main): Print cref table if --cref. Don't close mapfile
7845 until after printing cref table.
7846 * cref.cc: Include "symtab.h".
7847 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7848 (Cref_table_compare::operator()): New function.
7849 (Cref_inputs::gather_cref): New function.
7850 (filecol): New static const.
7851 (Cref_inputs::print_cref): New function.
7852 (Cref::print_cref): New function.
7853 * cref.h: Include <cstdio>.
7854 (class Cref): Update declarations.
7855 * mapfile.h (Mapfile::file): New function.
7856 * object.h (class Object): Define Symbols. Declare virtual
7857 do_get_global_symbols.
7858 (Object::get_global_symbols): New function.
7859 * object.cc (Input_objects::add_object): Pass object to cref_ if
7860 --cref.
7861 (Input_objects::archive_start): Likewise.
7862 (Input_objects::archive_stop): Likewise.
7863 (Input_objects::print_cref): New function.
7864 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7865 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7866 --cref.
7867 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7868 function.
7869 * plugin.h (class Sized_pluginobj): Update declarations.
7870
7871 2010-01-05 Ian Lance Taylor <iant@google.com>
7872
7873 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7874 to is_default_version. Rename insdef to insdefault.
7875 (Symbol_table::add_from_relobj): Rename def to is_default_version
7876 and local to is_forced_local.
7877 (Symbol_table::add_from_pluginobj): Likewise.
7878 (Symbol_table::add_from_dynobj): Likewise.
7879 (Symbol_table::define_special_symbol): Rename insdef to
7880 insdefault.
7881
7882 2010-01-04 Ian Lance Taylor <iant@google.com>
7883
7884 PR 10980
7885 * options.h (class General_options): Add
7886 --allow-multiple-definition and -z muldefs.
7887 * resolve.cc (Symbol_table::should_override): Don't warn about a
7888 multiple symbol definition if --allow-multiple-definition or -z
7889 muldefs.
7890
7891 PR 10980
7892 * options.h (class General_options): Add --add-needed and
7893 --copy-dt-needed-entries. Tweak --as-needed help entry.
7894 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7895 error if --copy-dt-needed-entries aka --add-needed is used and
7896 would cause a change in behaviour.
7897
7898 PR 10980
7899 * options.h (class General_options): Add -G as a short version of
7900 --shared. Add no-op options -assert, -g, and -i.
7901
7902 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7903
7904 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7905 check for .text or .gnu.linkonce.t sections.
7906 * icf.cc (Icf::find_identical_sections): Ditto.
7907 Change the detection for mangled function name within the section
7908 name.
7909 * icf.h (is_section_foldable_candidate): New function.
7910
7911 2009-12-30 Ian Lance Taylor <iant@google.com>
7912
7913 PR 10980
7914 * options.h (class General_options): Permit two dashes with
7915 --retain-symbols-file.
7916
7917 2009-12-30 Ian Lance Taylor <iant@google.com>
7918
7919 PR 10979
7920 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7921 don't put the file header and segment headers in the text
7922 segment.
7923
7924 PR 10979
7925 * common.cc (Sort_commons::operator()): Stabilize sort when both
7926 entries are NULL.
7927 (Symbol_table::do_allocate_commons_list): When allocating common
7928 symbols, skip a symbol which is no longer common.
7929 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7930 an object before checking its type.
7931 * testsuite/common_test_2.c: New file.
7932 * testsuite/common_test_3.c: New file.
7933 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7934 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7935 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7936 (common_test_2_pic.o, common_test_2.so): New targets.
7937 (common_test_3_pic.o, common_test_3.so): New targets.
7938 * testsuite/Makefile.in: Rebuild.
7939
7940 PR 10979
7941 * script.cc (read_input_script): If we see a new SECTIONS clause,
7942 and we have added an input section, give an error.
7943 * layout.h (class Layout): Add have_added_input_section function.
7944 Add have_added_input_section_ field.
7945 * layout.cc (Layout::Layout): Initialize
7946 have_added_input_section_.
7947 (Layout::layout): Set have_added_input_section_.
7948 (Layout::layout_eh_frame): Likewise.
7949
7950 2009-12-30 Ian Lance Taylor <iant@google.com>
7951
7952 PR 10931
7953 * options.h (class General_options): Add --sort-common option.
7954 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7955 * common.cc (Sort_common): Add sort_order parameter to
7956 constructor. Add sort_order_ field.
7957 (Sort_commons::operator): Check sort_order_.
7958 (Symbol_table::allocate_commons): Determine the sort order.
7959 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7960 Change all callers.
7961 (Symbol_table::do_allocate_commons_list): Likewise.
7962
7963 2009-12-30 Ian Lance Taylor <iant@google.com>
7964
7965 PR 10916
7966 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7967 symbols from this object, don't change the visibility of an
7968 undefined symbol.
7969 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7970
7971 2009-12-30 Ian Lance Taylor <iant@google.com>
7972
7973 PR 10861
7974 * script.h (class Version_script_info): Define Language enum.
7975 Update declarations. Define Glob, Exact, and Lookup types. Add
7976 new fields globals_, locals_, and is_finalized_.
7977 * script.cc: Various formatting fixes.
7978 (class Parser_closure): Change language_stack_ from a vector of
7979 std::string to one of Version_script_info::Language. Adjust all
7980 uses accordingly.
7981 (class Lazy_demangler): Remove.
7982 (struct Version_expression): Change language from std::string to
7983 Version_script_info::Language.
7984 (Version_script_info::Version_script_info): New function.
7985 (Version_script_info::~Version_script_info): Don't call clear.
7986 (Version_script_info::finalize): New function.
7987 (Version_script_info::build_lookup_tables): New function.
7988 (Version_script_info::build_expression_list_lookup): New
7989 function.
7990 (Version_script_info::get_symbol_version_helper): Rewrite to use
7991 lookup tables.
7992 (Version_script_info::print_expression_list): Adjust to use
7993 Version_script_info::Language.
7994 (script_push_lex_into_version_mode): Check that the version script
7995 has not been finalized.
7996 (version_script_push_lang): Change language string to
7997 Version_script_info::Language.
7998 * options.cc (Command_line::version_script): New function.
7999 * options.h (class General_options): Add finalize_dynamic_list
8000 function. Change version_script from declaration to definition.
8001 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8002 * testsuite/version_script.map: Remove duplicate def of foo.
8003 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8004 version_script.map.
8005 * testsuite/Makefile.in: Rebuild.
8006
8007 2009-12-30 Ian Lance Taylor <iant@google.com>
8008
8009 PR 10843
8010 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8011 if the input symbol index is 0, make the output symbol index 0.
8012
8013 2009-12-30 Ian Lance Taylor <iant@google.com>
8014
8015 PR 10670
8016 * options.h (class General_options): Add -x/--discard-all.
8017 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8018 --discard-all. If the local symbol needs a dynamic entry, check
8019 that before handling --discard-locals.
8020
8021 2009-12-30 Ian Lance Taylor <iant@google.com>
8022
8023 PR 10450
8024 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8025 flags to PF_R.
8026 (Output_segment::add_output_section): Don't change the flags if
8027 the type is PT_TLS.
8028
8029 PR 10450
8030 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8031 GNU hash table if they need a dynamic value. Otherwise, don't add
8032 them if they are defined in a dynamic object or are forced local.
8033
8034 2009-12-29 Ian Lance Taylor <iant@google.com>
8035
8036 PR 10450
8037 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8038 .gnu.hash table for a 32-bit target.
8039
8040 PR 10450
8041 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8042 regular and a dynamic object only needs a dynamic symbol table
8043 entry if it is externally visible.
8044
8045 PR 10450
8046 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8047 constructor. Add global_offset_table_ field.
8048 (Target_i386::got_section): Set global_offset_table_.
8049 (Target_i386::do_finalize_sections): Set global_offset_table_
8050 size.
8051 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8052 in constructor. Add global_offset_table_ field.
8053 (Target_x86_64::got_section): Set global_offset_table_.
8054 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8055 size.
8056
8057 * layout.cc (Layout::Layout): Initialize increase_relro_.
8058 (Layout::get_output_section): Add is_relro, is_last_relro, and
8059 is_first_non_relro parameters. Change all callers.
8060 (Layout::choose_output_section): Likewise.
8061 (Layout::add_output_section_data): Likewise.
8062 (Layout::make_output_section): Likewise.
8063 (Layout::set_segment_offsets): Clear increase_relro when using a
8064 linker script.
8065 * layout.h (class Layout): Add increase_relro method. Add
8066 increase_relro_ field. Update declarations.
8067 * output.cc (Output_section::Output_section): Initialize
8068 is_last_relro_ and is_first_non_relro_.
8069 (Output_segment::add_output_section): Group relro sections is
8070 do_sort is true. Handle is_last_relro and is_first_non_relro.
8071 (Output_segment::maximum_alignment): Remove relro handling.
8072 (Output_segment::set_section_addresses): Add increase_relro
8073 parameter. Change all callers. Add initial alignment to align
8074 relro sections on separate page. Remove old relro handling.
8075 (Output_segment::set_section_list_addresses): Remove in_relro
8076 parameter. Change all callers.
8077 (Output_segment::set_offset): Add increase parameter. Change all
8078 callers. Remove old relro handling.
8079 * output.h (class Output_section): Add new methods: is_last_relro,
8080 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8081 Add is_last_relro_ and is_first_non_relro_ fields.
8082 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8083 Create separate .got.plt section. Call increase_relro.
8084 * x86_64.cc (Target_x86_64::got_section): Likewise.
8085 * testsuite/relro_script_test.t: Add .got.plt.
8086
8087 PR 10450
8088 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8089 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8090 (Layout::finalize): Call set_dynamic_symbol_size.
8091 (Layout::set_dynamic_symbol_size): New function.
8092 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8093 set_dynamic_symbol_size.
8094
8095 PR 10450
8096 * output.h (class Output_section): Add is_entsize_zero_ field.
8097 * output.cc (Output_section::Output_section): Initialize
8098 is_entsize_zero_.
8099 (Output_section::set_entsize): If two different entsizes are
8100 requested, force it to zero.
8101 (Output_section::add_input_section): Set flags for .debug_str
8102 before updating section flags. Set entsize.
8103 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8104 and SHF_STRING if all input sections have those flags.
8105
8106 2009-12-29 Rafael Espindola <espindola@google.com>
8107
8108 * main.cc (main): Fix the sys time reporting.
8109 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8110 reporting.
8111
8112 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8113
8114 * options.cc (General_options::parse_version): Allow -v to exit
8115 without an error if there is nothing to link.
8116
8117 2009-12-29 Ian Lance Taylor <iant@google.com>
8118
8119 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8120 using a version of gcc before 4.1.
8121 * configure: Rebuild.
8122
8123 2009-12-28 Chris Demetriou <cgd@google.com>
8124
8125 * attributes.cc (Output_attributes_section_data::do_write): Use
8126 std::vector::front rather than std::vector::data.
8127
8128 2009-12-28 Ian Lance Taylor <iant@google.com>
8129
8130 * symtab.h (class Symbol_table): Add enum Defined.
8131 * resolve.cc (Symbol_table::should_override): Add defined
8132 parameter. Change all callers. Test whether object is NULL
8133 before calling a method on it.
8134 (Symbol_table::report_resolve_problem): Add defined parameter.
8135 Change all callers.
8136 (Symbol_table::should_override_with_special): Likewise.
8137 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8138 parameter. Change all callers.
8139 (Symbol_table::do_define_in_output_data): Likewise.
8140 (Symbol_table::define_in_output_segment): Likewise.
8141 (Symbol_table::do_define_in_output_segment): Likewise.
8142 (Symbol_table::define_as_constant): Likewise.
8143 (Symbol_table::do_define_as_constant): Likewise.
8144 * script.h (class Symbol_assignment): Add is_defsym parameter to
8145 constructor; change all callers.
8146 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8147 parameter. Change all callers. Add is_defsym_ field.
8148 (class Parser_closure): Add parsing_defsym parameter to
8149 constructor; change all callers. Add parsing_defsym accessor
8150 function. Add parsing_defsym_ field.
8151
8152 2009-12-28 Ian Lance Taylor <iant@google.com>
8153
8154 * gold.cc (queue_middle_tasks): Fix formatting.
8155 * object.cc (Relobj::is_section_name_included): Likewise.
8156
8157 2009-12-23 Ian Lance Taylor <iant@google.com>
8158
8159 * i386.cc (Target_i386::do_calls_non_split): Recognize
8160 -fsplit-stack prologue for a function with a static chain.
8161 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8162 -fsplit-stack prologue when using %r11.
8163
8164 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8165
8166 * options.cc (General_options::parse_version): Make -v continue and do
8167 the link like GNU ld does.
8168
8169 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8170
8171 * Makefile.am (CCFILES): Add timer.cc.
8172 (HFILES): Add timer.h.
8173 * configure.ac: Check for sysconf and times.
8174 * main.cc: include timer.h.
8175 (main): Use Timer instead of get_run_time.
8176 * timer.cc: New.
8177 * timer.h: New.
8178 * workqueue.cc: include timer.h.
8179 (Workqueue::find_and_run_task):
8180 Report user, sys and wall time.
8181 * Makefile.in: Regenerate.
8182 * config.in: Regenerate.
8183 * configure: Regenerate.
8184
8185 2009-12-16 Doug Kwan <dougkwan@google.com>
8186
8187 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8188 sections.
8189 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8190 relaxed input sections.
8191 * output.cc (Output_section::find_relaxed_input_section): Change
8192 return type to Output_relaxed_input_section pointer. Adjust code
8193 for new type of relaxed_input_section_map_.
8194 * output.h (Output_section::find_relaxed_input_section): Change
8195 return type to Output_relaxed_input_section pointer.
8196 (Output_section::Output_relaxed_input_section_by_input_section_map):
8197 New type.
8198 (Output_section::relaxed_input_section_map_): Change type to
8199 Output_section::Output_relaxed_input_section_by_input_section_map.
8200 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8201 input section.
8202
8203 2009-12-15 Ian Lance Taylor <iant@google.com>
8204
8205 * layout.cc (Layout::create_shstrtab): Only write out after input
8206 sections if we are compressing debug sections.
8207
8208 2009-12-15 Ian Lance Taylor <iant@google.com>
8209
8210 * archive.cc (Archive::add_symbols): Only look up a symbol without
8211 a version if there is, in fact, a version.
8212
8213 2009-12-14 Ian Lance Taylor <iant@google.com>
8214
8215 Revert -Wshadow changes, all changes from:
8216 2009-12-11 Doug Kwan <dougkwan@google.com>
8217 2009-12-11 Nick Clifton <nickc@redhat.com>
8218 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8219
8220 2009-12-11 Doug Kwan <dougkwan@google.com>
8221
8222 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8223 due to -Wshadow.
8224 * attributes.cc (Object_attribute::size): Ditto.
8225 (Attributes_section_data::size): Ditto.
8226 (Attributes_section_data::Attributes_section_data): Ditto.
8227 (Output_attributes_section_data::do_write): Ditto.
8228 * attributes.h (Object_attribute::set_type): Ditto.
8229 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8230
8231 2009-12-11 Nick Clifton <nickc@redhat.com>
8232
8233 * archive.cc: Fix shadowed variable warnings.
8234 * arm.cc: Likewise.
8235 * compressed_output.cc: Likewise.
8236 * compressed_output.h: Likewise.
8237 * configure: Likewise.
8238 * dwarf_reader.cc: Likewise.
8239 * dynobj.cc: Likewise.
8240 * dynobj.h: Likewise.
8241 * ehframe.cc: Likewise.
8242 * ehframe.h: Likewise.
8243 * errors.cc: Likewise.
8244 * expression.cc: Likewise.
8245 * fileread.cc: Likewise.
8246 * fileread.h: Likewise.
8247 * freebsd.h: Likewise.
8248 * i386.cc: Likewise.
8249 * icf.cc: Likewise.
8250 * incremental.h: Likewise.
8251 * layout.cc: Likewise.
8252 * layout.h: Likewise.
8253 * mapfile.cc: Likewise.
8254 * merge.cc: Likewise.
8255 * merge.h: Likewise.
8256 * object.cc: Likewise.
8257 * object.h: Likewise.
8258 * options.h: Likewise.
8259 * output.cc: Likewise.
8260 * output.h: Likewise.
8261 * parameters.cc: Likewise.
8262 * plugin.cc: Likewise.
8263 * powerpc.cc: Likewise.
8264 * reduced_debug_output.cc: Likewise.
8265 * reduced_debug_output.h: Likewise.
8266 * reloc.cc: Likewise.
8267 * reloc.h: Likewise.
8268 * resolve.cc: Likewise.
8269 * script-sections.cc: Likewise.
8270 * script.cc: Likewise.
8271 * script.h: Likewise.
8272 * sparc.cc: Likewise.
8273 * symtab.cc: Likewise.
8274 * symtab.h: Likewise.
8275 * target-select.cc: Likewise.
8276 * target-select.h: Likewise.
8277 * token.h: Likewise.
8278 * workqueue.cc: Likewise.
8279 * workqueue.h: Likewise.
8280 * x86_64.cc: Likewise.
8281
8282 2009-12-10 Doug Kwan <dougkwan@google.com>
8283
8284 * arm.cc (attributes.h): New include.
8285 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8286 (Arm_relobj::~Arm_relobj): Delete object pointed by
8287 attributes_section_data_.
8288 (Arm_relobj::attributes_section_data): New method definition.
8289 (Arm_relobj::attributes_section_data_): New data member declaration.
8290 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8291 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8292 attributes_section_data_.
8293 (Arm_dynobj::attributes_section_data): New method definition.
8294 (Arm_dynobj::attributes_section_data_): New data member declaration.
8295 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8296 initialization value of may_use_blx_ to false.
8297 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8298 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8299 object attributes to compute results instead of hard-coding.
8300 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8301 Target_arm::get_secondary_compatible_arch,
8302 Target_arm::set_secondary_compatible_arch
8303 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8304 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8305 New method declarations.
8306 (Target_arm::get_aeabi_object_attribute): New method definition.
8307 (Target_arm::attributes_section_data_): New data member declaration.
8308 (read_arm_attributes_section): New template definition.
8309 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8310 (Arm_dynobj::do_read_symbols): Ditto.
8311 (Target_arm::do_finalize_sections): Merge attributes sections from
8312 input. Check for BLX use after attributes section merging.
8313 Fix __exidx_start and __exidx_end visibility. Create an
8314 .ARM.attributes section if necessary.
8315 (Target_arm::get_secondary_compatible_arch,
8316 Target_arm::set_secondary_compatible_arch,
8317 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8318 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8319 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8320 New method definitions.
8321
8322 2009-12-09 Ian Lance Taylor <iant@google.com>
8323
8324 * plugin.cc (Plugin::load): Don't cast from void* to a function
8325 pointer.
8326
8327 2009-12-09 Ian Lance Taylor <iant@google.com>
8328
8329 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8330 information fields.
8331
8332 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8333
8334 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8335 Replace two_file_shared_1.so with two_file_shared_2.so.
8336 * testsuite/Makefile.in: Regenerated.
8337
8338 2009-12-08 Doug Kwan <dougkwan@google.com>
8339
8340 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8341 (HFILES): Add attributes.h and int_encoding.h.
8342 * Makefile.in: Regenerate.
8343 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8344 function definitions to int_encoding.cc
8345 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8346 prototypes to int_encoding.h
8347 * reduced_debug_output.cc (int_encoding.h): New include.
8348 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8349 function definitions to int_encoding.cc
8350 (insert_into_vector, read_from_pointer): Move template definitions to
8351 int_encoding.h
8352 * attributes.cc: New file.
8353 * attributes.h: New file.
8354 * int_encoding.cc: New file.
8355 * int_encoding.h: New file.
8356
8357 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8358
8359 PR gold/11055
8360 * incremental-dump.cc (dump_incremental_inputs): New.
8361 (main): Use dump_incremental_inputs.
8362
8363 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8364
8365 PR gold/10893
8366 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8367 checking elfcpp::STT_FUNC.
8368 (Target_i386::Relocate::relocate): Likewise.
8369 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8370
8371 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8372 symbols from shared libraries into normal FUNC symbols.
8373
8374 * symtab.h (Symbol): Add is_func and use it.
8375
8376 2009-12-05 Doug Kwan <dougkwan@google.com>
8377
8378 * arm.cc (Target_arm::arm_info): Initialize new fields
8379 attributes_section and attributes_vendor.
8380 * i386.cc (Target_i386::i386_info): Same.
8381 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8382 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8383 fields attributes_section and attributes_vendor.
8384 * sparc.cc (Target_sparc::sparc_info): Same.
8385 * target.h (Target::attributes_section, Target::attributes_vendor,
8386 Target::is_attributes_section, Target::attribute_arg_type,
8387 Target::attributes_order): New method definitions.
8388 (Target::Target_info::attributes_section,
8389 Target::Target_info::attributes_vendor): New fields.
8390 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8391 virtual method definitions.
8392 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8393 attributes_section and attributes_vendor.
8394 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8395
8396 2009-12-05 Doug Kwan <dougkwan@google.com>
8397
8398 * arm.cc: Update comments about interworking and stub generation.
8399 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8400 considered as non-PIC.
8401 (Arm_relocate_functions::base_abs): Fix formatting.
8402 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8403 of function to use GOT entry address instead of offset.
8404 (Target_arm::Scan::global): Issue an error if a symbol would need a
8405 PLT does not get one because it is untyped. Remove code to create
8406 dynamic symbols for relative branches.
8407 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8408 takes unsigned integer instead of boolean.
8409
8410 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8411
8412 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8413 (two_file_test_LDADD): Likewise.
8414 (common_test_1_LDADD): Likewise.
8415 (exception_test_LDADD) Likewise.
8416 (weak_test_LDADD): Likewise.
8417 (many_sections_test_LDADD): Likewise.
8418 (initpri1_LDADD): Likewise.
8419 (script_test_1_LDADD): Likewise.
8420 (script_test_2_LDADD): Likewise.
8421 (justsyms_LDADD): Likewise.
8422 (binary_test_LDADD): Likewise.
8423 (large_LDADD): Likewise.
8424 * testsuite/Makefile.in: Regenerated.
8425
8426 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8427
8428 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8429 (Symbol_table::override_with_special): Likewise.
8430 (Symbol_table::add_from_object): Likewise.
8431
8432 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8433
8434 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8435 Don't set the data_offset twice.
8436
8437 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8438
8439 * testsuite/Makefile.in: Regenerate.
8440
8441 2009-12-03 Doug Kwan <dougkwan@google.com>
8442
8443 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8444 (Target_arm::do_finalize_sections): Add parameter for symbol table
8445 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8446 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8447 parameter for symbol table pointer.
8448 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8449 an additional parameter for a pointer to symbol table.
8450 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8451 parameter for a symbol table pointer.
8452 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8453 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8454 Ditto.
8455 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8456 parameter for a symbol table pointer.
8457
8458 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8459
8460 * incremental.cc (Incremental_inputs_header)
8461 (Incremental_inputs_header_write, Incremental_inputs_entry)
8462 (Incremental_inputs_entry_write): Move ...
8463 * incremental.h (Incremental_inputs_header)
8464 (Incremental_inputs_header_write, Incremental_inputs_entry)
8465 (Incremental_inputs_entry_write): here.
8466
8467 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8468
8469 * incremental.cc (make_sized_incremental_binary): Set the target.
8470 Error if it is incompatible.
8471 * output.h (Output_file): Add filename method.
8472
8473 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8474
8475 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8476 from the get_* methods.
8477
8478 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8479
8480 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8481 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8482 Write 0 for the data_offset of scripts.
8483
8484 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8485
8486 * testsuite/Makefile.am: Add the incremental_test.sh test.
8487 * testsuite/incremental_test.sh: New.
8488 * testsuite/incremental_test_1.c: New.
8489 * testsuite/incremental_test_2.c: New.
8490
8491 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8492
8493 * incremental-dump.cc (main): Fix typos.
8494
8495 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8496
8497 PR gold/11025
8498 * incremental-dump.cc (main): Use llu to print 64 bit values.
8499
8500 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8501 H.J. Lu <hongjiu.lu@intel.com>
8502
8503 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8504 $(LIBDL).
8505 (incremental_dump_LDADD): Likewise.
8506 * Makefile.in: Regenerated.
8507
8508 2009-11-25 Doug Kwan <dougkwan@google.com>
8509
8510 Revert:
8511
8512 2009-11-25 Doug Kwan <dougkwan@google.com>
8513
8514 * arm.cc (Target_arm::Target_arm): Move method definition
8515 outside of class definition. Add code to handle
8516 --target1-rel, --target1-abs and --target2= options.
8517 (Target_arm::get_reloc_reloc_type): Change method to be
8518 non-static and const.
8519 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8520 New data member declaration.
8521 (Target_arm::Scan::local, Target_arm::Scan::global,
8522 Target_arm::Relocate::relocate,
8523 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8524 Adjust call to Target_arm::get_real_reloc_type.
8525 (Target_arm::get_real_reloc_type): Use command line options
8526 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8527 * options.h (--target1-rel, --target1-abs, --target2): New
8528 ARM-only options.
8529
8530 2009-11-25 Doug Kwan <dougkwan@google.com>
8531
8532 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8533 class definition. Add code to handle --target1-rel, --target1-abs
8534 and --target2= options.
8535 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8536 and const.
8537 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8538 member declaration.
8539 (Target_arm::Scan::local, Target_arm::Scan::global,
8540 Target_arm::Relocate::relocate,
8541 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8542 call to Target_arm::get_real_reloc_type.
8543 (Target_arm::get_real_reloc_type): Use command line options to
8544 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8545 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8546 options.
8547
8548 2009-11-25 Doug Kwan <dougkwan@google.com>
8549
8550 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8551 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8552 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8553 formatting.
8554 (Arm_relocate_functions::thm_call): Replace body with a call to
8555 Arm_relocate_functions::thumb_branch_common.
8556 (Arm_relocate_functions::thm_jump24,
8557 Arm_relocate_functions::thm_xpc22): New method definitions.
8558 (Arm_relocate_functions::thumb_branch_common): New method definition.
8559 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8560 operator.
8561 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8562 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8563
8564 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8565
8566 * Makefile.am: Build incremental-dump
8567 * Makefile.in: Regenerate.
8568 * incremental-dump.cc: New.
8569 * incremental.cc (Incremental_inputs_header_data,
8570 Incremental_inputs_entry_data): Move to incremental.h
8571 * incremental.h: (Incremental_inputs_header_data,
8572 Incremental_inputs_entry_data): Move from incremental.cc
8573
8574 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8575
8576 * incremental.cc (Incremental_inputs_header,
8577 Incremental_inputs_header_write, Incremental_inputs_entry,
8578 Incremental_inputs_entry_write): Add a typedef with the data type.
8579
8580 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8581
8582 * incremental.cc (Incremental_inputs_header,
8583 Incremental_inputs_header_write, Incremental_inputs_entry,
8584 Incremental_inputs_entry_write): Update comment about which
8585 type has the filed descriptions.
8586
8587 2009-11-15 Doug Kwan <dougkwan@google.com>
8588
8589 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8590 (Arm_relocate_functions::arm_branch_common): Change method defintion
8591 in class definition to a method declaration and update list of formal
8592 parameters.
8593 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8594 Arm_relocation_functions::jump24): Adjust call to
8595 Arm_relocate_functions::arm_branch_common. Update list of formal
8596 parameters.
8597 (Arm_relocate_functions::xpc25): New method definition.
8598 (Arm_relocate_functions::arm_branch_common): Move method defintion
8599 out from class definition. Use stubs for mode-switching and extending
8600 branch ranges.
8601 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8602 specially. Change code to enable use of stubs in ARM branches.
8603
8604 2009-11-10 Doug Kwan <dougkwan@google.com>
8605
8606 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8607 in method declaration.
8608 (Target_arm::relocate_stub): New method declaration.
8609 (Target_arm::default_target): Change to return a pointer instead of
8610 a const reference.
8611 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8612 Target_arm::default_target.
8613 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8614 method definition.
8615 (Target_arm::relocate_section): Adjust view.
8616 (Target_arm::relocate_stub): New method definition.
8617
8618 2009-11-10 Doug Kwan <dougkwan@google.com>
8619
8620 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8621 a format warning.
8622 * incremental.cc (open_incremental_binary): Initialized local
8623 variables to avoid warnings.
8624 * object.cc (make_elf_object): Ditto.
8625 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8626 a format warning.
8627
8628 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8629
8630 PR gold/10930
8631 * testsuite/plugin_test.c: Include "config.h".
8632
8633 2009-11-09 Doug Kwan <dougkwan@google.com>
8634
8635 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8636 (arm_symbol_value): Remove.
8637 (Arm_relocate_functions::arm_branch_common,
8638 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8639 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8640 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8641 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8642 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8643 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8644 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8645 Arm_relocate_functions::thm_mobw_abs_nc,
8646 Arm_relocate_functions::thm_mov_abs,
8647 Arm_relocate_functions::movw_prel_nc,
8648 Arm_relocate_functions::thm_movt_abs,
8649 Arm_relocate_functions::movt_prel,
8650 Arm_relocate_functions::thm_movw_prel_nc,
8651 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8652 (Target_arm::Relocate::relocate): Only decompose address into two
8653 parts if relocation type uses the thumb-bit and pass the actual
8654 bit instead of a flag indicating that the thumb-bit is used. Adjust
8655 calls to methods in Arm_relocate_functions for this change.
8656
8657 2009-11-08 Ian Lance Taylor <iant@google.com>
8658
8659 PR 10925
8660 * reloc.cc: Instantiate
8661 Sized_relobj::initialize_input_to_output_maps and
8662 Sized_relobj:free_input_to_output_maps.
8663
8664 2009-11-06 Ian Lance Taylor <iant@google.com>
8665
8666 PR 10876
8667 * defstd.cc (in_segment): Set only_if_ref true for "end".
8668
8669 2009-11-06 Doug Kwan <dougkwan@google.com>
8670
8671 * arm.cc (class Reloc_stub): Correct a comment.
8672 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8673 (Target_arm::scan_section_for_stubs): New method declaration.
8674 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8675 Change methods from private to protected.
8676 (Target_arm::do_may_relax): New method definition.
8677 (Target_arm::do_relax, Target_arm::group_sections,
8678 Target_arm::scan_reloc_for_stub,
8679 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8680 (Target_arm::arm_input_section_map_): New data member declaration.
8681 (Target_arm::scan_reloc_for_stub,
8682 Target_arm::scan_reloc_section_for_stubs,
8683 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8684 Target_arm::do_relax): New method definitions.
8685
8686 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8687
8688 * configure.ac: Check for (struct stat)::st_mtim
8689 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8690 * config.in: Regenerate.
8691 * configure: Regenerate.
8692
8693 2009-11-05 Ian Lance Taylor <iant@google.com>
8694
8695 PR 10910
8696 * output.cc (Output_segment::add_output_section): Add missing
8697 return statement.
8698
8699 2009-11-04 Ian Lance Taylor <iant@google.com>
8700
8701 PR 10880
8702 * object.h (class Object): Add is_needed and set_is_needed
8703 methods. Add is_needed_ field. Make bool fields into bitfields.
8704 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8705 defined in a dynamic object and referenced by a regular object,
8706 set is_needed for the dynamic object.
8707 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8708 if the file is marked with as_needed and it is not needed.
8709
8710 2009-11-04 Ian Lance Taylor <iant@google.com>
8711
8712 PR 10887
8713 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8714 tags if data is discarded by linker script.
8715 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8716 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8717 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8718 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8719
8720 2009-11-04 Ian Lance Taylor <iant@google.com>
8721
8722 * layout.cc (Layout::get_output_section): Add is_interp and
8723 is_dynamic_linker_section parameters. Change all callers.
8724 (Layout::choose_output_section): Likewise.
8725 (Layout::make_output_section): Likewise.
8726 (Layout::add_output_section_data): Add is_dynamic_linker_section
8727 parameter. Change all callers.
8728 * layout.h (class Layout): Update declarations.
8729 * output.h (class Output_section): Add is_interp, set_is_interp,
8730 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8731 Add is_interp_, is_dynamic_linker_section_ fields. Change
8732 generate_code_fills_at_write_ to a bitfield.
8733 * output.cc (Output_section::Output_sections): Initialize new
8734 fields.
8735 (Output_segment::add_output_section): Add do_sort parameter.
8736 Change all callers.
8737
8738 2009-11-03 Ian Lance Taylor <iant@google.com>
8739
8740 PR 10860
8741 * options.h (class General_options): Add --warn-common.
8742 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8743 merging two common symbols.
8744 (Symbol_table::should_override): Handle --warn-common when merging
8745 a common symbol with a defined symbol. Use report_resolve_problem
8746 for multiple definitions.
8747 (Symbol_table::report_resolve_problem): New function.
8748 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8749
8750 2009-11-03 Doug Kwan <dougkwan@google.com>
8751
8752 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8753 stub_factory_.
8754 (Target_arm::stub_factory): New method definition.
8755 (Target_arm::new_arm_input_section,
8756 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8757 Target_arm::reloc_uses_thumb_bit): New method declarations.
8758 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8759 New type definitions.
8760 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8761 member declarations.
8762 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8763 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8764 New method definitions.
8765
8766 2009-11-03 Ian Lance Taylor <iant@google.com>
8767
8768 * options.h (class General_options): Add --warn_constructors.
8769
8770 2009-11-03 Ian Lance Taylor <iant@google.com>
8771
8772 PR 10893
8773 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8774 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8775
8776 2009-11-03 Ian Lance Taylor <iant@google.com>
8777
8778 PR 10895
8779 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8780 --msgid-bugs-address.
8781 (install-pdf): New target.
8782 (install-data_yes): Look up one directory to find mkinstalldirs.
8783
8784 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8785
8786 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8787 tree.
8788
8789 2009-10-30 Doug Kwan <dougkwan@google.com>
8790
8791 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8792
8793 2009-10-30 Doug Kwan <dougkwan@google.com>
8794
8795 * arm.cc (Stub_addend_reader): New struct template definition
8796 and partial specializations.
8797 (Stub_addend_reader::operator()): New method definition for a
8798 partially specialized template.
8799
8800 2009-10-30 Doug Kwan <dougkwan@google.com>
8801
8802 * arm.cc (Arm_relobj::processor_specific_flags): New method
8803 definition.
8804 (Arm_relobj::do_read_symbols): New method declaration.
8805 (Arm_relobj::processor_specific_flags_): New data member declaration.
8806 (Arm_dynobj): New class definition.
8807 (Target_arm::do_finalize_sections): Add input_objects parameter.
8808 (Target_arm::do_adjust_elf_header): New method declaration.
8809 (Target_arm::are_eabi_versions_compatible,
8810 (Target_arm::merge_processor_specific_flags): New method declaration.
8811 (Target_arm::do_make_elf_object): New overloaded method definitions
8812 and declaration.
8813 (Arm_relobj::do_read_symbols): New method definition.
8814 (Arm_dynobj::do_read_symbols): Ditto.
8815 (Target_arm::do_finalize_sections): Add input_objects parameters.
8816 Merge processor-specific flags from all input objects.
8817 (Target_arm::are_eabi_versions_compatible,
8818 Target_arm::merge_processor_specific_flags,
8819 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8820 New method definitions.
8821 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8822 Input_objects pointer type parameter.
8823 * layout.cc (Layout::finalize): Pass input objects to target's.
8824 finalize_sections function.
8825 * output.cc (Output_file_header::do_sized_write): Set ELF file
8826 header's processor-specific flags.
8827 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8828 Input_objects pointer type parameter.
8829 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8830 * target.h (Input_objects): New forward class declaration.
8831 (Target::processor_specific_flags,
8832 Target::are_processor_specific_flags_sect): New method definitions.
8833 (Target::finalize_sections): Add input_objects parameter.
8834 (Target::Target): Initialize processor_specific_flags_ and
8835 are_processor_specific_flags_set_.
8836 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8837 parameter.
8838 (Target::set_processor_specific_flags): New method definition.
8839 (Target::processor_specific_flags_,
8840 Target::are_processor_specific_flags_set_): New data member
8841 declarations.
8842 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8843 Input_objects pointer type parameter.
8844
8845 2009-10-30 Doug Kwan <dougkwan@google.com>
8846
8847 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8848
8849 2009-10-28 Ian Lance Taylor <iant@google.com>
8850
8851 * object.h (class Relobj): Drop options parameter from
8852 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8853 do_scan_relocs, do_relocate. Change all callers.
8854 (class Sized_relobj): Drop options parameters from
8855 do_gc_process_relocs, do_scan_relocs, do_relocate,
8856 do_relocate_sections, relocate_sections, emit_relocs_scan,
8857 emit_relocs_scan_reltype. Change all callers.
8858 (struct Relocate_info): Remove options field and all references to
8859 it.
8860 * reloc.h (class Read_relocs): Remove options constructor
8861 parameter and options_ field. Change all callers.
8862 (class Gc_process_relocs, class Scan_relocs): Likewise.
8863 (class Relocate_task): Likewise.
8864 * target-reloc.h (scan_relocs): Remove options parameter. Change
8865 all callers.
8866 (scan_relocatable_relocs): Likewise.
8867 * target.h (class Sized_target): Remove options parameter from
8868 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8869 all callers.
8870 * gc.h (gc_process_relocs): Remove options parameter. Change all
8871 callers.
8872 * arm.cc: Update functions to remove options parameters.
8873 * i386.cc: Likewise.
8874 * powerpc.cc: Likewise.
8875 * sparc.cc: Likewise.
8876 * x86_64.cc: Likewise.
8877 * testsuite/testfile.cc: Likewise.
8878
8879 2009-10-28 Doug Kwan <dougkwan@google.com>
8880
8881 * arm.cc (Arm_relobj): New class definition.
8882 (Arm_relobj::scan_sections_for_stubs,
8883 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8884 New method definitions.
8885
8886 2009-10-28 Cary Coutant <ccoutant@google.com>
8887
8888 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8889 (Plugin::cleanup_done_): New member.
8890 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8891 (Plugin_manager::cleanup_done_): Remove.
8892 (Plugin_manager::add_input_file): Edit error message.
8893 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8894 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8895
8896 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8897
8898 * fileread.cc: (File_read::View::~View): Use the new
8899 data_ownership_ filed.
8900 (File_read::~File_read): Dispose the new whole_file_view_.
8901 (File_read::open): Mmap the whole file if needed.
8902 (File_read::open): Use whole_file_view_ instead of contents_.
8903 (File_read::find_view): Use whole_file_view_ if applicable.
8904 (File_read::do_read): Use whole_file_view_ instead of contents_.
8905 (File_read::make_view): Use whole_file_view_ instead of contents_,
8906 update File_read::View::View call.
8907 (File_read::find_or_make_view): Update File_read::View::View
8908 call.
8909 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8910 remove contents_
8911 (File_read::View::Data_ownership): New enum.
8912 (File_read::View::View): Replace bool mapped_ with Data_ownership
8913 argument.
8914 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8915 (File_read::View::data_ownership_): New field.
8916 (File_read::contents_): Remove (replaced by whole_file_view_).
8917 (File_read::whole_file_view_): New field.
8918 * options.h (class General_options): Add --keep-files-mapped.
8919
8920 2009-10-27 Cary Coutant <ccoutant@google.com>
8921
8922 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8923 * testsuite/Makefile.am (plugin_test_5): New test case.
8924 * testsuite/Makefile.in: Regenerate.
8925
8926 2009-10-25 Doug Kwan <dougkwan@google.com>
8927
8928 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8929 from private to protected to allow access by child class.
8930 (Sized_relobj::do_relocate_sections): New method declaration.
8931 (Sized_relobj::relocate_sections): Virtualize.
8932 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8933 Sized_relobj::relocate_sections. Instantiate template explicitly
8934 for different target sizes and endianity.
8935
8936 2009-10-24 Doug Kwan <dougkwan@google.com>
8937
8938 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8939 (Arm_input_section::as_arm_input_section): New method.
8940 (Arm_output_section): New class definition.
8941 (Arm_output_section::create_stub_group,
8942 Arm_output_section::group_sections): New method definitions.
8943
8944 2009-10-22 Doug Kwan <dougkwan@google.com>
8945
8946 * arm.cc (Arm_input_section): New class definition.
8947 (Arm_input_section::init, Arm_input_section:do_write,
8948 Arm_input_section::set_final_data_size,
8949 Arm_input_section::do_reset_address_and_file_offset): New method
8950 definitions.
8951
8952 2009-10-21 Doug Kwan <dougkwan@google.com>
8953
8954 * arm.cc (Stub_table, Arm_input_section): New forward class
8955 declarations.
8956 (Stub_table): New class defintion.
8957 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8958 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8959 New method definition.
8960
8961 2009-10-21 Doug Kwan <dougkwan@google.com>
8962
8963 * arm.cc: Update copyright comments.
8964 (Target_arm): New forward class template declaration.
8965 (Arm_address): New type.
8966 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8967 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8968 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8969 constants.
8970 (Insn_template): Same.
8971 (DEF_STUBS): New macro.
8972 (Stub_type): New enum type.
8973 (Stub_template): New class definition.
8974 (Stub): Same.
8975 (Reloc_stub): Same.
8976 (Stub_factory): Same.
8977 (Target_arm::Target_arm): Initialize may_use_blx_ and
8978 should_force_pic_veneer_.
8979 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8980 Target_arm::should_force_pic_veneer,
8981 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8982 Target_arm::using_thumb_only, Target_arm:;default_target): New
8983 method defintions.
8984 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8985 New data member declarations.
8986 (Insn_template::size, Insn_template::alignment): New method defintions.
8987 (Stub_template::Stub_template): New method definition.
8988 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8989 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8990 (Stub_factory::Stub_factory): New method definition.
8991 * gold.h (string_hash): New template.
8992 * output.h (Input_section_specifier::hash_value): Use
8993 gold::string_hash.
8994 (Input_section_specifier::string_hash): Remove.
8995 * stringpool.cc (Stringpool_template::string_hash): Use
8996 gold::string_hash.
8997
8998 2009-10-20 Doug Kwan <dougkwan@google.com>
8999
9000 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9001 symbols of relaxed input sections.
9002 * output.h (Output_section::find_relaxed_input_section): Make
9003 method public.
9004
9005 2009-10-16 Doug Kwan <dougkwan@google.com>
9006
9007 * dynobj.cc (Versions::Versions): Initialize version_script_.
9008 Only insert base version symbol definition for a shared object
9009 if version script defines any version versions.
9010 (Versions::define_base_version): New method definition.
9011 (Versions::add_def): Check that base version is not needed.
9012 (Versions::add_need): Define base version lazily.
9013 * dynobj.h (Versions::define_base_version): New method declaration.
9014 (Versions::needs_base_version_): New data member declaration.
9015 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9016 (check_DATA): Add no_version_test.stdout.
9017 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9018 New make rules.
9019 * testsuite/Makefile.in: Regenerate.
9020 * testsuite/no_version_test.c: New file.
9021 * testsuite/no_version_test.sh: Ditto.
9022
9023 2009-10-16 Doug Kwan <dougkwan@google.com>
9024
9025 * expression.cc (class Segment_start_expression): New class definition.
9026 (Segment_start_expression::value): New method definition.
9027 (script_exp_function_segment_start): Return a new
9028 Segment_start_expression.
9029 * gold/script-c.h (script_saw_segment_start_expression): New function
9030 prototype.
9031 * script-sections.cc (Script_sections::Script_sections): Initialize
9032 SAW_SEGMENT_START_EXPRESSION_ to false.
9033 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9034 and -Tbbs options to specify section addresses if given in
9035 command line and no SEGMENT_START expression is seen in a script.
9036 * script-sections.h (Script_sections::saw_segment_start_expression,
9037 Script_sections::set_saw_segment_start_expression): New method
9038 definition.
9039 (Script_sections::saw_segment_start_expression_): New data member
9040 declaration.
9041 * script.cc (script_saw_segment_start_expression): New function.
9042 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9043 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9044 script_test_7.sh and script_test_8.sh.
9045 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9046 script_test_8.stdout.
9047 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9048 (script_test_6, script_test_6.stdout, script_test_7,
9049 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9050 * Makefile.in: Regenerate.
9051 * testsuite/script_test_6.sh: New file.
9052 * testsuite/script_test_6.t: Same.
9053 * testsuite/script_test_7.sh: Same.
9054 * testsuite/script_test_7.t: Same.
9055 * testsuite/script_test_8.sh: Same.
9056
9057 2009-10-16 Doug Kwan <dougkwan@google.com>
9058
9059 * output.cc (Output_segment::set_section_list_address): Cast
9060 expressions to unsigned long long type to avoid format warnings.
9061
9062 2009-10-15 Ian Lance Taylor <iant@google.com>
9063
9064 * script.cc (Script_options::add_symbol_assignment): Always add a
9065 dot assignment to script_sections_.
9066 * script-sections.cc (Script_sections::add_dot_assignment):
9067 Initialize if necessary.
9068
9069 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9070 program headers with no load segment if there is a linker script.
9071
9072 * layout.cc (Layout::set_segment_offsets): Align the file offset
9073 to the segment aligment for -N or -n with no load segment.
9074 * output.cc (Output_segment::add_output_section): Don't crash if
9075 the first section is a TLS section.
9076 (Output_segment::set_section_list_addresses): Print an error
9077 message if the address moves backward in a linker script.
9078 * script-sections.cc
9079 (Output_section_element_input::set_section_addresses): Don't
9080 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9081 (Orphan_output_section::set_section_addresses): Likewise.
9082
9083 2009-10-15 Doug Kwan <dougkwan@google.com>
9084
9085 * layout.cc (Layout::finish_dynamic_section): Generate tags
9086 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9087 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9088 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9089
9090 2009-10-14 Ian Lance Taylor <iant@google.com>
9091
9092 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9093 fields.
9094 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9095 data_shdr fields of relinfo.
9096 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9097 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9098 R_386_TLS_LDO_32, adjust based on section flags.
9099 (Target_i386::Relocate::fix_up_ldo): Remove.
9100
9101 2009-10-13 Ian Lance Taylor <iant@google.com>
9102
9103 Add support for -pie.
9104 * options.h (class General_options): Add -pie and
9105 --pic-executable.
9106 (General_options::output_is_position_independent): Test -pie.
9107 (General_options::output_is_executable): Return true if not shared
9108 and not relocatable.
9109 (General_options::output_is_pie): Remove.
9110 * options.cc (General_options::finalize): Reject incompatible uses
9111 of -pie.
9112 * gold.cc (queue_middle_tasks): A -pie link is not static.
9113 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9114 * symtab.cc (Symbol::final_value_is_known): Return false if
9115 output_is_position_independent.
9116 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9117 output_is_position_independent.
9118 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9119 output_is_position_independent.
9120 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9121 output_is_position_independent.
9122 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9123 two_file_pie_test.
9124 (basic_pie_test.o, basic_pie_test): New targets.
9125 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9126 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9127 (two_file_pie_test): New target.
9128 * testsuite/Makefile.in: Rebuild.
9129 * README: Remove note saying that -pie is not supported.
9130
9131 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9132
9133 * options.h (class General_options): Add -init and -fini.
9134 * layout.cc (Layout::finish_dynamic_section): Emit
9135 given init and fini functions.
9136
9137 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9138
9139 * gc.h (gc_process_relocs): Check if icf is enabled using new
9140 function.
9141 * gold.cc (queue_initial_tasks): Likewise.
9142 (queue_middle_tasks): Likewise.
9143 * object.cc (do_layout): Likewise.
9144 * symtab.cc (is_section_folded): Likewise.
9145 * main.cc (main): Likewise.
9146 * reloc.cc (Read_relocs::run): Likewise.
9147 (Sized_relobj::do_scan_relocs): Likewise.
9148 * icf.cc (is_function_ctor_or_dtor): New function.
9149 (Icf::find_identical_sections): Check if function is ctor or dtor when
9150 safe icf is chosen.
9151 * options.h (General_options::icf): Change option to be an enum.
9152 (Icf_status): New enum.
9153 (icf_enabled): New method.
9154 (icf_safe_folding): New method.
9155 (set_icf_status): New method.
9156 (icf_status_): New variable.
9157 * (options.cc) (General_options::finalize): Set icf_status_.
9158 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9159 icf_test and icf_keep_unique_test to use the --icf enum flag.
9160 * testsuite/icf_safe_test.sh: New file.
9161 * testsuite/icf_safe_test.cc: New file.
9162
9163 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9164
9165 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9166 includes to gc.h and icf.h.
9167 * arm.cc: Include gc.h.
9168 * gold.cc: Likewise.
9169 * i386.cc: Likewise.
9170 * powerpc.cc: Likewise.
9171 * sparc.cc: Likewise.
9172 * x86_64.cc: Likewise.
9173 * gc.h: Include icf.h.
9174
9175 2009-10-11 Ian Lance Taylor <iant@google.com>
9176
9177 * plugin.cc: Include "gold.h" before other header files.
9178
9179 2009-10-10 Chris Demetriou <cgd@google.com>
9180
9181 * options.h (Input_file_argument::Input_file_type): New enum.
9182 (Input_file_argument::is_lib_): Replace with...
9183 (Input_file_argument::type_): New member.
9184 (Input_file_argument::Input_file_argument): Take Input_file_type
9185 'type' rather than boolean 'is_lib' as second argument.
9186 (Input_file_argument::is_lib): Use type_.
9187 (Input_file_argument::is_searched_file): New function.
9188 (Input_file_argument::may_need_search): Handle is_searched_file.
9189 * options.cc (General_options::parse_library): Support -l:filename.
9190 (General_options::parse_just_symbols): Update for Input_file_argument
9191 changes.
9192 (Command_line::process): Likewise.
9193 * archive.cc (Archive::get_file_and_offset): Likewise.
9194 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9195 * script.cc (read_script_file, script_add_file): Likewise.
9196 * fileread.cc (Input_file::Input_file): Likewise.
9197 (Input_file::will_search_for): Handle is_searched_file.
9198 (Input_file::open): Likewise.
9199 * readsyms.cc (Read_symbols::get_name): Likewise.
9200 * testsuite/Makefile.am (searched_file_test): New test.
9201 * testsuite/Makefile.in: Regenerate.
9202 * testsuite/searched_file_test.cc: New file.
9203 * testsuite/searched_file_test_lib.cc: New file.
9204
9205 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9206 Ian Lance Taylor <iant@google.com>
9207
9208 * descriptor.cc: Include <cstdio> and "binary-io.h".
9209 (Descriptors::open): Open the files in binary mode always.
9210 * script.cc (Lex::get_token): Treat \r as whitespace.
9211
9212 2009-10-09 Ian Lance Taylor <iant@google.com>
9213
9214 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9215
9216 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9217 Ian Lance Taylor <iant@google.com>
9218
9219 * configure.ac: Check for readv function also.
9220 * fileread.cc (readv): Define if not HAVE_READV.
9221 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9222 does not exist.
9223 * config.in: Regenerate.
9224 * configure: Regenerate.
9225
9226 2009-10-09 Doug Kwan <dougkwan@google.com>
9227
9228 * layout.cc (Layout::make_output_section): Call target hook to make
9229 ordinary output section.
9230 (Layout::finalize): Adjust parameter list of call the
9231 Target::may_relax().
9232 * layout.h (class Layout::section_list): New method.
9233 * merge.h (Output_merge_base::entsize): Change visibility to public.
9234 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9235 New methods.
9236 (Output_merge_string::do_is_string): New method.
9237 * object.cc (Sized_relobj::do_setup): renamed from
9238 Sized_relobj::set_up.
9239 * object.h (Sized_relobj::adjust_shndx,
9240 Sized_relobj::initializ_input_to_output_maps,
9241 Sized_relobj::free_input_to_output_maps): Change visibilities to
9242 protected.
9243 (Sized_relobj::setup): Virtualize.
9244 (Sized_relobj::do_setup): New method declaration.
9245 (Sized_relobj::invalidate_section_offset,
9246 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9247 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9248 * options.cc (parse_int): New function.
9249 * options.h (parse_int): New declaration.
9250 (DEFINE_int): New macro.
9251 (stub_group_size): New option.
9252 * output.cc (Output_section::Output_section): Initialize memebers
9253 merge_section_map_, merge_section_by_properties_map_,
9254 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9255 (Output_section::add_input_section): Handled deferred code-fill
9256 generation and remove an old comment.
9257 (Output_section::add_relaxed_input_section): New method definition.
9258 (Output_section::add_merge_input_section): Use merge section by
9259 properties map to speed to search. Update merge section maps
9260 as appropriate.
9261 (Output_section::build_relaxation_map): New method definition.
9262 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9263 Same.
9264 (Output_section::relax_input_section): Renamed to
9265 Output_section::convert_input_sections_to_relaxed_sections and change
9266 interface to take a vector of pointers to relaxed sections.
9267 (Output_section::find_merge_section,
9268 Output_section::find_relaxed_input_section): New method definitions.
9269 (Output_section::is_input_address_mapped,
9270 Output_section::output_offset, Output_section::output_address):
9271 Use output section data maps to speed up searching.
9272 (Output_section::find_starting_output_address): Add comments.
9273 (Output_section::do_write,
9274 Output_section::write_to_postprocessing_buffer): Do code-fill
9275 generation as appropriate.
9276 (Output_section::get_input_sections): Invalidate relaxed input section
9277 map.
9278 (Output_section::restore_states): Adjust type of checkpoint .
9279 Invalidate relaxed input section map.
9280 * output.h (Output_merge_base): New class declaration.
9281 (Input_section_specifier): New class defintion.
9282 (class Output_relaxed_input_section) Change base class to
9283 Output_section_data_build.
9284 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9285 base class initializer.
9286 (Output_section::add_relaxed_input_section): New method declaration.
9287 (Output_section::Input_section): Change visibility to protected.
9288 (Output_section::Input_section::relobj,
9289 Output_section::Input_section::shndx): Handle relaxed input sections.
9290 Output_section::input_sections) Change visibility to protected. Also
9291 define overload to return a non-const pointer.
9292 (Output_section::Merge_section_properties): New class defintion.
9293 (Output_section::Merge_section_by_properties_map,
9294 Output_section::Output_section_data_by_input_section_map,
9295 Output_section::Relaxation_map): New types.
9296 (Output_section::relax_input_section): Rename method to
9297 Output_section::convert_input_sections_to_relaxed_sections and change
9298 interface to take a vector of relaxed section pointers.
9299 (Output_section::find_merge_section,
9300 Output_section::find_relaxed_input_section,
9301 Output_section::build_relaxation_map,
9302 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9303 New method declarations.
9304 (Output_section::merge_section_map_
9305 Output_section::merge_section_by_properties_map_,
9306 Output_section::relaxed_input_section_map_,
9307 Output_section::is_relaxed_input_section_map_valid_,
9308 Output_section::generate_code_fills_at_write_): New data members.
9309 * script-sections.cc
9310 (Output_section_element_input::set_section_addresses): Call
9311 current_data_size and addralign methods of relaxed input sections.
9312 (Orphan_output_section::set_section_addresses): Call current_data_size
9313 and addralign methods of relaxed input sections.
9314 * symtab.cc (Symbol_table::compute_final_value): Extract template
9315 from the body of Symbol_table::sized_finalize_symbol.
9316 (Symbol_table::sized_finalized_symbol): Call
9317 Symbol_table::compute_final_value.
9318 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9319 (Symbol_table::compute_final_value): New templated method declaration.
9320 * target.cc (Target::do_make_output_section): New method defintion.
9321 * target.h (Target::make_output_section): New method declaration.
9322 (Target::relax): Add more parameters for input objects, symbol table
9323 and layout. Adjust call to do_relax.
9324 (Target::do_make_output_section): New method declaration.
9325 (Target::do_relax): Add parameters for input objects, symbol table
9326 and layout.
9327
9328 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9329
9330 * pread.c: Include stdio.h.
9331
9332 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9333
9334 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9335 defined.
9336
9337 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9338
9339 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9340 Change read_shndx type to unsigned int.
9341 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9342 int.
9343 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9344 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9345 Change read_shndx type to unsigned int.
9346 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9347 int.
9348 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9349 * layout.cc (Layout::create_symtab_sections): Cast the result of
9350 local_symcount * symsize to off_t in the gold_assert.
9351
9352 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9353
9354 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9355 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9356 R_ARM_BASE_ABS.
9357 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9358 (Arm_relocate_functions::thm_abs5): New function.
9359 (Arm_relocate_functions::abs12): New function.
9360 (Arm_relocate_functions::abs16): New function.
9361 (Arm_relocate_functions::base_abs): New function.
9362 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9363 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9364 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9365 R_ARM_BASE_ABS.
9366 (Scan::global): Likewise.
9367 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9368 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9369 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9370 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9371 R_ARM_BASE_ABS.
9372
9373 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9374
9375 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9376 (Arm_relocate_functions::movt_prel): New function.
9377 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9378 (Arm_relocate_functions::thm_movt_prel): New function.
9379 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9380 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9381 (Scan::global, Relocate::relocate): Likewise.
9382 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9383
9384 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9385
9386 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9387 Incremental_checker.
9388 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9389 unsigned int.
9390 (class Incremental_inputs_header): New class.
9391 (Incremental_inputs_header_writer): Edit comment.
9392 (Incremental_inputs_entry): New class.
9393 (Incremental_inputs_entry_writer): Edit comment.
9394 (Sized_incremental_binary::do_find_incremental_inputs_section):
9395 Add *strtab_shndx parameter, fill it.
9396 (Sized_incremental_binary::do_check_inputs): New method.
9397 (Incremental_checker::can_incrementally_link_output_file): Use
9398 Sized_incremental_binary::check_inputs.
9399 (Incremental_inputs::report_command_line): Save command line in
9400 command_line_.
9401 * incremental.h:
9402 (Incremental_binary::find_incremental_inputs_section): New
9403 method.
9404 (Incremental_binary::do_find_incremental_inputs_section): Add
9405 strtab_shndx parameter.
9406 (Incremental_binary::do_check_inputs): New pure virtual method.
9407 (Sized_incremental_binary::do_check_inputs): Declare.
9408 (Incremental_checker::Incremental_checker): Add incremental_inputs
9409 parameter, use it to initialize incremental_inputs_.
9410 (Incremental_checker::incremental_inputs_): New field.
9411 (Incremental_checker::command_line): New method.
9412 (Incremental_checker::inputs): New method.
9413 (Incremental_checker::command_line_): New field.
9414
9415 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9416
9417 * incremental.cc: Include <cstdarg> and "target-select.h".
9418 (vexplain_no_incremental): New function.
9419 (explain_no_incremental): New function.
9420 (Incremental_binary::error): New method.
9421 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9422 method.
9423 (make_sized_incremental_binary): New function.
9424 (open_incremental_binary): New function.
9425 (can_incrementally_link_file): Add checks if output is ELF and has
9426 inputs section.
9427 * incremental.h: Include "elfcpp_file.h" and "output.h".
9428 (Incremental_binary): New class.
9429 (Sized_incremental_binary): New class.
9430 (open_incremental_binary): Declare.
9431 * object.cc (is_elf_object): Use
9432 elfcpp::Elf_recognizer::is_elf_file.
9433 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9434 * output.h (Output_file::filesize): New method.
9435
9436 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9437
9438 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9439 New function.
9440 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9441 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9442 function.
9443 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9444 function.
9445 (Arm_relocate_functions::movw_abs_nc): New function.
9446 (Arm_relocate_functions::movt_abs): New function.
9447 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9448 (Arm_relocate_functions::thm_movt_abs): New function.
9449 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9450 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9451 (Scan::global): Likewise.
9452 (Relocate::relocate): Likewise.
9453 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9454
9455 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9456
9457 * arm.cc (Arm_relocate_functions::got_prel) New function.
9458 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9459 (Relocate::relocate): Likewise.
9460 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9461
9462 2009-10-06 Ian Lance Taylor <iant@google.com>
9463
9464 * options.h (class General_options): Define
9465 split_stack_adjust_size parameter.
9466 * object.h (class Object): Add uses_split_stack_ and
9467 has_no_split_stack_ fields. Add uses_split_stack and
9468 has_no_split_stack accessor functions. Declare
9469 handle_split_stack_section.
9470 (class Reloc_symbol_changes): Define.
9471 (class Sized_relobj): Define Function_offsets. Declare
9472 split_stack_adjust, split_stack_adjust_reltype, and
9473 find_functions.
9474 * object.cc (Object::handle_split_stack_section): New function.
9475 (Sized_relobj::do_layout): Call handle_split_stack_section.
9476 * dynobj.cc (Sized_dynobj::do_layout): Call
9477 handle_split_stack_section.
9478 * reloc.cc (Sized_relobj::relocate_sections): Call
9479 split_stack_adjust for executable sections in split_stack
9480 objects. Pass reloc_map to relocate_section.
9481 (Sized_relobj::split_stack_adjust): New function.
9482 (Sized_relobj::split_stack_adjust_reltype): New function.
9483 (Sized_relobj::find_functions): New function.
9484 * target-reloc.h: Include "object.h".
9485 (relocate_section): Add reloc_symbol_changes parameter. Change
9486 all callers.
9487 * target.h (class Target): Add calls_non_split method. Declare
9488 do_calls_non_split virtual method. Declare match_view and
9489 set_view_to_nop.
9490 * target.cc: Include "elfcpp.h".
9491 (Target::do_calls_non_split): New function.
9492 (Target::match_view): New function.
9493 (Target::set_view_to_nop): New function.
9494 * gold.cc (queue_middle_tasks): Give an error if mixing
9495 split-stack and non-split-stack objects with -r.
9496 * i386.cc (Target_i386::relocate_section): Add
9497 reloc_symbol_changes parameter.
9498 (Target_i386::do_calls_non_split): New function.
9499 * x86_64.cc (Target_x86_64::relocate_section): Add
9500 reloc_symbol_changes parameter.
9501 (Target_x86_64::do_calls_non_split): New function.
9502 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9503 parameter.
9504 * powerpc.cc (Target_powerpc::relocate_section): Add
9505 reloc_symbol_changes parameter.
9506 * sparc.cc (Target_sparc::relocate_section): Add
9507 reloc_symbol_changes parameter.
9508 * configure.ac: Call AM_CONDITIONAL for the default target.
9509 * configure: Rebuild.
9510 * testsuite/Makefile.am (TEST_AS): New variable.
9511 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9512 (check_DATA): Add split_i386 and split_x86_64 files.
9513 (SPLIT_DEFSYMS): Define.
9514 (split_i386_[1234n].o): New targets.
9515 (split_i386_[124]): New targets.
9516 (split_i386_[1234r].stdout): New targets.
9517 (split_x86_64_[1234n].o): New targets.
9518 (split_x86_64_[124]): New targets.
9519 (split_x86_64_[1234r].stdout): New targets.
9520 (MOSTLYCLEANFILES): Add new executables.
9521 * testsuite/split_i386.sh: New file.
9522 * testsuite/split_x86_64.sh: New file.
9523 * testsuite/split_i386_1.s: New file.
9524 * testsuite/split_i386_2.s: New file.
9525 * testsuite/split_i386_3.s: New file.
9526 * testsuite/split_i386_4.s: New file.
9527 * testsuite/split_i386_n.s: New file.
9528 * testsuite/split_x86_64_1.s: New file.
9529 * testsuite/split_x86_64_2.s: New file.
9530 * testsuite/split_x86_64_3.s: New file.
9531 * testsuite/split_x86_64_4.s: New file.
9532 * testsuite/split_x86_64_n.s: New file.
9533 * testsuite/testfile.cc (Target_test): Update relocation_section
9534 function.
9535 * testsuite/Makefile.in: Rebuild.
9536
9537 2009-10-06 Ian Lance Taylor <iant@google.com>
9538
9539 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9540 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9541 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9542 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9543 the address on ldo_addrs_.
9544 (Target_i386::Relocate::fix_up_ldo): New function.
9545
9546 2009-10-06 Rafael Espindola <espindola@google.com>
9547
9548 * plugin.cc (add_input_library): New.
9549 (Plugin::load): Add add_input_library to tv.
9550 (Plugin_manager::add_input_file): Add the is_lib argument.
9551 (add_input_file): Update call to Plugin_manager::add_input_file.
9552 (add_input_library): New.
9553 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9554
9555 2009-09-30 Doug Kwan <dougkwan@google.com>
9556
9557 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9558 symbol and call Symbol::may_need_copy_reloc to determine if
9559 a copy reloc is needed.
9560 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9561 nocopyreloc is given in command line.
9562 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9563 given in command line.
9564 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9565 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9566 of the removed Target_i386::may_need_copy_reloc.
9567 * options.h (copyreloc): New option with default value false.
9568 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9569 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9570 instead of the removed Target_powerpc::may_need_copy_reloc.
9571 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9572 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9573 instead of the removed Target_sparc::may_need_copy_reloc.
9574 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9575 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9576 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9577 instead of the removed Target_x86_64::may_need_copy_reloc.
9578
9579 2009-09-30 Ian Lance Taylor <iant@google.com>
9580
9581 * object.h (class Object): Remove target_ field, and target,
9582 sized_target, and set_target methods.
9583 (Object::sized_target): Remove.
9584 (class Sized_relobj): Update declarations. Remove sized_target.
9585 * object.cc (Sized_relobj::setup): Remove target parameter.
9586 Change all callers.
9587 (Input_objects::add_object): Don't do anything with the target.
9588 (make_elf_sized_object): Add punconfigured parameter. Change all
9589 callers. Set or test parameter target.
9590 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9591 Change all callers.
9592 * parameters.cc (Parameters::set_target): Change parameter type to
9593 be non-const.
9594 (Parameters::default_target): Remove.
9595 (set_parameters_target): Change parameter type to be non-const.
9596 (parameters_force_valid_target): New function.
9597 (parameters_clear_target): New function.
9598 * parameters.h (class Parameters): Update declarations. Remove
9599 default_target method. Add sized_target and clear_target
9600 methods. Change target_ to be non-const.
9601 (set_parameters_target): Update declaration.
9602 (parameters_force_valid_target): Declare.
9603 (parameters_clear_target): Declare.
9604 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9605 as NULL if we aren't searching.
9606 (Add_symbols::run): Don't check for compatible target.
9607 * fileread.cc (Input_file::open_binary): Call
9608 parameters_force_valid_target.
9609 * gold.cc (queue_middle_tasks): Likewise.
9610 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9611 set_target on object.
9612 * dynobj.h (class Sized_dynobj): Update declarations.
9613 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9614 make_elf_object returns NULL.
9615 (Archive::include_member): Don't check whether object target is
9616 compatible.
9617 * output.cc (Output_section::add_input_section): Get target from
9618 parameters.
9619 (Output_section::relax_input_section): Likewise.
9620 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9621 parameters.
9622 (Sized_relobj::do_scan_relocs): Likewise.
9623 (Sized_relobj::relocate_sections): Likewise.
9624 * resolve.cc (Symbol_table::resolve): Likewise.
9625 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9626 parameter. Change all callers.
9627 (Symbol_table::add_from_object): Get target from parameters.
9628 (Symbol_table::add_from_relobj): Don't check object target.
9629 (Symbol_table::add_from_dynobj): Likewise.
9630 (Symbol_table::define_special_symbol): Get target from
9631 parameters.
9632 * symtab.h (class Symbol_table): Update declaration.
9633 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9634 parameter. Change all callers. Clear parameter target.
9635 (Binary_test): Test target here.
9636 * testsuite/object_unittest.cc (gold_testsuite): Remove
9637 target_test_pointer parameter. Change all callers.
9638 (Object_test): Test target here.
9639
9640 2009-09-26 Ian Lance Taylor <iant@google.com>
9641
9642 * testsuite/initpri1.c: Don't try to use constructor priorities if
9643 compiling with gcc before 4.3.
9644
9645 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9646
9647 * testsuite/retain_symbols_file_test.sh (check_present): Change
9648 output file name to retain_symbols_file_test.stdout.
9649 (check_absent): Likewise.
9650
9651 2009-09-18 Craig Silverstein <csilvers@google.com>
9652
9653 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9654 * options.cc: Include <cerrno> and <fstream>.
9655 (General_options::finalize): Parse -retain-symbols-file tag.
9656 * options.h: New flag.
9657 (General_options): New method should_retain_symbol, new
9658 variable symbols_to_retain.
9659 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9660 should_retain_symbol map.
9661 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9662 * testsuite/Makefile.in: Regenerate.
9663 * testsuite/retain_symbols_file_test.sh: New file.
9664
9665 2009-09-18 Nick Clifton <nickc@redhat.com>
9666
9667 * po/es.po: Updated Spanish translation.
9668
9669 2009-09-17 Doug Kwan <dougkwan@google.com>
9670
9671 * debug.h (DEBUG_RELAXATION): New constant.
9672 (DEBUG_ALL): Add DEBUG_RELAXATION.
9673 (debug_string_to_enum): Add relaxation debug option.
9674 * layout.cc
9675 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9676 Layout::Relaxation_debug_check::read_sections,
9677 Layout::Relaxation_debug_check::read_sections): New method definitions.
9678 (Layout::Layout): Initialize data members
9679 record_output_section_data_from_scrips_,
9680 script_output_section_data_list_ and relaxation_debug_check_.
9681 (Layout::save_segments, Layout::restore_segments,
9682 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9683 Layout::relaxation_loop_body): New method definitions.
9684 (Layout::finalize): Support relaxation. Move section layout code to
9685 Layout::relaxation_loop_body.
9686 (Layout::set_asection_address_from_script): Move code for orphan
9687 section placement out.
9688 (Layout::place_orphan_sections_in_script): New method definition.
9689 * layout.h (Output_segment_headers, Output_file_header):
9690 New forward class declarations.
9691 (Layout::~Layout): Define.
9692 (Layout::new_output_section_data_from_script): New method definition.
9693 (Layout::place_orphan_sections_in_script): New method declaration.
9694 (Layout::Segment_states): New type declaration.
9695 (Layout::save_segments, Layout::restore_segments,
9696 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9697 Layout::relaxation_loop_body): New method declarations.
9698 (Layout::Output_section_data_list): New type declaration.
9699 (Layout::Relaxation_debug_check): New class definition.
9700 (Layout::record_output_section_data_from_script_,
9701 Layout::script_output_section_data_list_, Layout::segment_states_,
9702 Layout::relaxation_debug_check_): New data members.
9703 * output.cc: (Output_section_headers::do_size): New method definition.
9704 (Output_section_headers::Output_section_headers): Move size
9705 computation to Output_section_headers::do_size.
9706 (Output_segment_headers::do_size): New method definition.
9707 (Output_file_header::Output_file_header): Move size computation to
9708 Output_file_header::do_size and call it.
9709 (Output_file_header::do_size): New method definition.
9710 (Output_data_group::Output_data_group): Adjust call to
9711 Output_section_data.
9712 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9713 (Output_symtab_xindex::do_write): Add array bound check.
9714 (Output_section::Input_section::print_to_mapfile): Handle
9715 RELAXED_INPUT_SECTION_CODE.
9716 (Output_section::Output_section): Initialize data member checkpoint_.
9717 (Output_section::~Output_section): Delete checkpoint object pointed
9718 by checkpoint_.
9719 (Output_section::add_input_section): Always add an Input_section if
9720 relaxing.
9721 (Output_section::add_merge_input_section): Add assert.
9722 (Output_section::relax_input_section): New method definition.
9723 (Output_section::set_final_data_size): Set load address to zero for
9724 an unallocated section.
9725 (Output_section::do_address_and_file_offset_have_reset_values):
9726 New method definition.
9727 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9728 Handle relaxed input section.
9729 (Output_section::sort_attached_input_sections): Checkpoint input
9730 section list lazily.
9731 (Output_section::get_input_sections): Change type of input_sections to
9732 list of Simple_input_section pointers. Checkpoint input section list
9733 lazily. Also handle relaxed input sections.
9734 (Output_section::add_input_section_for_script): Take a reference to
9735 a Simple_input_section object instead of Relobj pointer and section
9736 index as parameter. Handle relaxed input sections.
9737 (Output_section::save_states, Output_section::restore_states): New
9738 method definitions.
9739 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9740 (Output_data::is_data_size_fixed): New method definition.
9741 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9742 if it is fixed.
9743 (Output_data::address_and_file_offset_have_reset_values): New method
9744 definition.
9745 (Output_data::do_address_and_file_offset_have_reset_values): New method
9746 definition.
9747 (Output_data::set_data_size): Check that data size is not fixed.
9748 (Output_data::fix_data_size): New method definition.
9749 (Output_data::is_data_size_fixed_): New data member.
9750 (Output_section_headers::set_final_data_size): New method definition.
9751 (Output_section_headers::do_size): New method declaration.
9752 (Output_segment_headers::set_final_data_size): New method definition.
9753 (Output_segment_headers::do_size): New method declaration.
9754 (Output_file_header::set_final_data_size)::New method definition.
9755 (Output_file_header::do_size)::New method declaration.
9756 (Output_section_data::Output_section_data): Add new parameter
9757 is_data_size_fixed and use it to fix data size.
9758 (Output_data_const::Output_data_const): Adjust call to base class
9759 constructor and fix data size.
9760 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9761 base class constructor and fix data size.
9762 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9763 base class constructor and fix data size.
9764 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9765 class constructor and fix data size.
9766 (Output_data_group::set_final_data_size): New method definition.
9767 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9768 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9769 class constructor and fix data size.
9770 (Output_relaxed_input_section): New class definition.
9771 (Output_section::Simple_input_section): New class definition.
9772 (Output_section::get_input_sections): Adjust parameter list.
9773 (Output_section::add_input_section_for_script): Same.
9774 (Output_section::save_states, Output_section::restore_states,
9775 Output_section::do_address_and_file_offset_have_reset_values,
9776 (Output_section::Input_section::Input_section): Handle
9777 RELAXED_INPUT_SECTION_CODE. Add new overload for
9778 Output_relaxed_input_section.
9779 (Output_section::Input_section::is_input_section,
9780 Output_section::Input_section::set_output_section): Handle relaxed
9781 input section.
9782 (Output_section::Input_section::is_relaxed_input_section,
9783 Output_section::Input_section::output_section_data,
9784 Output_section::Input_section::relaxed_input_section): New method
9785 definitions.
9786 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9787 value.
9788 (Output_section::Input_section::u1_): Update comments.
9789 (Output_section::Input_section::u2_): Add new union member poris.
9790 (Output_section::Checkpoint_output_section): New classs definition.
9791 (Output_section::relax_input_section): New method declaration.
9792 (Output_section::checkpoint_): New data member.
9793 (Output_segment): Update comments.
9794 (Output_segment::Output_segment): Un-privatize copy constructor.
9795 (Output_segment::operator=): Un-privatize.
9796 * script-sections.cc (Output_section_element::Input_section_list):
9797 Change element type to Output_section::Simple_input_section.
9798 (Output_section_element_dot_assignment::set_section_addresses):
9799 Register output section data for relaxation clean up.
9800 (Output_data_exression::Output_data_expression): Adjust call to base
9801 constructor to fix data size.
9802 (Output_section_element_data::set_section_addresses): Register
9803 Output_data_expression object for relaxation clean up.
9804 (struct Input_section_info): Replace Relobj pointer and section index
9805 pair with Output_section::Simple_input_section and Convert struct to a
9806 class.
9807 (Input_section_sorter::operator()): Adjust access to
9808 Input_section_info data member to use accessors.
9809 (Output_section_element_input::set_section_addresses): Use layout
9810 parameter. Adjust code to use Output_section::Simple_input_section
9811 and Input_secction_info classes. Register filler for relaxation
9812 clean up.
9813 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9814 and section index pair with Output_section::Simple_input_section
9815 class. Adjust code accordingly.
9816 (Phdrs_element::release_segment): New method definition.
9817 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9818 segment list.
9819 (Script_sections::release_segments): New method definition.
9820 * gold/script-sections.h (Script_sections::release_segments): New
9821 method declaration.
9822 * gold/target.h (Target::may_relax, Target::relax,
9823 Target::do_may_relax, Target::do_relax): New method definitions.
9824
9825 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9826
9827 * arm.cc (has_signed_unsigned_overflow): New function.
9828 (Arm_relocate_functions::abs8): New function.
9829 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9830 (Target_arm::Scan::global): Likewise.
9831 (Target_arm::relocate::relocate): Likewise.
9832 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9833 Likewise.
9834
9835 2009-09-16 Cary Coutant <ccoutant@google.com>
9836
9837 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9838 * testsuite/Makefile.in: Regenerate.
9839
9840 2009-09-11 Nick Clifton <nickc@redhat.com>
9841
9842 * po/gold.pot: Updated by the Translation project.
9843
9844 2009-09-08 Cary Coutant <ccoutant@google.com>
9845
9846 * output.cc (Output_file::open): Add execute permission to empty file.
9847 * testsuite/Makefile.am (permission_test): New test.
9848 * testsuite/Makefile.in: Regenerate.
9849
9850 2009-09-02 Ian Lance Taylor <iant@google.com>
9851
9852 * output.cc (Output_file::resize): Call map_no_anonymous rather
9853 than map.
9854
9855 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9856
9857 * gold.cc: Include "incremental.h".
9858 (queue_initial_tasks): Call Incremental_checker methods.
9859 * incremental.cc: Include "output.h".
9860 (Incremental_checker::can_incrementally_link_output_file): New
9861 method.
9862 * incremental.h (Incremental_checker): New class.
9863
9864 * output.cc (Output_file::open_for_modification): New method.
9865 (Output_file::map_anonymous): Changed return type to bool. Record
9866 map in base_ field.
9867 (Output_file::map_no_anonymous): New method, broken out of map.
9868 (Output_file::map): Use map_no_anonymous and map_anonymous.
9869 * output.h (class Output_file): Update declarations.
9870
9871 2009-08-24 Cary Coutant <ccoutant@google.com>
9872
9873 * options.h (Command_line::Pre_options): New class.
9874 (Command_line::pre_options): New member.
9875 * options.cc (gold::options::ready_to_register): New variable.
9876 (One_option::register_option): Do nothing if not registering options.
9877 Assert if same short option registered twice.
9878 (General_options::General_options): Turn off option registration when
9879 done constructing.
9880 (Command_line::Pre_options::Pre_options): New constructor.
9881
9882 2009-08-24 Cary Coutant <ccoutant@google.com>
9883
9884 * options.h (General_options::no_keep_memory): Remove incorrect
9885 short option.
9886
9887 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9888
9889 * Makefile.am (am__skiplex, am__skipyacc): New.
9890 * Makefile.in: Regenerate.
9891
9892 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9893
9894 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9895 (INCLUDES): ... this.
9896 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9897 (AM_CPPFLAGS): Renamed from ...
9898 (INCLUDE): ... this.
9899 * Makefile.in, testsuite/Makefile.in: Regenerate.
9900
9901 * Makefile.in: Regenerate.
9902 * aclocal.m4: Likewise.
9903 * config.in: Likewise.
9904 * configure: Likewise.
9905 * testsuite/Makefile.in: Likewise.
9906
9907 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9908 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9909 * Makefile.in: Regenerate.
9910 * testsuite/Makefile.in: Regenerate.
9911
9912 2009-08-19 Cary Coutant <ccoutant@google.com>
9913
9914 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9915 symbols in shared libraries overridden by hidden or internal symbols
9916 in the main program.
9917
9918 2009-08-19 Chris Demetriou <cgd@google.com>
9919
9920 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9921 checking source file names in error messages.
9922
9923 2009-08-18 Doug Kwan <dougkwan@google.com>
9924
9925 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9926 an elcpp::Ehdr as parameter. Adjust call to set_target.
9927 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9928 an elfcpp::Ehdr as parameter.
9929 * object.cc (Object::set_target): Remove the version that looks up
9930 a target and sets it.
9931 (Sized_relobj::setup): Take a Target object instead of
9932 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9933 (make_elf_sized_object): Find target and ask target to
9934 make an ELF object.
9935 * object.h: (Object::set_target): Remove the version that looks up
9936 a target and sets it.
9937 (Sized_relobj::setup): Take a Target object instead of
9938 an elfcpp:Ehdr as parameter.
9939 * target.cc: Include dynobj.h.
9940 (Target::do_make_elf_object_implementation): New.
9941 (Target::do_make_elf_object): New.
9942 * target.h (Target::make_elf_object): New template declaration.
9943 (Target::do_make_elf_object): New method declarations.
9944 (Target::do_make_elf_object_implementation): New template declaration.
9945
9946 2009-08-14 Ian Lance Taylor <iant@google.com>
9947
9948 * gold.h (FUNCTION_NAME): Define.
9949 (gold_unreachable): Use FUNCTION_NAME.
9950
9951 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9952
9953 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9954 symbol in the --keep-unique list is not found.
9955
9956 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9957
9958 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9959 been maked as --keep-unique.
9960 (Icf::unfold_section): New function.
9961 * icf.h (Icf::unfold_section): New function.
9962 * options.h (General_options::keep_unique): New option.
9963 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9964 * testsuite/Makefile.in: Regenerate.
9965 * testsuite/icf_keep_unique_test.sh: New file.
9966 * testsuite/icf_keep_unique_test.cc: New file.
9967
9968 2009-08-12 Cary Coutant <ccoutant@google.com>
9969
9970 PR 10471
9971 * resolve.cc (Symbol_table::resolve): Check for references from
9972 dynamic objects to hidden and internal symbols.
9973 * testsuite/Makefile.am (hidden_test.sh): New test.
9974 * testsuite/Makefile.in: Regenerate.
9975 * testsuite/hidden_test.sh: New script.
9976 * testsuite/hidden_test_1.c: New test source.
9977 * testsuite/hidden_test_main.c: New test source.
9978
9979 2009-08-11 Doug Kwan <dougkwan@google.com>
9980
9981 * arm.cc: Update comments.
9982 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9983 segment to locate the .ARM.exidx section if present.
9984
9985 2009-08-09 Doug Kwan <dougkwan@google.com>
9986
9987 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9988 patch.
9989
9990 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9991 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9992 compiler warnings.
9993
9994 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9995
9996 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9997 valid tls_segment only for non-debug-section relocations.
9998 * testsuite/Makefile.am: Add gc_tls_test.
9999 * testsuite/Makefile.in: Regenerate.
10000 * testsuite/gc_tls_test.cc: New file.
10001 * testsuite/gc_tls_test.sh: New file.
10002
10003 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10004
10005 * icf.cc: New file.
10006 * icf.h: New file.
10007 * Makefile.am (CCFILES): Add icf.cc.
10008 (HFILES): Add icf.h
10009 * Makefile.in: Regenerate.
10010 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10011 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10012 section, symbol and addend information for the relocs.
10013 * gold.cc (queue_middle_tasks): Call identical code folding.
10014 * gold.h: Add defines for multimap.
10015 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10016 to the call of finalize_local_symbols.
10017 * main.cc (main): Create object of class Icf.
10018 * object.cc (Sized_relobj::do_layout): Allow this function to be
10019 called twice during icf.
10020 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10021 to sections marked as identical by icf.
10022 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10023 when available.
10024 (Sized_relobj::do_section_entsize): New function.
10025 * object.h (Object::section_entsize): New function.
10026 (Object::do_section_entsize): New pure virtual function.
10027 (Relobj::finalize_local_symbols): Add new parameter.
10028 (Relobj::do_section_entsize): New function.
10029 * options.h (General_options::icf): New option.
10030 (General_options::icf_iterations): New option.
10031 (General_options::print_icf_sections): New option.
10032 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10033 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10034 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10035 icf.
10036 * symtab.cc (Symbol_table::is_section_folded): New function.
10037 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10038 to sections marked as identical by icf.
10039 * symtab.h (Symbol_table::set_icf): New function.
10040 (Symbol_table::icf): New function.
10041 (Symbol_table::is_section_folded): New function.
10042 (Symbol_table::icf_): New data member.
10043 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10044 * testsuite/Makefile.am: Add commands to build icf_test.
10045 * testsuite/Makefile.in: Regenerate.
10046 * testsuite/icf_test.sh: New file.
10047 * testsuite/icf_test.cc: New file.
10048
10049 2009-07-24 Chris Demetriou <cgd@google.com>
10050
10051 * layout.cc (is_compressible_debug_section): Fix incorrect
10052 comment about compressed section names.
10053
10054 2009-07-20 Ian Lance Taylor <ian@airs.com>
10055
10056 PR 10419
10057 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10058
10059 2009-07-16 Ian Lance Taylor <iant@google.com>
10060
10061 PR 10400
10062 * layout.h: #include <map>.
10063 (class Kept_section): Change from struct to class. Add accessors
10064 and setters. Add section size to Comdat_group mapping. Change
10065 Comdat_group to std::map. Add is_comdat_ field. Add
10066 linkonce_size field in union.
10067 (class Layout): Update declaration of find_or_add_kept_section.
10068 Don't declare find_kept_object.
10069 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10070 parameter. Add object, shndx, is_comdat, and is_group_name
10071 parameters. Change all callers. Adjust for new Kept_section.
10072 (Layout::find_kept_object): Remove.
10073 * object.cc (Sized_relobj::include_section_group): Update use of
10074 Kept_section. Rename secnum to shndx. Only record
10075 Kept_comdat_section if sections are the same size.
10076 (Sized_relobj::include_linkonce_section): Update use of
10077 Kept_section. Only record Kept_comdat_section if sections are the
10078 same size. Set size of linkonce section.
10079 (Sized_relobj::map_to_kept_section): Update call to
10080 get_kept_comdat_section.
10081 * object.h (class Sized_relobj): Rename fields in
10082 Kept_comdat_section to drop trailing underscores; change object
10083 field to Relobj*. Change Kept_comdat_section_table to store
10084 struct rather than pointer.
10085 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10086 Add kept_object and kept_shndx parameters. Change all callers.
10087 (Sized_relobj::get_kept_comdat_section): Change return type to
10088 bool. Add kept_object and kept_shndx parameters. Change all
10089 callers.
10090 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10091 Layout::find_or_add_kept_section.
10092
10093 2009-07-09 Ian Lance Taylor <iant@google.com>
10094
10095 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10096 Reserve space in the hash table.
10097
10098 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10099
10100 * fileread.cc (File_read::get_mtime): New method.
10101 * fileread.h (Timespec): New structure.
10102 (File_read::get_mtime): New method.
10103 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10104 Renamed from timestamp_nsec.
10105 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10106 Elf_Xword.
10107 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10108 timestamp_nsec.
10109 (Incremental_inputs::report_archive): Save mtime; style fix.
10110 (Incremental_inputs::report_obejct): Save mtime; style fix.
10111 (Incremental_inputs::report_script): Save mtime; style fix.
10112 (Incremental_inputs::finalize_inputs): Style fix.
10113 (Incremental_inputs::finalize): Style fix.
10114 (Incremental_inputs::create_input_section_data): Store inputs
10115 mtime.
10116 * incremental.h (Incremental_inputs::report_script): Add mtime
10117 argument.
10118 (Incremental_inputs::Input_info::Input_info): Intialize only one
10119 union member.
10120 (Incremental_inputs::Input_info::archive): Move to nameless
10121 union.
10122 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10123 (Incremental_inputs::Input_info::script): Move to nameless union.
10124 (Incremental_inputs::mtime): New field.
10125 * script.cc (read_input_script): Pass file mtime to
10126 Incremental_input.
10127 * script.h (Script_info::inputs): Style fix.
10128
10129 2009-07-01 Ian Lance Taylor <ian@airs.com>
10130
10131 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10132 instead of 32.
10133
10134 2009-06-24 Ian Lance Taylor <iant@google.com>
10135
10136 PR 10156
10137 * layout.cc (Layout::choose_output_section): If we find an
10138 existing section, update the flags.
10139 (Layout::create_notes): New function, broken out of
10140 Layout::finalize.
10141 (Layout::finalize): Don't create note sections.
10142 (Layout::create_note): Don't crash if linker script discards
10143 section.
10144 (Layout::create_gold_note): Likewise.
10145 (Layout::create_build_id): Likewise. Don't set
10146 after_input_sections on the section.
10147 (Layout::create_executable_stack_info): Remove target parameter.
10148 Change caller.
10149 * layout.h (class Layout): Declare create_notes. Update
10150 declaration of create_executable_stack_info.
10151 * gold.cc (queue_middle_tasks): Call create_notes.
10152 * output.cc (Output_section::update_flags_for_input_section): Move
10153 here from output.h. If SHF_ALLOC flag is newly set, mark address
10154 invalid.
10155 * output.h (Output_data::mark_address_invalid): New function.
10156 (class Output_section): Only declare, not define,
10157 update_flags_for_input_section. Remove set_flags.
10158
10159 2009-06-24 Ian Lance Taylor <iant@google.com>
10160
10161 * script-sections.cc (Output_section_definition::
10162 set_section_addresses): Rename shadowing local load_address to
10163 laddr.
10164
10165 2009-06-24 Ian Lance Taylor <iant@google.com>
10166
10167 PR 10244
10168 * reloc.cc (relocate_sections): Skip empty relocation sections.
10169
10170 2009-06-23 Ian Lance Taylor <iant@google.com>
10171
10172 PR 10156
10173 * layout.cc (Layout::create_note): Use choose_output_section
10174 rather than make_output_section.
10175
10176 2009-06-23 Ian Lance Taylor <iant@google.com>
10177
10178 PR 10237
10179 * options.cc (General_options::parse_V): Set printed_version_.
10180 (General_options::General_options): Initialize printed_version_.
10181 * options.h (class General_options): Add printed_version_ field.
10182 * gold.cc (queue_initial_tasks): If there are no input files,
10183 don't give a fatal error if we printed the version information.
10184 (queue_middle_tasks): If using -r with a shared object, give a
10185 fatal error rather than an ordinary error.
10186
10187 2009-06-23 Ian Lance Taylor <iant@google.com>
10188
10189 PR 10219
10190 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10191 (Layout::make_output_section): Set have_stabstr_section_ if we see
10192 a .stab*str section.
10193 (Layout::finalize): Call link_stabs_sections.
10194 (Layout::link_stabs_sections): New file.
10195 * layout.h (class Layout): Add have_stabstr_section_ field.
10196 Declare link_stabs_sections.
10197
10198 2009-06-23 Doug Kwan <dougkwan@google.com>
10199
10200 * Makefile.am (libgold_a_LIBADD): New.
10201 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10202 * Makefile.in: Regenerate.
10203 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10204 * configure: Regenerate.
10205 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10206 * fileread.cc: Include sys/state.h
10207 * gold.h: Declare memmem and strndup if found missing.
10208 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10209
10210 2009-06-23 Ian Lance Taylor <iant@google.com>
10211
10212 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10213 * configure: Rebuild.
10214
10215 2009-06-23 Ian Lance Taylor <iant@google.com>
10216
10217 PR 10147
10218 * object.cc (Object::section_contents): Don't try to get a view if
10219 the section has length zero.
10220 (Object::handle_gnu_warning_section): If the section is empty, use
10221 the name of the section as the warning.
10222
10223 2009-06-23 Ian Lance Taylor <iant@google.com>
10224
10225 PR 10133
10226 * stringpool.h (class Stringpool_template): Add optimize_ field.
10227 (Stringpool_template::set_optimize): New function.
10228 * stringpool.cc (Stringpool_template::Stringpool_template):
10229 Initialize optimize_ field.
10230 (Stringpool_template::set_string_offsets): Test local optimize
10231 fild rather than parameter.
10232 * layout.cc (Layout::Layout): Call set_optimize on the section
10233 name stringpool.
10234
10235 2009-06-22 Ian Lance Taylor <iant@google.com>
10236
10237 PR 10030
10238 * yyscript.y: Parse TARGET.
10239 * script.cc (script_set_target): New function.
10240 * script-c.h (script_set_target): Declare.
10241 * options.cc (General_options::string_to_object_format): Rename
10242 from string_to_object_format in anonymous namespace. Change
10243 callers.
10244 * options.h (class General_options): Declare
10245 string_to_object_format.
10246
10247 2009-06-22 Ian Lance Taylor <iant@google.com>
10248
10249 * script-sections.cc (Script_sections::create_segments): Don't put
10250 program headers in a PT_LOAD segment if -n or -N.
10251
10252 2009-06-22 Ian Lance Taylor <iant@google.com>
10253
10254 PR 10141
10255 * options.h (class General_options): Add -z lazy and -z now. Sort
10256 -z options into alphabetical order.
10257 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10258
10259 2009-06-21 Ian Lance Taylor <iant@google.com>
10260
10261 * layout.cc (Layout::make_output_section): Call
10262 Target::new_output_section.
10263 (Layout::attach_allocated_section_to_segment): Put large section
10264 sections in a separate load segment with the large segment flag
10265 set.
10266 (Layout::segment_precedes): Sort large data segments after other
10267 load segments.
10268 (align_file_offset): New static function.
10269 (Layout::set_segment_offsets): Use align_file_offset.
10270 * output.h (class Output_section): Add is_small_section_ and
10271 is_large_section_ fields.
10272 (Output_section::is_small_section): New function.
10273 (Output_section::set_is_small_section): New function.
10274 (Output_section::is_large_section): New function.
10275 (Output_section::set_is_large_section): New function.
10276 (Output_section::is_large_data_section): New function.
10277 (class Output_segment): Add is_large_data_segment_ field.
10278 (Output_segment::is_large_data_segment): New function.
10279 (Output_segment::set_is_large_data_segment): New function.
10280 * output.cc (Output_section::Output_section): Initialize new
10281 fields.
10282 (Output_segment::Output_segment): Likewise.
10283 (Output_segment::add_output_section): Add assertion that large
10284 data sections always go in large data segments. Force small data
10285 sections to the end of the list of data sections. Force small BSS
10286 sections to the start of the list of BSS sections. For large BSS
10287 sections to the end of the list of BSS sections.
10288 * symtab.h (class Symbol): Declare is_common_shndx.
10289 (Symbol::is_defined): Check Symbol::is_common_shndx.
10290 (Symbol::is_common): Likewise.
10291 (class Symbol_table): Define enum Commons_section_type. Update
10292 declarations. Add small_commons_ and large_commons_ fields.
10293 * symtab.cc (Symbol::is_common_shndx): New function.
10294 (Symbol_table::Symbol_table): Initialize new fields.
10295 (Symbol_table::add_from_object): Put small and large common
10296 symbols in the right list.
10297 (Symbol_table::sized_finalized_symbol): Check
10298 Symbol::is_common_shndx.
10299 (Symbol_table::sized_write_globals): Likewise.
10300 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10301 common symbol lists. Don't call do_allocate_commons_list if the
10302 list is empty.
10303 (Symbol_table::do_allocate_commons_list): Remove is_tls
10304 parameter. Add comons_section_type parameter. Change all
10305 callers. Handle small and large common symbols.
10306 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10307 Symbol::is_common_shndx.
10308 * resolve.cc (symbol_to_bits): Likewise.
10309 * target.h (Target::small_common_shndx): New function.
10310 (Target::small_common_section_flags): New function.
10311 (Target::large_common_shndx): New function.
10312 (Target::large_common_section_flags): New function.
10313 (Target::new_output_section): New function.
10314 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10315 small_common_section_flags, and large_common_section_flags
10316 fields.
10317 (Target::do_new_output_section): New virtual function.
10318 * arm.cc (Target_arm::arm_info): Initialize new fields.
10319 * i386.cc (Target_i386::i386_info): Likewise.
10320 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10321 Likewise.
10322 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10323 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10324 (Target_x86_64::do_new_output_section): New function.
10325 * configure.ac: Define conditional MCMODEL_MEDIUM.
10326 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10327 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10328 (large_LDFLAGS): Define.
10329 * testsuite/large.c: New file.
10330 * testsuite/testfile.cc (Target_test::test_target_info):
10331 Initialize new fields.
10332 * configure, testsuite/Makefile.in: Rebuild.
10333
10334 2009-06-05 Doug Kwan <dougkwan@google.com>
10335
10336 * Makefile.am (CCFILES): Add target.cc.
10337 * Makefile.in: Regenerate.
10338 * i386.cc (class Target_i386): Define new virtual method to
10339 override do_is_local_label_name in parent.
10340 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10341 local symbols if --discard-locals or -X is given.
10342 * options.h (class General_options): Declare new options
10343 '--discard-locals' and '-X' for discarding locals.
10344 * target.h (class Target): Define new methods is_local_label_name.
10345 Declare new virtual method do_is_local_label_name.
10346 * target.cc: New file.
10347 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10348 (check_SCRIPTS): Add discard_locals_test.sh.
10349 (check_DATA): Add discard_local_tests.syms.
10350 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10351 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10352 * testsuite/Makefile.in: Regenerate.
10353 * testsuite/discard_locals_test.c: New file.
10354 * testsuite/discard_locals_test.sh: Same.
10355
10356 2009-06-05 Doug Kwan <dougkwan@google.com>
10357
10358 * object.cc (Sized_relobj::Sized_relobj): Initialize
10359 discarded_eh_frame_shndx_ to -1U.
10360 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10361 section.
10362 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10363 a discarded .eh_frame section.
10364 (Sized_relobj::do_finalize_local_symbols): Ditto.
10365 * object.h (class Sized_relobj): Declare new member
10366 discarded_eh_frame_shndx_.
10367 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10368 (local_labels_test.o, local_labels_test): New rules.
10369 * testsuite/Makefile.in: Regenerate.
10370
10371 2009-06-04 Doug Kwan <dougkwan@google.com>
10372
10373 * layout.cc (Layout::section_name_mapping): Add mapping for
10374 special ARM sections.
10375
10376 2009-06-03 Doug Kwan <dougkwan@google.com>
10377
10378 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10379 (utils::has_overflow): Same.
10380
10381 2009-06-03 Ian Lance Taylor <iant@google.com>
10382
10383 * layout.cc (Layout::section_name_mapping): New array, replacing
10384 Layout::linkonce_mapping.
10385 (Layout::section_name_mapping_count): New variable, replacing
10386 Layout::linkonce_mapping_count.
10387 (Layout::linkonce_output_name): Remove.
10388 (Layout::output_section_name): Rewrite.
10389 * layout.h (class Layout): Rename Linkonce_mapping to
10390 Section_name_mapping, linkonce_mapping to section_name_mapping,
10391 linkonce_mapping_count to section_name_mapping_count. Don't
10392 declare linkonce_output_name.
10393
10394 2009-06-03 Doug Kwan <dougkwan@google.com>
10395
10396 * gold/arm.cc (namespace utils): New.
10397 (Target_arm::reloc_is_non_pic): Define new method.
10398 (class Arm_relocate_functions): New.
10399 (Target_arm::Relocate::relocate): Handle relocation types used by
10400 Android.
10401
10402 2009-06-03 Ian Lance Taylor <iant@google.com>
10403
10404 * arm.cc (Target_arm::scan::global): Use || instead of |.
10405
10406 2009-06-02 Doug Kwan <dougkwan@google.com>
10407
10408 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10409 issued_non_pic_error_.
10410 (class Target_arm::Scan): Declare new method check_non_pic.
10411 Define new method symbol_needs_plt_entry.
10412 Declare new data member issued_non_pic_error_.
10413 (class Target_arm::Relocate): Declare new method
10414 should_apply_static_reloc.
10415 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10416 (Target_arm::Scan::check_non_pic): Define new method.
10417 (Target_arm::Scan::local): Handle a small subset of reloc types used
10418 by Android.
10419 (Target_arm::Scan::local): Same.
10420 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10421
10422 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10423
10424 * incremental.cc (Incremental_inputs::report_command_line): Filter
10425 out --incremental-* options.
10426
10427 2009-05-29 Doug Kwan <dougkwan@google.com>
10428
10429 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10430 template class.
10431 (class Target_arm): Update comment.
10432 (Target_arm::Target_arm): Initialize new data members GOT_,
10433 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10434 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10435 and Target_arm::rel_dyn_section.
10436 Declare new_enum Target_arm::Got_type.
10437 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10438 and DYNBSS_.
10439 Update commments for member do_dynsym_value.
10440 (Target_arm::got_size, Target_arm::plt_section,
10441 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10442 new methods inside class defintion.
10443 (Target_arm::got_section): Define new method.
10444 (Target_arm::rel_dyn_section): Same.
10445 (Output_data_plt_arm): New template class.
10446 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10447 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10448 (Output_data_plt_arm::add_entry): Same.
10449 (Output_data_plt_arm::first_plt_entry): Define new
10450 static data member for PLT instruction template.
10451 (Output_data_plt_arm::plt_entry): Same.
10452 (Output_data_plt_arm::do_write): Define new method.
10453 (Target_arm::make_plt_entry): Same.
10454 (Target_arm::do_finalize_sections): Same.
10455 (Target_arm::do_dynsym_value): Same.
10456
10457 2009-05-28 Doug Kwan <dougkwan@google.com>
10458
10459 * Makefile.am (TARGETSOURCES): Add arm.cc.
10460 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10461 * Makefile.in: Regenerate.
10462 * arm.cc: New file.
10463 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10464
10465 2009-05-26 Doug Kwan <dougkwan@google.com>
10466
10467 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10468 (General_options::check_excluded_libs): Strip off directories in
10469 archive name before matching like GNU ld does.
10470 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10471 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10472 (exclude_libs_test_LDFLAGS): Add linker option
10473 -Wl,--exclude-libs,libexclude_libs_test_3
10474 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10475 an explicit archive without using -l.
10476 (alt/libexclude_libs_test_3.a): New make rule.
10477 * testsuite/Makefile.in: Regenerate.
10478 * testsuite/exclude_libs_test.c : Declare lib3_default().
10479 (main): Call it.
10480 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10481 * exclude_libs_test_3.c: New file.
10482
10483 2009-05-26 Nick Clifton <nickc@redhat.com>
10484
10485 * po/id.po: New Indonesian translation.
10486 * po/gold.pot: Updated template file.
10487
10488 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10489
10490 * testsuite/Makefile.am: Add -ffunction-sections to compile
10491 gc_comdat_test files. Add -Wl,--gc-sections to build
10492 gc_comdat_test.
10493 * testsuite/Makefile.in: Regenerate.
10494 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10495
10496 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10497
10498 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10499 kept comdat section was garbage collected.
10500 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10501 * testsuite/Makefile.in: Regenerate.
10502 * testsuite/gc_comdat_test.sh: New file.
10503 * testsuite/gc_comdat_test_1.cc: New file.
10504 * testsuite/gc_comdat_test_2.cc: New file.
10505
10506 2009-05-19 Doug Kwan <dougkwan@google.com>
10507
10508 * archive.cc (Archive::Archive): Move constructor from archive.h
10509 to here. Initialize no_export_.
10510 (Archive::get_elf_object_for_member): Set no_export flag of object.
10511 * archive.h (Archive::Archive): Move constructor body to
10512 archive.cc.
10513 (Archive::no_export): New method.
10514 (Archive::no_export_): New field.
10515 * object.h (Object::Object): Initialize no_export_ to false.
10516 (Object::no_export, Object::set_no_export): New methods.
10517 (Object::no_export_): New field.
10518 * options.cc (General_options::parse_exclude_libs): New method.
10519 (General_options::check_excluded_libs) Same.
10520 * options.h (exclude_libs): New option.
10521 (General_options::check_excluded_libs): New method declaration.
10522 (General_options::excluded_libs_): New field.
10523 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10524 default or protected visibility if an object has no-export flag set.
10525 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10526 (check_SCRIPTS): Add exclude_libs_test.sh.
10527 (check_DATA): Add exclude_libs_test.syms.
10528 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10529 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10530 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10531 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10532 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10533 libexclude_libs_test_2.a): New rules.
10534 * testsuite/Makefile.in: Regenerate.
10535 * testsuite/exclude_libs_test.c: New file.
10536 * testsuite/exclude_libs_test.sh: Ditto.
10537 * testsuite/exclude_libs_test_1.c: Ditto.
10538 * testsuite/exclude_libs_test_2.c: Ditto.
10539
10540 2009-05-15 Ian Lance Taylor <iant@google.com>
10541
10542 * configure.ac: Check for declarations for cases where libiberty.h
10543 checks HAVE_DECL_xxx.
10544 * configure, config.in: Rebuild.
10545
10546 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10547
10548 * gold.h (Incremental_argument_list): Remove (invalid) forward
10549 declaration.
10550 * incremental.cc (Incremental_inputs::report_achive): New method.
10551 (Incremental_inputs::report_object): New method.
10552 (Incremental_inputs::report_script): New method.
10553 (Incremental_inputs::finalize_inputs): New method.
10554 (Incremental_inputs::finalize): Call finalize_inputs().
10555 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10556 Create inputs entries.
10557 * incremental.h (Incremental_input_type): New enum.
10558 (Incremental_inputs::Incremental_input): Initialize new fields.
10559 (Incremental_inputs::report_inputs): New method.
10560 (Incremental_inputs::report_achive): New method.
10561 (Incremental_inputs::report_object): New method.
10562 (Incremental_inputs::report_script): New method.
10563 (Incremental_inputs::finalize_inputs): New method.
10564 (Incremental_inputs::Input_info): New struct.
10565 (Incremental_inputs::Input_info_map): New typedef.
10566 (Incremental_inputs::lock_): New field.
10567 (Incremental_inputs::Inputs_): New field.
10568 (Incremental_inputs::Inputs_map): New field.
10569 * main.cc (main): Call Incremental_input::report_inputs.
10570 * options.h (Input_argument_list): Typedef moved from
10571 Input_arguments.
10572 (Input_file_group::Files): Remove, use ::Input_argument_list.
10573 (Input_file_group::Input_argument_list): Remove, use
10574 ::Input_argument_list.
10575 * plugin.cc (Plugin_manager::add_input_file): Add error in
10576 incremental build.
10577 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10578 functions.
10579 * script.cc (read_input_script): Call
10580 Incremental_input::report_script.
10581 * script.h (Script_info): New class.
10582
10583 2009-04-27 Ian Lance Taylor <iant@google.com>
10584
10585 * x86_64.cc (do_adjust_output_section): Set entsize to
10586 plt_entry_size.
10587
10588 2009-04-23 Elliott Hughes <enh@google.com>
10589
10590 * output.cc (Output_file::close): After short writes, continue
10591 writing from the correct offset in the buffer being written.
10592
10593 2009-04-23 Chris Demetriou <cgd@google.com>
10594
10595 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10596 * configure: Regenerate.
10597 * config.in: Regenerate.
10598 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10599 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10600
10601 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10602
10603 * incremental.cc (Incremental_inputs_header_data): Renamed from
10604 Incremental_input_header_data.
10605 (Incremental_inputs_header_data::data_size): New field.
10606 (Incremental_inputs_header_data::put_input_file_count): Renamed
10607 from input_file_count.
10608 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10609 from command_line_offset.
10610 (Incremental_inputs_header_data::put_reserved): Renamed from
10611 put_reserved.
10612 (Incremental_inputs_entry_data): Renamed from
10613 Incremental_input_entry_data.
10614 (Incremental_inputs_entry_data::data_size): New field.
10615 (Incremental_inputs::report_command_line): New method.
10616 (Incremental_inputs::finalize): New method.
10617 (Incremental_inputs::create_incremental_inputs_data): New method.
10618 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10619 * incremental.h: New file.
10620 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10621 (Layout::finalize): Create incremental inputs section in
10622 incremental builds.
10623 (Layout::create_incremental_info_sections): New method.
10624 * layout.h (Layout::incremental_inputs): New method.
10625 (Layout::create_incremental_info_sections): New method.
10626 (Layout::incremental_inputs_): New field.
10627 * main.cc (main): Notify Incremental_input of the command line.
10628
10629 2009-04-01 Ian Lance Taylor <iant@google.com>
10630 Mikolaj Zalewski <mikolajz@google.com>
10631
10632 * gold.h (reserve_unordered_map): Define, three versions, one for
10633 each version of Unordered_map.
10634 * layout.cc (Layout::Layout): Remove options parameter. Add
10635 number_of_input_files parameter. Don't initialize options_.
10636 Initialize number_of_input_files_ and resized_signatures_. Move
10637 sections_are_attached_.
10638 (Layout::layout_group): Reserve space for group_signatures_.
10639 (Layout::find_or_add_kept_section): Change name parameter to be a
10640 reference. Resize signatures_ map when it gets large enough.
10641 (Layout::layout_eh_frame): Use parameters->options() instead of
10642 this->options_.
10643 (Layout::make_output_section): Likewise.
10644 (Layout::attach_allocated_section_to_segment): Likewise.
10645 (Layout::finalize, Layout::create_executable_stack): Likewise.
10646 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10647 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10648 * layout.h (class Layout): Update declarations. Remove options_
10649 field. Add number_of_input_files_ and resized_signatures_
10650 fields. Move sections_are_attached_ field.
10651 * main.cc (main): Pass number of input files to Layout
10652 constructor. Don't pass options.
10653
10654 2009-03-30 Ian Lance Taylor <iant@google.com>
10655
10656 * ffsll.c (ffsll): Correct implementation.
10657
10658 2009-03-27 Ian Lance Taylor <iant@google.com>
10659
10660 * ffsll.c: New file.
10661 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10662 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10663 * ftruncate.c (ftruncate): Declare before definition.
10664 * mremap.c (mremap): Likewise.
10665 * pread.c (pread): Likewise.
10666 * configure, Makefile.in, config.in: Rebuild.
10667
10668 * mremap.c: New file.
10669 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10670 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10671 (mremap): Declare if HAVE_MREMAP is not defined.
10672 * configure, Makefile.in, config.in: Rebuild.
10673
10674 2009-03-27 Cary Coutant <ccoutant@google.com>
10675
10676 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10677 position independent.
10678 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10679 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10680
10681 2009-03-24 Cary Coutant <ccoutant@google.com>
10682
10683 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10684 an executable.
10685 (needs_dynamic_reloc): Likewise.
10686
10687 2009-03-24 Ian Lance Taylor <iant@google.com>
10688
10689 * yyscript.y (file_cmd): Recognize EXTERN.
10690 (extern_name_list, extern_name_list_body): New nonterminals.
10691 * script.cc (script_add_extern): Define.
10692 * script-c.h (script_add_extern): Declare.
10693
10694 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10695
10696 * object.cc (is_elf_object): Define.
10697 * object.h (is_elf_object): Declare.
10698 * archive.cc (Archive::get_elf_object_for_member): Call
10699 is_elf_object.
10700 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10701
10702 2009-03-24 Elliott Hughes <enh@google.com>
10703
10704 * output.cc (Output_file::map_anonymous): Define.
10705 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10706 try an anonymous one. Report the size if the mmap fails.
10707 * output.h (class Output_file): Declare map_anonymous.
10708
10709 2009-03-24 Ian Lance Taylor <iant@google.com>
10710
10711 * target-select.cc (instantiate_target): Don't acquire the lock if
10712 the instantiated_target_ field has already been set.
10713
10714 2009-03-23 Ian Lance Taylor <iant@google.com>
10715
10716 * gold-threads.h (class Initialize_lock): Define.
10717 * gold-threads.cc (class Initialize_lock_once): Define.
10718 (initialize_lock_control): New static variable.
10719 (initialize_lock_pointer): New static variable.
10720 (initialize_lock_once): New static function.
10721 (Initialize_lock::Initialize_lock): Define.
10722 (Initialize_lock::initialize): Define.
10723 * target-select.h: Include "gold-threads.h".
10724 (class Target_selector): Add lock_ and initialize_lock_ fields.
10725 Don't define instantiate_target, just declare it.
10726 * target-select.cc (Target_selector::Target_selector): Initialize
10727 new fields.
10728 (Target_selector::instantiate_target): Define.
10729 * descriptors.h: Include "gold-threads.h".
10730 (class Descriptors): Add initialize_lock_ field.
10731 * descriptors.cc (Descriptors::Descriptors): Initialize new
10732 field.
10733 (Descriptors::open): Use initialize_lock_ field
10734 * errors.h (class Errors): Add initialize_lock_ field.
10735 * errors.cc (Errors::Errors): Initialize new field.
10736 (Errors::initialize_lock): Use initialize_lock_ field.
10737 * powerpc.cc (class Target_selector_powerpc): Remove
10738 instantiated_target_ field. In do_recognize call
10739 instantiate_target rather than do_instantiate_target. In
10740 do_instantiate_target just allocate a new target.
10741 * sparc.cc (class Target_selector_sparc): Likewise.
10742
10743 * freebsd.h: New file.
10744 * i386.cc: Include "freebsd.h".
10745 (Target_i386): Derive from Target_freebsd rather than
10746 Sized_target.
10747 (Target_selector_i386): Derive from Target_selector_freebsd rather
10748 than Target_selector.
10749 * x86_64.cc: Include "freebsd.h".
10750 (Target_x86_64): Derive from Target_freebsd rather than
10751 Sized_target.
10752 (Target_selector_x86_64): Derive from Target_selector_freebsd
10753 rather than Target_selector.
10754 * target.h (class Target): Add adjust_elf_header and
10755 do_adjust_elf_header.
10756 * output.cc (Output_file_header:: do_sized_write): Call target
10757 adjust_elf_header routine.
10758 * configure.tgt: Set targ_osabi.
10759 * configure.ac: Define GOLD_DEFAULT_OSABI.
10760 * parameters.cc (Parameters::default_target): Pass
10761 GOLD_DEFAULT_OSABI to select_target.
10762 * target-select.h (class Target_selector): Make instantiate_target
10763 protected rather than private.
10764 * Makefile.am (HFILES): Add freebsd.h.
10765 * configure, Makefile.in, config.in: Rebuild.
10766
10767 * merge.cc (do_add_input_section): Correct pend value. Change
10768 message about last entry not being null terminated from error to
10769 warning.
10770
10771 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10772
10773 * incremental.cc: New file.
10774 * Makefile.am (CCFILES): Add incremental.cc.
10775 * Makefile.in: Rebuild.
10776
10777 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10778
10779 * layout.cc (Layout::output_section_name): Preserve names
10780 of '.note.' sections.
10781
10782 2009-03-19 Ian Lance Taylor <iant@google.com>
10783
10784 * descriptors.cc (Descriptors::open): Check that the options are
10785 valid before using them.
10786
10787 2009-03-18 Ian Lance Taylor <iant@google.com>
10788
10789 * script-sections.h: Include <list>.
10790 (class Script_sections): Change Sections_elements from std::vector
10791 to std::list. Typedef public Elements_iterator. Add
10792 orphan_section_placement_, data_segment_align_start_, and
10793 saw_data_segment_align_ fields. Remove data_segment_align_index_
10794 field.
10795 * script-sections.cc (class Orphan_section_placement): New class.
10796 (class Sections_element): Add virtual functions is_relro and
10797 orphan_section_init. Remove virtual function place_orphan_here.
10798 (class Output_section_definition): Add is_relro and
10799 orphan_section_init. Remove place_orphan_here.
10800 (class Orphan_output_section): Likewise.
10801 (Script_sections::Script_sections): Update for field changes.
10802 (Script_sections::data_segment_align): Set saw_data_segment_align_
10803 and data_segment_align_start_, not data_segment_align_index.
10804 (Script_sections::data_segment_relro_end): Check
10805 saw_data_segment_align_. Use data_segment_align_start_ rather
10806 than data_segment_align_index_.
10807 (Script_sections::place_orphan): Rewrite to use
10808 Orphan_section_placement.
10809
10810 2009-03-17 Ian Lance Taylor <iant@google.com>
10811
10812 * archive.cc (Archive::add_symbols): Check for a version attached
10813 to the symbol name in the archive map.
10814 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10815 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10816 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10817 (ver_test_11.a): New target.
10818 * testsuite/Makefile.in: Rebuild.
10819
10820 * configure.ac: Check for chsize and posix_fallocate. Replace
10821 ftruncate.
10822 * ftruncate.c: New file, from gnulib.
10823 * output.cc (posix_fallocate): Define dummy version if not
10824 HAVE_POSIX_FALLOCATE.
10825 (Output_file::map): Call posix_fallocate rather than lseek and
10826 write.
10827 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10828 * configure, Makefile.in, config.in: Rebuild.
10829
10830 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10831
10832 * layout.h (Layout::create_note): Add section_name parameter.
10833 * layout.cc (Layout::create_note): Likewise.
10834 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10835
10836 2009-03-17 Ian Lance Taylor <iant@google.com>
10837
10838 * descriptors.cc: Include "options.h".
10839 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10840 (Descriptors::open): Always use O_CLOEXEC when opening a new
10841 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10842 then set FD_CLOEXEC.
10843
10844 * sparc.cc (class Target_sparc): Add has_got_section.
10845 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10846 make sure we have a GOT section.
10847
10848 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10849 (Target_sparc::Scan::local): Likewise.
10850 (Target_sparc::Scan::global): Likewise.
10851 (Target_sparc::Relocate::relocate): Likewise.
10852 (Target_sparc::Relocate::relocate_tls): Likewise.
10853
10854 * symtab.cc (Symbol_table::define_default_version): New function,
10855 broken out of add_from_object.
10856 (Symbol_table::add_from_object): Call define_default_version.
10857 (Symbol_table::define_special_symbol): Add resolve_oldsym
10858 parameter. Change all callers. If the version for a symbol comes
10859 from a version script, resolve it with the symbol with the same
10860 name with no version. Also add the symbol without a version if
10861 appropriate.
10862 (do_define_in_output_data): If resolving with oldsym, don't delete
10863 sym.
10864 (do_define_in_output_segment): Likewise.
10865 (do_define_as_constant): Likewise.
10866 * symtab.h (class Symbol_table): Update declarations.
10867
10868 2009-03-13 Ian Lance Taylor <iant@google.com>
10869
10870 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10871 (Read_symbols::requeue): New function.
10872 (Read_symbols::do_read_symbols): If make_elf_object fails because
10873 the target type is not configured, and the file was searched for,
10874 issue a warning and retry with the next directory.
10875 (Add_symbols::run): If the file has an incompatible format, and
10876 it was searched for, requeue the Read_symbols task. On error,
10877 release the object.
10878 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10879 dirindex parameter to constructor. Change all callers. Declare
10880 incompatible_warning and requeue.
10881 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10882 input_argument_ and input_group_ fields. Add them to
10883 constructor. Change all callers.
10884 (class Read_script): Add dirindex_ field. Add it to constructor.
10885 Change all callers.
10886 * archive.cc (Archive::setup): Remove input_objects parameter.
10887 Change all callers.
10888 (Archive::get_file_and_offset): Likewise.
10889 (Archive::read_all_symbols): Likewise.
10890 (Archive::read_symbols): Likewise.
10891 (Archive::get_elf_object_for_member): Remove input_objects
10892 parameter. Add punconfigured parameter. Change all callers.
10893 (Archive::add_symbols): Change return type to bool. Check return
10894 value of include_member.
10895 (Archive::include_all_members): Likewise.
10896 (Archive::include_member): Change return type to bool. Return
10897 false if first included object has incompatible target. Set
10898 included_member_ field.
10899 (Add_archive_symbols::run): If add_symbols returns false, requeue
10900 Read_symbols task.
10901 * archive.h (class Archive): Add included_member_ field.
10902 Initialize it in constructor. Add input_file and searched_for
10903 methods. Update declarations.
10904 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10905 input_argument_ fields. Add them to constructor. Change all
10906 callers.
10907 * script.cc: Include "target-select.h".
10908 (class Parser_closure): Add skip_on_incompatible_target_ and
10909 found_incompatible_target_ fields. Add
10910 skip_on_incompatible_target parameter to constructor. Change all
10911 callers. Add methods skip_on_incompatible_target,
10912 clear_skip_on_incompatible_target, found_incompatible_target, and
10913 set_found_incompatible_target.
10914 (read_input_script): Add dirindex parameter. Change all callers.
10915 If parser finds an incompatible target, requeue Read_symbols
10916 task.
10917 (script_set_symbol): Clear skip_on_incompatible_target in
10918 closure.
10919 (script_add_assertion, script_parse_option): Likewise.
10920 (script_start_sections, script_add_phdr): Likewise.
10921 (script_check_output_format): New function.
10922 * script.h (read_input_script): Update declaration.
10923 * script-c.h (script_check_output_format): Declare.
10924 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10925 (ignore_cmd): Remove OUTPUT_FORMAT.
10926 * fileread.cc (Input_file::Input_file): Add explicit this.
10927 (Input_file::will_search_for): New function.
10928 (Input_file::open): Add pindex parameter. Change all callers.
10929 * fileread.h (class Input_file): Add input_file_argument method.
10930 Declare will_search_for. Update declarations.
10931 * object.cc (make_elf_object): Add punconfigured parameter.
10932 Change all callers.
10933 * object.h (class Object): Make input_file public. Add
10934 searched_for method.
10935 (make_elf_object): Update declaration.
10936 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10937 restart search.
10938 * dirsearch.h (class Dirsearch): Update declaration.
10939 * options.h (class General_options): Add --warn-search-mismatch.
10940 * parameters.cc (Parameters::is_compatible_target): New function.
10941 * parameters.h (class Parameters): Declare is_compatible_target.
10942 * workqueue.cc (Workqueue::add_blocker): New function.
10943 * workqueue.h (class Workqueue): Declare add_blocker.
10944
10945 * fileread.cc (Input_file::open): Remove options parameter.
10946 Change all callers.
10947 (Input_file::open_binary): Likewise.
10948 * script.cc (read_input_script): Likewise.
10949 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10950 options parameter from constructor. Change all callers.
10951 (class Read_script): Likewise.
10952 * fileread.h (class Input_file): Update declarations.
10953 * script.h (read_input_script): Update declaration.
10954
10955 2009-03-10 Nick Clifton <nickc@redhat.com>
10956
10957 * po/es.po: New Spanish translation.
10958
10959 2009-03-06 Cary Coutant <ccoutant@google.com>
10960
10961 * options.cc (parse_short_option): Keep dash_z from registering itself.
10962
10963 2009-03-03 Ian Lance Taylor <iant@google.com>
10964
10965 PR 9918
10966 * target-reloc.h (relocate_section): Pass output_section to
10967 relocate.
10968 * i386.cc (Target_i386::should_apply_static_reloc): Add
10969 output_section parameter. Change all callers.
10970 (Target_i386::Relocate::relocate): Add output_section parameter.
10971 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10972 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10973 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10974 * testsuite/two_file_shared.sh: New script.
10975 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10976 (check_DATA): Add two_file_shared.dbg.
10977 (two_file_shared.dbg): New target.
10978 * testsuite/Makefile.in: Rebuild.
10979
10980 2009-03-01 Ian Lance Taylor <iant@google.com>
10981
10982 * configure.ac: Check for byteswap.h.
10983 * configure: Rebuild.
10984 * config.in: Rebuild.
10985
10986 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10987
10988 * layout.cc (Layout::find_or_add_kept_section): New function.
10989 (Layout::add_comdat): Removed.
10990 * layout.h (struct Kept_section): Move out of class Layout.
10991 Remove trailing underscores from field names. Add group_sections
10992 field. Rename group_ field to is_group. Change all uses.
10993 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10994 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10995 comdat_groups_ field.
10996 (Sized_relobj::include_section_group): Use
10997 find_or_add_kept_section and Kept_section::group_sections.
10998 (Sized_relobj::include_linkonce_section): Likewise.
10999 * object.cc (class Sized_relobj): Don't define Comdat_group or
11000 Comdat_group_table. Remove find_comdat_group and
11001 add_comdat_group. Remove comdat_groups_ field.
11002 * plugin.cc (include_comdat_group): Use
11003 Layout::find_or_add_kept_section.
11004
11005 2009-02-28 Ian Lance Taylor <iant@google.com>
11006
11007 * README: --gc-sections and map files are now supported. Document
11008 some build requirements.
11009
11010 PR 6992
11011 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11012 relocatable link set the value of the section symbol to zero.
11013 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11014 relocatable link don't include the section address in the local
11015 symbol value.
11016
11017 2009-02-27 Ian Lance Taylor <iant@google.com>
11018
11019 PR 6811
11020 * options.h (class Search_directory): Add is_system_directory.
11021 (class General_options): Declare is_in_system_directory.
11022 * options.cc (get_relative_sysroot): Make static.
11023 (get_default_sysroot): Make static.
11024 (General_optoins::is_in_system_directory): New function.
11025 * fileread.cc (Input_file::is_in_system_directory): New function.
11026 * fileread.h (class Input_file): Declare is_in_system_directory.
11027 * object.h (class Object): Add is_in_system_directory.
11028 (class Input_objects): Remove system_library_directory_ field.
11029 * object.cc (Input_objects::add_object): Don't set
11030 system_library_directory_.
11031 (input_objects::found_in_system_library_directory): Remove.
11032 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11033 parameter. Change all callers.
11034 (Symbol_table::sized_write_globals): Likewise.
11035 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11036 Call Object::is_in_system_directory.
11037 * symtab.h (class Symbol_table): Update declarations.
11038
11039 PR 5990
11040 * descriptors.h (Open_descriptor): Add is_on_stack field.
11041 * descriptors.cc (Descriptors::open): If the descriptor is on the
11042 top of the stack, remove it. Initialize is_on_stack field.
11043 (Descriptors::release): Only add pod to stack if it is not on the
11044 stack already.
11045 (Descriptors::close_some_descriptor): Clear stack_next and
11046 is_on_stack fields.
11047
11048 PR 7091
11049 * output.cc (Output_section::find_starting_output_address): Rename
11050 from starting_output_address; add PADDR parameter; change return
11051 type.
11052 * output.h (class Output_section): Declare
11053 find_starting_output_address instead of starting_output_address.
11054 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11055 section symbol for which we can't find a merge section.
11056
11057 PR 9836
11058 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11059 hidden or internal, force the symbol to be local.
11060 * resolve.cc (Symbol::override_visibility): Define.
11061 (Symbol::override_base): Use override_visibility.
11062 (Symbol_table::resolve): Likewise.
11063 (Symbol::override_base_with_special): Likewise.
11064 (Symbol_table::override_with_special): If the visibility is hidden
11065 or internal, force the symbol to be local.
11066 * symtab.h (class Symbol): Add set_visibility and
11067 override_visibility.
11068 * testsuite/ver_test_1.sh: New file.
11069 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11070 (check_DATA): Add ver_test_1.syms.
11071 (ver_test_1.syms): New target.
11072 * testsuite/Makefile.in: Rebuild.
11073
11074 2009-02-25 Cary Coutant <ccoutant@google.com>
11075
11076 * layout.cc (Layout::choose_output_section): Don't rename sections
11077 when using a linker script that has a SECTIONS clause.
11078 * Makefile.in: Regenerate.
11079
11080 * testsuite/Makefile.am (script_test_5.sh): New test case.
11081 * testsuite/Makefile.in: Regenerate.
11082 * testsuite/script_test_5.cc: New file.
11083 * testsuite/script_test_5.sh: New file.
11084 * testsuite/script_test_5.t: New file.
11085
11086 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11087
11088 * archive.cc (Archive::include_member): Update calls to add_symbols.
11089 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11090 the Layout argument.
11091 * dynobj.h (do_add_symbols): Add the Layout argument.
11092 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11093 Layout argument.
11094 * object.h (Object::add_symbols): Add the Layout argument.
11095 (Object::do_add_symbols): Add the Layout argument.
11096 (Sized_relobj::do_add_symbols): Add the Layout argument.
11097 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11098 Unify the two versions.
11099 (Add_plugin_symbols): Remove.
11100 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11101 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11102 (Add_plugin_symbols): Remove.
11103 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11104 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11105 (Add_symbols::run): Make it work with Pulginobj.
11106
11107 2009-02-06 Ian Lance Taylor <iant@google.com>
11108
11109 * object.cc (Sized_relobj::do_layout): Make info message start
11110 with lower case letter.
11111
11112 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11113
11114 * binary.cc: Fix file comment.
11115
11116 * options.h (enum Incremental_disposition): Define.
11117 (class General_options): Add new options: --incremental,
11118 --incremental_changed, --incremental_unchanged,
11119 --incremental_unknown. Add incremental_disposition_ and
11120 implicit_incremental_ fields.
11121 (General_options::incremental_disposition): New function.
11122 (class Position_dependent_options): Add incremental_disposition
11123 option.
11124 (Position_dependent_options::copy_from_options): Set incremental
11125 dispositions.
11126 * options.cc (General_options::parse_incremental_changed): New
11127 function.
11128 (General_options::parse_incremental_unchanged): New function.
11129 (General_options::parse_incremental_unknown): New function.
11130 (General_options::General_options): Initialize new fields
11131 incremental_disposition_ and implicit_incremental_.
11132 (General_options::finalize): Check for uasge of --incremental-*
11133 without --incremental.
11134
11135 2009-02-06 Chris Demetriou <cgd@google.com>
11136
11137 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11138 pointer and to report location as the file name associated with
11139 the symbol.
11140 (gold_undefined_symbol_at_location): New function to replace the
11141 old gold_undefined_symbol functionality.
11142 * target-reloc.h (relocate_section): Update to use
11143 gold_undefined_symbol_at_location.
11144 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11145 Call gold_undefined_symbol function rather than gold_error.
11146 * errors.h (Errors::undefined_symbol): Take location as a
11147 string, rather than calculating it from a relocation.
11148 * errors.cc (Errors::fatal): Print "fatal error:" before the
11149 formatted message.
11150 (Errors::error, Errors::error_at_location): Print "error: "
11151 before the formatted message.
11152 (Errors::undefined_symbol): Take location as a string, rather
11153 than calculating it from a relocation.
11154 (gold_undefined_symbol_at_location): New function akin to
11155 old gold_undefined_symbol, calculates location from relocation.
11156 (gold_undefined_symbol): Change to take only a Symbol pointer
11157 and to report location as the file name associated with the symbol.
11158 * testsuite/debug_msg.sh: Update for changed error messages.
11159 * testsuite/undef_symbol.sh: Likewise.
11160
11161 2009-02-04 Duncan Sands <baldrick@free.fr>
11162
11163 PR 9812
11164 * reduced_debug_output.h
11165 (Output_reduced_debug_abbrev_section::failed): Use format for
11166 gold_warning.
11167 (Output_reduced_debug_info_section::faild): Likewise.
11168
11169 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11170
11171 * script.cc (Lazy_demangler): New class.
11172 (Version_script_info::get_symbol_version_helper): Demangle a
11173 symbol only once.
11174
11175 2009-01-29 Cary Coutant <ccoutant@google.com>
11176
11177 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11178 to __tls_get_addr.
11179 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11180
11181 2009-01-28 Ian Lance Taylor <iant@google.com>
11182
11183 * version.cc (version_string): Bump to 1.9.
11184
11185 * gold.h: Include <cstring> and <stdint.h>.
11186 * version.cc: Include <cstdio>.
11187 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11188 warning.
11189 * reduced_debug_output.cc (insert_into_vector): Rename from
11190 Insert_into_vector; change all callers. Use Swap_unaligned to
11191 avoid aliasing issue; remove union since it is unnecessary.
11192
11193 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11194
11195 * Makefile.am (CCFILES): Add gc.cc.
11196 (HFILES): Add gc.h.
11197 * Makefile.in: Regenerate.
11198 * gold.cc (Gc_runner): New class.
11199 (queue_initial_tasks): Call garbage collection related tasks
11200 when corresponding options are invoked.
11201 (queue_middle_gc_tasks): New function.
11202 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11203 processed early before laying out sections during garbage collection.
11204 * gold.h (queue_middle_gc_tasks): New function.
11205 (is_prefix_of): Move from "layout.cc".
11206 * i386.cc (Target_i386::gc_process_relocs): New function.
11207 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11208 * main.cc (main): Create object of class "Garbage_collection".
11209 * object.cc (Relobj::copy_symbols_data): New function.
11210 (Relobj::is_section_name_included): New function.
11211 (Sized_relobj::do_layout): Allow this function to be called twice
11212 during garbage collection and defer layout of section during the
11213 first call.
11214 * object.h (Relobj::get_symbols_data): New function.
11215 (Relobj::is_section_name_included): New function.
11216 (Relobj::copy_symbols_data): New function.
11217 (Relobj::set_symbols_data): New function.
11218 (Relobj::get_relocs_data): New function.
11219 (Relobj::set_relocs_data): New function.
11220 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11221 (Relobj::gc_process_relocs): New function.
11222 (Relobj::do_gc_process_relocs): New pure virtual function.
11223 (Relobj::sd_): New data member.
11224 (Sized_relobj::is_output_section_offset_invalid): New function.
11225 (Sized_relobj::do_gc_process_relocs): New function.
11226 * options.h (General_options::gc_sections): Modify to not be a no-op.
11227 (General_options::print_gc_sections): New option.
11228 * plugin.cc (Plugin_finish::run): Remove function call to
11229 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11230 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11231 * reloc.cc (Read_relocs::run): Add task to process relocs and
11232 determine unreferenced sections when doing garbage collection.
11233 (Gc_process_relocs): New class.
11234 (Sized_relobj::do_gc_process_relocs): New function.
11235 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11236 sections that are garbage collected.
11237 * reloc.h (Gc_process_relocs): New class.
11238 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11239 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11240 symbols whose corresponding sections are garbage collected.
11241 (Symbol_table::Symbol_table): Add new parameter for the garbage
11242 collection object.
11243 (Symbol_table::gc_mark_undef_symbols): New function.
11244 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11245 (Symbol_table::gc_mark_dyn_syms): New function.
11246 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11247 as garbage.
11248 (Symbol_table::add_from_object): Likewise.
11249 (Symbol_table::add_from_relobj): When building shared objects, do not
11250 treat externally visible symbols as garbage.
11251 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11252 table information for static and relocatable links.
11253 * symtab.h (Symbol_table::set_gc): New function.
11254 (Symbol_table::gc): New function.
11255 (Symbol_table::gc_mark_undef_symbols): New function.
11256 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11257 (Symbol_table::gc_mark_dyn_syms): New function.
11258 (Symbol_table::gc_): New data member.
11259 * target.h (Sized_target::gc_process_relocs): New pure virtual
11260 function.
11261 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11262 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11263
11264 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11265
11266 * options.h (General_options::gc_sections): Define as a no-op for now.
11267 (General_options::no_keep_memory): Ditto.
11268 (General_options::Bshareable): Define.
11269 * options.cc (General_options::finalize): Honor -Bshareable.
11270
11271 2009-01-20 Andreas Schwab <schwab@suse.de>
11272
11273 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11274 read the value in the contents, since we don't use it. Use the
11275 template endianness when writing.
11276 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11277
11278 2009-01-19 Andreas Schwab <schwab@suse.de>
11279
11280 * configure.tgt (powerpc64-*): Fix targ_obj.
11281
11282 2009-01-15 Ian Lance Taylor <iant@google.com>
11283
11284 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11285 local symbols when stripping all symbols.
11286
11287 2009-01-14 Cary Coutant <ccoutant@google.com>
11288
11289 * output.cc (Output_reloc): Add explicit instantiations.
11290
11291 2009-01-14 Cary Coutant <ccoutant@google.com>
11292
11293 * archive.cc (Archive::get_elf_object_for_member): Remove call
11294 to File_read::claim_for_plugin.
11295 * descriptors.cc (Descriptors::open): Remove reference to
11296 is_claimed.
11297 (Descriptors::claim_for_plugin): Remove.
11298 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11299 (Descriptors::is_claimed): Remove.
11300 (claim_descriptor_for_plugin): Remove.
11301 * fileread.cc (File_read::claim_for_plugin): Remove.
11302 * fileread.h (File_read::claim_for_plugin): Remove.
11303 (File_read::descriptor): Reopen descriptor if necessary.
11304 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11305 (Plugin_manager::all_symbols_read): Add task parameter. Change
11306 all callers.
11307 (Plugin_manager::get_input_file): New function.
11308 (Plugin_manager::release_input_file): New function.
11309 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11310 corresponding data member.
11311 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11312 and pass to base constructor. Change all callers.
11313 (get_input_file, release_input_file): New functions.
11314 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11315 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11316 (Plugin_manager::all_symbols_read): Add task parameter.
11317 (Plugin_manager::get_input_file): New function.
11318 (Plugin_manager::release_input_file): New function.
11319 (Plugin_manager::task_): New data member.
11320 (Pluginobj::Pluginobj): Add filesize parameter.
11321 (Pluginobj::filename): New function.
11322 (Pluginobj::descriptor): New function.
11323 (Pluginobj::filesize): New function.
11324 (Pluginobj::filesize_): New data member.
11325 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11326 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11327 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11328
11329 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11330 with archive libraries.
11331 * testsuite/Makefile.in: Regenerate.
11332 * testsuite/plugin_test.c (struct sym_info): New type.
11333 (get_input_file, release_input_file): New static variables.
11334 (onload): Capture new transfer vector entries.
11335 (claim_file_hook): Stop reading at end of file according to filesize.
11336 Factor out parsing of readelf output into separate function.
11337 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11338 APIs and get the source file name from the symbol table. Convert
11339 source file name to corresponding object file name. Print info
11340 message when adding new input files.
11341 (parse_readelf_line): New function.
11342 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11343 * testsuite/plugin_test_2.sh: Likewise.
11344 * testsuite/plugin_test_3.sh: Likewise.
11345 * testsuite/plugin_test_4.sh: New test case.
11346
11347 2009-01-07 Ian Lance Taylor <iant@google.com>
11348
11349 * version.cc (version_string): Bump to 1.8.
11350
11351 2008-12-23 Cary Coutant <ccoutant@google.com>
11352
11353 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11354 * plugin.cc (Plugin_manager::finish): Rename as
11355 layout_deferred_objects. Move cleanup to separate function.
11356 (Plugin_manager::cleanup): New function.
11357 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11358 separately.
11359 * plugin.h (Plugin_manager::finish): Rename as
11360 layout_deferred_objects.
11361 (Plugin_manager::cleanup): New function.
11362 (Plugin_manager::cleanup_done): New field.
11363
11364 2008-12-23 Cary Coutant <ccoutant@google.com>
11365
11366 * plugin.cc (is_visible_from_outside): New function.
11367 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11368 so we don't return "IR only" status for exported symbols or -r links.
11369
11370 * testsuite/Makefile.am (plugin_test_3): New test case.
11371 * testsuite/Makefile.in: Regenerate.
11372 * testsuite/plugin_test_3.sh: New file.
11373
11374 2008-12-22 Cary Coutant <ccoutant@google.com>
11375
11376 * object.cc (Sized_relobj::layout_section): New function.
11377 (Sized_relobj::do_layout): Defer layout of input sections until after
11378 plugin has provided replacement files.
11379 (Sized_relobj::do_layout_deferred_sections): New function.
11380 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11381 (Relobj::layout_deferred_sections): New function.
11382 (Relobj::do_layout_deferred_sections): New function.
11383 (Sized_relobj::do_layout_deferred_sections): New function.
11384 (Sized_relobj::layout_section): New function.
11385 (Sized_relobj::Deferred_layout): New structure.
11386 (Sized_relobj::deferred_layout_): New field.
11387 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11388 Change all callers. Layout deferred sections.
11389 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11390 references.
11391 (Plugin_hook::run): Move code from do_plugin_hook inline.
11392 (Plugin_hook::do_plugin_hook): Remove.
11393 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11394 (Plugin_manager::finish): Renamed, was cleanup.
11395 (Plugin_manager::should_defer_layout): New function.
11396 (Plugin_manager::add_deferred_layout_object): New function.
11397 (Plugin_manager::Deferred_layout_list): New type.
11398 (Plugin_manager::deferred_layout_objects_): New field.
11399 (Plugin_hook::do_plugin_hook): Remove.
11400
11401 2008-12-17 Ian Lance Taylor <iant@google.com>
11402
11403 * options.h (class General_options): Add --no case for
11404 --export-dynamic.
11405
11406 2008-12-16 Cary Coutant <ccoutant@google.com>
11407
11408 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11409 vector.
11410 (Plugin_manager::claim_file): Create plugin object even if
11411 plugin did not call the add_symbols callback.
11412 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11413 asking for more symbols than were added.
11414 * testsuite/Makefile.am (plugin_test_1): Add test case with
11415 no global symbols.
11416 (empty.syms): New target.
11417 * testsuite/Makefile.in: Regenerate.
11418 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11419 message. Don't call add_symbols if no globals.
11420 (all_symbols_read_hook): Don't provide replacement for empty
11421 claimed file.
11422
11423 2008-12-12 Ian Lance Taylor <iant@google.com>
11424
11425 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11426 r_type == 0 for a local symbol with r_sym == 0.
11427 (scan_relocatable_relocs): Pass r_sym to
11428 local_non_section_strategy.
11429 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11430 r_sym parameter.
11431
11432 * configure.ac: Update test for TLS descriptors: they are
11433 supported as of glibc 2.9.
11434 * configure: Rebuild.
11435
11436 2008-12-11 Ian Lance Taylor <iant@google.com>
11437
11438 PR 7091
11439 * target-reloc.h (Default_scan_relocatable_relocs): For each
11440 function, map r_type == 0 to RELOC_DISCARD.
11441
11442 2008-12-10 Cary Coutant <ccoutant@google.com>
11443
11444 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11445 object to override a kept COMDAT group from a plugin object.
11446
11447 2008-12-09 Ian Lance Taylor <iant@google.com>
11448
11449 PR 7088
11450 * yyscript.y (file_cmd): Handle INPUT.
11451
11452 * testsuite/initpri1.c: Change all declarations to be full
11453 prototypes by adding void, to avoid compiler warnings.
11454
11455 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11456
11457 * options.cc (General_options::parse_plugin_opt): New.
11458 (General_options::add_plugin): The argument now is just the filename.
11459 (General_options::add_plugin_option): New.
11460 * options.h (plugin_opt): New.
11461 (add_plugin): Change argument name.
11462 (add_plugin_option): New.
11463 * plugin.cc (Plugin::load): Don't parse the plugin option.
11464 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11465 (Plugin::add_option): New.
11466 (Plugin::args_): Change type.
11467 (Plugin::filename_): New.
11468 (Plugin_manager::add_plugin_option): New.
11469 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11470 * testsuite/Makefile.in: Regenerate.
11471
11472 2008-12-05 Cary Coutant <ccoutant@google.com>
11473
11474 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11475 Handle --strip-lto-sections option.
11476 * options.h (strip_lto_sections): New option.
11477
11478 2008-12-01 Cary Coutant <ccoutant@google.com>
11479
11480 * plugin.cc (ld_plugin_message): Change format parameter to const.
11481 Fix mismatch between new[] and delete.
11482
11483 2008-11-14 Cary Coutant <ccoutant@google.com>
11484
11485 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11486 instead of -1U.
11487
11488 2008-11-05 Craig Silverstein <csilvers@google.com>
11489
11490 * options.cc (General_options::parse_dynamic_list): New function.
11491 * options.h (General_options): New flags dynamic_list,
11492 dynamic_list_data, dynamic_list_cpp_new, and
11493 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11494 (General_options::in_dynamic_list): New function.
11495 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11496 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11497 (Lex::can_continue_name): Likewise.
11498 (yylex): Likewise.
11499 (read_script_file): New parameter script_options.
11500 (read_dynamic_list): New function.
11501 (Script_options::define_dynamic_list): New function.
11502 (dynamic_list_keyword_parsecodes): New variable.
11503 (dynamic_list_keywords): New variable.
11504 * script.h (Script_options::define_dynamic_list): New function
11505 prototype.
11506 (read_dynamic_list): New function prototype.
11507 * symtab.cc (strprefix): New macro.
11508 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11509 dynamic_list_data, dynamic_list_cpp_new, and
11510 dynamic_list_cpp_typeinfo.
11511 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11512 (dynamic_list_expr): New rule.
11513 (dynamic_list_nodes): Likewise.
11514 (dynamic_list_node): Likewise.
11515 * testsuite/Makefile.am (dynamic_list): New test.
11516 * testsuite/Makefile.in: Regenerated.
11517 * testsuite/dynamic_list.t: New file.
11518 * testsuite/dynamic_list.sh: New file.
11519
11520 2008-11-05 Craig Silverstein <csilvers@google.com>
11521
11522 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11523 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11524 (t11_last): Likewise.
11525 * testsuite/ver_test_6.c (main): Likewise.
11526
11527 2008-10-07 Cary Coutant <ccoutant@google.com>
11528
11529 * options.c (General_options::finalize): Add check for -static and
11530 -shared.
11531 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11532 is not empty.
11533
11534 2008-10-02 Cary Coutant <ccoutant@google.com>
11535
11536 * plugin.cc (make_sized_plugin_object): Fix conditional
11537 compilation to work when not all targets are enabled.
11538
11539 2008-09-29 Cary Coutant <ccoutant@google.com>
11540
11541 * archive.cc (Archive::get_file_and_offset): Use filename instead
11542 of name to get library path.
11543 (Archive::include_member): Unlock external member of a thin archive.
11544
11545 * testsuite/Makefile.am (TEST_AR): New variable.
11546 (thin_archive_test_1): New test.
11547 (thin_archive_test_2): New test.
11548 * testsuite/Makefile.in: Regenerate.
11549 * testsuite/thin_archive_main.cc: New file.
11550 * testsuite/thin_archive_test_1.cc: New file.
11551 * testsuite/thin_archive_test_2.cc: New file.
11552 * testsuite/thin_archive_test_3.cc: New file.
11553 * testsuite/thin_archive_test_4.cc: New file.
11554
11555 2008-09-29 Cary Coutant <ccoutant@google.com>
11556
11557 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11558 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11559 instead of -1U.
11560 (Sized_relobj::do_finalize_local_symbols): Likewise.
11561 (Sized_relobj::map_to_kept_section): Likewise.
11562 * object.h (Sized_relobj::invalid_address): New constant.
11563 (Sized_relobj::do_output_section_offset): Check for invalid_address
11564 and return -1ULL.
11565 * output.cc (Output_reloc::local_section_offset): Use constant
11566 invalid_address instead of -1U.
11567 (Output_reloc::get_address): Likewise.
11568 (Output_section::output_address): Change -1U to -1ULL.
11569 * output.h (Output_reloc::invalid_address): New constant.
11570 * reloc.cc (Sized_relobj::write_sections): Use constant
11571 invalid_address instead of -1U.
11572 (Sized_relobj::relocate_sections): Likewise.
11573 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11574 values for merge sections.
11575 * target-reloc.h (relocate_for_relocatable): Use constant
11576 invalid_address instead of -1U.
11577
11578 2008-09-19 Cary Coutant <ccoutant@google.com>
11579
11580 Add plugin functionality for link-time optimization (LTO).
11581 * configure.ac (plugins): Add --enable-plugins option.
11582 * configure: Regenerate.
11583 * config.in: Regenerate.
11584 * Makefile.am (LIBDL): New variable.
11585 (CCFILES): Add plugin.cc.
11586 (HFILES): Add plugin.h.
11587 (ldadd_var): Add LIBDL.
11588 * Makefile.in: Regenerate.
11589
11590 * archive.cc: Include "plugin.h".
11591 (Archive::setup): Don't preread archive symbols when using a plugin.
11592 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11593 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11594 files.
11595 (Archive::include_member): Add symbols from plugin objects.
11596 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11597 * descriptors.cc (Descriptors::open): Check for file descriptors
11598 abandoned by plugins.
11599 (Descriptors::claim_for_plugin): New function.
11600 * descriptors.h (Descriptors::claim_for_plugin): New function.
11601 (Open_descriptor::is_claimed): New field.
11602 (claim_descriptor_for_plugin): New function.
11603 * fileread.cc (File_read::claim_for_plugin): New function.
11604 * fileread.h (File_read::claim_for_plugin): New function.
11605 (File_read::descriptor): New function.
11606 * gold.cc: Include "plugin.h".
11607 (queue_initial_tasks): Add task to call plugin hooks for generating
11608 new object files.
11609 * main.cc: Include "plugin.h".
11610 (main): Load plugin libraries.
11611 * object.h (Pluginobj): Declare.
11612 (Object::pluginobj): New function.
11613 (Object::do_pluginobj): New function.
11614 (Object::set_target): New function.
11615 * options.cc: Include "plugin.h".
11616 (General_options::parse_plugin): New function.
11617 (General_options::General_options): Initialize plugins_ field.
11618 (General_options::add_plugin): New function.
11619 * options.h (Plugin_manager): Declare.
11620 (General_options): Add --plugin option.
11621 (General_options::has_plugins): New function.
11622 (General_options::plugins): New function.
11623 (General_options::add_plugin): New function.
11624 (General_options::plugins_): New field.
11625 * plugin.cc: New file.
11626 * plugin.h: New file.
11627 * readsyms.cc: Include "plugin.h".
11628 (Read_symbols::do_read_symbols): Check for archive before checking
11629 for ELF file. Call plugin hooks to claim files.
11630 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11631 from a real object file; force override when processing replacement
11632 files.
11633 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11634 (Symbol::init_base_object): Likewise.
11635 (Symbol::init_base_output_data): Likewise.
11636 (Symbol::init_base_output_segment): Likewise.
11637 (Symbol::init_base_constant): Likewise.
11638 (Symbol::init_base_undefined): Likewise.
11639 (Symbol::output_section): Assert that object is not a plugin.
11640 (Symbol_table::add_from_pluginobj): New function.
11641 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11642 undefined.
11643 (Symbol_table::sized_write_globals): Likewise.
11644 (Symbol_table::add_from_pluginobj): Instantiate template.
11645 * symtab.h (Sized_pluginobj): Declare.
11646 (Symbol::in_real_elf): New function.
11647 (Symbol::set_in_real_elf): New function.
11648 (Symbol::in_real_elf_): New field.
11649 (Symbol_table::add_from_pluginobj): New function.
11650
11651 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11652 (LIBDL): New variable.
11653 (LDADD): Add LIBDL.
11654 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11655 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11656 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11657 (MOSTLYCLEANFILES): Likewise.
11658 * testsuite/Makefile.in: Regenerate.
11659 * testsuite/plugin_test.c: New file.
11660 * testsuite/plugin_test_1.sh: New file.
11661 * testsuite/plugin_test_2.sh: New file.
11662
11663 2008-09-16 Ian Lance Taylor <iant@google.com>
11664
11665 * target-reloc.h (relocate_section): Check whether a symbol is
11666 defined by the ABI before reporting an undefined symbol error.
11667 * target.h (Target::is_defined_by_abi): Make parameter const.
11668 (Target::do_is_defined_by_abi): Likewise.
11669 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11670 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11671 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11672 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11673 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11674 * testsuite/Makefile.in: Rebuild.
11675
11676 * fileread.cc (make_view): Add casts to avoid warning.
11677
11678 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11679
11680 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11681 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11682
11683 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11684
11685 * options.h (General_options::output_is_executable): New.
11686 (General_options::output_is_pie): New.
11687 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11688 for shared libraries.
11689 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11690
11691 2008-09-11 Chris Demetriou <cgd@google.com>
11692
11693 * options.h (origin): New -z option.
11694 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11695 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11696 in DT_FLAGS_1.
11697
11698 2008-09-05 Cary Coutant <ccoutant@google.com>
11699
11700 * fileread.cc (File_read::make_view): Add check for attempt to map
11701 beyond end of file.
11702
11703 2008-09-05 Cary Coutant <ccoutant@google.com>
11704
11705 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11706 explicit instantiations.
11707
11708 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11709
11710 PR gold/6858
11711 * options.cc (General_options::finalize): Allow undefined symbols
11712 in shlibs if linking -shared.
11713
11714 PR gold/6859
11715 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11716 symbols as not needing a dynsym entry.
11717
11718 2008-08-20 Craig Silverstein <csilvers@google.com>
11719
11720 * fileread.cc (File_read::open): Do not lock the file unless it
11721 was successfully opened.
11722
11723 2008-08-14 Cary Coutant <ccoutant@google.com>
11724
11725 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11726 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11727 * testsuite/tls_test.cc (struct int128): 128-bit struct
11728 for testing TLS relocs with non-zero addend.
11729 (v12): New TLS variable.
11730 (t12): New test.
11731 (t_last): Add check for v12.
11732 * testsuite/tls_test.h (t12): New function.
11733 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11734
11735 2008-08-13 Ian Lance Taylor <iant@google.com>
11736
11737 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11738 set tls_segment_ or relro_segment_.
11739 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11740 when appropriate.
11741 * output.h (Output_section::clear_is_relro): New function.
11742 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11743 sections specially even when output_data_ is empty.
11744 (Output_segment::maximum_alignment): When first section is relro,
11745 only force alignment for PT_LOAD segments.
11746 * script.cc (script_data_segment_align): New function.
11747 (script_data_segment_relro_end): New function.
11748 * script-c.h (script_data_segment_align): Declare.
11749 (script_data_segment_relro_end): Declare.
11750 * script-sections.h (class Script_sections): Declare
11751 data_segment_align and data_segment_relro_end. Add fields
11752 segment_align_index_ and saw_relro_end_.
11753 * script-sections.cc (class Sections_element): Add set_is_relro
11754 virtual function. Add new bool* parameter to place_orphan_here.
11755 Add get_output_section virtual function.
11756 (class Output_section_definition): Add set_is_relro. Add new
11757 bool* parameter to place_orphan_here. Add get_output_section.
11758 Add is_relro_ field.
11759 (Output_section_definition::Output_section_definition): Initialize
11760 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11761 and is_relro_ fields.
11762 (Output_section_definition::place_orphan_here): Add is_relro
11763 parameter.
11764 (Output_section_definition::set_section_addresses): Set relro for
11765 output section.
11766 (Output_section_definition::alternate_constraint): Likewise.
11767 (class Orphan_output_section): Add new bool* parameter to
11768 place_orphan_here. Add get_output_section.
11769 (Orphan_output_section::place_orphan_here): Add is_relro
11770 parameter.
11771 (Script_sections::Script_sections): Initialize
11772 data_segment_align_index_ and saw_relro_end_.
11773 (Script_sections::data_segment_align): New function.
11774 (Script_sections::data_segment_relro_end): New function.
11775 (Script_sections::place_orphan): Set or clear is_relro.
11776 (Script_sections::set_section_addresses): Force alignment of first
11777 TLS section.
11778 * yyscript.y (exp): Call script_data_segment_align and
11779 script_data_segment_relro_end.
11780 * testsuite/relro_script_test.t: New file.
11781 * testsuite/relro_test.cc (using_script): Declare.
11782 (t1, t2): Test using_script.
11783 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11784 (relro_script_test_SOURCES): Define.
11785 (relro_script_test_DEPENDENCIES): Define.
11786 (relro_script_test_LDFLAGS): Define.
11787 (relro_script_test_LDADD): Define.
11788 (relro_script_test.so): New target.
11789 * testsuite/Makefile.in: Rebuild.
11790
11791 2008-08-06 Cary Coutant <ccoutant@google.com>
11792
11793 * archive.cc (Archive::total_archives, Archive::total_members)
11794 (Archive::total_members_loaded): New variables.
11795 (Archive::setup): Add parameter. Add option to preread
11796 archive symbols.
11797 (Archive::read_armap): Add counter.
11798 (Archive::get_file_and_offset): New function.
11799 (Archive::get_elf_object_for_member): New function.
11800 (Archive::read_all_symbols): New function.
11801 (Archive::read_symbols): New function.
11802 (Archive::add_symbols): Add counters.
11803 (Archive::include_all_members): Use armap to find members if it's
11804 already built.
11805 (Archive::include_member): Skip reading symbols if already read.
11806 Factored code into Archive::get_file_and_offset and
11807 Archive::get_elf_object_for_member. Changed call to
11808 Mapfile::report_include_archive_member.
11809 (Archive::print_stats): New function.
11810 * archive.h: Declare Object and Read_symbols_data classes.
11811 (Archive::Archive): Add initializers for new members.
11812 (Archive::setup): Add parameter.
11813 (Archive::print_stats): New function.
11814 (Archive::total_archives, Archive::total_members)
11815 (Archive::total_members_loaded): New variables.
11816 (Archive::get_file_and_offset): New function.
11817 (Archive::get_elf_object_for_member): New function.
11818 (Archive::read_all_symbols): New function.
11819 (Archive::read_symbols): New function.
11820 (Archive::Archive_member): New class.
11821 (Archive::members_): New member.
11822 (Archive::num_members_): New member.
11823 * main.cc: Include archive.h.
11824 (main): Call Archive::print_stats.
11825 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11826 archive parameter; member_name is now the fully-decorated name.
11827 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11828 * options.h: (General_options): Add --preread-archive-symbols option.
11829 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11830 Archive::setup.
11831
11832 2008-08-04 Ian Lance Taylor <iant@google.com>
11833
11834 * symtab.h (Symbol::use_plt_offset): New function.
11835 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11836 * powerpc.cc (Relocate::relocate): Likewise.
11837 * sparc.cc (Relocate::relocate): Likewise.
11838 * x86_64.cc (Relocate::relocate): Likewise.
11839 * testsuite/weak_plt.sh: New test.
11840 * testsuite/weak_plt_main.cc: New test.
11841 * testsuite/weak_plt_shared.cc: New test.
11842 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11843 (check_PROGRAMS): Add weak_plt.
11844 (check_DATA): Add weak_plt_shared.so.
11845 (weak_plt_main_pic.o, weak_plt): New targets.
11846 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11847 * testsuite/Makefile.in: Rebuild.
11848
11849 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11850 gcctestdir/ld.
11851 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11852 * testsuite/Makefile.in: Rebuild.
11853
11854 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11855
11856 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11857 * Makefile.in: Regenerate.
11858 * po/POTFILES.in: Regenerate.
11859
11860 2008-07-29 Ian Lance Taylor <iant@google.com>
11861
11862 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11863 symbols before other symbols.
11864 * testsuite/script_test_2.cc (test_addr): Declare.
11865 (test_addr_alias): Declare.
11866 (main): Check that test_addr and test_addr_alias have the right
11867 values.
11868 * testsuite/script_test_2.t: Define test_addr_alias and
11869 test_addr.
11870
11871 2008-07-24 Ian Lance Taylor <iant@google.com>
11872
11873 PR 5990
11874 * descriptors.cc: New file.
11875 * descriptors.h: New file.
11876 * gold-threads.h (class Hold_optional_lock): New class.
11877 * fileread.cc: Include "descriptors.h".
11878 (File_read::~File_read): Release descriptor rather than closing
11879 it.
11880 (File_read::open) [file]: Call open_descriptor rather than open.
11881 Set is_descriptor_opened_.
11882 (File_read::open) [memory]: Assert that descriptor is not open.
11883 (File_read::reopen_descriptor): New function.
11884 (File_read::release): Release descriptor.
11885 (File_read::do_read): Make non-const. Reopen descriptor.
11886 (File_read::read): Make non-const.
11887 (File_read::make_view): Reopen descriptor.
11888 (File_read::do_readv): Likewise.
11889 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11890 Update declarations.
11891 * layout.cc: Include "descriptors.h".
11892 (Layout::create_build_id): Use open_descriptor rather than open.
11893 * output.cc: Include "descriptors.h".
11894 (Output_file::open): Use open_descriptor rather than open.
11895 * archive.cc (Archive::const_iterator): Change Archive to be
11896 non-const.
11897 (Archive::begin, Archive::end): Make non-const.
11898 (Archive::count_members): Likewise.
11899 * archive.h (class Archive): Update declarations.
11900 * object.h (Object::read): Make non-const.
11901 * Makefile.am (CCFILES): Add descriptors.cc.
11902 (HFILES): Add descriptors.h.
11903 * Makefile.in: Rebuild.
11904
11905 PR 6716
11906 * gold.h: Always include <clocale>. Add Solaris workarounds
11907 following code in binutils/sysdep.h.
11908
11909 PR 6048
11910 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11911 this->eh_frame_hdr_ is NULL before using it.
11912
11913 * dynobj.cc (Versions::Versions): Update comment.
11914
11915 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11916 the base version name.
11917
11918 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11919 array size plus one.
11920 (Stringpool_template::set_string_offsets): Subtract one from key
11921 before using it as an array index.
11922 (Stringpool_template::get_offset_with_length): Likewise.
11923 (Stringpool_template::write_to_buffer): Likewise.
11924 * stringpool.h (Stringpool_template::get_offset_from_key):
11925 Likewise.
11926
11927 2008-07-23 Ian Lance Taylor <iant@google.com>
11928
11929 PR 6658
11930 * object.h (Merged_symbol_value::value): Do our best to handle a
11931 negative addend.
11932
11933 PR 6647
11934 * script.cc (Version_script_info::get_versions): Don't add empty
11935 version tag to return value.
11936 (Version_script_info::get_symbol_version_helper): Change return
11937 type to bool. Add pversion parameter. Change all callers.
11938 (script_register_vers_node): Don't require a non-NULL tag.
11939 * script.h (class Version_script_info): Update declarations.
11940 (Version_script_info::get_symbol_version): Change return type to
11941 bool. Add version parameter. Change all callers.
11942 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11943 handling. Handle an empty version from a version script.
11944 (Symbol_table::define_special_symbol): Likewise.
11945 * testsuite/ver_test_10.script: New file.
11946 * testsuite/ver_test_10.sh: New file.
11947 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11948 (check_DATA): Add ver_test_10.syms.
11949 (ver_test_10.syms, ver_test_10.so): New target.
11950 * testsuite/Makefile.in: Rebuild.
11951
11952 2008-07-23 Simon Baldwin <simonb@google.com>
11953
11954 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11955 to zero for undefined symbols from dynamic libraries.
11956
11957 2008-07-23 Ian Lance Taylor <iant@google.com>
11958
11959 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11960 Change all callers.
11961 * symtab.h (class Symbol_table): Update declaration.
11962 * testsuite/ver_test_9.cc: New file.
11963 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11964 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11965 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11966 (ver_test_9.so, ver_test_9.o): New targets.
11967 * testsuite/Makefile.in: Rebuild.
11968
11969 2008-07-22 Ian Lance Taylor <iant@google.com>
11970
11971 * options.h (class General_options): Define --check-sections.
11972 * layout.cc (Layout::set_segment_offsets): Handle
11973 --check-sections.
11974
11975 * options.h (class General_options): Define -n/--nmagic and
11976 -N/--omagic.
11977 * options.cc (General_options::finalize): For -n/--nmagic or
11978 -N/--omagic, set -static.
11979 * layout.cc (Layout::attach_allocated_section_to_segment): If
11980 -N/--omagic, don't put read-only and read-write sections in
11981 different segments.
11982 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11983 finding a read-only segment.
11984 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11985 don't set the minimum segment alignment to the common page size,
11986 and don't set the file offset to the address modulo the page size.
11987 * script-sections.cc (Script_sections::create_segments): If
11988 -n/--omagic, don't put read-only and read-write sections in
11989 different segments.
11990
11991 * cref.cc: New file.
11992 * cref.h: New file.
11993 * options.h (class General_options): Add --print-symbol-counts.
11994 * main.cc (main): Issue defined symbol report if requested.
11995 * archive.cc (Archive::interpret_header): Make into a const member
11996 function.
11997 (Archive::add_symbols): Call Input_objects::archive_start and
11998 archive_stop.
11999 (Archive::const_iterator): Define new class.
12000 (Archive::begin, Archive::end): New functions.
12001 (Archive::include_all_members): Rewrite to use iterator.
12002 (Archive::count_members): New function.
12003 * archive.h (class Archive): Update declarations.
12004 (Archive::filename): New function.
12005 * object.cc: Include "cref.h".
12006 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12007 (Sized_relobj::do_get_global_symbol_counts): New function.
12008 (Input_objects::add_object): Add object to cross-referencer.
12009 (Input_objects::archive_start): New function.
12010 (Input_objects::archive_stop): New function.
12011 (Input_objects::print_symbol_counts): New function.
12012 * object.h: Declare Cref and Archive.
12013 (Object::get_global_symbol_counts): New function.
12014 (Object::do_get_global_symbol_counts): New pure virtual function.
12015 (class Sized_relobj): Add defined_count_ field. Update
12016 declarations.
12017 (class Input_objects): Add cref_ field. Update constructor.
12018 Update declarations.
12019 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12020 defined_count_.
12021 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12022 symbol counts.
12023 (Sized_dynobj::do_get_global_symbol_counts): New function.
12024 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12025 defined_count_. Update declarations. Define Symbols typedef.
12026 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12027 parameter. Change all callers.
12028 (Symbol_table::add_from_dynobj): Add sympointers and defined
12029 parameters. Change all callers.
12030 * symtab.h (class Symbol_table): Update declarations.
12031 * Makefile.am (CCFILES): Add cref.cc.
12032 (HFILES): Add cref.h.
12033 * Makefile.in: Rebuild.
12034
12035 2008-07-22 Simon Baldwin <simonb@google.com>
12036
12037 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12038 to zero when writing undefined symbols.
12039
12040 2008-07-22 Ian Lance Taylor <iant@google.com>
12041
12042 * output.cc (Output_section::add_input_section): Don't try to
12043 merge empty merge sections.
12044
12045 2008-07-21 Craig Silverstein <csilvers@google.com>
12046
12047 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12048 Include symbol version in error message.
12049
12050 2008-07-20 Chris Demetriou <cgd@google.com>
12051
12052 * configure.ac (gold_cv_c_random_seed): New configured variable.
12053 (RANDOM_SEED_CFLAGS): New substituted variable.
12054 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12055 * configure: Rebuild.
12056 * Makefile.in: Likewise.
12057 * testsuite/Makefile.in: Likewise.
12058
12059 2008-07-18 Ian Lance Taylor <iant@google.com>
12060
12061 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12062 where we see NAME/NULL and NAME/VERSION as separate symbols.
12063 * testsuite/ver_test_main.cc (main): Call t4.
12064 (t4, t4_2a): Define.
12065 * testsuite/ver_test_2.cc (t4_2): Define.
12066 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12067 * testsuite/ver_test_4.cc (t4_2a): Define.
12068 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12069 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12070
12071 2008-07-17 Ian Lance Taylor <iant@google.com>
12072
12073 * dynobj.cc (Versions::add_def): If we give an error about a
12074 missing version, go ahead and create the version anyhow.
12075
12076 2008-07-10 Ian Lance Taylor <iant@google.com>
12077
12078 Handle output sections with more than 0x7fffffff bytes.
12079 * object.h (class Relobj): Change map_to_output_ to
12080 output_sections_, and just keep a section pointer. Change all
12081 uses. Move comdat group support to Sized_relobj.
12082 (Relobj::is_section_specially_mapped): Remove.
12083 (Relobj::output_section): Remove poff parameter. Change all
12084 callers.
12085 (Relobj::output_section_offset): New function.
12086 (Relobj::set_section_offset): Rewrite.
12087 (Relobj::map_to_output): Remove.
12088 (Relobj::output_sections): New function.
12089 (Relobj::do_output_section_offset): New pure virtual function.
12090 (Relobj::do_set_section_offset): Likewise.
12091 (class Sized_relobj): Add section_offsets_ field. Add comdat
12092 group support from Relobj. Update declarations.
12093 (Sized_relobj::get_output_section_offset): New function.
12094 (Sized_relobj::do_output_section_offset): New function.
12095 (Sized_relobj::do_set_section_offset): New function.
12096 * object.cc (Relobj::output_section_address): Remove.
12097 (Sized_relobj::Sized_relobj): Initialize new fields.
12098 (Sized_relobj::include_section_group): Cast find_kept_object to
12099 Sized_relobj.
12100 (Sized_relobj::include_linkonce_section): Likewise.
12101 (Sized_relobj::do_layout): Use separate arrays for output section
12102 and output offset.
12103 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12104 output_sections.
12105 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12106 output_sections and section_offsets.
12107 (Sized_relobj::write_local_symbols): Likewise.
12108 (map_to_kept_section): Compute output address directly.
12109 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12110 output_sections and section_offsets.
12111 (Sized_relobj::write_sections): Likewise.
12112 (Sized_relobj::relocate_sections): Likewise.
12113 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12114 * output.h (class Output_reloc): Update declarations. Change
12115 u2_.relobj to Sized_relobj*.
12116 (class Output_data_reloc): Change add functions to use
12117 Sized_relobj*.
12118 * output.cc (Output_reloc::Output_reloc): Change relobj to
12119 Sized_relobj*.
12120 (Output_reloc::local_section_offset): Change return type to
12121 Elf_Addr. Use get_output_section_offset.
12122 (Output_reloc::get_address): Likewise.
12123 (Output_section::is_input_address_mapped): Don't call
12124 is_section_specially_mapped.
12125 (Output_section::output_offset): Likewise.
12126 (Output_section::output_address): Likewise.
12127 (Output_section::starting_output_address): Likewise.
12128 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12129 parameter to Sized_relobj*.
12130 (Copy_relocs::need_copy_reloc): Likewise.
12131 (Copy_relocs::save): Likewise.
12132 * copy-relocs.h (class Copy_relocs): Update declarations.
12133 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12134 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12135 * target-reloc.h (relocate_for_relocatable): Change
12136 offset_in_output_section type to Elf_Addr. Change code that uses
12137 it as well.
12138 * layout.cc (Layout::layout): Always set *off.
12139 * mapfile.cc (Mapfile::print_input_section): Use
12140 output_section_offset.
12141 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12142 Sized_relobj*.
12143 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12144 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12145 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12146
12147 2008-07-03 Ian Lance Taylor <iant@google.com>
12148
12149 * layout.cc (Layout::include_section): Do not discard unrecognized
12150 SHT_STRTAB sections.
12151
12152 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12153
12154 * script.cc (Lex::can_continue_name): Make '?' allowable in
12155 version-script names.
12156 * testsuite/version_script.map: Change glob pattern to use '?'
12157
12158 2008-06-30 Manish Singh <yosh@gimp.org>
12159
12160 PR 6585
12161 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12162 Correct typo.
12163
12164 2008-06-30 Ian Lance Taylor <iant@google.com>
12165
12166 PR 6660
12167 PR 6682
12168 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12169 versions]: Don't try to read the value in the contents, since we
12170 don't use it. Use the template endianness when writing.
12171
12172 2008-06-25 Cary Coutant <ccoutant@google.com>
12173
12174 * fileread.cc (File_read::make_view): Assert on zero-length view.
12175 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12176 symbol table when there are no symbols to read.
12177
12178 2008-06-23 Craig Silverstein <csilvers@google.com>
12179
12180 * version.cc (version_string): Bump to 1.7
12181
12182 2008-06-18 Craig Silverstein <csilvers@google.com>
12183
12184 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12185 constant 0xFFFF to type Valtype.
12186 (Powerpc_relocate_functions::rel16_ha): Likewise.
12187
12188 2008-06-17 Ian Lance Taylor <iant@google.com>
12189
12190 * output.h (Output_section::Input_section): Initialize p2align_ to
12191 zero for Output_section_data constructors.
12192 (Output_section::Input_section::addralign): If not an input
12193 section, return the alignment of the Output_section_data.
12194 * testsuite/copy_test.cc: New file.
12195 * testsuite/copy_test_1.cc: New file.
12196 * testsuite/copy_test_2.cc: New file.
12197 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12198 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12199 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12200 (copy_test_1_pic.o, copy_test_1.so): New targets.
12201 (copy_test_2_pic.o, copy_test_2.so): New targets.
12202 * testsuite/Makefile.in: Rebuild.
12203
12204 * script-sections.cc (Script_sections::place_orphan): Initialize
12205 local variable exact.
12206
12207 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12208
12209 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12210
12211 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12212 David S. Miller <davem@davemloft.net>
12213
12214 * powerpc.cc: New file.
12215 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12216 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12217 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12218 * Makefile.in: Rebuild.
12219
12220 2008-06-09 Ian Lance Taylor <iant@google.com>
12221
12222 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12223 <exception>.
12224 (throwing, orig_terminate): New static variables.
12225 (terminate_handler): New static function.
12226 (t2): Set terminate handler.
12227
12228 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12229
12230 PR 6584
12231 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12232 alignment.
12233
12234 2008-05-30 Cary Coutant <ccoutant@google.com>
12235
12236 * archive.cc (Archive::include_all_members) Correct to step
12237 over symbol table and extended name table in thin archives.
12238
12239 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12240
12241 PR 6407
12242 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12243 calculation.
12244
12245 2008-05-28 Caleb Howe <cshowe@google.com>
12246
12247 * reduced_debug_output.cc: New file.
12248 * reduced_debug_output.h: New file.
12249 * options.h (class General_options): Add --strip-debug-non-line.
12250 * options.cc (General_options::finalize): Add strip_debug_non_line
12251 to the strip heirarchy.
12252 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12253 fields.
12254 * layout.cc: Include "reduced_debug_output.h".
12255 (Layout::Layout): Initialize new fields.
12256 (line_only_debug_sections): New static array.
12257 (is_lines_only_debug_sections): New static inline function.
12258 (Layout::include_section): Handle --strip-debug-non-line.
12259 (Layout::make_output_section): If --strip-debug-non-line, build
12260 new output sections for .debug_abbrev and .debug_info.
12261 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12262 gold. Warn about possible overflow.
12263 (read_signed_LEB_128): Likewise.
12264 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12265 (read_signed_LEB_128): Declare.
12266 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12267 (HFILES): Add reduced_debug_output.h.
12268 * Makefile.in: Rebuild.
12269
12270 2008-05-21 Ian Lance Taylor <iant@google.com>
12271
12272 * mapfile.cc: New file.
12273 * mapfile.h: New file.
12274 * options.h (class General_options): Add -M/--print-map and -Map.
12275 * options.cc (General_options::finalize): Make -M equivalent to
12276 -Map -.
12277 * main.cc: Include <cstdio> and "mapfile.h".
12278 (main): Open mapfile if requested.
12279 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12280 constructor. Change caller.
12281 (queue_initial_tasks): Add mapfile parameter. Change caller.
12282 (queue_middle_tasks): Likewise.
12283 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12284 declarations.
12285 * archive.cc: Include "mapfile.h".
12286 (Archive::add_symbols): Add mapfile parameter. Change all
12287 callers. Pass mapfile, symbol, and reason to include_member.
12288 (Archive::include_all_members): Add mapfile parameter. Change all
12289 callers.
12290 (Archive::include_member): Add mapfile, sym, and why parameters.
12291 Change all callers. Report inclusion to map file.
12292 * archive.h: Include "fileread.h".
12293 (class Archive): Update declarations.
12294 (Archive::file): New const method.
12295 (class Add_archive_symbols): Add mapfile_ field. Update
12296 constructor. Change all callers.
12297 * readsyms.h (class Read_symbols): Likewise.
12298 (class Finish_group): Likewise.
12299 (class Read_script): Likewise.
12300 * common.cc: Include "mapfile.h".
12301 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12302 all callers.
12303 (Symbol_table::do_allocate_commons): Likewise.
12304 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12305 symbol allocation to mapfile.
12306 * common.h (class Allocate_commons_task): Add mapfile_ field.
12307 Update constructor. Change all callers.
12308 * symtab.h (class Symbol_table): Update declarations.
12309 * layout.cc: Include "mapfile.h".
12310 (Layout_task_runner::run): Print information to mapfile.
12311 (Layout::create_gold_note): Change Output_data_fixed_space to
12312 Output_data_zero_fill.
12313 (Layout::create_build_id): Likewise.
12314 (Layout::print_to_mapfile): New function.
12315 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12316 constructor. Change caller.
12317 (class Layout): Declare print_to_mapfile.
12318 * output.cc (Output_section::Input_section::print_to_mapfile): New
12319 function.
12320 (Output_section::add_input_section): If producing a map, always
12321 add to input_sections_ list.
12322 (Output_section::do_print_to_mapfile): New function.
12323 (Output_segment::print_sections_to_mapfile): New function.
12324 (Output_segment::print_section_list_to_mapfile): New function.
12325 * output.h: Include "mapfile.h".
12326 (Output_data::print_to_mapfile): New function.
12327 (Output_data::do_print_to_mapfile): New virtual function.
12328 (Output_segment_headers::do_print_to_mapfile): New function.
12329 (Output_file_header::do_print_to_mapfile): New function.
12330 (Output_data_const::do_print_to_mapfile): New function.
12331 (class Output_data_const_buffer): Add map_name_ field. Update
12332 constructor. Change all callers. Add do_print_to_mapfile
12333 function.
12334 (class Output_data_fixed_space): Likewise.
12335 (class Output_data_space): Likewise.
12336 (class Output_data_zero_fill): New class.
12337 (Output_data_strtab::do_print_to_mapfile): New function.
12338 (Output_data_reloc_base::do_print_to_mapfile): New function.
12339 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12340 (Output_data_group::do_print_to_mapfile): New function.
12341 (Output_data_got::do_print_to_mapfile): New function.
12342 (Output_data_dynamic::do_print_to_mapfile): New function.
12343 (Output_symtab_xindex::do_print_to_mapfile): New function.
12344 (class Output_section): Declare do_print_to_mapflie. Declare
12345 print_to_mapfile in Input_section.
12346 (class Output_segment): Declare new functions.
12347 * object.h (Sized_relobj::symbol_count): New function.
12348 * script-sections.cc
12349 (Output_section_element_dot_assignment::set_section_addresses):
12350 Change Output_data_fixed_space to Output_data_zero_fill.
12351 (Output_data_expression::do_print_to_mapfile): New function.
12352 * script.cc (read_input_script): Add mapfile parameter. Change
12353 all callers.
12354 * script.h (read_input_script): Update declaration.
12355 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12356 (Eh_frame::do_print_to_mapfile): New function.
12357 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12358 (Output_merge_string::do_print_to_mapfile): New function.
12359 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12360 function.
12361 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12362 function.
12363 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12364 function.
12365 * Makefile.am (CCFILES): Add mapfile.cc.
12366 (HFILES): Add mapfile.h.
12367 * Makefile.in: Rebuild.
12368
12369 2008-05-19 Ian Lance Taylor <iant@google.com>
12370
12371 * options.h (class General_options): Add -z relro.
12372 * layout.cc (Layout::Layout): Initialize relro_segment_.
12373 (Layout::add_output_section_data): Return the output section.
12374 (Layout::make_output_section): Rcognize relro sections and mark
12375 them appropriately.
12376 (Layout::attach_allocated_section_to_segment): Put relro sections
12377 in a PT_GNU_RELRO segment.
12378 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12379 section as relro.
12380 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12381 PT_TLS segments.
12382 (Layout::linkonce_mapping): Map d.rel.ro.local to
12383 .data.rel.ro.local.
12384 (Layout::output_section_name): Us .data.rel.ro.local for any
12385 section which begins with that.
12386 * layout.h (class Layout): Update add_output_section_data
12387 declaration. Add relro_segment_ field.
12388 * output.cc (Output_section::Output_section): Initialize is_relro_
12389 and is_relro_local_ fields.
12390 (Output_segment::add_output_section): Group relro sections.
12391 (Output_segment::is_first_section_relro): New function.
12392 (Output_segment::maximum_alignment): If there is a relro section,
12393 align the segment to the common page size.
12394 (Output_segment::set_section_addresses): Track whether we are
12395 looking at relro sections. If the last section is a relro
12396 section, align to the common page size.
12397 (Output_segment::set_section_list_addresses): Add in_relro
12398 parameter. Change all callers. Align to the page size when
12399 moving from relro to non-relro section.
12400 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12401 segment.
12402 * output.h (class Output_section): Add is_relro_ and
12403 is_relro_local_ fields.
12404 (Output_section::is_relro): New function.
12405 (Output_section::set_is_relro): New function.
12406 (Output_section::is_relro_local): New function.
12407 (Output_section::set_is_relro_local): New function.
12408 (class Output_segment): Update declarations.
12409 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12410 * sparc.cc (Target_sparc::got_section): Likewise.
12411 * x86_64.cc (Target_x86_64::got_section): Likewise.
12412 * testsuite/relro_test_main.cc: New file.
12413 * testsuite/relro_test.cc: New file.
12414 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12415 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12416 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12417 (relro_test.so, relro_test_pic.o): New targets.
12418 * testsuite/Makefile.in: Rebuild.
12419
12420 2008-05-16 Ian Lance Taylor <iant@google.com>
12421
12422 * output.cc (Output_segment::add_output_section): Remove front
12423 parameter.
12424 * output.h (class Output_segment): Remove
12425 add_initial_output_section and overloaded add_output_section.
12426 Update declaration of remaining add_output_section.
12427 * layout.cc (Layout::create_interp): Call add_output_section
12428 rather than add_initial_output_section.
12429 (Layout::finish_dynamic_section): Likewise.
12430
12431 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12432 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12433 know the dynamic type.
12434 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12435 field. Initialize it in constructor.
12436 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12437 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12438 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12439 reloc.
12440
12441 * output.cc (Output_reloc::get_address): Change return type to
12442 Elf_Addr.
12443 * output.h (class Output_reloc): Update get_address declaration.
12444 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12445 for section addresses.
12446
12447 2008-05-09 Ian Lance Taylor <iant@google.com>
12448
12449 PR 6493
12450 * gold.cc (gold_nomem): Use return value of write.
12451
12452 2008-05-08 Ian Lance Taylor <iant@google.com>
12453
12454 * symtab.c (Symbol::init_base_output_data): Add version
12455 parameter. Change all callers.
12456 (Symbol::init_base_output_segment): Likewise.
12457 (Symbol::init_base_constant): Likewise.
12458 (Symbol::init_base_undefined): Likewise.
12459 (Sized_symbol::init_output_data): Likewise.
12460 (Sized_symbol::init_output_segment): Likewise.
12461 (Sized_symbol::init_constant): Likewise.
12462 (Sized_symbol::init_undefined): Likewise.
12463 (Symbol_table::do_define_in_output_data): If the new symbol has a
12464 version, mark it as the default.
12465 (Symbol_table::do_define_in_output_segment): Likewise.
12466 (Symbol_table::do_define_as_constant): Likewise.
12467 * symtab.h (class Symbol): Update declarations.
12468 (class Sized_symbol): Likewise.
12469 * resolve.cc (Symbol::override_version): New function.
12470 (Symbol::override_base): Call override_version.
12471 (Symbol::override_base_with_special): Likewise.
12472 * testsuite/ver_script_8.script: New file.
12473 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12474 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12475 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12476 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12477
12478 2008-05-06 Ian Lance Taylor <iant@google.com>
12479
12480 PR 6049
12481 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12482 functions.
12483 (class General_options): Remove existing --undefined, and add
12484 --no-undefined instead. Add new --undefined as synonym for -u.
12485 * archive.cc (Archive::add_symbols): Check whether symbol was
12486 named with -u.
12487 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12488 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12489 all uses. Add IS_UNDEFINED. Update declarations to split
12490 different versions of init_base. Declare init_base_undefined.
12491 (Symbol::is_defined): Handle IS_UNDEFINED.
12492 (Symbol::is_undefined): Likewise.
12493 (Symbol::is_weak_undefined): Call is_undefined.
12494 (Symbol::is_absolute): Handle IS_CONSTANT.
12495 (class Sized_symbol): Update declarations to split different
12496 versions of init. Declare init_undefined.
12497 (class Symbol_table): Declare new functions.
12498 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12499 Change all callers.
12500 (Symbol::init_base_output_data): Likewise.
12501 (Symbol::init_base_output_segment): Likewise.
12502 (Symbol::init_base_constant): Likewise.
12503 (Symbol::init_base_undefined): New function.
12504 (Sized_symbol::init_object): Rename from init. Change all
12505 callers.
12506 (Sized_symbol::init_output_data): Likewise.
12507 (Sized_symbol::init_output_segment): Likewise.
12508 (Sized_symbol::init_constant): Likewise.
12509 (Sized_symbol::init_undefined): New function.
12510 (Symbol_table::add_undefined_symbols_from_command_line): New
12511 function.
12512 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12513 function.
12514 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12515 (Symbol::output_section): Likewise.
12516 (Symbol::set_output_section): Likewise.
12517 (Symbol_table::sized_finalize_symbol): Likewise.
12518 (Symbol_table::sized_write_globals): Likewise.
12519 * resolve.cc (Symbol_table::should_override): Likewise.
12520 (Symbol::override_base_with_special): Likewise.
12521
12522 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12523 symbol, change it to have default visibility.
12524 * testsuite/protected_1.cc: New file.
12525 * testsuite/protected_2.cc: New file.
12526 * testsuite/protected_3.cc: New file.
12527 * testsuite/protected_main_1.cc: New file.
12528 * testsuite/protected_main_2.cc: New file.
12529 * testsuite/protected_main_3.cc: New file.
12530 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12531 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12532 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12533 (protected_1.so): New target.
12534 (protected_1_pic.o, protected_2_pic.o): New targets.
12535 (protected_3_pic.o): New target.
12536 (check_PROGRAMS): Add protected_2.
12537 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12538 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12539 * testsuite/Makefile.in: Rebuild.
12540
12541 * options.h (DEFINE_var): Add set_user_set_##varname__.
12542 (DEFINE_bool_alias): New macro.
12543 (class General_options): Define -Bstatic using DEFINE_bool_alias
12544 rather than DEFINE_special. Add --undefined as an alias for -z
12545 defs.
12546 * options.cc (General_options::parse_Bstatic): Remove.
12547
12548 * options.h (class General_options): Add --fatal-warnings.
12549 * main.cc (main): Implement --fatal-warnings.
12550 * errors.h (Errors::warning_count): New function.
12551
12552 * options.h (class General_options): Add -Bsymbolic-functions.
12553 * symtab.h (Symbol::is_preemptible): Check for
12554 -Bsymbolic-functions.
12555
12556 2008-05-05 Ian Lance Taylor <iant@google.com>
12557
12558 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12559 as noVARNAME rather than no-VARNAME.
12560 (class General_options): Add option -z combreloc.
12561 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12562 get_address.
12563 (Output_reloc::sort_before) [SHT_REL]: New function.
12564 (Output_reloc::sort_before) [SHT_RELA]: New function.
12565 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12566 Sort_relocs_comparison.
12567 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12568 parameter. Change all callers.
12569 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12570 sort_relocs parameter. Change all callers.
12571 * output.cc (Output_reloc::get_address): New function, broken out
12572 of write_rel.
12573 (Output_reloc::write_rel): Call it.
12574 (Output_reloc::compare): New function.
12575 (Output_data_reloc_base::do_write): Optionally sort relocs.
12576
12577 * configure.ac: If targ_extra_obj is set, link it in.
12578 * configure.tgt: Initialize all variables.
12579 (x86_64*): Set targ_extra_obj and targ_extra_size.
12580 * configure: Rebuild.
12581
12582 * object.cc (Sized_relobj::include_section_group): Adjust section
12583 indexes read from group data. Build vector to pass to
12584 layout_group.
12585 * layout.cc (Layout::layout_group): Add flags and shndxes
12586 parameters. Remove contents parameter. Change caller. Update
12587 explicit instantiations.
12588 * layout.h (class Layout): Update layout_group declaration.
12589 * output.cc (Output_data_group::Output_data_group): Add flags and
12590 input_shndxes parameters. Remove contents parameter. Change
12591 caller.
12592 (Output_data_group::do_write): Change input_sections_ to
12593 input_shndxes_.
12594 * output.h (class Output_data_group): Update constructor
12595 declaration. Rename input_sections_ to input_shndxes_.
12596 * testsuite/many_sections_test.cc: Add template.
12597
12598 2008-04-30 Cary Coutant <ccoutant@google.com>
12599
12600 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12601
12602 * layout.cc (Layout::include_section): Refactored check for debug
12603 info section.
12604 (Layout::add_comdat): Add new parameters. Change type
12605 of signature parameter. Add object and shndx to signatures table.
12606 (Layout::find_kept_object): New function.
12607 * layout.h: Include <cstring>.
12608 (Layout::is_debug_info_section): New function.
12609 (Layout::add_comdat): Add new parameters.
12610 (Layout::find_kept_object): New function.
12611 (Layout::Kept_section): New struct.
12612 (Layout::Signatures): Change type of map range.
12613 * object.cc (Relobj::output_section_address): New function.
12614 (Sized_relobj::include_section_group): Add new parameters. Change
12615 calls to Layout::add_comdat. Change to build table of kept comdat
12616 groups and table mapping discarded sections to kept sections.
12617 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12618 (Sized_relobj::do_layout): Change calls to include_section_group and
12619 include_linkonce_section.
12620 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12621 value to zero when section is discarded.
12622 (Sized_relobj::map_to_kept_section): New function.
12623 * object.h (Relobj::output_section_address): New function.
12624 (Relobj::Comdat_group): New type.
12625 (Relobj::find_comdat_group): New function.
12626 (Relobj::Comdat_group_table): New type.
12627 (Relobj::Kept_comdat_section): New type.
12628 (Relobj::Kept_comdat_section_table): New type.
12629 (Relobj::add_comdat_group): New function.
12630 (Relobj::set_kept_comdat_section): New function.
12631 (Relobj::get_kept_comdat_section): New function.
12632 (Relobj::comdat_groups_): New field.
12633 (Relobj::kept_comdat_sections_): New field.
12634 (Symbol_value::input_value): Update comment.
12635 (Sized_relobj::map_to_kept_section) New function.
12636 (Sized_relobj::include_linkonce_section): Add new parameter.
12637 * target-reloc.h (Comdat_behavior): New type.
12638 (get_comdat_behavior): New function.
12639 (relocate_section): Add code to map a discarded section to the
12640 corresponding kept section when applying a relocation.
12641
12642 2008-04-30 Craig Silverstein <csilvers@google.com>
12643
12644 * dwarf_reader.cc (next_generation_count): New static var.
12645 (Addr2line_cache_entry): New struct.
12646 (addr2line_cache): New static var.
12647 (Dwarf_line_info::one_addr2line): Added caching.
12648 (Dwarf_line_info::clear_addr2line_cache): New function.
12649 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12650 cache-size parameter.
12651 (Dwarf_line_info::one_addr2line_cache): New function.
12652 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12653 new cache-size argument to one_addr2line(), and clear cache.
12654
12655 2008-04-28 Cary Coutant <ccoutant@google.com>
12656
12657 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12658 R_386_PC8 relocations.
12659
12660 2008-04-23 Ian Lance Taylor <iant@google.com>
12661
12662 * object.cc (Sized_relobj::include_section_group): Check for
12663 invalid section group.
12664
12665 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12666 header size.
12667
12668 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12669 than read for file header.
12670 * archive.cc (Archive::include_member): Likewise.
12671
12672 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12673
12674 * aclocal.m4: Regenerate.
12675 * configure: Regenerate.
12676
12677 2008-04-19 Ian Lance Taylor <iant@google.com>
12678
12679 * version.cc (version_string): Bump to 1.6.
12680
12681 * testsuite/Makefile.am (many_sections_r_test): New target.
12682 (many_sections_r_test_SOURCES): Remove.
12683 (many_sections_r_test_DEPENDENCIES): Remove.
12684 (many_sections_r_test_LDFLAGS): Remove.
12685 (many_sections_r_test_LDADD): Remove.
12686
12687 * object.cc (Sized_relobj::do_add_symbols): Always pass
12688 local_symbol_count_ to add_from_relobj.
12689
12690 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12691 every thousand variables.
12692 * testsuite/Makefile.in: Rebuild.
12693
12694 * object.cc (Xindex::initialize_symtab_xindex): New function.
12695 (Xindex::read_symtab_xindex): New function.
12696 (Xindex::sym_xindex_to_shndx): New function.
12697 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12698 available.
12699 (Sized_relobj::do_initialize_xindex): New function.
12700 (Sized_relobj::do_read_symbols): Adjust section links.
12701 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12702 parameter. Change all callers.
12703 (Sized_relobj::include_section_group): Adjust section links and
12704 symbol section indexes.
12705 (Sized_relobj::do_layout): Adjust section links.
12706 (Sized_relobj::do_count_local_symbols): Adjust section links and
12707 symbol section indexes.
12708 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12709 ordinary and special symbols.
12710 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12711 dynsym_xindex parameters. Change all callers. Adjust section
12712 links. Use SHN_XINDEX when needed.
12713 (Sized_relobj::get_symbol_location_info): Adjust section links.
12714 Don't get fooled by special symbols.
12715 * object.h (class Xindex): Define.
12716 (class Object): Add xindex_ parameter. Declare virtual functoin
12717 do_initialize_xindex.
12718 (Object::adjust_sym_shndx): New function.
12719 (Object::set_xindex): New protected function.
12720 (class Symbol_value): Add is_ordinary_shndx_ field.
12721 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12722 (Symbol_value::value): Assert ordinary section.
12723 (Symbol_value::initialize_input_to_output_map): Likewise.
12724 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12725 Change all callers.
12726 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12727 all callers.
12728 (class Sized_relobj): Update declarations.
12729 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12730 parameter. Change all callers.
12731 (Sized_relobj::adjust_shndx): New function.
12732 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12733 field.
12734 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12735 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12736 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12737 (Sized_dynobj::read_dynsym_section): Adjust section links.
12738 (Sized_dynobj::read_dynamic): Likewise.
12739 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12740 section links.
12741 (Sized_dynobj::do_initialize_xindex): New function.
12742 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12743 do_initialize_xindex.
12744 (Sized_dynobj::adjust_shndx): New function.
12745 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12746 dynsym_xindex_ fields.
12747 (Layout::finalize): Add a call to set_section_indexes before
12748 creating the symtab sections.
12749 (Layout::set_section_indexes): Don't do anything if the section
12750 already has a section index.
12751 (Layout::create_symtab_sections): Add shnum parameter. Change
12752 caller. Create .symtab_shndx section if needed.
12753 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12754 caller.
12755 (Layout::allocated_output_section_count): New function.
12756 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12757 needed.
12758 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12759 fields. Update declarations.
12760 (Layout::symtab_xindex): New function.
12761 (Layout::dynsym_xindex): New function.
12762 (class Write_symbols_task): Add layout_ field.
12763 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12764 Change caller.
12765 * output.cc (Output_section_headers::Output_section_headers): Add
12766 shstrtab_section parameter. Change all callers.
12767 (Output_section_headers::do_sized_write): Store overflow values
12768 for section count and section string table section index in
12769 section header zero.
12770 (Output_file_header::do_sized_write): Check for overflow of
12771 section count and section string table section index.
12772 (Output_symtab_xindex::do_write): New function.
12773 (Output_symtab_xindex::endian_do_write): New function.
12774 * output.h (class Output_section_headers): Add shstrtab_section_.
12775 Update declarations.
12776 (class Output_symtab_xindex): Define.
12777 (Output_section::has_out_shndx): New function.
12778 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12779 field.
12780 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12781 Change all callers.
12782 (Sized_symbol::init): Likewise.
12783 (Symbol::output_section): Check for ordinary symbol.
12784 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12785 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12786 callers.
12787 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12788 Change all callers. Simplify handling of symbols from sections
12789 not included in the link.
12790 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12791 distinction.
12792 (Weak_alias_sorter::operator()): Assert that symbols are
12793 ordinary.
12794 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12795 distinction.
12796 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12797 parameters. Change all callers.
12798 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12799 symbol distinction. Use SHN_XINDEX when needed.
12800 (Symbol_table::write_section_symbol): Add symtab_xindex
12801 parameter. Change all callers.
12802 (Symbol_table::sized_write_section_symbol): Likewise. Use
12803 SHN_XINDEX when needed.
12804 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12805 declarations.
12806 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12807 (Symbol::is_defined): Check is_ordinary.
12808 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12809 (Symbol::is_absolute, Symbol::is_common): Likewise.
12810 (class Sized_symbol): Update declarations.
12811 (class Symbol_table): Update declarations.
12812 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12813 parameters. Change all callers.
12814 (Sized_symbol::override): Likewise.
12815 (Symbol_table::override): Likewise.
12816 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12817 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12818 is_ordinary, and orig_st_shndx parameters. Change all callers.
12819 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12820 to be in an ordinary section.
12821 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12822 object and is_ordinary parameters. Change all callers.
12823 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12824 Change all callers. Don't add undefined or non-ordinary symbols
12825 to reloc_map_.
12826 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12827 Change all callers.
12828 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12829 declarations.
12830 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12831 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12832 (Sized_relobj::relocate_sections): Likewise.
12833 * target-reloc.h (scan_relocs): Adjust section symbol index.
12834 (scan_relocatable_relocs): Likewise.
12835 * i386.cc (Scan::local): Check for ordinary symbols.
12836 * sparc.cc (Scan::local): Likewise.
12837 * x86_64.cc (Scan::local): Likewise.
12838 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12839 to symbol_section_and_value.
12840 * testsuite/many_sections_test.cc: New file.
12841 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12842 (check_PROGRAMS): Add many_sections_test.
12843 (many_sections_test_SOURCES): Define.
12844 (many_sections_test_DEPENDENCIES): Define.
12845 (many_sections_test_LDFLAGS): Define.
12846 (BUILT_SOURCES): Add many_sections_define.h.
12847 (many_sections_define.h): New target.
12848 (BUILT_SOURCES): Add many_sections_check.h.
12849 (many_sections_check.h): New target.
12850 (check_PROGRAMS): Add many_sections_r_test.
12851 (many_sections_r_test_SOURCES): Define.
12852 (many_sections_r_test_DEPENDENCIES): Define.
12853 (many_sections_r_test_LDFLAGS): Define.
12854 (many_sections_r_test_LDADD): Define.
12855 (many_sections_r_test.o): New target.
12856 * testsuite/Makefile.in: Rebuild.
12857
12858 2008-04-17 Cary Coutant <ccoutant@google.com>
12859
12860 * errors.cc (Errors::info): New function.
12861 (gold_info): New function.
12862 * errors.h (Errors::info): New function.
12863 * gold.h (gold_info): New function.
12864 * object.cc (Input_objects::add_object): Print trace output.
12865 * options.cc (options::parse_set): New function.
12866 (General_options::parse_wrap): Deleted.
12867 (General_options::General_options): Deleted initializer.
12868 * options.h (options::String_set): New typedef.
12869 (options::parse_set): New function.
12870 (DEFINE_set): New macro.
12871 (General_options::wrap): Changed to use DEFINE_set. Changed
12872 callers of any_wrap_symbols and is_wrap_symbol.
12873 (General_options::trace, General_options::trace_symbol):
12874 New options.
12875 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12876 (General_options::wrap_symbols_): Deleted.
12877 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12878
12879 2008-04-17 David S. Miller <davem@davemloft.net>
12880
12881 * options.cc (General_options::parse_V): New function.
12882 * options.h: Add entries for -V and -Qy.
12883
12884 2008-04-17 Ian Lance Taylor <iant@google.com>
12885
12886 * common.cc (Symbol_table::allocate_commons): Remove options
12887 parameter. Change caller.
12888 (Symbol_table::do_allocate_commons): Remove options parameter.
12889 Change caller. Just call do_allocate_commons_list twice.
12890 (Symbol_table::do_allocate_commons_list): New function, broken out
12891 of do_allocate_commons.
12892 * common.h (class Allocate_commons_task): Remove options_ field.
12893 Update constructor.
12894 * symtab.cc (Symbol_table::Symbol_table): Initialize
12895 tls_commons_.
12896 (Symbol_table::add_from_object): Put TLS common symbols on
12897 tls_commons_ list.
12898 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12899 which are IN_OUTPUT_DATA.
12900 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12901 allocate_commons and do_allocate_commons declarations. Declare
12902 do_allocate_commons_list.
12903 * gold.cc (queue_middle_tasks): Update creation of
12904 Allocate_commons_task to not pass options.
12905 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12906 (TLS_TEST_C_FLAGS): New variable.
12907 (tls_test_c_pic.o): New target.
12908 (tls_test_shared.so): Link in tls_test_c_pic.o.
12909 (tls_test_c_pic_ie.o): New target.
12910 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12911 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12912 (tls_test_c.o): New target.
12913 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12914 (tls_pic_test_LDADD): Likewise.
12915 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12916 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12917 (tls_test_c_gnu2.o): New target.
12918 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12919 tls_test_c_gnu2.o.
12920 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12921 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12922 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12923 * testsuite/tls_test.cc: Include "config.h".
12924 (t_last): Call t11_last.
12925 * testsuite/tls_test.h (t11, t11_last): Declare.
12926 * testsuite/tls_test_c.c: New file.
12927 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12928 * configure.ac: Check for OpenMP support.
12929 * configure, config.in, Makefile.in: Rebuild.
12930 * testsuite/Makefile.in: Rebuild.
12931
12932 2008-04-16 Cary Coutant <ccoutant@google.com>
12933
12934 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12935 (Target_i386::tls_base_symbol_defined_): New field.
12936 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12937 (Target_i386::Scan::global): Likewise.
12938 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12939 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12940 (Target_x86_64::tls_base_symbol_defined_): New field.
12941 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12942 (Target_x86_64::Scan::global): Likewise.
12943
12944 2008-04-16 Cary Coutant <ccoutant@google.com>
12945
12946 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12947 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12948 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12949 building shared libraries.
12950 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12951 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12952 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12953 * testsuite/Makefile.in: Rebuild.
12954 * testsuite/weak_undef.h: New file.
12955 * testsuite/weak_undef_file1.cc: Add extra test cases.
12956 * testsuite/weak_undef_file2.cc: Likewise.
12957 * testsuite/weak_undef_test.cc: Likewise.
12958
12959 2008-04-16 David S. Miller <davem@davemloft.net>
12960
12961 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12962 Add issued_non_pic_error_ field. Declare check_non_pic.
12963 (Target_sparc::Scan::check_non_pic): New function.
12964 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12965 (Target_sparc::Scan::global): Likewise.
12966
12967 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12968 * configure: Rebuild.
12969
12970 * options.h (DEFINE_enable): New macro.
12971 (new_dtags): New enable option.
12972 (initfirst, interpose, loadfltr, nodefaultlib,
12973 nodelete, nodlopen, nodump): New -z options.
12974 * layout.cc (Layout:finish_dynamic_section): If new
12975 dtags enabled, emit DT_RUNPATH. Also, emit a
12976 DT_FLAGS_1 containing any specified -z flags.
12977
12978 2008-04-16 Ian Lance Taylor <iant@google.com>
12979
12980 * copy-relocs.cc: New file.
12981 * copy-relocs.h: New file.
12982 * reloc.cc: Remove Copy_relocs code.
12983 * reloc.h: Likewise.
12984 * reloc-types.h (struct Reloc_types) [both versions]: Add
12985 get_reloc_addend_noerror.
12986 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12987 variants of add_global which take an addend which must be zero.
12988 * i386.cc: Include "copy-relocs.h".
12989 (class Target_i386): Change type of copy_relocs_ to variable,
12990 update initializer.
12991 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12992 Change all callers.
12993 (Target_i386::do_finalize_sections): Change handling of
12994 copy_relocs_.
12995 * sparc.cc: Include "copy-relocs.h".
12996 (class Target_sparc): Change type of copy_relocs_ to variable,
12997 update initializer.
12998 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12999 Change all callers.
13000 (Target_sparc::do_finalize_sections): Change handling of
13001 copy_relocs_.
13002 * x86_64.cc: Include "copy-relocs.h".
13003 (class Target_x86_64): Change type of copy_relocs_ to variable,
13004 update initializer.
13005 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13006 class. Change all callers.
13007 (Target_x86_64::do_finalize_sections): Change handling of
13008 copy_relocs_.
13009 * Makefile.am (CCFILES): Add copy-relocs.cc.
13010 (HFILES): Add copy-relocs.h.
13011
13012 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13013
13014 * testsuite/script_test_4.sh: Permit leading zeroes.
13015
13016 2008-04-15 Ian Lance Taylor <iant@google.com>
13017
13018 * script-sections.cc (Script_sections::create_segments): Use
13019 header_size_adjustment even when there is enough room for the
13020 headers.
13021 * testsuite/script_test_4.sh: New file.
13022 * testsuite/script_test_4.t: New file.
13023 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13024 (check_DATA): Add script_test_4.stdout.
13025 (MOSTLYCLEANFILES): Likewise.
13026 (script_test_4): New target.
13027 (script_test_4.stdout): New target.
13028 * testsuite/Makefile.in: Rebuild.
13029
13030 * sparc.cc: Add definitions for Output_data_plt_sparc class
13031 constants.
13032
13033 2008-04-14 David S. Miller <davem@davemloft.net>
13034
13035 * sparc.cc: New file.
13036 * Makefile.am (TARGETSOURCES): Add sparc.cc
13037 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13038 * configure.tgt: Document targ_extra_size and
13039 targ_extra_big_endian. Add entries for sparc-* and
13040 sparc64-*.
13041 * configure.ac: Handle targ_extra_size and
13042 targ_extra_big_endian.
13043 * Makefile.in: Rebuild.
13044 * configure: Likewise.
13045 * po/POTFILES.in: Likewise.
13046 * po/gold.pot: Likewise.
13047
13048 2008-04-14 Ian Lance Taylor <iant@google.com>
13049
13050 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13051 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13052 in the name/type/flags to section mapping. Don't call
13053 allocate_output_section.
13054 (Layout::choose_output_section): Change parameter from adjust_name
13055 to is_input_section. Don't permit input sections after sections
13056 are attached to segments. Don't call allocate_output_section.
13057 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13058 not write_enable_output_section.
13059 (Layout::make_output_section): Don't push to
13060 unattached_section_list_ nor call attach_to_segment. Call
13061 attach_section_to_segment if sections are attached.
13062 (Layout::attach_sections_to_segments): New function.
13063 (Layout::attach_section_to_segment): New function.
13064 (Layout::attach_allocated_section_to_segment): Rename from
13065 attach_to_segment. Remove flags parameter.
13066 (Layout::allocate_output_section): Remove function.
13067 (Layout::write_enable_output_section): Remove function.
13068 * layout.h (class Layout): Update for above changes. Add new
13069 field sections_are_attached_.
13070 * output.h (Output_section::update_flags_for_input_section): New
13071 function.
13072 * output.cc (Output_section::add_input_section): Call
13073 update_flags_for_input_section.
13074 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13075
13076 2008-04-11 Cary Coutant <ccoutant@google.com>
13077
13078 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13079 thought unnecessary.
13080 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13081
13082 2008-04-11 Ian Lance Taylor <iant@google.com>
13083
13084 * output.h (class Output_section_data): Remove inline definition
13085 of set_addralign.
13086 * output.cc (Output_section_data::set_addralign): New function.
13087
13088 2008-04-11 Cary Coutant <ccoutant@google.com>
13089
13090 Add support for TLS descriptors for i386 and x86_64.
13091 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13092 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13093 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13094 GOT_TYPE_TLS_DESC.
13095 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13096 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13097 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13098 relocations.
13099 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13100 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13101 Fix problem with initial-exec relocations.
13102 (Target_i386::Relocate::relocate_tls): Likewise.
13103 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13104 relaxation.
13105 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13106 support for section-plus-offset dynamic table entries.
13107 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13108 (Output_data_dynamic::Dynamic_entry): Add support for
13109 section-plus-offset dynamic table entries.
13110 (Output_data_dynamic::Classification): Likewise.
13111 (Output_data_dynamic::classification_): Renamed offset_.
13112 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13113 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13114 (Target_x86_64::make_plt_section): New function.
13115 (Target_x86_64::reserve_tlsdesc_entries): New function.
13116 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13117 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13118 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13119 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13120 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13121 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13122 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13123 add extra PLT entry for TLS descriptors.
13124 (Output_data_plt_x86_64::got_): New field.
13125 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13126 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13127 fields.
13128 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13129 descriptors.
13130 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13131 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13132 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13133 R_386_TLS_DESC_CALL relocations.
13134 (Target_x86_64::Scan::global): Likewise.
13135 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13136 for TLS descriptors.
13137 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13138 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13139 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13140 GD-to-IE relaxation.
13141 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13142 and TLS_DESCRIPTORS.
13143 * Makefile.in: Rebuild.
13144 * configure: Rebuild.
13145 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13146 (tls_test_shared2.so): New target.
13147 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13148 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13149 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13150 (tls_shared_gd_to_ie_test_LDADD): New variable.
13151 (tls_shared_gnu2_gd_to_ie_test): New target.
13152 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13153 New targets.
13154 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13155 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13156 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13157 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13158 (tls_shared_gnu2_test): New target.
13159 (tls_test_gnu2_shared.so): New target.
13160 (tls_shared_gnu2_test_SOURCES): New variable.
13161 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13162 (tls_shared_gnu2_test_LDFLAGS): New variable.
13163 (tls_shared_gnu2_test_LDADD): New variable.
13164 * testsuite/Makefile.in: Rebuild.
13165 * testsuite/Makefile.
13166
13167 2008-04-11 Ian Lance Taylor <iant@google.com>
13168
13169 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13170 justsyms.t.
13171 * testsuite/Makefile.in: Rebuild.
13172
13173 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13174 long.
13175 * testsuite/script_test_2.cc (main): Adjust test.
13176
13177 2008-04-11 David S. Miller <davem@davemloft.net>
13178 Ian Lance Taylor <iant@google.com>
13179
13180 * options.h (General_options): Add entries for '-Y' and
13181 '-relax'.
13182 * options.cc (General_options:finalize): If -Y was used, add those
13183 entries to the library path instead of the default "/lib" and
13184 "/usr/lib".
13185
13186 2008-04-11 David S. Miller <davem@davemloft.net>
13187
13188 * testsuite/justsyms.t: Start at 0x100.
13189 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13190 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13191 long.
13192 * testsuite/script_test_2.cc: Adjust string and section length
13193 checks.
13194
13195 2008-04-09 Ian Lance Taylor <iant@google.com>
13196
13197 PR gold/5996
13198 * script-sections.cc (Sections_element::allocate_to_segment): Add
13199 orphan parameter.
13200 (Output_section_definition::allocate_to_segment): Likewise.
13201 (Orphan_output_section::allocate_to_segment): Likewise.
13202 (Script_sections::attach_sections_using_phdrs_clause): Don't
13203 propagate non-PT_LOAD segments to orphan sections.
13204 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13205 readelf rather than objdump.
13206 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13207 .interp section and PT_INTERP segment are the same size.
13208 * testsuite/Makefile.in: Rebuild.
13209
13210 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13211 aliases for symbols defined in the same object.
13212 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13213 (weak_alias_test_SOURCES): New variable.
13214 (weak_alias_test_DEPENDENCIES): New variable.
13215 (weak_alias_test_LDFLAGS): New variable.
13216 (weak_alias_test_LDADD): New variable.
13217 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13218 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13219 (weak_alias_test_3.o): New target.
13220 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13221 * testsuite/weak_alias_test_main.cc: New file.
13222 * testsuite/weak_alias_test_1.cc: New file.
13223 * testsuite/weak_alias_test_2.cc: New file.
13224 * testsuite/weak_alias_test_3.cc: New file.
13225
13226 2008-04-08 Ian Lance Taylor <iant@google.com>
13227
13228 * options.h (class General_options): Add --noinhibit-exec option.
13229 * main.cc (main): Check --noinhibit-exec.
13230
13231 * options.h (class General_options): Define --wrap as a special
13232 option. Add wrap_symbols_ field.
13233 (General_options::any_wrap_symbols): New function.
13234 (General_options::is_wrap_symbol): New function.
13235 * options.cc (General_options::parse_wrap): New function.
13236 (General_options::General_options): Initialize wrap_symbols_.
13237 * symtab.cc (Symbol_table::wrap_symbol): New function.
13238 (Symbol_table::add_from_object): Handle --wrap.
13239 * symtab.h (class Symbol_table): Declare wrap_symbol.
13240 * target.h (Target::wrap_char): New function.
13241 (Target::Target_info): Add wrap_char field.
13242 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13243 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13244 * testsuite/testfile.cc (Target_test::test_target_info):
13245 Likewise.
13246
13247 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13248 there is one.
13249
13250 * layout.h (class Layout): Add added_eh_frame_data_ field.
13251 * layout.cc (Layout::Layout): Initialize new field.
13252 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13253 output section until we find a section we merged successfully.
13254 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13255 that the size be non-zero.
13256
13257 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13258 qualifier.
13259
13260 2008-04-08 Craig Silverstein <csilvers@google.com>
13261
13262 * configure.ac: Export new conditional variable HAVE_ZLIB.
13263 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13264 on HAVE_ZLIB.
13265 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13266 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13267
13268 2008-04-07 Ian Lance Taylor <iant@google.com>
13269
13270 * version.cc (version_string): Set to "1.5".
13271
13272 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13273 Add issued_non_pic_error_ field. Declare check_non_pic.
13274 (Target_x86_64::Scan::check_non_pic): New function.
13275 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13276 (Target_x86_64::Scan::global): Likewise.
13277
13278 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13279 addend parameter. Change caller. Handle merge sections.
13280 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13281 Address to Addend. Don't add in the result of
13282 local_section_offset, pass down the addend and use the returned
13283 value.
13284 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13285 Update declarations of local_section_offset and symbol_value.
13286 * testsuite/two_file_test_1.cc (t18): New function.
13287 * testsuite/two_file_test_2.cc (f18): New function.
13288 * testsuite/two_file_test_main.cc (main): Call t18.
13289 * testsuite/two_file_test.h (t18, f18): Declare.
13290
13291 * configure.ac: Don't test for objdump, c++filt, or readelf.
13292 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13293 conditionals.
13294 (TEST_READELF): New variable.
13295 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13296 (check_PROGRAMS): Add two_file_strip_test.
13297 (two_file_strip_test): New target.
13298 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13299 (two_file_same_shared_strip_test_SOURCES): New variable.
13300 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13301 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13302 (two_file_same_shared_strip_test_LDADD): New variable.
13303 (two_file_shared_strip.so): New target.
13304 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13305 (ver_test_5.syms, ver_test_7.syms): Likewise.
13306 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13307 (strip_test_3.stdout): Use TEST_OBJDUMP.
13308 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13309
13310 2008-04-04 Cary Coutant <ccoutant@google.com>
13311
13312 * symtab.h (Symbol::is_weak_undefined): New function.
13313 (Symbol::is_strong_undefined): New function.
13314 (Symbol::is_absolute): New function.
13315 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13316 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13317 absolute symbols.
13318 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13319 (weak_undef_test): New target.
13320 * testsuite/Makefile.in: Rebuild.
13321 * testsuite/weak_undef_file1.cc: New file.
13322 * testsuite/weak_undef_file2.cc: New file.
13323 * testsuite/weak_undef_test.cc: New file.
13324
13325 2008-04-03 Craig Silverstein <csilvers@google.com>
13326
13327 * compressed_output.h (class Output_compressed_section): Use
13328 unsigned buffer.
13329 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13330 add zlib header.
13331 (zlib_compressed_suffix): Removed.
13332 (Output_compressed_section::set_final_data_size): Use unsigned
13333 buffers.
13334 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13335 Fix linker invocation.
13336 (flagstest_o_specialfile_and_compress_debug_sections):
13337 Likewise.
13338 * testsuite/Makefile.in: Regenerated.
13339
13340 2008-04-02 David S. Miller <davem@davemloft.net>
13341
13342 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13343 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13344
13345 2008-04-02 Craig Silverstein <csilvers@google.com>
13346
13347 * TODO: New file.
13348
13349 2008-04-02 Ian Lance Taylor <iant@google.com>
13350
13351 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13352 parameters. Update for new key type to views_. Change all
13353 callers.
13354 (File_read::read): Adjust for byteshift in returned view.
13355 (File_read::add_view): New function, broken out of
13356 find_and_make_view.
13357 (File_read::make_view): New function, broken out of
13358 find_and_make_view.
13359 (File_read::find_or_make_view): Add offset and aligned
13360 parameters. Rewrite accordingly. Change all callers.
13361 (File_read::get_view): Add offset and aligned parameters. Adjust
13362 for byteshift in return value.
13363 (File_read::get_lasting_view): Likewise.
13364 * fileread.h (class File_read): Update declarations.
13365 (class File_read::View): Add byteshift_ field. Add byteshift to
13366 constructor. Add byteshift method.
13367 * archive.h (Archive::clear_uncached_views): New function.
13368 (Archive::get_view): Add aligned parameter. Change all callers.
13369 * object.h (Object::get_view): Add aligned parameter. Change all
13370 callers.
13371 (Object::get_lasting_view): Likewise.
13372
13373 * fileread.cc (File_read::release): Don't call clear_views if
13374 there are multiple objects.
13375 * fileread.h (File_read::clear_uncached_views): New function.
13376 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13377 on the archive.
13378
13379 2008-03-31 Cary Coutant <ccoutant@google.com>
13380
13381 Add thin archive support.
13382 * archive.cc (Archive::armagt): New const.
13383 (Archive::setup): Remove task parameter and calls to unlock.
13384 (Archive::unlock_nested_archives): New function.
13385 (Archive::read_header): Add nested_off parameter. Change
13386 all callers.
13387 (Archive::interpret_header): Likewise.
13388 (Archive::include_all_members): Change to handle thin
13389 archives.
13390 (Archive::include_member): Likewise.
13391 * archive.h (Archive::Archive): Add new parameters and
13392 initializers.
13393 (Archive::armagt): New const.
13394 (Archive::setup): Remove task parameter.
13395 (Archive::unlock_nested_archives): New function.
13396 (Archive::read_header): Add nested_off parameter.
13397 (Archive::interpret_header): Likewise.
13398 (Archive::Nested_archive_table): New typedef.
13399 (Archive::is_thin_archive_): New field.
13400 (Archive::nested_archives_): New field.
13401 (Archive::options_): New field.
13402 (Archive::dirpath_): New field.
13403 (Archive::task_): New field.
13404 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13405 for thin archives. Pass additional parameters to
13406 Archive::Archive. Unlock the archive file after calling
13407 Archive::setup.
13408
13409 2008-03-29 Ian Lance Taylor <iant@google.com>
13410
13411 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13412 version symbol to be local.
13413 * testsuite/ver_test_4.sh: New file.
13414 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13415 (check_DATA): Add ver_test_4.syms.
13416 (ver_test_4.syms): New target.
13417 * testsuite/Makefile.in: Rebuild.
13418
13419 * output.cc
13420 (Output_section::Input_section_sort_entry::has_priority): New
13421 function.
13422 (Output_section::Input_section_sort_entry::match_file_name): New
13423 function.
13424 (Output_section::Input_section_sort_entry::match_section_name):
13425 Remove.
13426 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13427 Remove.
13428 (Output_section::Input_section_sort_entry::match_section_file):
13429 Remove.
13430 (Output_section::Input_section_sort_compare::operator()): Rewrite
13431 using new Input_section_sort_entry functions. Sort crtbegin and
13432 crtend first. Sort sections with no priority before sections with
13433 a priority.
13434 * testsuite/initpri1.c (d3): Check j != 4.
13435 (cd5): New constructor/destructor function.
13436 (main): Check j != 2.
13437
13438 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13439 new symbol when resolving, don't call set_is_default.
13440 * testsuite/ver_test_7.cc: New file.
13441 * testsuite/ver_test_7.sh: New file.
13442 * testsuite/Makefile.am (ver_test_7.so): New target.
13443 (ver_test_7.o): New target.
13444 (check_SCRIPTS): Add ver_test_7.sh.
13445 (check_DATA): Add ver_test_7.syms.
13446 (ver_test_7.syms): New target.
13447
13448 2008-03-28 Ian Lance Taylor <iant@google.com>
13449
13450 * layout.cc (Layout::layout): If we see an input section with a
13451 name that needs sorting, set the must_sort flag for the output
13452 section.
13453 (Layout::make_output_section): If the name of the output section
13454 indicates that it might require sorting, set the may_sort flag.
13455 * output.h (Output_section::may_sort_attached_input_sections): New
13456 function.
13457 (Output_section::set_may_sort_attached_input_sections): New
13458 function.
13459 (Output_section::must_sort_attached_input_sections): New
13460 function.
13461 (Output_section::set_must_sort_attached_input_sections): New
13462 function.
13463 (class Output_section): Declare Input_section_sort_entry. Define
13464 Input_section_sort_compare. Declare
13465 sort_attached_input_sections. Add new fields:
13466 may_sort_attached_input_sections_,
13467 must_sort_attached_input_sections_,
13468 attached_input_sections_are_sorted_.
13469 * output.cc (Output_section::Output_section): Initialize new
13470 fields.
13471 (Output_section::add_input_section): Add an entry to
13472 input_sections_ if may_sort or must_sort are true.
13473 (Output_section::set_final_data_size): Call
13474 sort_attached_input_sections if necessary.
13475 (Output_section::Input_section_sort_entry): Define new class.
13476 (Output_section::Input_section_sort_compare::operator()): New
13477 function.
13478 (Output_section::sort_attached_input_sections): New function.
13479 * configure.ac: Check whether the compiler supports constructor
13480 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13481 * testsuite/initpri1.c: New file.
13482 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13483 CONSTRUCTOR_PRIORITY.
13484 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13485 (initpri1_LDFLAGS): New variable.
13486 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13487
13488 2008-03-27 Ian Lance Taylor <iant@google.com>
13489
13490 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13491 * testsuite/common_test_1.c: New file.
13492 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13493 (common_test_1_SOURCES): New variable.
13494 (common_test_1_DEPENDENCIES): New variable.
13495 (common_test_1_LDFLAGS): New variable.
13496
13497 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13498 and commons_ correctly when NAME/VERSION does not override
13499 NAME/NULL.
13500 * testsuite/ver_test_6.c: New file.
13501 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13502 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13503 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13504
13505 2008-03-26 Ian Lance Taylor <iant@google.com>
13506
13507 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13508 of an undefined symbol from a version script.
13509 * testsuite/Makefile.am (ver_test_5.so): New target.
13510 (ver_test_5.o): New target.
13511 (check_SCRIPTS): Add ver_test_5.sh.
13512 (check_DATA): Add ver_test_5.syms.
13513 (ver_test_5.syms): New target.
13514 * testsuite/ver_test_5.cc: New file.
13515 * testsuite/ver_test_5.script: New file.
13516 * testsuite/ver_test_5.sh: New file.
13517 * Makefile.in, testsuite/Makefile.in: Rebuild.
13518
13519 PR gold/5986
13520 Fix problems building gold with gcc 4.3.0.
13521 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13522 (gold_error_at_location, gold_warning_at_location): Use it.
13523 * configure.ac: Check whether we can compile and use a template
13524 function with a printf attribute.
13525 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13526 when jumping over bytes.
13527 * object.cc: Instantiate Object::read_section_data.
13528 * debug.h: Include <cstring>
13529 * dwarf_reader.cc: Include <algorithm>
13530 * main.cc: Include <cstring>.
13531 * options.cc: Include <cstring>.
13532 * output.cc: Include <cstring>.
13533 * script.cc: Include <cstring>.
13534 * script.h: Include <string>.
13535 * symtab.cc: Include <cstring> and <algorithm>.
13536 * target-select.cc: Include <cstring>.
13537 * version.cc: Include <string>.
13538 * testsuite/testmain.cc: Include <cstdlib>.
13539 * configure, config.in: Rebuild.
13540
13541 2008-03-25 Ian Lance Taylor <iant@google.com>
13542
13543 * options.cc: Include "../bfd/bfdver.h".
13544 (options::help): Print bug reporting address.
13545
13546 * version.cc (print_version): Adjust output for current value of
13547 BFD_VERSION_STRING.
13548
13549 * NEWS: New file.
13550
13551 * options.cc (options::help): Print list of supported targets.
13552 * target-select.h: Include <vector>.
13553 (class Target_selector): Make machine_, size_, and is_big_endian_
13554 fields const. Add bfd_name_ and instantiated_target_ fields.
13555 (Target_selector::Target_selector): Add bfd_name parameter.
13556 (Target_selector::recognize): Make non-virtual, call
13557 do_recognize.
13558 (Target_selector::recognize_by_name): Make non-virtual, call
13559 do_recognize_by_name.
13560 (Target_selector::supported_names): New function.
13561 (Target_selector::bfd_name): New function.
13562 (Target_selector::do_instantiate_target): New pure virtual
13563 function.
13564 (Target_selector::do_recognize): New virtual function.
13565 (Target_selector::do_recognize_by_name): New virtual function.
13566 (Target_selector::instantiate_target): New private function.
13567 (supported_target_names): Declare.
13568 * target-select.cc (Target_selector::Target_selector): Update for
13569 new parameter and fields.
13570 (select_target_by_name): Check that the name matches before
13571 calling recognize_by_name.
13572 (supported_target_names): New function.
13573 * i386.cc (class Target_selector_i386): Update Target_selector
13574 constructor call. Remove recognize and recognize_by_name. Add
13575 do_instantiate_target.
13576 * x86_64.cc (class Target_selector_x86_64): Likewise.
13577 * testsuite/testfile.cc (class Target_selector_test): Update for
13578 changes to Target_selector.
13579
13580 * README: Rewrite, with some notes on unsupported features.
13581
13582 2008-03-24 Cary Coutant <ccoutant@google.com>
13583
13584 * i386.cc (Target_i386::Got_type): New enum declaration.
13585 (Target_i386::Scan::local): Updated callers of Output_data_got
13586 member functions.
13587 (Target_i386::Scan::global): Likewise.
13588 (Target_i386::Relocate::relocate): Likewise.
13589 (Target_i386::Relocate::relocate_tls): Likewise.
13590 * object.h (Got_offset_list): New class.
13591 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13592 (Sized_relobj::local_got_offset): Likewise.
13593 (Sized_relobj::set_local_got_offset): Likewise.
13594 (Sized_relobj::local_has_tls_got_offset): Removed.
13595 (Sized_relobj::local_tls_got_offset): Removed.
13596 (Sized_relobj::set_local_tls_got_offset): Removed.
13597 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13598 * output.cc (Output_data_got::add_global): Added got_type parameter.
13599 (Output_data_got::add_global_with_rel): Likewise.
13600 (Output_data_got::add_global_with_rela): Likewise.
13601 (Output_data_got::add_global_pair_with_rel): New function.
13602 (Output_data_got::add_global_pair_with_rela): New function.
13603 (Output_data_got::add_local): Added got_type parameter.
13604 (Output_data_got::add_local_with_rel): Likewise.
13605 (Output_data_got::add_local_with_rela): Likewise.
13606 (Output_data_got::add_local_pair_with_rel): New function.
13607 (Output_data_got::add_local_pair_with_rela): New function.
13608 (Output_data_got::add_global_tls): Removed.
13609 (Output_data_got::add_global_tls_with_rel): Removed.
13610 (Output_data_got::add_global_tls_with_rela): Removed.
13611 (Output_data_got::add_local_tls): Removed.
13612 (Output_data_got::add_local_tls_with_rel): Removed.
13613 (Output_data_got::add_local_tls_with_rela): Removed.
13614 * output.h (Output_data_got::add_global): Added got_type parameter.
13615 (Output_data_got::add_global_with_rel): Likewise.
13616 (Output_data_got::add_global_with_rela): Likewise.
13617 (Output_data_got::add_global_pair_with_rel): New function.
13618 (Output_data_got::add_global_pair_with_rela): New function.
13619 (Output_data_got::add_local): Added got_type parameter.
13620 (Output_data_got::add_local_with_rel): Likewise.
13621 (Output_data_got::add_local_with_rela): Likewise.
13622 (Output_data_got::add_local_pair_with_rel): New function.
13623 (Output_data_got::add_local_pair_with_rela): New function.
13624 (Output_data_got::add_global_tls): Removed.
13625 (Output_data_got::add_global_tls_with_rel): Removed.
13626 (Output_data_got::add_global_tls_with_rela): Removed.
13627 (Output_data_got::add_local_tls): Removed.
13628 (Output_data_got::add_local_tls_with_rel): Removed.
13629 (Output_data_got::add_local_tls_with_rela): Removed.
13630 * resolve.cc (Symbol::override_base_with_special): Removed
13631 reference to has_got_offset_ field.
13632 * symtab.cc (Symbol::init_fields): Replaced initialization
13633 of got_offset_ with got_offsets_. Removed initialization
13634 of has_got_offset_
13635 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13636 (Symbol::got_offset): Likewise.
13637 (Symbol::set_got_offset): Likewise.
13638 (Symbol::has_tls_got_offset): Removed.
13639 (Symbol::tls_got_offset): Removed.
13640 (Symbol::set_tls_got_offset): Removed.
13641 (Symbol::got_offset_): Removed.
13642 (Symbol::tls_mod_got_offset_): Removed.
13643 (Symbol::tls_pair_got_offset_): Removed.
13644 (Symbol::got_offsets_): New field.
13645 (Symbol::has_got_offset): Removed.
13646 (Symbol::has_tls_mod_got_offset): Removed.
13647 (Symbol::has_tls_pair_got_offset): Removed.
13648 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13649 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13650 member functions.
13651 (Target_x86_64::Scan::global): Likewise.
13652 (Target_x86_64::Relocate::relocate): Likewise.
13653 (Target_x86_64::Relocate::relocate_tls): Likewise.
13654
13655 2008-03-25 Ben Elliston <bje@au.ibm.com>
13656
13657 * yyscript.y: Fix spelling error in comment.
13658
13659 2008-03-24 Ian Lance Taylor <iant@google.com>
13660
13661 * options.h (class General_options): Define build_id option.
13662 * layout.h (class Layout): Declare write_build_id, create_note,
13663 create_build_id. Add build_id_note_ member.
13664 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13665 "libiberty.h", "md5.h", "sha1.h".
13666 (Layout::Layout): Initialize eh_frame_data_,
13667 eh_frame_hdr_section_, and build_id_note_.
13668 (Layout::finalize): Call create_build_id.
13669 (Layout::create_note): New function, broken out of
13670 Layout::create_gold_note.
13671 (Layout::create_gold_note): Call create_note.
13672 (Layout::create_build_id): New function.
13673 (Layout::write_build_id): New function.
13674 (Close_task_runner::run): Call write_build_id.
13675
13676 * x86_64.cc: Correct license to GPLv3.
13677
13678 2008-03-23 Ian Lance Taylor <iant@google.com>
13679
13680 * options.cc: Include "demangle.h".
13681 (parse_optional_string): New function.
13682 (parse_long_option): Handle takes_optional_argument.
13683 (parse_short_option): Update dash_z initializer. Handle
13684 takes_optional_argument.
13685 (General_options::General_options): Initialize do_demangle_.
13686 (General_options::finalize): Set do_demangle_. Handle demangling
13687 style.
13688 * options.h (parse_optional_string): Declare.
13689 (struct One_option): Add optional_arg field. Update constructor.
13690 Update call constructor calls. Add takes_optional_argument
13691 function.
13692 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13693 (DEFINE_optional_string): Define.
13694 (General_options::demangle): Change from DEFINE_bool to
13695 DEFINE_optional_string.
13696 (General_options::no_demangle): New function.
13697 (General_options::do_demangle): New function.
13698 (General_options::set_do_demangle): New function.
13699 (General_options::execstack_status_): Move definition to end of
13700 class definition.
13701 (General_options::static_): Likewise.
13702 (General_options::do_demangle_): New field.
13703 * object.cc (big_endian>::get_symbol_location_info): Call
13704 Options::do_demangle, not Options::demangle.
13705 * symtab.cc (demangle): Likewise.
13706
13707 2008-03-22 Ian Lance Taylor <iant@google.com>
13708
13709 * gold.h: Include <cstddef> and <sys/types.h>
13710 * options.h: Include <cstring>.
13711
13712 2008-03-21 Ian Lance Taylor <iant@google.com>
13713
13714 * Added source code to GNU binutils.