* powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
[external/binutils.git] / gold / ChangeLog
1 2012-09-05  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4         update all uses and lose "enum" when using type.
5
6 2012-09-05  Alan Modra  <amodra@gmail.com>
7
8         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
9         * configure: Regenerate.
10         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
11         (plugin_final_layout.stdout): Likewise.
12         (memory_test): Set page sizes to 0x1000.
13         * testsuite/Makefile.in: Regenerate.
14         * testsuite/discard_locals_test.sh: Add FIXME comment.
15         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
16         * testsuite/pr14265.t: Add .got output section statement.
17         * testsuite/script_test_2.t: Likewise.
18         * testsuite/script_test_3.t: Likewise.
19         * testsuite/script_test_4.t: Likewise.
20         * testsuite/script_test_5.t: Likewise.
21         * testsuite/script_test_6.t: Likewise.
22         * testsuite/script_test_7.t: Likewise.
23         * testsuite/script_test_9.t: Likewise.
24
25 2012-09-05  Alan Modra  <amodra@gmail.com>
26
27         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
28         (Powerpc_relocate_functions::Status): New typedef.
29         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
30         (Target_powerpc::Scan::local): Handle REL64.
31         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
32         for REL32 and REL64.
33         (Target_powerpc::symval_for_branch): New function, extracted from..
34         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
35         checks.  Report overflow errors.
36
37 2012-09-05  Alan Modra  <amodra@gmail.com>
38
39         * object.h (Sized_relobj_file::emit_relocs): Delete.
40         (Sized_relobj_file::emit_relocs_reltype): Delete.
41         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
42         relocate_relocs for --emit-relocs.
43         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
44         * output.h: Update comment.
45         (Output_segment::first_section): New function.
46         (Output_segment::first_section_load_address): Use first_section.
47         * output.cc (Output_segment::first_section): New function extracted..
48         (Output_segment::first_section_load_address): ..from here.  Delete.
49         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
50         * target.h (Sized_target::relocate_for_relocatable): Likewise.
51         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
52         adjust call to target.h function.
53         * i386.cc (Target_i386): Likewise.
54         * sparc.cc (Target_sparc): Likewise.
55         * x86_64.cc (Target_x86_64): Likewise.
56         * powerpc.cc (Target_powerpc): Likewise.
57         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
58         first tls section has section symbol for optimised local dynamic
59         output relocs.
60         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
61         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
62         optimised tls code.
63         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
64         Rename to relocate_relocs.  Update error message.
65
66 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
67
68         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
69         --just-symbols.
70
71 2012-08-31  Alan Modra  <amodra@gmail.com>
72
73         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
74         (Powerpc_relobj::toc_base_offset): New stub function.
75         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
76         got_mod_index_offset to tlsld_got_offset.  Update all refs.
77         (Target_powerpc::Relocate::enum skip_tls): New.
78         (Target_powerpc::call_tls_get_addr_): New var.
79         (Target_powerpc::is_branch_reloc): Move to file scope.
80         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
81         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
82         New functions.
83         (Target_powerpc::enum Got_type): Delete old values, add new ones.
84         (powerpc_info): Correct common_pagesize for ppc64.
85         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
86         (Powerpc_relocate_functions): Add overflow check enums and functions.
87         Add non-shift version of rela, rela_ua.  Delete all rel public
88         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
89         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
90         addr16_ha3, addr14 functions.
91         (Output_data_got_powerpc::add_constant_pair): New function.
92         (Output_data_got_powerpc::got_base_offset): Likewise.
93         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
94         (instruction constants): Sort, add some more.
95         (Output_data_glink::do_write): Add and use Address typedef.  Use
96         object->toc_base_offset() stub for 64-bit.
97         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
98         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
99         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
100         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
101         Always treat .opd relocs as against locally defined symbol.
102         Correct condition for RELATIVE relocs.
103         (Target_powerpc::do_finalize_sections): Test for NULL sections.
104         (Target_powerpc::Relocate::relocate): Use plt call stub as value
105         for 32-bit syms with a plt entry.  Correct ppc64 toc base
106         calculations.  Handle TLS relocs, and more.  Add overflow
107         checking and adjust for Powerpc_relocate_functions changes.
108         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
109         Reinstate --emit-relocs code with FIXME.
110
111 2012-08-30  Alan Modra  <amodra@gmail.com>
112
113         * layout.cc (Layout::set_segment_offsets): Set p_align to
114         abi_pagesize, not common_pagesize.
115         (Layout::relaxation_loop_body): Similarly use abi_pagesize
116         to determine whether file header can go in segment.
117
118 2012-08-30  Alan Modra  <amodra@gmail.com>
119
120         * output.h (Output_reloc::Output_reloc <output section>): Add
121         is_relative param.  Adjust calls.
122         (Output_reloc::add_output_section_relative): New functions.
123         * output.cc (Output_reloc::Output_reloc <output section>): Handle
124         is_relative.
125         (Output_reloc::symbol_value): Handle SECTION_CODE.
126
127 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
128
129         * gold.cc (queue_middle_tasks): Call layout again when unique
130         segments for sections is desired.
131         * layout.cc (Layout::Layout): Initialize new members.
132         (Layout::get_output_section_flags): New function.
133         (Layout::choose_output_section): Call get_output_section_flags.
134         (Layout::layout): Make output section for mapping to a unique segment.
135         (Layout::insert_section_segment_map): New function.
136         (Layout::attach_allocated_section_to_segment): Make unique segment for
137         output sections marked so.
138         (Layout::segment_precedes): Check for unique segments when sorting.
139         * layout.h (Layout::Unique_segment_info): New struct.
140         (Layout::Section_segment_map): New typedef.
141         (Layout::insert_section_segment_map): New function.
142         (Layout::get_output_section_flags): New function.
143         (Layout::is_unique_segment_for_sections_specified): New function.
144         (Layout::set_unique_segment_for_sections_specified): New function.
145         (Layout::unique_segment_for_sections_specified_): New member.
146         (Layout::section_segment_map_): New member.
147         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
148         Rename is_gc_pass_one to is_pass_one.
149         Rename is_gc_pass_two to is_pass_two.
150         Rename is_gc_or_icf to is_two_pass.
151         Check for which pass based on whether symbols data is present.
152         Make it two pass when unique segments for sections is desired.
153         * output.cc (Output_section::Output_section): Initialize new
154         members.
155         * output.h (Output_section::is_unique_segment): New function.
156         (Output_section::set_is_unique_segment): New function.
157         (Output_section::is_unique_segment_): New member.
158         (Output_section::extra_segment_flags): New function.
159         (Output_section::set_extra_segment_flags): New function.
160         (Output_section::extra_segment_flags_): New member.
161         (Output_section::segment_alignment): New function.
162         (Output_section::set_segment_alignment): New function.
163         (Output_section::segment_alignment_): New member.
164         (Output_segment::Output_segment): Initialize is_unique_segment_.
165         (Output_segment::is_unique_segment): New function.
166         (Output_segment::set_is_unique_segment): New function.
167         (Output_segment::is_unique_segment_): New member.
168         * plugin.cc (allow_unique_segment_for_sections): New function.
169         (unique_segment_for_sections): New function.
170         (Plugin::load): Add new functions to transfer vector.
171         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
172         * Makefile.in: Regenerate.
173         * testsuite/plugin_final_layout.sh: Check if unique segment
174         functionality works.
175         * testsuite/plugin_section_order.c (onload): Check if new interfaces
176         are available.
177         (allow_unique_segment_for_sections): New global.
178         (unique_segment_for_sections): New global.
179         (claim_file_hook): Call allow_unique_segment_for_sections.
180         (all_symbols_read_hook): Call unique_segment_for_sections.
181
182 2012-08-22  Cary Coutant  <ccoutant@google.com>
183
184         * layout.cc (Layout::include_section): Don't assert on GROUP
185         sections with --emit-relocs.
186
187 2012-08-21  Cary Coutant  <ccoutant@google.com>
188
189         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
190         if --export-dynamic-symbol names an undef symbol.
191
192 2012-08-18  Alan Modra  <amodra@gmail.com>
193
194         * powerpc.cc: Formatting and white space.
195         (Powerpc_relobj): Rename got2_section_ to special_.
196         Add opd_ent_shndx_ and opd_ent_off_ vectors.
197         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
198         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
199         (Target_powerpc): Add Address typedef and invalid_address.  Use
200         throughout.
201         (Target_powerpc::is_branch_reloc): New function.
202         (Powerpc_relocate_functions): Add Address typedef, use throughout.
203         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
204         for dst_mask, value and addend.
205         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
206         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
207         (Output_data_glink::do_write): Correct toc base.  Don't try to use
208         uint16_t for 24-bit offset.  Use get_output_section_offset and
209         check return.
210         (Target_powerpc::Scan::local): Handle more relocs.
211         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
212         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
213         Plug in toc restoring insn after plt calls.  Translate branches
214         to function descriptor symbols to corresponding entry point.
215         (Target_powerpc::relocate_for_relocatable): Check return from
216         get_output_section_offset.
217         * symtab.h: Comment typo.
218
219 2012-08-14  Ian Lance Taylor  <iant@google.com>
220
221         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
222         unsupported_relocal_local to call unsupported_reloc_global.
223
224 2012-08-14  Nick Clifton  <nickc@redhat.com>
225
226         PR ld/14265
227         * script-sections.cc (Sections_element::output_section_name): Add
228         keep return parameter.
229         (Output_section_element::match_name): Add keep return parameter.
230         Return the value of the keep_ member.
231         * script-sections.h (class Output_section): Update
232         output_section_name prototype.
233         * layout.cc (Layout::keep_input_section): New public member
234         function.
235         (Layout::choose_output_section): Pass keep parameter to
236         output_section_name.
237         * layout.h (class Layout): Add keep_input_section.
238         * object.cc (Sized_relobj_file::do_layout): Check for kept input
239         sections.
240         * testsuite/Makefile.am: Add a test.
241         * testsuite/Makefile.in: Regenerate.
242         * testsuite/pr14265.c: Source file for the test.
243         * testsuite/pr14265.t: Linker script for the test.
244         * testsuite/pr14265.sh: Shell script for the test.
245
246 2012-08-14  Alan Modra  <amodra@gmail.com>
247
248         * target.h (Target::output_section_name): New function.
249         (Target::do_output_section_name): New function.
250         * layout.cc (Layout::choose_output_section): Call the above.
251         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
252
253 2012-08-14  Alan Modra  <amodra@gmail.com>
254
255         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
256         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
257         for replace_constant call.
258         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
259         (Output_data_glink::do_print_to_mapfile): New function.
260         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
261         (Target_powerpc::Relocate::relocate): Likewise.
262
263 2012-08-14  Alan Modra  <amodra@gmail.com>
264
265         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
266         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
267         (Output_data_glink::add_entry,find_entry): Remove shndx param.
268         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
269         all references to shndx_.  Handle special case for R_PPC_PLTREL24
270         here.
271         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
272         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
273         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
274         here.
275         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
276         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
277
278 2012-08-12  Alan Modra  <amodra@gmail.com>
279
280         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
281         (glink insn constants): Use uint32_t.
282         (Output_data_glink::add_entry): Use insert, not [] operator.
283
284 2012-08-11  Alan Modra  <amodra@gmail.com>
285
286         * object.h (Sized_relobj_file::find_shdr): New function.
287         (Sized_relobj_file::find_special_sections): New function.
288         * object.cc (Sized_relobj_file::find_shdr): New function.
289         (Sized_relobj_file::find_eh_frame): Use find_shdr.
290         (Sized_relobj_file::find_special_sections): New function, split out..
291         (Sized_relobj_file::do_read_symbols): ..from here.
292         * output.h (Output_data_got::replace_constant): New function.
293         (Output_data_got::num_entries): New function.
294         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
295         (Output_data_got::got_offset): Protected rather than private.
296         (Output_data_got::replace_got_entry): New function.
297         * output.cc (Output_data_got::replace_got_entry): New function.
298         * powerpc.cc (class Powerpc_relobj): New.
299         (class Powerpc_relocate_functions): Delete all psymval variants or
300         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
301         Implement _ha functions using corresponding _hi function.
302         (Powerpc_relobj::find_special_sections): New function.
303         (Target_powerpc::do_make_elf_object): New function.
304         (class Output_data_got_powerpc): New.
305         (class Output_data_glink): New.
306         (class Powerpc_scan_relocatable_reloc): New.
307         Many more changes througout file.
308
309 2012-08-09  Nick Clifton  <nickc@redhat.com>
310
311         * po/vi.po: Updated Vietnamese translation.
312
313 2012-08-07  Ian Lance Taylor  <iant@google.com>
314
315         * layout.cc (Layout::add_target_dynamic_tags): If
316         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
317         plt_rel.
318
319 2012-07-30  Nick Clifton  <nickc@redhat.com>
320
321         * po/gold.pot: Updated template.
322         * po/es.po: Updated Spanish translation.
323
324 2012-07-18  Cary Coutant  <ccoutant@google.com>
325
326         PR gold/14344
327         * configure.ac: Add check for -gpubnames support.
328         * configure: Regenerate.
329         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
330         support; force -gno-pubnames.
331         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
332         support.
333         (gdb_index_test_4): New test.
334         * testsuite/Makefile.in: Regenerate.
335         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
336         * testsuite/gdb_index_test_2.sh: Likewise.
337         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
338         * testsuite/gdb_index_test_4.sh: New script.
339         * testsuite/gdb_index_test_comm.sh: New script with common code;
340         don't look for space after colon.
341
342 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
343
344         * gold.cc (queue_middle_tasks): Update function order only after
345         deferred objects due to plugins are processed.
346
347 2012-07-11  Ian Lance Taylor  <iant@google.com>
348
349         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
350         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
351         (Target_arm::scan_reloc_for_stub): Likewise.
352         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
353         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
354         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
355         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
356         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
357
358 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
359             Ian Lance Taylor  <iant@google.com>
360
361         PR gold/14309
362         * configure.ac: Test whether std::tr1::hash<off_t> works.
363         * gold.h: Add a specialization for std::tr1::hash<off_t> if
364         needed.
365         * output.h (class Output_fill): Add virtual destructor.
366         * configure, config.in: Rebuild.
367
368 2012-06-22  Roland McGrath  <mcgrathr@google.com>
369
370         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
371
372 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
373
374         * plugin.cc (Plugin::load): Handle position independent executables.
375
376 2012-06-06  Cary Coutant  <ccoutant@google.com>
377
378         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
379         add .debug_macro.
380         (lines_only_debug_sections): Likewise.
381         (gdb_fast_lookup_sections): New static array.
382         (is_gdb_debug_section): Rename formal parameter.
383         (is_lines_only_debug_section): Likewise.
384         (is_gdb_fast_lookup_section): New function.
385         (Layout::include_section): Check for ".zdebug_" prefix; pass
386         section name suffix to is_gdb_debug_section, et al.; check for
387         fast-lookup sections when building .gdb_index.
388         * options.h (--strip-debug-gdb): Update GDB version number.
389
390 2012-06-06  Cary Coutant  <ccoutant@google.com>
391
392         * configure.ac: Add check for fallocate.
393         * configure: Regenerate.
394         * config.in: Regenerate.
395
396         * options.h (class General_options): Add --mmap-output-file and
397         --posix-fallocate options.
398         * output.cc: (posix_fallocate): Remove; replace with...
399         (gold_fallocate): New function.
400         (Output_file::map_no_anonymous): Call gold_fallocate.
401         (Output_file::map): Check --mmap-output-file option.
402
403 2012-06-05  Jing Yu  <jingyu@google.com>
404
405         * gold.h (textdomain): Add do {} to empty while(0).
406         (bindtextdomain): Likewise.
407
408 2012-06-04  Cary Coutant  <ccoutant@google.com>
409
410         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
411         has_dynsym_index.
412
413 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
414
415         * symtab.cc (Symbol_table::define_special_symbol):
416         Initialize *poldsym to prevent uninitialized variable errors.
417
418 2012-05-23  Cary Coutant  <ccoutant@google.com>
419
420         * layout.cc (Layout::section_name_mapping): Add rules to handle
421         exact match on .data.rel.ro.local or .data.rel.ro.
422         (Layout::output_section_name): Check for exact matches.
423
424 2012-05-23  Cary Coutant  <ccoutant@google.com>
425
426         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
427         more carefully.
428
429 2012-05-22  Cary Coutant  <ccoutant@google.com>
430
431         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
432         object before exporting symbol.
433
434 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
435
436         * testsuite/tls_test.cc: Include "config.h" first.
437         * testsuite/tls_test_c.c: Likewise.
438
439 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
440             Nick Clifton  <nickc@redhat.com>
441
442         PR 14072
443         * configure.in: Add check that sysdep.h has been included before
444         any system header files.
445         * configure: Regenerate.
446         * config.in: Regenerate.
447
448 2012-05-14  Cary Coutant  <ccoutant@google.com>
449
450         * layout.cc (Layout::make_output_section): Mark .tdata section
451         as RELRO.
452         * testsuite/relro_test.cc: Add a TLS variable.
453
454 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
455
456         PR gold/14091
457         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
458         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
459         R_X86_64_64.
460
461 2012-05-08  Cary Coutant  <ccoutant@google.com>
462
463         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
464         (lines_only_debug_sections): Likewise.
465
466 2012-05-02  Roland McGrath  <mcgrathr@google.com>
467
468         * nacl.cc: New file.
469         * nacl.h: New file.
470         * Makefile.am (CCFILES, HFILES): Add them.
471         * Makefile.in: Regenerate.
472         * i386.cc (Output_data_plt_i386_nacl): New class.
473         (Output_data_plt_i386_nacl_exec): New class.
474         (Output_data_plt_i386_nacl_dyn): New class.
475         (Target_i386_nacl): New class.
476         (Target_selector_i386_nacl): New class.
477         (target_selector_i386): Use it instead of Target_selector_i386.
478         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
479         (Target_x86_64_nacl): New class.
480         (Target_selector_x86_64_nacl): New class.
481         (target_selector_x86_64, target_selector_x32): Use it instead of
482         Target_selector_x86_64.
483         * arm.cc (Output_data_plt_arm_nacl): New class.
484         (Target_arm_nacl): New class.
485         (Target_selector_arm_nacl): New class.
486         (target_selector_arm, target_selector_armbe): Use it instead of
487         Target_selector_arm.
488
489         * target-select.cc (select_target): Take new Input_file* and off_t
490         arguments, pass them on to recognize method of selector.
491         * object.cc (make_elf_sized_object): Update caller.
492         * parameters.cc (parameters_force_valid_target): Likewise.
493         * incremental.cc (make_sized_incremental_binary): Likewise.
494         * target-select.h: Update decl.
495         (Target_selector::recognize): Take new Input_file* argument,
496         pass it on to do_recognize.
497         (Target_selector::do_recognize): Take new Input_file* argument.
498         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
499         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
500         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
501         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
502
503         * target.h (Target::Target_info): New members isolate_execinstr
504         and rosegment_gap.
505         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
506         * arm.cc (Target_arm::arm_info): Update initializer.
507         * i386.cc (Target_i386::i386_info): Likewise.
508         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
509         * sparc.cc (Target_sparc::sparc_info): Likewise.
510         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
511         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
512         * layout.cc (Layout::attach_allocated_section_to_segment):
513         Take new const Target* argument.  If target->isolate_execinstr(), act
514         like --rosegment.
515         (Layout::find_first_load_seg): Take new const Target* argument;
516         if target->isolate_execinstr(), reject PF_X segments.
517         (Layout::relaxation_loop_body): Update caller.
518         (Layout::set_segment_offsets): If target->isolate_execinstr(),
519         reset file offset to zero when we hit LOAD_SEG, and then do a second
520         loop over the segments before LOAD_SEG to reassign offsets after
521         addresses have been determined.  Handle target->rosegment_gap().
522         (Layout::attach_section_to_segment): Take new const Target* argument;
523         pass it to attach_allocated_section_to_segment.
524         (Layout::make_output_section): Update caller.
525         (Layout::attach_sections_to_segments): Take new const Target* argument;
526         pass it to attach_section_to_segment.
527         * gold.cc (queue_middle_tasks): Update caller.
528         * layout.h (Layout): Update method decls with new arguments.
529
530         * arm.cc (Target_arm::Target_arm): Take optional argument for the
531         Target_info pointer to use.
532         (Target_arm::do_make_data_plt): New virtual method.
533         (Target_arm::make_data_plt): New method that calls it.
534         (Target_arm::make_plt_entry): Use it.
535         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
536         for the section alignment.
537         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
538         method.
539         (Output_data_plt_arm::first_plt_entry_offset): Call it.
540         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
541         method.
542         (Output_data_plt_arm::get_plt_entry_size): Call it.
543         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
544         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
545         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
546         method.
547         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
548         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
549         method instead of sizeof(plt_entry).
550         (Output_data_plt_arm::add_entry): Likewise.
551         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
552         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
553         than static method.
554         (Target_arm::plt_entry_size): Likewise.
555         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
556         Move to ...
557         (Output_data_plt_arm_standard): ... here, new class.
558         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
559         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
560         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
561
562         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
563         Take additional argument for the PLT entry size.
564         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
565         Use get_plt_entry_size method rather than plt_entry_size variable.
566         (Output_data_plt_x86_64::reserve_slot): Likewise.
567         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
568         (Output_data_plt_x86_64::add_entry): Likewise.
569         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
570         (Output_data_plt_x86_64::address_for_global): Likewise.
571         (Output_data_plt_x86_64::address_for_local): Likewise.
572         (Output_data_plt_x86_64::set_final_data_size): Likewise.
573         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
574         Make method non-static.
575         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
576         method.
577         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
578         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
579         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
580         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
581         virtual method.
582         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
583         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
584         virtual method.
585         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
586         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
587         virtual method.
588         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
589         (Output_data_plt_x86_64::plt_entry_size)
590         (Output_data_plt_x86_64::first_plt_entry)
591         (Output_data_plt_x86_64::plt_entry)
592         (Output_data_plt_x86_64::tlsdesc_plt_entry)
593         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
594         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
595         (Output_data_plt_x86_64_standard): ... here, new class.
596         (Target_x86_64::Target_x86_64): Take optional argument for the
597         Target_info pointer to use.
598         (Target_x86_64::do_make_data_plt): New virtual method.
599         (Target_x86_64::make_data_plt): New method to call it.
600         (Target_x86_64::init_got_plt_for_update): Use that.
601         Call this->plt_->add_eh_frame method here.
602         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
603         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
604         rather than static method.
605         (Target_x86_64::plt_entry_size): Likewise.
606         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
607         rather than plt_entry_size variable.  Move guts of PLT filling to...
608         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
609         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
610         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
611
612         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
613         additional argument for the section alignment.
614         Don't do add_eh_frame_for_plt here.
615         (Output_data_plt_i386::first_plt_entry_offset): Make the method
616         non-static.  Use get_plt_entry_size method rather than plt_entry_size
617         variable.
618         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
619         method.
620         (Output_data_plt_i386::get_plt_entry_size): Call it.
621         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
622         (Output_data_plt_i386::add_eh_frame): New method to call it.
623         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
624         method.
625         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
626         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
627         method.
628         (Output_data_plt_i386::fill_plt_entry): New method to call it.
629         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
630         method instead of plt_entry_size.
631         (Output_data_plt_i386::plt_entry_size)
632         (Output_data_plt_i386::plt_eh_frame_fde_size)
633         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
634         (Output_data_plt_i386_standard): ... here, new class.
635         (Output_data_plt_i386_exec): New class.
636         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
637         (Output_data_plt_i386_exec::first_plt_entry): ... here.
638         (Output_data_plt_i386::exec_plt_entry): Move to ...
639         (Output_data_plt_i386_exec::plt_entry): ... here.
640         (Output_data_plt_i386_dyn): New class.
641         (Output_data_plt_i386::first_plt_entry): Move to ...
642         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
643         (Output_data_plt_i386::dyn_plt_entry): Move to ...
644         (Output_data_plt_i386_dyn::plt_entry): ... here.
645         (Target_i386::Target_i386): Take optional argument for the Target_info
646         pointer to use.
647         (Target_i386::do_make_data_plt): New virtual method.
648         (Target_i386::make_data_plt): New method to call it.
649         (Target_i386::make_plt_section): Use that.
650         Call this->plt_->add_eh_frame method here.
651         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
652         rather than plt_entry_size variable.
653         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
654         (Output_data_plt_i386::address_for_local): Likewise.
655         (Output_data_plt_i386::do_write): Likewise.
656         Move guts of PLT filling to...
657         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
658         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
659         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
660         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
661
662 2012-05-01  Cary Coutant  <ccoutant@google.com>
663
664         * dwarf_reader.cc (Dwarf_die::read_attributes)
665         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
666         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
667         * reduced_debug_output.cc
668         (Output_reduced_debug_info_section::get_die_end): Remove
669         DW_FORM_GNU_ref_index.  Add default case.
670
671 2012-04-26  Mark Wielaard  <mjw@redhat.com>
672
673         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
674         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
675         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
676         DW_AT_high_pc as offset from DW_AT_low_pc.
677
678         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
679         * testsuite/Makefile.in: Regenerate.
680         * testsuite/gdb_index_test_3.c: New test source file.
681         * testsuite/gdb_index_test_3.sh: New test source file.
682
683 2012-04-25  Ian Lance Taylor  <iant@google.com>
684
685         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
686         pointer.
687         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
688         as a class, not a struct.
689         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
690         (Target_arm::apply_cortex_a8_workaround): Likewise.
691         * gc.h: Declare Reloc_types as a struct, not a class.
692         * object.h: Declare Symbols_data as a struct.
693         * reloc.h: Declare Read_relocs_data as a struct.
694         * target.h: Declare Relocate_info as a struct.
695
696 2012-04-24  David S. Miller  <davem@davemloft.net>
697
698         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
699         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
700         and R_SPARC_WPLT30.
701
702 2012-04-24  Cary Coutant  <ccoutant@google.com>
703
704         * incremental-dump.cc (find_input_containing_global): Replace
705         magic number with symbolic constant.
706         (dump_incremental_inputs): Update version number.
707         * incremental.cc (Output_section_incremental_inputs): Update version
708         number; import symbolic constants from Incremental_inputs_reader.
709         (Incremental_inputs::create_data_sections): Align relocations
710         section correctly for 64-bit targets.
711         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
712         constants; add padding.
713         (Output_section_incremental_inputs::write_header): Add assert for
714         header_size.
715         (Output_section_incremental_inputs::write_input_files): Add assert
716         for input_entry_size.
717         (Output_section_incremental_inputs::write_info_blocks): Add padding;
718         add assert for object_info_size, input_section_entry_size,
719         global_sym_entry_size.
720         * incremental.h (Incremental_inputs_reader): Add symbolic constants
721         for data structure sizes; use them.
722         (Incremental_input_entry_reader): Import symbolic constants from
723         Incremental_inputs_reader; use them.
724
725 2012-04-23  David S. Miller  <davem@davemloft.net>
726
727         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
728         and elf_flags_set_.
729         (Target_sparc::Target_sparc): Initialize new fields.
730         (Target_sparc::do_make_elf_object): New function.
731         (Target_sparc::do_adjust_elf_header): New function.
732
733 2012-04-23  Cary Coutant  <ccoutant@google.com>
734
735         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
736         CU range table of gdb index.
737
738 2012-04-20  David S. Miller  <davem@davemloft.net>
739
740         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
741         instead of false.
742
743 2012-04-16  David S. Miller  <davem@davemloft.net>
744
745         * sparc.cc (Target_sparc::got_address): New function.
746         (Sparc_relocate_functions::gdop_hix22): New function.
747         (Sparc_relocate_functions::gdop_lox10): New function.
748         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
749         relocs.
750         (Target_sparc::Scan::local): Likewise if the global symbol is not
751         preemptible and is not IFUNC.
752         (Target_sparc::Relocate::relocate): Perform GOTDATA code
753         transformations for local and non-preemptible non-IFUNC global
754         symbols.
755
756         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
757         writing out 64-bit part of ranges.
758
759         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
760         -fpic and -fpie respectively.
761         * Makefile.in: Regenerate.
762
763         * sparc.cc (class Target_sparc): Add rela_ifunc_.
764         (Target_sparc::Target_sparc): Initialize new field.
765         (Target_sparc::do_plt_section_for_global): New function.
766         (Target_sparc::do_plt_section_for_local): New function.
767         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
768         (Target_sparc::make_plt_section): New function, broken out of
769         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
770         (Target_sparc::make_plt_entry): Call make_plt_section.
771         (Target_sparc::make_local_ifunc_plt_entry): New function.
772         (Target_sparc::rela_ifunc_section): New function.
773         (Target_sparc::plt_section): Remove const.
774         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
775         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
776         and ifunc_count_ fields.
777         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
778         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
779         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
780         (Output_data_plt_sparc::rela_ifunc): New function.
781         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
782         (Output_data_plt_sparc::has_ifunc_section): New function.
783         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
784         (Output_data_plt_sparc::address_for_global): New function.
785         (Output_data_plt_sparc::address_for_local): New function.
786         (Output_data_plt_sparc::plt_index_to_offset): New function.
787         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
788         and entry_count.
789         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
790         entry_count.
791         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
792         R_SPARC_JMP_IREL to switch.
793         (Target_sparc::Scan::check_non_pic): Likewise.
794         (Target_sparc::Scan::local): Handle IFUNC symbols.
795         (Target_sparc::Scan::local): Likewise.
796         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
797         and plt_address_for_local.
798         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
799         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
800
801         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
802         (class Output_data_reloc): Adjust calls to Output_reloc_type.
803         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
804         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
805         global relocs too.
806         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
807         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
808         calls.
809         * sparc.cc (Target_sparc::Scan::global): Likewise.
810         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
811
812 2012-04-16  Cary Coutant  <ccoutant@google.com>
813
814         * archive.cc (Library_base::should_include_member): Check for
815         --export-dynamic-symbol.
816         * options.h (class General_options): Add --export-dynamic-symbol.
817         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
818         --export-dynamic-symbol.
819         (Symbol_table::gc_mark_undef_symbols): Likewise.
820         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
821
822 2012-04-12  David S. Miller  <davem@davemloft.net>
823
824         * sparc.cc (Reloc::wdisp10): New relocation method.
825         (Reloc::h34): Likewise.
826         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
827         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
828         R_SPARC_WDISP10.
829         (Target_sparc::Scan::local): Likewise.
830         (Target_sparc::Scan::global): Likewise.
831         (Target_sparc::Relocate::relocate): Likewise.
832
833 2012-04-09  Cary Coutant  <ccoutant@google.com>
834
835         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
836         low_pc == 0.
837
838 2012-04-06  Ian Lance Taylor  <iant@google.com>
839
840         * timer.cc: #include <unistd.h>.
841
842 2012-04-06  Roland McGrath  <mcgrathr@google.com>
843
844         * configure.in (AC_CHECK_HEADERS): Add locale.h.
845         * config.in: Regenerate.
846         * configure: Regenerate.
847
848 2012-04-05  Nick Clifton  <nickc@redhat.com>
849
850         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
851         (AM_LC_MESSAGES): Add.
852         * aclocal.m4: Regenerate.
853         * config.in: Regenerate.
854         * configure: Regenerate.
855
856 2012-03-21  Cary Coutant  <ccoutant@google.com>
857
858         * Makefile.am: Add gdb-index.cc, gdb-index.h.
859         * Makefile.in: Regenerate.
860         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
861         (Sized_elf_reloc_mapper::symbol_section): New function.
862         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
863         (make_elf_reloc_mapper): New function.
864         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
865         (Dwarf_abbrev_table::do_read_abbrevs): New function.
866         (Dwarf_abbrev_table::do_get_abbrev): New function.
867         (Dwarf_ranges_table::read_ranges_table): New function.
868         (Dwarf_ranges_table::read_range_list): New function.
869         (Dwarf_pubnames_table::read_section): New function.
870         (Dwarf_pubnames_table::read_header): New function.
871         (Dwarf_pubnames_table::next_name): New function.
872         (Dwarf_die::Dwarf_die): New function.
873         (Dwarf_die::read_attributes): New function.
874         (Dwarf_die::skip_attributes): New function.
875         (Dwarf_die::set_name): New function.
876         (Dwarf_die::set_linkage_name): New function.
877         (Dwarf_die::attribute): New function.
878         (Dwarf_die::string_attribute): New function.
879         (Dwarf_die::int_attribute): New function.
880         (Dwarf_die::uint_attribute): New function.
881         (Dwarf_die::ref_attribute): New function.
882         (Dwarf_die::child_offset): New function.
883         (Dwarf_die::sibling_offset): New function.
884         (Dwarf_info_reader::check_buffer): New function.
885         (Dwarf_info_reader::parse): New function.
886         (Dwarf_info_reader::do_parse): New function.
887         (Dwarf_info_reader::do_read_string_table): New function.
888         (Dwarf_info_reader::lookup_reloc): New function.
889         (Dwarf_info_reader::get_string): New function.
890         (Dwarf_info_reader::visit_compilation_unit): New function.
891         (Dwarf_info_reader::visit_type_unit): New function.
892         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
893         Sized_elf_reloc_mapper.
894         (Sized_dwarf_line_info::symbol_section): Remove function.
895         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
896         (Sized_dwarf_line_info::read_line_mappings): Remove object
897         parameter, adjust callers.
898         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
899         * dwarf_reader.h: Include <sys/types.h>.
900         (class Track_relocs): Remove forward declaration.
901         (class Elf_reloc_mapper): New class.
902         (class Sized_elf_reloc_mapper): New class.
903         (class Dwarf_abbrev_table): New class.
904         (class Dwarf_range_list): New class.
905         (class Dwarf_ranges_table): New class.
906         (class Dwarf_pubnames_table): New class.
907         (class Dwarf_die): New class.
908         (class Dwarf_info_reader): New class.
909         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
910         (Sized_dwarf_line_info::symbol_section): Remove member function.
911         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
912         base class.
913         * gdb-index.cc: New source file.
914         * gdb-index.h: New source file.
915         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
916         and .debug_types sections, call Layout::add_to_gdb_index.
917         (Sized_relobj_incr::do_section_name): Implement.
918         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
919         return type; Implement.
920         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
921         return type.
922         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
923         parameter list and return type.
924         (Sized_incr_dynobj::do_section_contents): Likewise.
925         * layout.cc: Include gdb-index.h.
926         (Layout::Layout): Initialize gdb_index_data_.
927         (Layout::init_fixed_output_section): Check for .gdb_index section.
928         (Layout::add_to_gdb_index): New function. Instantiate.
929         * layout.h: Add forward declaration for class Gdb_index.
930         (Layout::add_to_gdb_index): New member function.
931         (Layout::gdb_index_data_): New data member.
932         * main.cc: Include gdb-index.h.
933         (main): Print statistics for gdb index.
934         * object.cc (Object::section_contents): Move code into
935         do_section_contents.
936         (need_decompressed_section): Check for sections needed when building
937         gdb index.
938         (build_compressed_section_map): Likewise.
939         (Sized_relobj_file::do_read_symbols): Need local symbols when building
940         gdb index.
941         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
942         sections; call Layout::add_to_gdb_index.
943         (Sized_relobj_file::do_decompressed_section_contents): Call
944         do_section_contents directly.
945         * object.h (Object::do_section_contents): Adjust parameter list and
946         return type.
947         (Object::do_decompressed_section_contents): Call do_section_contents
948         directly.
949         (Sized_relobj_file::do_section_contents): Adjust parameter list and
950         return type.
951         * options.h (class General_options): Add --gdb-index option.
952         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
953         list and return type.
954         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
955         * reloc.h (Track_relocs::checkpoint): New function.
956         (Track_relocs::reset): New function.
957
958         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
959         New test cases.
960         * testsuite/Makefile.in: Regenerate.
961         * testsuite/gdb_index_test.cc: New test source file.
962         * testsuite/gdb_index_test_1.sh: New test source file.
963         * testsuite/gdb_index_test_2.sh: New test source file.
964
965 2012-03-19  Doug Kwan  <dougkwan@google.com>
966
967         * arm.cc (Target_arm::do_define_standard_symbols): New method.
968         (Target_arm::do_finalize_sections): Remove code which defines
969         __exidx_start and __exidx_end.  Make symbol table parameter
970         anonymous as it is not used.
971         * gold.cc (queue_middle_tasks): Call target hook to define any
972         target-specific symbols.
973         * target.h (Target::define_standard_symbols): New method.
974         (Target::do_define_standard_symbols): Same.
975         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
976         * testsuite/Makefile.in: Regenerate.
977         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
978         and __exidx_end.
979         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
980         relocations are generated for __exidx_start and __exidx_end.
981
982 2012-03-16  Doug Kwan  <dougkwan@google.com>
983
984         * testsuite/Makefile.am: Disable test initpri3b.
985         * testsuite/Makefile.in: Regenerate.
986
987 2012-03-15  Doug Kwan  <dougkwan@google.com>
988
989         * arm.cc (Target_arm::got_section): Make .got section read-only
990         if -z now is given.
991
992 2012-03-15  Ian Lance Taylor  <iant@google.com>
993
994         PR gold/13850
995         * layout.cc (Layout::make_output_section): Correctly mark
996         SHT_INIT_ARRAY, et. al., as relro.
997
998 2012-03-14  Doug Kwan  <dougkwan@google.com>
999
1000         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1001         dynamic relocations for protected symbols in shared objects.
1002
1003 2012-03-13  Ian Lance Taylor  <iant@google.com>
1004
1005         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1006         keep the larger alignment.
1007
1008 2012-03-12  Cary Coutant  <ccoutant@google.com>
1009
1010         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1011         handling of DW_LNE_define_file.
1012
1013 2012-03-12  Cary Coutant  <ccoutant@google.com>
1014
1015         * reduced_debug_output.cc
1016         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1017         codes to switch.
1018
1019 2012-02-29  Cary Coutant  <ccoutant@google.com>
1020
1021         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1022
1023 2012-02-29  Cary Coutant  <ccoutant@google.com>
1024
1025         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1026         Call Object::decompressed_section_contents.
1027         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1028         New dtor.
1029         (Sized_dwarf_line_info::buffer_start_): New data member.
1030         * merge.cc (Output_merge_data::do_add_input_section): Call
1031         Object::decompressed_section_contents.
1032         (Output_merge_string::do_add_input_section): Likewise.
1033         * object.cc (need_decompressed_section): New function.
1034         (build_compressed_section_map): Decompress sections needed later.
1035         (Sized_relobj_file::do_decompressed_section_contents): New function.
1036         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1037         * object.h (Object::decompressed_section_contents): New function.
1038         (Object::discard_decompressed_sections): New function.
1039         (Object::do_decompressed_section_contents): New function.
1040         (Object::do_discard_decompressed_sections): New function.
1041         (Compressed_section_info): New type.
1042         (Compressed_section_map): Include decompressed section contents.
1043         (Sized_relobj_file::do_decompressed_section_contents): New function.
1044         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1045
1046 2012-02-16  Cary Coutant  <ccoutant@google.com>
1047
1048         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1049         * testsuite/Makefile.in: Regenerate.
1050
1051 2012-02-14  Cary Coutant  <ccoutant@google.com>
1052
1053         * options.cc (General_options::finalize): Disallow -pie and -static.
1054
1055 2012-02-03  Doug Kwan  <dougkwan@google.com>
1056
1057         * arm.cc (Arm_relocate_functions::abs8,
1058         Arm_relocate_functions::abs16): Use
1059         Bits::has_signed_unsigned_overflow32.
1060         (Arm_relocate_functions::thm_abs8): Correct range of
1061         overflow check.
1062         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1063         in assertions.
1064
1065 2012-02-02  Doug Kwan  <dougkwan@google.com>
1066
1067         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1068         position independent outputs, not just shared objects.
1069
1070 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1071
1072         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1073         * configure: Regenerated.
1074
1075 2012-01-27  Ian Lance Taylor  <iant@google.com>
1076
1077         * reloc.h (Bits): New class with static functions, copied from
1078         namespace utils in arm.cc.
1079         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1080         instead.
1081
1082 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1083
1084         * incremental.cc (write_info_blocks): Correct relocation offset.
1085
1086 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1087
1088         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1089         (Relocate::tls_gd_to_le): Likewise.
1090
1091 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1092
1093         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1094
1095 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1096
1097         * configure.ac: Check if -mcmodel=medium works.
1098         * configure: Regenerated.
1099
1100 2012-01-24  Cary Coutant  <ccoutant@google.com>
1101
1102         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1103         definition and ...
1104         (read_unsigned_LEB_128_x): ... this new function.
1105         (read_signed_LEB_128): Replaced with inline definition and ...
1106         (read_signed_LEB_128_x): ... this new function.
1107         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1108         (read_unsigned_LEB_128): Add inline definition.
1109         (read_signed_LEB_128_x): New function.
1110         (read_signed_LEB_128): Add inline definition.
1111         * testsuite/Makefile.am (leb128_unittest): New unit test.
1112         * testsuite/Makefile.in: Regenerate.
1113         * testsuite/leb128_unittest.cc: New unit test.
1114
1115 2012-01-23  Ian Lance Taylor  <iant@google.com>
1116
1117         PR gold/13617
1118         * i386.cc (Target_i386::do_code_fill): When using a jmp
1119         instruction, pad with nop instructions.
1120         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1121
1122 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1123
1124         * x86_64.cc (gc_process_relocs): Add typename on types used in
1125         template.
1126         (scan_relocs): Likewise.
1127         (relocate_section): Likewise.
1128         (apply_relocation): Likewise.
1129
1130 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1131
1132         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1133         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1134         under x32.
1135
1136 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1137
1138         * x86_64.cc: Initial support for x32.
1139
1140 2012-01-03  Cary Coutant  <ccoutant@google.com>
1141
1142         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1143         Use abstract base class for GOT.
1144         * gold/output.h (class Output_data_got_base): New abstract base class.
1145         (class Output_data_got): Derive from new base class, adjust ctors.
1146         (Output_data_got::reserve_slot): Make virtual; rename to
1147         do_reserve_slot; Adjust callers.
1148         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1149         pointer to abstract base class.
1150         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1151
1152 2011-12-18  Ian Lance Taylor  <iant@google.com>
1153
1154         * object.h (Relobj::local_symbol_value): New function.
1155         (Relobj::local_plt_offset): New function.
1156         (Relobj::local_has_got_offset): New function.
1157         (Relobj::local_got_offset): New function.
1158         (Relobj::set_local_got_offset): New function.
1159         (Relobj::do_local_symbol_value): New pure virtual function.
1160         (Relobj::do_local_plt_offset): Likewise.
1161         (Relobj::do_local_has_got_offset): Likewise.
1162         (Relobj::do_local_got_offset): Likewise.
1163         (Relobj::do_set_local_got_offset): Likewise.
1164         (Sized_relobj::do_local_has_got_offset): Rename from
1165         local_has_got_offset.
1166         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1167         (Sized_relobj::do_set_local_got_offset): Rename from
1168         set_local_got_offset.
1169         (Sized_relobj_file::do_local_plt_offset): Rename from
1170         local_plt_offset.
1171         (Sized_relobj_file::do_local_symbol_value): New function.
1172         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1173         local_plt_offset.
1174         * output.cc (Output_data_got::Got_entry::write): Change object to
1175         Relobj.  Use local_symbol_value.
1176         (Output_data_got::add_global_with_rel): Change rel_dyn to
1177         Output_data_reloc_generic*.  Use add_global_generic.
1178         (Output_data_got::add_global_with_rela): Remove.  Change all
1179         callers to use add_global_with_rel.
1180         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1181         Output_data_reloc_generic*.  Use add_global_generic.
1182         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1183         callers to use add_global_pair_with_rel.
1184         (Output_data_got::add_local): Change object to Relobj*.
1185         (Output_data_got::add_local_plt): Likewise.
1186         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1187         change rel_dyn to Output_data_reloc_generic*.  Use
1188         add_local_generic.
1189         (Output_data_got::add_local_with_rela): Remove.  Change all
1190         callers to use all_local_with_rel.
1191         (Output_data_got::add_local_pair_with_rel): Change object to
1192         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1193         add_output_section_generic.
1194         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1195         callers to use add_local_pair_with_rel.
1196         (Output_data_got::reserve_local): Change object to Relobj*.
1197         * output.h: (class Output_data_reloc_generic): Add pure virtual
1198         declarations for add_global_generic, add_local_generic,
1199         add_output_section_generic.
1200         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1201         functions for Output_data_reloc_generic.  Update declarations for
1202         changes listed in output.cc.
1203         (class Output_data_got): Change template parameter to got_size.
1204         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1205         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1206         function.
1207         (Sized_relobj_incr::do_local_plt_offset): New function.
1208         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1209         add_global_generic.
1210
1211 2011-12-17  Cary Coutant  <ccoutant@google.com>
1212
1213         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1214         * resolve.cc (Symbol_table::resolve): Likewise.
1215         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1216         arrays.
1217         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1218
1219 2011-12-16  Ian Lance Taylor  <iant@google.com>
1220
1221         * output.h (Output_data_reloc_generic::add): Only call
1222         add_dynamic_reloc if this is a dynamic reloc section.
1223
1224 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1225
1226         PR gold/13505
1227         * target-reloc.h (apply_relocation): Replace <64, false> with
1228         <size, big_endian>.
1229
1230 2011-11-25  Nick Clifton  <nickc@redhat.com>
1231
1232         * po/it.po: New Italian translation.
1233
1234 2011-11-17  Sterling Augustine  <saugustine@google.com>
1235
1236         * script.cc (script_include_directive): Implement.
1237         (read_script_file): New local variables name and search_path. Update
1238         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1239         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1240         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1241
1242 2011-11-11  Sterling Augustine  <saugustine@google.com>
1243
1244         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1245         (file_or_sections_cmd): Likewise.
1246
1247 2011-11-11  Doug Kwan  <dougkwan@google.com>
1248
1249         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1250         if --just-symbols is given.
1251
1252 2011-11-10  Doug Kwan  <dougkwan@google.com>
1253
1254         PR gold/13362
1255         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1256         when processing data relocs.
1257         * reloc.h (Relocate_functions::rel_unaligned): New method.
1258         (Relocate_functions::pcrel_unaligned): Ditto.
1259         (Relocate_functions::rel32_unaligned): Ditto.
1260         (Relocate_functions::pcrel32_unaligned): Ditto.
1261
1262 2011-11-09  Doug Kwan  <dougkwan@google.com>
1263
1264         PR gold/13362
1265         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1266         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1267         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1268         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1269         (Relocate_functions::rel_unaligned): New.
1270         (Relocate_functions::rel32_unaligned): New.
1271         * target-reloc.h (relocate_for_relocatable): Add code to handle
1272         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1273         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1274         arm_unaligned_reloc_r): New targets.
1275         * testsuite/Makefile.in: Regenerate.
1276         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1277         linking.
1278
1279 2011-11-02  Ian Lance Taylor  <iant@google.com>
1280
1281         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1282         NATIVE_LINKER.
1283         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1284         * options.cc (General_options::finalize): Use library search path
1285         from configure script if specified.  If not native and no sysroot,
1286         only search TOOLLIBDIR.
1287         * options.h (Search_directory::Search_directory): Change name to
1288         const std::string&.
1289         (General_options::add_to_library_path_with_sysroot): Change arg to
1290         const std::string&.
1291         * configure, Makefile.in, config.in: Rebuild.
1292
1293 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1294
1295         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1296         we are working around the ARM1176 Erratum.
1297         * options.h (General_options::fix_arm1176): Add option.
1298         * testsuite/Makefile.am: Add testcases, and keep current ones
1299         working.
1300         * testsuite/Makefile.in: Regenerate.
1301         * testsuite/arm_fix_1176.s: New file.
1302         * testsuite/arm_fix_1176.sh: Likewise.
1303
1304 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1305
1306         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1307         may_use_blx_.
1308         (Target_arm::may_use_blx): Remove method.
1309         (Target_arm::set_may_use_blx): Likewise.
1310         (Target_arm::may_use_v4t_interworking): New method.
1311         (Target_arm::may_use_v5t_interworking): Likewise.
1312         (Target_arm::may_use_blx_): Remove member variable.
1313         (Arm_relocate_functions::arm_branch_common): Check for v5T
1314         interworking.
1315         (Arm_relocate_functions::thumb_branch_common): Likewise.
1316         (Reloc_stub::stub_type_for_reloc): Likewise.
1317         (Target_arm::do_finalize_sections): Correct interworking checks.
1318         * testsuite/Makefile.am: Add new tests.
1319         * testsuite/Makefile.in: Regenerate.
1320         * testsuite/arm_farcall_arm_arm.s: New test.
1321         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1322         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1323         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1324         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1325         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1326         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1327         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1328
1329 2011-10-31  Cary Coutant  <ccoutant@google.com>
1330
1331         PR gold/13023
1332         * expression.cc (Expression::eval_with_dot): Add
1333         is_section_dot_assignment parameter.
1334         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1335         absolute and assigning to dot within a section.
1336         * script-sections.cc
1337         (Output_section_element_assignment::set_section_addresses): Pass
1338         dot_section to set_if_absolute.
1339         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1340         as is_section_dot_assignment flag to eval_with_dot.
1341         (Output_section_element_dot_assignment::set_section_addresses):
1342         Likewise.
1343         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1344         parameter.  Also set value if relative to dot_section; set the
1345         symbol's output_section.
1346         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1347         parameter.  Adjust all callers.
1348         (Expression::eval_maybe_dot): Likewise.
1349         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1350         Adjust all callers.
1351         * testsuite/script_test_2.t: Test assignment of an absolute value
1352         to dot within an output section element.
1353
1354 2011-10-31  Cary Coutant  <ccoutant@google.com>
1355
1356         * options.h (class General_options): Add --[no-]gnu-unique options.
1357         * symtab.cc (Symbol_table::sized_write_globals): Convert
1358         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1359
1360 2011-10-31  Cary Coutant  <ccoutant@google.com>
1361
1362         PR gold/13359
1363         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1364         unnecessary assertion.
1365         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1366
1367 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1368
1369         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1370         gc_mark_symbol.
1371         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1372         gc_mark_symbol.
1373         Change to just keep the section associated with symbol.
1374         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1375         they are externally visible and --export-dynamic is turned on.
1376         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1377
1378 2011-10-19  Ian Lance Taylor  <iant@google.com>
1379
1380         PR gold/13163
1381         * script-sections.cc
1382         (Output_section_element_dot_assignment::needs_output_section): New
1383         function.
1384
1385 2011-10-19  Ian Lance Taylor  <iant@google.com>
1386
1387         PR gold/13204
1388         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1389         --section-start option was seen.
1390         * options.h (General_options::any_section_start): New function.
1391
1392 2011-10-18  David S. Miller  <davem@davemloft.net>
1393
1394         PR binutils/13301
1395         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1396         member to track relocation locations that have moved during TLS
1397         reloc optimizations.
1398         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1399         (Target_sparc::Relocate::relocate): Adjust view down by 4
1400         bytes if it matches reloc_adjust_addr_.
1401         (Target_sparc::Relocate::relocate_tls): Always move the
1402         __tls_get_addr call delay slot instruction forward 4 bytes when
1403         performing relaxation.
1404
1405 2011-10-18  Cary Coutant  <ccoutant@google.com>
1406
1407         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1408         (Output_file::map_no_anonymous): Check for non-zero
1409         return code from posix_fallocate.
1410
1411 2011-10-17  Cary Coutant  <ccoutant@google.com>
1412
1413         PR gold/13245
1414         * plugin.cc (is_visible_from_outside): Check for symbols
1415         referenced from dynamic objects.
1416         * resolve.cc (Symbol_table::resolve): Don't count references
1417         from dynamic objects as references from real ELF files.
1418         * testsuite/plugin_test_2.sh: Adjust expected result.
1419
1420 2011-10-17  Cary Coutant  <ccoutant@google.com>
1421
1422         * gold.cc: Include timer.h.
1423         (queue_middle_tasks): Stamp time.
1424         (queue_final_tasks): Likewise.
1425         * main.cc (main): Store timer in parameters.  Print timers
1426         for each pass.
1427         * parameters.cc (Parameters::Parameters): Initialize timer_.
1428         (Parameters::set_timer): New function.
1429         (set_parameters_timer): New function.
1430         * parameters.h (Parameters::set_timer): New function.
1431         (Parameters::timer): New function.
1432         (Parameters::timer_): New data member.
1433         (set_parameters_timer): New function.
1434         * timer.cc (Timer::stamp): New function.
1435         (Timer::get_pass_time): New function.
1436         * timer.h (Timer::stamp): New function.
1437         (Timer::get_pass_time): New function.
1438         (Timer::pass_times_): New data member.
1439
1440 2011-10-17  Cary Coutant  <ccoutant@google.com>
1441
1442         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1443         task for members of lib groups.
1444
1445 2011-10-17  Cary Coutant  <ccoutant@google.com>
1446
1447         PR gold/13288
1448         * fileread.cc (File_read::find_view): Add assert.
1449         (File_read::make_view): Move bounds check (replace with assert)...
1450         (File_read::find_or_make_view): ... to here.
1451
1452 2011-10-12  Cary Coutant  <ccoutant@google.com>
1453
1454         * output.cc (Output_file::open_base_file): Handle case where
1455         ::read returns less than requested size.
1456
1457 2011-10-10  Cary Coutant  <ccoutant@google.com>
1458
1459         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1460         Initialize defined_count_.
1461         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1462         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1463         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1464         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1465         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1466         * incremental.h (Sized_relobj_incr::defined_count_): New data
1467         member.
1468         (Sized_incr_dynobj::defined_count_): New data member.
1469         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1470         Return zeroes instead of internal error.
1471
1472 2011-10-10  Cary Coutant  <ccoutant@google.com>
1473
1474         PR gold/13249
1475         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1476         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1477         * output.h (class Output_reloc): Add use_plt_offset flag.
1478         (Output_reloc::type_): Adjust size of bit field.
1479         (Output_reloc::use_plt_offset_): New bit field.
1480         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1481         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1482         flag.  Adjust all callers.
1483         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1484         creating RELATIVE relocations.
1485
1486 2011-10-10  Nick Clifton  <nickc@redhat.com>
1487
1488         * po/es.po: Updated Spanish translation.
1489         * po/fi.po: Updated Finnish translation.
1490
1491 2011-10-03   Diego Novillo  <dnovillo@google.com>
1492
1493         * options.cc (parse_uint): Fix dereference of RETVAL.
1494
1495 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1496
1497         * layout.h (section_order_map_): New member.
1498         (get_section_order_map): New member function.
1499         * output.cc (Output_section::add_input_section): Check for patterns
1500         only when --section-ordering-file is specified.
1501         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1502         output_sections have been formed.
1503         * layout.cc (Layout_Layout): Initialize section_order_map_.
1504         * plugin.cc (update_section_order): Store order in order_map. Do not
1505         update the order.
1506         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1507         * testsuite/Makefile.in: Regenerate.
1508         * testsuite/plugin_section_order.c: New file.
1509         * testsuite/plugin_final_layout.cc: New file.
1510         * testsuite/plugin_final_layout.sh: New file.
1511
1512 2011-09-29  Cary Coutant  <ccoutant@google.com>
1513
1514         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1515         Check for NULL.
1516         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1517         symbols during incremental update.
1518         (Symbol_table::add_from_dynobj): Likewise.
1519
1520 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1521             Ian Lance Taylor  <iant@google.com>
1522
1523         * symtab.cc (Symbol_table::define_special_symbol): Always
1524         canonicalize version string.
1525
1526 2011-09-26  Cary Coutant  <ccoutant@google.com>
1527
1528         * gold.cc (queue_initial_tasks): Move option checks ...
1529         * options.cc (General_options::finalize): ... to here. Disable
1530         some options; make others fatal.
1531
1532 2011-09-26  Cary Coutant  <ccoutant@google.com>
1533
1534         gcc PR lto/47247
1535         * plugin.cc (get_symbols_v2): New function.
1536         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1537         (is_referenced_from_outside): New function.
1538         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1539         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1540         (get_symbols): Pass version parameter.
1541         (get_symbols_v2): New function.
1542         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1543         parameter.
1544         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1545         (onload): Add LDPT_GET_SYMBOLS_V2.
1546         (all_symbols_read_hook): Use get_symbols_v2; check for
1547         LDPR_PREVAILING_DEF_IRONLY_EXP.
1548         * testsuite/plugin_test_3.sh: Update expected results.
1549
1550 2011-09-23  Simon Baldwin  <simonb@google.com>
1551
1552         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1553         configuration options.
1554         * configure: Regenerate.
1555         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1556         * Makefile.in: Regenerate.
1557         * testsuite/Makefile.in: Regenerate.
1558
1559 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1560
1561         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1562
1563 2011-09-19  Cary Coutant  <ccoutant@google.com>
1564
1565         * incremental.cc (can_incremental_update): Fix typo in comment.
1566         * incremental.h (can_incremental_update): Likewise.
1567
1568 2011-09-18  Cary Coutant  <ccoutant@google.com>
1569
1570         * incremental.cc (can_incremental_update): New function.
1571         * incremental.h (can_incremental_update): New function.
1572         * layout.cc (Layout::init_fixed_output_section): Call it.
1573         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1574         * object.cc (Sized_relobj_file::do_layout): Call
1575         can_incremental_update.
1576
1577 2011-09-13  Cary Coutant  <ccoutant@google.com>
1578
1579         * configure.ac: Check for glibc support for gnu_indirect_function
1580         support with static linking, setting automake conditional
1581         IFUNC_STATIC.
1582         * Makefile.in: Regenerate.
1583         * configure: Regenerate.
1584
1585         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1586         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1587         for IFUNC_STATIC.
1588         * testsuite/Makefile.in: Regenerate.
1589
1590 2011-09-13  Cary Coutant  <ccoutant@google.com>
1591
1592         * incremental.cc (Sized_relobj_incr::do_layout): Call
1593         report_comdat_group for kept comdat sections.
1594         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1595         * testsuite/Makefile.in: Regenerate.
1596         * testsuite/incr_comdat_test_1.cc: New source file.
1597         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1598         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1599         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1600
1601 2011-09-13  Ian Lance Taylor  <iant@google.com>
1602
1603         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1604         variable external_symbols_offset.
1605
1606 2011-09-12  Ian Lance Taylor  <iant@google.com>
1607
1608         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1609         triggered if object has no symbols.
1610
1611 2011-09-09  David S. Miller  <davem@davemloft.net>
1612
1613         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1614         (Output_fill_debug_line::do_write): Likewise.
1615
1616 2011-08-29  Cary Coutant  <ccoutant@google.com>
1617
1618         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1619         casts to match formatting specs.
1620         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1621
1622 2011-08-26  Cary Coutant  <ccoutant@google.com>
1623
1624         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1625         remaining hole size when allocating.
1626         (Layout::make_output_section): Set fill methods for debug sections.
1627         * layout.h (Free_list::Free_list_node): Move from private to
1628         public.
1629         (Free_list::set_min_hole_size): New function.
1630         (Free_list::begin, Free_list::end): New functions.
1631         (Free_list::min_hole_): New data member.
1632         * output.cc: Include dwarf.h.
1633         (Output_fill_debug_info::do_minimum_hole_size): New function.
1634         (Output_fill_debug_info::do_write): New function.
1635         (Output_fill_debug_line::do_minimum_hole_size): New function.
1636         (Output_fill_debug_line::do_write): New function.
1637         (Output_section::Output_section): Initialize new data member.
1638         (Output_section::set_final_data_size): Ensure patch space is larger
1639         than minimum hole size.
1640         (Output_section::do_write): Fill holes in debug sections.
1641         * output.h (Output_fill): New class.
1642         (Output_fill_debug_info): New class.
1643         (Output_fill_debug_line): New class.
1644         (Output_section::set_free_space_fill): New function.
1645         (Output_section::free_space_fill_): New data member.
1646         * testsuite/Makefile.am (incremental_test_3): Add
1647         --incremental-patch option.
1648         (incremental_test_4): Likewise.
1649         (incremental_test_5): Likewise.
1650         (incremental_test_6): Likewise.
1651         (incremental_copy_test): Likewise.
1652         (incremental_common_test_1): Likewise.
1653         * testsuite/Makefile.in: Regenerate.
1654
1655 2011-08-26  Nick Clifton  <nickc@redhat.com>
1656
1657         * po/es.po: Updated Spanish translation.
1658
1659 2011-08-01  Cary Coutant  <ccoutant@google.com>
1660
1661         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1662         * gold/testsuite/Makefile.in: Regenerate.
1663         * gold/testsuite/justsyms_exec.c: New source file.
1664         * gold/testsuite/justsyms_lib.c: New source file.
1665
1666 2011-08-01  Cary Coutant  <ccoutant@google.com>
1667
1668         * layout.cc (Layout::set_segment_offsets): Don't realign text
1669         segment if -Ttext was specified.
1670         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1671         file type.
1672         * object.h (Sized_relobj_file::e_type): New function.
1673         (Sized_relobj_file::e_type_): New data member.
1674         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1675         base address for ET_EXEC files.
1676         * target.cc (Target::do_make_elf_object_implementation): Allow
1677         ET_EXEC files with --just-symbols option.
1678
1679 2011-07-28  Cary Coutant  <ccoutant@google.com>
1680
1681         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1682         Add thread_number parameter.
1683         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1684         * workqueue-threads.cc
1685         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1686         current thread if its thread number is greater than desired thread
1687         count.
1688         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1689         Add thread_number parameter.
1690         (Workqueue::should_cancel_thread): Likewise.
1691         (Workqueue::find_runnable_or_wait): Pass thread_number to
1692         should_cancel_thread.
1693         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1694         parameter.
1695
1696 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1697
1698         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1699         only after checking if it cannot be forced local.
1700         * symtab.h (is_externally_visible): Check if the symbol is not forced
1701         local.
1702
1703 2011-07-15  Ian Lance Taylor  <iant@google.com>
1704
1705         * options.h (class General_options): Add --print-output-format.
1706         Move -EL next to -EB, for  better --help output.
1707         * target-select.cc: Include <cstdio>, "options.h", and
1708         "parameters.h".
1709         (Target_selector::do_target_bfd_name): New function.
1710         (print_output_format): New function.
1711         * target-select.h (class Target_selector): Update declarations.
1712         (Target_selector::target_bfd_name): New function.
1713         (print_output_format): Declare.
1714         * main.cc: Include "target-select.h".
1715         (main): Handle --print-output-format.
1716         * gold.cc: Include "target-select.h".
1717         (queue_initial_tasks): Handle --print-output-format when there are
1718         no input files.
1719         * parameters.cc (parameters_force_valid_target): Give a better
1720         error message if -EB/-EL does not match target.
1721         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1722         function.
1723
1724 2011-07-15  Ian Lance Taylor  <iant@google.com>
1725
1726         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1727         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1728         (Output_data_plt_i386::do_write): Write address of .dynamic
1729         section to first entry in .got.plt section.
1730         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1731         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1732         Initialize layout_.
1733         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1734         section to first entry in .got.plt section.
1735         * layout.h (Layout::dynamic_section): New function.
1736
1737 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1738
1739         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1740         to claim_file call.
1741         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1742         input_section_position_, and input_section_glob_.
1743         (read_layout_from_file): Call function section_ordering_specified.
1744         * layout.h (is_section_ordering_specified): New function.
1745         (section_ordering_specified): New function.
1746         (section_ordering_specified_): New boolean member.
1747         * main.cc(main): Call load_plugins after layout object is defined.
1748         * output.cc (Output_section::add_input_section): Use
1749         function section_ordering_specified to check if section ordering is
1750         needed.
1751         * output.cc (Output_section::add_relaxed_input_section): Use
1752         function section_ordering_specified to check if section ordering is
1753         needed.
1754         (Output_section::update_section_layout): New function.
1755         (Output_section::sort_attached_input_sections): Check if input section
1756         must be reordered.
1757         * output.h (Output_section::update_section_layout): New function.
1758         * plugin.cc (get_section_count): New function.
1759         (get_section_type): New function.
1760         (get_section_name): New function.
1761         (get_section_contents): New function.
1762         (update_section_order): New function.
1763         (allow_section_ordering): New function.
1764         (Plugin::load): Add the new interfaces to the transfer vector.
1765         (Plugin_manager::load_plugins): New parameter.
1766         (Plugin_manager::all_symbols_read): New parameter.
1767         (Plugin_manager::claim_file): New parameter. Save the elf object for
1768         unclaimed objects.
1769         (Plugin_manager::get_elf_object): New function.
1770         (Plugin_manager::get_view): Change to directly use the bool to check
1771         if get_view is called from claim_file_hook.
1772         * plugin.h (input_objects): New function
1773         (Plugin__manager::load_plugins): New parameter.
1774         (Plugin_manager::claim_file): New parameter.
1775         (Plugin_manager::get_elf_object): New function.
1776         (Plugin_manager::in_claim_file_handler): New function.
1777         (Plugin_manager::in_claim_file_handler_): New member.
1778         (layout): New function.
1779         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1780         handler with an extra parameter. Make the elf object before calling
1781         claim_file handler.
1782         * testsuite/plugin_test.c (get_section_count): New function pointer.
1783         (get_section_type): New function pointer.
1784         (get_section_name): New function pointer.
1785         (get_section_contents): New function pointer.
1786         (update_section_order): New function pointer.
1787         (allow_section_ordering): New function pointer.
1788         (onload): Check if the new interfaces exist.
1789
1790 2011-07-13  Ian Lance Taylor  <iant@google.com>
1791
1792         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1793         relro section.
1794         * x86_64.cc (Target_x86_64::got_section): Likewise.
1795         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1796         (relro_now_test_SOURCES): New variable.
1797         (relro_now_test_DEPENDENCIES): New variable.
1798         (relro_now_test_LDFLAGS): New variable.
1799         (relro_now_test_LDADD): New variable.
1800         (relro_now_test.so): New target.
1801         * testsuite/Makefile.in: Rebuild.
1802
1803 2011-07-12  Ian Lance Taylor  <iant@google.com>
1804
1805         PR gold/12980
1806         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1807         GLOB_DAT relocation rather than a RELATIVE relocation for a
1808         protected symbol when creating a shared library.
1809         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1810         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1811         * testsuite/protected_main_1.cc (main): Test that protected
1812         function has same address.
1813
1814 2011-07-11  Ian Lance Taylor  <iant@google.com>
1815
1816         PR gold/12979
1817         * options.h (class General_options): Add -Bgroup.
1818         * options.cc (General_options::finalize): If -Bgroup is set,
1819         default to --unresolved-symbols=report-all.
1820         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1821         * target-reloc.h (issue_undefined_symbol_error): Handle
1822         --unresolved-symbols=report-all.
1823
1824 2011-07-08  Ian Lance Taylor  <iant@google.com>
1825
1826         PR gold/11985
1827         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1828         if linker script discards key sections.
1829         (Layout::create_dynamic_symtab): Likewise.
1830         (Layout::assign_local_dynsym_offsets): Likewise.
1831         (Layout::sized_create_version_sections): Likewise.
1832         (Layout::create_interp): Likewise.
1833         (Layout::finish_dynamic_section): Likewise.
1834         (Layout::set_dynamic_symbol_size): Likewise.
1835
1836 2011-07-08  Ian Lance Taylor  <iant@google.com>
1837
1838         PR gold/12386
1839         * options.h (class General_options): Add --unresolved-symbols.
1840         * target-reloc.h (issue_undefined_symbol_error): Check
1841         --unresolved-symbols.  Add comments.
1842
1843 2011-07-08  Ian Lance Taylor  <iant@google.com>
1844
1845         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1846         expression more complex.
1847
1848 2011-07-08  Ian Lance Taylor  <iant@google.com>
1849
1850         PR gold/11317
1851         * target-reloc.h (issue_undefined_symbol_error): New inline
1852         function, broken out of relocate_section.
1853         (relocate_section): Call issue_undefined_symbol_error.
1854         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1855         there is no TLS segment if we are about to issue an undefined
1856         symbol error.
1857         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1858
1859 2011-07-08  Ian Lance Taylor  <iant@google.com>
1860
1861         PR gold/12279
1862         * resolve.cc (Symbol_table::should_override): Add fromtype
1863         parameter.  Change all callers.  Give error when linking together
1864         TLS and non-TLS symbol.
1865         (Symbol_table::should_override_with_special): Add fromtype
1866         parameter.  Change all callers.
1867         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1868         there is no TLS segment if we have reported some errors.
1869         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1870
1871 2011-07-08  Ian Lance Taylor  <iant@google.com>
1872
1873         PR gold/12372
1874         * target.h (Target::plt_address_for_global): New function.
1875         (Target::plt_address_for_local): New function.
1876         (Target::plt_section_for_global): Remove.
1877         (Target::plt_section_for_local): Remove.
1878         (Target::do_plt_address_for_global): New virtual function.
1879         (Target::do_plt_address_for_local): New virtual function.
1880         (Target::do_plt_section_for_global): Remove.
1881         (Target::do_plt_section_for_local): Remove.
1882         (Target::register_global_plt_entry): Add Symbol_table and Layout
1883         parameters.
1884         * output.cc (Output_data_got::Got_entry::write): Use
1885         plt_address_for_global and plt_address_for_local.
1886         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1887         address of output section.
1888         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1889         got_irelative_, and irelative_count_ fields.  Update
1890         declarations.
1891         (Output_data_plt_i386::has_irelative_section): New function.
1892         (Output_data_plt_i386::entry_count): Add irelative_count_.
1893         (Output_data_plt_i386::set_final_data_size): Likewise.
1894         (class Target_i386): Add got_irelative_ and rel_irelative_
1895         fields.  Update declarations.
1896         (Target_i386::Target_i386): Initialize new fields.
1897         (Target_i386::do_plt_address_for_global): New function replacing
1898         do_plt_section_for_global.
1899         (Target_i386::do_plt_address_for_local): New function replacing
1900         do_plt_section_for_local.
1901         (Target_i386::got_section): Create got_irelative_.
1902         (Target_i386::rel_irelative_section): New function.
1903         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1904         fields.  Don't define __rel_iplt_{start,end}.
1905         (Output_data_plt_i386::add_entry): Add symtab and layout
1906         parameters.  Change all callers.  Use different PLT and GOT for
1907         IFUNC symbols.
1908         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1909         layout parameters.  Change all callers.  Use different PLT and
1910         GOT.
1911         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1912         (Output_data_plt_i386::rel_irelative): New function.
1913         (Output_data_plt_i386::address_for_global): New function.
1914         (Output_data_plt_i386::address_for_local): New function.
1915         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1916         IRELATIVE GOT when changing IFUNC GOT entries.
1917         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1918         reloc.
1919         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1920         if we didn't create an IRELATIVE GOT.
1921         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1922         plt_address_for_local.
1923         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1924         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1925         got_irelative_, and irelative_count_ fields.  Update
1926         declarations.
1927         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1928         Initialize new fields.  Remove symtab parameter.  Change all
1929         callers.
1930         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1931         irelative_count_.
1932         (Output_data_plt_x86_64::has_irelative_section): New function.
1933         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1934         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1935         fields.  Update declarations.
1936         (Target_x86_64::Target_x86_64): Initialize new fields.
1937         (Target_x86_64::do_plt_address_for_global): New function replacing
1938         do_plt_section_for_global.
1939         (Target_x86_64::do_plt_address_for_local): New function replacing
1940         do_plt_section_for_local.
1941         (Target_x86_64::got_section): Create got_irelative_.
1942         (Target_x86_64::rela_irelative_section): New function.
1943         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1944         all callers.  Don't create __rel_iplt_{start,end}.
1945         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1946         parameters.  Change all callers.  Use different PLT and GOT for
1947         IFUNC symbols.
1948         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1949         layout parameters.  Change all callers.  Use different PLT and
1950         GOT.
1951         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1952         parameters.  Change all callers.  Use different PLT and GOT for
1953         IFUNC symbols.
1954         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1955         (Output_data_plt_x86_64::rela_irelative): New function.
1956         (Output_data_plt_x86_64::address_for_global): New function.
1957         (Output_data_plt_x86_64::address_for_local): New function.
1958         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1959         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1960         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1961         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1962         parameters.
1963         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1964         reloc.
1965         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1966         symbols if we didn't create an IRELATIVE GOT.
1967         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1968         plt_address_for_local.
1969         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1970         * testsuite/ifuncvar1.c: New test file.
1971         * testsuite/ifuncvar2.c: New test file.
1972         * testsuite/ifuncvar3.c: New test file.
1973         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1974         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1975         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1976         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1977         * testsuite/Makefile.in: Rebuild.
1978
1979 2011-07-07  Cary Coutant  <ccoutant@google.com>
1980
1981         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1982         (two_file_test_1_ndebug.o): Likewise.
1983         (two_file_test_1b_ndebug.o): Likewise.
1984         (two_file_test_2_ndebug.o): Likewise.
1985         (two_file_test_main_ndebug.o): Likewise.
1986         (incremental_test_2): Link with no-debug versions.
1987
1988 2011-07-06  Cary Coutant  <ccoutant@google.com>
1989
1990         * gold/incremental.cc
1991         (Output_section_incremental_inputs::write_info_blocks): Check for
1992         hidden and internal symbols.
1993
1994 2011-07-06  Cary Coutant  <ccoutant@google.com>
1995
1996         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1997         Check disposition for startup file.
1998         (Incremental_inputs::report_command_line): Ignore
1999         --incremental-startup-unchanged option.
2000         * options.cc (General_options::parse_incremental_startup_unchanged):
2001         New function.
2002         (General_options::General_options): Initialize new data member.
2003         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2004         (General_options): Add --incremental-startup-unchanged option.
2005         (General_options::incremental_startup_disposition): New function.
2006         (General_options::incremental_startup_disposition_): New data member.
2007
2008 2011-07-06  Cary Coutant  <ccoutant@google.com>
2009
2010         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2011         input file index to Script_info ctor.
2012         (Sized_incremental_binary::do_file_has_changed): Find the
2013         command-line argument for files named in scripts.
2014         * incremental.h (Script_info::Script_info): New ctor
2015         with input file index.
2016         (Script_info::input_file_index): New function.
2017         (Script_info::input_file_index_): New data member.
2018         (Incremental_binary::get_library): Add const.
2019         (Incremental_binary::get_script_info): Add const.
2020         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2021         * testsuite/Makefile.am (incremental_test_5): New test case.
2022         (incremental_test_6): New test case.
2023         * testsuite/Makefile.in: Regenerate.
2024
2025 2011-07-06  Cary Coutant  <ccoutant@google.com>
2026
2027         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2028         debug output when command lines differ.
2029
2030 2011-07-06  Cary Coutant  <ccoutant@google.com>
2031
2032         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2033         --incremental-patch option.
2034         * layout.cc (Free_list::allocate): Extend allocation beyond original
2035         end if enabled.
2036         (Layout::make_output_section): Mark sections that should get
2037         patch space.
2038         * options.cc (parse_percent): New function.
2039         * options.h (parse_percent): New function.
2040         (DEFINE_percent): New macro.
2041         (General_options): Add --incremental-patch option.
2042         * output.cc (Output_section::Output_section): Initialize new data
2043         members.
2044         (Output_section::add_input_section): Print section name when out
2045         of patch space.
2046         (Output_section::add_output_section_data): Likewise.
2047         (Output_section::set_final_data_size): Add patch space when
2048         doing --incremental-full.
2049         (Output_section::do_reset_address_and_file_offset): Remove patch
2050         space.
2051         (Output_segment::set_section_list_addresses): Print debug output
2052         only if --incremental-update.
2053         * output.h (Output_section::set_is_patch_space_allowed): New function.
2054         (Output_section::is_patch_space_allowed_): New data member.
2055         (Output_section::patch_space_): New data member.
2056         * parameters.cc (Parameters::incremental_full): New function.
2057         * parameters.h (Parameters::incremental_full): New function
2058         * testsuite/Makefile.am (incremental_test_2): Add test for
2059         --incremental-patch option.
2060         * testsuite/Makefile.in: Regenerate.
2061         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2062         (t18): Remove function body.
2063
2064 2011-07-05  Doug Kwan  <dougkwan@google.com>
2065
2066         PR gold/12771
2067         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2068         Arm_Address type for relocation result.
2069         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2070         overflow check.
2071         (Arm_relocate_functions::abs32): Use unaligned access.
2072         (Arm_relocate_functions::rel32): Ditto.
2073         (Arm_relocate_functions::prel31): Ditto.
2074         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2075         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2076         static data relocations.
2077         * testsuite/Makefile.in: Regnerate.
2078         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2079
2080 2011-07-05  Ian Lance Taylor  <iant@google.com>
2081
2082         PR gold/12392
2083         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2084         symbols if necessary.
2085         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2086
2087 2011-07-05  Ian Lance Taylor  <iant@google.com>
2088
2089         PR gold/12952
2090         * resolve.cc (Symbol::override_base_with_special): Simply override
2091         version with special symbol version, ignoring previous version.
2092
2093 2011-07-05  Ian Lance Taylor  <iant@google.com>
2094
2095         * object.cc (Sized_relobj_file::include_section_group): Add
2096         information to comment about signature location.
2097
2098 2011-07-02  Ian Lance Taylor  <iant@google.com>
2099
2100         PR gold/12957
2101         * options.h (class General_options): Add -f and -F.
2102         * options.cc (General_options::finalize): Fatal error if -f/-F
2103         are used without -shared.
2104         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2105
2106 2011-07-02  Ian Lance Taylor  <iant@google.com>
2107
2108         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2109
2110 2011-07-01  Ian Lance Taylor  <iant@google.com>
2111
2112         PR gold/12525
2113         PR gold/12952
2114         * resolve.cc (Symbol::override_base_with_special): Don't override
2115         the version if the overriding symbol has a different name.
2116         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2117         all callers.  If we give an error about an undefined version,
2118         define the base version if necessary.
2119         * dynobj.h (class Versions): Update declaration.
2120         * testsuite/weak_alias_test_5.cc: New file.
2121         * testsuite/weak_alias_test.script: New file.
2122         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2123         and versioned_alias have the right value, and call t2.
2124         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2125         weak_alias_test_5.so.
2126         (weak_alias_test_LDADD): Likewise.
2127         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2128         * testsuite/Makefile.in: Rebuild.
2129
2130 2011-07-01  Ian Lance Taylor  <iant@google.com>
2131
2132         PR gold/12525
2133         * options.h (class General_options): Support -z notext.
2134         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2135         -Wl,-z,notext.
2136         (two_file_shared_nonpic.so): Likewise.
2137         (two_file_shared_mixed.so): Likewise.
2138         (two_file_shared_mixed_1.so): Likewise.
2139         (weak_undef_lib_nonpic.so): Likewise.
2140         (alt/weak_undef_lib_nonpic.so): Likewise.
2141         (tls_test_shared_nonpic.so): Likewise.
2142         * testsuite/Makefile.in: Rebuild.
2143
2144 2011-07-01  Ian Lance Taylor  <iant@google.com>
2145
2146         PR gold/12525
2147         * configure.ac: Test whether static linking works, setting
2148         the automake conditional HAVE_STATIC.
2149         * testsuite/Makefile.am: Disable tests using -static if
2150         HAVE_STATIC is not true.
2151         * configure, testsuite/Makefile.in: Rebuild.
2152
2153 2011-07-01  Ian Lance Taylor  <iant@google.com>
2154
2155         PR gold/12525
2156         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2157         Assert if we see DW_EH_PE_indirect.
2158         * target.h (Target::ehframe_datarel_base): New function.
2159         (Target::do_ehframe_datarel_base): New target function.
2160         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2161         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2162         function.
2163
2164 2011-07-01  Ian Lance Taylor  <iant@google.com>
2165
2166         PR gold/12571
2167         * options.h (class General_options): Add
2168         --ld-generated-unwind-info.
2169         * ehframe.cc (Fde::write): Add address parameter.  Change all
2170         callers.  If associated with PLT, fill in address and size.
2171         (Cie::set_output_offset): Only add merge mapping if there is an
2172         object.
2173         (Cie::write): Add address parameter.  Change all callers.
2174         (Eh_frame::add_ehframe_for_plt): New function.
2175         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2176         input_offset_ fields into union u_, with new plt field.
2177         (Fde::Fde): Adjust for new union field.
2178         (Fde::Fde) [Output_data version]: New constructor.
2179         (Fde::add_mapping): Only add merge mapping if there is an object.
2180         (class Cie): Update declarations.
2181         (class Eh_frame): Declare add_ehframe_for_plt.
2182         * layout.cc (Layout::layout_eh_frame): Break out code into
2183         make_eh_frame_section, and call it.
2184         (Layout::make_eh_frame_section): New function.
2185         (Layout::add_eh_frame_for_plt): New function.
2186         * layout.h (class Layout): Update declarations.
2187         * merge.cc (Merge_map::add_mapping): Add assertion.
2188         * i386.cc: Include "dwarf.h".
2189         (class Output_data_plt_i386): Make first_plt_entry,
2190         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2191         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2192         and plt_eh_frame_fde.
2193         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2194         boundary.  Call add_eh_frame_for_plt if appropriate.
2195         * x86_64.cc: Include "dwarf.h".
2196         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2197         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2198         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2199         and plt_eh_frame_fde.
2200         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2201         appropriate.
2202
2203 2011-06-29  Ian Lance Taylor  <iant@google.com>
2204
2205         PR gold/12629
2206         * object.cc (Sized_relobj_file::layout_section): Change shdr
2207         parameter to be const.
2208         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2209         out of do_layout.
2210         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2211         appropriate.  Call layout_eh_frame_section.
2212         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2213         sections.
2214         * object.h (class Sized_relobj_file): Update declarations.
2215
2216 2011-06-29  Ian Lance Taylor  <iant@google.com>
2217
2218         PR gold/12652
2219         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2220         modifier.
2221         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2222
2223 2011-06-29  Ian Lance Taylor  <iant@google.com>
2224
2225         PR gold/12675
2226         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2227         SHT_X86_64_UNWIND.
2228         * layout.cc (Layout::layout_eh_frame): Likewise.
2229
2230 2011-06-29  Ian Lance Taylor  <iant@google.com>
2231
2232         PR gold/12695
2233         * layout.cc (Layout::symtab_section_shndx): New function.
2234         * layout.h (class Layout): Declare symtab_section_shndx.
2235         * output.cc (Output_section::write_header): Call it.
2236
2237 2011-06-29  Ian Lance Taylor  <iant@google.com>
2238
2239         PR gold/12818
2240         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2241         symbols which are not used in a relocation.
2242
2243 2011-06-28  Ian Lance Taylor  <iant@google.com>
2244
2245         PR gold/12898
2246         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2247         script create indistinguishable segments.
2248         (Layout::set_segment_offsets): Use stable_sort when sorting
2249         segments.  Pass this to Compare_segments constructor.
2250         * layout.h (class Layout): Make segment_precedes non-static.
2251         (class Compare_segments): Change from struct to class.  Add
2252         layout_ field.  Add constructor.
2253         * script-sections.cc
2254         (Script_sections::attach_sections_using_phdrs_clause): Rename
2255         local orphan to is_orphan.  Don't report failure to put empty
2256         section in segment.  On attachment failure, report name of
2257         section, and attach to first PT_LOAD segment.
2258
2259 2011-06-28  Ian Lance Taylor  <iant@google.com>
2260
2261         PR gold/12934
2262         * target-select.cc (Target_selector::Target_selector): Add
2263         emulation parameter.  Change all callers.
2264         (select_target_by_bfd_name): Rename from select_target_by_name.
2265         Change all callers.
2266         (select_target_by_emulation): New function.
2267         (supported_emulation_names): New function.
2268         * target-select.h (class Target_selector): Add emulation_ field.
2269         Update declarations.
2270         (Target_selector::recognize_by_bfd_name): Rename from
2271         recognize_by_name.  Change all callers.
2272         (Target_selector::supported_bfd_names): Rename from
2273         supported_names.  Change all callers.
2274         (Target_selector::recognize_by_emulation): New function.
2275         (Target_selector::supported_emulations): New function.
2276         (Target_selector::emulation): New function.
2277         (Target_selector::do_recognize_by_bfd_name): Rename from
2278         do_recognize_by_name.  Change all callers.
2279         (Target_selector::do_supported_bfd_names): Rename from
2280         do_supported_names.  Change all callers.
2281         (Target_selector::do_recognize_by_emulation): New function.
2282         (Target_selector::do_supported_emulations): New function.
2283         (select_target_by_bfd_name): Change name in declaration.
2284         (select_target_by_emulation): Declare.
2285         (supported_emulation_names): Declare.
2286         * parameters.cc (parameters_force_valid_target): Try to find
2287         target based on emulation from -m option.
2288         * options.h (class General_options): Change doc string for -m.
2289         * options.cc (help): Print emulations.
2290         (General_options::parse_V): Likewise.
2291         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2292         Add emulation parameter.  Change all callers.
2293
2294 2011-06-28  Ian Lance Taylor  <iant@google.com>
2295
2296         * target.h (class Target): Add osabi_ field.
2297         (Target::osabi): New function.
2298         (Target::set_osabi): New function.
2299         (Target::Target): Initialize osabi_.
2300         (Target::do_adjust_elf_header): Make pure virtual.
2301         (Sized_target::do_adjust_elf_header): Declare.
2302         * target.cc (Sized_target::do_adjust_elf_header): New function.
2303         (class Sized_target): Instantiate all versions.
2304         * freebsd.h (class Target_freebsd): Remove.
2305         (Target_selector_freebsd::do_recognize): Call set_osabi on
2306         Target.
2307         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2308         (Target_selector_freebsd::set_osabi): Remove.
2309         * i386.cc (class Target_i386): Inherit from Sized_target rather
2310         than Target_freebsd.
2311         * x86_64.cc (class Target_x86_64): Likewise.
2312
2313 2011-06-28  Ian Lance Taylor  <iant@google.com>
2314
2315         * target.h (Target::can_check_for_function_pointers): Rewrite.
2316         Make non-virtual.
2317         (Target::can_icf_inline_merge_sections): Likewise.
2318         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2319         (Target::Target_info): Add can_icf_inline_merge_sections field.
2320         (Target::do_can_check_for_function_pointers): New virtual
2321         function.
2322         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2323         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2324         from can_check_for_function_pointers, move in file.
2325         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2326         section_may_have_icf_unsafe_poineters, move in file.
2327         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2328         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2329         Rename from can_check_for_function_pointers, move in file.
2330         (Target_i386::can_icf_inline_merge_sections): Remove.
2331         (Target_i386::i386_info): Initialize
2332         can_icf_inline_merge_sections.
2333         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2334         Initialize can_icf_inline_merge_sections.
2335         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2336         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2337         Rename from can_check_for_function_pointers, move in file.
2338         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2339         (Target_x86_64::x86_64_info): Initialize
2340         can_icf_inline_merge_sections.
2341         * testsuite/testfile.cc (Target_test::test_target_info):
2342         Likewise.
2343         * icf.cc (get_section_contents): Correct formatting.
2344
2345 2011-06-27  Ian Lance Taylor  <iant@google.com>
2346
2347         * symtab.cc (Symbol::versioned_name): New function.
2348         (Symbol_table::add_to_final_symtab): Use versioned_name when
2349         appropriate.
2350         (Symbol_table::sized_write_symbol): Likewise.
2351         * symtab.h (class Symbol): Declare versioned_name.
2352         * stringpool.h (class Stringpool_template): Add variant of add
2353         which takes a std::basic_string.
2354         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2355         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2356         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2357         (ver_test_12.o): New target.
2358         * testsuite/Makefile.in: Rebuild.
2359
2360 2011-06-27  Doug Kwan  <dougkwan@google.com>
2361
2362         * arm.cc (Arm_relocate_functions::thm_jump8,
2363         Arm_relocate_functions::thm_jump11): Use a wider signed
2364         type to compute offset.
2365         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2366         arm_thm_jump8.
2367         * testsuite/Makefile.in: Regenerate.
2368         * testsuite/arm_branch_in_range.sh: Check test results of
2369         arm_thm_jump11 and arm_thm_jump8.
2370         * testsuite/arm_thm_jump11.s: New test source file.
2371         * testsuite/arm_thm_jump11.t: New linker script.
2372         * testsuite/arm_thm_jump8.s: New test source file.
2373         * testsuite/arm_thm_jump8.t: New linker script.
2374
2375 2011-06-24  Ian Lance Taylor  <iant@google.com>
2376
2377         * layout.cc: Include "object.h".
2378         (ctors_sections_in_init_array): New static variable.
2379         (Layout::is_ctors_in_init_array): New function.
2380         (Layout::layout): Add entry to ctors_sections_in_init_array if
2381         appropriate.
2382         * layout.h (class Layout): Declare is_ctors_in_init_array.
2383         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2384         is_ctors_reverse_view is set.
2385         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2386         all callers.  Set is_ctors_reverse_view field of View_size.
2387         (Sized_relobj_file::reverse_words): New function.
2388         * object.h (Sized_relobj_file::View_size): Add
2389         is_ctors_reverse_view field.
2390         (class Sized_relobj_file): Update declarations.
2391         * testsuite/initpri3.c: New test.
2392         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2393         initpri3b.
2394         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2395         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2396         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2397         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2398         * testsuite/Makefile.in: Rebuild.
2399
2400 2011-06-24  Cary Coutant  <ccoutant@google.com>
2401
2402         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2403         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2404         (debug_msg_cdebug.err): New targets.
2405         * testsuite/Makefile.in: Regenerate.
2406         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2407         Fix checks for link with shared library.
2408
2409 2011-06-24  Doug Kwan  <dougkwan@google.com>
2410
2411         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2412         skip empty text sections.
2413         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2414
2415 2011-06-22  Ian Lance Taylor  <iant@google.com>
2416
2417         PR gold/12910
2418         * options.h (class General_options): Add --ctors-in-init-array.
2419         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2420         friends as SHT_PROGBITS for merging sections.
2421         (Layout::layout): Remove special handling of .init_array and
2422         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2423         and .dtors if ctors_in_init_array.
2424         (Layout::make_output_section): Force correct section types for
2425         .init_array and friends.  Don't sort if doing relocatable link,
2426         Don't sort .ctors and .dtors if ctors_in_init_array.
2427         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2428         (Layout::output_section_name): Add relobj parameter.  Change all
2429         callers.  Handle .ctors. and .dtors. in code rather than table.
2430         Handle .ctors and .dtors if ctors_in_init_array.
2431         (Layout::match_file_name): New function, moved from output.cc.
2432         * layout.h (class Layout): Update declarations.
2433         * output.cc: Include "layout.h".
2434         (Input_section_sort_entry::get_priority): New function.
2435         (Input_section_sort_entry::match_file_name): Just call
2436         Layout::match_file_name.
2437         (Output_section::Input_section_sort_init_fini_compare::operator()):
2438         Handle .ctors and .dtors.  Sort by explicit priority rather than
2439         by name.
2440         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2441         * testsuite/initpri2.c: New test.
2442         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2443         (check_PROGRAMS): Add initpri2.
2444         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2445         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2446         * configure, testsuite/Makefile.in: Rebuild.
2447
2448 2011-06-19  Ian Lance Taylor  <iant@google.com>
2449
2450         PR gold/12880
2451         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2452         .interp section to a PT_INTERP segment even if we have seen a
2453         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2454         clause in a linker script.
2455         (Layout::finalize): Don't create a .interp section if we've
2456         already create a PT_INTERP segment.
2457         (Layout::create_interp): Always call choose_output_section (revert
2458         patch of 2011-06-17).  Don't create PT_INTERP segment.
2459         * script-sections.cc
2460         (Script_sections::create_note_and_tls_segments): Add a .interp
2461         section to a PT_INTERP segment even if we have seen a
2462         --dynamic-linker option.
2463
2464 2011-06-18  Ian Lance Taylor  <iant@google.com>
2465
2466         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2467         merely because a non-PT_LOAD segment has a dynamic reloc.
2468
2469 2011-06-18  Ian Lance Taylor  <iant@google.com>
2470
2471         * layout.cc (Layout::finish_dynamic_section): Don't create
2472         DT_FLAGS entry if not needed.
2473
2474 2011-06-18  Ian Lance Taylor  <iant@google.com>
2475
2476         PR gold/12745
2477         * layout.cc (Layout::layout_eh_frame): Correct handling of
2478         writable .eh_frame section.
2479
2480 2011-06-17  Ian Lance Taylor  <iant@google.com>
2481
2482         PR gold/12893
2483         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2484         symbol is redefined with the exact same object and value.
2485
2486 2011-06-17  Ian Lance Taylor  <iant@google.com>
2487
2488         PR gold/12880
2489         * layout.h (class Layout): Add interp_segment_ field.
2490         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2491         (Layout::attach_allocated_section_to_segment): If making shared
2492         library, put .interp section in PT_INTERP segment.
2493         (Layout::finalize): Also call create_interp if -dynamic-linker
2494         option was used.
2495         (Layout::create_interp): Assert that there is no PT_INTERP
2496         segment.  If not using a SECTIONS clause, use make_output_section.
2497         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2498         * script-sections.cc
2499         (Script_sections::create_note_and_tls_segments): If making shared
2500         library, put .interp section in PT_INTERP segment.
2501
2502 2011-06-17  Ian Lance Taylor  <iant@google.com>
2503
2504         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2505         when making a shared library.
2506
2507 2011-06-17  Ian Lance Taylor  <iant@google.com>
2508
2509         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2510         parameter.  Change all callers.  Don't issue warning about PC32
2511         against locally defined symbol.
2512
2513 2011-06-16  Ian Lance Taylor  <iant@google.com>
2514
2515         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2516         occurs in same object.
2517
2518 2011-06-14  Alan Modra  <amodra@gmail.com>
2519
2520         * po/POTFILES.in: Regenerate.
2521
2522 2011-06-09  Ian Lance Taylor  <iant@google.com>
2523
2524         * script-sections.cc
2525         (Orphan_output_section::set_section_addresses): For a relocatable
2526         link set address to 0.
2527
2528 2011-06-09  Cary Coutant  <ccoutant@google.com>
2529
2530         PR gold/12804
2531         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2532         used with --compress-debug-sections.
2533         * gold/object.cc (Sized_relobj_file::do_layout): Report
2534         uncompressed size of compressed input sections.
2535
2536 2011-06-08  Cary Coutant  <ccoutant@google.com>
2537
2538         PR gold/12804
2539         * testsuite/two_file_test_2_v1.cc: Change initialization of
2540         v2 to keep it in .data.
2541
2542 2011-06-07  Cary Coutant  <ccoutant@google.com>
2543
2544         * common.cc (Symbol_table::do_allocate_commons_list): Call
2545         gold_fallback.
2546         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2547         (Errors::fallback): New function.
2548         (gold_fallback): New function.
2549         * errors.h (Errors::fallback): New function.
2550         * gold.cc (gold_exit): Change status parameter to enum; adjust
2551         all callers.
2552         (queue_initial_tasks): Call gold_fallback.
2553         * gold.h: Include cstdlib.
2554         (Exit_status): New enum type.
2555         (gold_exit): Change status parameter to enum.
2556         (gold_fallback): New function.
2557         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2558         (Layout::create_symtab_sections): Likewise.
2559         (Layout::create_shdrs): Likewise.
2560         * main.cc (main): Adjust call to gold_exit.
2561         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2562         (Output_data_got::add_got_entry_pair): Likewise.
2563         (Output_section::add_input_section): Likewise.
2564         (Output_section::add_output_section_data): Likewise.
2565         (Output_segment::set_section_list_addresses): Likewise.
2566         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2567
2568 2011-06-07  Cary Coutant  <ccoutant@google.com>
2569
2570         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2571         for incremental links.
2572         * output.cc (Output_segment::set_section_list_addresses): Remove
2573         FIXME and test for TLS or BSS.
2574
2575 2011-06-07  Cary Coutant  <ccoutant@google.com>
2576
2577         * testsuite/Makefile.am: Add incremental_copy_test,
2578         incremental_common_test_1.
2579         * testsuite/Makefile.in: Regenerate.
2580         * testsuite/common_test_1_v1.c: New source file.
2581         * testsuite/common_test_1_v2.c: New source file.
2582         * testsuite/copy_test_v1.cc: New source file.
2583
2584 2011-06-07  Cary Coutant  <ccoutant@google.com>
2585
2586         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2587         update, allocate common from bss section's free list.
2588         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2589         linker-defined symbols.
2590         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2591         Skip GOT and PLT entries that are no longer referenced.
2592         (Output_section_incremental_inputs::write_info_blocks): Mark
2593         linker-defined symbols.
2594         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2595         * output.cc (Output_section::allocate): New function.
2596         * output.h (Output_section::allocate): New function.
2597         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2598         linker-defined symbols.
2599         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2600         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2601         (Symbol::init_base_output_data): Likewise.
2602         (Symbol::init_base_output_segment): Likewise.
2603         (Symbol::init_base_constant): Likewise.
2604         (Sized_symbol::init_output_data): Likewise.
2605         (Sized_symbol::init_output_segment): Likewise.
2606         (Sized_symbol::init_constant): Likewise.
2607         (Symbol_table::do_define_in_output_data): Likewise.
2608         (Symbol_table::do_define_in_output_segment): Likewise.
2609         (Symbol_table::do_define_as_constant): Likewise.
2610         * symtab.h (Symbol::is_predefined): New function.
2611         (Symbol::init_base_output_data): Add is_predefined parameter.
2612         (Symbol::init_base_output_segment): Likewise.
2613         (Symbol::init_base_constant): Likewise.
2614         (Symbol::is_predefined_): New data member.
2615         (Sized_symbol::init_output_data): Add is_predefined parameter.
2616         (Sized_symbol::init_output_segment): Likewise.
2617         (Sized_symbol::init_constant): Likewise.
2618         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2619
2620 2011-06-07  Cary Coutant  <ccoutant@google.com>
2621
2622         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2623         instead of emit_copy_reloc.
2624         (Copy_relocs::emit_copy_reloc): Refactor.
2625         (Copy_relocs::make_copy_reloc): New function.
2626         (Copy_relocs::add_copy_reloc): Remove.
2627         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2628         section.
2629         (Copy_relocs::make_copy_reloc): New function.
2630         (Copy_relocs::add_copy_reloc): Remove.
2631         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2632         unchanged input files.
2633         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2634         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2635         Reserve BSS space for COPY relocations.
2636         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2637         (Output_section_incremental_inputs::write_info_blocks): Record
2638         whether a symbol is copied from a shared object.
2639         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2640         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2641         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2642         (Incremental_input_entry_reader::get_output_symbol_index): Add
2643         is_copy parameter.
2644         (Incremental_binary::emit_copy_relocs): New function.
2645         (Incremental_binary::do_emit_copy_relocs): New function.
2646         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2647         new data member.
2648         (Sized_incremental_binary::add_copy_reloc): New function.
2649         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2650         (Sized_incremental_binary::Copy_reloc): New struct.
2651         (Sized_incremental_binary::Copy_relocs): New typedef.
2652         (Sized_incremental_binary::copy_relocs_): New data member.
2653         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2654         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2655         * target.h (Sized_target::emit_copy_reloc): New function.
2656         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2657
2658 2011-06-02  Cary Coutant  <ccoutant@google.com>
2659
2660         PR gold/12163
2661         * gold/archive.cc (Archive::Archive): Initialize new data member.
2662         (Archive::include_all_members): Return if archive has already been
2663         included.
2664         * gold/archive.h (Archive::include_all_members_): New data member.
2665
2666 2011-06-02  Nick Clifton  <nickc@redhat.com>
2667
2668         * dynobj.h: Fix spelling mistake in comment.
2669         * output.cc: Likewise.
2670
2671 2011-05-31  Doug Kwan  <dougkwan@google.com>
2672             Asier Llano
2673
2674         PR gold/12826
2675         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2676         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2677         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2678         redundant arm_exidx_test.so.
2679         * testsuite/Makefile.in: Regenerate.
2680         (check_SCRIPTS): Add pr12826.sh
2681         (check_DATA): Add pr12826.stdout
2682         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2683         * testsuite/pr12826.sh: New file.
2684         * testsuite/pr12826_1.s: Ditto.
2685         * testsuite/pr12826_1.s: Ditto.
2686
2687 2011-05-30  Ian Lance Taylor  <iant@google.com>
2688
2689         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2690         sections.
2691
2692 2011-05-29  Ian Lance Taylor  <iant@google.com>
2693
2694         PR gold/12804
2695         * testsuite/Makefile.am: Use different file name for two_file_test
2696         temporary file for each incremental test.
2697         * testsuite/Makefile.in: Rebuild.
2698
2699 2011-05-29  Ian Lance Taylor  <iant@google.com>
2700
2701         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2702         binary input file is empty.
2703
2704 2011-05-27  Ian Lance Taylor  <iant@google.com>
2705
2706         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2707         (ver_test_9.so): Likewise.
2708         * testsuite/Makefile.in: Rebuild.
2709
2710 2011-05-26 Cary Coutant  <ccoutant@google.com>
2711
2712         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2713         * incremental.cc (Incremental_inputs::report_input_section): Fix
2714         comment, indentation.
2715         (Incremental_inputs::report_comdat_group): New function.
2716         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2717         of data for incremental input file entry.
2718         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2719         group count, COMDAT group signatures.
2720         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2721         an unchanged input file.
2722         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2723         Initialize new data member.
2724         (Incremental_object_entry::add_comdat_group): New function.
2725         (Incremental_object_entry::get_comdat_group_count): New function.
2726         (Incremental_object_entry::get_comdat_signature_key): New function.
2727         (Incremental_object_entry::groups_): New data member.
2728         (Incremental_inputs::report_comdat_group): New function.
2729         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2730         data for incremental input file entry.
2731         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2732         (Incremental_input_entry_reader::get_input_section): Adjust size of
2733         data for incremental input file entry.
2734         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2735         (Incremental_input_entry_reader::get_comdat_group_signature): New
2736         function.
2737         * object.cc (Sized_relobj::include_section_group): Report kept
2738         COMDAT groups for incremental links.
2739
2740 2011-05-24  David Meyer  <pdox@google.com>
2741
2742         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2743         with name parameter.  Add found_name parameter.
2744         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2745         * dirsearch.h (class Dirsearch): Update declaration.
2746
2747 2011-05-24  Ian Lance Taylor  <iant@google.com>
2748
2749         * archive.cc (Library_base::should_include_member): Pull in object
2750         from archive if it defines the entry symbol.
2751         * parameters.cc (Parameters::entry): New function.
2752         * parameters.h (class Parameters): Declare entry.
2753         * output.h (class Output_file_header): Remove entry_ field.
2754         * output.cc (Output_file_header::Output_file_header): Remove entry
2755         parameter.  Change all callers.
2756         (Output_file_header::entry): Use parameters->entry.
2757         * gold.cc (queue_middle_tasks): Likewise.
2758         * plugin.cc (Plugin_hook::run): Likewise.
2759
2760 2011-05-24 Cary Coutant  <ccoutant@google.com>
2761
2762         * gold.cc (queue_initial_tasks): Pass incremental base filename
2763         to Output_file::open_base_file; don't print error message.
2764         * incremental-dump.cc (main): Adjust call to
2765         Output_file::open_for_modification.
2766         * incremental-dump.cc (main): Likewise.
2767         * incremental.cc (Incremental_inputs::report_command_line):
2768         Ignore --incremental-base option when comparing command lines.
2769         Ignore parameter when given as separate argument.
2770         * options.h (class General_options): Add --incremental-base.
2771         * output.cc (Output_file::Output_file):
2772         (Output_file::open_base_file): Add base_name and writable parameters;
2773         read base file into new file; print error message here.
2774         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2775         callers.
2776         * output.h (Output_file::open_for_modification): Rename to...
2777         (Output_file::open_base_file): ...this; add base_name and
2778         writable parameters; adjust all callers.
2779         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2780         callers.
2781         * testsuite/Makefile.am (incremental_test_4): Test
2782         --incremental-base.
2783         * testsuite/Makefile.in: Regenerate.
2784
2785 2011-05-24 Cary Coutant  <ccoutant@google.com>
2786
2787         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2788         incremental_test_4.
2789         * testsuite/Makefile.in: Regenerate.
2790         * testsuite/two_file_test_1_v1.cc: New test source file.
2791         * testsuite/two_file_test_1b_v1.cc: New test source file.
2792         * testsuite/two_file_test_2_v1.cc: New test source file.
2793
2794 2011-05-24 Cary Coutant  <ccoutant@google.com>
2795
2796         * dynobj.h (Dynobj::do_dynobj): New function.
2797         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2798         flag and soname for shared objects.
2799         * incremental.cc (Incremental_inputs::report_object): Make
2800         either Incremental_object_entry or Incremental_dynobj_entry; add
2801         soname to string table.
2802         (Incremental_inputs::report_input_section): Add assertion.
2803         (Output_section_incremental_inputs::set_final_data_size): Adjust
2804         type of input file entry for shared libraries; adjust size of
2805         shared library info entry.
2806         (Output_section_incremental_inputs::write_input_files): Write
2807         as_needed flag for shared libraries.
2808         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2809         of input file entry for shared libraries; write soname.
2810         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2811         soname from incremental info.
2812         * incremental.h (enum Incremental_input_flags): Add
2813         INCREMENTAL_INPUT_AS_NEEDED.
2814         (Incremental_input_entry::Incremental_input_entry): Initialize new
2815         data member.
2816         (Incremental_input_entry::set_as_needed): New function.
2817         (Incremental_input_entry::as_needed): New function.
2818         (Incremental_input_entry::do_dynobj_entry): New function.
2819         (Incremental_input_entry::as_needed_): New data member.
2820         (Incremental_object_entry::Incremental_object_entry): Don't check
2821         for shared library.
2822         (Incremental_object_entry::do_type): Likewise.
2823         (class Incremental_dynobj_entry): New class.
2824         (Incremental_input_entry_reader::as_needed): New function.
2825         (Incremental_input_entry_reader::get_soname): New function.
2826         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2827         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2828         size of shared library info entry.
2829         * layout.cc (Layout::finish_dynamic_section): Don't test for
2830         incremental link when adding DT_NEEDED entries.
2831         * object.h (Object::Object): Initialize new data member.
2832         (Object::dynobj): New function.
2833         (Object::set_as_needed): New function.
2834         (Object::as_needed): New function.
2835         (Object::do_dynobj): New function.
2836         (Object::as_needed_): New data member.
2837
2838 2011-05-24 Cary Coutant  <ccoutant@google.com>
2839
2840         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2841         info; adjust display of GOT entries.
2842         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2843         vector of input objects; remove file_status_.
2844         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2845         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2846         got_plt reader; call target hooks to reserve GOT entries.
2847         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2848         of input file info header and GOT info entry.
2849         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2850         relocation info.
2851         (Got_plt_view_info::got_descriptor): Remove.
2852         (Got_plt_view_info::sym_index): New data member.
2853         (Got_plt_view_info::input_index): New data member.
2854         (Local_got_offset_visitor::visit): Write input file index.
2855         (Global_got_offset_visitor::visit): Write 0 for input file index.
2856         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2857         with sym_index and input_index.
2858         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2859         incremental info GOT entry; replace got_descriptor with input_index.
2860         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2861         map from input file index to object.
2862         (Sized_relobj_incr::do_layout): Replace direct data member reference
2863         with accessor function.
2864         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2865         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2866         Adjust size of input file info header.
2867         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2868         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2869         (Incremental_input_entry_reader::get_input_section): Adjust size of
2870         input file info header.
2871         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2872         of incremental info GOT entry.
2873         (Incremental_got_plt_reader::get_got_desc): Remove.
2874         (Incremental_got_plt_reader::get_got_symndx): New function.
2875         (Incremental_got_plt_reader::get_got_input_index): New function.
2876         (Sized_incremental_binary::Sized_incremental_binary): Remove
2877         file_status_; add input_objects_.
2878         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2879         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2880         (Sized_incremental_binary::file_is_unchanged): Remove.
2881         (Sized_incremental_binary::set_input_object): New function.
2882         (Sized_incremental_binary::input_object): New function.
2883         (Sized_incremental_binary::file_status_): Remove.
2884         (Sized_incremental_binary::input_objects_): New data member.
2885         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2886         references.
2887         (Sized_relobj_incr::invalid_address): Move to base class.
2888         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2889         class.
2890         (Sized_relobj_incr::do_output_section_offset): Likewise.
2891         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2892         (Sized_relobj_incr::section_offsets_): Likewise.
2893         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2894         function.
2895         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2896         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2897         with accessor function.
2898         (Sized_relobj_file::do_layout): Likewise.
2899         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2900         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2901         (Sized_relobj_file::compute_final_local_value): Replace refs to
2902         section_offsets_ with accessor function.
2903         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2904         * object.h (Relobj::Relobj): Initialize new data members.
2905         (Relobj::add_dyn_reloc): New function.
2906         (Relobj::first_dyn_reloc): New function.
2907         (Relobj::dyn_reloc_count): New function.
2908         (Relobj::first_dyn_reloc_): New data member.
2909         (Relobj::dyn_reloc_count_): New data member.
2910         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2911         references.
2912         (Sized_relobj::Address): New typedef.
2913         (Sized_relobj::invalid_address): Move here from child class.
2914         (Sized_relobj::Sized_relobj): Initialize new data members.
2915         (Sized_relobj::sized_relobj): New function.
2916         (Sized_relobj::is_output_section_offset_invalid): Move here from
2917         child class.
2918         (Sized_relobj::get_output_section_offset): Likewise.
2919         (Sized_relobj::local_has_got_offset): Likewise.
2920         (Sized_relobj::local_got_offset): Likewise.
2921         (Sized_relobj::set_local_got_offset): Likewise.
2922         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2923         (Sized_relobj::clear_got_offsets): New function.
2924         (Sized_relobj::section_offsets): Move here from child class.
2925         (Sized_relobj::do_output_section_offset): Likewise.
2926         (Sized_relobj::do_set_section_offset): Likewise.
2927         (Sized_relobj::Local_got_offsets): Likewise.
2928         (Sized_relobj::local_got_offsets_): Likewise.
2929         (Sized_relobj::section_offsets_): Likewise.
2930         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2931         references.
2932         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2933         class.
2934         (Sized_relobj_file::sized_relobj): New function
2935         (Sized_relobj_file::local_has_got_offset): Move to base class.
2936         (Sized_relobj_file::local_got_offset): Likewise.
2937         (Sized_relobj_file::set_local_got_offset): Likewise.
2938         (Sized_relobj_file::get_output_section_offset): Likewise.
2939         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2940         (Sized_relobj_file::do_output_section_offset): Likewise.
2941         (Sized_relobj_file::do_set_section_offset): Likewise.
2942         (Sized_relobj_file::Local_got_offsets): Likewise.
2943         (Sized_relobj_file::local_got_offsets_): Likewise.
2944         (Sized_relobj_file::section_offsets_): Likewise.
2945         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2946         (all constructors).
2947         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2948         (Output_reloc::get_symbol_index): Likewise.
2949         (Output_reloc::local_section_offset): Likewise.
2950         (Output_reloc::get_address): Likewise.
2951         (Output_reloc::symbol_value): Likewise.
2952         (Output_data_got::reserve_slot): Move to class definition.
2953         (Output_data_got::reserve_local): New function.
2954         (Output_data_got::reserve_slot_for_global): Remove.
2955         (Output_data_got::reserve_global): New function.
2956         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2957         (all constructors, two instantiations).
2958         (Output_reloc::get_relobj): New function (two instantiations).
2959         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2960         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2961         (Output_data_reloc::add_global): Adjust type of relobj.
2962         (Output_data_reloc::add_global_relative): Likewise.
2963         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2964         (Output_data_reloc::add_local): Likewise.
2965         (Output_data_reloc::add_local_relative): Likewise.
2966         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2967         (Output_data_reloc::add_local_section): Likewise.
2968         (Output_data_reloc::add_output_section): Likewise.
2969         (Output_data_reloc::add_absolute): Likewise.
2970         (Output_data_reloc::add_target_specific): Likewise.
2971         (Output_data_got::reserve_slot): Move definition here.
2972         (Output_data_got::reserve_local): New function.
2973         (Output_data_got::reserve_global): New function.
2974         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2975         section_offsets_ with accessor function.
2976         (Sized_relobj_file::write_sections): Likewise.
2977         (Sized_relobj_file::do_relocate_sections): Likewise.
2978         * target.h (Sized_target::reserve_local_got_entry): New function.
2979         (Sized_target::reserve_global_got_entry): New function.
2980         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2981         (Target_x86_64::reserve_global_got_entry): New function.
2982         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2983
2984 2011-05-23 Cary Coutant  <ccoutant@google.com>
2985
2986         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2987         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2988         bit when checking got_type.
2989         * incremental.cc (Sized_incremental_binary::setup_readers):
2990         Store symbol table and string table locations; initialize bit vector
2991         of file status flags.
2992         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2993         unchanged files.
2994         (Sized_incremental_binary::do_process_got_plt): New function.
2995         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2996         (Output_section_incremental_inputs::set_final_data_size): Record
2997         file index for each input file.
2998         (Output_section_incremental_inputs::write_got_plt): Store file index
2999         instead of input entry offset for each GOT entry.
3000         * incremental.h
3001         (Incremental_input_entry::Incremental_input_entry): Initialize new
3002         data member.
3003         (Incremental_input_entry::set_offset): Store file index.
3004         (Incremental_input_entry::get_file_index): New function.
3005         (Incremental_input_entry::file_index_): New data member.
3006         (Incremental_binary::process_got_plt): New function.
3007         (Incremental_binary::do_process_got_plt): New function.
3008         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3009         data members.
3010         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3011         (Sized_incremental_binary::set_file_is_unchanged): New function.
3012         (Sized_incremental_binary::file_is_unchanged): New function.
3013         (Sized_incremental_binary::do_process_got_plt): New function.
3014         (Sized_incremental_binary::file_status_): New data member.
3015         (Sized_incremental_binary::main_symtab_loc_): New data member.
3016         (Sized_incremental_binary::main_strtab_loc_): New data member.
3017         * output.cc (Output_data_got::Got_entry::write): Add case
3018         RESERVED_CODE.
3019         (Output_data_got::add_global): Call add_got_entry.
3020         (Output_data_got::add_global_plt): Likewise.
3021         (Output_data_got::add_global_with_rel): Likewise.
3022         (Output_data_got::add_global_with_rela): Likewise.
3023         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3024         (Output_data_got::add_global_pair_with_rela): Likewise.
3025         (Output_data_got::add_local): Call add_got_entry.
3026         (Output_data_got::add_local_plt): Likewise.
3027         (Output_data_got::add_local_with_rel): Likewise.
3028         (Output_data_got::add_local_with_rela): Likewise.
3029         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3030         (Output_data_got::add_local_pair_with_rela): Likewise.
3031         (Output_data_got::reserve_slot): New function.
3032         (Output_data_got::reserve_slot_for_global): New function.
3033         (Output_data_got::add_got_entry): New function.
3034         (Output_data_got::add_got_entry_pair): New function.
3035         (Output_section::add_output_section_data): Edit FIXME.
3036         * output.h
3037         (Output_section_data_build::Output_section_data_build): New
3038         constructor with size parameter.
3039         (Output_data_space::Output_data_space): Likewise.
3040         (Output_data_got::Output_data_got): Initialize new data member; new
3041         constructor with size parameter.
3042         (Output_data_got::add_constant): Call add_got_entry.
3043         (Output_data_got::reserve_slot): New function.
3044         (Output_data_got::reserve_slot_for_global): New function.
3045         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3046         (Output_data_got::add_got_entry): New function.
3047         (Output_data_got::add_got_entry_pair): New function.
3048         (Output_data_got::free_list_): New data member.
3049         * target.h (Sized_target::init_got_plt_for_update): New function.
3050         (Sized_target::register_global_plt_entry): New function.
3051         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3052         Initialize new data member; call init; add constructor with PLT count.
3053         (Output_data_plt_x86_64::init): New function.
3054         (Output_data_plt_x86_64::add_relocation): New function.
3055         (Output_data_plt_x86_64::reserve_slot): New function.
3056         (Output_data_plt_x86_64::free_list_): New data member.
3057         (Target_x86_64::init_got_plt_for_update): New function.
3058         (Target_x86_64::register_global_plt_entry): New function.
3059         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3060         incremental updates.
3061         (Output_data_plt_x86_64::add_relocation): New function.
3062         * testsuite/object_unittest.cc (Object_test): Set default options.
3063
3064 2011-05-16  Ian Lance Taylor  <iant@google.com>
3065
3066         * options.h (class General_options): Make -i a synonym for -r.
3067
3068 2011-05-16  Ian Lance Taylor  <iant@google.com>
3069
3070         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3071
3072 2011-05-10 Cary Coutant  <ccoutant@google.com>
3073
3074         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3075         strip_all (-s).
3076
3077 2011-05-06  Ian Lance Taylor  <iant@google.com>
3078
3079         * layout.cc (Layout::layout): If the output section flags change,
3080         update the ordering.
3081
3082 2011-04-25 Cary Coutant  <ccoutant@google.com>
3083
3084         * incremental-dump.cc (dump_incremental_inputs): Print local
3085         symbol info for each input file.
3086         * incremental.cc
3087         (Output_section_incremental_inputs::set_final_data_size): Add local
3088         symbol info to input file entries in incremental info.
3089         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3090         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3091         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3092         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3093         implementation.
3094         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3095         (Sized_incr_relobj::do_relocate): Write the local symbols.
3096         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3097         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3098         Adjust size of input file header.
3099         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3100         (Incremental_inputs_reader::get_local_symbol_count): New function.
3101         (Incremental_inputs_reader::get_input_section): Adjust size of input
3102         file header.
3103         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3104         (Sized_incr_relobj::This): New typedef.
3105         (Sized_incr_relobj::sym_size): New const data member.
3106         (Sized_incr_relobj::Local_symbol): New struct.
3107         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3108         (Sized_incr_relobj::do_local_symbol_offset): New function.
3109         (Sized_incr_relobj::local_symbol_count_): New data member.
3110         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3111         (Sized_incr_relobj::local_symbol_index_): New data member.
3112         (Sized_incr_relobj::local_symbol_offset_): New data member.
3113         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3114         (Sized_incr_relobj::local_symbols_): New data member.
3115         * object.h (Relobj::output_local_symbol_count): New function.
3116         (Relobj::local_symbol_offset): New function.
3117         (Relobj::do_output_local_symbol_count): New function.
3118         (Relobj::do_local_symbol_offset): New function.
3119         (Sized_relobj::do_output_local_symbol_count): New function.
3120         (Sized_relobj::do_local_symbol_offset): New function.
3121
3122 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3123
3124         * descriptors.cc (set_close_on_exec): New function.
3125         (Descriptors::open): Use set_close_on_exec.
3126         * output.cc (S_ISLNK): Define if not defined.
3127
3128 2011-04-22 Cary Coutant  <ccoutant@google.com>
3129
3130         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3131         global symbol map.
3132         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3133         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3134         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3135         relocations.
3136         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3137         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3138         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3139         * incremental.h
3140         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3141         function.
3142         (Incremental_binary::apply_incremental_relocs): New function.
3143         (Incremental_binary::do_apply_incremental_relocs): New function.
3144         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3145         data member.
3146         (Sized_incremental_binary::add_global_symbol): New function.
3147         (Sized_incremental_binary::global_symbol): New function.
3148         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3149         (Sized_incremental_binary::symbol_map_): New data member.
3150         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3151         * target.h (Sized_target::apply_relocation): New function.
3152         * target-reloc.h (apply_relocation): New function.
3153         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3154
3155 2011-04-22  Doug Kwan  <dougkwan@google.com>
3156
3157         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3158         flag of a SHT_ARM_EXIDX section.
3159         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3160         * testsuite/Makefile.in: Regenerate.
3161         * testsuite/arm_exidx_test.s: New file.
3162         * testsuite/arm_exidx_test.sh: Same.
3163
3164 2011-04-20 Cary Coutant  <ccoutant@google.com>
3165
3166         PR gold/12689
3167         * archive.h (Incremental_archive_entry::Archive_member):
3168         Initialize arg_serial_ (second constructor).
3169
3170 2011-04-17  Ian Lance Taylor  <iant@google.com>
3171
3172         * object.cc (Relocate_info::location): Simplify location string.
3173         * errors.cc (Errors::error_at_location): Don't print program
3174         name.
3175         (Errors::warning_at_location): Likewise.
3176         (Errors::undefined_symbol): Likewise.
3177         * testsuite/debug_msg.sh: Update accordingly.
3178
3179 2011-04-14 Cary Coutant  <ccoutant@google.com>
3180
3181         * gold/layout.cc (Layout::symtab_section_offset): New function.
3182         * gold/layout.h (Layout::symtab_section_offset): New function.
3183         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3184
3185 2011-04-12  Ian Lance Taylor  <iant@google.com>
3186
3187         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3188         with MREMAP_MAYMOVE.
3189         * output.h (class Output_file): Add map_is_allocated_ field.
3190         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3191         not available, provide stubs.  If mremap is not available, #define
3192         it to gold_mremap.
3193         (MREMAP_MAYMOVE): Define if not defined.
3194         (Output_file::Output_file): Initialize map_is_allocated_.
3195         (Output_file::resize): Check map_is_allocated_.
3196         (Output_file::map_anonymous): If mmap fails, use malloc.
3197         (Output_file::unmap): Don't do anything for an anonymous map.
3198         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3199         is not available, provide stubs.
3200         (File_read::View::~View): Use free rather than delete[].
3201         (File_read::make_view): Use malloc rather than new[].  If mmap
3202         fails, use malloc.
3203         (File_read::find_or_make_view): Use malloc rather than new[].
3204         * gold.h: Remove HAVE_REMAP code.
3205         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3206         exists.  Rename mremap to gold_mremap.  If mmap is not available
3207         don't do anything.
3208         * configure, config.in: Rebuild.
3209
3210 2011-04-11  Ian Lance Taylor  <iant@google.com>
3211
3212         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3213         initialize local variable v.
3214
3215 2011-04-11  Cary Coutant  <ccoutant@google.com>
3216
3217         * archive.cc (Archive::include_member): Adjust call to
3218         report_object.
3219         (Add_archive_symbols::run): Track argument serial numbers.
3220         (Lib_group::include_member): Likewise.
3221         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3222         * archive.h (Incremental_archive_entry::Archive_member):
3223         Initialize arg_serial_.
3224         (Archive_member::arg_serial_): New data member.
3225         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3226         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3227         incremental link.
3228         (Sized_dynobj::do_for_all_local_got_entries): New function.
3229         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3230         function.
3231         * fileread.cc (get_mtime): New function.
3232         * fileread.h (get_mtime): New function.
3233         * gold.cc (queue_initial_tasks): Check for incremental update.
3234         (process_incremental_input): New function.
3235         (queue_middle_tasks): Don't force valid target for incremental
3236         update.
3237         * incremental-dump.cc (find_input_containing_global): Adjust
3238         size of symbol info entry.
3239         (dump_incremental_inputs): Dump argument serial number and
3240         in_system_directory flag; bias shndx by 1; print symbol names
3241         when dumping per-file symbol lists; use new symbol info readers.
3242         * incremental.cc
3243         (Output_section_incremental_inputs:update_data_size): New function.
3244         (Sized_incremental_binary::setup_readers): Setup input readers
3245         for each input file; build maps for files added from libraries
3246         and scripts.
3247         (Sized_incremental_binary::check_input_args): New function.
3248         (Sized_incremental_binary::do_check_inputs): Build map of argument
3249         serial numbers to input arguments.
3250         (Sized_incremental_binary::do_file_has_changed): Rename
3251         do_file_is_unchanged to this; compare file modification times.
3252         (Sized_incremental_binary::do_init_layout): New function.
3253         (Sized_incremental_binary::do_reserve_layout): New function.
3254         (Sized_incremental_binary::do_get_input_reader): Remove.
3255         (Sized_incremental_binary::get_symtab_view): New function.
3256         (Incremental_checker::can_incrementally_link_output_file): Remove.
3257         (Incremental_inputs::report_command_line): Exclude --debug options.
3258         (Incremental_inputs::report_archive_begin): Add parameter; track
3259         argument serial numbers; don't put input file entry for archive
3260         before archive members.
3261         (Incremental_inputs::report_archive_end): Put input file entry
3262         for archive after archive members.
3263         (Incremental_inputs::report_object): Add parameter; track argument
3264         serial numbers and in_system_directory flag.
3265         (Incremental_inputs::report_script): Add parameter; track argument
3266         serial numbers.
3267         (Output_section_incremental_inputs::set_final_data_size): Adjust
3268         size of symbol info entry; check for forwarding symbols.
3269         (Output_section_incremental_inputs::write_input_files): Write
3270         in_system_directory flag and argument serial number.
3271         (Output_section_incremental_inputs::write_info_blocks): Map section
3272         indices between incremental info and original input file; store
3273         input section index for each symbol.
3274         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3275         change operator() to visit().
3276         (class Global_got_offset_visitor): Likewise.
3277         (class Global_symbol_visitor_got_plt):
3278         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3279         classes.
3280         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3281         (Sized_incr_relobj::do_read_symbols): New function.
3282         (Sized_incr_relobj::do_layout): New function.
3283         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3284         (Sized_incr_relobj::do_add_symbols): New function.
3285         (Sized_incr_relobj::do_should_include_member): New function.
3286         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3287         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3288         (Sized_incr_relobj::do_section_size): New function.
3289         (Sized_incr_relobj::do_section_name): New function.
3290         (Sized_incr_relobj::do_section_contents): New function.
3291         (Sized_incr_relobj::do_section_flags): New function.
3292         (Sized_incr_relobj::do_section_entsize): New function.
3293         (Sized_incr_relobj::do_section_address): New function.
3294         (Sized_incr_relobj::do_section_type): New function.
3295         (Sized_incr_relobj::do_section_link): New function.
3296         (Sized_incr_relobj::do_section_info): New function.
3297         (Sized_incr_relobj::do_section_addralign): New function.
3298         (Sized_incr_relobj::do_initialize_xindex): New function.
3299         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3300         (Sized_incr_relobj::do_read_relocs): New function.
3301         (Sized_incr_relobj::do_gc_process_relocs): New function.
3302         (Sized_incr_relobj::do_scan_relocs): New function.
3303         (Sized_incr_relobj::do_count_local_symbols): New function.
3304         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3305         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3306         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3307         (Sized_incr_relobj::do_relocate): New function.
3308         (Sized_incr_relobj::do_set_section_offset): New function.
3309         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3310         (Sized_incr_dynobj::do_read_symbols): New function.
3311         (Sized_incr_dynobj::do_layout): New function.
3312         (Sized_incr_dynobj::do_add_symbols): New function.
3313         (Sized_incr_dynobj::do_should_include_member): New function.
3314         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3315         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3316         (Sized_incr_dynobj::do_section_size): New function.
3317         (Sized_incr_dynobj::do_section_name): New function.
3318         (Sized_incr_dynobj::do_section_contents): New function.
3319         (Sized_incr_dynobj::do_section_flags): New function.
3320         (Sized_incr_dynobj::do_section_entsize): New function.
3321         (Sized_incr_dynobj::do_section_address): New function.
3322         (Sized_incr_dynobj::do_section_type): New function.
3323         (Sized_incr_dynobj::do_section_link): New function.
3324         (Sized_incr_dynobj::do_section_info): New function.
3325         (Sized_incr_dynobj::do_section_addralign): New function.
3326         (Sized_incr_dynobj::do_initialize_xindex): New function.
3327         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3328         (make_sized_incremental_object): New function.
3329         (Incremental_library::copy_unused_symbols): New function.
3330         (Incremental_library::do_for_all_unused_symbols): New function.
3331         * incremental.h (enum Incremental_input_flags): New type.
3332         (class Incremental_checker): Remove.
3333         (Incremental_input_entry::Incremental_input_entry): Add argument
3334         serial number.
3335         (Incremental_input_entry::arg_serial): New function.
3336         (Incremental_input_entry::set_is_in_system_directory): New function.
3337         (Incremental_input_entry::is_in_system_directory): New function.
3338         (Incremental_input_entry::arg_serial_): New data member.
3339         (Incremental_input_entry::is_in_system_directory_): New data member.
3340         (class Script_info): Move here from script.h.
3341         (Script_info::Script_info): Add filename parameter.
3342         (Script_info::filename): New function.
3343         (Script_info::filename_): New data member.
3344         (Incremental_script_entry::Incremental_script_entry): Add argument
3345         serial number.
3346         (Incremental_object_entry::Incremental_object_entry): Likewise.
3347         (Incremental_object_entry::add_input_section): Build list of input
3348         sections with map to original shndx.
3349         (Incremental_object_entry::get_input_section_index): New function.
3350         (Incremental_object_entry::shndx_): New data member.
3351         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3352         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3353         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3354         serial number.
3355         (Incremental_inputs::report_archive_begin): Likewise.
3356         (Incremental_inputs::report_object): Likewise.
3357         (Incremental_inputs::report_script): Likewise.
3358         (class Incremental_global_symbol_reader): New class.
3359         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3360         and store flags and input file type.
3361         (Incremental_input_entry_reader::arg_serial): New function.
3362         (Incremental_input_entry_reader::type): Extract type from flags.
3363         (Incremental_input_entry_reader::is_in_system_directory): New function.
3364         (Incremental_input_entry_reader::get_input_section_count): Call
3365         accessor function for type.
3366         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3367         function for type; adjust size of global symbol entry.
3368         (Incremental_input_entry_reader::get_global_symbol_count): Call
3369         accessor function for type.
3370         (Incremental_input_entry_reader::get_object_count): Likewise.
3371         (Incremental_input_entry_reader::get_object_offset): Likewise.
3372         (Incremental_input_entry_reader::get_member_count): Likewise.
3373         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3374         (Incremental_input_entry_reader::get_member_offset): Likewise.
3375         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3376         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3377         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3378         (Incremental_input_entry_reader::get_global_symbol_reader): New
3379         function.
3380         (Incremental_input_entry_reader::get_output_symbol_index): New
3381         function.
3382         (Incremental_input_entry_reader::type_): Remove.
3383         (Incremental_input_entry_reader::flags_): New data member.
3384         (Incremental_inputs_reader::input_file_offset): New function.
3385         (Incremental_inputs_reader::input_file_index): New function.
3386         (Incremental_inputs_reader::input_file): Call input_file_offset.
3387         (Incremental_inputs_reader::input_file_at_offset): New function.
3388         (Incremental_relocs_reader::get_r_type): Reformat.
3389         (Incremental_relocs_reader::get_r_shndx): Reformat.
3390         (Incremental_relocs_reader::get_r_offset): Reformat.
3391         (Incremental_relocs_reader::data): New function.
3392         (Incremental_binary::Incremental_binary): Initialize new data members.
3393         (Incremental_binary::check_inputs): Add cmdline parameter.
3394         (Incremental_binary::file_is_unchanged): Remove.
3395         (Input_reader::arg_serial): New function.
3396         (Input_reader::get_unused_symbol_count): New function.
3397         (Input_reader::get_unused_symbol): New function.
3398         (Input_reader::do_arg_serial): New function.
3399         (Input_reader::do_get_unused_symbol_count): New function.
3400         (Input_reader::do_get_unused_symbol): New function.
3401         (Incremental_binary::input_file_count): New function.
3402         (Incremental_binary::get_input_reader): Change signature to use
3403         index instead of filename.
3404         (Incremental_binary::file_has_changed): New function.
3405         (Incremental_binary::get_input_argument): New function.
3406         (Incremental_binary::get_library): New function.
3407         (Incremental_binary::get_script_info): New function.
3408         (Incremental_binary::init_layout): New function.
3409         (Incremental_binary::reserve_layout): New function.
3410         (Incremental_binary::output_file): New function.
3411         (Incremental_binary::do_check_inputs): New function.
3412         (Incremental_binary::do_file_is_unchanged): Remove.
3413         (Incremental_binary::do_file_has_changed): New function.
3414         (Incremental_binary::do_init_layout): New function.
3415         (Incremental_binary::do_reserve_layout): New function.
3416         (Incremental_binary::do_input_file_count): New function.
3417         (Incremental_binary::do_get_input_reader): Change signature.
3418         (Incremental_binary::input_args_map_): New data member.
3419         (Incremental_binary::library_map_): New data member.
3420         (Incremental_binary::script_map_): New data member.
3421         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3422         new data members.
3423         (Sized_incremental_binary::output_section): New function.
3424         (Sized_incremental_binary::inputs_reader): Add const.
3425         (Sized_incremental_binary::symtab_reader): Add const.
3426         (Sized_incremental_binary::relocs_reader): Add const.
3427         (Sized_incremental_binary::got_plt_reader): Add const.
3428         (Sized_incremental_binary::get_symtab_view): New function.
3429         (Sized_incremental_binary::Inputs_reader): New typedef.
3430         (Sized_incremental_binary::Input_entry_reader): New typedef.
3431         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3432         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3433         (Sized_incremental_binary::do_file_has_changed): New function.
3434         (Sized_incremental_binary::do_init_layout): New function.
3435         (Sized_incremental_binary::do_reserve_layout): New function.
3436         (Sized_input_reader::Inputs_reader): Remove.
3437         (Sized_input_reader::Input_entry_reader): Remove.
3438         (Sized_input_reader::do_arg_serial): New function.
3439         (Sized_input_reader::do_get_unused_symbol_count): New function.
3440         (Sized_input_reader::do_get_unused_symbol): New function.
3441         (Sized_incremental_binary::do_input_file_count): New function.
3442         (Sized_incremental_binary::do_get_input_reader): Change signature;
3443         use index instead of filename.
3444         (Sized_incremental_binary::section_map_): New data member.
3445         (Sized_incremental_binary::input_entry_readers_): New data member.
3446         (class Sized_incr_relobj): New class.
3447         (class Sized_incr_dynobj): New class.
3448         (make_sized_incremental_object): New function.
3449         (class Incremental_library): New class.
3450         * layout.cc (Free_list::num_lists): New static data member.
3451         (Free_list::num_nodes): New static data member.
3452         (Free_list::num_removes): New static data member.
3453         (Free_list::num_remove_visits): New static data member.
3454         (Free_list::num_allocates): New static data member.
3455         (Free_list::num_allocate_visits): New static data member.
3456         (Free_list::init): New function.
3457         (Free_list::remove): New function.
3458         (Free_list::allocate): New function.
3459         (Free_list::dump): New function.
3460         (Free_list::print_stats): New function.
3461         (Layout_task_runner::run): Resize output file for incremental updates.
3462         (Layout::Layout): Initialize new data members.
3463         (Layout::set_incremental_base): New function.
3464         (Layout::init_fixed_output_section): New function.
3465         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3466         incremental updates.
3467         (Layout::create_gold_note): Do not create gold note section for
3468         incremental updates.
3469         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3470         for incremental updates.
3471         (Layout::set_section_offsets): For incremental updates, allocate space
3472         from free list.
3473         (Layout::create_symtab_sections): Layout with offsets relative to
3474         start of section; for incremental updates, allocate space from free
3475         list.
3476         (Layout::create_shdrs): For incremental updates, allocate space from
3477         free list.
3478         (Layout::finish_dynamic_section): For incremental updates, do not
3479         check --as-needed (fixed in subsequent patch).
3480         * layout.h (class Free_list): New class.
3481         (Layout::set_incremental_base): New function.
3482         (Layout::incremental_base): New function.
3483         (Layout::init_fixed_output_section): New function.
3484         (Layout::allocate): New function.
3485         (Layout::incremental_base_): New data member.
3486         (Layout::free_list_): New data member.
3487         * main.cc (main): Print Free_list statistics.
3488         * object.cc (Relobj::finalize_incremental_relocs): Add
3489         clear_counts parameter; clear counts only when clear_counts is set.
3490         (Sized_relobj::Sized_relobj): Initialize new base class.
3491         (Sized_relobj::do_layout): Don't report special sections.
3492         (Sized_relobj::do_for_all_local_got_entries): New function.
3493         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3494         symtab_off to all symbol table offsets.
3495         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3496         * object.h (class Got_offset_list): Move to top of file.
3497         (Object::Object): Allow case where input_file == NULL.
3498         (Object::~Object): Likewise.
3499         (Object::input_file): Assert that input_file != NULL.
3500         (Object::lock): Allow case where input_file == NULL.
3501         (Object::unlock): Likewise.
3502         (Object::is_locked): Likewise.
3503         (Object::token): Likewise.
3504         (Object::release): Likewise.
3505         (Object::is_incremental): New function.
3506         (Object::get_mtime): New function.
3507         (Object::for_all_local_got_entries): New function.
3508         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3509         (Object::set_is_in_system_directory): New function.
3510         (Object::is_in_system_directory): New function.
3511         (Object::do_is_incremental): New function.
3512         (Object::do_get_mtime): New function.
3513         (Object::do_for_all_local_got_entries): New function.
3514         (Object::is_in_system_directory_): New data member.
3515         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3516         (class Sized_relobj_base): New class.
3517         (class Sized_relobj): Derive from Sized_relobj_base.
3518         (class Sized_relobj::Symbols): Redeclare from base class.
3519         (class Sized_relobj::local_got_offset_list): Remove.
3520         (class Sized_relobj::Output_sections): Redeclare from base class.
3521         (class Sized_relobj::do_for_all_local_got_entries): New function.
3522         (class Sized_relobj::write_local_symbols): Add offset parameter.
3523         (class Sized_relobj::local_symbol_offset_): Update comment.
3524         (class Sized_relobj::local_dynsym_offset_): Update comment.
3525         * options.cc (Input_arguments::add_file): Remove const.
3526         * options.h (Input_file_argument::Input_file_argument):
3527         Initialize arg_serial_ (all constructors).
3528         (Input_file_argument::set_arg_serial): New function.
3529         (Input_file_argument::arg_serial): New function.
3530         (Input_file_argument::arg_serial_): New data member.
3531         (Input_arguments::Input_arguments): Initialize file_count_.
3532         (Input_arguments::add_file): Remove const.
3533         (Input_arguments::number_of_input_files): New function.
3534         (Input_arguments::file_count_): New data member.
3535         (Command_line::number_of_input_files): Call
3536         Input_arguments::number_of_input_files.
3537         * output.cc (Output_segment_headers::Output_segment_headers):
3538         Set current size.
3539         (Output_section::Input_section::current_data_size): New function.
3540         (Output_section::Output_section): Initialize new data members.
3541         (Output_section::add_input_section): Don't do merge sections for
3542         an incremental link; allocate space from free list for an
3543         incremental update.
3544         (Output_section::add_output_section_data): Allocate space from
3545         free list for an incremental update.
3546         (Output_section::update_data_size): New function.
3547         (Output_section::set_fixed_layout): New function.
3548         (Output_section::reserve): New function.
3549         (Output_segment::set_section_addresses): Remove const.
3550         (Output_segment::set_section_list_addresses): Remove const; allocate
3551         space from free list for an incremental update.
3552         (Output_segment::set_offset): Adjust size of RELRO segment for an
3553         incremental update.
3554         * output.h (Output_data::current_data_size): Move here from
3555         child classes.
3556         (Output_data::pre_finalize_data_size): New function.
3557         (Output_data::update_data_size): New function.
3558         (Output_section_headers::update_data_size): new function.
3559         (Output_section_data_build::current_data_size): Move to Output_data.
3560         (Output_data_strtab::update_data_size): New function.
3561         (Output_section::current_data_size): Move to Output_data.
3562         (Output_section::set_fixed_layout): New function.
3563         (Output_section::has_fixed_layout): New function.
3564         (Output_section::reserve): New function.
3565         (Output_section::update_data_size): New function.
3566         (Output_section::has_fixed_layout_): New data member.
3567         (Output_section::free_list_): New data member.
3568         (Output_segment::set_section_addresses): Remove const.
3569         (Output_segment::set_section_list_addresses): Remove const.
3570         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3571         New function.
3572         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3573         New function.
3574         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3575         parameter when calling Add_symbols constructor; store argument
3576         serial number for members of a lib group.
3577         (Add_symbols::locks): Allow case where token == NULL.
3578         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3579         (Read_member::~Read_member): New function.
3580         (Read_member::is_runnable): New function.
3581         (Read_member::locks): New function.
3582         (Read_member::run): New function.
3583         (Check_script::~Check_script): New function.
3584         (Check_script::is_runnable): New function.
3585         (Check_script::locks): New function.
3586         (Check_script::run): New function.
3587         (Check_library::~Check_library): New function.
3588         (Check_library::is_runnable): New function.
3589         (Check_library::locks): New function.
3590         (Check_library::run): New function.
3591         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3592         (Add_symbols::library_): New data member.
3593         (class Read_member): New class.
3594         (class Check_script): New class.
3595         (class Check_library): New class.
3596         * reloc.cc (Read_relocs::is_runnable): Allow case where
3597         token == NULL.
3598         (Read_relocs::locks): Likewise.
3599         (Scan_relocs::locks): Likewise.
3600         (Relocate_task::locks): Likewise.
3601         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3602         to clear counters.
3603         (Sized_relobj::incremental_relocs_scan): Fix comment.
3604         (Sized_relobj::do_relocate): Pass output file offset to
3605         write_local_symbols.
3606         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3607         from class declaration.
3608         * script.cc (read_input_script): Allocate Script_info; pass
3609         argument serial number to report_script.
3610         * script.h (class Script_info): Move to incremental.h.
3611         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3612         * symtab.h (Symbol_table::add_from_incrobj): New function.
3613         (Symbol_table::set_file_offset): New function.
3614
3615 2011-04-05  Cary Coutant  <ccoutant@google.com>
3616
3617         * incremental-dump.cc (dump_incremental_inputs): Change signature
3618         to take a Sized_incremental_binary; change caller.  Use readers
3619         in Sized_incremental_binary.
3620         * incremental.cc
3621         (Sized_incremental_binary::find_incremental_inputs_sections):
3622         Rename do_find_incremental_inputs_sections to this.
3623         (Sized_incremental_binary::setup_readers): New function.
3624         (Sized_incremental_binary::do_check_inputs): Check
3625         has_incremental_info_ flag; move setup code to setup_readers;
3626         use input readers.
3627         (Sized_incremental_binary::do_file_is_unchanged): New function.
3628         (Sized_incremental_binary::do_get_input_reader): New function.
3629         * incremental.h (class Incremental_binary): Move to end of file.
3630         (Incremental_binary::file_is_unchanged): New function.
3631         (Incremental_binary::do_file_is_unchanged): New function.
3632         (Incremental_binary::Input_reader): New class.
3633         (Incremental_binary::get_input_reader): New function.
3634         (class Sized_incremental_binary): Move to end of file.
3635         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3636         input section reader classes.
3637         (Sized_incremental_binary::has_incremental_info): New function.
3638         (Sized_incremental_binary::inputs_reader): New function.
3639         (Sized_incremental_binary::symtab_reader): New function.
3640         (Sized_incremental_binary::relocs_reader): New function.
3641         (Sized_incremental_binary::got_plt_reader): New function.
3642         (Sized_incremental_binary::do_file_is_unchanged): New function.
3643         (Sized_incremental_binary::Sized_input_reader): New class.
3644         (Sized_incremental_binary::get_input_reader): New function.
3645         (Sized_incremental_binary::find_incremental_inputs_sections):
3646         Rename do_find_incremental_inputs_sections to this.
3647         (Sized_incremental_binary::setup_readers): New function.
3648         (Sized_incremental_binary::has_incremental_info_): New data member.
3649         (Sized_incremental_binary::inputs_reader_): New data member.
3650         (Sized_incremental_binary::symtab_reader_): New data member.
3651         (Sized_incremental_binary::relocs_reader_): New data member.
3652         (Sized_incremental_binary::got_plt_reader_): New data member.
3653         (Sized_incremental_binary::current_input_file_): New data member.
3654
3655 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3656
3657         PR gold/12640
3658         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3659         violation.
3660
3661 2011-03-30  Cary Coutant  <ccoutant@google.com>
3662
3663         * archive.cc (Archive::include_member): Adjust call to report_object.
3664         (Add_archive_symbols::run): Add script_info to call to
3665         report_archive_begin.
3666         (Lib_group::include_member): Adjust call to report_object.
3667         (Add_lib_group_symbols::run): Adjust call to report_object.
3668         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3669         blocks.  Add object count for script input files.
3670         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3671         script_info parameter; change all callers.
3672         (Incremental_inputs::report_object): Add script_info parameter;
3673         change all callers.
3674         (Incremental_inputs::report_script): Store backpointer to
3675         incremental info entry.
3676         (Output_section_incremental_inputs::set_final_data_size): Record
3677         additional information for scripts.
3678         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3679         * incremental.h (Incremental_script_entry::add_object): New function.
3680         (Incremental_script_entry::get_object_count): New function.
3681         (Incremental_script_entry::get_object): New function.
3682         (Incremental_script_entry::objects_): New data member; adjust
3683         constructor.
3684         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3685         (Incremental_inputs::report_object): Add script_info parameter.
3686         (Incremental_inputs_reader::get_object_count): New function.
3687         (Incremental_inputs_reader::get_object_offset): New function.
3688         * options.cc (Input_arguments::add_file): Return reference to
3689         new input argument.
3690         * options.h (Input_argument::set_script_info): New function.
3691         (Input_argument::script_info): New function.
3692         (Input_argument::script_info_): New data member; adjust all
3693         constructors.
3694         (Input_file_group::add_file): Return reference to new input argument.
3695         (Input_file_lib::add_file): Likewise.
3696         (Input_arguments::add_file): Likewise.
3697         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3698         * script.cc (Parser_closure::Parser_closure): Add script_info
3699         parameter; adjust all callers.
3700         (Parser_closure::script_info): New function.
3701         (Parser_closure::script_info_): New data member.
3702         (read_input_script): Report scripts earlier to incremental info.
3703         (script_add_file): Set script_info in Input_argument.
3704         (script_add_library): Likewise.
3705         * script.h (Script_options::Script_info): Rewrite class.
3706
3707 2011-03-29  Cary Coutant  <ccoutant@google.com>
3708
3709         * archive.cc (Library_base::should_include_member): Move
3710         method here from class Archive.
3711         (Archive::Archive): Initialize base class.
3712         (Archive::should_include_member): Move to base class.
3713         (Archive::do_for_all_unused_symbols): New function.
3714         (Add_archive_symbols::run): Remove redundant access to
3715         incremental_inputs.
3716         (Lib_group::Lib_group): Initialize base class.
3717         (Lib_group::do_filename): New function.
3718         (Lib_group::include_member): Pass pointer to Lib_group to
3719         report_object.
3720         (Lib_group::do_for_all_unused_symbols): New function.
3721         (Add_lib_group_symbols::run): Report archive information for
3722         incremental links.
3723         * archive.h (class Library_base): New base class.
3724         (class Archive): Derive from Library_base.
3725         (Archive::filename): Move to base class.
3726         (Archive::set_incremental_info): Likewise.
3727         (Archive::incremental_info): Likewise.
3728         (Archive::Should_include): Likewise.
3729         (Archive::should_include_member): Likewise.
3730         (Archive::Armap_entry): Remove.
3731         (Archive::Unused_symbol_iterator): Remove.
3732         (Archive::unused_symbols_begin): Remove.
3733         (Archive::unused_symbols_end): Remove.
3734         (Archive::do_filename): New function.
3735         (Archive::do_get_mtime): New function.
3736         (Archive::do_for_all_unused_symbols): New function.
3737         (Archive::task_): Move to base class.
3738         (Archive::incremental_info_): Likewise.
3739         (class Lib_group): Derive from Library_base.
3740         (Lib_group::do_filename): New function.
3741         (Lib_group::do_get_mtime): New function.
3742         (Lib_group::do_for_all_unused_symbols): New function.
3743         (Lib_group::task_): Move to base class.
3744         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3745         function.
3746         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3747         function.
3748         * incremental.cc (Incremental_inputs::report_archive_begin):
3749         Use Library_base; call library's get_mtime; add incremental inputs
3750         entry before members.
3751         (class Unused_symbol_visitor): New class.
3752         (Incremental_inputs::report_archive_end): Use Library_base; use
3753         visitor class to record unused symbols; don't add incremental inputs
3754         entry after members.
3755         (Incremental_inputs::report_object): Use Library_base.
3756         * incremental.h
3757         (Incremental_archive_entry::Incremental_archive_entry): Remove
3758         unused Archive parameter.
3759         (Incremental_inputs::report_archive_begin): Use Library_base.
3760         (Incremental_inputs::report_archive_end): Likewise.
3761         (Incremental_inputs::report_object): Likewise.
3762         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3763         function.
3764         * object.h (Object::for_all_global_symbols): New function.
3765         (Object::do_for_all_global_symbols): New function.
3766         (Sized_relobj::do_for_all_global_symbols): New function.
3767         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3768         function.
3769         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3770         function.
3771
3772 2011-03-27  Ian Lance Taylor  <iant@google.com>
3773
3774         * archive.cc (Archive::interpret_header): Return -1 if something
3775         goes wrong.  Change callers accordingly.
3776
3777 2011-03-25  Cary Coutant  <ccoutant@google.com>
3778
3779         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3780         * testsuite/Makefile.in: Regenerate.
3781
3782 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3783
3784         * plugin.cc (get_view): New.
3785         (Plugin::load): Pass get_view to the plugin.
3786         (Plugin_manager::get_view): New.
3787
3788 2011-03-21  Ian Lance Taylor  <iant@google.com>
3789
3790         * testsuite/final_layout.sh: Rewrite to not use dc.
3791         * testsuite/relro_test.sh: Fail if dc is not present.
3792
3793 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3794
3795         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3796         Change == to -eq.
3797         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3798         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3799         Change == to -eq.
3800         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3801         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3802
3803 2011-03-14  Ian Lance Taylor  <iant@google.com>
3804
3805         * script-sections.cc (Sort_output_sections::script_compare):
3806         Rename from is_before, change return type.
3807         (Sort_output_sections::operator()): Adjust accordingly.
3808
3809 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3810
3811         PR gold/12572
3812         * testsuite/odr_violation2.cc: Add comment to make all error line
3813         numbers double digits.
3814         * testsuite/debug_msg.sh: Adjust expected errors.
3815
3816 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3817
3818         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3819         but mark earlier ones as non-canonical
3820         (offset_to_iterator): Update search target and example
3821         (do_addr2line): Return extra lines in a vector*
3822         (format_file_lineno): Extract from do_addr2line
3823         (one_addr2line): Add vector* out-param
3824         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3825         when a lineno entry appeared last for its instruction
3826         (Dwarf_line_info): Add vector* out-param
3827         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3828         * symtab.cc (Odr_violation_compare): Include the lineno in the
3829         comparison again.
3830         (linenos_from_loc): New. Combine the canonical line for an
3831         address with its other lines.
3832         (True_if_intersect): New. Helper functor to make
3833         std::set_intersection a query.
3834         (detect_odr_violations): Compare sets of lines instead of just
3835         one line for each function. This became less deterministic, but
3836         has fewer false positives.
3837         * symtab.h: Declarations.
3838         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3839         mix an optimized and non-optimized object in the same binary
3840         (odr_violation2.so): Same.
3841         * testsuite/Makefile.in: Regenerate from Makefile.am.
3842         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3843         * testsuite/debug_msg.sh: Update line numbers and add
3844         assertions.
3845         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3846         non-optimized context.
3847         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3848         isn't inlined, and use OdrDerived in an optimized context.
3849         * testsuite/odr_header1.h: Defines OdrDerived, where
3850         optimization will change the
3851         first-instruction-in-the-destructor's file and line number.
3852         * testsuite/odr_header2.h: Defines OdrBase.
3853
3854 2011-03-09  Ian Lance Taylor  <iant@google.com>
3855
3856         * fileread.cc (File_read::clear_views): Don't delete the whole
3857         file view.
3858
3859 2011-03-08  Ian Lance Taylor  <iant@google.com>
3860
3861         PR gold/12525
3862         * fileread.cc: #include <climits>.
3863         (GOLD_IOV_MAX): Define.
3864         (File_read::read_multiple): Limit number of entries by iov_max.
3865         * fileread.h (class File_read): Always set max_readv_entries to
3866         128.
3867
3868 2011-03-07  Ian Lance Taylor  <iant@google.com>
3869
3870         PR gold/12525
3871         * options.h (class General_options): Add -dy and -dn.
3872
3873 2011-03-02  Cary Coutant  <ccoutant@google.com>
3874
3875         * testsuite/script_test_9.t: Add TLS segment.
3876
3877 2011-03-02  Simon Baldwin  <simonb@google.com>
3878
3879         * configure.ac: Add check for gnu_indirect_function support in
3880         the toolchain building binutils.
3881         * configure: Rebuild.
3882
3883 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3884
3885         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3886         plugin only symbols.
3887         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3888         in plugin files as not needed in the symbol table.
3889
3890 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3891
3892         * output.cc (Output_section::add_input_section): Delay fill
3893         generation for section ordering.
3894
3895 2011-02-09  Ian Lance Taylor  <iant@google.com>
3896
3897         PR gold/12316
3898         * object.h (class Sized_relobj): Remove clear_local_symbols.
3899         * reloc.cc (Sized_relobj::do_relocate): Don't call
3900         clear_local_symbols.
3901
3902 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3903
3904         * plugin.cc (is_visible_from_outside): Return true for symbols
3905         in the -u option.
3906
3907 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3908
3909         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3910         filename.
3911
3912 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3913
3914         * icf.h (is_section_foldable_candidate): Change type of parameter
3915         to std::string.
3916         * icf.cc (Icf::find_identical_sections): Change type of local variable
3917         section_name to be std::string.
3918         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3919
3920 2011-01-25  Ian Lance Taylor  <iant@google.com>
3921
3922         * script.cc (script_add_extern): Rewrite to use
3923         add_symbol_reference.
3924
3925 2011-01-25  Doug Kwan  <dougkwan@google.com>
3926
3927         * icf.cc (get_section_contents): Always lock section's object.
3928
3929 2011-01-24  Ian Lance Taylor  <iant@google.com>
3930
3931         * options.h (class General_options): Accept
3932         --no-detect-odr-violations.
3933
3934 2011-01-24  Ian Lance Taylor  <iant@google.com>
3935
3936         * version.cc (version_string): Bump to 1.11.
3937
3938 2011-01-24  Ian Lance Taylor  <iant@google.com>
3939
3940         * plugin.cc (class Plugin_rescan): Define new class.
3941         (Plugin_manager::claim_file): Set any_claimed_.
3942         (Plugin_manager::save_archive): New function.
3943         (Plugin_manager::save_input_group): New function.
3944         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3945         necessary.
3946         (Plugin_manager::new_undefined_symbol): New function.
3947         (Plugin_manager::rescan): New function.
3948         (Plugin_manager::rescannable_defines): New function.
3949         (Plugin_manager::add_input_file): Set any_added_.
3950         * plugin.h (class Plugin_manager): define new fields rescannable_,
3951         undefined_symbols_, any_claimed_, and any_added_.  Declare
3952         Plugin_rescan as friend.  Declare new functions.
3953         (Plugin_manager::Rescannable): Define type.
3954         (Plugin_manager::Rescannable_list): Define type.
3955         (Plugin_manager::Undefined_symbol_list): Define type.
3956         (Plugin_manager::Plugin_manager): Initialize new fields.
3957         * archive.cc (Archive::defines_symbol): New function.
3958         (Add_archive_symbols::run): Pass archive to plugins if any.
3959         * archive.h (class Archive): Declare defines_symbol.
3960         * readsyms.cc (Input_group::~Input_group): New function.
3961         (Finish_group::run): Pass input_group to plugins if any.
3962         * readsyms.h (class Input_group): Declare destructor.
3963         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3964         any.
3965
3966 2011-01-10  Ian Lance Taylor  <iant@google.com>
3967
3968         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3969         section as relro.
3970         (Layout::set_segment_offsets): Reset increase_relro before calling
3971         set_section_addresses a second time.
3972
3973 2011-01-04  Cary Coutant  <ccoutant@google.com>
3974
3975         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3976         sections before NOBITS sections.
3977
3978 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3979
3980         * version.cc (print_version): Update copyright to 2011.
3981
3982 2010-12-23  Cary Coutant  <ccoutant@google.com>
3983
3984         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3985         of OS to this->add.  Add OD parameter to second form of the function.
3986
3987 2010-12-20  Ian Lance Taylor  <iant@google.com>
3988
3989         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3990         second of two consecutive entries with same offset.
3991
3992 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3993
3994         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3995         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3996         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3997         to avoid unneeded links against $(LDADD).
3998         * testsuite/Makefile.in: Regenerate.
3999
4000 2010-12-15  Ian Lance Taylor  <iant@google.com>
4001
4002         PR gold/12324
4003         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4004         for R_X86_64_32 and R_X86_64_PC32.
4005         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4006         ver_matching_def_pic.o.
4007         (ver_matching_def_pic.o): New target.
4008
4009 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4010
4011         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4012         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4013         Move definition before File_read::View member definitions.
4014         (File_read::View::~View): Initialize and hold lock before
4015         updating current_mapped_bytes.
4016
4017 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4018
4019         * dwarf_reader.cc: Remove outdated comment.
4020         * gold-threads.cc: Fix typo in error message.
4021         * archive.cc: Fix typos in comments.
4022         * archive.h: Likewise.
4023         * arm-reloc-property.cc: Likewise.
4024         * arm-reloc-property.h: Likewise.
4025         * arm-reloc.def: Likewise.
4026         * arm.cc: Likewise.
4027         * attributes.h: Likewise.
4028         * cref.cc: Likewise.
4029         * ehframe.cc: Likewise.
4030         * fileread.h: Likewise.
4031         * gold.h: Likewise.
4032         * i386.cc: Likewise.
4033         * icf.cc: Likewise.
4034         * incremental.h: Likewise.
4035         * int_encoding.cc: Likewise.
4036         * layout.h: Likewise.
4037         * main.cc: Likewise.
4038         * merge.h: Likewise.
4039         * object.cc: Likewise.
4040         * object.h: Likewise.
4041         * options.cc: Likewise.
4042         * readsyms.cc: Likewise.
4043         * reduced_debug_output.cc: Likewise.
4044         * reloc.cc: Likewise.
4045         * script-sections.cc: Likewise.
4046         * sparc.cc: Likewise.
4047         * symtab.h: Likewise.
4048         * target-reloc.h: Likewise.
4049         * target.cc: Likewise.
4050         * target.h: Likewise.
4051         * timer.cc: Likewise.
4052         * timer.h: Likewise.
4053         * x86_64.cc: Likewise.
4054
4055 2010-12-09  Cary Coutant  <ccoutant@google.com>
4056
4057         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4058         stack.
4059         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4060         parameter; change all callers.
4061         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4062         * options.h (warn_execstack): New option.
4063
4064 2010-12-07  Doug Kwan  <dougkwan@google.com>
4065
4066         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4067         like function call relocations.
4068
4069 2010-12-07  Ian Lance Taylor  <iant@google.com>
4070
4071         * archive.cc (Archive::get_elf_object_for_member): Permit
4072         punconfigured to be NULL.
4073         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4074         (Archive::include_member): Pass NULL to get_elf_object_for_member
4075         if we searched for the archive and this is the first included
4076         object.
4077
4078 2010-12-01  Ian Lance Taylor  <iant@google.com>
4079
4080         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4081         track_relocs_type_ field.
4082         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4083         Set track_relocs_type_.
4084         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4085         contents when using RELA relocs.
4086         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4087         reloc_map_.
4088         * reloc.cc (Track_relocs::next_addend): New function.
4089         * reloc.h (class Track_relocs): Declare next_addend.
4090
4091 2010-12-01  Ian Lance Taylor  <iant@google.com>
4092
4093         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4094         virtual destructor.
4095
4096 2010-12-01  Ian Lance Taylor  <iant@google.com>
4097
4098         * README: Update compilers known to work and fail.
4099
4100 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4101
4102         * configure.in: For --enable-gold, handle value `default' instead of
4103         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4104         not the default.
4105         * configure: Regenerate.
4106
4107 2010-11-18  Doug Kwan  <dougkwan@google.com>
4108
4109         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4110         and right_alignment to be zero.  Store result alignment only if it is
4111         greater than existing alignment.
4112
4113 2010-11-16  Cary Coutant  <ccoutant@google.com>
4114
4115         PR gold/12220
4116         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4117         Check for ".zdebug_line".
4118
4119 2010-11-16  Doug Kwan  <dougkwan@google.com>
4120             Cary Coutant  <ccoutant@google.com>
4121
4122         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4123         by reference; adjust all callers.
4124         * output.cc (Output_segment::set_section_addresses): Adjust references
4125         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4126         list is empty.
4127         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4128         end at page boundary.
4129
4130 2010-11-16  Cary Coutant  <ccoutant@google.com>
4131
4132         PR gold/12220
4133         * layout.cc (Layout::choose_output_section): Transform names of
4134         compressed sections even when using a script with a SECTIONS clause.
4135         (Layout::output_section_name): Remove code to transform
4136         compressed debug section names.
4137         * output.cc (Output_section::add_input_section): Use uncompressed
4138         section size when tracking input sections.
4139
4140 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4141
4142         * symtab.h (Symbol::NON_PIC_REF): Remove.
4143         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4144         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4145         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4146         (Symbol::use_plt_offset): Take a flags argument and pass it
4147         directly to needs_dynamic_reloc.  Restrict check for undefined
4148         weak symbols to function calls.
4149         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4150         (Target_arm::Scan::global): Use it.
4151         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4152         (Target_arm::Relocate::relocate): Likewise.
4153         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4154         parameter with an r_type parameter.  Use get_reference_flags
4155         to get the flags.
4156         (Target_arm::Relocate::relocate): Update accordingly.
4157         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4158         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4159         (Target_i386::Scan::global): Likewise.
4160         (Target_i386::Relocate::relocate): Likewise.
4161         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4162         parameter with an r_type parameter.  Use get_reference_flags
4163         to get the flags.
4164         (Target_i386::Relocate::relocate): Update accordingly.
4165         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4166         (Target_powerpc::Scan::global): Use it.
4167         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4168         (Target_powerpc::Relocate::relocate): Likewise.
4169         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4170         (Target_sparc::Scan::global): Use it.
4171         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4172         (Target_sparc::Relocate::relocate): Likewise.
4173         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4174         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4175         (Target_x86_64::Scan::global): Likewise.
4176         (Target_x86_64::Relocate::relocate): Likewise.
4177
4178 2010-11-08  Doug Kwan  <dougkwan@google.com>
4179             Cary Coutant  <ccoutant@google.com>
4180
4181         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4182         (Arm_exidx_merge_section::section_contents_): New data member.
4183         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4184         (Arm_input_section::~Arm_input_section): De-allocate memory.
4185         (Arm_input_section::original_contents_): New data member.
4186         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4187         in parameters instead of calling Object::section_contents without
4188         locking.
4189         (Arm_output_section::group_section): New parameter TASK.  Pass it
4190         to callees that need locking objects.
4191         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4192         to lock EXIDX input sections.  Fix a formatting issue.  Call
4193         Arm_exidx_merged_section::build_contents to create merged section
4194         contents.
4195         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4196         to lock object of stub table owner.
4197         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4198         TEXT_SIZE to initialize data member TEXT_SIZE_.
4199         (Arm_exidx_input_section::addralign): Fix typo in comment.
4200         (Arm_exidx_input_section::text_size): New method.
4201         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4202         that require locking objects.  Lock objects before scanning for stubs
4203         and updating local symbols.
4204         (Arm_input_section<big_endian>::init): Copy contents of original
4205         input section.
4206         (Arm_input_section<big_endian>::do_write): Use saved contents of
4207         original input section instead of calling Object::section_contents
4208         without locking.
4209         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4210         size without calling Object::section_size().
4211         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4212         for size.  Allocate a buffer for merged EXIDX entries.
4213         (Arm_exidx_merged_section::build_contents): New method.
4214         (Arm_exidx_merged_section::do_write): Move merge section contents
4215         building code to Arm_exidx_merged_section::build_contetns.  Write
4216         out contetns in buffer instead of building it on the fly.
4217         (Arm_relobj::make_exidx_input_section): Also pass text section size
4218         to Arm_exidx_input_section constructor.
4219         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4220         (Arm_dynobj::do_read_symbols): Fix memory leak.
4221         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4222         * target.h: (class Task): Add forward declaration.
4223         (Target::relax): Add new parameter TASK and pass it to
4224         Target::do_relax().
4225         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4226
4227 2010-11-05  Cary Coutant  <ccoutant@google.com>
4228
4229         PR gold/10708
4230         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4231         object when reading from the file.
4232         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4233         second layout pass.
4234         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4235         when reading section contents.
4236         (get_section_contents): Likewise.
4237         (icf::find_identical_sections): Likewise.
4238         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4239         object when reading from the file.
4240         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4241         the object when doing deferred section layout.
4242
4243 2010-11-03  Nick Clifton  <nickc@redhat.com>
4244
4245         PR gold/12001
4246         * script.h (class Symbol_assignment: name): New member.  Returns
4247         the name of the symbol.
4248         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4249         Returns true if the given symbol name is on the list of
4250         assignments wating to be processed.
4251         * archive.cc (should_incldue_member): If the symbol is undefined,
4252         check to see if it is on the list of symbols pending assignment.
4253
4254 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4255
4256         * script-sections.cc (Script_sections::find_memory_region): Check
4257         for a NULL output section pointer.
4258
4259 2010-10-29  Doug Kwan  <dougkwan@google.com>
4260
4261         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4262         Output_section::add_relaxed_input_section.
4263         * output.cc (Output_section::add_relaxed_input_section): Add new
4264         arguments LAYOUT and NAME.  Set section order index.
4265         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4266         Copy section order index.
4267         * output.h (Output_section::add_relaxed_input_section): Add new
4268         arguments LAYOUT and NAME.
4269
4270 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4271
4272         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4273         NATIVE_OR_CROSS_LINKER.
4274         * testsuite/Makefile.in: Regenerate.
4275
4276 2010-10-20  Doug Kwan  <dougkwan@google.com>
4277
4278         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4279         without SHF_LINK_ORDER flags.
4280         * layout.cc (Layout::choose_output_section): Do not filter
4281         SHF_LINK_ORDER flag in a relocatable link.
4282
4283 2010-10-17  Cary Coutant  <ccoutant@google.com>
4284
4285         * output.h (Output_segment::set_section_addresses): Change function
4286         signature.  Update all callers.
4287         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4288         sections.
4289         (Output_segment::set_section_addresses): Align after last TLS
4290         section.  Add padding before last relro section instead of after.
4291
4292 2010-10-17  Doug Kwan  <dougkwan@google.com>
4293
4294         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4295         GOT output section to be writable.
4296
4297 2010-10-14  Cary Coutant  <ccoutant@google.com>
4298
4299         * debug.h (DEBUG_INCREMENTAL): New flag.
4300         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4301         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4302         mode.
4303         * incremental.cc (report_command_line): Ignore all forms of
4304         --incremental.
4305         * layout.cc (Layout::Layout): Check parameters for incremental link
4306         mode.
4307         * options.cc (General_options::parse_incremental): New function.
4308         (General_options::parse_no_incremental): New function.
4309         (General_options::parse_incremental_full): New function.
4310         (General_options::parse_incremental_update): New function.
4311         (General_options::incremental_mode_): New data member.
4312         (General_options::finalize): Check incremental_mode_.
4313         * options.h (General_options): Update help text for --incremental.
4314         Add --no-incremental, --incremental-full, --incremental-update.
4315         (General_options::Incremental_mode): New enum type.
4316         (General_options::incremental_mode): New function.
4317         (General_options::incremental_mode_): New data member.
4318         * parameters.cc (Parameters::incremental_mode_): New data member.
4319         (Parameters::set_options): Set incremental_mode_.
4320         (Parameters::set_incremental_full): New function.
4321         (Parameters::incremental): New function.
4322         (Parameters::incremental_update): New function.
4323         (set_parameters_incremental_full): New function.
4324         * parameters.h (Parameters::set_incremental_full): New function.
4325         (Parameters::incremental): New function.
4326         (Parameters::incremental_update): New function.
4327         (Parameters::incremental_mode_): New data member.
4328         (set_parameters_incremental_full): New function.
4329         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4330         incremental link mode.
4331         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4332         (Sized_relobj::do_relocate_sections): Likewise.
4333         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4334         option.
4335         * testsuite/Makefile.in: Regenerate.
4336         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4337
4338 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4339
4340         * script-sections.h (class Script_sections): Make
4341         Sections_elements typedef public.
4342         * script-sections.cc (class Sort_output_sections): Add elements_
4343         field.  Add constructor which sets it; change all callers.
4344         (Sort_output_sections::is_before): New function.
4345         (Sort_output_sections::operator()): Call is_before.
4346         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4347         conditional.
4348         * testsuite/script_test_10.sh: New test. Test script section
4349         order.
4350         * testsuite/script_test_10.t: Likewise.
4351         * testsuite/script_test_10.s: Likewise.
4352         * testsuite/Makefile.am: Wrap the cross linker tests and the
4353         common tests into NATIVE_OR_CROSS_LINKER.
4354         (check_SCRIPTS): Add script_test_10.sh.
4355         (check_DATA): Add script_test_10.stdout.
4356         (script_test_10.o, script_test_10): New targets.
4357         (script_test_10.stdout): New target.
4358         * configure, testsuite/Makefile.in: Regenerate.
4359
4360 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4361
4362         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4363         error for the deprecated relocations.
4364         (Target_arm::Scan::global): Likewise.
4365         (Target_arm::Relocate::relocate): Likewise.
4366
4367 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4368
4369         * fileread.cc (Input_file::find_file): Initialize *found_name
4370         and *namep when using the fallback search for case 4.
4371
4372 2010-10-11  Cary Coutant  <ccoutant@google.com>
4373
4374         * options.h (class General_options): Redefine -z lazy as an alias for
4375         the negation of -z now.
4376
4377 2010-10-11  Ian Lance Taylor  <iant@google.com>
4378
4379         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4380         binding.
4381
4382 2010-10-06  Nick Clifton  <nickc@redhat.com>
4383
4384         * script-sections.cc(class Memory_region): Remove
4385         current_lma_offset_ field.  Rename current_vma_offset_ to
4386         current_offset_.  Add last_section_ field.
4387         (Memory_region::get_current_vma_address): Rename to
4388         get_current_address.
4389         (Memory_region::get_current_lma_address): Delete.
4390         (Memory_region::increment_vma_offset): Rename to
4391         increment_offset.
4392         (Memory_region::increment_lma_offset): Delete.
4393         (Memory_region::attributes_compatible): New method.  Returns
4394         true if the provided section is compatible with the region.
4395         (Memory_region::get_last_section): New method.  Returns the last
4396         section to use the region.
4397         (Memory_region::set_last_section): New method.  Stores the last
4398         section to use the region.
4399         (Script_sections::block_in_region): New method.  Returns true if
4400         a block of memory is contained within a region.
4401         (Script_sections::find_memory_region): New method.  Locates a
4402         memory region to be used to set a VMA or LMA address.
4403         (Output_section_definition::set_section_addresses): Add code to
4404         check for addresses set by memory regions.
4405         (Output_segment::set_section_addresses): Remove memory region
4406         walking code.
4407         (Script_sections::create_segment): Add a warning if a header
4408         segment is created outside of any region.
4409         * script-sections.h (class Script_sections): Add prototypes for
4410         find_memory_region and block_in_region methods.
4411         * testsuite/memory_test.s: Use .long instead of .word.
4412         * testsuite/memory_test.t: Add some more output sections.
4413         * testsuite/memory_test.sh: Update expected output.
4414
4415 2010-10-02  Doug Kwan  <dougkwan@google.com>
4416
4417         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4418         defintion to symtab.h
4419         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4420         declaration to defintion.
4421
4422 2010-10-01  Nick Clifton  <nickc@redhat.com>
4423
4424         * expression.cc (eval): Replace dummy argument with NULL.
4425         (eval_maybe_dot): Check for a NULL result section pointer.
4426         (Symbol_expression::value): Likewise.
4427         (Dot_expression::value): Likewise.
4428         (BINARY_EXPRESSION): Likewise.
4429         (Max_expression::value): Likewise.
4430         (Min_expression::value): Likewise.
4431         (Absolute_expression::value): Likewise.
4432         (Addr_expression::value_from_output_section): Likewise.
4433         (Loaddddr_expression::value_from_output_section): Likewise.
4434         (Segment_start_expression::value): Likewise.
4435         * script-sections.cc
4436         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4437         argument with NULL.
4438         (Sections_elememt_dot_assignment::set_section_addresses):
4439         Likewise.
4440         (Output_data_expression::do_write_to_buffer): Likewise.
4441         (Output_section_definition::finalize_symbols): Likewise.
4442         (Output_section_definition::set_section_addresses): Likewise.
4443
4444 2010-09-30  Doug Kwan  <dougkwan@google.com>
4445
4446         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4447
4448 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4449
4450         * target.h (Target::can_icf_inline_merge_sections): New virtual
4451         function.
4452         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4453         virtual function.
4454         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4455         virtual function.
4456         * icf.cc (get_section_contents): Inline merge sections only when
4457         target allows it.
4458
4459 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4460
4461         * configure: Regenerate.
4462
4463 2010-09-17  Ian Lance Taylor  <iant@google.com>
4464
4465         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4466         * testsuite/Makefile.am (memory_test.o): New target.
4467         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4468         memory_test.t.
4469         * testsuite/Makefile.in: Rebuild.
4470
4471 2010-09-17  Doug Kwan  <dougkwan@google.com>
4472
4473         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4474         defintion if relocation uses GOT entries of the symbol.
4475         * testsuite/icf_safe_test.sh: Fix test.
4476         * testsuite/icf_safe_so_test.sh: Fix test.
4477
4478 2010-09-16  Cary Coutant  <ccoutant@google.com>
4479
4480         * script_sections.cc (class Memory_region): Remove "NULL" from
4481         vector initializations.
4482
4483 2010-09-15  Cary Coutant  <ccoutant@google.com>
4484
4485         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4486         Resolve forwarding symbols.
4487
4488 2010-09-15  Doug Kwan  <dougkwan@google.com>
4489
4490         * gold/testsuite/script_test_3.t: Add ARM special sections.
4491         * gold/testsuite/script_test_4.t: Same.
4492         * gold/testsuite/script_test_5.t: Same.
4493         * gold/testsuite/script_test_6.t: Same.
4494         * gold/testsuite/script_test_7.t: Same.
4495         * gold/testsuite/script_test_7.t: Same.
4496         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4497
4498 2010-09-14  Cary Coutant  <ccoutant@google.com>
4499
4500         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4501         (Target_x86_64::Relocate::relocate_tls): Replace check for
4502         saw_tls_block_reloc_ with test for executable section.
4503
4504 2010-09-12  Cary Coutant  <ccoutant@google.com>
4505
4506         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4507         position-independent executables to shared libraries need dynamic
4508         relocations.
4509         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4510         position-independent executables.
4511         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4512         * testsuite/Makefile.in: Regenerate.
4513
4514 2010-09-10  Nick Clifton  <nickc@redhat.com>
4515
4516         PR gold/11997
4517         * testsuite/memory_test.t: Discard any sections that are not
4518         needed.
4519
4520 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4521
4522         PR gold/11996
4523         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4524         "This::" to work around a bug in gcc 4.2.
4525
4526         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4527
4528 2010-09-09  Rafael Espindola  <espindola@google.com>
4529
4530         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4531         sections with different PF_X flags in the same segment.
4532         (Layout::find_first_load_seg): Search all segments to find the first
4533         one.
4534         * options.h (rosegment): New.
4535
4536 2010-09-08  Rafael Espindola  <espindola@google.com>
4537
4538         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4539
4540 2010-09-08  Doug Kwan  <dougkwan@google.com>
4541
4542         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4543         (Arm_relobj::do_relocate_sections): Add new parameter for output
4544         file to match the parent.
4545         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4546         of local symbols instead of input values.  Update code to track
4547         changes in gold::relocate_section.
4548         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4549         (Sized_relobj::compute_final_local_value_internal): New methods.
4550         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4551         body into private version of Sized_relobj::compute_final_local_value.
4552         Call the inline method.
4553         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4554         merged symbol value if there is one.
4555         (Symbol_value::has_output_value): New method defintiion.
4556         (Sized_relobj::Compute_final_local_value_status): New enum type.
4557         (Sized_relobj::compute_final_local_value): New methods.
4558         (Sized_relobj::compute_final_local_value_internal): New methods.
4559         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4560         and arm_cortex_a8.sh.
4561         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4562         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4563         New tests.
4564         * Makefile.in: Regenerate.
4565         * testsuite/arm_bl_out_of_range.s: Update test.
4566         * testsuite/thumb_bl_out_of_range.s: Ditto.
4567         * testsuite/thumb_blx_out_of_range.s: Ditto.
4568         * testsuite/arm_branch_out_of_range.sh: New file.
4569         * testsuite/arm_cortex_a8.sh: Ditto.
4570         * testsuite/arm_cortex_a8_b.s: Ditto.
4571         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4572         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4573         * testsuite/arm_cortex_a8_bl.s: Ditto.
4574         * testsuite/arm_cortex_a8_blx.s: Ditto.
4575         * testsuite/arm_cortex_a8_local.s: Ditto.
4576         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4577         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4578
4579 2010-09-08  Rafael Espindola  <espindola@google.com>
4580
4581         * Makefile.am (memory_test.stdout): Run readelf with -W.
4582         * Makefile.in: Regenerate.
4583         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4584         64 bit output.
4585
4586 2010-09-08  Rafael Espindola  <espindola@google.com>
4587
4588         * script-sections.cc (Script_sections::add_memory_region): Convert
4589         field precision to int.
4590         * script.cc (script_set_section_region, script_set_section_region):
4591         Convert field precision to int.
4592
4593 2010-09-08  Rafael Espindola  <espindola@google.com>
4594
4595         * arm.cc (do_finalize_sections): Create the __exidx_start and
4596         __exdix_end symbols even when the section is missing.
4597
4598 2010-09-08  Nick Clifton  <nickc@redhat.com>
4599
4600         * README: Remove claim that MEMORY is not supported.
4601         * expression.cc (script_exp_function_origin)
4602         (script_exp_function_length): Move from here to ...
4603         * script.cc: ... here.
4604         (script_set_section_region, script_add_memory)
4605         (script_parse_memory_attr, script_include_directive): New
4606         functions.
4607         * script-sections.cc
4608         (class Memory_region): New class.
4609         (class Output_section_definition): Add set_memory_region,
4610         set_section_vma, set_section_lma and get_section_name methods.
4611         (class Script_Sections): Add add_memory_region,
4612         find_memory_region, find_memory_region_origin,
4613         find_memory_region_length and set_memory_region methods.
4614         Have set_section_addresses method walk the list of set memory
4615         regions.
4616         Extend the print methos to display memory regions.
4617         * script-sections.h: Add prototypes for new methods.
4618         Add enum for MEMORY region attributes.
4619         * yyscript.y: Add support for parsing MEMORY regions.
4620         * script-c.h: Add prototypes for new functions.
4621         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4622         * testsuite/Makefile.in: Regenerate.
4623         * testsuite/memory_test.sh: New script.
4624         * testsuite/memory_test.s: New assembler source file.
4625         * testsuite/memory_test.t: New linker script.
4626
4627 2010-08-27  Doug Kwan  <dougkwan@google.com>
4628
4629         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4630         reference override an existing dynamic weak reference.
4631         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4632         * testsuite/Makefile.in: Regenerate.
4633         * testsuite/dyn_weak_ref.sh: New file.
4634         * testsuite/dyn_weak_ref_1.c: Ditto.
4635         * testsuite/dyn_weak_ref_2.c: Ditto.
4636
4637 2010-08-27  Ian Lance Taylor  <iant@google.com>
4638
4639         * incremental.h (class Incremental_input_entry): Add virtual
4640         destructor.
4641
4642 2010-08-27  Ian Lance Taylor  <iant@google.com>
4643
4644         * testsuite/start_lib_test_3.c: Mark t3 as used.
4645
4646 2010-08-27  Nick Clifton  <nickc@redhat.com>
4647
4648         * options.cc (version_script): Fix small typo in previous
4649         whitespace tidyup.
4650
4651 2010-08-25  Nick Clifton  <nickc@redhat.com>
4652
4653         * archive.cc: Formatting fixes: Remove whitespace between
4654         typename and following asterisk.  Remove whitespace between
4655         function name and opening parenthesis.
4656         * archive.h: Likewise.
4657         * arm.cc: Likewise.
4658         * attributes.cc: Likewise.
4659         * attributes.h: Likewise.
4660         * common.cc: Likewise.
4661         * copy-relocs.cc: Likewise.
4662         * dirsearch.h: Likewise.
4663         * dynobj.cc: Likewise.
4664         * ehframe.cc: Likewise.
4665         * ehframe.h: Likewise.
4666         * expression.cc: Likewise.
4667         * fileread.cc: Likewise.
4668         * fileread.h: Likewise.
4669         * gc.h: Likewise.
4670         * gold-threads.cc: Likewise.
4671         * gold.cc: Likewise.
4672         * i386.cc: Likewise.
4673         * icf.h: Likewise.
4674         * incremental-dump.cc: Likewise.
4675         * incremental.cc: Likewise.
4676         * layout.cc: Likewise.
4677         * layout.h: Likewise.
4678         * main.cc: Likewise.
4679         * merge.cc: Likewise.
4680         * merge.h: Likewise.
4681         * object.cc: Likewise.
4682         * object.h: Likewise.
4683         * options.cc: Likewise.
4684         * options.h: Likewise.
4685         * output.cc: Likewise.
4686         * output.h: Likewise.
4687         * plugin.cc: Likewise.
4688         * plugin.h: Likewise.
4689         * powerpc.cc: Likewise.
4690         * reloc.cc: Likewise.
4691         * script-c.h: Likewise.
4692         * script-sections.cc: Likewise.
4693         * script.cc: Likewise.
4694         * stringpool.cc: Likewise.
4695         * symtab.cc: Likewise.
4696         * symtab.h: Likewise.
4697         * target.cc: Likewise.
4698         * timer.cc: Likewise.
4699         * timer.h: Likewise.
4700         * version.cc: Likewise.
4701         * x86_64.cc: Likewise.
4702
4703 2010-08-24  Nick Clifton  <nickc@redhat.com>
4704
4705         PR 11899
4706         * layout.cc (segment_precedes): Sort segments by their physical
4707         addresses, if they have been set.
4708
4709 2010-08-23  Cary Coutant  <ccoutant@google.com>
4710
4711         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4712         symbols data.
4713         (Lib_group::include_member): Unlock object after deleting its
4714         symbols data.
4715         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4716         the bug fixed here.
4717
4718 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4719             Cary Coutant  <ccoutant@google.com>
4720
4721         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4722         constructor, and set_blocker.
4723         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4724         readsyms_blocker_.
4725         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4726         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4727         * testsuite/Makefile.am (start_lib_test): New test case.
4728         * testsuite/Makefile.in: Regenerate.
4729         * testsuite/start_lib_test_main.c: New file.
4730         * testsuite/start_lib_test_1.c: New file.
4731         * testsuite/start_lib_test_2.c: New file.
4732         * testsuite/start_lib_test_3.c: New file.
4733
4734 2010-08-19  Ian Lance Taylor  <iant@google.com>
4735
4736         * Makefile.in: Rebuild with automake 1.11.1.
4737         * aclocal.m4: Likewise.
4738         * testsuite/Makefile.in: Likewise.
4739
4740 2010-08-19  Ian Lance Taylor  <iant@google.com>
4741
4742         PR 10893
4743         * i386.cc (class Output_data_plt_i386): Update declarations.
4744         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4745         local_ifuncs_ fields.
4746         (Target_i386::do_plt_section_for_global): New function.
4747         (Target_i386::do_plt_section_for_local): New function.
4748         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4749         parameter; change all callers.  Initialize global_ifuncs_ and
4750         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4751         __rel_iplt_end.
4752         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4753         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4754         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4755         symbols.
4756         (Target_i386::make_plt_section): New function, broken out of
4757         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4758         (Target_i386::make_plt_entry): Call make_plt_section.
4759         (Target_i386::make_local_ifunc_plt_entry): New function.
4760         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4761         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4762         R_386_IRELATIVE to switch.
4763         (Target_i386::Scan::global): Likewise.
4764         (Target_i386::Relocate::relocate): Likewise.
4765         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4766         switch.
4767         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4768         (Target_x86_64::do_plt_section_for_global): New function.
4769         (Target_x86_64::do_plt_section_for_local): New function.
4770         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4771         parameter; change all callers.  If doing a static link define
4772         __rela_iplt_start and __rela_iplt_end.
4773         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4774         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4775         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4776         to point to .plt.
4777         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4778         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4779         switch.
4780         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4781         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4782         R_X86_64_IRELATIVE to switch.
4783         (Target_x86_64::Scan::global): Likewise.
4784         (Target_x86_64::Relocate::relocate): Likewise.
4785         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4786         switch.
4787         * target.h (class Target): Add plt_section_for_global and
4788         plt_section_for_local functions.  Add do_plt_section_for_global
4789         and do_plt_section_for_local virtual functions.
4790         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4791         clarifying comments.
4792         (Symbol::use_plt_offset): Handle IFUNC symbol.
4793         * object.cc (Sized_relobj::Sized_relobj): Initialize
4794         local_plt_offsets_.
4795         (Sized_relobj::local_has_plt_offset): New function.
4796         (Sized_relobj::local_plt_offset): New function.
4797         (Sized_relobj::set_local_plt_offset): New function.
4798         (Sized_relobj::do_count): Handle IFUNC symbol.
4799         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4800         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4801         is_ifunc_symbol functions.
4802         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4803         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4804         local_plt_offsets_ field.
4805         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4806         * output.h (class Output_section_data): Add non-const
4807         output_section function.
4808         (class Output_data_got): Update declarations.
4809         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4810         Add use_plt_offset parameter to global and local constructors.
4811         Change all callers.  Change local_sym_index_ field to 31 bits.
4812         Change GSYM_CODE and CONSTANT_CODE accordingly.
4813         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4814         doing a static link don't set sh_link field.
4815         (Output_data_got::Got_entry::write): Use PLT offset if
4816         appropriate.
4817         (Output_data_got::add_global_plt): New function.
4818         (Output_data_got::add_local_plt): New function.
4819         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4820         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4821         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4822         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4823         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4824         IFUNC conditional.
4825         * testsuite/ifunc-sel.h: New file.
4826         * testsuite/ifuncmain1.c: New file.
4827         * testsuite/ifuncmain1vis.c: New file.
4828         * testsuite/ifuncmod1.c: New file.
4829         * testsuite/ifuncdep2.c: New file.
4830         * testsuite/ifuncmain2.c: New file.
4831         * testsuite/ifuncmain3.c: New file.
4832         * testsuite/ifuncmod3.c: New file.
4833         * testsuite/ifuncmain4.c: New file.
4834         * testsuite/ifuncmain5.c: New file.
4835         * testsuite/ifuncmod5.c: New file.
4836         * testsuite/ifuncmain6pie.c: New file.
4837         * testsuite/ifuncmod6.c: New file.
4838         * testsuite/ifuncmain7.c: New file.
4839         * configure, testsuite/Makefile.in: Rebuild.
4840
4841 2010-08-18  Ian Lance Taylor  <iant@google.com>
4842
4843         * incremental.cc
4844         (Output_section_incremental_inputs::write_input_files): Add cast
4845         to avoid signed/unsigned comparison warning.
4846         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4847
4848 2010-08-12  Cary Coutant  <ccoutant@google.com>
4849
4850         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4851
4852 2010-08-13  Ian Lance Taylor  <iant@google.com>
4853
4854         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4855
4856 2010-08-12  Cary Coutant  <ccoutant@google.com>
4857             Doug Kwan  <dougkwan@google.com>
4858
4859         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4860         defintion overrides non-weak undef, remember that the original undef
4861         is not weak.
4862         * symtab.cc (Symbol_table::sized_write_global): For undef without
4863         an original weak binding, set binding to global in output.
4864         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4865         * testsuite/Makefile.in: Regenerate.
4866         * testsuite/strong_ref_weak_def.sh: New file.
4867         * testsuite/strong_ref_weak_def_1.c: Ditto.
4868         * testsuite/strong_ref_weak_def_2.c: Ditto.
4869
4870 2010-08-12  Cary Coutant  <ccoutant@google.com>
4871
4872         * testsuite/incremental_test.sh: Rewrite.
4873         * testsuite/incremental_test_1.c: Rewrite.
4874         * testsuite/incremental_test_2.c: Rewrite.
4875
4876 2010-08-12  Cary Coutant  <ccoutant@google.com>
4877
4878         * arm.cc (Target_arm::got_size): Add const.
4879         (Target_arm::got_entry_count): New function.
4880         (Target_arm::plt_entry_count): New function.
4881         (Target_arm::first_plt_entry_offset): New function.
4882         (Target_arm::plt_entry_size): New function.
4883         (Output_data_plt_arm::entry_count): New function.
4884         (Output_data_plt_arm::first_plt_entry_offset): New function.
4885         (Output_data_plt_arm::get_plt_entry_size): New function.
4886         * i386.cc (Target_i386::got_size): Add const.
4887         (Target_i386::got_entry_count): New function.
4888         (Target_i386::plt_entry_count): New function.
4889         (Target_i386::first_plt_entry_offset): New function.
4890         (Target_i386::plt_entry_size): New function.
4891         (Output_data_plt_i386::entry_count): New function.
4892         (Output_data_plt_i386::first_plt_entry_offset): New function.
4893         (Output_data_plt_i386::get_plt_entry_size): New function.
4894         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4895         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4896         * incremental.cc: Include target.h.
4897         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4898         parameter.  Adjust all callers.  Find incremental_got_plt section.
4899         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4900         section.
4901         (Output_section_incremental_inputs::set_final_data_size): Calculate
4902         size of incremental_got_plt section.
4903         (Output_section_incremental_inputs::do_write): Write the
4904         incremental_got_plt section.
4905         (Got_plt_view_info): New struct.
4906         (Local_got_offset_visitor): New class.
4907         (Global_got_offset_visitor): New class.
4908         (Global_symbol_visitor_got_plt): New class.
4909         (Output_section_incremental_inputs::write_got_plt): New function.
4910         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4911         Add parameter.  Adjust all callers.
4912         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4913         (Incremental_inputs::got_plt_section): New function.
4914         (Incremental_inputs::got_plt_section_): New data member.
4915         (Incremental_got_plt_reader): New class.
4916         * layout.cc (Layout::create_incremental_info_sections): Add the
4917         incremental_got_plt section.
4918         * object.h (Got_offset_list::get_list): New function.
4919         (Got offset_list::for_all_got_offsets): New function.
4920         (Sized_relobj::local_got_offset_list): New function.
4921         * powerpc.cc (Target_powerpc::got_size): Add const.
4922         (Target_powerpc::got_entry_count): New function.
4923         (Target_powerpc::plt_entry_count): New function.
4924         (Target_powerpc::first_plt_entry_offset): New function.
4925         (Target_powerpc::plt_entry_size): New function.
4926         (Output_data_plt_powerpc::entry_count): New function.
4927         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4928         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4929         * sparc.cc (Target_sparc::got_size): Add const.
4930         (Target_sparc::got_entry_count): New function.
4931         (Target_sparc::plt_entry_count): New function.
4932         (Target_sparc::first_plt_entry_offset): New function.
4933         (Target_sparc::plt_entry_size): New function.
4934         (Output_data_plt_sparc::entry_count): New function.
4935         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4936         (Output_data_plt_sparc::get_plt_entry_size): New function.
4937         * symtab.h (Symbol::got_offset_list): New function.
4938         (Symbol_table::for_all_symbols): New function.
4939         * target.h (Sized_target::got_entry_count): New function.
4940         (Sized_target::plt_entry_count): New function.
4941         (Sized_target::plt_entry_size): New function.
4942         * x86_64.cc (Target_x86_64::got_size): Add const.
4943         (Target_x86_64::got_entry_count): New function.
4944         (Target_x86_64::plt_entry_count): New function.
4945         (Target_x86_64::first_plt_entry_offset): New function.
4946         (Target_x86_64::plt_entry_size): New function.
4947         (Output_data_plt_x86_64::entry_count): New function.
4948         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4949         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4950
4951 2010-08-12  Cary Coutant  <ccoutant@google.com>
4952
4953         * archive.cc: Include incremental.h.
4954         (Archive::Archive): Initialize incremental_info_.
4955         (Archive::include_member): Record archive members in incremental info.
4956         (Add_archive_symbols::run): Record begin and end of an archive in
4957         incremental info.
4958         (Lib_group::include_member): Record objects in incremental info.
4959         * archive.h (Incremental_archive_entry): Forward declaration.
4960         (Archive::set_incremental_info): New member function.
4961         (Archive::incremental_info): New member function.
4962         (Archive::Unused_symbol_iterator): New class.
4963         (Archive::unused_symbols_begin): New member function.
4964         (Archive::unused_symbols_end): New member function.
4965         (Archive::incremental_info_): New data member.
4966         * incremental-dump.cc (find_input_containing_global): New function.
4967         (dump_incremental_inputs): Dump new incremental info sections.
4968         * incremental.cc: Include symtab.h.
4969         (Output_section_incremental_inputs): New class.
4970         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4971         new incremental info sections.
4972         (Sized_incremental_binary::do_check_inputs): Likewise.
4973         (Incremental_inputs::report_archive): Remove.
4974         (Incremental_inputs::report_archive_begin): New function.
4975         (Incremental_inputs::report_archive_end): New function.
4976         (Incremental_inputs::report_object): New function.
4977         (Incremental_inputs::finalize_inputs): Remove.
4978         (Incremental_inputs::report_input_section): New function.
4979         (Incremental_inputs::report_script): Rewrite.
4980         (Incremental_inputs::finalize): Do nothing but finalize string table.
4981         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4982         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4983         (Incremental_inputs::create_data_sections): New function.
4984         (Incremental_inputs::relocs_entsize): New function.
4985         (Output_section_incremental_inputs::set_final_data_size): New function.
4986         (Output_section_incremental_inputs::do_write): New function.
4987         (Output_section_incremental_inputs::write_header): New function.
4988         (Output_section_incremental_inputs::write_input_files): New function.
4989         (Output_section_incremental_inputs::write_info_blocks): New function.
4990         (Output_section_incremental_inputs::write_symtab): New function.
4991         * incremental.h (Incremental_script_entry): Forward declaration.
4992         (Incremental_object_entry): Forward declaration.
4993         (Incremental_archive_entry): Forward declaration.
4994         (Incremental_inputs): Forward declaration.
4995         (Incremental_inputs_header_data): Remove.
4996         (Incremental_inputs_header): Remove.
4997         (Incremental_inputs_header_write): Remove.
4998         (Incremental_inputs_entry_data): Remove.
4999         (Incremental_inputs_entry): Remove.
5000         (Incremental_inputs_entry_write): Remove.
5001         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5002         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5003         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5004         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5005         Likewise.
5006         (Incremental_input_entry): New class.
5007         (Incremental_script_entry): New class.
5008         (Incremental_object_entry): New class.
5009         (Incremental_archive_entry): New class.
5010         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5011         (Incremental_inputs::report_inputs): Remove.
5012         (Incremental_inputs::report_archive): Remove.
5013         (Incremental_inputs::report_archive_begin): New function.
5014         (Incremental_inputs::report_archive_end): New function.
5015         (Incremental_inputs::report_object): Change prototype.
5016         (Incremental_inputs::report_input_section): New function.
5017         (Incremental_inputs::report_script): Change prototype.
5018         (Incremental_inputs::get_reloc_count): New function.
5019         (Incremental_inputs::set_reloc_count): New function.
5020         (Incremental_inputs::create_data_sections): New function.
5021         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5022         (Incremental_inputs::inputs_section): New function.
5023         (Incremental_inputs::symtab_section): New function.
5024         (Incremental_inputs::relocs_section): New function.
5025         (Incremental_inputs::get_stringpool): Add const.
5026         (Incremental_inputs::command_line): Add const.
5027         (Incremental_inputs::inputs): Remove.
5028         (Incremental_inputs::command_line_key): New function.
5029         (Incremental_inputs::input_file_count): New function.
5030         (Incremental_inputs::input_files): New function.
5031         (Incremental_inputs::relocs_entsize): New function.
5032         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5033         (Incremental_inputs::finalize_inputs): Remove.
5034         (Incremental_inputs::Input_info): Remove.
5035         (Incremental_inputs::lock_): Remove.
5036         (Incremental_inputs::inputs_): Change type.
5037         (Incremental_inputs::inputs_map_): Remove.
5038         (Incremental_inputs::current_object_entry_): New data member.
5039         (Incremental_inputs::inputs_section_): New data member.
5040         (Incremental_inputs::symtab_section_): New data member.
5041         (Incremental_inputs::relocs_section_): New data member.
5042         (Incremental_inputs::reloc_count_): New data member.
5043         (Incremental_inputs_reader): New class.
5044         (Incremental_symtab_reader): New class.
5045         (Incremental_relocs_reader): New class.
5046         * layout.cc (Layout::finalize): Move finalization of incremental info
5047         and creation of incremental info sections to follow finalization of
5048         symbol table.  Set offsets for postprocessing sections.
5049         (Layout::create_incremental_info_sections): Call
5050         Incremental_inputs::create_data_sections.  Add incremental symtab
5051         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5052         sections to layout after input sections.
5053         * layout.h (struct Timespec): Forward declaration.
5054         (Layout::incremental_inputs): Add const.
5055         (Layout::create_incremental_info_sections): Add parameter.
5056         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5057         * object.cc: Include incremental.h.
5058         (Relobj::finalize_incremental_relocs): New function.
5059         (Sized_relobj::do_layout): Record input sections in incremental info.
5060         * object.h (Object::output_section): New function.
5061         (Object::output_section_offset): Moved from Relobj.
5062         (Object::get_incremental_reloc_base): New function.
5063         (Object::get_incremental_reloc_count): New function.
5064         (Object::do_output_section): New function.
5065         (Object::do_output_section_offset): Moved from Relobj.
5066         (Object::do_get_incremental_reloc_base): New function.
5067         (Object::do_get_incremental_reloc_count): New function.
5068         (Object::Object): Initialize new data members.
5069         (Relobj::output_section): Renamed do_output_section and moved to
5070         protected.
5071         (Relobj::output_section_offset): Moved to Object.
5072         (Relobj::do_get_incremental_reloc_base): New function.
5073         (Relobj::do_get_incremental_reloc_count): New function.
5074         (Relobj::allocate_incremental_reloc_counts): New function.
5075         (Relobj::count_incremental_reloc): New function.
5076         (Relobj::finalize_incremental_relocs): New function.
5077         (Relobj::next_incremental_reloc_index): New function.
5078         (Relobj::reloc_counts_): New data member.
5079         (Relobj::reloc_bases_): New data member.
5080         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5081         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5082         (Sized_relobj::incremental_relocs_scan): New function.
5083         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5084         (Sized_relobj::incremental_relocs_write): New function.
5085         (Sized_relobj::incremental_relocs_write_reltype): New function.
5086         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5087         incremental link.
5088         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5089         archives and object files elsewhere.
5090         (Add_symbols::run): Report object files here.
5091         (Finish_group::run): Report end of archive at end of group.
5092         * reloc.cc: Include layout.h, incremental.h.
5093         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5094         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5095         (Sized_relobj::incremental_relocs_scan): New function.
5096         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5097         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5098         (Sized_relobj::incremental_relocs_write): New function.
5099         (Sized_relobj::incremental_relocs_write_reltype): New function.
5100         * script.cc (read_input_script): Rewrite test for incremental link.
5101         Change call to Incremental_inputs::report_script.
5102         * symtab.h (Symbol_table::first_global_index): New function.
5103         (Symbol_table::output_count): New function.
5104
5105 2010-08-12  Doug Kwan  <dougkwan@google.com>
5106
5107         * arm.cc (Target_arm::merge_object_attributes): Check command line
5108         options --no-wchar-size-warning and --no-enum-size-warning.
5109         * options.h (General_options): Add ld-compatible options
5110         --no-enum-size-warning and --no-wchar-size-warning.
5111
5112 2010-08-04  Ian Lance Taylor  <iant@google.com>
5113
5114         * x86_64.cc (Target_x86_64::Scan::local): Use
5115         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5116         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5117         (Target_x86_64::Scan::global): Likewise.
5118         (Target_x86_64::Relocate::relocate): Likewise.
5119         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5120         Likewise.
5121
5122 2010-08-03  Cary Coutant  <ccoutant@google.com>
5123
5124         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5125         to reserve space in merged_strings vector. Keep total input size
5126         for stats.
5127         (Output_merge_string::do_print_merge_stats): Print total input size.
5128         * merge.h (Output_merge_string): Add input_size_ field.
5129         * stringpool.cc (Stringpool_template::string_length): Move
5130         implementations out of Stringpool_template class and place in
5131         stringpool.h.
5132         * stringpool.h (string_length): Move out of Stringpool_template.
5133
5134 2010-08-03  Ian Lance Taylor  <iant@google.com>
5135
5136         PR 11712
5137         * layout.cc (relaxation_loop_body): If address of load segment is
5138         set, adjust address to include headers if possible.
5139
5140 2010-08-03  Ian Lance Taylor  <iant@google.com>
5141
5142         * version.cc (version_string): Bump to 1.10.
5143
5144 2010-08-03  Ian Lance Taylor  <iant@google.com>
5145
5146         PR 11805
5147         * layout.h (enum Output_section_order): Define.
5148         (class Layout): Update declarations.
5149         * layout.cc (Layout::get_output_section): Add order parameter.
5150         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5151         is_first_non_relro parameters.  Change all callers.
5152         (Layout::choose_output_section): Likewise.
5153         (Layout::add_output_section_data): Likewise.
5154         (Layout::make_output_section): Likewise.  Set order.
5155         (Layout::default_section_order): New function.
5156         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5157         * output.cc (Output_section::Output_section): Initialize order_.
5158         Don't initialize deleted fields.
5159         (Output_segment::Output_segment): Don't initialize deleted
5160         fields.
5161         (Output_segment::add_output_section_to_load): New function
5162         replacing add_output_section.  Change all callers to call this or
5163         add_output_section_to_nonload.
5164         (Output_segment::add_output_section_to_nonload): New function.
5165         (Output_segment::remove_output_section): Rewrite.
5166         (Output_segment::add_initial_output_data): Likewise.
5167         (Output_segment::has_any_data_sections): Likewise.
5168         (Output_segment::is_first_section_relro): Likewise.
5169         (Output_segment::maximum_alignment): Likewise.
5170         (Output_segment::has_dynamic_reloc): New function replacing
5171         dynamic_reloc_count.  Change all callers.
5172         (Output_segment::has_dynamic_reloc_list): New function replacing
5173         dynamic_reloc_count_list.  Change all callers.
5174         (Output_segment::set_section_addresses): Rewrite.
5175         (Output_segment::set_offset): Rewrite.
5176         (Output_segment::find_first_and_last_list): Remove.
5177         (Output_segment::set_tls_offsets): Rewrite.
5178         (Output_segment::first_section_load_address): Likewise.
5179         (Output_segment::output_section_count): Likewise.
5180         (Output_segment::section_with_lowest_load_address): Likewise.
5181         (Output_segment::write_section_headers): Likewise.
5182         (Output_segment::print_sections_to_map): Likewise.
5183         * output.h (class Output_data): Remove dynamic_reloc_count_
5184         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5185         (Output_data::add_dynamic_reloc): Rewrite.
5186         (Output_data::has_dynamic_reloc): New function.
5187         (Output_data::dynamic_reloc_count): Remove.
5188         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5189         is_last_relro_, is_first_non_relro_, is_interp_,
5190         is_dynamic_linker_section_ fields.  Add order and set_order
5191         functions.  Remove is_relro_local, set_is_relro_local,
5192         is_last_relro, set_is_last_relro, is_first_non_relro,
5193         set_is_first_non_relro functions, is_interp, set_is_interp,
5194         is_dynamic_linker_section, and set_is_dynamic_linker_section
5195         functions.
5196         (class Output_segment): Change Output_data_list from std::list to
5197         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5198         output_bss_ fields.  Update declarations.
5199
5200 2010-08-02  Ian Lance Taylor  <iant@google.com>
5201
5202         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5203         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5204         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5205
5206 2010-08-02  Ian Lance Taylor  <iant@google.com>
5207
5208         PR 11855
5209         * script.cc (Script_options::Script_options): Initialize
5210         symbol_definitions_ and symbol_references_.
5211         (Script_options::add_symbol_assignment): Update
5212         symbol_definitions_ and symbol_references_.
5213         (Script_options::add_symbol_reference): New function.
5214         (script_symbol): New function.
5215         * script.h (class Script_options): Add symbol_definitions_ and
5216         symbol_references_ fields.
5217         (Script_options::referenced_const_iterator): New type.
5218         (Script_options::referenced_begin): New function.
5219         (Script_options::referenced_end): New function.
5220         (Script_options::is_referenced): New function.
5221         (Script_options::any_unreferenced): New function.
5222         * script-c.h (script_symbol): Declare.
5223         * yyscript.y (exp): Call script_symbol.
5224         * symtab.cc: Include "script.h".
5225         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5226         Change all callers.  Check symbols referenced by scripts.
5227         (Symbol_table::add_undefined_symbols_from_command_line): Add
5228         layout parameter.  Change all callers.
5229         (Symbol_table::do_add_undefined_symbols_from_command_line):
5230         Likewise.  Break out loop body.  Check symbols referenced by
5231         scripts.
5232         (Symbol_table::add_undefined_symbol_from_command_line): New
5233         function broken out of
5234         do_add_undefined_symbols_from_command_line.
5235         * symtab.h (class Symbol_table): Update declarations.
5236         * archive.cc: Include "layout.h".
5237         (Archive::should_include_member): Add layout parameter.  Change
5238         all callers.  Check for symbol mentioned in expression.
5239         * archive.h (class Archive): Update declaration.
5240         * object.cc (Sized_relobj::do_should_include_member): Add layout
5241         parameter.
5242         * object.h (Object::should_include_member): Add layout parameter.
5243         Change all callers.
5244         (Object::do_should_include_member): Add layout parameter.
5245         (class Sized_relobj): Update declaration.
5246         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5247         parameter.
5248         * dynobj.h (class Sized_dynobj): Update declaration.
5249         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5250         layout parameter.
5251         * plugin.h (class Sized_pluginobj): Update declaration.
5252
5253 2010-08-02  Ian Lance Taylor  <iant@google.com>
5254
5255         PR 11866
5256         * output.cc (Output_segment::set_offset): Search for the first and
5257         last sections rather than assuming that the list is in order.
5258         (Output_segment::find_first_and_last_list): New function.
5259         * output.h (class Output_segment): Update declarations.
5260         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5261         (relro_strip_test_SOURCES): New variable.
5262         (relro_strip_test_DEPENDENCIES): New variable.
5263         (relro_strip_test_LDFLAGS): New variable.
5264         (relro_strip_test_LDADD): New variable.
5265         (relro_strip_test.so): New target.
5266
5267 2010-08-02  Ian Lance Taylor  <iant@google.com>
5268
5269         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5270         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5271         (Target_i386::got_tlsdesc_section): New function.
5272         (Target_i386::got_section): Create space for GOT entries for
5273         TLSDESC relocations.
5274         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5275         R_386_TLS_GOTDESC.
5276         (Target_i386::Scan::global): Likewise.
5277         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5278         using TLSDESC GOT.
5279         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5280         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5281         (Target_x86_64::got_tlsdesc_section): New function.
5282         (Target_x86_64::got_section): Create space for GOT entries for
5283         TLSDESC relocations.
5284         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5285         R_386_TLS_GOTDESC.
5286         (Target_x86_64::Scan::global): Likewise.
5287         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5288         using TLSDESC GOT.
5289
5290 2010-08-02  Ian Lance Taylor  <iant@google.com>
5291
5292         * testsuite/final_layout.sh: Use dc to convert from hex to
5293         decimal.
5294
5295 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5296
5297         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5298         paramter to the call to gold::gc_process_relocs.
5299         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5300         paramter to the call to gold::gc_process_relocs.
5301         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5302         parameter to the call to gold::gc_process_relocs.
5303         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5304         template parameter to the call to gold::gc_process_relocs.
5305         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5306         paramter to the call to gold::gc_process_relocs.
5307         * gc.h (get_embedded_addend_size): New function.
5308         (gc_process_relocs): Save the size of the reloc for use by ICF.
5309         * icf.cc (get_section_contents): Get the addend from the text section
5310         for SHT_REL relocation sections.
5311         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5312         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5313         * int_encoding.h (read_from_pointer): New overloaded function.
5314         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5315         * testsuite/icf_sht_rel_addend_test.sh: New file.
5316         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5317         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5318
5319 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5320
5321         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5322         * Makefile.in: Regenerate.
5323         * testsuite/Makefile.in: Regenerate.
5324
5325 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5326
5327         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5328         * gold/testsuite/debug_msg.cc: Likewise.
5329         * gold/testsuite/odr_violation1.cc
5330         * gold/testsuite/odr_violation2.cc
5331
5332 2010-07-21  Cary Coutant  <ccoutant@google.com>
5333
5334         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5335         string, and length fields.
5336         (Output_merge_string::Merged_strings_list): New type.
5337         (Output_merge_string::Merged_strings_lists): New typedef.
5338         (Output_merge_string): Replace merged_strings_ with
5339         merged_strings_lists_.
5340         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5341         Merged_strings_list per input object and section.  Don't store pointer
5342         to the string.  Don't store length with each merged string entry.
5343         (Output_merge_string::finalize_merged_data): Loop over list of merged
5344         strings lists.  Recompute length of each merged string.
5345
5346 2010-07-15  Cary Coutant  <ccoutant@google.com>
5347
5348         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5349         here.
5350
5351 2010-07-14  Ian Lance Taylor  <iant@google.com>
5352
5353         * descriptors.cc (Descriptors::open): Report correct name in error
5354         message.
5355
5356 2010-07-13  Doug Kwan  <dougkwan@google.com>
5357
5358         * arm.cc (Arm_input_section::Arm_input_section): For a
5359         SHT_ARM_EXIDX section, always keeps the input sections.
5360         (Arm_input_section::set_exidx_section_link): New method.
5361         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5362         has_errors_ to false.
5363         (Arm_exidx_input_section::has_errors,
5364         Arm_exidx_input_section::set_has_errors): New methods.
5365         (Arm_exidx_input_section::has_errors_): New data member.
5366         (Arm_relobj::get_exidx_shndx_list): New method.
5367         (Arm_output_section::append_text_sections_to_list): Do not skip
5368         section without SHF_EXECINSTR.
5369         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5370         errors.
5371         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5372         section header.  Make error messages more verbose.  Check for
5373         a non-executable section linked to an EXIDX section.
5374         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5375         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5376         check that there is no deferred EXIDX section if we exit early.
5377         Instead of not making an EXIDX section in case of an error, make one
5378         and set the has_errors flag of it.
5379         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5380         in a relocatable link.
5381         (Target_arm::do_relax): Look for the EXIDX output section instead of
5382         assuming that it is called .ARM.exidx.
5383         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5384         section list.  Do not check for SHF_EXECINSTR section flags but
5385         skip any input section with errors.
5386         * output.cc (Output_section::Output_section): Initialize
5387         always_keeps_input_sections_ to false.
5388         (Output_section::add_input_section): Check for
5389         always_keeps_input_sections_.
5390         *  output.h (Output_section::always_keeps_input_sections,
5391         Output_section::set_always_keeps_input_sections): New methods.
5392         (Output_section::always_keeps_input_sections): New data member.
5393
5394 2010-07-13  Rafael Espindola  <espindola@google.com>
5395
5396         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5397         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5398
5399 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5400             Ian Lance Taylor  <iant@google.com>
5401
5402         * output.h (Output_section_lookup_maps::add_merge_section):
5403         Correct check of whether value was inserted.
5404         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5405         (Output_section_lookup_maps::add_relaxed_input_section):
5406         Likewise.
5407         * arm.cc (Target_arm::got_section): Remove used local os.
5408         * i386.cc (Target_i386::got_section): Likewise.
5409         * x86_64.cc (Target_x86_64::got_section): Likewise.
5410         * sparc.cc (Target_sparc::got_section): Likewise.
5411         (Target_sparc::relocate): Remove unused local have_got_offset.
5412         * powerpc.cc (Target_powerpc::relocate): Likewise.
5413
5414 2010-07-13  Ian Lance Taylor  <iant@google.com>
5415
5416         * compressed_output.cc (zlib_decompress): Fix signature in
5417         !HAVE_ZLIB_H case.
5418
5419         * archive.cc (Archive::include_member): Unlock an external member
5420         of a thin archive.  Don't bother to delete an object we know is
5421         NULL.
5422
5423 2010-07-12  Cary Coutant  <ccoutant@google.com>
5424
5425         * compressed_output.cc (zlib_decompress): New function.
5426         (get_uncompressed_size): New function.
5427         (decompress_input_section): New function.
5428         * compressed_output.h (get_uncompressed_size): New function.
5429         (decompress_input_section): New function.
5430         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5431         Handle compressed debug sections.
5432         * layout.cc (is_compressed_debug_section): New function.
5433         (Layout::output_section_name): Map compressed section names to
5434         canonical names.
5435         * layout.h (is_compressed_debug_section): New function.
5436         (is_debug_info_section): Recognize compressed debug sections.
5437         * merge.cc: Include compressed_output.h.
5438         (Output_merge_data::do_add_input_section): Handle compressed
5439         debug sections.
5440         (Output_merge_string::do_add_input_section): Handle compressed
5441         debug sections.
5442         * object.cc: Include compressed_output.h.
5443         (Sized_relobj::Sized_relobj): Initialize new data members.
5444         (build_compressed_section_map): New function.
5445         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5446         * object.h (Object::section_is_compressed): New method.
5447         (Object::do_section_is_compressed): New method.
5448         (Sized_relobj::Compressed_section_map): New type.
5449         (Sized_relobj::do_section_is_compressed): New method.
5450         (Sized_relobj::compressed_sections_): New data member.
5451         * output.cc (Output_section::add_input_section): Handle compressed
5452         debug sections.
5453         * reloc.cc: Include compressed_output.h.
5454         (Sized_relobj::write_sections): Handle compressed debug sections.
5455
5456 2010-07-08  Cary Coutant  <ccoutant@google.com>
5457
5458         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5459         weak when resolving to a dynamic def.
5460         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5461         for weak undef/dynamic def cases. Adjust callers.
5462         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5463         undef_binding_weak_.
5464         (Symbol_table::sized_write_globals): Adjust symbol binding.
5465         (Symbol_table::sized_write_symbol): Add binding parameter.
5466         * symtab.h (Symbol::set_undef_binding): New method.
5467         (Symbol::is_undef_binding_weak): New method.
5468         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5469         (Symbol_table::should_override): Add new parameter.
5470         (Symbol_table::sized_write_symbol): Add new parameter.
5471
5472         * testsuite/weak_undef_file1.cc: Add new test case.
5473         * testsuite/weak_undef_file2.cc: Fix header comment.
5474         * testsuite/weak_undef_test.cc: Add new test case.
5475
5476 2010-06-29  Doug Kwan  <dougkwan@google.com>
5477
5478         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5479         Initialize USE_SYMBOL_.
5480         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5481         definition.
5482         (Arm_reloc_property::uses_symbol_): New data member declaration.
5483         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5484         uses symbol value and symbol is undefined but not weakly undefined.
5485
5486 2010-06-28  Rafael Espindola  <espindola@google.com>
5487
5488         * plugin.cc (Plugin::load): Use dlerror.
5489
5490 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5491
5492         * symtab.cc (detect_odr_violations): When reporting an ODR
5493         violation, report an object where the symbol is defined.
5494
5495 2010-06-25  Doug Kwan  <dougkwan@google.com>
5496
5497         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5498         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5499         definition.
5500         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5501         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5502         target hook to detect function points.
5503         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5504         * icf.h (Icf::check_section_for_function_pointers): Change type of
5505         parameter SECTION_NAME to const reference to std::string.  Use
5506         target hook to determine if section may have unsafe pointers.
5507         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5508         method definition.
5509
5510 2010-06-21  Rafael Espindola  <espindola@google.com>
5511
5512         * fileread.cc (Input_file::find_fie): New
5513         (Input_file::open): Use Input_file::find_fie.
5514         * fileread.h (Input_file::find_fie): New
5515         * plugin.cc (set_extra_library_path): New.
5516         (Plugin::load): Add set_extra_library_path to the transfer vector.
5517         (Plugin_manager::set_extra_library_path): New.
5518         (Plugin_manager::add_input_file): Use the extra search path if set.
5519         (set_extra_library_path(): New.
5520         * plugin.h (Plugin_manager): Add set_extra_library_path and
5521         extra_search_path_.
5522
5523 2010-06-19  Cary Coutant  <ccoutant@google.com>
5524
5525         * layout.cc (gdb_sections): Add .debug_types.
5526         (lines_only_debug_sections): Likewise.
5527
5528 2010-06-18  Rafael Espindola  <espindola@google.com>
5529
5530         * plugin.cc (add_input_file,add_input_library)
5531         (Plugin_manager::add_input_file): Make filename arguments const.
5532         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5533         const.
5534
5535 2010-06-16  Doug Kwan  <dougkwan@google.com>
5536
5537         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5538         .ARM.attributes section if we have not merged any input
5539         attributes sections.
5540
5541 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5542
5543         * arm.cc: Allow combining objects with no EABI version
5544         information.
5545
5546 2010-06-15  Rafael Espindola  <espindola@google.com>
5547
5548         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5549
5550 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5551
5552         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5553         (struct iovec): Correct !HAVE_READV definition.
5554
5555 2010-06-10  Cary Coutant  <ccoutant@google.com>
5556
5557         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5558         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5559         reloc sections.
5560         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5561
5562         PR 11683
5563         * symtab.h (Symbol::is_placeholder): New member function.
5564         * target-reloc.h (relocate_section): Check for placeholder symbols.
5565
5566         * testsuite/Makefile.am (plugin_test_8): New test.
5567         (plugin_test_9): New test.
5568         * testsuite/Makefile.in: Regenerate.
5569
5570 2010-06-09  Nick Clifton  <nickc@redhat.com>
5571
5572         * yyscript.y (input_list_element): Allow strings prefixed with
5573         the '-' character.  Treat these as libraries.
5574         * script.cc (script_add_library): New function.  Adds a library
5575         specified by "-l<name>" found in an input script.
5576         * script-c.h: Add prototype for script_add_library.
5577
5578 2010-06-07  Doug Kwan  <dougkwan@google.com>
5579
5580         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5581         Restrict stub-group size to be within long conditional branch
5582         range when working around cortex-A8 erratum.
5583
5584 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5585
5586         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5587         #ifdef typo.
5588
5589 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5590
5591         PR gold/11658
5592         * output.cc
5593         (Output_section::Input_section_sort_entry::compare_section_ordering):
5594         Change to return non-zero correctly.
5595         (Output_section::Input_section_sort_section_order_index_compare
5596         ::operator()): Change to fix ambiguity in comparisons.
5597
5598 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5599
5600         * gold.h (is_wildcard_string): New function.
5601         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5602         (Layout::layout_eh_frame): Ditto.
5603         (Layout::find_section_order_index): New method.
5604         (Layout::read_layout_from_file): New method.
5605         * layout.h (Layout::find_section_order_index): New method.
5606         (Layout::read_layout_from_file): New method.
5607         (Layout::input_section_position_): New private member.
5608         (Layout::input_section_glob_): New private member.
5609         * main.cc (main): Call read_layout_from_file here.
5610         * options.h (--section-ordering-file): New option.
5611         * output.cc (Output_section::input_section_order_specified_): New
5612         member.
5613         (Output_section::Output_section): Initialize new member.
5614         (Output_section::add_input_section): Add new parameter.
5615         Keep input sections when --section-ordering-file is used.
5616         (Output_section::set_final_data_size): Sort input sections when
5617         section ordering file is specified.
5618         (Output_section::Input_section_sort_entry): Add new parameter.
5619         Check sorting type.
5620         (Output_section::Input_section_sort_entry::compare_section_ordering):
5621         New method.
5622         (Output_section::Input_section_sort_compare::operator()): Change to
5623         consider section_order_index.
5624         (Output_section::Input_section_sort_init_fini_compare::operator()):
5625         Change to consider section_order_index.
5626         (Output_section::Input_section_sort_section_order_index_compare
5627         ::operator()): New method.
5628         (Output_section::sort_attached_input_sections): Change to sort
5629         according to section order when specified.
5630         (Output_section::add_input_section<32, true>): Add new parameter.
5631         (Output_section::add_input_section<64, true>): Add new parameter.
5632         (Output_section::add_input_section<32, false>): Add new parameter.
5633         (Output_section::add_input_section<64, false>): Add new parameter.
5634         * output.h (Output_section::add_input_section): Add new parameter.
5635         (Output_section::input_section_order_specified): New
5636         method.
5637         (Output_section::set_input_section_order_specified): New method.
5638         (Input_section::Input_section): Initialize section_order_index_.
5639         (Input_section::section_order_index): New method.
5640         (Input_section::set_section_order_index): New method.
5641         (Input_section::section_order_index_): New member.
5642         (Input_section::Input_section_sort_section_order_index_compare): New
5643         struct.
5644         (Output_section::input_section_order_specified_): New member.
5645         * script-sections.cc (is_wildcard_string): Delete and move modified
5646         method to gold.h.
5647         (Output_section_element_input::Output_section_element_input): Modify
5648         call to is_wildcard_string.
5649         (Output_section_element_input::Input_section_pattern
5650         ::Input_section_pattern): Ditto.
5651         (Output_section_element_input::Output_section_element_input): Ditto.
5652         * testsuite/Makefile.am (final_layout): New test case.
5653         * testsuite/Makefile.in: Regenerate.
5654         * testsuite/final_layout.cc: New file.
5655         * testsuite/final_layout.sh: New file.
5656
5657 2010-06-01  Rafael Espindola  <espindola@google.com>
5658
5659         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5660
5661 2010-06-01  Rafael Espindola  <espindola@google.com>
5662
5663         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5664         visibility of symbols.
5665
5666 2010-05-27  Doug Kwan  <dougkwan@google.com>
5667
5668         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5669         from start of output section instead of address for a local symbol
5670         in a merged or relaxed section when doing a relocatable link.
5671
5672 2010-05-26  Rafael Espindola  <espindola@google.com>
5673
5674         PR 11604
5675         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5676         adding sections the garbage collector removed.
5677         * gold/testsuite/Makefile.am: Add test.
5678         * gold/testsuite/Makefile.in: Regenerate.
5679         * gold/testsuite/plugin_test_7.sh: New.
5680         * gold/testsuite/plugin_test_7_1.c: New.
5681         * gold/testsuite/plugin_test_7_2.c: New.
5682
5683 2010-05-26  Rafael Espindola  <espindola@google.com>
5684
5685         * script-sections.cc (Output_section_definition::set_section_addresses):
5686         Check for --section-start.
5687
5688 2010-05-26  Doug Kwan  <dougkwan@google.com>
5689
5690         * arm.cc (Arm_scan_relocatable_relocs): New class.
5691         (Target_arm::relocate_special_relocatable): New method.
5692         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5693         (Arm_relocate_functions::thumb_branch_common): Same.
5694         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5695         instead of Default_scan_relocatable_relocs.
5696         * target-reloc.h (relocate_for_relocatable): Let target handle
5697         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5698         * target.h (Sized_target::relocate_special_relocatable): New method.
5699
5700 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5701
5702         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5703
5704 2010-05-23  Doug Kwan  <dougkwan@google.com>
5705
5706         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5707         instead of a cast.
5708         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5709         with a direct branch, not a conditional branch, to a stub.
5710         * merge.cc (Output_merge_base::record_input_section): New method
5711         defintion.
5712         (Output_merge_data::do_add_input_section): Record input section if
5713         keeps-input-sections flag is set.
5714         (Output_merge_string::do_add_input_section): Ditto.
5715         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5716         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5717         INPUT_SECTIONS_.
5718         (Output_merge_base::keeps_input_sections,
5719         Output_merge_base::set_keeps_input_sections,
5720         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5721         method definitions.
5722         (Output_merge_base::Input_sections): New type declaration.
5723         (Output_merge_base::input_sections_begin,
5724         Output_merge_base::input_sections_end,
5725         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5726         (Output_merge_base::bool keeps_input_sections_,
5727         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5728         Output_merge_base::input_sections_): New data members.
5729         (Output_merge_data::do_set_keeps_input_sections): New method
5730         defintion.
5731         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5732         * output.cc (Output_section::Input_section::relobj): Move method
5733         defintion from class declaration to here and handle merge sections.
5734         (Output_section::Input_section::shndx): Ditto.
5735         (Output_section::Output_section): Remove initializations of removed
5736         data members and initialize new data member LOOKUP_MAPS_.
5737         (Output_section::add_input_section): Set keeps-input-sections flag
5738         for a newly created merge output section as appropriate.  Adjust code
5739         to use Output_section_lookup_maps class.
5740         (Output_section::add_relaxed_input_section): Adjst code for lookup
5741         maps code refactoring.
5742         (Output_section::add_merge_input_section): Add a new parameter
5743         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5744         class.  If adding input section to a newly created merge output
5745         section fails, remove the new merge section.
5746         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5747         Adjust code for use of the Output_section_lookup_maps class.
5748         (Output_section::find_merge_section): Ditto.
5749         (Output_section::build_lookup_maps): New method defintion.
5750         (Output_section::find_relaxed_input_section): Adjust code to use
5751         Output_section_lookup_maps class.
5752         (Output_section::get_input_sections): Export merge sections.  Adjust
5753         code to use Output_section_lookup_maps class.
5754         (Output_section:::add_script_input_section): Adjust code to use
5755         Output_section_lookup_maps class.  Update lookup maps for merge
5756         sections also.
5757         (Output_section::discard_states): Use Output_section_lookup_maps.
5758         (Output_section::restore_states): Same.
5759         * output.h (Merge_section_properties): Move class defintion out of
5760         Output_section.
5761         (Output_section_lookup_maps): New class.
5762         (Output_section::Input_section::is_merge_section): New method
5763         defintion.
5764         (Output_section::Input_section::relobj): Move defintion out of class
5765         defintion.  Declare method only.
5766         (Output_section::Input_section::shndx): Ditto.
5767         (Output_section::Input_section::output_merge_base): New method defintion.
5768         (Output_section::Input_section::u2_.pomb): New union field.
5769         (Output_section::Merge_section_by_properties_map,
5770         Output_section::Output_section_data_by_input_section_map,
5771         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5772         Remove types.
5773         (Output_section::add_merge_input_section): Add new parameter
5774         KEEPS_INPUT_SECTIONS.
5775         (Output_section::build_lookup_maps): New method declaration.
5776         (Output_section::merge_section_map_,
5777         Output_section::merge_section_by_properties_map_,
5778         Output_section::relaxed_input_section_map_,
5779         Output_section::is_relaxed_input_section_map_valid_): Remove data
5780         members.
5781         (Output_section::lookup_maps_): New data member.
5782
5783 2010-05-21  Doug Kwan  <dougkwan@google.com>
5784
5785         PR gold/11619
5786         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5787         avoid a compilation error.
5788
5789 2010-05-19  Rafael Espindola  <espindola@google.com>
5790
5791         * script-sections.cc (Output_section_definition::allocate_to_segment):
5792         Update the phdrs_list even when the output section is NULL.
5793         * testsuite/Makefile.am: Add test.
5794         * testsuite/Makefile.in: Regenerate.
5795         * testsuite/script_test_9.cc: New.
5796         * testsuite/script_test_9.sh: New.
5797         * testsuite/script_test_9.t: New.
5798
5799 2010-05-19  Doug Kwan  <dougkwan@google.com>
5800
5801         * arm.cc (Arm_input_section::original_size): New method.
5802         (Arm_input_section::do_addralign): Add a cast.
5803         (Arm_input_section::do_output_offset): Remove static cast.
5804         (Arm_input_section::original_addralign,
5805          Arm_input_section::original_size_): Change type to uint32_t.
5806         (Arm_input_section::init): Add safe casts for section alignment
5807         and size.
5808         (Arm_input_section::set_final_data_size): Do not set address and
5809         offset of stub table.
5810         (Arm_output_section::fix_exidx_coverage): Change use of of
5811         Output_section::Simple_input_section to that of
5812         Output_section::Input_section.
5813         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5814         except for the first pass.
5815         * output.cc (Output_section::get_input_sections): Change type of
5816         input_sections to std::list<Input_section>.
5817         (Output_section::add_script_input_section): Rename from
5818         Output_section::add_simple_input_section.  Change type of SIS
5819         parameter from Simple_input_section to Input_section.
5820         * output.h (Output_section::Simple_input_section): Remove class.
5821         (Output_section::Input_section): Change class visibility to public.
5822         (Output_section::Input_section::addralign): Use stored alignments
5823         for special input sections if set.
5824         (Output_section::Input_section::set_addralign): New method.
5825         (Output_section::get_input_sections): Change parameter type from
5826         list of Simple_input_section to list of Input_section.
5827         (Output_section::add_script_input_section): Rename from
5828         Output_section::add_simple_input_section. Change first parameter's
5829         type from Simple_input_section to Input_section and remove the
5830         second and third parameters.
5831         * script-sections.cc (Input_section::Input_section_list): Change
5832         type to list of Output_section::Input_section/
5833         (Input_section_info::Input_section_info): Change parameter type of
5834         INPUT_SECTION to Output_section::Input_section.
5835         (Input_section_info::input_section): Change return type.
5836         (Input_section_info::input_section_): Change type to
5837         Output_section::Input_section.
5838         (Output_section_element_input::set_section_addresses): Adjust code
5839         to use Output_section::Input_section instead of
5840         Output_section::Simple_input_section.  Adjust code for renaming
5841         of Output_section::add_simple_input_section.
5842         (Orphan_output_section::set_section_addresses): Ditto.
5843
5844 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5845
5846         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5847         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5848
5849 2010-05-18  Rafael Espindola  <espindola@google.com>
5850
5851         * options.cc (General_options::finalize): Handle -nostdlib.
5852         * options.h (nostdlib): New option.
5853         * script.cc (script_add_search_dir): Handle -nostdlib.
5854
5855 2010-05-12  Doug Kwan  <dougkwan@google.com>
5856
5857         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5858         attributes section only if there no attributes section after merging.
5859         (Target_arm::merge_object_attributes): Move value of
5860         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5861         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5862         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5863         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5864         and arm_attr_merge_7.stdout.
5865         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5866         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5867         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5868         arm_attr_merge_7b.o): New rules.
5869         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5870         arm_attr_merge_7
5871         * testsuite/Makefile.in: Regenerate.
5872         * testsuite/arm_attr_merge.sh: New file.
5873         * testsuite/arm_attr_merge_[67][ab].s: Same.
5874
5875 2010-05-05  Nick Clifton  <nickc@redhat.com>
5876
5877         * po/es.po: Updated Spanish translation.
5878
5879 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5880
5881         * Makefile.am (install-exec-local): Properly install gold as
5882         default cross linker.
5883         * Makefile.in: Regenerated.
5884
5885 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5886             Nick Clifton  <nickc@redhat.com>
5887
5888         * configure.ac (install_as_default): Define and set to false
5889         unless --enable-gold or --enable-gold=both/gold has been
5890         specified.
5891         * configure: Regenerate.
5892
5893         * Makefile.am (install-exec-local): Install the executable as
5894         'ld.gold'.  If install_as_default is true then also install it as
5895         'ld'.
5896         * Makefile.in: Regenerated.
5897
5898 2010-04-24  Ian Lance Taylor  <iant@google.com>
5899
5900         * layout.cc (Layout::layout_reloc): In relocatable link don't
5901         combine reloc sections for grouped sections.
5902
5903 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5904
5905         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5906         sections that are not ordinary to icf.
5907         * icf.cc (get_section_contents): Handle relocation pointing to section
5908         with no object or shndx information.
5909         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5910         * testsuite/Makefile.in: Regenerate.
5911         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5912         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5913
5914 2010-04-22  Ian Lance Taylor  <iant@google.com>
5915
5916         * expression.cc (Expression::Expression_eval_info): Add
5917         result_alignment_pointer field.
5918         (Expression::eval_with_dot): Add result_alignment_pointer
5919         parameter.  Change all callers.
5920         (Expression::eval_maybe_dot): Likewise.
5921         (class Binary_expression): Add alignment_pointer parameter to
5922         left_value and right_value.  Change all callers.
5923         (BINARY_EXPRESSION): Set result alignment.
5924         (class Trinary_expression): Add alignment_pointer parameter to
5925         arg2_value and arg3_value.  Change all callers.
5926         (Trinary_cond::value): Set result alignment.
5927         (Max_expression::value, Min_expression::value): Likewise.
5928         (Align_expression::value): Likewise.
5929         * script-sections.cc (class Sections_element): Add dot_alignment
5930         parameter to set_section_addresses virtual function.  Update
5931         instantiations.
5932         (class Output_section_element): Likewise.
5933         (Script_sections::create_segments): Add dot_alignment parameter.
5934         Change all callers.
5935         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5936         (Script_sections::set_phdrs_clause_addresses): Likewise.
5937         * script-sections.h: Update declarations.
5938         * script.h: Update declarations.
5939         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5940         min_p_align.
5941         * testsuite/script_test_3.t: Set large alignment.
5942         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5943         segment has expected alignment.
5944
5945 2010-04-22  Nick Clifton  <nickc@redhat.com>
5946
5947         * po/gold.pot: Updated by the Translation project.
5948         * po/vi.po: Updated Vietnamese translation.
5949
5950 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5951
5952         * testsuite/Makefile.am (check_PROGRAMS): Add
5953         icf_virtual_function_folding_test.
5954         * testsuite/Makefile.in: Regenerated.
5955
5956 2010-04-15  Andrew Haley  <aph@redhat.com>
5957
5958         * options.h (merge_exidx_entries): New option.
5959         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5960         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5961         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5962         (Target_arm::merge_exidx_entries): New function.
5963         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5964         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5965         to Arm_exidx_fixup constructor.
5966         Add new arg, merge_exidx_entries.
5967         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5968         Arm_output_section::fix_exidx_coverage.
5969
5970 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5971
5972         * icf.cc (get_section_contents): Check for preemptible functions.
5973         Ignore addend when appropriate.
5974         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5975         section folded.
5976         (add_from_relobj): Check for section folded.
5977         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5978         * symtab.h (should_add_dynsym_entry): Add new parameter.
5979         * target-reloc.h (scan_relocs): Check for section folded.
5980         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5981         Check reloc types for function pointers in shared objects.
5982         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5983         case.
5984         (icf_preemptible_functions_test): New test case.
5985         (icf_string_merge_test): New test case.
5986         * testsuite.Makefile.in: Regenerate.
5987         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5988         bar_glob.  Refactor code.
5989         * testsuite/icf_preemptible_functions_test.cc: New file.
5990         * testsuite/icf_preemptible_functions_test.sh: New file.
5991         * testsuite/icf_string_merge_test.cc: New file.
5992         * testsuite/icf_string_merge_test.sh: New file.
5993         * testsuite/icf_virtual_function_folding_test.cc: New file.
5994         * testsuite/icf_virtual_function_folding_test.sh: New file.
5995
5996 2010-04-14  Doug Kwan  <dougkwan@google.com>
5997
5998         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5999         for local symbol recounting if we remove a section due to ICF.
6000         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6001         there are no regular objects in input.
6002
6003 2010-04-13  Doug Kwan  <dougkwan@google.com>
6004
6005         * arm.cc (Arm_input_section::set_final_data_size): Compute
6006         accurate final data size instead of using current data size.
6007
6008 2010-04-09  Doug Kwan  <dougkwan@google.com>
6009
6010         * layout.cc (Layout::choose_output_section): Handle script section
6011         types.
6012         (Layout::make_output_section_for_script): Add section type parameter.
6013         Handle script section types.
6014         * layout.h (Layout::make_output_section_for_script): Add section
6015         type parameter.
6016         * output.cc (Output_section::Output_section): Initialize data member
6017         is_noload_.
6018         (Output_section::do_reset_address_and_file_offset): Do not set address
6019         to 0 if section is a NOLOAD section.
6020         * output.h (Output_section::is_noload): New method.
6021         (Output_section::set_is_noload): Ditto.
6022         (Output_section::is_noload_): New data member.
6023         * script-c.h (Script_section_type): New enum type.
6024         (struct Parser_output_section_header): Add new file section_type.
6025         * script-sections.cc (Sections_element::output_section_name): Add
6026         parameter for returning script section type.
6027         (Output_section_definition::output_section_name): Ditto.
6028         (Output_section_definition::section_type)P; New method.
6029         (Output_section_definiton::script_section_type_name): Ditto.
6030         (Output_section_definition::script_section_type_): New data member.
6031         (Output_section_definition::Output_section_definition): Initialize
6032         data member Output_section_definition::script_section_type_.
6033         (Output_section_definition::create_sections): Pass script section type
6034         to Layout::make_output_section_for_script.
6035         (Output_section_definition::output_section_name): Return script
6036         section type to caller.
6037         (Output_section_definition::set_section_address): Do not advance
6038         dot value and load address if section type is NOLOAD.  Set address
6039         of NOLOAD sections regardless of section flags.
6040         (Output_section_definition::print): Print section type if it is
6041         not SCRIPT_SECTION_TYPE_NONE.
6042         (Output_section_definition::section_type): New method.
6043         (Output_section_definition::script_section_type_name): Ditto.
6044         (Script_sections::output_section_name): Add new parameter
6045         PSECTION_TYPE for returning script section type.  Pass it to
6046         section elements.  Handle discard sections.
6047         (Sort_output_sections::operator()): Handle NOLOAD sections.
6048         * script-sections.h (Script_sections::Section_type): New enum type.
6049         (Script_sections::output_section_name): Add a new parameter for
6050         returning script section type.
6051         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6052         INFO and NOLOAD.
6053         * yyscript.y (union): Add new field SECTION_TYPE.
6054         (COPY, DSECT, INFO, NOLOAD): New tokens.
6055         (opt_address_and_section_type): Change type to output_section_header.
6056         (section_type): New non-terminal
6057         (section_header): Handle section type.
6058         (opt_address_and_section_type): Return section type value.
6059
6060 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6061
6062         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6063         * testsuite/plugin_common_test_2.c (foo): Likewise.
6064
6065 2010-04-08  Doug Kwan  <dougkwan@google.com>
6066
6067         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6068         Output_merge_data.
6069         * output.cc (Output_section::add_merge_input_section): Simplify
6070         code and return status of Output_merge_base::add_input_section.
6071         Update merge section map only if Output_merge_base::add_input_section
6072         returns true.
6073
6074 2010-04-07  Doug Kwan  <dougkwan@google.com>
6075
6076         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6077         if section is marked as containing instructions but has no mapping
6078         symbols.
6079         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6080         correct section index.
6081         (Arm_relobj::find_linked_text_section): Ditto.
6082
6083 2010-04-07  Cary Coutant  <ccoutant@google.com>
6084
6085         * archive.cc (include_member): Destroy Read_symbols_data object before
6086         releasing file.
6087         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6088         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6089         (Read_symbols_data::~Read_symbols_data) New destructor.
6090         (Section_relocs::Section_relocs) New constructor.
6091         (Section_relocs::~Section_relocs) New destructor.
6092         (Read_relocs_data::Read_relocs_data) New constructor.
6093         (Read_relocs_data::~Read_relocs_data) New destructor.
6094         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6095         pointers to NULL after deleting.
6096
6097 2010-04-07  Doug Kwan  <dougkwan@google.com>
6098
6099         * arm.cc: Replace "endianity" with "endianness" in comments.
6100         (Arm_exidx_cantunwind): Ditto.
6101         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6102         (Arm_relobj::merge_flags_and_attributes): New method.
6103         (Arm_relobj::merge_flags_and_attributes_): New data member.
6104         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6105         (Arm_relobj::scan_sections_for_stubs): Ditto.
6106         (Arm_relobj::do_read_symbols): Check to see if we really want to
6107         merge processor-specific flags and attributes.  Exit early if
6108         an object is empty except for section names and the undefined symbol.
6109         (Target_arm::do_finalize_sections): Move check for ELF format to
6110         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6111         attributes from a regular object only when we have determined that
6112         it is aapropriate.  Do not create an .ARM.attributes section in
6113         output if there is no regular input object.
6114         (Target_arm::merge_processor_specific_flags): Check
6115         --warn-mismatch before printing any error.
6116         (Target_arm::merge_object_attributes): Ditto.
6117         * gold.cc (queue_middle_tasks): Handle the case in which there is
6118         no regular object in input.
6119         * options.cc (General_options::parse_EB): New method.
6120         (General_options::parse_EL): Same.
6121         (General_options::General_options): Initialize endianness_.
6122         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6123         New options.
6124         (General_options::Endianness): New enum.
6125         (General_options::endianness): New method.
6126         (General_options::endianness_): New data member.
6127         * parameters.cc (Parameters::set_options): Check target endianness.
6128         (Parameters::set_target_once): Ditto.
6129         (Parameters::check_target_endianness): New method.
6130         (parameters_force_valid_target): If either -EL or -EB is specified,
6131         use it to define endianness of default target.
6132         * parameters.h (Parameters::check_target_endianness): New method
6133         declaration.
6134         * target.h (class Target): Change "endianity" to "endianness"
6135         in comments.
6136
6137 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6138
6139         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6140         * configure: Regenerate.
6141         * Makefile.in: Regenerate.
6142         * testsuite/Makefile.in: Regenerate.
6143
6144 2010-04-06  Cary Coutant  <ccoutant@google.com>
6145
6146         gcc PR lto/42757
6147         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6148         prevailing definitions of common symbols.
6149         * testsuite/plugin_test_6.sh: New test case.
6150         * testsuite/plugin_common_test_1.c: New test case.
6151         * testsuite/plugin_common_test_2.c: New test case.
6152         * testsuite/Makefile.am (plugin_test_6): New test case.
6153         * testsuite/Makefile.in: Regenerate.
6154
6155 2010-04-06  Nick Clifton  <nickc@redhat.com>
6156
6157         * po/vi.po: New Vietnamese translation.
6158
6159 2010-03-30  Doug Kwan  <dougkwan@google.com>
6160
6161         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6162
6163 2010-03-25  Doug Kwan  <dougkwan@google.com>
6164
6165         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6166         to avoid a conversion warning on a 32-bit host.
6167
6168 2010-03-24  Ian Lance Taylor  <iant@google.com>
6169
6170         * testsuite/script_test_3.t: Add a TLS segment.
6171         * testsuite/Makefile.am (check_PROGRAMS): Add
6172         tls_phdrs_script_test.
6173         (tls_phdrs_script_test_SOURCES): Define.
6174         (tls_phdrs_script_test_DEPENDENCIES): Define.
6175         (tls_phdrs_script_test_LDFLAGS): Define.
6176         (tls_phdrs_script_test_LDADD): Define.
6177         * testsuite/Makefile.in: Rebuild.
6178
6179 2010-03-23  Cary Coutant  <ccoutant@google.com>
6180
6181         * fileread.cc (find_or_make_view): Fix comment.
6182
6183 2010-03-23  Ian Lance Taylor  <iant@google.com>
6184
6185         * script-sections.cc (class Orphan_section_placement): Define
6186         PLACE_TLS and PLACE_TLS_BSS.
6187         (Orphan_section_placement::Orphan_section_placement): Initialize
6188         new places.
6189         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6190         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6191         (tls_script_test_SOURCES): Define.
6192         (tls_script_test_DEPENDENCIES): Define.
6193         (tls_script_test_LDFLAGS): Define.
6194         (tls_script_test_LDADD): Define.
6195         * testsuite/Makefile.in: Rebuild.
6196
6197 2010-03-22  Doug Kwan  <dougkwan@google.com>
6198
6199         * arm.cc (Arm_relocate_functions::abs8,
6200         Arm_relocate_functions::abs16): Use correct check for overflow
6201         specified in the ARM ELF specs.
6202         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6203         target of a BLX instruction specially.
6204         (Reloc_stub::stub_type_for_reloc): Ditto.
6205         (Relocate::relocate): Use symbolic names instead of numeric relocation
6206         codes to report error.
6207         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6208         workaround.
6209         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6210         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6211         thumb2_blx_out_of_range.stdout
6212         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6213         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6214         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6215         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6216         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6217         thumb2_blx_in_range, thumb2_blx_in_range.o,
6218         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6219         thumb2_blx_out_of_range.o): New rules.
6220         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6221         thumb2_blx_in_range and thumb2_blx_out_of_range.
6222         * testsuite/Makefile.in: Regenerate.
6223         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6224         * testsuite/thumb_blx_in_range.s: New file.
6225         * testsuite/thumb_blx_out_of_range.s: New file.
6226
6227 2010-03-22  Rafael Espindola  <espindola@google.com>
6228
6229         * archive.cc (Should_include): Move to archive.h.
6230         (should_include_member): Make it a member of Archive.
6231         (Lib_group): New.
6232         (Add_lib_group_symbols): New.
6233         * archive.h: Include options.h.
6234         (Archive_member): Moved from Archive.
6235         (Should_include): Moved from archive.cc.
6236         (Lib_group): New.
6237         (Add_lib_group_symbols): New.
6238         * dynobj.cc (do_should_include_member): New.
6239         * dynobj.h (do_should_include_member): New.
6240         * gold.cc (queue_initial_tasks): Update call to queue.
6241         * main.cc (main): Print lib group stats.
6242         * object.cc (do_should_include_member): New.
6243         * object.h: Include archive.h.
6244         (Object::should_include_member): New.
6245         (Object::do_should_include_member): New.
6246         (Sized_relobj::do_should_include_member): New.
6247         * options.cc (General_options::parse_start_lib): New.
6248         (General_options::parse_end_lib): New.
6249         (Input_arguments::add_file): Handle lib groups.
6250         (Input_arguments::start_group): Check we are not in a lib.
6251         (Input_arguments::start_lib): New.
6252         (Input_arguments::end_lib): New.
6253         * options.h (General_options): Add start_lib and end_lib.
6254         (Input_argument::lib_): New.
6255         (Input_argument::lib): New.
6256         (Input_argument::is_lib): New.
6257         (Input_file_lib): New.
6258         (Input_arguments::in_lib_): New.
6259         (Input_arguments::in_lib): New.
6260         (Input_arguments::start_lib): New.
6261         (Input_arguments::end_lib_): New.
6262         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6263         in unused members as preempted.
6264         (Sized_pluginobj::do_should_include_member): New.
6265         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6266         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6267         return the blocker.
6268         (Read_symbols::do_whole_lib_group): New.
6269         (Read_symbols::do_lib_group): New.
6270         (Read_symbols::do_read_symbols): Handle lib groups.
6271         (Read_symbols::get_name): Handle lib groups.
6272         * readsyms.h (Read_symbols): Add an archive member pointer.
6273         (Read_symbols::do_whole_lib_group): New.
6274         (Read_symbols::do_lib_group): New.
6275         (Read_symbols::member_): New.
6276         * script.cc (read_input_script): Update call to queue_soon.
6277
6278 2010-03-19  Doug Kwan  <dougkwan@google.com>
6279
6280         * arm.cc (Stub_table::Stub_table): Initialize new data members
6281         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6282         (Stub_table::add_reloc_stub): Assign stub offset and update
6283         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6284         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6285         New data members.
6286         (Stub_table::update_data_size_and_addralign): Use
6287         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6288         instead of going over all reloc stubs.
6289         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6290         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6291         Stringpool_template::offset_ to size of Stringpool_char.
6292         (Stringpool_template::new_key_offset): Remove code to initialize
6293         Stringpool_template::offset_.
6294         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6295         Stringpool_template::offset_ to zero.
6296
6297 2010-03-15  Doug Kwan  <dougkwan@google.com>
6298
6299         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6300         offset_.
6301         (Stringpool_template::new_key_offset): New method.
6302         (Stringpool_template::add_string): Assign offsets when adding new
6303         strings.
6304         (Stringpool_template::set_string_offsets): Do not set string offsets
6305         when not optimizing.
6306         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6307         member size_.
6308         (Chunked_vector::clear): Clear size_.
6309         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6310         (Chunked_vector::size): Return size_.
6311         (Chunked_vector::push_back): Use size_ to find insert position.
6312         (Chunked_vector::size_): New data member.
6313         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6314         (Stringpool_template::new_key_offset): New method declaration.
6315         (Stringpool_template::offset_): New data member.
6316
6317 2010-03-15   Rafael Espindola  <espindola@google.com>
6318
6319         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6320         Add_symbols' constructor.
6321         * readsyms.h (Add_symbols): Remove the input_group member.
6322
6323 2010-03-10  Ian Lance Taylor  <iant@google.com>
6324
6325         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6326         target to ask whether a reference to a symbol requires a stack
6327         split.
6328         * target.h (Target::is_call_to_non_split): New function.
6329         (Target::do_is_call_to_non_split): Declare virtual function.
6330         * target.cc: Include "symtab.h".
6331         (Target::do_is_call_to_non_split): New function.
6332         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6333
6334 2010-03-10  Cary Coutant  <ccoutant@google.com>
6335
6336         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6337         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6338         (File_read::open[2]): Add whole_file_view_ to list of views.
6339         (File_read::make_view): Remove test of whole_file_view_.
6340         (File_read::find_or_make_view): Create whole_file_view_ if
6341         necessary.
6342         (File_read::clear_views): Replace bool parameter with enum;
6343         adjust all callers.  Don't delete views with permanent data;
6344         do delete cached views and views from archives if
6345         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6346         if clearing the corresponding view.
6347         * fileread.h (File_read::Clear_views_mode): New enum.
6348         (File_read::View::is_permanent_view): New method.
6349         (File_read::clear_views): Replace bool parameter
6350         with enum; adjust all callers.
6351         * options.h (General_options): Change keep_files_mapped option;
6352         add map_whole_files.
6353         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6354         releasing the file.
6355         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6356         the file.
6357
6358 2010-03-10  David S. Miller  <davem@davemloft.net>
6359
6360         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6361
6362 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6363
6364         * icf.cc (get_section_contents): Add '@' marker after processing the
6365         merge reloc.
6366
6367 2010-03-08  Doug Kwan  <dougkwan@google.com>
6368
6369         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6370         due to a conversion warning.
6371         (Arm_relobj::update_output_local_symbol_count): Check for local
6372         symbol with unset output index.
6373
6374 2010-03-05  Ian Lance Taylor  <iant@google.com>
6375
6376         * options.h (class General_options): Add --spare-dynamic-tags.
6377         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6378         --spare-dynamic-tags.
6379
6380 2010-03-05  Ian Lance Taylor  <iant@google.com>
6381
6382         * incremental.cc: Include "libiberty.h".
6383
6384 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6385
6386         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6387         function, is_info_ member.
6388         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6389         (Versions::Versions): Update caller.
6390         (Versions::define_base_version): Likewise.
6391         (Versions::add_def): Likewise.
6392
6393 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6394
6395         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6396         (Scan::possible_function_pointer_reloc): New function.
6397         (Scan::local_reloc_may_be_function_pointer): Change to call
6398         possible_function_pointer_reloc.
6399         (Scan::global_reloc_may_be_function_pointer): Ditto.
6400         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6401         relocations in ".data.rel.ro._ZTV" section.
6402         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6403         * testsuite/icf_safe_so_test.cc: Ditto.
6404         * testsuite/icf_safe_test.cc: Ditto.
6405         * testsuite/icf_safe_test.sh: Ditto.
6406
6407 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6408             Ian Lance Taylor  <iant@google.com>
6409
6410         * target-reloc.h (relocate_section): Check the symbol table index
6411         for -1U before setting the local symbol index.
6412         (scan_relocatable_relocs): If copying the relocation, record that
6413         the local symbol is required.
6414         * object.h (Symbol_value::is_output_symtab_index_set): New
6415         function.
6416         (Symbol_value::may_be_discarded_from_output_symtab): New
6417         function.
6418         (Symbol_value::has_output_symtab_entry): New function.
6419         (Symbol_value::needs_output_symtab_entry): Remove.
6420         (Symbol_value::output_symtab_index): Make sure the symbol index is
6421         set.
6422         (Symbol_value::set_output_symtab_index): Make sure the symbol
6423         index is not set.  Make sure the new index is valid.
6424         (Symbol_value::set_must_have_output_symtab_entry): New function.
6425         (Symbol_value::has_output_dynsym_entry): New function.
6426         (Symbol_value::set_output_dynsym_index): Make sure the new index
6427         is valid.
6428         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6429         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6430         local symbol if permitted.
6431         (Sized_relobj::do_finalize_local_symbols): Call
6432         is_output_symtab_index_set rather than needs_output_symtab_entry.
6433         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6434         rather than needs_output_symtab_entry.  Call
6435         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6436         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6437         is_output_symtab_index_set rather than needs_output_symtab_entry.
6438         * testsuite/discard_locals_relocatable_test.c: New file.
6439         * testsuite/discard_locals_test.sh: Test -r.
6440         * testsuite/Makefile.am (check_DATA): Add
6441         discard_locals_relocatable_test1.syms,
6442         discard_local_relocatable_test2.syms.
6443         (MOSTLYCLEANFILES): Likewise.  Also add
6444         discard_locals_relocatable_test1.lout and
6445         discard_locals_relocatable_test2.out.
6446         (discard_locals_relocatable_test1.syms): New target.
6447         (discard_locals_relocatable_test.o): New target.
6448         (discard_locals_relocatable_test1.out): New target.
6449         (discard_locals_relocatable_test2.syms): New target.
6450         (discard_locals_relocatable_test2.out): New target.
6451         (various): Add missing ../ld-new dependencies.
6452         * testsuite/Makefile.in: Rebuild.
6453
6454 2010-03-03  Nick Clifton  <nickc@redhat.com>
6455
6456         * po/fi.po: New Finnish translation.
6457
6458 2010-03-01  Doug Kwan  <dougkwan@google.com>
6459
6460         * layout.cc (Layout::Layout): Force section types of .init_array*,
6461         .preinit_array* and .fini_array* sections.
6462         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6463         Fix check of return value of std::string::find.().
6464         (Output_section::Input_section_sort_compare::operator()): Remove
6465         comment about .init_array.
6466         (Output_section::Input_section_sort_init_fini_compare::operator()):
6467         New method.
6468         (Output_section::sort_attached_input_sections): Handle .init_array
6469         and .fini_array specially.
6470         * output.h (Output_section::Inut_section_sort_compare): Update
6471         comment.
6472         (Output_section::Input_section_sort_init_fini_compare): New struct.
6473
6474 2010-02-26  Doug Kwan  <dougkwan@google.com>
6475
6476         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6477         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6478         * testsuite/debug_msg.sh: Avoid matching source line number for
6479         use of global variable undef_int.
6480
6481 2010-02-26  Doug Kwan  <dougkwan@google.com>
6482
6483         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6484         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6485         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6486         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6487         * options.cc (General_options::General_options): Initialize member
6488         fix_v4bx_.
6489         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6490         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6491         and rm_no_fix_v4bx.stdout
6492         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6493         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6494         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6495         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6496         and arm_no_fix_v4bx.
6497         * Makefile.in: Regenerate.
6498         * testsuite/arm_fix_v4bx.s: New file.
6499         * testsuite/arm_fix_v4bx.sh: Ditto.
6500
6501 2010-02-24  Doug Kwan  <dougkwan@google.com>
6502
6503         * arm.cc (Target_arm::got_section): Make the .got section the first
6504         non RELRO section in the data segment.
6505         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6506         suffixes of section names.
6507
6508 2010-02-24  Doug Kwan  <dougkwan@google.com>
6509
6510         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6511         flags and attributes merging if an input file is a binary file.
6512         * fileread.cc (Input_file::open): Record format of original file.
6513         * fileread.h (Input_file::Format): New enum type.
6514         (Input_file::Input_file): Initialize data member format_.
6515         (Input_file::format): New method definition.
6516         (Input_file::format_):: New data member.
6517
6518 2010-02-24  Doug Kwan  <dougkwan@google.com>
6519
6520         * arm.cc (Arm_output_data_got): New class.
6521         (ARM_TCB_SIZE): New constant
6522         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6523         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6524         If user uses a script with a SECTIONS clause, issue only a warning
6525         for a misplaced EXIDX input section.  Otherwise, issue an error.
6526         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6527         garbage collection.
6528         (Target_arm::got_mode_index_entry): Handle static linking.
6529         (Target_arm::Scan::local): Ditto.
6530         (Target_arm::Scan::global): Ditto.
6531         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6532         all incorrectly implemented relocations.
6533         (Target_arm::fix_exidx_coverage): Pass layout to
6534         Arm_output_section::fix_exidx_coverage.
6535         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6536         from ".ARM.exidx." and ".ARM.extab.".
6537
6538 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6539
6540         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6541         section if it does not already exist.
6542         * attributes.cc (Attributes_section_data::Attributes_section_data):
6543         Don't crash if size is zero.
6544
6545 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6546             Ian Lance Taylor  <iant@google.com>
6547
6548         * gold.cc (queue_middle_tasks): If no input files were opened,
6549         exit.
6550         * workqueue.h (Task_function::Task_function): Assert that there is
6551         a blocker.
6552
6553 2010-02-22  Doug Kwan  <dougkwan@google.com>
6554
6555         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6556         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6557         types to avoid warnings due to different uint64_t implementations
6558         on different hosts.
6559
6560 2010-02-21  Doug Kwan  <dougkwan@google.com>
6561
6562         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6563         handling of the maximum backward branch offset.
6564         (Arm_relocate_functions::thumb_branch_common): Ditto.
6565         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6566         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6567         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6568         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6569         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6570         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6571         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6572         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6573         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6574         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6575         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6576         thumb2_bl_out_of_range.o): New rules.
6577         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6578         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6579         thumb2_bl_out_of_range
6580         * testsuite/Makefile.in: Regenerate.
6581         * testsuite/arm_bl_in_range.s: New file.
6582         * testsuite/arm_bl_out_of_range.s: Ditto.
6583         * testsuite/arm_branch_in_range.sh: Ditto.
6584         * testsuite/arm_branch_range.t: Ditto.
6585         * testsuite/thumb2_branch_range.t: Ditto.
6586         * testsuite/thumb_bl_in_range.s: Ditto.
6587         * testsuite/thumb_bl_out_of_range.s: Ditto.
6588         * testsuite/thumb_branch_range.t: Ditto.
6589
6590 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6591
6592         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6593         Add reloc offset information.
6594         * icf.cc (get_section_contents): Change iterators to point to the new
6595         vectors. Add reloc offset information to the contents.
6596         * icf.h (Icf::Sections_reachable_info): New typedef.
6597         (Icf::Sections_reachable_list): New typedef.
6598         (Icf::Offset_info): New typedef.
6599         (Icf::Reloc_info): New struct typedef.
6600         (Icf::Reloc_info_list): New typedef.
6601         (Icf::symbol_reloc_list): Delete method.
6602         (Icf::addend_reloc_list): Delete method.
6603         (Icf::section_reloc_list): Delete method.
6604         (Icf::reloc_info_list): New method.
6605         (Icf::reloc_info_list_): New member.
6606
6607 2010-02-19  Doug Kwan  <dougkwan@google.com>
6608
6609         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6610         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6611         * arm.cc (Arm_relocation_functions): New forward declaration.
6612         (Target_arm::Target_arm): Initialize new data members
6613         got_mod_index_offset_ and tls_base_symbol_defined_.
6614         (Target_arm::Relocate::relocate_tls): New method.
6615         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6616          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6617         New methods.
6618         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6619         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6620         (Target_arm::got_mod_index_offset_,
6621         Target_arm::tls_base_symbol_defined_): New data members.
6622         (Target_arm::Scan::local, Target::Scan::global,
6623         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6624         relocations.
6625
6626 2010-02-18  Doug Kwan  <dougkwan@google.com>
6627
6628         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6629         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6630         text section as a parameter becuase some broken tools may not set
6631         the link in section header.
6632         (Target_arm::has_got_section): New method.
6633         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6634         without any mapping symbol as data only.  Remove warning.
6635         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6636         link in its section header, try to discover the link by inspecting the
6637         REL31 relocation at the beginning of the section.
6638         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6639         in error message.
6640         (Target_arm::Scan::global): Treat any reference to the symbol
6641         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6642
6643 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6644
6645         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6646         (Scan::global_reloc_may_be_function_pointer): New function.
6647         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6648         (Scan::global_reloc_may_be_function_pointer): New function.
6649         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6650         (Scan::global_reloc_may_be_function_pointer): New function.
6651         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6652         (Scan::global_reloc_may_be_function_pointer): New function.
6653         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6654         (Scan::global_reloc_may_be_function_pointer): New function.
6655         (Scan::possible_function_pointer_reloc): New function.
6656         (Target_x86_64::can_check_for_function_pointers): New function.
6657         * gc.h (gc_process_relocs): Scan relocation types to determine if
6658         function pointers were taken for targets that support it.
6659         * icf.cc (Icf::find_identical_sections): Include functions for
6660         folding in safe ICF whose pointer is not taken.
6661         * icf.h (Secn_fptr_taken_set): New typedef.
6662         (fptr_section_id_): New member.
6663         (section_has_function_pointers): New function.
6664         (set_section_has_function_pointers): New function.
6665         (check_section_for_function_pointers): New function.
6666         * options.h: Fix comment for safe ICF option.
6667         * target.h (can_check_for_function_pointers): New function.
6668         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6669         Modify icf_safe_test for X86-64.
6670         * testsuite/Makefile.in: Regenerate.
6671         * testsuite/icf_safe_so_test.cc: New file.
6672         * testsuite/icf_safe_so_test.sh: New file.
6673         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6674         (main): Change to take pointer to function kept_func_3.
6675         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6676         folding is done correctly for X86-64.
6677
6678 2010-02-12  David S. Miller  <davem@davemloft.net>
6679
6680         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6681         is_symbolless parameter.
6682         (Output_reloc<SHT_REL>::is_symbolless): New.
6683         (Output_reloc<SHT_REL>::is_symbolless_): New.
6684         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6685         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6686         (Output_reloc<SHT_RELA>::is_symbolless): New.
6687         (Output_data_reloc::add_global): Handle is_symbolless.
6688         (Output_data_reloc::add_global_relative): Likewise.
6689         (Output_data_reloc::add_local): Likewise.
6690         (Output_data_reloc::add_local_relative): Likewise.
6691         (Output_data_reloc::add_symbolless_global_addend): New.
6692         (Output_data_reloc::add_symbolless_local_addend): New.
6693         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6694         is_symbolless.
6695         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6696         instead of ->is_relative_
6697         (Output_reloc::write): Likewise.
6698         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6699         (Output_reloc::write_rel): Simplify.
6700
6701         * sparc.cc (Target_sparc::Scan::local): Use
6702         ->add_symbolless_local_addend as needed.
6703         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6704         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6705         based upon relocation offset.
6706
6707 2010-02-11  Doug Kwan  <dougkwan@google.com>
6708
6709         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6710         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6711         beginning of function.
6712         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6713         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6714         parameter is_32bit in calls to should_apply_static_reloc.
6715         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6716         (check_DATA): Add arm_abs_global.stdout.
6717         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6718         arm_abs_global.stdout): New rules.
6719         (MOSTLLYCLEANFILES): Add arm_abs_global
6720         * Makefile.in: Regenerate.
6721         * testsuite/arm_abs_global.s: New file.
6722         * testsuite/arm_abs_global.sh: Ditto.
6723         * testsuite/arm_abs_lib.s: Ditto.
6724
6725 2010-02-11  Ian Lance Taylor  <iant@google.com>
6726
6727         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6728         Read_relocs task.
6729         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6730         Allocate_commons_task first.
6731         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6732         task, rather than symtab_lock_.
6733         (Gc_process_relocs::~Gc_process_relocs): New function.
6734         (Gc_process_relocs::is_runnable): Check this_blocker_.
6735         (Gc_process_relocs::locks): Use next_blocker_ rather than
6736         blocker_.
6737         (Scan_relocs::~Scan_relocs): New function.
6738         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6739         symtab_lock_.
6740         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6741         next_blocker_.
6742         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6743         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6744         constructor accordingly.
6745         (class Gc_process_relocs): Likewise.
6746         (class Scan_relocs): Likewise.
6747         * common.h (class Allocate_commons_task): Remove symtab_lock_
6748         field, and corresponding constructor parameter.
6749         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6750         symtab_lock_.
6751         (Allocate_commons_task::locks): Likewise.
6752
6753 2010-02-11  Ian Lance Taylor  <iant@google.com>
6754
6755         * gold-threads.h (class Once): Define.
6756         (class Initialize_lock): Rewrite as child of Once.
6757         * gold-threads.cc (class Once_initialize): Define.
6758         (once_pointer_control): New static variable.
6759         (once_pointer, once_arg): New static variables.
6760         (c_run_once): New static function.
6761         (Once::Once, Once::run_once, Once::internal_run): New functions.
6762         (class Initialize_lock_once): Remove.
6763         (initialize_lock_control): Remove.
6764         (initialize_lock_pointer): Remove.
6765         (initialize_lock_once): Remove.
6766         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6767         (Initialize_lock::initialize): Rewrite.
6768         (Initialize_lock::do_run_once): New function.
6769         * archive.cc (Archive::interpret_header): Only clear name if it is
6770         not already empty.
6771         * fileread.cc: Include "gold-threads.h"
6772         (file_counts_lock): New static variable.
6773         (file_counts_initialize_lock): Likewise.
6774         (File_read::release): Only increment counts when using --stats.
6775         Use a lock around the increment.
6776         * parameters.cc (class Set_parameters_target_once): Define.
6777         (set_parameters_target_once): New static variable.
6778         (Parameters::Parameters): Move here from parameters.h.
6779         (Parameters::set_target): Rewrite.
6780         (Parameters::set_target_once): New function.
6781         (Parameters::clear_target): Move here and rewrite.
6782         * parameters.h (class Parameters): Update declarations.  Add
6783         set_parameters_target_once_ field.
6784         (Parameters::Parameters): Move to parameters.cc.
6785         (Parameters::clear_target): Likewise.
6786         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6787         task.
6788         (Start_group::~Start_group): New function.
6789         (Start_group::is_runnable): New function.
6790         (Start_group::locks, Start_group::run): New functions.
6791         (Finish_group::run): Change saw_undefined to size_t.
6792         * readsyms.h (class Start_group): Define.
6793         (class Finish_group): Change saw_undefined_ field to size_t.
6794         (Finish_group::Finish_group): Remove saw_undefined and
6795         this_blocker parameters.  Change all callers.
6796         (Finish_group::set_saw_undefined): New function.
6797         (Finish_group::set_blocker): New function.
6798         * symtab.h (class Symbol_table): Change saw_undefined to return
6799         size_t.  Change saw_undefined_ field to size_t.
6800         * target-select.cc (Set_target_once::do_run_once): New function.
6801         (Target_selector::Target_selector): Initialize set_target_once_
6802         field.  Don't initialize lock_ and initialize_lock_ fields.
6803         (Target_selector::instantiate_target): Rewrite.
6804         (Target_selector::set_target): New function.
6805         * target-select.h (class Set_target_once): Define.
6806         (class Target_selector): Update declarations.  Make
6807         Set_target_once a friend.  Remove lock_ and initialize_lock_
6808         fields.  Add set_target_once_ field.
6809
6810 2010-02-10  Ian Lance Taylor  <iant@google.com>
6811
6812         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6813         queueing any tasks.
6814         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6815         (queue_middle_tasks): Add all blockers before queueing any tasks.
6816         (queue_final_tasks): Likewise.
6817         * token.h (Task_token::add_blockers): New function.
6818         * object.h (Input_objects::number_of_relobjs): New function.
6819
6820 2010-02-10  Ian Lance Taylor  <iant@google.com>
6821
6822         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6823         shared, not if not position independent.
6824         * x86_64.cc (Relocate::relocate_tls): Likewise.
6825         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6826         (tls_pie_pic_test): New target.
6827         * testsuite/Makefile.in: Rebuild.
6828
6829         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6830         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6831         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6832         * testsuite/Makefile.in: Rebuild.
6833
6834 2010-02-09  David S. Miller  <davem@davemloft.net>
6835
6836         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6837         R_SPARC_RELATIVE using ->add_local_relative().
6838         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6839
6840         * output.h (Output_data_dynamic::add_section_size): New method
6841         that takes two Output_data objects.
6842         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6843         entry param.  Handle it in initializers.
6844         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6845         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6846         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6847         arg.
6848         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6849         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6850         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6851         for dynrel_includes_plt.
6852         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6853         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6854         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6855         before .rela.plt
6856         (Target_sparc::do_finalize_sections): Update to pass true for
6857         dynrel_includes_plt.
6858         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6859         output before .rela.plt
6860         (Target_powerpc::do_finalize_sections): Update to pass true for
6861         dynrel_includes_plt when 32-bit.
6862
6863 2010-02-08  Doug Kwan  <dougkwan@google.com>
6864
6865         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6866         method.
6867         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6868         Arm_relobj::scan_section_for_cortex_a8_stubs,
6869         Arm_relobj::do_relocation_section): Instead of calling
6870         Output_section::output_address, use faster
6871         Arm_relobj::simple_input_section_output_address.
6872
6873 2010-02-08  David S. Miller  <davem@davemloft.net>
6874
6875         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6876         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6877         relocation helper function.
6878
6879         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6880         just like R_SPARC_GOT{10,13,22}.
6881         (Target_sparc::Scan::local): Likewise.
6882         (Target_sparc::Relocate:relocate): Likewise.
6883
6884 2010-02-06  Ian Lance Taylor  <iant@google.com>
6885
6886         * configure.ac: Rewrite targetobjs duplicate removal code to use
6887         only shell constructs.
6888         * configure: Rebuild.
6889
6890 2010-02-05  Doug Kwan  <dougkwan@google.com>
6891
6892         PR 11247
6893         * arm.cc (Arm_relobj::section_is_scannable): New method.
6894         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6895         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6896
6897 2010-02-04  Doug Kwan  <dougkwan@google.com>
6898
6899         PR 11247
6900         * arm-reloc-property.cc (cstdio): Include.
6901         * configure.ac (targetobjs): Remove duplicates.
6902         * configure: Regenerate.
6903         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6904         big and little endian version for a given address size.
6905
6906 2010-02-03  Doug Kwan  <dougkwan@google.com>
6907
6908         * arm-reloc-property.cc
6909         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6910         definition.
6911         * arm-reloc-property.h
6912         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6913         New method definition.
6914         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6915         declaration.
6916         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6917         overflow to N.
6918         (GOT_PREL): Change implemented to Y.
6919         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6920         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6921         (Arm_relocate_functions::movw_abs_nc): Remove method.
6922         (Arm_relocate_functions::movt_abs): Ditto.
6923         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6924         (Arm_relocate_functions::thm_movt_abs): Ditto.
6925         (Arm_relocate_functions::movw_rel_nc): Ditto.
6926         (Arm_relocate_functions::movw_rel): Ditto.
6927         (Arm_relocate_functions::movt_rel): Ditto.
6928         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6929         (Arm_relocate_functions:thm_movw_rel): Ditto.
6930         (Arm_relocate_functions:thm_movt_rel): Ditto.
6931         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6932         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6933         New method definitions.
6934         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6935         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6936         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6937         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6938         (Target_arm::Relocate::relocate): Check for non-static or
6939         unimplemented relocation code and exit early.  Change calls to
6940         Target_arm::reloc_uses_thumb_bit and
6941         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6942         instead.  Refactor code to handle similar relocations to increase
6943         code sharing.  Remove check for unsupported relocation code in switch
6944         statement.
6945         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6946         relocation property table to find out size.  Change error message to
6947         print out the name of a relocation code instead of the numeric value.
6948         (Target_arm::scan_reloc_for_stub): Use relocation property table
6949         instead of calling Target_arm::reloc_uses_thumb_bit().
6950
6951 2010-02-02  Doug Kwan  <dougkwan@google.com>
6952
6953         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6954         types of relaxed input section.
6955
6956 2010-02-02  Doug Kwan  <dougkwan@google.com>
6957
6958         * Makefile.am (HFILES): Add arm-reloc-property.h.
6959         (DEFFILES): New.
6960         (TARGETSOURCES): Add arm-reloc-property.cc
6961         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6962         (libgold_a_SOURCES): $(DEFFILES)
6963         * Makefile.in: Regenerate.
6964         * arm-reloc-property.cc: New file.
6965         * arm-reloc-property.h: New file.
6966         * arm-reloc.def: New file.
6967         * arm.cc: Update comments.
6968         (arm-reloc-property.h): New included header.
6969         (arm_reloc_property_table): New global variable.
6970         (Target_arm::do_select_as_default_target): New method definition.
6971         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6972         arm-reloc-property to targ_extra_obj.
6973         * parameters.cc (set_parameters_target): Call
6974         Target::select_as_default_target().
6975         * target.h (Target::select_as_default_target): New method definition.
6976         (Target::do_select_as_default_target): Same.
6977
6978 2010-02-01  Doug Kwan  <dougkwan@google.com>
6979
6980         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6981         first_output_text_section_.
6982         (Arm_exidx_fixup::first_output_text_section): New method definition.
6983         (Arm_exidx_fixup::first_output_text_section_): New data member.
6984         (Arm_exidx_fixup::process_exidx_section): Record the first text
6985         output section seen.
6986         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6987         and entsize in output section header.
6988
6989 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6990
6991         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6992         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6993         (Arm_relocate_functions::thm_alu11): New Method.
6994         (Arm_relocate_functions::thm_pc8): New Method.
6995         (Arm_relocate_functions::thm_pc12): New Method.
6996         (Target_arm::Scan::local): Handle the relocations.
6997         (Target_arm::Scan::global): Likewise.
6998         (Target_arm::Relocate::relocate): Likewise.
6999         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7000
7001 2010-01-29  Doug Kwan  <dougkwan@google.com>
7002
7003         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7004         of relocation types as ld.
7005
7006 2010-01-29  Doug Kwan  <dougkwan@google.com>
7007
7008         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7009         to public.
7010         (Arm_relocate_functions::thumb_branch_common): Ditto.
7011         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7012         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7013         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7014         Arm_relocate_functions::jump24): Remove.
7015         (Target_arm::Relocate::relocate): Adjust code to call
7016         Arm_relocation_functions::arm_branch_common and
7017         Arm_relocation_functions::thumb_branch_common instead of their removed
7018         wrappers.  Merge switch-cases together to reduce source code size.
7019
7020 2010-01-29  Doug Kwan  <dougkwan@google.com>
7021
7022         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7023         output_local_symbol_count_needs_update_.
7024         (Arm_relobj::output_local_symbol_count_needs_update,
7025          Arm_relobj::set_output_local_symbol_count_needs_update,
7026          Arm_relobj::update_output_local_symbol_count): New methods.
7027         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7028         member.
7029         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7030         of pointed function as in a R_ARM_PREL31 relocation.
7031         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7032         for output local symbol count updating.
7033         (Target_arm::do_relax): Update output local symbol counts in objects
7034         if necessary.
7035         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7036
7037 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7038
7039         * arm.cc: Added support for the ARM relocations:
7040         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7041         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7042         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7043         movw_prel_nc).
7044         (Arm_relocate_functions::movw_rel): New method.
7045         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7046         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7047         thm_movw_prel_nc).
7048         (Arm_relocate_functions::thm_movw_rel): New method.
7049         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7050         thm_movt_prel).
7051         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7052         relocations.
7053         (Target_arm::Scan::global): Likewise.
7054         (Target_arm::Relocate::relocate): Likewise.
7055         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7056         Likewise.
7057
7058 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7059
7060         * arm.cc: Added support for ARM group relocations.
7061         (Target_arm::reloc_needs_sym_origin): New method.
7062         (Arm_relocate_functions::calc_grp_kn): New method.
7063         (Arm_relocate_functions::calc_grp_residual): New method.
7064         (Arm_relocate_functions::calc_grp_gn): New method.
7065         (Arm_relocate_functions::arm_grp_alu): New Method.
7066         (Arm_relocate_functions::arm_grp_ldr): New Method.
7067         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7068         (Arm_relocate_functions::arm_grp_ldc): New Method.
7069         (Target_arm::Scan::local): Handle the ARM group relocations.
7070         (Target_arm::Scan::global): Likewise.
7071         (Target_arm::Relocate::relocate): Likewise.
7072         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7073         Likewise.
7074
7075 2010-01-26  Doug Kwan  <dougkwan@google.com>
7076
7077         * arm.cc (set): Include.
7078         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7079         pointer type.
7080         (Arm_output_section::Text_section_list): New type.
7081         (Arm_output_section::append_text_sections_to_list): New method.
7082         (Arm_output_section::fix_exidx_coverage): Ditto.
7083         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7084         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7085         Relobj::set_section_offset() instead of
7086         Sized_relobj::invalidate_section_offset().
7087         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7088         parameter for section headers. Ignore relocation sections for
7089         unallocated sections and EXIDX sections.
7090         (Target_arm::fix_exidx_coverage): New method.
7091         (Target_arm::output_section_address_less_than): New type.
7092         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7093         linked text section instead of the EXIDX section.
7094         (Arm_output_section::create_stub_group): Add an assertion to check
7095         that this is not an EXIDX output section.
7096         (Arm_output_section::append_text_sections_to_list): New method.
7097         (Arm_output_section::fix_exidx_coverage): Ditto.
7098         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7099         Arm_relobj::section_needs_reloc_stub_scanning.
7100         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7101         first pass.
7102         (Target_arm::fix_exidx_coverage): New method.
7103         * object.h (Relobj::set_output_section): New method.
7104         (Sized_relobj::invalidate_section_offset): Remove method.
7105         (Sized_relobj::do_invalidate_section_offset): Remove method.
7106         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7107
7108 2010-01-25  Doug Kwan  <dougkwan@google.com>
7109
7110         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7111         Fix warning due to signed and unsigned comparison on a 32-bit host.
7112
7113 2010-01-22  Doug Kwan  <dougkwan@google.com>
7114
7115         * arm.cc (Target_arm::do_relax): Record an output section for section
7116         offset adjustment it contains any stub table that has changed.
7117         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7118         offsets in an output section if necessary.
7119         * output.cc (Output_section::Output_section): Initialize
7120         section_offsets_need_adjustments_.
7121         (Output_section::add_input_section_for_script): Renamed to
7122         Output_section::add_simple_input_section.
7123         (Output_section::save_states): Add a comment.
7124         (Output_section::discard_states): New method defintion.
7125         (Output_section::adjust_section_offsets): Same.
7126         * output.h (Output_section::add_input_section_for_script): Renamed to
7127         Output_section::add_simple_input_section.
7128         (Output_section::discard_states): New method declaration.
7129         (Output_section::adjust_section_offsets): Same.
7130         (Output_section::section_offsets_need_adjustment,
7131         Output_section::set_section_offsets_need_adjustment): New method
7132         definitions.
7133         (Output_section::section_offsets_need_adjustment_): New data member.
7134         * script-sections.cc
7135         (Output_section_element_input::set_section_address): Adjust code for
7136         renaming of Output_section::add_input_section_for_script.
7137         (Orphan_output_section::set_section_address): Same.
7138
7139 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7140
7141         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7142         Fix_v4bx enum values .
7143         * gold/options.h (General_options): New option definitions.
7144         (General_options::fix_v4bx): New method.
7145         (General_options::Fix_v4bx): New enum.
7146         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7147         (General_options::parse_fix_v4bx_interworking): New method.
7148
7149 2010-01-22  Doug Kwan  <dougkwan@google.com>
7150
7151         * arm.cc (Arm_exidx_fixup): New class.
7152
7153 2010-01-21  Doug Kwan  <dougkwan@google.com>
7154
7155         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7156         classes.
7157         (Arm_exidx_section_offset_map): New type.
7158
7159 2010-01-21  Doug Kwan  <dougkwan@google.com>
7160
7161         * arm.cc (Arm_exidx_input_section): New class.
7162         (Arm_relobj::exidx_input_section_by_link,
7163         Arm_relobj::exidx_input_section_by_shndx,
7164         Arm_relobj::make_exidx_input_section): New methods.
7165         (read_arm_attributes_section): Remove.
7166         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7167         information about them.
7168         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7169         to here.
7170
7171 2010-01-20  Doug Kwan  <dougkwan@google.com>
7172
7173         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7174         Input_section_specifier to Section_id.
7175         (Target_arm::new_arm_input_section: Adjust code for change of key
7176         type.
7177         (Target_arm::find_arm_input_section): Ditto.
7178         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7179         (Section_id): Remove.
7180         (Garbage_collection::Section_id_hash): Remove.
7181         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7182         (Section_id): Remove.
7183         (Icf::Section_id_hash): Remove.
7184         * object.h (Section_id, Const_section_id, Section_id_hash,
7185         Const_section_id_hash): New type definitions.
7186         * output.cc (Output_section::add_relaxed_input_section): Change to
7187         use Const_section_id instead of Input_section_specifier as key type.
7188         (Output_section::add_merge_input_section): Ditto.
7189         (Output_section::build_relaxation_map): Change to use Section_id
7190         instead of Input_section_specifier as key type.
7191         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7192         Ditto.
7193         (Output_section::convert_input_sections_to_relaxed_sections): Change
7194         to use Const_section_id instead of Input_section_specifier as key type.
7195         (Output_section::find_merge_section): Ditto.
7196         (Output_section::find_relaxed_input_section): Ditto.
7197         * output.h (Input_section_specifier): Remove class.
7198         (Output_section::Output_section_data_by_input_section_map): Change
7199         key type to Const_section_id.
7200         (Output_section::Output_relaxed_input_section_by_input_section_map):
7201         Ditto.
7202         (Output_section::Relaxation_map): Change key type to Section_id.
7203
7204 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7205
7206         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7207         (class Arm_v4bx_stub): New class.
7208         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7209         (Stub_factory::make_arm_v4bx_stub): New method.
7210         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7211         (Stub_table::empty): Handle v4bx stubs.
7212         (Stub_table::add_arm_v4bx_stub): New method.
7213         (Stub_table::find_arm_v4bx_stub): New method.
7214         (Arm_relocate_functions::v4bx): New method.
7215         (Target_arm::fix_v4bx): New method.
7216         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7217         (Stub_table::relocate_stubs): Likewise.
7218         (Stub_table::do_write): Likewise.
7219         (Stub_table::update_data_size_and_addralign): Likewise.
7220         (Stub_table::finalize_stubs):  Likewise.
7221         (Target_arm::Scan::local): Likewise.
7222         (Target_arm::Scan::global): Likewise.
7223         (Target_arm::do_finalize_sections): Likewise.
7224         (Target_arm::Relocate::relocate): Likewise.
7225         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7226         Likewise.
7227         (Target_arm::scan_reloc_for_stub): Likewise.
7228         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7229
7230 2010-01-19  Ian Lance Taylor  <iant@google.com>
7231
7232         * output.cc (Output_section_headers::do_sized_write): Write large
7233         segment count to sh_info field.
7234         (Output_file_header::do_sized_write): For large segment count,
7235         write PN_XNUM to e_phnum field.
7236
7237 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7238
7239         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7240         (Arm_relocate_functions::thm_jump8): New function.
7241         (Arm_relocate_functions::thm_jump11): New function.
7242         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7243         R_ARM_THM_JUMP11.
7244         (Target_arm::Scan::global): Likewise.
7245         (Target_arm::Relocate::relocate): Likewise.
7246         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7247         Likewise.
7248
7249 2010-01-14  Doug Kwan  <dougkwan@google.com>
7250
7251         * arm.cc (map, utility): Include headers.
7252         (Target_arm::apply_cortex_a8_workaround): New method.
7253         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7254         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7255         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7256         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7257         the --[no-]fix-cortex-a8 command line options.
7258         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7259         (Target_arm::relocate_stub): Use addend in instruction template.
7260         * options.h (DEFINE_bool): Set the user-set flag.
7261         (General_options): Add --[no-]-fix-cortex options.
7262         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7263         : Update fast look-up map after conversion.
7264
7265 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7266
7267         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7268         in the first pass of do_layout.
7269
7270 2010-01-13  Doug Kwan  <dougkwan@google.com>
7271
7272         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7273         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7274         apparent compiler problem of not folding static constant integral
7275         data members of elfcpp::Elf_sizes<32>.
7276
7277 2010-01-13  Doug Kwan  <dougkwan@google.com>
7278
7279         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7280         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7281         Arm_relobj::scan_section_for_cortex_a8_erratum,
7282         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7283         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7284         sections to scan for relocation stubs into a new method
7285         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7286         relocation and Cortex-A8 stub scanning.
7287         (Target_arm::do_relax): Force stubs to be after stubbed sections
7288         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7289         the beginning of a new relaxation pass.  Update a comment.
7290         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7291
7292 2010-01-12  Ian Lance Taylor  <iant@google.com>
7293
7294         * target-reloc.h (visibility_error): New inline function.
7295         (relocate_section): Call visibility_error.
7296         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7297         (MOSTLYCLEANFILES): Likewise.
7298         (protected_4_pic.o, protected_3.err): New targets.
7299         * testsuite/protected_4.cc: New file.
7300
7301 2010-01-12  Doug Kwan  <dougkwan@google.com>
7302
7303         * arm.cc (Cortex_a8_reloc): New class.
7304         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7305         and cortex_a8_relocs_info_.
7306         (Target_arm::fix_cortex_a8): New method definition.
7307         (Target_arm::Cortex_a8_relocs_info): New type.
7308         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7309         New data member declarations.
7310         (Target_arm::scan_reloc_for_stub): Record information about
7311         relocations for THUMB branches that might be exempted from the
7312         Cortex-A8 workaround.
7313         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7314         at the beginning of a relaxation pass.
7315
7316 2010-01-12  Doug Kwan  <dougkwan@google.com>
7317
7318         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7319         (Arm_relobj::Mapping_symbol_position,
7320          Arm_reloj::Mapping_symbol_position_less,
7321          Arm_relobj::Mapping_symbols_info): New types.
7322         (Target_arm::is_mapping_symbol_name): New method definition.
7323         (Arm_relobj::do_count_local_symbols): Save information about mapping
7324         symbols.
7325
7326 2010-01-11  Doug Kwan  <dougkwan@google.com>
7327
7328         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7329         Arm_relocate_functions::thumb32_branch_upper,
7330         Arm_relocate_functions::thumb32_branch_lower,
7331         Arm_relocate_functions::thumb32_cond_branch_offset,
7332         Arm_relocate_functions::thumb32_cond_branch_upper,
7333         Arm_relocate_functions::thumb32_cond_branch_lower,
7334         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7335         branch offset encoding.
7336         (Arm_relocate_functions::thumb_branch_common): Use new branch
7337         offset encoding methods to avoid code duplication.
7338         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7339         (Stub_addend_reader::operator()): Use new branch encoding method
7340         to avoid code duplication.
7341
7342 2010-01-11  Doug Kwan  <dougkwan@google.com>
7343
7344         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7345         (Target_arm::do_finalize_sections): Define special EXIDX section
7346         symbols only if referenced.
7347         * gc.h (Garbage_collection::add_reference): New method.
7348         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7349         code duplication.
7350
7351 2010-01-11  Ian Lance Taylor  <iant@google.com>
7352
7353         * script.cc (Version_script_info::build_expression_list_lookup):
7354         Change complaing about duplicate wildcard match from error to
7355         warning.
7356
7357         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7358         of 2009-12-30.
7359         (Version_script_info::Version_script_info): Initialize globs_,
7360         default_version_, default_is_global_, and exact_.  Don't
7361         initialize globals_ or locals_.
7362         (Version_script_info::build_lookup_tables): Build local symbols
7363         first.
7364         (Version_script_info::unquote): New function.
7365         (Version_script_info::add_exact_match): New function.
7366         (Version_script_info::build_expression_list_lookup): Remove lookup
7367         parameter.  Add is_global parameter.  Change all callers.  Handle
7368         wildcard pattern specially.  Unquote pattern.  Call
7369         add_exact_match.
7370         (Version_script_info::get_name_to_match): New function.
7371         (Version_script_info::get_symbol_version): New function.
7372         (Version_script_info::get_symbol_version_helper): Remove.
7373         (Version_script_info::check_unmatched_names): Call unquote.
7374         * script.h (class Version_script_info): Change get_symbol_version
7375         to be non-inline and add is_global parameter; change all callers.
7376         Rewrite symbol_is_local.  Update declarations.  Define struct
7377         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7378         Remove globals_ and locals_ members.  Add exact_, globs_,
7379         default_version_, is_global_.
7380         (Version_script_info::Glob): Remove pattern, add expression and
7381         is_global.  Update constructor.  Change all callers.
7382         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7383         default version.
7384         (Versions::symbol_section_contents): If a symbol is undefined, or
7385         defined in a dynamic object, set the version index to
7386         VER_NDX_LOCAL.
7387         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7388         symbol_is_local.
7389         (Symbol_table::add_from_pluginobj): Likewise.
7390         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7391
7392 2010-01-11  Doug Kwan  <dougkwan@google.com>
7393
7394         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7395         (incremental_dump_LDADD): Add linking option for libintl.
7396         * Makefile.in: Regenerate.
7397
7398 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7399
7400         PR gold/11144
7401         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7402         instead of -Ds.
7403         * testsuite/Makefile.in: Regenerated.
7404
7405 2010-01-10  Doug Kwan  <dougkwan@google.com>
7406
7407         * options.h (DEFINE_var): Use parentheses around argument varname__
7408         in macro body to avoid any unintended subsequent substitutions.
7409
7410 2010-01-10  Ian Lance Taylor  <iant@google.com>
7411
7412         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7413         candidates before doing symbol resolution.
7414
7415         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7416         ODR candidates if only one is weak.
7417
7418 2010-01-08  Ian Lance Taylor  <iant@google.com>
7419
7420         * script.cc (Version_script_info::build_expression_list_lookup):
7421         Don't warn about ambiguous version, just record the ambiguity.
7422         (Version_script_info::get_symbol_version_helper): Give error if
7423         version is ambiguous.
7424
7425 2010-01-08  Doug Kwan  <dougkwan@google.com>
7426
7427         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7428         prev_data_size_ and prev_addralign_.  Remove initializer for
7429         deleted data member has_been_changed_.
7430         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7431         to determine if the table is empty.
7432         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7433         Remove.
7434         (Stub_table::add_reloc_stub): Define method in class definition
7435         instead of just declaring it there.
7436         (Stub_table::add_cortex_a8_stub): New method definition.
7437         (Stub_table::update_data_size_and_addralign): Ditto.
7438         (Stub_table::finalize_stubs): Ditto.
7439         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7440         (Stub_table::do_addralign_): Return address alignment in the
7441         (Stub_table::do_reset_address_and_file_offset): Define method in
7442         class definition instead of declaring it there.  Set current data
7443         size to be the data size of the previous pass.
7444         (Stub_table::set_final_data_size): Use current data size as the
7445         final data size.
7446         (Stub_table::relocate_stub): Change parameter type of stub from
7447         Reloc_stub pointer to Stub pointer.
7448         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7449         (Stub_table::Cortex_a8_stub_list): New typedef.
7450         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7451          Stub_table::prev_addralign_): New data member.
7452         (Arm_relobj::Arm_relobj): Initialize data member
7453         section_has_cortex_a8_workaround_.
7454         (Arm_relobj::section_has_cortex_a8_workaround,
7455          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7456          definitions.
7457         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7458         declarations.
7459         (Target_arm::relocate_stub): Change parameter type of stub from
7460         Reloc_stub pointer to Stub pointer.
7461         (Insn_template::size, Insn_template::alignment): Handle
7462         THUMB16_SPECIAL_TYPE.
7463         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7464          Stub_table::update_data_size_and_addralign,
7465          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7466         definitions.
7467         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7468         (Stub_table::do_write): Ditto.
7469         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7470
7471 2010-01-08  Ian Lance Taylor  <iant@google.com>
7472
7473         PR 11108
7474         * symtab.h (class Symbol): Remove fields is_target_special_ and
7475         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7476         (Symbol::is_defined_in_discarded_section): New function.
7477         (Symbol::set_is_defined_in_discarded_section): New function.
7478         (Symbol::has_plt_offset): Rewrite.
7479         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7480         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7481         Don't initialize is_target_special_ or has_plt_offset_.
7482         Initialize is_defined_in_discarded_section_.
7483         (Symbol_table::add_from_relobj): If appropriate, set
7484         is_defined_in_discarded_section.
7485         * resolve.cc (Symbol::override_base_with_special): Don't test
7486         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7487         * target-reloc.h (relocate_section): Do special handling for
7488         symbols defined in discarded sections for global symbols as well
7489         as local symbols.
7490
7491 2010-01-08  Ian Lance Taylor  <iant@google.com>
7492
7493         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7494         the SHT_SYMTAB case.
7495
7496 2010-01-08  Ian Lance Taylor  <iant@google.com>
7497
7498         * object.cc (Sized_relobj::do_layout): Don't get confused if
7499         layout_eh_frame returns NULL.
7500
7501 2010-01-08  Ian Lance Taylor  <iant@google.com>
7502
7503         PR 11084
7504         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7505         dynamic symbol table, use the normal symbol table.
7506         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7507         symbol table.
7508
7509 2010-01-08  Ian Lance Taylor  <iant@google.com>
7510
7511         PR 11072
7512         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7513         sections.
7514
7515 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7516
7517         * version.cc (print_version): Change to "Copyright 2010".
7518
7519 2010-01-08  Ian Lance Taylor  <iant@google.com>
7520
7521         PR 10287
7522         PR 11063
7523         * i386.cc (class Target_i386): Change return type of plt_section
7524         to be non-const.
7525         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7526         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7527         tls_desc_rel_ field.
7528         (Output_data_plt_i386::rel_tls_desc): New function.
7529         (Target_i386::rel_tls_desc_section): New function.
7530         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7531         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7532         R_386_TLS_DESC reloc in rel_tls_desc_section.
7533         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7534         Define struct Tlsdesc_info.
7535         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7536         (Target_x86_64::do_reloc_symbol_index): New function.
7537         (Target_x86_64::add_tlsdesc_info): New function.
7538         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7539         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7540         tlsdesc_rel_ field.
7541         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7542         all callers.
7543         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7544         (Target_x86_64::rela_tlsdesc_section): New function.
7545         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7546         handling.
7547         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7548         (Target_x86_64::do_reloc_addend): New function.
7549         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7550         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7551         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7552         (Output_reloc::type): New function.
7553         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7554         (Output_reloc::is_target_specific): New function.
7555         (Output_reloc::target_arg): New function.
7556         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7557         absolute relocs and target specific relocs.
7558         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7559         add_target_specific.
7560         (class Output_data_reloc) [SHT_RELA]: Likewise.
7561         * output.cc (Output_reloc::Output_reloc): Add four new versions
7562         for absolute relocs and target specific relocs.
7563         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7564         (Output_reloc::get_symbol_index): Likewise.
7565         (Output_reloc::local_section_offset): Check that local_sym_index_
7566         is not TARGET_CODE or 0.
7567         (Output_reloc::symbol_value): Likewise.
7568         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7569         reloc.
7570         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7571         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7572         functions.
7573         * layout.cc (add_target_dynamic_tags): Use output section for
7574         DT_PLTRELSZ and DT_JMPREL.
7575
7576 2010-01-07  Ian Lance Taylor  <iant@google.com>
7577
7578         PR 11061
7579         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7580         function.
7581         (class Output_data_reloc_generic): Define.
7582         (class Output_data_reloc_base): Change base class to
7583         Output_data_reloc_generic.  Change add() method to call
7584         bump_relative_reloc_count for a relative reloc.  Remove
7585         sort_relocs_ field.
7586         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7587         to sort_relocs().
7588         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7589         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7590         appropriate.
7591         * layout.h (class Layout): Update declaration.
7592
7593 2010-01-07  Ian Lance Taylor  <iant@google.com>
7594
7595         * output.h (class Output_data): Add const version of
7596         output_section and do_output_section.
7597         (class Output_section_data): Add const version of
7598         do_output_section.
7599         (class Output_section): Likewise.
7600         * layout.cc (Layout::add_target_dynamic_tags): New function.
7601         * layout.h (class Layout): Update declarations.
7602         * arm.cc (Target_arm::do_finalize_sections): Use
7603         add_target_dynamic_tags.
7604         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7605         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7606         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7607         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7608
7609 2010-01-07  Ian Lance Taylor  <iant@google.com>
7610
7611         PR 11042
7612         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7613         object as needed.
7614
7615 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7616             Ian Lance Taylor  <iant@google.com>
7617
7618         PR 11019
7619         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7620         Xindex::read_symtab_xindex.
7621
7622 2010-01-07  Doug Kwan  <dougkwan@google.com>
7623
7624         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7625         (Insn_template::thumb16_bcond_insn): New method declaration.
7626         (Insn_template): Fix spelling.
7627         (Stub::thumb16_special): New method declaration.
7628         (Stub::do_write): Define virtual method which was previously pure
7629         virtual.
7630         (Stub::do_thumb16_special): New method declaration.
7631         (Stub::do_fixed_endian_write): New template member.
7632         (Reloc_stub::do_write): Remove.
7633         (Reloc_stub::do_fixed_endian_write): Remove.
7634         (Cortex_a8_stub): New class definition.
7635         (Stub_factory::make_cortex_a8_stub): New method definition.
7636         (Stub_factory::Stub_factory): Add missing static storage class
7637         qualifier for elf32_arm_stub_a8_veneer_blx.
7638
7639 2010-01-07  Ian Lance Taylor  <iant@google.com>
7640
7641         PR 10980
7642         * options.h (class General_options): Add --warn-unresolved-symbols
7643         and --error-unresolved-symbols.
7644         * errors.cc (Errors::undefined_symbol): Implement
7645         --warn-unresolved-symbols.
7646
7647         * options.h (class General_options): Add -z text and -z textoff.
7648         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7649
7650 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7651
7652         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7653         (Garbage_collection::cident_sections): New function.
7654         (Garbage_collection::add_cident_section): New function.
7655         (Garbage_collection::cident_sections_): New member.
7656         (gc_process_relocs): Add references to sections whose names are C
7657         identifiers.
7658         * gold.h (cident_section_start_prefix): New constant.
7659         (cident_section_stop_prefix): New constant.
7660         (is_cident): New function.
7661         * layout.cc (Layout::define_section_symbols): Replace string constants
7662         with the newly defined constants.
7663         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7664         C identifiers.
7665         * testsuite/Makefile.am: Add gc_orphan_section_test.
7666         * testsuite/Makefile.in: Regenerate.
7667         * testsuite/gc_orphan_section_test.cc: New file.
7668         * testsuite/gc_orphan_section_test.sh: New file.
7669
7670 2010-01-06  Ian Lance Taylor  <iant@google.com>
7671
7672         PR 10980
7673         * options.h (class General_options): Add --warn-shared-textrel.
7674         * layout.cc (Layout::finish_dynamic_section): Implement
7675         --warn-shared-textrel.
7676
7677         PR 10980
7678         * options.h (class General_options): Add --warn-multiple-gp.
7679
7680 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7681
7682         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7683         $(THREADSLIB) and $(LIBDL).
7684         * Makefile.in: Rebuild.
7685
7686 2010-01-06  Ian Lance Taylor  <iant@google.com>
7687
7688         PR 10980
7689         * options.cc (General_options::parse_section_start): New function.
7690         (General_options::section_start): New function.
7691         (General_options::General_options): Initialize all members.
7692         * options.h: Include <map>
7693         (class General_options): Add --section-start.  Add section_starts_
7694         member.
7695         * layout.cc (Layout::attach_allocated_section_to_segment): If
7696         --section-start was used, set the address of the segment.  Remove
7697         local sort_sections.
7698         (Layout::relaxation_loop_body): If the address of the load segment
7699         has been set by --section-start, don't use it.
7700         * output.h (Output_segment::update_flags_for_output_section): New
7701         function.
7702         * output.cc (Output_segment::add_output_section): Call
7703         update_flags_for_output_section.
7704
7705 2010-01-05  Ian Lance Taylor  <iant@google.com>
7706
7707         PR 10980
7708         * options.h (class General_options): Add --undefined-version.
7709         * script.cc (struct Version_expression): Add was_matched_by_symbol
7710         field.
7711         (Version_script_info::matched_symbol): New function.
7712         (Version_script_info::get_symbol_version_helper): Call
7713         matched_symbol.
7714         (Version_script_info::check_unmatched_names): New function.
7715         * script.h (class Version_script_info): Update declarations.
7716         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7717
7718         * options.h (class General_options): Use DEFINE_bool_alias for
7719         allow_multiple_definition.
7720         * resolve.cc (Symbol_table::should_override): Don't test
7721         allow_multiple_definition.
7722
7723         PR 10980
7724         * options.h (class General_options): Add --cref.
7725         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7726         until after printing cref table.
7727         * cref.cc: Include "symtab.h".
7728         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7729         (Cref_table_compare::operator()): New function.
7730         (Cref_inputs::gather_cref): New function.
7731         (filecol): New static const.
7732         (Cref_inputs::print_cref): New function.
7733         (Cref::print_cref): New function.
7734         * cref.h: Include <cstdio>.
7735         (class Cref): Update declarations.
7736         * mapfile.h (Mapfile::file): New function.
7737         * object.h (class Object): Define Symbols.  Declare virtual
7738         do_get_global_symbols.
7739         (Object::get_global_symbols): New function.
7740         * object.cc (Input_objects::add_object): Pass object to cref_ if
7741         --cref.
7742         (Input_objects::archive_start): Likewise.
7743         (Input_objects::archive_stop): Likewise.
7744         (Input_objects::print_cref): New function.
7745         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7746         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7747         --cref.
7748         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7749         function.
7750         * plugin.h (class Sized_pluginobj): Update declarations.
7751
7752 2010-01-05  Ian Lance Taylor  <iant@google.com>
7753
7754         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7755         to is_default_version.  Rename insdef to insdefault.
7756         (Symbol_table::add_from_relobj): Rename def to is_default_version
7757         and local to is_forced_local.
7758         (Symbol_table::add_from_pluginobj): Likewise.
7759         (Symbol_table::add_from_dynobj): Likewise.
7760         (Symbol_table::define_special_symbol): Rename insdef to
7761         insdefault.
7762
7763 2010-01-04  Ian Lance Taylor  <iant@google.com>
7764
7765         PR 10980
7766         * options.h (class General_options): Add
7767         --allow-multiple-definition and -z muldefs.
7768         * resolve.cc (Symbol_table::should_override): Don't warn about a
7769         multiple symbol definition if --allow-multiple-definition or -z
7770         muldefs.
7771
7772         PR 10980
7773         * options.h (class General_options): Add --add-needed and
7774         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7775         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7776         error if --copy-dt-needed-entries aka --add-needed is used and
7777         would cause a change in behaviour.
7778
7779         PR 10980
7780         * options.h (class General_options): Add -G as a short version of
7781         --shared.  Add no-op options -assert, -g, and -i.
7782
7783 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7784
7785         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7786         check for .text or .gnu.linkonce.t sections.
7787         * icf.cc (Icf::find_identical_sections): Ditto.
7788         Change the detection for mangled function name within the section
7789         name.
7790         * icf.h (is_section_foldable_candidate): New function.
7791
7792 2009-12-30  Ian Lance Taylor  <iant@google.com>
7793
7794         PR 10980
7795         * options.h (class General_options): Permit two dashes with
7796         --retain-symbols-file.
7797
7798 2009-12-30  Ian Lance Taylor  <iant@google.com>
7799
7800         PR 10979
7801         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7802         don't put the file header and segment headers in the text
7803         segment.
7804
7805         PR 10979
7806         * common.cc (Sort_commons::operator()): Stabilize sort when both
7807         entries are NULL.
7808         (Symbol_table::do_allocate_commons_list): When allocating common
7809         symbols, skip a symbol which is no longer common.
7810         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7811         an object before checking its type.
7812         * testsuite/common_test_2.c: New file.
7813         * testsuite/common_test_3.c: New file.
7814         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7815         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7816         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7817         (common_test_2_pic.o, common_test_2.so): New targets.
7818         (common_test_3_pic.o, common_test_3.so): New targets.
7819         * testsuite/Makefile.in: Rebuild.
7820
7821         PR 10979
7822         * script.cc (read_input_script): If we see a new SECTIONS clause,
7823         and we have added an input section, give an error.
7824         * layout.h (class Layout): Add have_added_input_section function.
7825         Add have_added_input_section_ field.
7826         * layout.cc (Layout::Layout): Initialize
7827         have_added_input_section_.
7828         (Layout::layout): Set have_added_input_section_.
7829         (Layout::layout_eh_frame): Likewise.
7830
7831 2009-12-30  Ian Lance Taylor  <iant@google.com>
7832
7833         PR 10931
7834         * options.h (class General_options): Add --sort-common option.
7835         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7836         * common.cc (Sort_common): Add sort_order parameter to
7837         constructor.  Add sort_order_ field.
7838         (Sort_commons::operator): Check sort_order_.
7839         (Symbol_table::allocate_commons): Determine the sort order.
7840         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7841         Change all callers.
7842         (Symbol_table::do_allocate_commons_list): Likewise.
7843
7844 2009-12-30  Ian Lance Taylor  <iant@google.com>
7845
7846         PR 10916
7847         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7848         symbols from this object, don't change the visibility of an
7849         undefined symbol.
7850         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7851
7852 2009-12-30  Ian Lance Taylor  <iant@google.com>
7853
7854         PR 10861
7855         * script.h (class Version_script_info): Define Language enum.
7856         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7857         new fields globals_, locals_, and is_finalized_.
7858         * script.cc: Various formatting fixes.
7859         (class Parser_closure): Change language_stack_ from a vector of
7860         std::string to one of Version_script_info::Language.  Adjust all
7861         uses accordingly.
7862         (class Lazy_demangler): Remove.
7863         (struct Version_expression): Change language from std::string to
7864         Version_script_info::Language.
7865         (Version_script_info::Version_script_info): New function.
7866         (Version_script_info::~Version_script_info): Don't call clear.
7867         (Version_script_info::finalize): New function.
7868         (Version_script_info::build_lookup_tables): New function.
7869         (Version_script_info::build_expression_list_lookup): New
7870         function.
7871         (Version_script_info::get_symbol_version_helper): Rewrite to use
7872         lookup tables.
7873         (Version_script_info::print_expression_list): Adjust to use
7874         Version_script_info::Language.
7875         (script_push_lex_into_version_mode): Check that the version script
7876         has not been finalized.
7877         (version_script_push_lang): Change language string to
7878         Version_script_info::Language.
7879         * options.cc (Command_line::version_script): New function.
7880         * options.h (class General_options): Add finalize_dynamic_list
7881         function.  Change version_script from declaration to definition.
7882         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7883         * testsuite/version_script.map: Remove duplicate def of foo.
7884         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7885         version_script.map.
7886         * testsuite/Makefile.in: Rebuild.
7887
7888 2009-12-30  Ian Lance Taylor  <iant@google.com>
7889
7890         PR 10843
7891         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7892         if the input symbol index is 0, make the output symbol index 0.
7893
7894 2009-12-30  Ian Lance Taylor  <iant@google.com>
7895
7896         PR 10670
7897         * options.h (class General_options): Add -x/--discard-all.
7898         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7899         --discard-all.  If the local symbol needs a dynamic entry, check
7900         that before handling --discard-locals.
7901
7902 2009-12-30  Ian Lance Taylor  <iant@google.com>
7903
7904         PR 10450
7905         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7906         flags to PF_R.
7907         (Output_segment::add_output_section): Don't change the flags if
7908         the type is PT_TLS.
7909
7910         PR 10450
7911         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7912         GNU hash table if they need a dynamic value.  Otherwise, don't add
7913         them if they are defined in a dynamic object or are forced local.
7914
7915 2009-12-29  Ian Lance Taylor  <iant@google.com>
7916
7917         PR 10450
7918         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7919         .gnu.hash table for a 32-bit target.
7920
7921         PR 10450
7922         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7923         regular and a dynamic object only needs a dynamic symbol table
7924         entry if it is externally visible.
7925
7926         PR 10450
7927         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7928         constructor.  Add global_offset_table_ field.
7929         (Target_i386::got_section): Set global_offset_table_.
7930         (Target_i386::do_finalize_sections): Set global_offset_table_
7931         size.
7932         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7933         in constructor.  Add global_offset_table_ field.
7934         (Target_x86_64::got_section): Set global_offset_table_.
7935         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7936         size.
7937
7938         * layout.cc (Layout::Layout): Initialize increase_relro_.
7939         (Layout::get_output_section): Add is_relro, is_last_relro, and
7940         is_first_non_relro parameters.  Change all callers.
7941         (Layout::choose_output_section): Likewise.
7942         (Layout::add_output_section_data): Likewise.
7943         (Layout::make_output_section): Likewise.
7944         (Layout::set_segment_offsets): Clear increase_relro when using a
7945         linker script.
7946         * layout.h (class Layout): Add increase_relro method.  Add
7947         increase_relro_ field.  Update declarations.
7948         * output.cc (Output_section::Output_section): Initialize
7949         is_last_relro_ and is_first_non_relro_.
7950         (Output_segment::add_output_section): Group relro sections is
7951         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7952         (Output_segment::maximum_alignment): Remove relro handling.
7953         (Output_segment::set_section_addresses): Add increase_relro
7954         parameter.  Change all callers.  Add initial alignment to align
7955         relro sections on separate page.  Remove old relro handling.
7956         (Output_segment::set_section_list_addresses): Remove in_relro
7957         parameter.  Change all callers.
7958         (Output_segment::set_offset): Add increase parameter.  Change all
7959         callers.  Remove old relro handling.
7960         * output.h (class Output_section): Add new methods: is_last_relro,
7961         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7962         Add is_last_relro_ and is_first_non_relro_ fields.
7963         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7964         Create separate .got.plt section.  Call increase_relro.
7965         * x86_64.cc (Target_x86_64::got_section): Likewise.
7966         * testsuite/relro_script_test.t: Add .got.plt.
7967
7968         PR 10450
7969         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7970         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7971         (Layout::finalize): Call set_dynamic_symbol_size.
7972         (Layout::set_dynamic_symbol_size): New function.
7973         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7974         set_dynamic_symbol_size.
7975
7976         PR 10450
7977         * output.h (class Output_section): Add is_entsize_zero_ field.
7978         * output.cc (Output_section::Output_section): Initialize
7979         is_entsize_zero_.
7980         (Output_section::set_entsize): If two different entsizes are
7981         requested, force it to zero.
7982         (Output_section::add_input_section): Set flags for .debug_str
7983         before updating section flags.  Set entsize.
7984         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7985         and SHF_STRING if all input sections have those flags.
7986
7987 2009-12-29   Rafael Espindola  <espindola@google.com>
7988
7989         * main.cc (main): Fix the sys time reporting.
7990         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7991         reporting.
7992
7993 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7994
7995         * options.cc (General_options::parse_version): Allow -v to exit
7996         without an error if there is nothing to link.
7997
7998 2009-12-29  Ian Lance Taylor  <iant@google.com>
7999
8000         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8001         using a version of gcc before 4.1.
8002         * configure: Rebuild.
8003
8004 2009-12-28  Chris Demetriou  <cgd@google.com>
8005
8006         * attributes.cc (Output_attributes_section_data::do_write): Use
8007         std::vector::front rather than std::vector::data.
8008
8009 2009-12-28  Ian Lance Taylor  <iant@google.com>
8010
8011         * symtab.h (class Symbol_table): Add enum Defined.
8012         * resolve.cc (Symbol_table::should_override): Add defined
8013         parameter.  Change all callers.  Test whether object is NULL
8014         before calling a method on it.
8015         (Symbol_table::report_resolve_problem): Add defined parameter.
8016         Change all callers.
8017         (Symbol_table::should_override_with_special): Likewise.
8018         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8019         parameter.  Change all callers.
8020         (Symbol_table::do_define_in_output_data): Likewise.
8021         (Symbol_table::define_in_output_segment): Likewise.
8022         (Symbol_table::do_define_in_output_segment): Likewise.
8023         (Symbol_table::define_as_constant): Likewise.
8024         (Symbol_table::do_define_as_constant): Likewise.
8025         * script.h (class Symbol_assignment): Add is_defsym parameter to
8026         constructor; change all callers.
8027         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8028         parameter.  Change all callers.  Add is_defsym_ field.
8029         (class Parser_closure): Add parsing_defsym parameter to
8030         constructor; change all callers.  Add parsing_defsym accessor
8031         function.  Add parsing_defsym_ field.
8032
8033 2009-12-28  Ian Lance Taylor  <iant@google.com>
8034
8035         * gold.cc (queue_middle_tasks): Fix formatting.
8036         * object.cc (Relobj::is_section_name_included): Likewise.
8037
8038 2009-12-23  Ian Lance Taylor  <iant@google.com>
8039
8040         * i386.cc (Target_i386::do_calls_non_split): Recognize
8041         -fsplit-stack prologue for a function with a static chain.
8042         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8043         -fsplit-stack prologue when using %r11.
8044
8045 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8046
8047         * options.cc (General_options::parse_version): Make -v continue and do
8048         the link like GNU ld does.
8049
8050 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8051
8052         * Makefile.am (CCFILES): Add timer.cc.
8053         (HFILES): Add timer.h.
8054         * configure.ac: Check for sysconf and times.
8055         * main.cc: include timer.h.
8056         (main): Use Timer instead of get_run_time.
8057         * timer.cc: New.
8058         * timer.h: New.
8059         * workqueue.cc: include timer.h.
8060         (Workqueue::find_and_run_task):
8061         Report user, sys and wall time.
8062         * Makefile.in: Regenerate.
8063         * config.in: Regenerate.
8064         * configure: Regenerate.
8065
8066 2009-12-16  Doug Kwan  <dougkwan@google.com>
8067
8068         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8069         sections.
8070         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8071         relaxed input sections.
8072         * output.cc (Output_section::find_relaxed_input_section): Change
8073         return type to Output_relaxed_input_section pointer.  Adjust code
8074         for new type of relaxed_input_section_map_.
8075         * output.h (Output_section::find_relaxed_input_section): Change
8076         return type to Output_relaxed_input_section pointer.
8077         (Output_section::Output_relaxed_input_section_by_input_section_map):
8078         New type.
8079         (Output_section::relaxed_input_section_map_): Change type to
8080         Output_section::Output_relaxed_input_section_by_input_section_map.
8081         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8082         input section.
8083
8084 2009-12-15  Ian Lance Taylor  <iant@google.com>
8085
8086         * layout.cc (Layout::create_shstrtab): Only write out after input
8087         sections if we are compressing debug sections.
8088
8089 2009-12-15  Ian Lance Taylor  <iant@google.com>
8090
8091         * archive.cc (Archive::add_symbols): Only look up a symbol without
8092         a version if there is, in fact, a version.
8093
8094 2009-12-14  Ian Lance Taylor  <iant@google.com>
8095
8096         Revert -Wshadow changes, all changes from:
8097         2009-12-11  Doug Kwan  <dougkwan@google.com>
8098         2009-12-11  Nick Clifton  <nickc@redhat.com>
8099         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8100
8101 2009-12-11  Doug Kwan  <dougkwan@google.com>
8102
8103         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8104         due to -Wshadow.
8105         * attributes.cc (Object_attribute::size): Ditto.
8106         (Attributes_section_data::size): Ditto.
8107         (Attributes_section_data::Attributes_section_data): Ditto.
8108         (Output_attributes_section_data::do_write): Ditto.
8109         * attributes.h (Object_attribute::set_type): Ditto.
8110         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8111
8112 2009-12-11  Nick Clifton  <nickc@redhat.com>
8113
8114         * archive.cc: Fix shadowed variable warnings.
8115         * arm.cc: Likewise.
8116         * compressed_output.cc: Likewise.
8117         * compressed_output.h: Likewise.
8118         * configure: Likewise.
8119         * dwarf_reader.cc: Likewise.
8120         * dynobj.cc: Likewise.
8121         * dynobj.h: Likewise.
8122         * ehframe.cc: Likewise.
8123         * ehframe.h: Likewise.
8124         * errors.cc: Likewise.
8125         * expression.cc: Likewise.
8126         * fileread.cc: Likewise.
8127         * fileread.h: Likewise.
8128         * freebsd.h: Likewise.
8129         * i386.cc: Likewise.
8130         * icf.cc: Likewise.
8131         * incremental.h: Likewise.
8132         * layout.cc: Likewise.
8133         * layout.h: Likewise.
8134         * mapfile.cc: Likewise.
8135         * merge.cc: Likewise.
8136         * merge.h: Likewise.
8137         * object.cc: Likewise.
8138         * object.h: Likewise.
8139         * options.h: Likewise.
8140         * output.cc: Likewise.
8141         * output.h: Likewise.
8142         * parameters.cc: Likewise.
8143         * plugin.cc: Likewise.
8144         * powerpc.cc: Likewise.
8145         * reduced_debug_output.cc: Likewise.
8146         * reduced_debug_output.h: Likewise.
8147         * reloc.cc: Likewise.
8148         * reloc.h: Likewise.
8149         * resolve.cc: Likewise.
8150         * script-sections.cc: Likewise.
8151         * script.cc: Likewise.
8152         * script.h: Likewise.
8153         * sparc.cc: Likewise.
8154         * symtab.cc: Likewise.
8155         * symtab.h: Likewise.
8156         * target-select.cc: Likewise.
8157         * target-select.h: Likewise.
8158         * token.h: Likewise.
8159         * workqueue.cc: Likewise.
8160         * workqueue.h: Likewise.
8161         * x86_64.cc: Likewise.
8162
8163 2009-12-10  Doug Kwan  <dougkwan@google.com>
8164
8165         * arm.cc (attributes.h): New include.
8166         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8167         (Arm_relobj::~Arm_relobj): Delete object pointed by
8168         attributes_section_data_.
8169         (Arm_relobj::attributes_section_data): New method definition.
8170         (Arm_relobj::attributes_section_data_): New data member declaration.
8171         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8172         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8173         attributes_section_data_.
8174         (Arm_dynobj::attributes_section_data): New method definition.
8175         (Arm_dynobj::attributes_section_data_): New data member declaration.
8176         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8177         initialization value of may_use_blx_ to false.
8178         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8179         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8180         object attributes to compute results instead of hard-coding.
8181         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8182         Target_arm::get_secondary_compatible_arch,
8183         Target_arm::set_secondary_compatible_arch
8184         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8185         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8186         New method declarations.
8187         (Target_arm::get_aeabi_object_attribute): New method definition.
8188         (Target_arm::attributes_section_data_): New data member declaration.
8189         (read_arm_attributes_section): New template definition.
8190         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8191         (Arm_dynobj::do_read_symbols): Ditto.
8192         (Target_arm::do_finalize_sections): Merge attributes sections from
8193         input.  Check for BLX use after attributes section merging.
8194         Fix __exidx_start and __exidx_end visibility.  Create an
8195         .ARM.attributes section if necessary.
8196         (Target_arm::get_secondary_compatible_arch,
8197         Target_arm::set_secondary_compatible_arch,
8198         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8199         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8200         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8201         New method definitions.
8202
8203 2009-12-09  Ian Lance Taylor  <iant@google.com>
8204
8205         * plugin.cc (Plugin::load): Don't cast from void* to a function
8206         pointer.
8207
8208 2009-12-09  Ian Lance Taylor  <iant@google.com>
8209
8210         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8211         information fields.
8212
8213 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8214
8215         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8216         Replace two_file_shared_1.so with two_file_shared_2.so.
8217         * testsuite/Makefile.in: Regenerated.
8218
8219 2009-12-08  Doug Kwan  <dougkwan@google.com>
8220
8221         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8222         (HFILES): Add attributes.h and int_encoding.h.
8223         * Makefile.in: Regenerate.
8224         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8225         function definitions to int_encoding.cc
8226         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8227         prototypes to int_encoding.h
8228         * reduced_debug_output.cc (int_encoding.h): New include.
8229         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8230         function definitions to int_encoding.cc
8231         (insert_into_vector, read_from_pointer): Move template definitions to
8232         int_encoding.h
8233         * attributes.cc: New file.
8234         * attributes.h: New file.
8235         * int_encoding.cc: New file.
8236         * int_encoding.h: New file.
8237
8238 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8239
8240         PR gold/11055
8241         * incremental-dump.cc (dump_incremental_inputs): New.
8242         (main): Use dump_incremental_inputs.
8243
8244 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8245
8246         PR gold/10893
8247         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8248         checking elfcpp::STT_FUNC.
8249         (Target_i386::Relocate::relocate): Likewise.
8250         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8251
8252         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8253         symbols from shared libraries into normal FUNC symbols.
8254
8255         * symtab.h (Symbol): Add is_func and use it.
8256
8257 2009-12-05  Doug Kwan  <dougkwan@google.com>
8258
8259         * arm.cc (Target_arm::arm_info): Initialize new fields
8260         attributes_section and attributes_vendor.
8261         * i386.cc (Target_i386::i386_info): Same.
8262         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8263         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8264         fields attributes_section and attributes_vendor.
8265         * sparc.cc (Target_sparc::sparc_info): Same.
8266         * target.h (Target::attributes_section, Target::attributes_vendor,
8267         Target::is_attributes_section, Target::attribute_arg_type,
8268         Target::attributes_order): New method definitions.
8269         (Target::Target_info::attributes_section,
8270         Target::Target_info::attributes_vendor): New fields.
8271         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8272         virtual method definitions.
8273         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8274         attributes_section and attributes_vendor.
8275         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8276
8277 2009-12-05  Doug Kwan  <dougkwan@google.com>
8278
8279         * arm.cc: Update comments about interworking and stub generation.
8280         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8281         considered as non-PIC.
8282         (Arm_relocate_functions::base_abs): Fix formatting.
8283         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8284         of function to use GOT entry address instead of offset.
8285         (Target_arm::Scan::global): Issue an error if a symbol would need a
8286         PLT does not get one because it is untyped.  Remove code to create
8287         dynamic symbols for relative branches.
8288         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8289         takes unsigned integer instead of boolean.
8290
8291 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8292
8293         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8294         (two_file_test_LDADD): Likewise.
8295         (common_test_1_LDADD): Likewise.
8296         (exception_test_LDADD) Likewise.
8297         (weak_test_LDADD): Likewise.
8298         (many_sections_test_LDADD): Likewise.
8299         (initpri1_LDADD): Likewise.
8300         (script_test_1_LDADD): Likewise.
8301         (script_test_2_LDADD): Likewise.
8302         (justsyms_LDADD): Likewise.
8303         (binary_test_LDADD): Likewise.
8304         (large_LDADD): Likewise.
8305         * testsuite/Makefile.in: Regenerated.
8306
8307 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8308
8309         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8310         (Symbol_table::override_with_special): Likewise.
8311         (Symbol_table::add_from_object): Likewise.
8312
8313 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8314
8315         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8316         Don't set the data_offset twice.
8317
8318 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8319
8320         * testsuite/Makefile.in: Regenerate.
8321
8322 2009-12-03  Doug Kwan  <dougkwan@google.com>
8323
8324         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8325         (Target_arm::do_finalize_sections): Add parameter for symbol table
8326         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8327         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8328         parameter for symbol table pointer.
8329         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8330         an additional parameter for a pointer to symbol table.
8331         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8332         parameter for a symbol table pointer.
8333         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8334         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8335         Ditto.
8336         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8337         parameter for a symbol table pointer.
8338
8339 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8340
8341         * incremental.cc (Incremental_inputs_header)
8342         (Incremental_inputs_header_write, Incremental_inputs_entry)
8343         (Incremental_inputs_entry_write): Move ...
8344         * incremental.h (Incremental_inputs_header)
8345         (Incremental_inputs_header_write, Incremental_inputs_entry)
8346         (Incremental_inputs_entry_write): here.
8347
8348 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8349
8350         * incremental.cc (make_sized_incremental_binary): Set the target.
8351         Error if it is incompatible.
8352         * output.h (Output_file): Add filename method.
8353
8354 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8355
8356         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8357         from the get_* methods.
8358
8359 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8360
8361         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8362         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8363         Write 0 for the data_offset of scripts.
8364
8365 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8366
8367         * testsuite/Makefile.am: Add the incremental_test.sh test.
8368         * testsuite/incremental_test.sh: New.
8369         * testsuite/incremental_test_1.c: New.
8370         * testsuite/incremental_test_2.c: New.
8371
8372 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8373
8374         * incremental-dump.cc (main): Fix typos.
8375
8376 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8377
8378         PR gold/11025
8379         * incremental-dump.cc (main): Use llu to print 64 bit values.
8380
8381 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8382             H.J. Lu  <hongjiu.lu@intel.com>
8383
8384         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8385         $(LIBDL).
8386         (incremental_dump_LDADD): Likewise.
8387         * Makefile.in: Regenerated.
8388
8389 2009-11-25  Doug Kwan  <dougkwan@google.com>
8390
8391         Revert:
8392
8393         2009-11-25  Doug Kwan  <dougkwan@google.com>
8394
8395                 * arm.cc (Target_arm::Target_arm): Move method definition
8396                 outside of class definition.  Add code to handle
8397                 --target1-rel, --target1-abs and --target2= options.
8398                 (Target_arm::get_reloc_reloc_type): Change method to be
8399                 non-static and const.
8400                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8401                 New data member declaration.
8402                 (Target_arm::Scan::local, Target_arm::Scan::global,
8403                 Target_arm::Relocate::relocate,
8404                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8405                 Adjust call to Target_arm::get_real_reloc_type.
8406                 (Target_arm::get_real_reloc_type): Use command line options
8407                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8408                 * options.h (--target1-rel, --target1-abs, --target2): New
8409                 ARM-only options.
8410
8411 2009-11-25  Doug Kwan  <dougkwan@google.com>
8412
8413         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8414         class definition.  Add code to handle --target1-rel, --target1-abs
8415         and --target2= options.
8416         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8417         and const.
8418         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8419         member declaration.
8420         (Target_arm::Scan::local, Target_arm::Scan::global,
8421         Target_arm::Relocate::relocate,
8422         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8423         call to Target_arm::get_real_reloc_type.
8424         (Target_arm::get_real_reloc_type): Use command line options to
8425         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8426         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8427         options.
8428
8429 2009-11-25  Doug Kwan  <dougkwan@google.com>
8430
8431         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8432         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8433         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8434         formatting.
8435         (Arm_relocate_functions::thm_call): Replace body with a call to
8436         Arm_relocate_functions::thumb_branch_common.
8437         (Arm_relocate_functions::thm_jump24,
8438         Arm_relocate_functions::thm_xpc22): New method definitions.
8439         (Arm_relocate_functions::thumb_branch_common): New method definition.
8440         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8441         operator.
8442         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8443         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8444
8445 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8446
8447         * Makefile.am: Build incremental-dump
8448         * Makefile.in: Regenerate.
8449         * incremental-dump.cc: New.
8450         * incremental.cc (Incremental_inputs_header_data,
8451         Incremental_inputs_entry_data): Move to incremental.h
8452         * incremental.h: (Incremental_inputs_header_data,
8453         Incremental_inputs_entry_data): Move from incremental.cc
8454
8455 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8456
8457         * incremental.cc (Incremental_inputs_header,
8458         Incremental_inputs_header_write, Incremental_inputs_entry,
8459         Incremental_inputs_entry_write): Add a typedef with the data type.
8460
8461 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8462
8463         * incremental.cc (Incremental_inputs_header,
8464         Incremental_inputs_header_write, Incremental_inputs_entry,
8465         Incremental_inputs_entry_write): Update comment about which
8466         type has the filed descriptions.
8467
8468 2009-11-15  Doug Kwan  <dougkwan@google.com>
8469
8470         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8471         (Arm_relocate_functions::arm_branch_common): Change method defintion
8472         in class definition to a method declaration and update list of formal
8473         parameters.
8474         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8475         Arm_relocation_functions::jump24): Adjust call to
8476         Arm_relocate_functions::arm_branch_common.  Update list of formal
8477         parameters.
8478         (Arm_relocate_functions::xpc25): New method definition.
8479         (Arm_relocate_functions::arm_branch_common): Move method defintion
8480         out from class definition.  Use stubs for mode-switching and extending
8481         branch ranges.
8482         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8483         specially.  Change code to enable use of stubs in ARM branches.
8484
8485 2009-11-10  Doug Kwan  <dougkwan@google.com>
8486
8487         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8488         in method declaration.
8489         (Target_arm::relocate_stub): New method declaration.
8490         (Target_arm::default_target): Change to return a pointer instead of
8491         a const reference.
8492         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8493         Target_arm::default_target.
8494         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8495         method definition.
8496         (Target_arm::relocate_section): Adjust view.
8497         (Target_arm::relocate_stub): New method definition.
8498
8499 2009-11-10  Doug Kwan  <dougkwan@google.com>
8500
8501         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8502         a format warning.
8503         * incremental.cc (open_incremental_binary): Initialized local
8504         variables to avoid warnings.
8505         * object.cc (make_elf_object): Ditto.
8506         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8507         a format warning.
8508
8509 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8510
8511         PR gold/10930
8512         * testsuite/plugin_test.c: Include "config.h".
8513
8514 2009-11-09  Doug Kwan  <dougkwan@google.com>
8515
8516         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8517         (arm_symbol_value): Remove.
8518         (Arm_relocate_functions::arm_branch_common,
8519         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8520         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8521         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8522         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8523         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8524         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8525         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8526         Arm_relocate_functions::thm_mobw_abs_nc,
8527         Arm_relocate_functions::thm_mov_abs,
8528         Arm_relocate_functions::movw_prel_nc,
8529         Arm_relocate_functions::thm_movt_abs,
8530         Arm_relocate_functions::movt_prel,
8531         Arm_relocate_functions::thm_movw_prel_nc,
8532         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8533         (Target_arm::Relocate::relocate): Only decompose address into two
8534         parts if relocation type uses the thumb-bit and pass the actual
8535         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8536         calls to methods in Arm_relocate_functions for this change.
8537
8538 2009-11-08  Ian Lance Taylor  <iant@google.com>
8539
8540         PR 10925
8541         * reloc.cc: Instantiate
8542         Sized_relobj::initialize_input_to_output_maps and
8543         Sized_relobj:free_input_to_output_maps.
8544
8545 2009-11-06  Ian Lance Taylor  <iant@google.com>
8546
8547         PR 10876
8548         * defstd.cc (in_segment): Set only_if_ref true for "end".
8549
8550 2009-11-06  Doug Kwan  <dougkwan@google.com>
8551
8552         * arm.cc (class Reloc_stub): Correct a comment.
8553         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8554         (Target_arm::scan_section_for_stubs): New method declaration.
8555         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8556         Change methods from private to protected.
8557         (Target_arm::do_may_relax): New method definition.
8558         (Target_arm::do_relax, Target_arm::group_sections,
8559         Target_arm::scan_reloc_for_stub,
8560         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8561         (Target_arm::arm_input_section_map_): New data member declaration.
8562         (Target_arm::scan_reloc_for_stub,
8563         Target_arm::scan_reloc_section_for_stubs,
8564         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8565         Target_arm::do_relax): New method definitions.
8566
8567 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8568
8569         * configure.ac: Check for (struct stat)::st_mtim
8570         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8571         * config.in: Regenerate.
8572         * configure: Regenerate.
8573
8574 2009-11-05  Ian Lance Taylor  <iant@google.com>
8575
8576         PR 10910
8577         * output.cc (Output_segment::add_output_section): Add missing
8578         return statement.
8579
8580 2009-11-04  Ian Lance Taylor  <iant@google.com>
8581
8582         PR 10880
8583         * object.h (class Object): Add is_needed and set_is_needed
8584         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8585         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8586         defined in a dynamic object and referenced by a regular object,
8587         set is_needed for the dynamic object.
8588         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8589         if the file is marked with as_needed and it is not needed.
8590
8591 2009-11-04  Ian Lance Taylor  <iant@google.com>
8592
8593         PR 10887
8594         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8595         tags if data is discarded by linker script.
8596         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8597         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8598         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8599         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8600
8601 2009-11-04  Ian Lance Taylor  <iant@google.com>
8602
8603         * layout.cc (Layout::get_output_section): Add is_interp and
8604         is_dynamic_linker_section parameters.  Change all callers.
8605         (Layout::choose_output_section): Likewise.
8606         (Layout::make_output_section): Likewise.
8607         (Layout::add_output_section_data): Add is_dynamic_linker_section
8608         parameter.  Change all callers.
8609         * layout.h (class Layout): Update declarations.
8610         * output.h (class Output_section): Add is_interp, set_is_interp,
8611         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8612         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8613         generate_code_fills_at_write_ to a bitfield.
8614         * output.cc (Output_section::Output_sections): Initialize new
8615         fields.
8616         (Output_segment::add_output_section): Add do_sort parameter.
8617         Change all callers.
8618
8619 2009-11-03  Ian Lance Taylor  <iant@google.com>
8620
8621         PR 10860
8622         * options.h (class General_options): Add --warn-common.
8623         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8624         merging two common symbols.
8625         (Symbol_table::should_override): Handle --warn-common when merging
8626         a common symbol with a defined symbol.  Use report_resolve_problem
8627         for multiple definitions.
8628         (Symbol_table::report_resolve_problem): New function.
8629         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8630
8631 2009-11-03  Doug Kwan  <dougkwan@google.com>
8632
8633         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8634         stub_factory_.
8635         (Target_arm::stub_factory): New method definition.
8636         (Target_arm::new_arm_input_section,
8637         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8638         Target_arm::reloc_uses_thumb_bit): New method declarations.
8639         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8640         New type definitions.
8641         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8642         member declarations.
8643         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8644         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8645         New method definitions.
8646
8647 2009-11-03  Ian Lance Taylor  <iant@google.com>
8648
8649         * options.h (class General_options): Add --warn_constructors.
8650
8651 2009-11-03  Ian Lance Taylor  <iant@google.com>
8652
8653         PR 10893
8654         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8655         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8656
8657 2009-11-03  Ian Lance Taylor  <iant@google.com>
8658
8659         PR 10895
8660         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8661         --msgid-bugs-address.
8662         (install-pdf): New target.
8663         (install-data_yes): Look up one directory to find mkinstalldirs.
8664
8665 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8666
8667         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8668         tree.
8669
8670 2009-10-30  Doug Kwan  <dougkwan@google.com>
8671
8672         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8673
8674 2009-10-30  Doug Kwan  <dougkwan@google.com>
8675
8676         * arm.cc (Stub_addend_reader): New struct template definition
8677         and partial specializations.
8678         (Stub_addend_reader::operator()): New method definition for a
8679         partially specialized template.
8680
8681 2009-10-30  Doug Kwan  <dougkwan@google.com>
8682
8683         * arm.cc (Arm_relobj::processor_specific_flags): New method
8684         definition.
8685         (Arm_relobj::do_read_symbols): New method declaration.
8686         (Arm_relobj::processor_specific_flags_): New data member declaration.
8687         (Arm_dynobj): New class definition.
8688         (Target_arm::do_finalize_sections): Add input_objects parameter.
8689         (Target_arm::do_adjust_elf_header): New method declaration.
8690         (Target_arm::are_eabi_versions_compatible,
8691         (Target_arm::merge_processor_specific_flags): New method declaration.
8692         (Target_arm::do_make_elf_object): New overloaded method definitions
8693         and declaration.
8694         (Arm_relobj::do_read_symbols): New method definition.
8695         (Arm_dynobj::do_read_symbols): Ditto.
8696         (Target_arm::do_finalize_sections): Add input_objects parameters.
8697         Merge processor-specific flags from all input objects.
8698         (Target_arm::are_eabi_versions_compatible,
8699         Target_arm::merge_processor_specific_flags,
8700         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8701         New method definitions.
8702         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8703         Input_objects pointer type parameter.
8704         * layout.cc (Layout::finalize): Pass input objects to target's.
8705         finalize_sections function.
8706         * output.cc (Output_file_header::do_sized_write): Set ELF file
8707         header's processor-specific flags.
8708         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8709         Input_objects pointer type parameter.
8710         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8711         * target.h (Input_objects): New forward class declaration.
8712         (Target::processor_specific_flags,
8713         Target::are_processor_specific_flags_sect): New method definitions.
8714         (Target::finalize_sections): Add input_objects parameter.
8715         (Target::Target): Initialize processor_specific_flags_ and
8716         are_processor_specific_flags_set_.
8717         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8718         parameter.
8719         (Target::set_processor_specific_flags): New method definition.
8720         (Target::processor_specific_flags_,
8721         Target::are_processor_specific_flags_set_): New data member
8722         declarations.
8723         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8724         Input_objects pointer type parameter.
8725
8726 2009-10-30  Doug Kwan  <dougkwan@google.com>
8727
8728         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8729
8730 2009-10-28  Ian Lance Taylor  <iant@google.com>
8731
8732         * object.h (class Relobj): Drop options parameter from
8733         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8734         do_scan_relocs, do_relocate.  Change all callers.
8735         (class Sized_relobj): Drop options parameters from
8736         do_gc_process_relocs, do_scan_relocs, do_relocate,
8737         do_relocate_sections, relocate_sections, emit_relocs_scan,
8738         emit_relocs_scan_reltype.  Change all callers.
8739         (struct Relocate_info): Remove options field and all references to
8740         it.
8741         * reloc.h (class Read_relocs): Remove options constructor
8742         parameter and options_ field.  Change all callers.
8743         (class Gc_process_relocs, class Scan_relocs): Likewise.
8744         (class Relocate_task): Likewise.
8745         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8746         all callers.
8747         (scan_relocatable_relocs): Likewise.
8748         * target.h (class Sized_target): Remove options parameter from
8749         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8750         all callers.
8751         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8752         callers.
8753         * arm.cc: Update functions to remove options parameters.
8754         * i386.cc: Likewise.
8755         * powerpc.cc: Likewise.
8756         * sparc.cc: Likewise.
8757         * x86_64.cc: Likewise.
8758         * testsuite/testfile.cc: Likewise.
8759
8760 2009-10-28  Doug Kwan  <dougkwan@google.com>
8761
8762         * arm.cc (Arm_relobj): New class definition.
8763         (Arm_relobj::scan_sections_for_stubs,
8764         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8765         New method definitions.
8766
8767 2009-10-28  Cary Coutant  <ccoutant@google.com>
8768
8769         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8770         (Plugin::cleanup_done_): New member.
8771         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8772         (Plugin_manager::cleanup_done_): Remove.
8773         (Plugin_manager::add_input_file): Edit error message.
8774         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8775         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8776
8777 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8778
8779         * fileread.cc: (File_read::View::~View): Use the new
8780         data_ownership_ filed.
8781         (File_read::~File_read): Dispose the new whole_file_view_.
8782         (File_read::open): Mmap the whole file if needed.
8783         (File_read::open): Use whole_file_view_ instead of contents_.
8784         (File_read::find_view): Use whole_file_view_ if applicable.
8785         (File_read::do_read): Use whole_file_view_ instead of contents_.
8786         (File_read::make_view): Use whole_file_view_ instead of contents_,
8787         update File_read::View::View call.
8788         (File_read::find_or_make_view): Update File_read::View::View
8789         call.
8790         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8791         remove contents_
8792         (File_read::View::Data_ownership): New enum.
8793         (File_read::View::View): Replace bool mapped_ with Data_ownership
8794         argument.
8795         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8796         (File_read::View::data_ownership_): New field.
8797         (File_read::contents_): Remove (replaced by whole_file_view_).
8798         (File_read::whole_file_view_): New field.
8799         * options.h (class General_options): Add --keep-files-mapped.
8800
8801 2009-10-27  Cary Coutant  <ccoutant@google.com>
8802
8803         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8804         * testsuite/Makefile.am (plugin_test_5): New test case.
8805         * testsuite/Makefile.in: Regenerate.
8806
8807 2009-10-25  Doug Kwan  <dougkwan@google.com>
8808
8809         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8810         from private to protected to allow access by child class.
8811         (Sized_relobj::do_relocate_sections): New method declaration.
8812         (Sized_relobj::relocate_sections): Virtualize.
8813         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8814         Sized_relobj::relocate_sections.  Instantiate template explicitly
8815         for different target sizes and endianity.
8816
8817 2009-10-24  Doug Kwan  <dougkwan@google.com>
8818
8819         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8820         (Arm_input_section::as_arm_input_section): New method.
8821         (Arm_output_section): New class definition.
8822         (Arm_output_section::create_stub_group,
8823         Arm_output_section::group_sections): New method definitions.
8824
8825 2009-10-22  Doug Kwan  <dougkwan@google.com>
8826
8827         * arm.cc (Arm_input_section): New class definition.
8828         (Arm_input_section::init, Arm_input_section:do_write,
8829         Arm_input_section::set_final_data_size,
8830         Arm_input_section::do_reset_address_and_file_offset): New method
8831         definitions.
8832
8833 2009-10-21  Doug Kwan  <dougkwan@google.com>
8834
8835         * arm.cc (Stub_table, Arm_input_section): New forward class
8836         declarations.
8837         (Stub_table): New class defintion.
8838         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8839         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8840         New method definition.
8841
8842 2009-10-21  Doug Kwan  <dougkwan@google.com>
8843
8844         * arm.cc: Update copyright comments.
8845         (Target_arm): New forward class template declaration.
8846         (Arm_address): New type.
8847         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8848         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8849         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8850         constants.
8851         (Insn_template): Same.
8852         (DEF_STUBS): New macro.
8853         (Stub_type): New enum type.
8854         (Stub_template): New class definition.
8855         (Stub): Same.
8856         (Reloc_stub): Same.
8857         (Stub_factory): Same.
8858         (Target_arm::Target_arm): Initialize may_use_blx_ and
8859         should_force_pic_veneer_.
8860         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8861         Target_arm::should_force_pic_veneer,
8862         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8863         Target_arm::using_thumb_only, Target_arm:;default_target): New
8864         method defintions.
8865         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8866         New data member declarations.
8867         (Insn_template::size, Insn_template::alignment): New method defintions.
8868         (Stub_template::Stub_template): New method definition.
8869         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8870         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8871         (Stub_factory::Stub_factory): New method definition.
8872         * gold.h (string_hash): New template.
8873         * output.h (Input_section_specifier::hash_value): Use
8874         gold::string_hash.
8875         (Input_section_specifier::string_hash): Remove.
8876         * stringpool.cc (Stringpool_template::string_hash): Use
8877         gold::string_hash.
8878
8879 2009-10-20  Doug Kwan  <dougkwan@google.com>
8880
8881         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8882         symbols of relaxed input sections.
8883         * output.h (Output_section::find_relaxed_input_section): Make
8884         method public.
8885
8886 2009-10-16  Doug Kwan  <dougkwan@google.com>
8887
8888         * dynobj.cc (Versions::Versions): Initialize version_script_.
8889         Only insert base version symbol definition for a shared object
8890         if version script defines any version versions.
8891         (Versions::define_base_version): New method definition.
8892         (Versions::add_def): Check that base version is not needed.
8893         (Versions::add_need): Define base version lazily.
8894         * dynobj.h (Versions::define_base_version): New method declaration.
8895         (Versions::needs_base_version_): New data member declaration.
8896         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8897         (check_DATA): Add no_version_test.stdout.
8898         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8899         New make rules.
8900         * testsuite/Makefile.in: Regenerate.
8901         * testsuite/no_version_test.c: New file.
8902         * testsuite/no_version_test.sh: Ditto.
8903
8904 2009-10-16  Doug Kwan  <dougkwan@google.com>
8905
8906         * expression.cc (class Segment_start_expression): New class definition.
8907         (Segment_start_expression::value): New method definition.
8908         (script_exp_function_segment_start): Return a new
8909         Segment_start_expression.
8910         * gold/script-c.h (script_saw_segment_start_expression): New function
8911         prototype.
8912         * script-sections.cc (Script_sections::Script_sections): Initialize
8913         SAW_SEGMENT_START_EXPRESSION_ to false.
8914         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8915         and -Tbbs options to specify section addresses if given in
8916         command line and no SEGMENT_START expression is seen in a script.
8917         * script-sections.h (Script_sections::saw_segment_start_expression,
8918         Script_sections::set_saw_segment_start_expression): New method
8919         definition.
8920         (Script_sections::saw_segment_start_expression_): New data member
8921         declaration.
8922         * script.cc (script_saw_segment_start_expression): New function.
8923         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8924         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8925         script_test_7.sh and script_test_8.sh.
8926         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8927         script_test_8.stdout.
8928         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8929         (script_test_6, script_test_6.stdout, script_test_7,
8930         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8931         * Makefile.in: Regenerate.
8932         * testsuite/script_test_6.sh: New file.
8933         * testsuite/script_test_6.t: Same.
8934         * testsuite/script_test_7.sh: Same.
8935         * testsuite/script_test_7.t: Same.
8936         * testsuite/script_test_8.sh: Same.
8937
8938 2009-10-16  Doug Kwan  <dougkwan@google.com>
8939
8940         * output.cc (Output_segment::set_section_list_address): Cast
8941         expressions to unsigned long long type to avoid format warnings.
8942
8943 2009-10-15  Ian Lance Taylor  <iant@google.com>
8944
8945         * script.cc (Script_options::add_symbol_assignment): Always add a
8946         dot assignment to script_sections_.
8947         * script-sections.cc (Script_sections::add_dot_assignment):
8948         Initialize if necessary.
8949
8950         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8951         program headers with no load segment if there is a linker script.
8952
8953         * layout.cc (Layout::set_segment_offsets): Align the file offset
8954         to the segment aligment for -N or -n with no load segment.
8955         * output.cc (Output_segment::add_output_section): Don't crash if
8956         the first section is a TLS section.
8957         (Output_segment::set_section_list_addresses): Print an error
8958         message if the address moves backward in a linker script.
8959         * script-sections.cc
8960         (Output_section_element_input::set_section_addresses): Don't
8961         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8962         (Orphan_output_section::set_section_addresses): Likewise.
8963
8964 2009-10-15  Doug Kwan  <dougkwan@google.com>
8965
8966         * layout.cc (Layout::finish_dynamic_section): Generate tags
8967         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8968         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8969         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8970
8971 2009-10-14  Ian Lance Taylor  <iant@google.com>
8972
8973         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8974         fields.
8975         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8976         data_shdr fields of relinfo.
8977         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8978         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8979         R_386_TLS_LDO_32, adjust based on section flags.
8980         (Target_i386::Relocate::fix_up_ldo): Remove.
8981
8982 2009-10-13  Ian Lance Taylor  <iant@google.com>
8983
8984         Add support for -pie.
8985         * options.h (class General_options): Add -pie and
8986         --pic-executable.
8987         (General_options::output_is_position_independent): Test -pie.
8988         (General_options::output_is_executable): Return true if not shared
8989         and not relocatable.
8990         (General_options::output_is_pie): Remove.
8991         * options.cc (General_options::finalize): Reject incompatible uses
8992         of -pie.
8993         * gold.cc (queue_middle_tasks): A -pie link is not static.
8994         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8995         * symtab.cc (Symbol::final_value_is_known): Return false if
8996         output_is_position_independent.
8997         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8998         output_is_position_independent.
8999         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9000         output_is_position_independent.
9001         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9002         output_is_position_independent.
9003         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9004         two_file_pie_test.
9005         (basic_pie_test.o, basic_pie_test): New targets.
9006         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9007         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9008         (two_file_pie_test): New target.
9009         * testsuite/Makefile.in: Rebuild.
9010         * README: Remove note saying that -pie is not supported.
9011
9012 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9013
9014         * options.h (class General_options): Add -init and -fini.
9015         * layout.cc (Layout::finish_dynamic_section): Emit
9016         given init and fini functions.
9017
9018 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9019
9020         * gc.h (gc_process_relocs): Check if icf is enabled using new
9021         function.
9022         * gold.cc (queue_initial_tasks): Likewise.
9023         (queue_middle_tasks): Likewise.
9024         * object.cc (do_layout): Likewise.
9025         * symtab.cc (is_section_folded): Likewise.
9026         * main.cc (main): Likewise.
9027         * reloc.cc (Read_relocs::run): Likewise.
9028         (Sized_relobj::do_scan_relocs): Likewise.
9029         * icf.cc (is_function_ctor_or_dtor): New function.
9030         (Icf::find_identical_sections): Check if function is ctor or dtor when
9031         safe icf is chosen.
9032         * options.h (General_options::icf): Change option to be an enum.
9033         (Icf_status): New enum.
9034         (icf_enabled): New method.
9035         (icf_safe_folding): New method.
9036         (set_icf_status): New method.
9037         (icf_status_): New variable.
9038         * (options.cc) (General_options::finalize): Set icf_status_.
9039         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9040         icf_test and icf_keep_unique_test to use the --icf enum flag.
9041         * testsuite/icf_safe_test.sh: New file.
9042         * testsuite/icf_safe_test.cc: New file.
9043
9044 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9045
9046         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9047         includes to gc.h and icf.h.
9048         * arm.cc: Include gc.h.
9049         * gold.cc: Likewise.
9050         * i386.cc: Likewise.
9051         * powerpc.cc: Likewise.
9052         * sparc.cc: Likewise.
9053         * x86_64.cc: Likewise.
9054         * gc.h: Include icf.h.
9055
9056 2009-10-11  Ian Lance Taylor  <iant@google.com>
9057
9058         * plugin.cc: Include "gold.h" before other header files.
9059
9060 2009-10-10  Chris Demetriou  <cgd@google.com>
9061
9062         * options.h (Input_file_argument::Input_file_type): New enum.
9063         (Input_file_argument::is_lib_): Replace with...
9064         (Input_file_argument::type_): New member.
9065         (Input_file_argument::Input_file_argument): Take Input_file_type
9066         'type' rather than boolean 'is_lib' as second argument.
9067         (Input_file_argument::is_lib): Use type_.
9068         (Input_file_argument::is_searched_file): New function.
9069         (Input_file_argument::may_need_search): Handle is_searched_file.
9070         * options.cc (General_options::parse_library): Support -l:filename.
9071         (General_options::parse_just_symbols): Update for Input_file_argument
9072         changes.
9073         (Command_line::process): Likewise.
9074         * archive.cc (Archive::get_file_and_offset): Likewise.
9075         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9076         * script.cc (read_script_file, script_add_file): Likewise.
9077         * fileread.cc (Input_file::Input_file): Likewise.
9078         (Input_file::will_search_for): Handle is_searched_file.
9079         (Input_file::open): Likewise.
9080         * readsyms.cc (Read_symbols::get_name): Likewise.
9081         * testsuite/Makefile.am (searched_file_test): New test.
9082         * testsuite/Makefile.in: Regenerate.
9083         * testsuite/searched_file_test.cc: New file.
9084         * testsuite/searched_file_test_lib.cc: New file.
9085
9086 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9087             Ian Lance Taylor  <iant@google.com>
9088
9089         * descriptor.cc: Include <cstdio> and "binary-io.h".
9090         (Descriptors::open): Open the files in binary mode always.
9091         * script.cc (Lex::get_token): Treat \r as whitespace.
9092
9093 2009-10-09  Ian Lance Taylor  <iant@google.com>
9094
9095         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9096
9097 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9098             Ian Lance Taylor  <iant@google.com>
9099
9100         * configure.ac: Check for readv function also.
9101         * fileread.cc (readv): Define if not HAVE_READV.
9102         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9103         does not exist.
9104         * config.in: Regenerate.
9105         * configure: Regenerate.
9106
9107 2009-10-09  Doug Kwan  <dougkwan@google.com>
9108
9109         * layout.cc (Layout::make_output_section): Call target hook to make
9110         ordinary output section.
9111         (Layout::finalize): Adjust parameter list of call the
9112         Target::may_relax().
9113         * layout.h (class Layout::section_list): New method.
9114         * merge.h (Output_merge_base::entsize): Change visibility to public.
9115         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9116         New methods.
9117         (Output_merge_string::do_is_string): New method.
9118         * object.cc (Sized_relobj::do_setup): renamed from
9119         Sized_relobj::set_up.
9120         * object.h (Sized_relobj::adjust_shndx,
9121         Sized_relobj::initializ_input_to_output_maps,
9122         Sized_relobj::free_input_to_output_maps): Change visibilities to
9123         protected.
9124         (Sized_relobj::setup): Virtualize.
9125         (Sized_relobj::do_setup): New method declaration.
9126         (Sized_relobj::invalidate_section_offset,
9127         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9128         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9129         * options.cc (parse_int): New function.
9130         * options.h (parse_int): New declaration.
9131         (DEFINE_int): New macro.
9132         (stub_group_size): New option.
9133         * output.cc (Output_section::Output_section): Initialize memebers
9134         merge_section_map_, merge_section_by_properties_map_,
9135         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9136         (Output_section::add_input_section): Handled deferred code-fill
9137         generation and remove an old comment.
9138         (Output_section::add_relaxed_input_section): New method definition.
9139         (Output_section::add_merge_input_section): Use merge section by
9140         properties map to speed to search.  Update merge section maps
9141         as appropriate.
9142         (Output_section::build_relaxation_map): New method definition.
9143         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9144         Same.
9145         (Output_section::relax_input_section): Renamed to
9146         Output_section::convert_input_sections_to_relaxed_sections and change
9147         interface to take a vector of pointers to relaxed sections.
9148         (Output_section::find_merge_section,
9149         Output_section::find_relaxed_input_section): New method definitions.
9150         (Output_section::is_input_address_mapped,
9151         Output_section::output_offset, Output_section::output_address):
9152         Use output section data maps to speed up searching.
9153         (Output_section::find_starting_output_address): Add comments.
9154         (Output_section::do_write,
9155         Output_section::write_to_postprocessing_buffer): Do code-fill
9156         generation as appropriate.
9157         (Output_section::get_input_sections): Invalidate relaxed input section
9158         map.
9159         (Output_section::restore_states): Adjust type of checkpoint .
9160         Invalidate relaxed input section map.
9161         * output.h (Output_merge_base): New class declaration.
9162         (Input_section_specifier): New class defintion.
9163         (class Output_relaxed_input_section) Change base class to
9164         Output_section_data_build.
9165         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9166         base class initializer.
9167         (Output_section::add_relaxed_input_section): New method declaration.
9168         (Output_section::Input_section): Change visibility to protected.
9169         (Output_section::Input_section::relobj,
9170         Output_section::Input_section::shndx): Handle relaxed input sections.
9171         Output_section::input_sections) Change visibility to protected.  Also
9172         define overload to return a non-const pointer.
9173         (Output_section::Merge_section_properties): New class defintion.
9174         (Output_section::Merge_section_by_properties_map,
9175         Output_section::Output_section_data_by_input_section_map,
9176         Output_section::Relaxation_map): New types.
9177         (Output_section::relax_input_section): Rename method to
9178         Output_section::convert_input_sections_to_relaxed_sections and change
9179         interface to take a vector of relaxed section pointers.
9180         (Output_section::find_merge_section,
9181         Output_section::find_relaxed_input_section,
9182         Output_section::build_relaxation_map,
9183         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9184         New method declarations.
9185         (Output_section::merge_section_map_
9186         Output_section::merge_section_by_properties_map_,
9187         Output_section::relaxed_input_section_map_,
9188         Output_section::is_relaxed_input_section_map_valid_,
9189         Output_section::generate_code_fills_at_write_): New data members.
9190         * script-sections.cc
9191         (Output_section_element_input::set_section_addresses): Call
9192         current_data_size and addralign methods of relaxed input sections.
9193         (Orphan_output_section::set_section_addresses): Call current_data_size
9194         and addralign methods of relaxed input sections.
9195         * symtab.cc (Symbol_table::compute_final_value): Extract template
9196         from the body of Symbol_table::sized_finalize_symbol.
9197         (Symbol_table::sized_finalized_symbol): Call
9198         Symbol_table::compute_final_value.
9199         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9200         (Symbol_table::compute_final_value): New templated method declaration.
9201         * target.cc (Target::do_make_output_section): New method defintion.
9202         * target.h (Target::make_output_section): New method declaration.
9203         (Target::relax): Add more parameters for input objects, symbol table
9204         and layout.  Adjust call to do_relax.
9205         (Target::do_make_output_section): New method declaration.
9206         (Target::do_relax): Add parameters for input objects, symbol table
9207         and layout.
9208
9209 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9210
9211         * pread.c: Include stdio.h.
9212
9213 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9214
9215         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9216         defined.
9217
9218 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9219
9220         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9221         Change read_shndx type to unsigned int.
9222         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9223         int.
9224         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9225         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9226         Change read_shndx type to unsigned int.
9227         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9228         int.
9229         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9230         * layout.cc (Layout::create_symtab_sections): Cast the result of
9231         local_symcount * symsize to off_t in the gold_assert.
9232
9233 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9234
9235         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9236         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9237         R_ARM_BASE_ABS.
9238         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9239         (Arm_relocate_functions::thm_abs5): New function.
9240         (Arm_relocate_functions::abs12): New function.
9241         (Arm_relocate_functions::abs16): New function.
9242         (Arm_relocate_functions::base_abs): New function.
9243         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9244         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9245         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9246         R_ARM_BASE_ABS.
9247         (Scan::global): Likewise.
9248         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9249         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9250         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9251         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9252         R_ARM_BASE_ABS.
9253
9254 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9255
9256         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9257         (Arm_relocate_functions::movt_prel): New function.
9258         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9259         (Arm_relocate_functions::thm_movt_prel): New function.
9260         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9261         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9262         (Scan::global, Relocate::relocate): Likewise.
9263         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9264
9265 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9266
9267         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9268         Incremental_checker.
9269         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9270         unsigned int.
9271         (class Incremental_inputs_header): New class.
9272         (Incremental_inputs_header_writer): Edit comment.
9273         (Incremental_inputs_entry): New class.
9274         (Incremental_inputs_entry_writer): Edit comment.
9275         (Sized_incremental_binary::do_find_incremental_inputs_section):
9276         Add *strtab_shndx parameter, fill it.
9277         (Sized_incremental_binary::do_check_inputs): New method.
9278         (Incremental_checker::can_incrementally_link_output_file): Use
9279         Sized_incremental_binary::check_inputs.
9280         (Incremental_inputs::report_command_line): Save command line in
9281         command_line_.
9282         * incremental.h:
9283         (Incremental_binary::find_incremental_inputs_section): New
9284         method.
9285         (Incremental_binary::do_find_incremental_inputs_section): Add
9286         strtab_shndx parameter.
9287         (Incremental_binary::do_check_inputs): New pure virtual method.
9288         (Sized_incremental_binary::do_check_inputs): Declare.
9289         (Incremental_checker::Incremental_checker): Add incremental_inputs
9290         parameter, use it to initialize incremental_inputs_.
9291         (Incremental_checker::incremental_inputs_): New field.
9292         (Incremental_checker::command_line): New method.
9293         (Incremental_checker::inputs): New method.
9294         (Incremental_checker::command_line_): New field.
9295
9296 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9297
9298         * incremental.cc: Include <cstdarg> and "target-select.h".
9299         (vexplain_no_incremental): New function.
9300         (explain_no_incremental): New function.
9301         (Incremental_binary::error): New method.
9302         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9303         method.
9304         (make_sized_incremental_binary): New function.
9305         (open_incremental_binary): New function.
9306         (can_incrementally_link_file): Add checks if output is ELF and has
9307         inputs section.
9308         * incremental.h: Include "elfcpp_file.h" and "output.h".
9309         (Incremental_binary): New class.
9310         (Sized_incremental_binary): New class.
9311         (open_incremental_binary): Declare.
9312         * object.cc (is_elf_object): Use
9313         elfcpp::Elf_recognizer::is_elf_file.
9314         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9315         * output.h (Output_file::filesize): New method.
9316
9317 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9318
9319         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9320         New function.
9321         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9322         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9323         function.
9324         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9325         function.
9326         (Arm_relocate_functions::movw_abs_nc): New function.
9327         (Arm_relocate_functions::movt_abs): New function.
9328         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9329         (Arm_relocate_functions::thm_movt_abs): New function.
9330         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9331         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9332         (Scan::global): Likewise.
9333         (Relocate::relocate): Likewise.
9334         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9335
9336 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9337
9338         * arm.cc (Arm_relocate_functions::got_prel) New function.
9339         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9340         (Relocate::relocate): Likewise.
9341         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9342
9343 2009-10-06  Ian Lance Taylor  <iant@google.com>
9344
9345         * options.h (class General_options): Define
9346         split_stack_adjust_size parameter.
9347         * object.h (class Object): Add uses_split_stack_ and
9348         has_no_split_stack_ fields.  Add uses_split_stack and
9349         has_no_split_stack accessor functions.  Declare
9350         handle_split_stack_section.
9351         (class Reloc_symbol_changes): Define.
9352         (class Sized_relobj): Define Function_offsets.  Declare
9353         split_stack_adjust, split_stack_adjust_reltype, and
9354         find_functions.
9355         * object.cc (Object::handle_split_stack_section): New function.
9356         (Sized_relobj::do_layout): Call handle_split_stack_section.
9357         * dynobj.cc (Sized_dynobj::do_layout): Call
9358         handle_split_stack_section.
9359         * reloc.cc (Sized_relobj::relocate_sections): Call
9360         split_stack_adjust for executable sections in split_stack
9361         objects.  Pass reloc_map to relocate_section.
9362         (Sized_relobj::split_stack_adjust): New function.
9363         (Sized_relobj::split_stack_adjust_reltype): New function.
9364         (Sized_relobj::find_functions): New function.
9365         * target-reloc.h: Include "object.h".
9366         (relocate_section): Add reloc_symbol_changes parameter.  Change
9367         all callers.
9368         * target.h (class Target): Add calls_non_split method.  Declare
9369         do_calls_non_split virtual method.  Declare match_view and
9370         set_view_to_nop.
9371         * target.cc: Include "elfcpp.h".
9372         (Target::do_calls_non_split): New function.
9373         (Target::match_view): New function.
9374         (Target::set_view_to_nop): New function.
9375         * gold.cc (queue_middle_tasks): Give an error if mixing
9376         split-stack and non-split-stack objects with -r.
9377         * i386.cc (Target_i386::relocate_section): Add
9378         reloc_symbol_changes parameter.
9379         (Target_i386::do_calls_non_split): New function.
9380         * x86_64.cc (Target_x86_64::relocate_section): Add
9381         reloc_symbol_changes parameter.
9382         (Target_x86_64::do_calls_non_split): New function.
9383         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9384         parameter.
9385         * powerpc.cc (Target_powerpc::relocate_section): Add
9386         reloc_symbol_changes parameter.
9387         * sparc.cc (Target_sparc::relocate_section): Add
9388         reloc_symbol_changes parameter.
9389         * configure.ac: Call AM_CONDITIONAL for the default target.
9390         * configure: Rebuild.
9391         * testsuite/Makefile.am (TEST_AS): New variable.
9392         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9393         (check_DATA): Add split_i386 and split_x86_64 files.
9394         (SPLIT_DEFSYMS): Define.
9395         (split_i386_[1234n].o): New targets.
9396         (split_i386_[124]): New targets.
9397         (split_i386_[1234r].stdout): New targets.
9398         (split_x86_64_[1234n].o): New targets.
9399         (split_x86_64_[124]): New targets.
9400         (split_x86_64_[1234r].stdout): New targets.
9401         (MOSTLYCLEANFILES): Add new executables.
9402         * testsuite/split_i386.sh: New file.
9403         * testsuite/split_x86_64.sh: New file.
9404         * testsuite/split_i386_1.s: New file.
9405         * testsuite/split_i386_2.s: New file.
9406         * testsuite/split_i386_3.s: New file.
9407         * testsuite/split_i386_4.s: New file.
9408         * testsuite/split_i386_n.s: New file.
9409         * testsuite/split_x86_64_1.s: New file.
9410         * testsuite/split_x86_64_2.s: New file.
9411         * testsuite/split_x86_64_3.s: New file.
9412         * testsuite/split_x86_64_4.s: New file.
9413         * testsuite/split_x86_64_n.s: New file.
9414         * testsuite/testfile.cc (Target_test): Update relocation_section
9415         function.
9416         * testsuite/Makefile.in: Rebuild.
9417
9418 2009-10-06  Ian Lance Taylor  <iant@google.com>
9419
9420         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9421         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9422         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9423         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9424         the address on ldo_addrs_.
9425         (Target_i386::Relocate::fix_up_ldo): New function.
9426
9427 2009-10-06   Rafael Espindola  <espindola@google.com>
9428
9429         * plugin.cc (add_input_library): New.
9430         (Plugin::load): Add add_input_library to tv.
9431         (Plugin_manager::add_input_file): Add the is_lib argument.
9432         (add_input_file): Update call to Plugin_manager::add_input_file.
9433         (add_input_library): New.
9434         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9435
9436 2009-09-30  Doug Kwan  <dougkwan@google.com>
9437
9438         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9439         symbol and call Symbol::may_need_copy_reloc to determine if
9440         a copy reloc is needed.
9441         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9442         nocopyreloc is given in command line.
9443         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9444         given in command line.
9445         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9446         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9447         of the removed Target_i386::may_need_copy_reloc.
9448         * options.h (copyreloc): New option with default value false.
9449         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9450         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9451         instead of the removed Target_powerpc::may_need_copy_reloc.
9452         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9453         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9454         instead of the removed Target_sparc::may_need_copy_reloc.
9455         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9456         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9457         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9458         instead of the removed Target_x86_64::may_need_copy_reloc.
9459
9460 2009-09-30  Ian Lance Taylor  <iant@google.com>
9461
9462         * object.h (class Object): Remove target_ field, and target,
9463         sized_target, and set_target methods.
9464         (Object::sized_target): Remove.
9465         (class Sized_relobj): Update declarations.  Remove sized_target.
9466         * object.cc (Sized_relobj::setup): Remove target parameter.
9467         Change all callers.
9468         (Input_objects::add_object): Don't do anything with the target.
9469         (make_elf_sized_object): Add punconfigured parameter.  Change all
9470         callers.  Set or test parameter target.
9471         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9472         Change all callers.
9473         * parameters.cc (Parameters::set_target): Change parameter type to
9474         be non-const.
9475         (Parameters::default_target): Remove.
9476         (set_parameters_target): Change parameter type to be non-const.
9477         (parameters_force_valid_target): New function.
9478         (parameters_clear_target): New function.
9479         * parameters.h (class Parameters): Update declarations.  Remove
9480         default_target method.  Add sized_target and clear_target
9481         methods.  Change target_ to be non-const.
9482         (set_parameters_target): Update declaration.
9483         (parameters_force_valid_target): Declare.
9484         (parameters_clear_target): Declare.
9485         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9486         as NULL if we aren't searching.
9487         (Add_symbols::run): Don't check for compatible target.
9488         * fileread.cc (Input_file::open_binary): Call
9489         parameters_force_valid_target.
9490         * gold.cc (queue_middle_tasks): Likewise.
9491         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9492         set_target on object.
9493         * dynobj.h (class Sized_dynobj): Update declarations.
9494         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9495         make_elf_object returns NULL.
9496         (Archive::include_member): Don't check whether object target is
9497         compatible.
9498         * output.cc (Output_section::add_input_section): Get target from
9499         parameters.
9500         (Output_section::relax_input_section): Likewise.
9501         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9502         parameters.
9503         (Sized_relobj::do_scan_relocs): Likewise.
9504         (Sized_relobj::relocate_sections): Likewise.
9505         * resolve.cc (Symbol_table::resolve): Likewise.
9506         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9507         parameter.  Change all callers.
9508         (Symbol_table::add_from_object): Get target from parameters.
9509         (Symbol_table::add_from_relobj): Don't check object target.
9510         (Symbol_table::add_from_dynobj): Likewise.
9511         (Symbol_table::define_special_symbol): Get target from
9512         parameters.
9513         * symtab.h (class Symbol_table): Update declaration.
9514         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9515         parameter.  Change all callers.  Clear parameter target.
9516         (Binary_test): Test target here.
9517         * testsuite/object_unittest.cc (gold_testsuite): Remove
9518         target_test_pointer parameter.  Change all callers.
9519         (Object_test): Test target here.
9520
9521 2009-09-26  Ian Lance Taylor  <iant@google.com>
9522
9523         * testsuite/initpri1.c: Don't try to use constructor priorities if
9524         compiling with gcc before 4.3.
9525
9526 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9527
9528         * testsuite/retain_symbols_file_test.sh (check_present): Change
9529         output file name to retain_symbols_file_test.stdout.
9530         (check_absent): Likewise.
9531
9532 2009-09-18  Craig Silverstein  <csilvers@google.com>
9533
9534         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9535         * options.cc: Include <cerrno> and <fstream>.
9536         (General_options::finalize): Parse -retain-symbols-file tag.
9537         * options.h: New flag.
9538         (General_options): New method should_retain_symbol, new
9539         variable symbols_to_retain.
9540         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9541         should_retain_symbol map.
9542         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9543         * testsuite/Makefile.in: Regenerate.
9544         * testsuite/retain_symbols_file_test.sh: New file.
9545
9546 2009-09-18  Nick Clifton  <nickc@redhat.com>
9547
9548         * po/es.po: Updated Spanish translation.
9549
9550 2009-09-17  Doug Kwan  <dougkwan@google.com>
9551
9552         * debug.h (DEBUG_RELAXATION): New constant.
9553         (DEBUG_ALL): Add DEBUG_RELAXATION.
9554         (debug_string_to_enum): Add relaxation debug option.
9555         * layout.cc
9556         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9557         Layout::Relaxation_debug_check::read_sections,
9558         Layout::Relaxation_debug_check::read_sections): New method definitions.
9559         (Layout::Layout): Initialize data members
9560         record_output_section_data_from_scrips_,
9561         script_output_section_data_list_ and relaxation_debug_check_.
9562         (Layout::save_segments, Layout::restore_segments,
9563         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9564         Layout::relaxation_loop_body): New method definitions.
9565         (Layout::finalize): Support relaxation.  Move section layout code to
9566         Layout::relaxation_loop_body.
9567         (Layout::set_asection_address_from_script): Move code for orphan
9568         section placement out.
9569         (Layout::place_orphan_sections_in_script): New method definition.
9570         * layout.h (Output_segment_headers, Output_file_header):
9571         New forward class declarations.
9572         (Layout::~Layout): Define.
9573         (Layout::new_output_section_data_from_script): New method definition.
9574         (Layout::place_orphan_sections_in_script): New method declaration.
9575         (Layout::Segment_states): New type declaration.
9576         (Layout::save_segments, Layout::restore_segments,
9577         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9578         Layout::relaxation_loop_body): New method declarations.
9579         (Layout::Output_section_data_list): New type declaration.
9580         (Layout::Relaxation_debug_check): New class definition.
9581         (Layout::record_output_section_data_from_script_,
9582         Layout::script_output_section_data_list_, Layout::segment_states_,
9583         Layout::relaxation_debug_check_): New data members.
9584         * output.cc: (Output_section_headers::do_size): New method definition.
9585         (Output_section_headers::Output_section_headers): Move size
9586         computation to Output_section_headers::do_size.
9587         (Output_segment_headers::do_size): New method definition.
9588         (Output_file_header::Output_file_header): Move size computation to
9589         Output_file_header::do_size and call it.
9590         (Output_file_header::do_size): New method definition.
9591         (Output_data_group::Output_data_group): Adjust call to
9592         Output_section_data.
9593         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9594         (Output_symtab_xindex::do_write): Add array bound check.
9595         (Output_section::Input_section::print_to_mapfile): Handle
9596         RELAXED_INPUT_SECTION_CODE.
9597         (Output_section::Output_section): Initialize data member checkpoint_.
9598         (Output_section::~Output_section): Delete checkpoint object pointed
9599         by checkpoint_.
9600         (Output_section::add_input_section): Always add an Input_section if
9601         relaxing.
9602         (Output_section::add_merge_input_section): Add assert.
9603         (Output_section::relax_input_section): New method definition.
9604         (Output_section::set_final_data_size): Set load address to zero for
9605         an unallocated section.
9606         (Output_section::do_address_and_file_offset_have_reset_values):
9607         New method definition.
9608         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9609         Handle relaxed input section.
9610         (Output_section::sort_attached_input_sections): Checkpoint input
9611         section list lazily.
9612         (Output_section::get_input_sections): Change type of input_sections to
9613         list of Simple_input_section pointers.  Checkpoint input section list
9614         lazily.  Also handle relaxed input sections.
9615         (Output_section::add_input_section_for_script): Take a reference to
9616         a Simple_input_section object instead of Relobj pointer and section
9617         index as parameter.  Handle relaxed input sections.
9618         (Output_section::save_states, Output_section::restore_states): New
9619         method definitions.
9620         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9621         (Output_data::is_data_size_fixed): New method definition.
9622         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9623         if it is fixed.
9624         (Output_data::address_and_file_offset_have_reset_values): New method
9625         definition.
9626         (Output_data::do_address_and_file_offset_have_reset_values): New method
9627         definition.
9628         (Output_data::set_data_size): Check that data size is not fixed.
9629         (Output_data::fix_data_size): New method definition.
9630         (Output_data::is_data_size_fixed_): New data member.
9631         (Output_section_headers::set_final_data_size): New method definition.
9632         (Output_section_headers::do_size): New method declaration.
9633         (Output_segment_headers::set_final_data_size): New method definition.
9634         (Output_segment_headers::do_size): New method declaration.
9635         (Output_file_header::set_final_data_size)::New method definition.
9636         (Output_file_header::do_size)::New method declaration.
9637         (Output_section_data::Output_section_data): Add new parameter
9638         is_data_size_fixed and use it to fix data size.
9639         (Output_data_const::Output_data_const): Adjust call to base class
9640         constructor and fix data size.
9641         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9642         base class constructor and fix data size.
9643         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9644         base class constructor and fix data size.
9645         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9646         class constructor and fix data size.
9647         (Output_data_group::set_final_data_size): New method definition.
9648         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9649         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9650         class constructor and fix data size.
9651         (Output_relaxed_input_section): New class definition.
9652         (Output_section::Simple_input_section): New class definition.
9653         (Output_section::get_input_sections): Adjust parameter list.
9654         (Output_section::add_input_section_for_script): Same.
9655         (Output_section::save_states, Output_section::restore_states,
9656         Output_section::do_address_and_file_offset_have_reset_values,
9657         (Output_section::Input_section::Input_section): Handle
9658         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9659         Output_relaxed_input_section.
9660         (Output_section::Input_section::is_input_section,
9661         Output_section::Input_section::set_output_section): Handle relaxed
9662         input section.
9663         (Output_section::Input_section::is_relaxed_input_section,
9664         Output_section::Input_section::output_section_data,
9665         Output_section::Input_section::relaxed_input_section): New method
9666         definitions.
9667         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9668         value.
9669         (Output_section::Input_section::u1_): Update comments.
9670         (Output_section::Input_section::u2_): Add new union member poris.
9671         (Output_section::Checkpoint_output_section): New classs definition.
9672         (Output_section::relax_input_section): New method declaration.
9673         (Output_section::checkpoint_): New data member.
9674         (Output_segment): Update comments.
9675         (Output_segment::Output_segment): Un-privatize copy constructor.
9676         (Output_segment::operator=): Un-privatize.
9677         * script-sections.cc (Output_section_element::Input_section_list):
9678         Change element type to Output_section::Simple_input_section.
9679         (Output_section_element_dot_assignment::set_section_addresses):
9680         Register output section data for relaxation clean up.
9681         (Output_data_exression::Output_data_expression): Adjust call to base
9682         constructor to fix data size.
9683         (Output_section_element_data::set_section_addresses): Register
9684         Output_data_expression object for relaxation clean up.
9685         (struct Input_section_info): Replace Relobj pointer and section index
9686         pair with Output_section::Simple_input_section and Convert struct to a
9687         class.
9688         (Input_section_sorter::operator()): Adjust access to
9689         Input_section_info data member to use accessors.
9690         (Output_section_element_input::set_section_addresses): Use layout
9691         parameter.  Adjust code to use Output_section::Simple_input_section
9692         and Input_secction_info classes.  Register filler for relaxation
9693         clean up.
9694         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9695         and section index pair with Output_section::Simple_input_section
9696         class.  Adjust code accordingly.
9697         (Phdrs_element::release_segment): New method definition.
9698         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9699         segment list.
9700         (Script_sections::release_segments): New method definition.
9701         * gold/script-sections.h (Script_sections::release_segments): New
9702         method declaration.
9703         * gold/target.h (Target::may_relax, Target::relax,
9704         Target::do_may_relax, Target::do_relax): New method definitions.
9705
9706 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9707
9708         * arm.cc (has_signed_unsigned_overflow): New function.
9709         (Arm_relocate_functions::abs8): New function.
9710         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9711         (Target_arm::Scan::global): Likewise.
9712         (Target_arm::relocate::relocate): Likewise.
9713         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9714         Likewise.
9715
9716 2009-09-16  Cary Coutant  <ccoutant@google.com>
9717
9718         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9719         * testsuite/Makefile.in: Regenerate.
9720
9721 2009-09-11  Nick Clifton  <nickc@redhat.com>
9722
9723         * po/gold.pot: Updated by the Translation project.
9724
9725 2009-09-08  Cary Coutant  <ccoutant@google.com>
9726
9727         * output.cc (Output_file::open): Add execute permission to empty file.
9728         * testsuite/Makefile.am (permission_test): New test.
9729         * testsuite/Makefile.in: Regenerate.
9730
9731 2009-09-02  Ian Lance Taylor  <iant@google.com>
9732
9733         * output.cc (Output_file::resize): Call map_no_anonymous rather
9734         than map.
9735
9736 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9737
9738         * gold.cc: Include "incremental.h".
9739         (queue_initial_tasks): Call Incremental_checker methods.
9740         * incremental.cc: Include "output.h".
9741         (Incremental_checker::can_incrementally_link_output_file): New
9742         method.
9743         * incremental.h (Incremental_checker): New class.
9744
9745         * output.cc (Output_file::open_for_modification): New method.
9746         (Output_file::map_anonymous): Changed return type to bool.  Record
9747         map in base_ field.
9748         (Output_file::map_no_anonymous): New method, broken out of map.
9749         (Output_file::map): Use map_no_anonymous and map_anonymous.
9750         * output.h (class Output_file): Update declarations.
9751
9752 2009-08-24  Cary Coutant  <ccoutant@google.com>
9753
9754         * options.h (Command_line::Pre_options): New class.
9755         (Command_line::pre_options): New member.
9756         * options.cc (gold::options::ready_to_register): New variable.
9757         (One_option::register_option): Do nothing if not registering options.
9758         Assert if same short option registered twice.
9759         (General_options::General_options): Turn off option registration when
9760         done constructing.
9761         (Command_line::Pre_options::Pre_options): New constructor.
9762
9763 2009-08-24  Cary Coutant  <ccoutant@google.com>
9764
9765         * options.h (General_options::no_keep_memory): Remove incorrect
9766         short option.
9767
9768 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9769
9770         * Makefile.am (am__skiplex, am__skipyacc): New.
9771         * Makefile.in: Regenerate.
9772
9773 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9774
9775         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9776         (INCLUDES): ... this.
9777         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9778         (AM_CPPFLAGS): Renamed from ...
9779         (INCLUDE): ... this.
9780         * Makefile.in, testsuite/Makefile.in: Regenerate.
9781
9782         * Makefile.in: Regenerate.
9783         * aclocal.m4: Likewise.
9784         * config.in: Likewise.
9785         * configure: Likewise.
9786         * testsuite/Makefile.in: Likewise.
9787
9788         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9789         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9790         * Makefile.in: Regenerate.
9791         * testsuite/Makefile.in: Regenerate.
9792
9793 2009-08-19  Cary Coutant  <ccoutant@google.com>
9794
9795         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9796         symbols in shared libraries overridden by hidden or internal symbols
9797         in the main program.
9798
9799 2009-08-19  Chris Demetriou  <cgd@google.com>
9800
9801         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9802         checking source file names in error messages.
9803
9804 2009-08-18  Doug Kwan  <dougkwan@google.com>
9805
9806         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9807         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9808         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9809         an elfcpp::Ehdr as parameter.
9810         * object.cc (Object::set_target): Remove the version that looks up
9811         a target and sets it.
9812         (Sized_relobj::setup): Take a Target object instead of
9813         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9814         (make_elf_sized_object): Find target and ask target to
9815         make an ELF object.
9816         * object.h: (Object::set_target): Remove the version that looks up
9817         a target and sets it.
9818         (Sized_relobj::setup): Take a Target object instead of
9819         an elfcpp:Ehdr as parameter.
9820         * target.cc: Include dynobj.h.
9821         (Target::do_make_elf_object_implementation): New.
9822         (Target::do_make_elf_object): New.
9823         * target.h (Target::make_elf_object): New template declaration.
9824         (Target::do_make_elf_object): New method declarations.
9825         (Target::do_make_elf_object_implementation): New template declaration.
9826
9827 2009-08-14  Ian Lance Taylor  <iant@google.com>
9828
9829         * gold.h (FUNCTION_NAME): Define.
9830         (gold_unreachable): Use FUNCTION_NAME.
9831
9832 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9833
9834         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9835         symbol in the --keep-unique list is not found.
9836
9837 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9838
9839         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9840         been maked as --keep-unique.
9841         (Icf::unfold_section): New function.
9842         * icf.h (Icf::unfold_section): New function.
9843         * options.h (General_options::keep_unique): New option.
9844         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9845         * testsuite/Makefile.in: Regenerate.
9846         * testsuite/icf_keep_unique_test.sh: New file.
9847         * testsuite/icf_keep_unique_test.cc: New file.
9848
9849 2009-08-12  Cary Coutant  <ccoutant@google.com>
9850
9851         PR 10471
9852         * resolve.cc (Symbol_table::resolve): Check for references from
9853         dynamic objects to hidden and internal symbols.
9854         * testsuite/Makefile.am (hidden_test.sh): New test.
9855         * testsuite/Makefile.in: Regenerate.
9856         * testsuite/hidden_test.sh: New script.
9857         * testsuite/hidden_test_1.c: New test source.
9858         * testsuite/hidden_test_main.c: New test source.
9859
9860 2009-08-11  Doug Kwan  <dougkwan@google.com>
9861
9862         * arm.cc: Update comments.
9863         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9864         segment to locate the .ARM.exidx section if present.
9865
9866 2009-08-09  Doug Kwan  <dougkwan@google.com>
9867
9868         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9869         patch.
9870
9871 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9872         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9873         compiler warnings.
9874
9875 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9876
9877         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9878         valid tls_segment only for non-debug-section relocations.
9879         * testsuite/Makefile.am: Add gc_tls_test.
9880         * testsuite/Makefile.in: Regenerate.
9881         * testsuite/gc_tls_test.cc: New file.
9882         * testsuite/gc_tls_test.sh: New file.
9883
9884 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9885
9886         * icf.cc: New file.
9887         * icf.h: New file.
9888         * Makefile.am (CCFILES): Add icf.cc.
9889         (HFILES): Add icf.h
9890         * Makefile.in: Regenerate.
9891         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9892         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9893         section, symbol and addend information for the relocs.
9894         * gold.cc (queue_middle_tasks): Call identical code folding.
9895         * gold.h: Add defines for multimap.
9896         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9897         to the call of finalize_local_symbols.
9898         * main.cc (main): Create object of class Icf.
9899         * object.cc (Sized_relobj::do_layout): Allow this function to be
9900         called twice during icf.
9901         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9902         to sections marked as identical by icf.
9903         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9904         when available.
9905         (Sized_relobj::do_section_entsize): New function.
9906         * object.h (Object::section_entsize): New function.
9907         (Object::do_section_entsize): New pure virtual function.
9908         (Relobj::finalize_local_symbols): Add new parameter.
9909         (Relobj::do_section_entsize): New function.
9910         * options.h (General_options::icf): New option.
9911         (General_options::icf_iterations): New option.
9912         (General_options::print_icf_sections): New option.
9913         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9914         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9915         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9916         icf.
9917         * symtab.cc (Symbol_table::is_section_folded): New function.
9918         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9919         to sections marked as identical by icf.
9920         * symtab.h (Symbol_table::set_icf): New function.
9921         (Symbol_table::icf): New function.
9922         (Symbol_table::is_section_folded): New function.
9923         (Symbol_table::icf_): New data member.
9924         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9925         * testsuite/Makefile.am: Add commands to build icf_test.
9926         * testsuite/Makefile.in: Regenerate.
9927         * testsuite/icf_test.sh: New file.
9928         * testsuite/icf_test.cc: New file.
9929
9930 2009-07-24  Chris Demetriou  <cgd@google.com>
9931
9932         * layout.cc (is_compressible_debug_section): Fix incorrect
9933         comment about compressed section names.
9934
9935 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9936
9937         PR 10419
9938         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9939
9940 2009-07-16  Ian Lance Taylor  <iant@google.com>
9941
9942         PR 10400
9943         * layout.h: #include <map>.
9944         (class Kept_section): Change from struct to class.  Add accessors
9945         and setters.  Add section size to Comdat_group mapping.  Change
9946         Comdat_group to std::map.  Add is_comdat_ field.  Add
9947         linkonce_size field in union.
9948         (class Layout): Update declaration of find_or_add_kept_section.
9949         Don't declare find_kept_object.
9950         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9951         parameter.  Add object, shndx, is_comdat, and is_group_name
9952         parameters.  Change all callers.  Adjust for new Kept_section.
9953         (Layout::find_kept_object): Remove.
9954         * object.cc (Sized_relobj::include_section_group): Update use of
9955         Kept_section.  Rename secnum to shndx.  Only record
9956         Kept_comdat_section if sections are the same size.
9957         (Sized_relobj::include_linkonce_section): Update use of
9958         Kept_section.  Only record Kept_comdat_section if sections are the
9959         same size.  Set size of linkonce section.
9960         (Sized_relobj::map_to_kept_section): Update call to
9961         get_kept_comdat_section.
9962         * object.h (class Sized_relobj): Rename fields in
9963         Kept_comdat_section to drop trailing underscores; change object
9964         field to Relobj*.  Change Kept_comdat_section_table to store
9965         struct rather than pointer.
9966         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9967         Add kept_object and kept_shndx parameters.  Change all callers.
9968         (Sized_relobj::get_kept_comdat_section): Change return type to
9969         bool.  Add kept_object and kept_shndx parameters.  Change all
9970         callers.
9971         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9972         Layout::find_or_add_kept_section.
9973
9974 2009-07-09  Ian Lance Taylor  <iant@google.com>
9975
9976         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9977         Reserve space in the hash table.
9978
9979 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9980
9981         * fileread.cc (File_read::get_mtime): New method.
9982         * fileread.h (Timespec): New structure.
9983         (File_read::get_mtime): New method.
9984         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9985         Renamed from timestamp_nsec.
9986         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9987         Elf_Xword.
9988         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9989         timestamp_nsec.
9990         (Incremental_inputs::report_archive): Save mtime; style fix.
9991         (Incremental_inputs::report_obejct): Save mtime; style fix.
9992         (Incremental_inputs::report_script): Save mtime; style fix.
9993         (Incremental_inputs::finalize_inputs): Style fix.
9994         (Incremental_inputs::finalize): Style fix.
9995         (Incremental_inputs::create_input_section_data): Store inputs
9996         mtime.
9997         * incremental.h (Incremental_inputs::report_script): Add mtime
9998         argument.
9999         (Incremental_inputs::Input_info::Input_info): Intialize only one
10000         union member.
10001         (Incremental_inputs::Input_info::archive): Move to nameless
10002         union.
10003         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10004         (Incremental_inputs::Input_info::script): Move to nameless union.
10005         (Incremental_inputs::mtime): New field.
10006         * script.cc (read_input_script): Pass file mtime to
10007         Incremental_input.
10008         * script.h (Script_info::inputs): Style fix.
10009
10010 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10011
10012         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10013         instead of 32.
10014
10015 2009-06-24  Ian Lance Taylor  <iant@google.com>
10016
10017         PR 10156
10018         * layout.cc (Layout::choose_output_section): If we find an
10019         existing section, update the flags.
10020         (Layout::create_notes): New function, broken out of
10021         Layout::finalize.
10022         (Layout::finalize): Don't create note sections.
10023         (Layout::create_note): Don't crash if linker script discards
10024         section.
10025         (Layout::create_gold_note): Likewise.
10026         (Layout::create_build_id): Likewise.  Don't set
10027         after_input_sections on the section.
10028         (Layout::create_executable_stack_info): Remove target parameter.
10029         Change caller.
10030         * layout.h (class Layout): Declare create_notes.  Update
10031         declaration of create_executable_stack_info.
10032         * gold.cc (queue_middle_tasks): Call create_notes.
10033         * output.cc (Output_section::update_flags_for_input_section): Move
10034         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10035         invalid.
10036         * output.h (Output_data::mark_address_invalid): New function.
10037         (class Output_section): Only declare, not define,
10038         update_flags_for_input_section.  Remove set_flags.
10039
10040 2009-06-24  Ian Lance Taylor  <iant@google.com>
10041
10042         * script-sections.cc (Output_section_definition::
10043         set_section_addresses): Rename shadowing local load_address to
10044         laddr.
10045
10046 2009-06-24  Ian Lance Taylor  <iant@google.com>
10047
10048         PR 10244
10049         * reloc.cc (relocate_sections): Skip empty relocation sections.
10050
10051 2009-06-23  Ian Lance Taylor  <iant@google.com>
10052
10053         PR 10156
10054         * layout.cc (Layout::create_note): Use choose_output_section
10055         rather than make_output_section.
10056
10057 2009-06-23  Ian Lance Taylor  <iant@google.com>
10058
10059         PR 10237
10060         * options.cc (General_options::parse_V): Set printed_version_.
10061         (General_options::General_options): Initialize printed_version_.
10062         * options.h (class General_options): Add printed_version_ field.
10063         * gold.cc (queue_initial_tasks): If there are no input files,
10064         don't give a fatal error if we printed the version information.
10065         (queue_middle_tasks): If using -r with a shared object, give a
10066         fatal error rather than an ordinary error.
10067
10068 2009-06-23  Ian Lance Taylor  <iant@google.com>
10069
10070         PR 10219
10071         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10072         (Layout::make_output_section): Set have_stabstr_section_ if we see
10073         a .stab*str section.
10074         (Layout::finalize): Call link_stabs_sections.
10075         (Layout::link_stabs_sections): New file.
10076         * layout.h (class Layout): Add have_stabstr_section_ field.
10077         Declare link_stabs_sections.
10078
10079 2009-06-23  Doug Kwan  <dougkwan@google.com>
10080
10081         * Makefile.am (libgold_a_LIBADD): New.
10082         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10083         * Makefile.in: Regenerate.
10084         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10085         * configure: Regenerate.
10086         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10087         * fileread.cc: Include sys/state.h
10088         * gold.h: Declare memmem and strndup if found missing.
10089         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10090
10091 2009-06-23  Ian Lance Taylor  <iant@google.com>
10092
10093         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10094         * configure: Rebuild.
10095
10096 2009-06-23  Ian Lance Taylor  <iant@google.com>
10097
10098         PR 10147
10099         * object.cc (Object::section_contents): Don't try to get a view if
10100         the section has length zero.
10101         (Object::handle_gnu_warning_section): If the section is empty, use
10102         the name of the section as the warning.
10103
10104 2009-06-23  Ian Lance Taylor  <iant@google.com>
10105
10106         PR 10133
10107         * stringpool.h (class Stringpool_template): Add optimize_ field.
10108         (Stringpool_template::set_optimize): New function.
10109         * stringpool.cc (Stringpool_template::Stringpool_template):
10110         Initialize optimize_ field.
10111         (Stringpool_template::set_string_offsets): Test local optimize
10112         fild rather than parameter.
10113         * layout.cc (Layout::Layout): Call set_optimize on the section
10114         name stringpool.
10115
10116 2009-06-22  Ian Lance Taylor  <iant@google.com>
10117
10118         PR 10030
10119         * yyscript.y: Parse TARGET.
10120         * script.cc (script_set_target): New function.
10121         * script-c.h (script_set_target): Declare.
10122         * options.cc (General_options::string_to_object_format): Rename
10123         from string_to_object_format in anonymous namespace.  Change
10124         callers.
10125         * options.h (class General_options): Declare
10126         string_to_object_format.
10127
10128 2009-06-22  Ian Lance Taylor  <iant@google.com>
10129
10130         * script-sections.cc (Script_sections::create_segments): Don't put
10131         program headers in a PT_LOAD segment if -n or -N.
10132
10133 2009-06-22  Ian Lance Taylor  <iant@google.com>
10134
10135         PR 10141
10136         * options.h (class General_options): Add -z lazy and -z now.  Sort
10137         -z options into alphabetical order.
10138         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10139
10140 2009-06-21  Ian Lance Taylor  <iant@google.com>
10141
10142         * layout.cc (Layout::make_output_section): Call
10143         Target::new_output_section.
10144         (Layout::attach_allocated_section_to_segment): Put large section
10145         sections in a separate load segment with the large segment flag
10146         set.
10147         (Layout::segment_precedes): Sort large data segments after other
10148         load segments.
10149         (align_file_offset): New static function.
10150         (Layout::set_segment_offsets): Use align_file_offset.
10151         * output.h (class Output_section): Add is_small_section_ and
10152         is_large_section_ fields.
10153         (Output_section::is_small_section): New function.
10154         (Output_section::set_is_small_section):  New function.
10155         (Output_section::is_large_section): New function.
10156         (Output_section::set_is_large_section): New function.
10157         (Output_section::is_large_data_section): New function.
10158         (class Output_segment): Add is_large_data_segment_ field.
10159         (Output_segment::is_large_data_segment): New function.
10160         (Output_segment::set_is_large_data_segment): New function.
10161         * output.cc (Output_section::Output_section): Initialize new
10162         fields.
10163         (Output_segment::Output_segment): Likewise.
10164         (Output_segment::add_output_section): Add assertion that large
10165         data sections always go in large data segments.  Force small data
10166         sections to the end of the list of data sections.  Force small BSS
10167         sections to the start of the list of BSS sections.  For large BSS
10168         sections to the end of the list of BSS sections.
10169         * symtab.h (class Symbol): Declare is_common_shndx.
10170         (Symbol::is_defined): Check Symbol::is_common_shndx.
10171         (Symbol::is_common): Likewise.
10172         (class Symbol_table): Define enum Commons_section_type.  Update
10173         declarations.  Add small_commons_ and large_commons_ fields.
10174         * symtab.cc (Symbol::is_common_shndx): New function.
10175         (Symbol_table::Symbol_table): Initialize new fields.
10176         (Symbol_table::add_from_object): Put small and large common
10177         symbols in the right list.
10178         (Symbol_table::sized_finalized_symbol): Check
10179         Symbol::is_common_shndx.
10180         (Symbol_table::sized_write_globals): Likewise.
10181         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10182         common symbol lists.  Don't call do_allocate_commons_list if the
10183         list is empty.
10184         (Symbol_table::do_allocate_commons_list): Remove is_tls
10185         parameter.  Add comons_section_type parameter.  Change all
10186         callers.  Handle small and large common symbols.
10187         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10188         Symbol::is_common_shndx.
10189         * resolve.cc (symbol_to_bits): Likewise.
10190         * target.h (Target::small_common_shndx): New function.
10191         (Target::small_common_section_flags): New function.
10192         (Target::large_common_shndx): New function.
10193         (Target::large_common_section_flags): New function.
10194         (Target::new_output_section): New function.
10195         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10196         small_common_section_flags, and large_common_section_flags
10197         fields.
10198         (Target::do_new_output_section): New virtual function.
10199         * arm.cc (Target_arm::arm_info): Initialize new fields.
10200         * i386.cc (Target_i386::i386_info): Likewise.
10201         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10202         Likewise.
10203         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10204         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10205         (Target_x86_64::do_new_output_section): New function.
10206         * configure.ac: Define conditional MCMODEL_MEDIUM.
10207         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10208         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10209         (large_LDFLAGS): Define.
10210         * testsuite/large.c: New file.
10211         * testsuite/testfile.cc (Target_test::test_target_info):
10212         Initialize new fields.
10213         * configure, testsuite/Makefile.in: Rebuild.
10214
10215 2009-06-05  Doug Kwan  <dougkwan@google.com>
10216
10217         * Makefile.am (CCFILES): Add target.cc.
10218         * Makefile.in: Regenerate.
10219         * i386.cc (class Target_i386): Define new virtual method to
10220         override do_is_local_label_name in parent.
10221         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10222         local symbols if --discard-locals or -X is given.
10223         * options.h (class General_options): Declare new options
10224         '--discard-locals' and '-X' for discarding locals.
10225         * target.h (class Target): Define new methods is_local_label_name.
10226         Declare new virtual method do_is_local_label_name.
10227         * target.cc: New file.
10228         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10229         (check_SCRIPTS): Add discard_locals_test.sh.
10230         (check_DATA): Add discard_local_tests.syms.
10231         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10232         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10233         * testsuite/Makefile.in: Regenerate.
10234         * testsuite/discard_locals_test.c: New file.
10235         * testsuite/discard_locals_test.sh: Same.
10236
10237 2009-06-05  Doug Kwan  <dougkwan@google.com>
10238
10239         * object.cc (Sized_relobj::Sized_relobj): Initialize
10240         discarded_eh_frame_shndx_ to -1U.
10241         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10242         section.
10243         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10244         a discarded .eh_frame section.
10245         (Sized_relobj::do_finalize_local_symbols): Ditto.
10246         * object.h (class Sized_relobj): Declare new member
10247         discarded_eh_frame_shndx_.
10248         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10249         (local_labels_test.o, local_labels_test): New rules.
10250         * testsuite/Makefile.in: Regenerate.
10251
10252 2009-06-04  Doug Kwan  <dougkwan@google.com>
10253
10254         * layout.cc (Layout::section_name_mapping): Add mapping for
10255         special ARM sections.
10256
10257 2009-06-03  Doug Kwan  <dougkwan@google.com>
10258
10259         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10260         (utils::has_overflow): Same.
10261
10262 2009-06-03  Ian Lance Taylor  <iant@google.com>
10263
10264         * layout.cc (Layout::section_name_mapping): New array, replacing
10265         Layout::linkonce_mapping.
10266         (Layout::section_name_mapping_count): New variable, replacing
10267         Layout::linkonce_mapping_count.
10268         (Layout::linkonce_output_name): Remove.
10269         (Layout::output_section_name): Rewrite.
10270         * layout.h (class Layout): Rename Linkonce_mapping to
10271         Section_name_mapping, linkonce_mapping to section_name_mapping,
10272         linkonce_mapping_count to section_name_mapping_count.  Don't
10273         declare linkonce_output_name.
10274
10275 2009-06-03  Doug Kwan  <dougkwan@google.com>
10276
10277         * gold/arm.cc (namespace utils): New.
10278         (Target_arm::reloc_is_non_pic): Define new method.
10279         (class Arm_relocate_functions): New.
10280         (Target_arm::Relocate::relocate): Handle relocation types used by
10281         Android.
10282
10283 2009-06-03  Ian Lance Taylor  <iant@google.com>
10284
10285         * arm.cc (Target_arm::scan::global): Use || instead of |.
10286
10287 2009-06-02  Doug Kwan  <dougkwan@google.com>
10288
10289         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10290         issued_non_pic_error_.
10291         (class Target_arm::Scan): Declare new method check_non_pic.
10292         Define new method symbol_needs_plt_entry.
10293         Declare new data member issued_non_pic_error_.
10294         (class Target_arm::Relocate): Declare new method
10295         should_apply_static_reloc.
10296         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10297         (Target_arm::Scan::check_non_pic): Define new method.
10298         (Target_arm::Scan::local): Handle a small subset of reloc types used
10299         by Android.
10300         (Target_arm::Scan::local): Same.
10301         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10302
10303 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10304
10305         * incremental.cc (Incremental_inputs::report_command_line): Filter
10306         out --incremental-* options.
10307
10308 2009-05-29  Doug Kwan  <dougkwan@google.com>
10309
10310         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10311         template class.
10312         (class Target_arm): Update comment.
10313         (Target_arm::Target_arm): Initialize new data members GOT_,
10314         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10315         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10316         and Target_arm::rel_dyn_section.
10317         Declare new_enum Target_arm::Got_type.
10318         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10319         and DYNBSS_.
10320         Update commments for member do_dynsym_value.
10321         (Target_arm::got_size, Target_arm::plt_section,
10322         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10323         new methods inside class defintion.
10324         (Target_arm::got_section): Define new method.
10325         (Target_arm::rel_dyn_section): Same.
10326         (Output_data_plt_arm): New template class.
10327         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10328         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10329         (Output_data_plt_arm::add_entry): Same.
10330         (Output_data_plt_arm::first_plt_entry): Define new
10331         static data member for PLT instruction template.
10332         (Output_data_plt_arm::plt_entry): Same.
10333         (Output_data_plt_arm::do_write): Define new method.
10334         (Target_arm::make_plt_entry): Same.
10335         (Target_arm::do_finalize_sections): Same.
10336         (Target_arm::do_dynsym_value): Same.
10337
10338 2009-05-28  Doug Kwan  <dougkwan@google.com>
10339
10340         * Makefile.am (TARGETSOURCES): Add arm.cc.
10341         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10342         * Makefile.in: Regenerate.
10343         * arm.cc: New file.
10344         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10345
10346 2009-05-26  Doug Kwan  <dougkwan@google.com>
10347
10348         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10349         (General_options::check_excluded_libs): Strip off directories in
10350         archive name before matching like GNU ld does.
10351         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10352         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10353         (exclude_libs_test_LDFLAGS): Add linker option
10354         -Wl,--exclude-libs,libexclude_libs_test_3
10355         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10356         an explicit archive without using -l.
10357         (alt/libexclude_libs_test_3.a): New make rule.
10358         * testsuite/Makefile.in: Regenerate.
10359         * testsuite/exclude_libs_test.c : Declare lib3_default().
10360         (main): Call it.
10361         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10362         * exclude_libs_test_3.c: New file.
10363
10364 2009-05-26  Nick Clifton  <nickc@redhat.com>
10365
10366         * po/id.po: New Indonesian translation.
10367         * po/gold.pot: Updated template file.
10368
10369 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10370
10371         * testsuite/Makefile.am: Add -ffunction-sections to compile
10372         gc_comdat_test files.  Add -Wl,--gc-sections to build
10373         gc_comdat_test.
10374         * testsuite/Makefile.in: Regenerate.
10375         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10376
10377 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10378
10379         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10380         kept comdat section was garbage collected.
10381         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10382         * testsuite/Makefile.in: Regenerate.
10383         * testsuite/gc_comdat_test.sh: New file.
10384         * testsuite/gc_comdat_test_1.cc: New file.
10385         * testsuite/gc_comdat_test_2.cc: New file.
10386
10387 2009-05-19  Doug Kwan  <dougkwan@google.com>
10388
10389         * archive.cc (Archive::Archive): Move constructor from archive.h
10390         to here.  Initialize no_export_.
10391         (Archive::get_elf_object_for_member): Set no_export flag of object.
10392         * archive.h (Archive::Archive): Move constructor body to
10393         archive.cc.
10394         (Archive::no_export): New method.
10395         (Archive::no_export_): New field.
10396         * object.h (Object::Object): Initialize no_export_ to false.
10397         (Object::no_export, Object::set_no_export): New methods.
10398         (Object::no_export_): New field.
10399         * options.cc (General_options::parse_exclude_libs): New method.
10400         (General_options::check_excluded_libs) Same.
10401         * options.h (exclude_libs): New option.
10402         (General_options::check_excluded_libs): New method declaration.
10403         (General_options::excluded_libs_): New field.
10404         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10405         default or protected visibility if an object has no-export flag set.
10406         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10407         (check_SCRIPTS): Add exclude_libs_test.sh.
10408         (check_DATA): Add exclude_libs_test.syms.
10409         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10410         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10411         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10412         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10413         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10414         libexclude_libs_test_2.a): New rules.
10415         * testsuite/Makefile.in: Regenerate.
10416         * testsuite/exclude_libs_test.c: New file.
10417         * testsuite/exclude_libs_test.sh: Ditto.
10418         * testsuite/exclude_libs_test_1.c: Ditto.
10419         * testsuite/exclude_libs_test_2.c: Ditto.
10420
10421 2009-05-15  Ian Lance Taylor  <iant@google.com>
10422
10423         * configure.ac: Check for declarations for cases where libiberty.h
10424         checks HAVE_DECL_xxx.
10425         * configure, config.in: Rebuild.
10426
10427 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10428
10429         * gold.h (Incremental_argument_list): Remove (invalid) forward
10430         declaration.
10431         * incremental.cc (Incremental_inputs::report_achive): New method.
10432         (Incremental_inputs::report_object): New method.
10433         (Incremental_inputs::report_script): New method.
10434         (Incremental_inputs::finalize_inputs): New method.
10435         (Incremental_inputs::finalize): Call finalize_inputs().
10436         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10437         Create inputs entries.
10438         * incremental.h (Incremental_input_type): New enum.
10439         (Incremental_inputs::Incremental_input): Initialize new fields.
10440         (Incremental_inputs::report_inputs): New method.
10441         (Incremental_inputs::report_achive): New method.
10442         (Incremental_inputs::report_object): New method.
10443         (Incremental_inputs::report_script): New method.
10444         (Incremental_inputs::finalize_inputs): New method.
10445         (Incremental_inputs::Input_info): New struct.
10446         (Incremental_inputs::Input_info_map): New typedef.
10447         (Incremental_inputs::lock_): New field.
10448         (Incremental_inputs::Inputs_): New field.
10449         (Incremental_inputs::Inputs_map): New field.
10450         * main.cc (main): Call Incremental_input::report_inputs.
10451         * options.h (Input_argument_list): Typedef moved from
10452         Input_arguments.
10453         (Input_file_group::Files): Remove, use ::Input_argument_list.
10454         (Input_file_group::Input_argument_list): Remove, use
10455         ::Input_argument_list.
10456         * plugin.cc (Plugin_manager::add_input_file): Add error in
10457         incremental build.
10458         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10459         functions.
10460         * script.cc (read_input_script): Call
10461         Incremental_input::report_script.
10462         * script.h (Script_info): New class.
10463
10464 2009-04-27  Ian Lance Taylor  <iant@google.com>
10465
10466         * x86_64.cc (do_adjust_output_section): Set entsize to
10467         plt_entry_size.
10468
10469 2009-04-23  Elliott Hughes  <enh@google.com>
10470
10471         * output.cc (Output_file::close): After short writes, continue
10472         writing from the correct offset in the buffer being written.
10473
10474 2009-04-23  Chris Demetriou  <cgd@google.com>
10475
10476         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10477         * configure: Regenerate.
10478         * config.in: Regenerate.
10479         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10480         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10481
10482 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10483
10484         * incremental.cc (Incremental_inputs_header_data): Renamed from
10485         Incremental_input_header_data.
10486         (Incremental_inputs_header_data::data_size): New field.
10487         (Incremental_inputs_header_data::put_input_file_count): Renamed
10488         from input_file_count.
10489         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10490         from command_line_offset.
10491         (Incremental_inputs_header_data::put_reserved): Renamed from
10492         put_reserved.
10493         (Incremental_inputs_entry_data): Renamed from
10494         Incremental_input_entry_data.
10495         (Incremental_inputs_entry_data::data_size): New field.
10496         (Incremental_inputs::report_command_line): New method.
10497         (Incremental_inputs::finalize): New method.
10498         (Incremental_inputs::create_incremental_inputs_data): New method.
10499         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10500         * incremental.h: New file.
10501         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10502         (Layout::finalize): Create incremental inputs section in
10503         incremental builds.
10504         (Layout::create_incremental_info_sections): New method.
10505         * layout.h (Layout::incremental_inputs): New method.
10506         (Layout::create_incremental_info_sections): New method.
10507         (Layout::incremental_inputs_): New field.
10508         * main.cc (main): Notify Incremental_input of the command line.
10509
10510 2009-04-01  Ian Lance Taylor  <iant@google.com>
10511             Mikolaj Zalewski  <mikolajz@google.com>
10512
10513         * gold.h (reserve_unordered_map): Define, three versions, one for
10514         each version of Unordered_map.
10515         * layout.cc (Layout::Layout): Remove options parameter.  Add
10516         number_of_input_files parameter.  Don't initialize options_.
10517         Initialize number_of_input_files_ and resized_signatures_.  Move
10518         sections_are_attached_.
10519         (Layout::layout_group): Reserve space for group_signatures_.
10520         (Layout::find_or_add_kept_section): Change name parameter to be a
10521         reference.  Resize signatures_ map when it gets large enough.
10522         (Layout::layout_eh_frame): Use parameters->options() instead of
10523         this->options_.
10524         (Layout::make_output_section): Likewise.
10525         (Layout::attach_allocated_section_to_segment): Likewise.
10526         (Layout::finalize, Layout::create_executable_stack): Likewise.
10527         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10528         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10529         * layout.h (class Layout): Update declarations.  Remove options_
10530         field.  Add number_of_input_files_ and resized_signatures_
10531         fields.  Move sections_are_attached_ field.
10532         * main.cc (main): Pass number of input files to Layout
10533         constructor.  Don't pass options.
10534
10535 2009-03-30  Ian Lance Taylor  <iant@google.com>
10536
10537         * ffsll.c (ffsll): Correct implementation.
10538
10539 2009-03-27  Ian Lance Taylor  <iant@google.com>
10540
10541         * ffsll.c: New file.
10542         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10543         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10544         * ftruncate.c (ftruncate): Declare before definition.
10545         * mremap.c (mremap): Likewise.
10546         * pread.c (pread): Likewise.
10547         * configure, Makefile.in, config.in: Rebuild.
10548
10549         * mremap.c: New file.
10550         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10551         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10552         (mremap): Declare if HAVE_MREMAP is not defined.
10553         * configure, Makefile.in, config.in: Rebuild.
10554
10555 2009-03-27  Cary Coutant  <ccoutant@google.com>
10556
10557         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10558         position independent.
10559         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10560         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10561
10562 2009-03-24  Cary Coutant  <ccoutant@google.com>
10563
10564         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10565         an executable.
10566         (needs_dynamic_reloc): Likewise.
10567
10568 2009-03-24  Ian Lance Taylor  <iant@google.com>
10569
10570         * yyscript.y (file_cmd): Recognize EXTERN.
10571         (extern_name_list, extern_name_list_body): New nonterminals.
10572         * script.cc (script_add_extern): Define.
10573         * script-c.h (script_add_extern): Declare.
10574
10575 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10576
10577         * object.cc (is_elf_object): Define.
10578         * object.h (is_elf_object): Declare.
10579         * archive.cc (Archive::get_elf_object_for_member): Call
10580         is_elf_object.
10581         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10582
10583 2009-03-24  Elliott Hughes  <enh@google.com>
10584
10585         * output.cc (Output_file::map_anonymous): Define.
10586         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10587         try an anonymous one.  Report the size if the mmap fails.
10588         * output.h (class Output_file): Declare map_anonymous.
10589
10590 2009-03-24  Ian Lance Taylor  <iant@google.com>
10591
10592         * target-select.cc (instantiate_target): Don't acquire the lock if
10593         the instantiated_target_ field has already been set.
10594
10595 2009-03-23  Ian Lance Taylor  <iant@google.com>
10596
10597         * gold-threads.h (class Initialize_lock): Define.
10598         * gold-threads.cc (class Initialize_lock_once): Define.
10599         (initialize_lock_control): New static variable.
10600         (initialize_lock_pointer): New static variable.
10601         (initialize_lock_once): New static function.
10602         (Initialize_lock::Initialize_lock): Define.
10603         (Initialize_lock::initialize): Define.
10604         * target-select.h: Include "gold-threads.h".
10605         (class Target_selector): Add lock_ and initialize_lock_ fields.
10606         Don't define instantiate_target, just declare it.
10607         * target-select.cc (Target_selector::Target_selector): Initialize
10608         new fields.
10609         (Target_selector::instantiate_target): Define.
10610         * descriptors.h: Include "gold-threads.h".
10611         (class Descriptors): Add initialize_lock_ field.
10612         * descriptors.cc (Descriptors::Descriptors): Initialize new
10613         field.
10614         (Descriptors::open): Use initialize_lock_ field
10615         * errors.h (class Errors): Add initialize_lock_ field.
10616         * errors.cc (Errors::Errors): Initialize new field.
10617         (Errors::initialize_lock): Use initialize_lock_ field.
10618         * powerpc.cc (class Target_selector_powerpc): Remove
10619         instantiated_target_ field.  In do_recognize call
10620         instantiate_target rather than do_instantiate_target.  In
10621         do_instantiate_target just allocate a new target.
10622         * sparc.cc (class Target_selector_sparc): Likewise.
10623
10624         * freebsd.h: New file.
10625         * i386.cc: Include "freebsd.h".
10626         (Target_i386): Derive from Target_freebsd rather than
10627         Sized_target.
10628         (Target_selector_i386): Derive from Target_selector_freebsd rather
10629         than Target_selector.
10630         * x86_64.cc: Include "freebsd.h".
10631         (Target_x86_64): Derive from Target_freebsd rather than
10632         Sized_target.
10633         (Target_selector_x86_64): Derive from Target_selector_freebsd
10634         rather than Target_selector.
10635         * target.h (class Target): Add adjust_elf_header and
10636         do_adjust_elf_header.
10637         * output.cc (Output_file_header:: do_sized_write): Call target
10638         adjust_elf_header routine.
10639         * configure.tgt: Set targ_osabi.
10640         * configure.ac: Define GOLD_DEFAULT_OSABI.
10641         * parameters.cc (Parameters::default_target): Pass
10642         GOLD_DEFAULT_OSABI to select_target.
10643         * target-select.h (class Target_selector): Make instantiate_target
10644         protected rather than private.
10645         * Makefile.am (HFILES): Add freebsd.h.
10646         * configure, Makefile.in, config.in: Rebuild.
10647
10648         * merge.cc (do_add_input_section): Correct pend value.  Change
10649         message about last entry not being null terminated from error to
10650         warning.
10651
10652 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10653
10654         * incremental.cc: New file.
10655         * Makefile.am (CCFILES): Add incremental.cc.
10656         * Makefile.in: Rebuild.
10657
10658 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10659
10660         * layout.cc (Layout::output_section_name): Preserve names
10661         of '.note.' sections.
10662
10663 2009-03-19  Ian Lance Taylor  <iant@google.com>
10664
10665         * descriptors.cc (Descriptors::open): Check that the options are
10666         valid before using them.
10667
10668 2009-03-18  Ian Lance Taylor  <iant@google.com>
10669
10670         * script-sections.h: Include <list>.
10671         (class Script_sections): Change Sections_elements from std::vector
10672         to std::list.  Typedef public Elements_iterator.  Add
10673         orphan_section_placement_, data_segment_align_start_, and
10674         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10675         field.
10676         * script-sections.cc (class Orphan_section_placement): New class.
10677         (class Sections_element): Add virtual functions is_relro and
10678         orphan_section_init.  Remove virtual function place_orphan_here.
10679         (class Output_section_definition): Add is_relro and
10680         orphan_section_init.  Remove place_orphan_here.
10681         (class Orphan_output_section): Likewise.
10682         (Script_sections::Script_sections): Update for field changes.
10683         (Script_sections::data_segment_align): Set saw_data_segment_align_
10684         and data_segment_align_start_, not data_segment_align_index.
10685         (Script_sections::data_segment_relro_end): Check
10686         saw_data_segment_align_.  Use data_segment_align_start_ rather
10687         than data_segment_align_index_.
10688         (Script_sections::place_orphan): Rewrite to use
10689         Orphan_section_placement.
10690
10691 2009-03-17  Ian Lance Taylor  <iant@google.com>
10692
10693         * archive.cc (Archive::add_symbols): Check for a version attached
10694         to the symbol name in the archive map.
10695         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10696         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10697         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10698         (ver_test_11.a): New target.
10699         * testsuite/Makefile.in: Rebuild.
10700
10701         * configure.ac: Check for chsize and posix_fallocate.  Replace
10702         ftruncate.
10703         * ftruncate.c: New file, from gnulib.
10704         * output.cc (posix_fallocate): Define dummy version if not
10705         HAVE_POSIX_FALLOCATE.
10706         (Output_file::map): Call posix_fallocate rather than lseek and
10707         write.
10708         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10709         * configure, Makefile.in, config.in: Rebuild.
10710
10711 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10712
10713         * layout.h (Layout::create_note): Add section_name parameter.
10714         * layout.cc (Layout::create_note): Likewise.
10715         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10716
10717 2009-03-17  Ian Lance Taylor  <iant@google.com>
10718
10719         * descriptors.cc: Include "options.h".
10720         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10721         (Descriptors::open): Always use O_CLOEXEC when opening a new
10722         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10723         then set FD_CLOEXEC.
10724
10725         * sparc.cc (class Target_sparc): Add has_got_section.
10726         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10727         make sure we have a GOT section.
10728
10729         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10730         (Target_sparc::Scan::local): Likewise.
10731         (Target_sparc::Scan::global): Likewise.
10732         (Target_sparc::Relocate::relocate): Likewise.
10733         (Target_sparc::Relocate::relocate_tls): Likewise.
10734
10735         * symtab.cc (Symbol_table::define_default_version): New function,
10736         broken out of add_from_object.
10737         (Symbol_table::add_from_object): Call define_default_version.
10738         (Symbol_table::define_special_symbol): Add resolve_oldsym
10739         parameter.  Change all callers.  If the version for a symbol comes
10740         from a version script, resolve it with the symbol with the same
10741         name with no version.  Also add the symbol without a version if
10742         appropriate.
10743         (do_define_in_output_data): If resolving with oldsym, don't delete
10744         sym.
10745         (do_define_in_output_segment): Likewise.
10746         (do_define_as_constant): Likewise.
10747         * symtab.h (class Symbol_table): Update declarations.
10748
10749 2009-03-13  Ian Lance Taylor  <iant@google.com>
10750
10751         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10752         (Read_symbols::requeue): New function.
10753         (Read_symbols::do_read_symbols): If make_elf_object fails because
10754         the target type is not configured, and the file was searched for,
10755         issue a warning and retry with the next directory.
10756         (Add_symbols::run): If the file has an incompatible format, and
10757         it was searched for, requeue the Read_symbols task.  On error,
10758         release the object.
10759         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10760         dirindex parameter to constructor.  Change all callers.  Declare
10761         incompatible_warning and requeue.
10762         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10763         input_argument_ and input_group_ fields.  Add them to
10764         constructor.  Change all callers.
10765         (class Read_script): Add dirindex_ field.  Add it to constructor.
10766         Change all callers.
10767         * archive.cc (Archive::setup): Remove input_objects parameter.
10768         Change all callers.
10769         (Archive::get_file_and_offset): Likewise.
10770         (Archive::read_all_symbols): Likewise.
10771         (Archive::read_symbols): Likewise.
10772         (Archive::get_elf_object_for_member): Remove input_objects
10773         parameter.  Add punconfigured parameter.  Change all callers.
10774         (Archive::add_symbols): Change return type to bool.  Check return
10775         value of include_member.
10776         (Archive::include_all_members): Likewise.
10777         (Archive::include_member): Change return type to bool.  Return
10778         false if first included object has incompatible target.  Set
10779         included_member_ field.
10780         (Add_archive_symbols::run): If add_symbols returns false, requeue
10781         Read_symbols task.
10782         * archive.h (class Archive): Add included_member_ field.
10783         Initialize it in constructor.  Add input_file and searched_for
10784         methods.  Update declarations.
10785         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10786         input_argument_ fields.  Add them to constructor.  Change all
10787         callers.
10788         * script.cc: Include "target-select.h".
10789         (class Parser_closure): Add skip_on_incompatible_target_ and
10790         found_incompatible_target_ fields.  Add
10791         skip_on_incompatible_target parameter to constructor.  Change all
10792         callers.  Add methods skip_on_incompatible_target,
10793         clear_skip_on_incompatible_target, found_incompatible_target, and
10794         set_found_incompatible_target.
10795         (read_input_script): Add dirindex parameter.  Change all callers.
10796         If parser finds an incompatible target, requeue Read_symbols
10797         task.
10798         (script_set_symbol): Clear skip_on_incompatible_target in
10799         closure.
10800         (script_add_assertion, script_parse_option): Likewise.
10801         (script_start_sections, script_add_phdr): Likewise.
10802         (script_check_output_format): New function.
10803         * script.h (read_input_script): Update declaration.
10804         * script-c.h (script_check_output_format): Declare.
10805         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10806         (ignore_cmd): Remove OUTPUT_FORMAT.
10807         * fileread.cc (Input_file::Input_file): Add explicit this.
10808         (Input_file::will_search_for): New function.
10809         (Input_file::open): Add pindex parameter.  Change all callers.
10810         * fileread.h (class Input_file): Add input_file_argument method.
10811         Declare will_search_for.  Update declarations.
10812         * object.cc (make_elf_object): Add punconfigured parameter.
10813         Change all callers.
10814         * object.h (class Object): Make input_file public.  Add
10815         searched_for method.
10816         (make_elf_object): Update declaration.
10817         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10818         restart search.
10819         * dirsearch.h (class Dirsearch): Update declaration.
10820         * options.h (class General_options): Add --warn-search-mismatch.
10821         * parameters.cc (Parameters::is_compatible_target): New function.
10822         * parameters.h (class Parameters): Declare is_compatible_target.
10823         * workqueue.cc (Workqueue::add_blocker): New function.
10824         * workqueue.h (class Workqueue): Declare add_blocker.
10825
10826         * fileread.cc (Input_file::open): Remove options parameter.
10827         Change all callers.
10828         (Input_file::open_binary): Likewise.
10829         * script.cc (read_input_script): Likewise.
10830         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10831         options parameter from constructor.  Change all callers.
10832         (class Read_script): Likewise.
10833         * fileread.h (class Input_file): Update declarations.
10834         * script.h (read_input_script): Update declaration.
10835
10836 2009-03-10  Nick Clifton  <nickc@redhat.com>
10837
10838         * po/es.po: New Spanish translation.
10839
10840 2009-03-06  Cary Coutant  <ccoutant@google.com>
10841
10842         * options.cc (parse_short_option): Keep dash_z from registering itself.
10843
10844 2009-03-03  Ian Lance Taylor  <iant@google.com>
10845
10846         PR 9918
10847         * target-reloc.h (relocate_section): Pass output_section to
10848         relocate.
10849         * i386.cc (Target_i386::should_apply_static_reloc): Add
10850         output_section parameter.  Change all callers.
10851         (Target_i386::Relocate::relocate): Add output_section parameter.
10852         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10853         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10854         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10855         * testsuite/two_file_shared.sh: New script.
10856         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10857         (check_DATA): Add two_file_shared.dbg.
10858         (two_file_shared.dbg): New target.
10859         * testsuite/Makefile.in: Rebuild.
10860
10861 2009-03-01  Ian Lance Taylor  <iant@google.com>
10862
10863         * configure.ac: Check for byteswap.h.
10864         * configure: Rebuild.
10865         * config.in: Rebuild.
10866
10867 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10868
10869         * layout.cc (Layout::find_or_add_kept_section): New function.
10870         (Layout::add_comdat): Removed.
10871         * layout.h (struct Kept_section): Move out of class Layout.
10872         Remove trailing underscores from field names.  Add group_sections
10873         field.  Rename group_ field to is_group.  Change all uses.
10874         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10875         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10876         comdat_groups_ field.
10877         (Sized_relobj::include_section_group): Use
10878         find_or_add_kept_section and Kept_section::group_sections.
10879         (Sized_relobj::include_linkonce_section): Likewise.
10880         * object.cc (class Sized_relobj): Don't define Comdat_group or
10881         Comdat_group_table.  Remove find_comdat_group and
10882         add_comdat_group.  Remove comdat_groups_ field.
10883         * plugin.cc (include_comdat_group): Use
10884         Layout::find_or_add_kept_section.
10885
10886 2009-02-28  Ian Lance Taylor  <iant@google.com>
10887
10888         * README: --gc-sections and map files are now supported.  Document
10889         some build requirements.
10890
10891         PR 6992
10892         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10893         relocatable link set the value of the section symbol to zero.
10894         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10895         relocatable link don't include the section address in the local
10896         symbol value.
10897
10898 2009-02-27  Ian Lance Taylor  <iant@google.com>
10899
10900         PR 6811
10901         * options.h (class Search_directory): Add is_system_directory.
10902         (class General_options): Declare is_in_system_directory.
10903         * options.cc (get_relative_sysroot): Make static.
10904         (get_default_sysroot): Make static.
10905         (General_optoins::is_in_system_directory): New function.
10906         * fileread.cc (Input_file::is_in_system_directory): New function.
10907         * fileread.h (class Input_file): Declare is_in_system_directory.
10908         * object.h (class Object): Add is_in_system_directory.
10909         (class Input_objects): Remove system_library_directory_ field.
10910         * object.cc (Input_objects::add_object): Don't set
10911         system_library_directory_.
10912         (input_objects::found_in_system_library_directory): Remove.
10913         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10914         parameter.  Change all callers.
10915         (Symbol_table::sized_write_globals): Likewise.
10916         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10917         Call Object::is_in_system_directory.
10918         * symtab.h (class Symbol_table): Update declarations.
10919
10920         PR 5990
10921         * descriptors.h (Open_descriptor): Add is_on_stack field.
10922         * descriptors.cc (Descriptors::open): If the descriptor is on the
10923         top of the stack, remove it.  Initialize is_on_stack field.
10924         (Descriptors::release): Only add pod to stack if it is not on the
10925         stack already.
10926         (Descriptors::close_some_descriptor): Clear stack_next and
10927         is_on_stack fields.
10928
10929         PR 7091
10930         * output.cc (Output_section::find_starting_output_address): Rename
10931         from starting_output_address; add PADDR parameter; change return
10932         type.
10933         * output.h (class Output_section): Declare
10934         find_starting_output_address instead of starting_output_address.
10935         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10936         section symbol for which we can't find a merge section.
10937
10938         PR 9836
10939         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10940         hidden or internal, force the symbol to be local.
10941         * resolve.cc (Symbol::override_visibility): Define.
10942         (Symbol::override_base): Use override_visibility.
10943         (Symbol_table::resolve): Likewise.
10944         (Symbol::override_base_with_special): Likewise.
10945         (Symbol_table::override_with_special): If the visibility is hidden
10946         or internal, force the symbol to be local.
10947         * symtab.h (class Symbol): Add set_visibility and
10948         override_visibility.
10949         * testsuite/ver_test_1.sh: New file.
10950         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10951         (check_DATA): Add ver_test_1.syms.
10952         (ver_test_1.syms): New target.
10953         * testsuite/Makefile.in: Rebuild.
10954
10955 2009-02-25  Cary Coutant  <ccoutant@google.com>
10956
10957         * layout.cc (Layout::choose_output_section): Don't rename sections
10958         when using a linker script that has a SECTIONS clause.
10959         * Makefile.in: Regenerate.
10960
10961         * testsuite/Makefile.am (script_test_5.sh): New test case.
10962         * testsuite/Makefile.in: Regenerate.
10963         * testsuite/script_test_5.cc: New file.
10964         * testsuite/script_test_5.sh: New file.
10965         * testsuite/script_test_5.t: New file.
10966
10967 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10968
10969         * archive.cc (Archive::include_member): Update calls to add_symbols.
10970         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10971         the Layout argument.
10972         * dynobj.h (do_add_symbols): Add the Layout argument.
10973         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10974         Layout argument.
10975         * object.h (Object::add_symbols): Add the Layout argument.
10976         (Object::do_add_symbols): Add the Layout argument.
10977         (Sized_relobj::do_add_symbols): Add the Layout argument.
10978         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10979         Unify the two versions.
10980         (Add_plugin_symbols): Remove.
10981         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10982         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10983         (Add_plugin_symbols): Remove.
10984         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10985         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10986         (Add_symbols::run): Make it work with Pulginobj.
10987
10988 2009-02-06  Ian Lance Taylor  <iant@google.com>
10989
10990         * object.cc (Sized_relobj::do_layout): Make info message start
10991         with lower case letter.
10992
10993 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10994
10995         * binary.cc: Fix file comment.
10996
10997         * options.h (enum Incremental_disposition): Define.
10998         (class General_options): Add new options: --incremental,
10999         --incremental_changed, --incremental_unchanged,
11000         --incremental_unknown.  Add incremental_disposition_ and
11001         implicit_incremental_ fields.
11002         (General_options::incremental_disposition): New function.
11003         (class Position_dependent_options): Add incremental_disposition
11004         option.
11005         (Position_dependent_options::copy_from_options): Set incremental
11006         dispositions.
11007         * options.cc (General_options::parse_incremental_changed): New
11008         function.
11009         (General_options::parse_incremental_unchanged): New function.
11010         (General_options::parse_incremental_unknown): New function.
11011         (General_options::General_options): Initialize new fields
11012         incremental_disposition_ and implicit_incremental_.
11013         (General_options::finalize): Check for uasge of --incremental-*
11014         without --incremental.
11015
11016 2009-02-06  Chris Demetriou  <cgd@google.com>
11017
11018         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11019         pointer and to report location as the file name associated with
11020         the symbol.
11021         (gold_undefined_symbol_at_location): New function to replace the
11022         old gold_undefined_symbol functionality.
11023         * target-reloc.h (relocate_section): Update to use
11024         gold_undefined_symbol_at_location.
11025         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11026         Call gold_undefined_symbol function rather than gold_error.
11027         * errors.h (Errors::undefined_symbol): Take location as a
11028         string, rather than calculating it from a relocation.
11029         * errors.cc (Errors::fatal): Print "fatal error:" before the
11030         formatted message.
11031         (Errors::error, Errors::error_at_location): Print "error: "
11032         before the formatted message.
11033         (Errors::undefined_symbol): Take location as a string, rather
11034         than calculating it from a relocation.
11035         (gold_undefined_symbol_at_location): New function akin to
11036         old gold_undefined_symbol, calculates location from relocation.
11037         (gold_undefined_symbol): Change to take only a Symbol pointer
11038         and to report location as the file name associated with the symbol.
11039         * testsuite/debug_msg.sh: Update for changed error messages.
11040         * testsuite/undef_symbol.sh: Likewise.
11041
11042 2009-02-04  Duncan Sands  <baldrick@free.fr>
11043
11044         PR 9812
11045         * reduced_debug_output.h
11046         (Output_reduced_debug_abbrev_section::failed): Use format for
11047         gold_warning.
11048         (Output_reduced_debug_info_section::faild): Likewise.
11049
11050 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11051
11052         * script.cc (Lazy_demangler): New class.
11053         (Version_script_info::get_symbol_version_helper): Demangle a
11054         symbol only once.
11055
11056 2009-01-29  Cary Coutant  <ccoutant@google.com>
11057
11058         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11059         to __tls_get_addr.
11060         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11061
11062 2009-01-28  Ian Lance Taylor  <iant@google.com>
11063
11064         * version.cc (version_string): Bump to 1.9.
11065
11066         * gold.h: Include <cstring> and <stdint.h>.
11067         * version.cc: Include <cstdio>.
11068         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11069         warning.
11070         * reduced_debug_output.cc (insert_into_vector): Rename from
11071         Insert_into_vector; change all callers.  Use Swap_unaligned to
11072         avoid aliasing issue; remove union since it is unnecessary.
11073
11074 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11075
11076         * Makefile.am (CCFILES): Add gc.cc.
11077         (HFILES): Add gc.h.
11078         * Makefile.in: Regenerate.
11079         * gold.cc (Gc_runner): New class.
11080         (queue_initial_tasks): Call garbage collection related tasks
11081         when corresponding options are invoked.
11082         (queue_middle_gc_tasks): New function.
11083         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11084         processed early before laying out sections during garbage collection.
11085         * gold.h (queue_middle_gc_tasks): New function.
11086         (is_prefix_of): Move from "layout.cc".
11087         * i386.cc (Target_i386::gc_process_relocs): New function.
11088         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11089         * main.cc (main): Create object of class "Garbage_collection".
11090         * object.cc (Relobj::copy_symbols_data): New function.
11091         (Relobj::is_section_name_included): New function.
11092         (Sized_relobj::do_layout): Allow this function to be called twice
11093         during garbage collection and defer layout of section during the
11094         first call.
11095         * object.h (Relobj::get_symbols_data): New function.
11096         (Relobj::is_section_name_included): New function.
11097         (Relobj::copy_symbols_data): New function.
11098         (Relobj::set_symbols_data): New function.
11099         (Relobj::get_relocs_data): New function.
11100         (Relobj::set_relocs_data): New function.
11101         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11102         (Relobj::gc_process_relocs): New function.
11103         (Relobj::do_gc_process_relocs): New pure virtual function.
11104         (Relobj::sd_): New data member.
11105         (Sized_relobj::is_output_section_offset_invalid): New function.
11106         (Sized_relobj::do_gc_process_relocs): New function.
11107         * options.h (General_options::gc_sections): Modify to not be a no-op.
11108         (General_options::print_gc_sections): New option.
11109         * plugin.cc (Plugin_finish::run): Remove function call to
11110         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11111         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11112         * reloc.cc (Read_relocs::run): Add task to process relocs and
11113         determine unreferenced sections when doing garbage collection.
11114         (Gc_process_relocs): New class.
11115         (Sized_relobj::do_gc_process_relocs): New function.
11116         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11117         sections that are garbage collected.
11118         * reloc.h (Gc_process_relocs): New class.
11119         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11120         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11121         symbols whose corresponding sections are garbage collected.
11122         (Symbol_table::Symbol_table): Add new parameter for the garbage
11123         collection object.
11124         (Symbol_table::gc_mark_undef_symbols): New function.
11125         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11126         (Symbol_table::gc_mark_dyn_syms): New function.
11127         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11128         as garbage.
11129         (Symbol_table::add_from_object): Likewise.
11130         (Symbol_table::add_from_relobj): When building shared objects, do not
11131         treat externally visible symbols as garbage.
11132         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11133         table information for static and relocatable links.
11134         * symtab.h (Symbol_table::set_gc): New function.
11135         (Symbol_table::gc): New function.
11136         (Symbol_table::gc_mark_undef_symbols): New function.
11137         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11138         (Symbol_table::gc_mark_dyn_syms): New function.
11139         (Symbol_table::gc_): New data member.
11140         * target.h (Sized_target::gc_process_relocs): New pure virtual
11141         function.
11142         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11143         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11144
11145 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11146
11147         * options.h (General_options::gc_sections): Define as a no-op for now.
11148         (General_options::no_keep_memory): Ditto.
11149         (General_options::Bshareable): Define.
11150         * options.cc (General_options::finalize): Honor -Bshareable.
11151
11152 2009-01-20  Andreas Schwab  <schwab@suse.de>
11153
11154         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11155         read the value in the contents, since we don't use it.  Use the
11156         template endianness when writing.
11157         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11158
11159 2009-01-19  Andreas Schwab  <schwab@suse.de>
11160
11161         * configure.tgt (powerpc64-*): Fix targ_obj.
11162
11163 2009-01-15  Ian Lance Taylor  <iant@google.com>
11164
11165         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11166         local symbols when stripping all symbols.
11167
11168 2009-01-14  Cary Coutant  <ccoutant@google.com>
11169
11170         * output.cc (Output_reloc): Add explicit instantiations.
11171
11172 2009-01-14  Cary Coutant  <ccoutant@google.com>
11173
11174         * archive.cc (Archive::get_elf_object_for_member): Remove call
11175         to File_read::claim_for_plugin.
11176         * descriptors.cc (Descriptors::open): Remove reference to
11177         is_claimed.
11178         (Descriptors::claim_for_plugin): Remove.
11179         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11180         (Descriptors::is_claimed): Remove.
11181         (claim_descriptor_for_plugin): Remove.
11182         * fileread.cc (File_read::claim_for_plugin): Remove.
11183         * fileread.h (File_read::claim_for_plugin): Remove.
11184         (File_read::descriptor): Reopen descriptor if necessary.
11185         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11186         (Plugin_manager::all_symbols_read): Add task parameter. Change
11187         all callers.
11188         (Plugin_manager::get_input_file): New function.
11189         (Plugin_manager::release_input_file): New function.
11190         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11191         corresponding data member.
11192         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11193         and pass to base constructor. Change all callers.
11194         (get_input_file, release_input_file): New functions.
11195         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11196         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11197         (Plugin_manager::all_symbols_read): Add task parameter.
11198         (Plugin_manager::get_input_file): New function.
11199         (Plugin_manager::release_input_file): New function.
11200         (Plugin_manager::task_): New data member.
11201         (Pluginobj::Pluginobj): Add filesize parameter.
11202         (Pluginobj::filename): New function.
11203         (Pluginobj::descriptor): New function.
11204         (Pluginobj::filesize): New function.
11205         (Pluginobj::filesize_): New data member.
11206         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11207         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11208         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11209
11210         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11211         with archive libraries.
11212         * testsuite/Makefile.in: Regenerate.
11213         * testsuite/plugin_test.c (struct sym_info): New type.
11214         (get_input_file, release_input_file): New static variables.
11215         (onload): Capture new transfer vector entries.
11216         (claim_file_hook): Stop reading at end of file according to filesize.
11217         Factor out parsing of readelf output into separate function.
11218         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11219         APIs and get the source file name from the symbol table.  Convert
11220         source file name to corresponding object file name.  Print info
11221         message when adding new input files.
11222         (parse_readelf_line): New function.
11223         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11224         * testsuite/plugin_test_2.sh: Likewise.
11225         * testsuite/plugin_test_3.sh: Likewise.
11226         * testsuite/plugin_test_4.sh: New test case.
11227
11228 2009-01-07  Ian Lance Taylor  <iant@google.com>
11229
11230         * version.cc (version_string): Bump to 1.8.
11231
11232 2008-12-23  Cary Coutant  <ccoutant@google.com>
11233
11234         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11235         * plugin.cc (Plugin_manager::finish): Rename as
11236         layout_deferred_objects.  Move cleanup to separate function.
11237         (Plugin_manager::cleanup): New function.
11238         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11239         separately.
11240         * plugin.h (Plugin_manager::finish): Rename as
11241         layout_deferred_objects.
11242         (Plugin_manager::cleanup): New function.
11243         (Plugin_manager::cleanup_done): New field.
11244
11245 2008-12-23  Cary Coutant  <ccoutant@google.com>
11246
11247         * plugin.cc (is_visible_from_outside): New function.
11248         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11249         so we don't return "IR only" status for exported symbols or -r links.
11250
11251         * testsuite/Makefile.am (plugin_test_3): New test case.
11252         * testsuite/Makefile.in: Regenerate.
11253         * testsuite/plugin_test_3.sh: New file.
11254
11255 2008-12-22  Cary Coutant  <ccoutant@google.com>
11256
11257         * object.cc (Sized_relobj::layout_section): New function.
11258         (Sized_relobj::do_layout): Defer layout of input sections until after
11259         plugin has provided replacement files.
11260         (Sized_relobj::do_layout_deferred_sections): New function.
11261         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11262         (Relobj::layout_deferred_sections): New function.
11263         (Relobj::do_layout_deferred_sections): New function.
11264         (Sized_relobj::do_layout_deferred_sections): New function.
11265         (Sized_relobj::layout_section): New function.
11266         (Sized_relobj::Deferred_layout): New structure.
11267         (Sized_relobj::deferred_layout_): New field.
11268         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11269         Change all callers.  Layout deferred sections.
11270         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11271         references.
11272         (Plugin_hook::run): Move code from do_plugin_hook inline.
11273         (Plugin_hook::do_plugin_hook): Remove.
11274         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11275         (Plugin_manager::finish): Renamed, was cleanup.
11276         (Plugin_manager::should_defer_layout): New function.
11277         (Plugin_manager::add_deferred_layout_object): New function.
11278         (Plugin_manager::Deferred_layout_list): New type.
11279         (Plugin_manager::deferred_layout_objects_): New field.
11280         (Plugin_hook::do_plugin_hook): Remove.
11281
11282 2008-12-17  Ian Lance Taylor  <iant@google.com>
11283
11284         * options.h (class General_options): Add --no case for
11285         --export-dynamic.
11286
11287 2008-12-16  Cary Coutant  <ccoutant@google.com>
11288
11289         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11290         vector.
11291         (Plugin_manager::claim_file): Create plugin object even if
11292         plugin did not call the add_symbols callback.
11293         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11294         asking for more symbols than were added.
11295         * testsuite/Makefile.am (plugin_test_1): Add test case with
11296         no global symbols.
11297         (empty.syms): New target.
11298         * testsuite/Makefile.in: Regenerate.
11299         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11300         message. Don't call add_symbols if no globals.
11301         (all_symbols_read_hook): Don't provide replacement for empty
11302         claimed file.
11303
11304 2008-12-12  Ian Lance Taylor  <iant@google.com>
11305
11306         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11307         r_type == 0 for a local symbol with r_sym == 0.
11308         (scan_relocatable_relocs): Pass r_sym to
11309         local_non_section_strategy.
11310         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11311         r_sym parameter.
11312
11313         * configure.ac: Update test for TLS descriptors: they are
11314         supported as of glibc 2.9.
11315         * configure: Rebuild.
11316
11317 2008-12-11  Ian Lance Taylor  <iant@google.com>
11318
11319         PR 7091
11320         * target-reloc.h (Default_scan_relocatable_relocs): For each
11321         function, map r_type == 0 to RELOC_DISCARD.
11322
11323 2008-12-10  Cary Coutant  <ccoutant@google.com>
11324
11325         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11326         object to override a kept COMDAT group from a plugin object.
11327
11328 2008-12-09  Ian Lance Taylor  <iant@google.com>
11329
11330         PR 7088
11331         * yyscript.y (file_cmd): Handle INPUT.
11332
11333         * testsuite/initpri1.c: Change all declarations to be full
11334         prototypes by adding void, to avoid compiler warnings.
11335
11336 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11337
11338         * options.cc (General_options::parse_plugin_opt): New.
11339         (General_options::add_plugin): The argument now is just the filename.
11340         (General_options::add_plugin_option): New.
11341         * options.h (plugin_opt): New.
11342         (add_plugin): Change argument name.
11343         (add_plugin_option): New.
11344         * plugin.cc (Plugin::load): Don't parse the plugin option.
11345         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11346         (Plugin::add_option): New.
11347         (Plugin::args_): Change type.
11348         (Plugin::filename_): New.
11349         (Plugin_manager::add_plugin_option): New.
11350         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11351         * testsuite/Makefile.in: Regenerate.
11352
11353 2008-12-05  Cary Coutant  <ccoutant@google.com>
11354
11355         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11356         Handle --strip-lto-sections option.
11357         * options.h (strip_lto_sections): New option.
11358
11359 2008-12-01  Cary Coutant  <ccoutant@google.com>
11360
11361         * plugin.cc (ld_plugin_message): Change format parameter to const.
11362         Fix mismatch between new[] and delete.
11363
11364 2008-11-14  Cary Coutant  <ccoutant@google.com>
11365
11366         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11367         instead of -1U.
11368
11369 2008-11-05  Craig Silverstein  <csilvers@google.com>
11370
11371         * options.cc (General_options::parse_dynamic_list): New function.
11372         * options.h (General_options): New flags dynamic_list,
11373         dynamic_list_data, dynamic_list_cpp_new, and
11374         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11375         (General_options::in_dynamic_list): New function.
11376         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11377         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11378         (Lex::can_continue_name): Likewise.
11379         (yylex): Likewise.
11380         (read_script_file): New parameter script_options.
11381         (read_dynamic_list): New function.
11382         (Script_options::define_dynamic_list): New function.
11383         (dynamic_list_keyword_parsecodes): New variable.
11384         (dynamic_list_keywords): New variable.
11385         * script.h (Script_options::define_dynamic_list): New function
11386         prototype.
11387         (read_dynamic_list): New function prototype.
11388         * symtab.cc (strprefix): New macro.
11389         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11390         dynamic_list_data, dynamic_list_cpp_new, and
11391         dynamic_list_cpp_typeinfo.
11392         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11393         (dynamic_list_expr): New rule.
11394         (dynamic_list_nodes): Likewise.
11395         (dynamic_list_node): Likewise.
11396         * testsuite/Makefile.am (dynamic_list): New test.
11397         * testsuite/Makefile.in: Regenerated.
11398         * testsuite/dynamic_list.t: New file.
11399         * testsuite/dynamic_list.sh: New file.
11400
11401 2008-11-05  Craig Silverstein  <csilvers@google.com>
11402
11403         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11404         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11405         (t11_last): Likewise.
11406         * testsuite/ver_test_6.c (main): Likewise.
11407
11408 2008-10-07  Cary Coutant  <ccoutant@google.com>
11409
11410         * options.c (General_options::finalize): Add check for -static and
11411         -shared.
11412         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11413         is not empty.
11414
11415 2008-10-02  Cary Coutant  <ccoutant@google.com>
11416
11417         * plugin.cc (make_sized_plugin_object): Fix conditional
11418         compilation to work when not all targets are enabled.
11419
11420 2008-09-29  Cary Coutant  <ccoutant@google.com>
11421
11422         * archive.cc (Archive::get_file_and_offset): Use filename instead
11423         of name to get library path.
11424         (Archive::include_member): Unlock external member of a thin archive.
11425
11426         * testsuite/Makefile.am (TEST_AR): New variable.
11427         (thin_archive_test_1): New test.
11428         (thin_archive_test_2): New test.
11429         * testsuite/Makefile.in: Regenerate.
11430         * testsuite/thin_archive_main.cc: New file.
11431         * testsuite/thin_archive_test_1.cc: New file.
11432         * testsuite/thin_archive_test_2.cc: New file.
11433         * testsuite/thin_archive_test_3.cc: New file.
11434         * testsuite/thin_archive_test_4.cc: New file.
11435
11436 2008-09-29  Cary Coutant  <ccoutant@google.com>
11437
11438         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11439         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11440         instead of -1U.
11441         (Sized_relobj::do_finalize_local_symbols): Likewise.
11442         (Sized_relobj::map_to_kept_section): Likewise.
11443         * object.h (Sized_relobj::invalid_address): New constant.
11444         (Sized_relobj::do_output_section_offset): Check for invalid_address
11445         and return -1ULL.
11446         * output.cc (Output_reloc::local_section_offset): Use constant
11447         invalid_address instead of -1U.
11448         (Output_reloc::get_address): Likewise.
11449         (Output_section::output_address): Change -1U to -1ULL.
11450         * output.h (Output_reloc::invalid_address): New constant.
11451         * reloc.cc (Sized_relobj::write_sections): Use constant
11452         invalid_address instead of -1U.
11453         (Sized_relobj::relocate_sections): Likewise.
11454         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11455         values for merge sections.
11456         * target-reloc.h (relocate_for_relocatable): Use constant
11457         invalid_address instead of -1U.
11458
11459 2008-09-19  Cary Coutant  <ccoutant@google.com>
11460
11461         Add plugin functionality for link-time optimization (LTO).
11462         * configure.ac (plugins): Add --enable-plugins option.
11463         * configure: Regenerate.
11464         * config.in: Regenerate.
11465         * Makefile.am (LIBDL): New variable.
11466         (CCFILES): Add plugin.cc.
11467         (HFILES): Add plugin.h.
11468         (ldadd_var): Add LIBDL.
11469         * Makefile.in: Regenerate.
11470
11471         * archive.cc: Include "plugin.h".
11472         (Archive::setup): Don't preread archive symbols when using a plugin.
11473         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11474         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11475         files.
11476         (Archive::include_member): Add symbols from plugin objects.
11477         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11478         * descriptors.cc (Descriptors::open): Check for file descriptors
11479         abandoned by plugins.
11480         (Descriptors::claim_for_plugin): New function.
11481         * descriptors.h (Descriptors::claim_for_plugin): New function.
11482         (Open_descriptor::is_claimed): New field.
11483         (claim_descriptor_for_plugin): New function.
11484         * fileread.cc (File_read::claim_for_plugin): New function.
11485         * fileread.h (File_read::claim_for_plugin): New function.
11486         (File_read::descriptor): New function.
11487         * gold.cc: Include "plugin.h".
11488         (queue_initial_tasks): Add task to call plugin hooks for generating
11489         new object files.
11490         * main.cc: Include "plugin.h".
11491         (main): Load plugin libraries.
11492         * object.h (Pluginobj): Declare.
11493         (Object::pluginobj): New function.
11494         (Object::do_pluginobj): New function.
11495         (Object::set_target): New function.
11496         * options.cc: Include "plugin.h".
11497         (General_options::parse_plugin): New function.
11498         (General_options::General_options): Initialize plugins_ field.
11499         (General_options::add_plugin): New function.
11500         * options.h (Plugin_manager): Declare.
11501         (General_options): Add --plugin option.
11502         (General_options::has_plugins): New function.
11503         (General_options::plugins): New function.
11504         (General_options::add_plugin): New function.
11505         (General_options::plugins_): New field.
11506         * plugin.cc: New file.
11507         * plugin.h: New file.
11508         * readsyms.cc: Include "plugin.h".
11509         (Read_symbols::do_read_symbols): Check for archive before checking
11510         for ELF file.  Call plugin hooks to claim files.
11511         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11512         from a real object file; force override when processing replacement
11513         files.
11514         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11515         (Symbol::init_base_object): Likewise.
11516         (Symbol::init_base_output_data): Likewise.
11517         (Symbol::init_base_output_segment): Likewise.
11518         (Symbol::init_base_constant): Likewise.
11519         (Symbol::init_base_undefined): Likewise.
11520         (Symbol::output_section): Assert that object is not a plugin.
11521         (Symbol_table::add_from_pluginobj): New function.
11522         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11523         undefined.
11524         (Symbol_table::sized_write_globals): Likewise.
11525         (Symbol_table::add_from_pluginobj): Instantiate template.
11526         * symtab.h (Sized_pluginobj): Declare.
11527         (Symbol::in_real_elf): New function.
11528         (Symbol::set_in_real_elf): New function.
11529         (Symbol::in_real_elf_): New field.
11530         (Symbol_table::add_from_pluginobj): New function.
11531
11532         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11533         (LIBDL): New variable.
11534         (LDADD): Add LIBDL.
11535         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11536         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11537         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11538         (MOSTLYCLEANFILES): Likewise.
11539         * testsuite/Makefile.in: Regenerate.
11540         * testsuite/plugin_test.c: New file.
11541         * testsuite/plugin_test_1.sh: New file.
11542         * testsuite/plugin_test_2.sh: New file.
11543
11544 2008-09-16  Ian Lance Taylor  <iant@google.com>
11545
11546         * target-reloc.h (relocate_section): Check whether a symbol is
11547         defined by the ABI before reporting an undefined symbol error.
11548         * target.h (Target::is_defined_by_abi): Make parameter const.
11549         (Target::do_is_defined_by_abi): Likewise.
11550         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11551         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11552         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11553         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11554         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11555         * testsuite/Makefile.in: Rebuild.
11556
11557         * fileread.cc (make_view): Add casts to avoid warning.
11558
11559 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11560
11561         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11562         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11563
11564 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11565
11566         * options.h (General_options::output_is_executable): New.
11567         (General_options::output_is_pie): New.
11568         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11569         for shared libraries.
11570         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11571
11572 2008-09-11  Chris Demetriou  <cgd@google.com>
11573
11574         * options.h (origin): New -z option.
11575         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11576         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11577         in DT_FLAGS_1.
11578
11579 2008-09-05  Cary Coutant  <ccoutant@google.com>
11580
11581         * fileread.cc (File_read::make_view): Add check for attempt to map
11582         beyond end of file.
11583
11584 2008-09-05  Cary Coutant  <ccoutant@google.com>
11585
11586         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11587         explicit instantiations.
11588
11589 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11590
11591         PR gold/6858
11592         * options.cc (General_options::finalize): Allow undefined symbols
11593         in shlibs if linking -shared.
11594
11595         PR gold/6859
11596         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11597         symbols as not needing a dynsym entry.
11598
11599 2008-08-20  Craig Silverstein  <csilvers@google.com>
11600
11601         * fileread.cc (File_read::open): Do not lock the file unless it
11602         was successfully opened.
11603
11604 2008-08-14  Cary Coutant  <ccoutant@google.com>
11605
11606         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11607         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11608         * testsuite/tls_test.cc (struct int128): 128-bit struct
11609         for testing TLS relocs with non-zero addend.
11610         (v12): New TLS variable.
11611         (t12): New test.
11612         (t_last): Add check for v12.
11613         * testsuite/tls_test.h (t12): New function.
11614         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11615
11616 2008-08-13  Ian Lance Taylor  <iant@google.com>
11617
11618         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11619         set tls_segment_ or relro_segment_.
11620         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11621         when appropriate.
11622         * output.h (Output_section::clear_is_relro): New function.
11623         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11624         sections specially even when output_data_ is empty.
11625         (Output_segment::maximum_alignment): When first section is relro,
11626         only force alignment for PT_LOAD segments.
11627         * script.cc (script_data_segment_align): New function.
11628         (script_data_segment_relro_end): New function.
11629         * script-c.h (script_data_segment_align): Declare.
11630         (script_data_segment_relro_end): Declare.
11631         * script-sections.h (class Script_sections): Declare
11632         data_segment_align and data_segment_relro_end.  Add fields
11633         segment_align_index_ and saw_relro_end_.
11634         * script-sections.cc (class Sections_element): Add set_is_relro
11635         virtual function.  Add new bool* parameter to place_orphan_here.
11636         Add get_output_section virtual function.
11637         (class Output_section_definition): Add set_is_relro.  Add new
11638         bool* parameter to place_orphan_here.  Add get_output_section.
11639         Add is_relro_ field.
11640         (Output_section_definition::Output_section_definition): Initialize
11641         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11642         and is_relro_ fields.
11643         (Output_section_definition::place_orphan_here): Add is_relro
11644         parameter.
11645         (Output_section_definition::set_section_addresses): Set relro for
11646         output section.
11647         (Output_section_definition::alternate_constraint): Likewise.
11648         (class Orphan_output_section): Add new bool* parameter to
11649         place_orphan_here.  Add get_output_section.
11650         (Orphan_output_section::place_orphan_here): Add is_relro
11651         parameter.
11652         (Script_sections::Script_sections): Initialize
11653         data_segment_align_index_ and saw_relro_end_.
11654         (Script_sections::data_segment_align): New function.
11655         (Script_sections::data_segment_relro_end): New function.
11656         (Script_sections::place_orphan): Set or clear is_relro.
11657         (Script_sections::set_section_addresses): Force alignment of first
11658         TLS section.
11659         * yyscript.y (exp): Call script_data_segment_align and
11660         script_data_segment_relro_end.
11661         * testsuite/relro_script_test.t: New file.
11662         * testsuite/relro_test.cc (using_script): Declare.
11663         (t1, t2): Test using_script.
11664         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11665         (relro_script_test_SOURCES): Define.
11666         (relro_script_test_DEPENDENCIES): Define.
11667         (relro_script_test_LDFLAGS): Define.
11668         (relro_script_test_LDADD): Define.
11669         (relro_script_test.so): New target.
11670         * testsuite/Makefile.in: Rebuild.
11671
11672 2008-08-06  Cary Coutant <ccoutant@google.com>
11673
11674         * archive.cc (Archive::total_archives, Archive::total_members)
11675         (Archive::total_members_loaded): New variables.
11676         (Archive::setup): Add parameter.  Add option to preread
11677         archive symbols.
11678         (Archive::read_armap): Add counter.
11679         (Archive::get_file_and_offset): New function.
11680         (Archive::get_elf_object_for_member): New function.
11681         (Archive::read_all_symbols): New function.
11682         (Archive::read_symbols): New function.
11683         (Archive::add_symbols): Add counters.
11684         (Archive::include_all_members): Use armap to find members if it's
11685         already built.
11686         (Archive::include_member): Skip reading symbols if already read.
11687         Factored code into Archive::get_file_and_offset and
11688         Archive::get_elf_object_for_member.  Changed call to
11689         Mapfile::report_include_archive_member.
11690         (Archive::print_stats): New function.
11691         * archive.h: Declare Object and Read_symbols_data classes.
11692         (Archive::Archive): Add initializers for new members.
11693         (Archive::setup): Add parameter.
11694         (Archive::print_stats): New function.
11695         (Archive::total_archives, Archive::total_members)
11696         (Archive::total_members_loaded): New variables.
11697         (Archive::get_file_and_offset): New function.
11698         (Archive::get_elf_object_for_member): New function.
11699         (Archive::read_all_symbols): New function.
11700         (Archive::read_symbols): New function.
11701         (Archive::Archive_member): New class.
11702         (Archive::members_): New member.
11703         (Archive::num_members_): New member.
11704         * main.cc: Include archive.h.
11705         (main): Call Archive::print_stats.
11706         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11707         archive parameter; member_name is now the fully-decorated name.
11708         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11709         * options.h: (General_options): Add --preread-archive-symbols option.
11710         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11711         Archive::setup.
11712
11713 2008-08-04  Ian Lance Taylor  <iant@google.com>
11714
11715         * symtab.h (Symbol::use_plt_offset): New function.
11716         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11717         * powerpc.cc (Relocate::relocate): Likewise.
11718         * sparc.cc (Relocate::relocate): Likewise.
11719         * x86_64.cc (Relocate::relocate): Likewise.
11720         * testsuite/weak_plt.sh: New test.
11721         * testsuite/weak_plt_main.cc: New test.
11722         * testsuite/weak_plt_shared.cc: New test.
11723         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11724         (check_PROGRAMS): Add weak_plt.
11725         (check_DATA): Add weak_plt_shared.so.
11726         (weak_plt_main_pic.o, weak_plt): New targets.
11727         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11728         * testsuite/Makefile.in: Rebuild.
11729
11730         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11731         gcctestdir/ld.
11732         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11733         * testsuite/Makefile.in: Rebuild.
11734
11735 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11736
11737         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11738         * Makefile.in: Regenerate.
11739         * po/POTFILES.in: Regenerate.
11740
11741 2008-07-29  Ian Lance Taylor  <iant@google.com>
11742
11743         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11744         symbols before other symbols.
11745         * testsuite/script_test_2.cc (test_addr): Declare.
11746         (test_addr_alias): Declare.
11747         (main): Check that test_addr and test_addr_alias have the right
11748         values.
11749         * testsuite/script_test_2.t: Define test_addr_alias and
11750         test_addr.
11751
11752 2008-07-24  Ian Lance Taylor  <iant@google.com>
11753
11754         PR 5990
11755         * descriptors.cc: New file.
11756         * descriptors.h: New file.
11757         * gold-threads.h (class Hold_optional_lock): New class.
11758         * fileread.cc: Include "descriptors.h".
11759         (File_read::~File_read): Release descriptor rather than closing
11760         it.
11761         (File_read::open) [file]: Call open_descriptor rather than open.
11762         Set is_descriptor_opened_.
11763         (File_read::open) [memory]: Assert that descriptor is not open.
11764         (File_read::reopen_descriptor): New function.
11765         (File_read::release): Release descriptor.
11766         (File_read::do_read): Make non-const.  Reopen descriptor.
11767         (File_read::read): Make non-const.
11768         (File_read::make_view): Reopen descriptor.
11769         (File_read::do_readv): Likewise.
11770         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11771         Update declarations.
11772         * layout.cc: Include "descriptors.h".
11773         (Layout::create_build_id): Use open_descriptor rather than open.
11774         * output.cc: Include "descriptors.h".
11775         (Output_file::open): Use open_descriptor rather than open.
11776         * archive.cc (Archive::const_iterator): Change Archive to be
11777         non-const.
11778         (Archive::begin, Archive::end): Make non-const.
11779         (Archive::count_members): Likewise.
11780         * archive.h (class Archive): Update declarations.
11781         * object.h (Object::read): Make non-const.
11782         * Makefile.am (CCFILES): Add descriptors.cc.
11783         (HFILES): Add descriptors.h.
11784         * Makefile.in: Rebuild.
11785
11786         PR 6716
11787         * gold.h: Always include <clocale>.  Add Solaris workarounds
11788         following code in binutils/sysdep.h.
11789
11790         PR 6048
11791         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11792         this->eh_frame_hdr_ is NULL before using it.
11793
11794         * dynobj.cc (Versions::Versions): Update comment.
11795
11796         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11797         the base version name.
11798
11799         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11800         array size plus one.
11801         (Stringpool_template::set_string_offsets): Subtract one from key
11802         before using it as an array index.
11803         (Stringpool_template::get_offset_with_length): Likewise.
11804         (Stringpool_template::write_to_buffer): Likewise.
11805         * stringpool.h (Stringpool_template::get_offset_from_key):
11806         Likewise.
11807
11808 2008-07-23  Ian Lance Taylor  <iant@google.com>
11809
11810         PR 6658
11811         * object.h (Merged_symbol_value::value): Do our best to handle a
11812         negative addend.
11813
11814         PR 6647
11815         * script.cc (Version_script_info::get_versions): Don't add empty
11816         version tag to return value.
11817         (Version_script_info::get_symbol_version_helper): Change return
11818         type to bool.  Add pversion parameter.  Change all callers.
11819         (script_register_vers_node): Don't require a non-NULL tag.
11820         * script.h (class Version_script_info): Update declarations.
11821         (Version_script_info::get_symbol_version): Change return type to
11822         bool.  Add version parameter.  Change all callers.
11823         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11824         handling.  Handle an empty version from a version script.
11825         (Symbol_table::define_special_symbol): Likewise.
11826         * testsuite/ver_test_10.script: New file.
11827         * testsuite/ver_test_10.sh: New file.
11828         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11829         (check_DATA): Add ver_test_10.syms.
11830         (ver_test_10.syms, ver_test_10.so): New target.
11831         * testsuite/Makefile.in: Rebuild.
11832
11833 2008-07-23  Simon Baldwin  <simonb@google.com>
11834
11835         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11836         to zero for undefined symbols from dynamic libraries.
11837
11838 2008-07-23  Ian Lance Taylor  <iant@google.com>
11839
11840         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11841         Change all callers.
11842         * symtab.h (class Symbol_table): Update declaration.
11843         * testsuite/ver_test_9.cc: New file.
11844         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11845         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11846         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11847         (ver_test_9.so, ver_test_9.o): New targets.
11848         * testsuite/Makefile.in: Rebuild.
11849
11850 2008-07-22  Ian Lance Taylor  <iant@google.com>
11851
11852         * options.h (class General_options): Define --check-sections.
11853         * layout.cc (Layout::set_segment_offsets): Handle
11854         --check-sections.
11855
11856         * options.h (class General_options): Define -n/--nmagic and
11857         -N/--omagic.
11858         * options.cc (General_options::finalize): For -n/--nmagic or
11859         -N/--omagic, set -static.
11860         * layout.cc (Layout::attach_allocated_section_to_segment): If
11861         -N/--omagic, don't put read-only and read-write sections in
11862         different segments.
11863         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11864         finding a read-only segment.
11865         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11866         don't set the minimum segment alignment to the common page size,
11867         and don't set the file offset to the address modulo the page size.
11868         * script-sections.cc (Script_sections::create_segments): If
11869         -n/--omagic, don't put read-only and read-write sections in
11870         different segments.
11871
11872         * cref.cc: New file.
11873         * cref.h: New file.
11874         * options.h (class General_options): Add --print-symbol-counts.
11875         * main.cc (main): Issue defined symbol report if requested.
11876         * archive.cc (Archive::interpret_header): Make into a const member
11877         function.
11878         (Archive::add_symbols): Call Input_objects::archive_start and
11879         archive_stop.
11880         (Archive::const_iterator): Define new class.
11881         (Archive::begin, Archive::end): New functions.
11882         (Archive::include_all_members): Rewrite to use iterator.
11883         (Archive::count_members): New function.
11884         * archive.h (class Archive): Update declarations.
11885         (Archive::filename): New function.
11886         * object.cc: Include "cref.h".
11887         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11888         (Sized_relobj::do_get_global_symbol_counts): New function.
11889         (Input_objects::add_object): Add object to cross-referencer.
11890         (Input_objects::archive_start): New function.
11891         (Input_objects::archive_stop): New function.
11892         (Input_objects::print_symbol_counts): New function.
11893         * object.h: Declare Cref and Archive.
11894         (Object::get_global_symbol_counts): New function.
11895         (Object::do_get_global_symbol_counts): New pure virtual function.
11896         (class Sized_relobj): Add defined_count_ field.  Update
11897         declarations.
11898         (class Input_objects): Add cref_ field.  Update constructor.
11899         Update declarations.
11900         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11901         defined_count_.
11902         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11903         symbol counts.
11904         (Sized_dynobj::do_get_global_symbol_counts): New function.
11905         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11906         defined_count_.  Update declarations.  Define Symbols typedef.
11907         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11908         parameter.  Change all callers.
11909         (Symbol_table::add_from_dynobj): Add sympointers and defined
11910         parameters.  Change all callers.
11911         * symtab.h (class Symbol_table): Update declarations.
11912         * Makefile.am (CCFILES): Add cref.cc.
11913         (HFILES): Add cref.h.
11914         * Makefile.in: Rebuild.
11915
11916 2008-07-22  Simon Baldwin  <simonb@google.com>
11917
11918         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11919         to zero when writing undefined symbols.
11920
11921 2008-07-22  Ian Lance Taylor  <iant@google.com>
11922
11923         * output.cc (Output_section::add_input_section): Don't try to
11924         merge empty merge sections.
11925
11926 2008-07-21  Craig Silverstein  <csilvers@google.com>
11927
11928         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11929         Include symbol version in error message.
11930
11931 2008-07-20  Chris Demetriou  <cgd@google.com>
11932
11933         * configure.ac (gold_cv_c_random_seed): New configured variable.
11934         (RANDOM_SEED_CFLAGS): New substituted variable.
11935         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11936         * configure: Rebuild.
11937         * Makefile.in: Likewise.
11938         * testsuite/Makefile.in: Likewise.
11939
11940 2008-07-18  Ian Lance Taylor  <iant@google.com>
11941
11942         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11943         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11944         * testsuite/ver_test_main.cc (main): Call t4.
11945         (t4, t4_2a): Define.
11946         * testsuite/ver_test_2.cc (t4_2): Define.
11947         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11948         * testsuite/ver_test_4.cc (t4_2a): Define.
11949         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11950         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11951
11952 2008-07-17  Ian Lance Taylor  <iant@google.com>
11953
11954         * dynobj.cc (Versions::add_def): If we give an error about a
11955         missing version, go ahead and create the version anyhow.
11956
11957 2008-07-10  Ian Lance Taylor  <iant@google.com>
11958
11959         Handle output sections with more than 0x7fffffff bytes.
11960         * object.h (class Relobj): Change map_to_output_ to
11961         output_sections_, and just keep a section pointer.  Change all
11962         uses.  Move comdat group support to Sized_relobj.
11963         (Relobj::is_section_specially_mapped): Remove.
11964         (Relobj::output_section): Remove poff parameter.  Change all
11965         callers.
11966         (Relobj::output_section_offset): New function.
11967         (Relobj::set_section_offset): Rewrite.
11968         (Relobj::map_to_output): Remove.
11969         (Relobj::output_sections): New function.
11970         (Relobj::do_output_section_offset): New pure virtual function.
11971         (Relobj::do_set_section_offset): Likewise.
11972         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11973         group support from Relobj.  Update declarations.
11974         (Sized_relobj::get_output_section_offset): New function.
11975         (Sized_relobj::do_output_section_offset): New function.
11976         (Sized_relobj::do_set_section_offset): New function.
11977         * object.cc (Relobj::output_section_address): Remove.
11978         (Sized_relobj::Sized_relobj): Initialize new fields.
11979         (Sized_relobj::include_section_group): Cast find_kept_object to
11980         Sized_relobj.
11981         (Sized_relobj::include_linkonce_section): Likewise.
11982         (Sized_relobj::do_layout): Use separate arrays for output section
11983         and output offset.
11984         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11985         output_sections.
11986         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11987         output_sections and section_offsets.
11988         (Sized_relobj::write_local_symbols): Likewise.
11989         (map_to_kept_section): Compute output address directly.
11990         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11991         output_sections and section_offsets.
11992         (Sized_relobj::write_sections): Likewise.
11993         (Sized_relobj::relocate_sections): Likewise.
11994         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11995         * output.h (class Output_reloc): Update declarations.  Change
11996         u2_.relobj to Sized_relobj*.
11997         (class Output_data_reloc): Change add functions to use
11998         Sized_relobj*.
11999         * output.cc (Output_reloc::Output_reloc): Change relobj to
12000         Sized_relobj*.
12001         (Output_reloc::local_section_offset): Change return type to
12002         Elf_Addr.  Use get_output_section_offset.
12003         (Output_reloc::get_address): Likewise.
12004         (Output_section::is_input_address_mapped): Don't call
12005         is_section_specially_mapped.
12006         (Output_section::output_offset): Likewise.
12007         (Output_section::output_address): Likewise.
12008         (Output_section::starting_output_address): Likewise.
12009         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12010         parameter to Sized_relobj*.
12011         (Copy_relocs::need_copy_reloc): Likewise.
12012         (Copy_relocs::save): Likewise.
12013         * copy-relocs.h (class Copy_relocs): Update declarations.
12014         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12015         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12016         * target-reloc.h (relocate_for_relocatable): Change
12017         offset_in_output_section type to Elf_Addr.  Change code that uses
12018         it as well.
12019         * layout.cc (Layout::layout): Always set *off.
12020         * mapfile.cc (Mapfile::print_input_section): Use
12021         output_section_offset.
12022         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12023         Sized_relobj*.
12024         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12025         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12026         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12027
12028 2008-07-03  Ian Lance Taylor  <iant@google.com>
12029
12030         * layout.cc (Layout::include_section): Do not discard unrecognized
12031         SHT_STRTAB sections.
12032
12033 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12034
12035         * script.cc (Lex::can_continue_name): Make '?' allowable in
12036         version-script names.
12037         * testsuite/version_script.map: Change glob pattern to use '?'
12038
12039 2008-06-30  Manish Singh  <yosh@gimp.org>
12040
12041         PR 6585
12042         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12043         Correct typo.
12044
12045 2008-06-30  Ian Lance Taylor  <iant@google.com>
12046
12047         PR 6660
12048         PR 6682
12049         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12050         versions]: Don't try to read the value in the contents, since we
12051         don't use it.  Use the template endianness when writing.
12052
12053 2008-06-25  Cary Coutant  <ccoutant@google.com>
12054
12055         * fileread.cc (File_read::make_view): Assert on zero-length view.
12056         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12057         symbol table when there are no symbols to read.
12058
12059 2008-06-23  Craig Silverstein  <csilvers@google.com>
12060
12061         * version.cc (version_string): Bump to 1.7
12062
12063 2008-06-18  Craig Silverstein  <csilvers@google.com>
12064
12065         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12066         constant 0xFFFF to type Valtype.
12067         (Powerpc_relocate_functions::rel16_ha): Likewise.
12068
12069 2008-06-17  Ian Lance Taylor  <iant@google.com>
12070
12071         * output.h (Output_section::Input_section): Initialize p2align_ to
12072         zero for Output_section_data constructors.
12073         (Output_section::Input_section::addralign): If not an input
12074         section, return the alignment of the Output_section_data.
12075         * testsuite/copy_test.cc: New file.
12076         * testsuite/copy_test_1.cc: New file.
12077         * testsuite/copy_test_2.cc: New file.
12078         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12079         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12080         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12081         (copy_test_1_pic.o, copy_test_1.so): New targets.
12082         (copy_test_2_pic.o, copy_test_2.so): New targets.
12083         * testsuite/Makefile.in: Rebuild.
12084
12085         * script-sections.cc (Script_sections::place_orphan): Initialize
12086         local variable exact.
12087
12088 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12089
12090         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12091
12092 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12093             David S. Miller  <davem@davemloft.net>
12094
12095         * powerpc.cc: New file.
12096         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12097         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12098         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12099         * Makefile.in: Rebuild.
12100
12101 2008-06-09  Ian Lance Taylor  <iant@google.com>
12102
12103         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12104         <exception>.
12105         (throwing, orig_terminate): New static variables.
12106         (terminate_handler): New static function.
12107         (t2): Set terminate handler.
12108
12109 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12110
12111         PR 6584
12112         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12113         alignment.
12114
12115 2008-05-30  Cary Coutant  <ccoutant@google.com>
12116
12117         * archive.cc (Archive::include_all_members) Correct to step
12118         over symbol table and extended name table in thin archives.
12119
12120 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12121
12122         PR 6407
12123         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12124         calculation.
12125
12126 2008-05-28  Caleb Howe  <cshowe@google.com>
12127
12128         * reduced_debug_output.cc: New file.
12129         * reduced_debug_output.h: New file.
12130         * options.h (class General_options): Add --strip-debug-non-line.
12131         * options.cc (General_options::finalize): Add strip_debug_non_line
12132         to the strip heirarchy.
12133         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12134         fields.
12135         * layout.cc: Include "reduced_debug_output.h".
12136         (Layout::Layout): Initialize new fields.
12137         (line_only_debug_sections): New static array.
12138         (is_lines_only_debug_sections): New static inline function.
12139         (Layout::include_section): Handle --strip-debug-non-line.
12140         (Layout::make_output_section): If --strip-debug-non-line, build
12141         new output sections for .debug_abbrev and .debug_info.
12142         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12143         gold.  Warn about possible overflow.
12144         (read_signed_LEB_128): Likewise.
12145         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12146         (read_signed_LEB_128): Declare.
12147         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12148         (HFILES): Add reduced_debug_output.h.
12149         * Makefile.in: Rebuild.
12150
12151 2008-05-21  Ian Lance Taylor  <iant@google.com>
12152
12153         * mapfile.cc: New file.
12154         * mapfile.h: New file.
12155         * options.h (class General_options): Add -M/--print-map and -Map.
12156         * options.cc (General_options::finalize): Make -M equivalent to
12157         -Map -.
12158         * main.cc: Include <cstdio> and "mapfile.h".
12159         (main): Open mapfile if requested.
12160         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12161         constructor.  Change caller.
12162         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12163         (queue_middle_tasks): Likewise.
12164         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12165         declarations.
12166         * archive.cc: Include "mapfile.h".
12167         (Archive::add_symbols): Add mapfile parameter.  Change all
12168         callers.  Pass mapfile, symbol, and reason to include_member.
12169         (Archive::include_all_members): Add mapfile parameter.  Change all
12170         callers.
12171         (Archive::include_member): Add mapfile, sym, and why parameters.
12172         Change all callers.  Report inclusion to map file.
12173         * archive.h: Include "fileread.h".
12174         (class Archive): Update declarations.
12175         (Archive::file): New const method.
12176         (class Add_archive_symbols): Add mapfile_ field.  Update
12177         constructor.  Change all callers.
12178         * readsyms.h (class Read_symbols): Likewise.
12179         (class Finish_group): Likewise.
12180         (class Read_script): Likewise.
12181         * common.cc: Include "mapfile.h".
12182         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12183         all callers.
12184         (Symbol_table::do_allocate_commons): Likewise.
12185         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12186         symbol allocation to mapfile.
12187         * common.h (class Allocate_commons_task): Add mapfile_ field.
12188         Update constructor.  Change all callers.
12189         * symtab.h (class Symbol_table): Update declarations.
12190         * layout.cc: Include "mapfile.h".
12191         (Layout_task_runner::run): Print information to mapfile.
12192         (Layout::create_gold_note): Change Output_data_fixed_space to
12193         Output_data_zero_fill.
12194         (Layout::create_build_id): Likewise.
12195         (Layout::print_to_mapfile): New function.
12196         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12197         constructor.  Change caller.
12198         (class Layout): Declare print_to_mapfile.
12199         * output.cc (Output_section::Input_section::print_to_mapfile): New
12200         function.
12201         (Output_section::add_input_section): If producing a map, always
12202         add to input_sections_ list.
12203         (Output_section::do_print_to_mapfile): New function.
12204         (Output_segment::print_sections_to_mapfile): New function.
12205         (Output_segment::print_section_list_to_mapfile): New function.
12206         * output.h: Include "mapfile.h".
12207         (Output_data::print_to_mapfile): New function.
12208         (Output_data::do_print_to_mapfile): New virtual function.
12209         (Output_segment_headers::do_print_to_mapfile): New function.
12210         (Output_file_header::do_print_to_mapfile): New function.
12211         (Output_data_const::do_print_to_mapfile): New function.
12212         (class Output_data_const_buffer): Add map_name_ field.  Update
12213         constructor.  Change all callers.  Add do_print_to_mapfile
12214         function.
12215         (class Output_data_fixed_space): Likewise.
12216         (class Output_data_space): Likewise.
12217         (class Output_data_zero_fill): New class.
12218         (Output_data_strtab::do_print_to_mapfile): New function.
12219         (Output_data_reloc_base::do_print_to_mapfile): New function.
12220         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12221         (Output_data_group::do_print_to_mapfile): New function.
12222         (Output_data_got::do_print_to_mapfile): New function.
12223         (Output_data_dynamic::do_print_to_mapfile): New function.
12224         (Output_symtab_xindex::do_print_to_mapfile): New function.
12225         (class Output_section): Declare do_print_to_mapflie.  Declare
12226         print_to_mapfile in Input_section.
12227         (class Output_segment): Declare new functions.
12228         * object.h (Sized_relobj::symbol_count): New function.
12229         * script-sections.cc
12230         (Output_section_element_dot_assignment::set_section_addresses):
12231         Change Output_data_fixed_space to Output_data_zero_fill.
12232         (Output_data_expression::do_print_to_mapfile): New function.
12233         * script.cc (read_input_script): Add mapfile parameter.  Change
12234         all callers.
12235         * script.h (read_input_script): Update declaration.
12236         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12237         (Eh_frame::do_print_to_mapfile): New function.
12238         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12239         (Output_merge_string::do_print_to_mapfile): New function.
12240         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12241         function.
12242         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12243         function.
12244         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12245         function.
12246         * Makefile.am (CCFILES): Add mapfile.cc.
12247         (HFILES): Add mapfile.h.
12248         * Makefile.in: Rebuild.
12249
12250 2008-05-19  Ian Lance Taylor  <iant@google.com>
12251
12252         * options.h (class General_options): Add -z relro.
12253         * layout.cc (Layout::Layout): Initialize relro_segment_.
12254         (Layout::add_output_section_data): Return the output section.
12255         (Layout::make_output_section): Rcognize relro sections and mark
12256         them appropriately.
12257         (Layout::attach_allocated_section_to_segment): Put relro sections
12258         in a PT_GNU_RELRO segment.
12259         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12260         section as relro.
12261         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12262         PT_TLS segments.
12263         (Layout::linkonce_mapping): Map d.rel.ro.local to
12264         .data.rel.ro.local.
12265         (Layout::output_section_name): Us .data.rel.ro.local for any
12266         section which begins with that.
12267         * layout.h (class Layout): Update add_output_section_data
12268         declaration.  Add relro_segment_ field.
12269         * output.cc (Output_section::Output_section): Initialize is_relro_
12270         and is_relro_local_ fields.
12271         (Output_segment::add_output_section): Group relro sections.
12272         (Output_segment::is_first_section_relro): New function.
12273         (Output_segment::maximum_alignment): If there is a relro section,
12274         align the segment to the common page size.
12275         (Output_segment::set_section_addresses): Track whether we are
12276         looking at relro sections.  If the last section is a relro
12277         section, align to the common page size.
12278         (Output_segment::set_section_list_addresses): Add in_relro
12279         parameter.  Change all callers.  Align to the page size when
12280         moving from relro to non-relro section.
12281         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12282         segment.
12283         * output.h (class Output_section): Add is_relro_ and
12284         is_relro_local_ fields.
12285         (Output_section::is_relro): New function.
12286         (Output_section::set_is_relro): New function.
12287         (Output_section::is_relro_local): New function.
12288         (Output_section::set_is_relro_local): New function.
12289         (class Output_segment): Update declarations.
12290         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12291         * sparc.cc (Target_sparc::got_section): Likewise.
12292         * x86_64.cc (Target_x86_64::got_section): Likewise.
12293         * testsuite/relro_test_main.cc: New file.
12294         * testsuite/relro_test.cc: New file.
12295         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12296         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12297         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12298         (relro_test.so, relro_test_pic.o): New targets.
12299         * testsuite/Makefile.in: Rebuild.
12300
12301 2008-05-16  Ian Lance Taylor  <iant@google.com>
12302
12303         * output.cc (Output_segment::add_output_section): Remove front
12304         parameter.
12305         * output.h (class Output_segment): Remove
12306         add_initial_output_section and overloaded add_output_section.
12307         Update declaration of remaining add_output_section.
12308         * layout.cc (Layout::create_interp): Call add_output_section
12309         rather than add_initial_output_section.
12310         (Layout::finish_dynamic_section): Likewise.
12311
12312         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12313         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12314         know the dynamic type.
12315         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12316         field.  Initialize it in constructor.
12317         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12318         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12319         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12320         reloc.
12321
12322         * output.cc (Output_reloc::get_address): Change return type to
12323         Elf_Addr.
12324         * output.h (class Output_reloc): Update get_address declaration.
12325         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12326         for section addresses.
12327
12328 2008-05-09  Ian Lance Taylor  <iant@google.com>
12329
12330         PR 6493
12331         * gold.cc (gold_nomem): Use return value of write.
12332
12333 2008-05-08  Ian Lance Taylor  <iant@google.com>
12334
12335         * symtab.c (Symbol::init_base_output_data): Add version
12336         parameter.  Change all callers.
12337         (Symbol::init_base_output_segment): Likewise.
12338         (Symbol::init_base_constant): Likewise.
12339         (Symbol::init_base_undefined): Likewise.
12340         (Sized_symbol::init_output_data): Likewise.
12341         (Sized_symbol::init_output_segment): Likewise.
12342         (Sized_symbol::init_constant): Likewise.
12343         (Sized_symbol::init_undefined): Likewise.
12344         (Symbol_table::do_define_in_output_data): If the new symbol has a
12345         version, mark it as the default.
12346         (Symbol_table::do_define_in_output_segment): Likewise.
12347         (Symbol_table::do_define_as_constant): Likewise.
12348         * symtab.h (class Symbol): Update declarations.
12349         (class Sized_symbol): Likewise.
12350         * resolve.cc (Symbol::override_version): New function.
12351         (Symbol::override_base): Call override_version.
12352         (Symbol::override_base_with_special): Likewise.
12353         * testsuite/ver_script_8.script: New file.
12354         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12355         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12356         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12357         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12358
12359 2008-05-06  Ian Lance Taylor  <iant@google.com>
12360
12361         PR 6049
12362         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12363         functions.
12364         (class General_options): Remove existing --undefined, and add
12365         --no-undefined instead.  Add new --undefined as synonym for -u.
12366         * archive.cc (Archive::add_symbols): Check whether symbol was
12367         named with -u.
12368         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12369         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12370         all uses.  Add IS_UNDEFINED.  Update declarations to split
12371         different versions of init_base.  Declare init_base_undefined.
12372         (Symbol::is_defined): Handle IS_UNDEFINED.
12373         (Symbol::is_undefined): Likewise.
12374         (Symbol::is_weak_undefined): Call is_undefined.
12375         (Symbol::is_absolute): Handle IS_CONSTANT.
12376         (class Sized_symbol): Update declarations to split different
12377         versions of init.  Declare init_undefined.
12378         (class Symbol_table): Declare new functions.
12379         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12380         Change all callers.
12381         (Symbol::init_base_output_data): Likewise.
12382         (Symbol::init_base_output_segment): Likewise.
12383         (Symbol::init_base_constant): Likewise.
12384         (Symbol::init_base_undefined): New function.
12385         (Sized_symbol::init_object): Rename from init.  Change all
12386         callers.
12387         (Sized_symbol::init_output_data): Likewise.
12388         (Sized_symbol::init_output_segment): Likewise.
12389         (Sized_symbol::init_constant): Likewise.
12390         (Sized_symbol::init_undefined): New function.
12391         (Symbol_table::add_undefined_symbols_from_command_line): New
12392         function.
12393         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12394         function.
12395         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12396         (Symbol::output_section): Likewise.
12397         (Symbol::set_output_section): Likewise.
12398         (Symbol_table::sized_finalize_symbol): Likewise.
12399         (Symbol_table::sized_write_globals): Likewise.
12400         * resolve.cc (Symbol_table::should_override): Likewise.
12401         (Symbol::override_base_with_special): Likewise.
12402
12403         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12404         symbol, change it to have default visibility.
12405         * testsuite/protected_1.cc: New file.
12406         * testsuite/protected_2.cc: New file.
12407         * testsuite/protected_3.cc: New file.
12408         * testsuite/protected_main_1.cc: New file.
12409         * testsuite/protected_main_2.cc: New file.
12410         * testsuite/protected_main_3.cc: New file.
12411         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12412         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12413         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12414         (protected_1.so): New target.
12415         (protected_1_pic.o, protected_2_pic.o): New targets.
12416         (protected_3_pic.o): New target.
12417         (check_PROGRAMS): Add protected_2.
12418         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12419         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12420         * testsuite/Makefile.in: Rebuild.
12421
12422         * options.h (DEFINE_var): Add set_user_set_##varname__.
12423         (DEFINE_bool_alias): New macro.
12424         (class General_options): Define -Bstatic using DEFINE_bool_alias
12425         rather than DEFINE_special.  Add --undefined as an alias for -z
12426         defs.
12427         * options.cc (General_options::parse_Bstatic): Remove.
12428
12429         * options.h (class General_options): Add --fatal-warnings.
12430         * main.cc (main): Implement --fatal-warnings.
12431         * errors.h (Errors::warning_count): New function.
12432
12433         * options.h (class General_options): Add -Bsymbolic-functions.
12434         * symtab.h (Symbol::is_preemptible): Check for
12435         -Bsymbolic-functions.
12436
12437 2008-05-05  Ian Lance Taylor  <iant@google.com>
12438
12439         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12440         as noVARNAME rather than no-VARNAME.
12441         (class General_options): Add option -z combreloc.
12442         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12443         get_address.
12444         (Output_reloc::sort_before) [SHT_REL]: New function.
12445         (Output_reloc::sort_before) [SHT_RELA]: New function.
12446         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12447         Sort_relocs_comparison.
12448         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12449         parameter.  Change all callers.
12450         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12451         sort_relocs parameter.  Change all callers.
12452         * output.cc (Output_reloc::get_address): New function, broken out
12453         of write_rel.
12454         (Output_reloc::write_rel): Call it.
12455         (Output_reloc::compare): New function.
12456         (Output_data_reloc_base::do_write): Optionally sort relocs.
12457
12458         * configure.ac: If targ_extra_obj is set, link it in.
12459         * configure.tgt: Initialize all variables.
12460         (x86_64*): Set targ_extra_obj and targ_extra_size.
12461         * configure: Rebuild.
12462
12463         * object.cc (Sized_relobj::include_section_group): Adjust section
12464         indexes read from group data.  Build vector to pass to
12465         layout_group.
12466         * layout.cc (Layout::layout_group): Add flags and shndxes
12467         parameters.  Remove contents parameter.  Change caller.  Update
12468         explicit instantiations.
12469         * layout.h (class Layout): Update layout_group declaration.
12470         * output.cc (Output_data_group::Output_data_group): Add flags and
12471         input_shndxes parameters.  Remove contents parameter.  Change
12472         caller.
12473         (Output_data_group::do_write): Change input_sections_ to
12474         input_shndxes_.
12475         * output.h (class Output_data_group): Update constructor
12476         declaration.  Rename input_sections_ to input_shndxes_.
12477         * testsuite/many_sections_test.cc: Add template.
12478
12479 2008-04-30  Cary Coutant  <ccoutant@google.com>
12480
12481         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12482
12483         * layout.cc (Layout::include_section): Refactored check for debug
12484         info section.
12485         (Layout::add_comdat): Add new parameters.  Change type
12486         of signature parameter.  Add object and shndx to signatures table.
12487         (Layout::find_kept_object): New function.
12488         * layout.h: Include <cstring>.
12489         (Layout::is_debug_info_section): New function.
12490         (Layout::add_comdat): Add new parameters.
12491         (Layout::find_kept_object): New function.
12492         (Layout::Kept_section): New struct.
12493         (Layout::Signatures): Change type of map range.
12494         * object.cc (Relobj::output_section_address): New function.
12495         (Sized_relobj::include_section_group): Add new parameters.  Change
12496         calls to Layout::add_comdat.  Change to build table of kept comdat
12497         groups and table mapping discarded sections to kept sections.
12498         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12499         (Sized_relobj::do_layout): Change calls to include_section_group and
12500         include_linkonce_section.
12501         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12502         value to zero when section is discarded.
12503         (Sized_relobj::map_to_kept_section): New function.
12504         * object.h (Relobj::output_section_address): New function.
12505         (Relobj::Comdat_group): New type.
12506         (Relobj::find_comdat_group): New function.
12507         (Relobj::Comdat_group_table): New type.
12508         (Relobj::Kept_comdat_section): New type.
12509         (Relobj::Kept_comdat_section_table): New type.
12510         (Relobj::add_comdat_group): New function.
12511         (Relobj::set_kept_comdat_section): New function.
12512         (Relobj::get_kept_comdat_section): New function.
12513         (Relobj::comdat_groups_): New field.
12514         (Relobj::kept_comdat_sections_): New field.
12515         (Symbol_value::input_value): Update comment.
12516         (Sized_relobj::map_to_kept_section) New function.
12517         (Sized_relobj::include_linkonce_section): Add new parameter.
12518         * target-reloc.h (Comdat_behavior): New type.
12519         (get_comdat_behavior): New function.
12520         (relocate_section): Add code to map a discarded section to the
12521         corresponding kept section when applying a relocation.
12522
12523 2008-04-30  Craig Silverstein  <csilvers@google.com>
12524
12525         * dwarf_reader.cc (next_generation_count): New static var.
12526         (Addr2line_cache_entry): New struct.
12527         (addr2line_cache): New static var.
12528         (Dwarf_line_info::one_addr2line): Added caching.
12529         (Dwarf_line_info::clear_addr2line_cache): New function.
12530         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12531         cache-size parameter.
12532         (Dwarf_line_info::one_addr2line_cache): New function.
12533         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12534         new cache-size argument to one_addr2line(), and clear cache.
12535
12536 2008-04-28  Cary Coutant  <ccoutant@google.com>
12537
12538         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12539         R_386_PC8 relocations.
12540
12541 2008-04-23  Ian Lance Taylor  <iant@google.com>
12542
12543         * object.cc (Sized_relobj::include_section_group): Check for
12544         invalid section group.
12545
12546         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12547         header size.
12548
12549         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12550         than read for file header.
12551         * archive.cc (Archive::include_member): Likewise.
12552
12553 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12554
12555         * aclocal.m4: Regenerate.
12556         * configure: Regenerate.
12557
12558 2008-04-19  Ian Lance Taylor  <iant@google.com>
12559
12560         * version.cc (version_string): Bump to 1.6.
12561
12562         * testsuite/Makefile.am (many_sections_r_test): New target.
12563         (many_sections_r_test_SOURCES): Remove.
12564         (many_sections_r_test_DEPENDENCIES): Remove.
12565         (many_sections_r_test_LDFLAGS): Remove.
12566         (many_sections_r_test_LDADD): Remove.
12567
12568         * object.cc (Sized_relobj::do_add_symbols): Always pass
12569         local_symbol_count_ to add_from_relobj.
12570
12571         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12572         every thousand variables.
12573         * testsuite/Makefile.in: Rebuild.
12574
12575         * object.cc (Xindex::initialize_symtab_xindex): New function.
12576         (Xindex::read_symtab_xindex): New function.
12577         (Xindex::sym_xindex_to_shndx): New function.
12578         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12579         available.
12580         (Sized_relobj::do_initialize_xindex): New function.
12581         (Sized_relobj::do_read_symbols): Adjust section links.
12582         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12583         parameter.  Change all callers.
12584         (Sized_relobj::include_section_group): Adjust section links and
12585         symbol section indexes.
12586         (Sized_relobj::do_layout): Adjust section links.
12587         (Sized_relobj::do_count_local_symbols): Adjust section links and
12588         symbol section indexes.
12589         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12590         ordinary and special symbols.
12591         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12592         dynsym_xindex parameters.  Change all callers.  Adjust section
12593         links.  Use SHN_XINDEX when needed.
12594         (Sized_relobj::get_symbol_location_info): Adjust section links.
12595         Don't get fooled by special symbols.
12596         * object.h (class Xindex): Define.
12597         (class Object): Add xindex_ parameter.  Declare virtual functoin
12598         do_initialize_xindex.
12599         (Object::adjust_sym_shndx): New function.
12600         (Object::set_xindex): New protected function.
12601         (class Symbol_value): Add is_ordinary_shndx_ field.
12602         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12603         (Symbol_value::value): Assert ordinary section.
12604         (Symbol_value::initialize_input_to_output_map): Likewise.
12605         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12606         Change all callers.
12607         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12608         all callers.
12609         (class Sized_relobj): Update declarations.
12610         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12611         parameter.  Change all callers.
12612         (Sized_relobj::adjust_shndx): New function.
12613         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12614         field.
12615         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12616         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12617         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12618         (Sized_dynobj::read_dynsym_section): Adjust section links.
12619         (Sized_dynobj::read_dynamic): Likewise.
12620         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12621         section links.
12622         (Sized_dynobj::do_initialize_xindex): New function.
12623         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12624         do_initialize_xindex.
12625         (Sized_dynobj::adjust_shndx): New function.
12626         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12627         dynsym_xindex_ fields.
12628         (Layout::finalize): Add a call to set_section_indexes before
12629         creating the symtab sections.
12630         (Layout::set_section_indexes): Don't do anything if the section
12631         already has a section index.
12632         (Layout::create_symtab_sections): Add shnum parameter.  Change
12633         caller.  Create .symtab_shndx section if needed.
12634         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12635         caller.
12636         (Layout::allocated_output_section_count): New function.
12637         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12638         needed.
12639         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12640         fields.  Update declarations.
12641         (Layout::symtab_xindex): New function.
12642         (Layout::dynsym_xindex): New function.
12643         (class Write_symbols_task): Add layout_ field.
12644         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12645         Change caller.
12646         * output.cc (Output_section_headers::Output_section_headers): Add
12647         shstrtab_section parameter.  Change all callers.
12648         (Output_section_headers::do_sized_write): Store overflow values
12649         for section count and section string table section index in
12650         section header zero.
12651         (Output_file_header::do_sized_write): Check for overflow of
12652         section count and section string table section index.
12653         (Output_symtab_xindex::do_write): New function.
12654         (Output_symtab_xindex::endian_do_write): New function.
12655         * output.h (class Output_section_headers): Add shstrtab_section_.
12656         Update declarations.
12657         (class Output_symtab_xindex): Define.
12658         (Output_section::has_out_shndx): New function.
12659         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12660         field.
12661         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12662         Change all callers.
12663         (Sized_symbol::init): Likewise.
12664         (Symbol::output_section): Check for ordinary symbol.
12665         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12666         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12667         callers.
12668         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12669         Change all callers.  Simplify handling of symbols from sections
12670         not included in the link.
12671         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12672         distinction.
12673         (Weak_alias_sorter::operator()): Assert that symbols are
12674         ordinary.
12675         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12676         distinction.
12677         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12678         parameters.  Change all callers.
12679         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12680         symbol distinction.  Use SHN_XINDEX when needed.
12681         (Symbol_table::write_section_symbol): Add symtab_xindex
12682         parameter.  Change all callers.
12683         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12684         SHN_XINDEX when needed.
12685         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12686         declarations.
12687         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12688         (Symbol::is_defined): Check is_ordinary.
12689         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12690         (Symbol::is_absolute, Symbol::is_common): Likewise.
12691         (class Sized_symbol): Update declarations.
12692         (class Symbol_table): Update declarations.
12693         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12694         parameters.  Change all callers.
12695         (Sized_symbol::override): Likewise.
12696         (Symbol_table::override): Likewise.
12697         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12698         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12699         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12700         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12701         to be in an ordinary section.
12702         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12703         object and is_ordinary parameters.  Change all callers.
12704         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12705         Change all callers.  Don't add undefined or non-ordinary symbols
12706         to reloc_map_.
12707         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12708         Change all callers.
12709         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12710         declarations.
12711         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12712         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12713         (Sized_relobj::relocate_sections): Likewise.
12714         * target-reloc.h (scan_relocs): Adjust section symbol index.
12715         (scan_relocatable_relocs): Likewise.
12716         * i386.cc (Scan::local): Check for ordinary symbols.
12717         * sparc.cc (Scan::local): Likewise.
12718         * x86_64.cc (Scan::local): Likewise.
12719         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12720         to symbol_section_and_value.
12721         * testsuite/many_sections_test.cc: New file.
12722         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12723         (check_PROGRAMS): Add many_sections_test.
12724         (many_sections_test_SOURCES): Define.
12725         (many_sections_test_DEPENDENCIES): Define.
12726         (many_sections_test_LDFLAGS): Define.
12727         (BUILT_SOURCES): Add many_sections_define.h.
12728         (many_sections_define.h): New target.
12729         (BUILT_SOURCES): Add many_sections_check.h.
12730         (many_sections_check.h): New target.
12731         (check_PROGRAMS): Add many_sections_r_test.
12732         (many_sections_r_test_SOURCES): Define.
12733         (many_sections_r_test_DEPENDENCIES): Define.
12734         (many_sections_r_test_LDFLAGS): Define.
12735         (many_sections_r_test_LDADD): Define.
12736         (many_sections_r_test.o): New target.
12737         * testsuite/Makefile.in: Rebuild.
12738
12739 2008-04-17  Cary Coutant  <ccoutant@google.com>
12740
12741         * errors.cc (Errors::info): New function.
12742         (gold_info): New function.
12743         * errors.h (Errors::info): New function.
12744         * gold.h (gold_info): New function.
12745         * object.cc (Input_objects::add_object): Print trace output.
12746         * options.cc (options::parse_set): New function.
12747         (General_options::parse_wrap): Deleted.
12748         (General_options::General_options): Deleted initializer.
12749         * options.h (options::String_set): New typedef.
12750         (options::parse_set): New function.
12751         (DEFINE_set): New macro.
12752         (General_options::wrap): Changed to use DEFINE_set. Changed
12753         callers of any_wrap_symbols and is_wrap_symbol.
12754         (General_options::trace, General_options::trace_symbol):
12755         New options.
12756         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12757         (General_options::wrap_symbols_): Deleted.
12758         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12759
12760 2008-04-17  David S. Miller  <davem@davemloft.net>
12761
12762         * options.cc (General_options::parse_V): New function.
12763         * options.h: Add entries for -V and -Qy.
12764
12765 2008-04-17  Ian Lance Taylor  <iant@google.com>
12766
12767         * common.cc (Symbol_table::allocate_commons): Remove options
12768         parameter.  Change caller.
12769         (Symbol_table::do_allocate_commons): Remove options parameter.
12770         Change caller.  Just call do_allocate_commons_list twice.
12771         (Symbol_table::do_allocate_commons_list): New function, broken out
12772         of do_allocate_commons.
12773         * common.h (class Allocate_commons_task): Remove options_ field.
12774         Update constructor.
12775         * symtab.cc (Symbol_table::Symbol_table): Initialize
12776         tls_commons_.
12777         (Symbol_table::add_from_object): Put TLS common symbols on
12778         tls_commons_ list.
12779         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12780         which are IN_OUTPUT_DATA.
12781         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12782         allocate_commons and do_allocate_commons declarations.  Declare
12783         do_allocate_commons_list.
12784         * gold.cc (queue_middle_tasks): Update creation of
12785         Allocate_commons_task to not pass options.
12786         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12787         (TLS_TEST_C_FLAGS): New variable.
12788         (tls_test_c_pic.o): New target.
12789         (tls_test_shared.so): Link in tls_test_c_pic.o.
12790         (tls_test_c_pic_ie.o): New target.
12791         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12792         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12793         (tls_test_c.o): New target.
12794         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12795         (tls_pic_test_LDADD): Likewise.
12796         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12797         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12798         (tls_test_c_gnu2.o): New target.
12799         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12800         tls_test_c_gnu2.o.
12801         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12802         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12803         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12804         * testsuite/tls_test.cc: Include "config.h".
12805         (t_last): Call t11_last.
12806         * testsuite/tls_test.h (t11, t11_last): Declare.
12807         * testsuite/tls_test_c.c: New file.
12808         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12809         * configure.ac: Check for OpenMP support.
12810         * configure, config.in, Makefile.in: Rebuild.
12811         * testsuite/Makefile.in: Rebuild.
12812
12813 2008-04-16  Cary Coutant  <ccoutant@google.com>
12814
12815         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12816         (Target_i386::tls_base_symbol_defined_): New field.
12817         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12818         (Target_i386::Scan::global): Likewise.
12819         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12820         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12821         (Target_x86_64::tls_base_symbol_defined_): New field.
12822         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12823         (Target_x86_64::Scan::global): Likewise.
12824
12825 2008-04-16  Cary Coutant  <ccoutant@google.com>
12826
12827         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12828         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12829         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12830         building shared libraries.
12831         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12832         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12833         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12834         * testsuite/Makefile.in: Rebuild.
12835         * testsuite/weak_undef.h: New file.
12836         * testsuite/weak_undef_file1.cc: Add extra test cases.
12837         * testsuite/weak_undef_file2.cc: Likewise.
12838         * testsuite/weak_undef_test.cc: Likewise.
12839
12840 2008-04-16  David S. Miller  <davem@davemloft.net>
12841
12842         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12843         Add issued_non_pic_error_ field.  Declare check_non_pic.
12844         (Target_sparc::Scan::check_non_pic): New function.
12845         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12846         (Target_sparc::Scan::global): Likewise.
12847
12848         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12849         * configure: Rebuild.
12850
12851         * options.h (DEFINE_enable): New macro.
12852         (new_dtags): New enable option.
12853         (initfirst, interpose, loadfltr, nodefaultlib,
12854         nodelete, nodlopen, nodump): New -z options.
12855         * layout.cc (Layout:finish_dynamic_section): If new
12856         dtags enabled, emit DT_RUNPATH.  Also, emit a
12857         DT_FLAGS_1 containing any specified -z flags.
12858
12859 2008-04-16  Ian Lance Taylor  <iant@google.com>
12860
12861         * copy-relocs.cc: New file.
12862         * copy-relocs.h: New file.
12863         * reloc.cc: Remove Copy_relocs code.
12864         * reloc.h: Likewise.
12865         * reloc-types.h (struct Reloc_types) [both versions]: Add
12866         get_reloc_addend_noerror.
12867         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12868         variants of add_global which take an addend which must be zero.
12869         * i386.cc: Include "copy-relocs.h".
12870         (class Target_i386): Change type of copy_relocs_ to variable,
12871         update initializer.
12872         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12873         Change all callers.
12874         (Target_i386::do_finalize_sections): Change handling of
12875         copy_relocs_.
12876         * sparc.cc: Include "copy-relocs.h".
12877         (class Target_sparc): Change type of copy_relocs_ to variable,
12878         update initializer.
12879         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12880         Change all callers.
12881         (Target_sparc::do_finalize_sections): Change handling of
12882         copy_relocs_.
12883         * x86_64.cc: Include "copy-relocs.h".
12884         (class Target_x86_64): Change type of copy_relocs_ to variable,
12885         update initializer.
12886         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12887         class.  Change all callers.
12888         (Target_x86_64::do_finalize_sections): Change handling of
12889         copy_relocs_.
12890         * Makefile.am (CCFILES): Add copy-relocs.cc.
12891         (HFILES): Add copy-relocs.h.
12892
12893         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12894
12895         * testsuite/script_test_4.sh: Permit leading zeroes.
12896
12897 2008-04-15  Ian Lance Taylor  <iant@google.com>
12898
12899         * script-sections.cc (Script_sections::create_segments): Use
12900         header_size_adjustment even when there is enough room for the
12901         headers.
12902         * testsuite/script_test_4.sh: New file.
12903         * testsuite/script_test_4.t: New file.
12904         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12905         (check_DATA): Add script_test_4.stdout.
12906         (MOSTLYCLEANFILES): Likewise.
12907         (script_test_4): New target.
12908         (script_test_4.stdout): New target.
12909         * testsuite/Makefile.in: Rebuild.
12910
12911         * sparc.cc: Add definitions for Output_data_plt_sparc class
12912         constants.
12913
12914 2008-04-14  David S. Miller  <davem@davemloft.net>
12915
12916         * sparc.cc: New file.
12917         * Makefile.am (TARGETSOURCES): Add sparc.cc
12918         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12919         * configure.tgt: Document targ_extra_size and
12920         targ_extra_big_endian.  Add entries for sparc-* and
12921         sparc64-*.
12922         * configure.ac: Handle targ_extra_size and
12923         targ_extra_big_endian.
12924         * Makefile.in: Rebuild.
12925         * configure: Likewise.
12926         * po/POTFILES.in: Likewise.
12927         * po/gold.pot: Likewise.
12928
12929 2008-04-14  Ian Lance Taylor  <iant@google.com>
12930
12931         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12932         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12933         in the name/type/flags to section mapping.  Don't call
12934         allocate_output_section.
12935         (Layout::choose_output_section): Change parameter from adjust_name
12936         to is_input_section.  Don't permit input sections after sections
12937         are attached to segments.  Don't call allocate_output_section.
12938         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12939         not write_enable_output_section.
12940         (Layout::make_output_section): Don't push to
12941         unattached_section_list_ nor call attach_to_segment.  Call
12942         attach_section_to_segment if sections are attached.
12943         (Layout::attach_sections_to_segments): New function.
12944         (Layout::attach_section_to_segment): New function.
12945         (Layout::attach_allocated_section_to_segment): Rename from
12946         attach_to_segment.  Remove flags parameter.
12947         (Layout::allocate_output_section): Remove function.
12948         (Layout::write_enable_output_section): Remove function.
12949         * layout.h (class Layout): Update for above changes.  Add new
12950         field sections_are_attached_.
12951         * output.h (Output_section::update_flags_for_input_section): New
12952         function.
12953         * output.cc (Output_section::add_input_section): Call
12954         update_flags_for_input_section.
12955         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12956
12957 2008-04-11  Cary Coutant  <ccoutant@google.com>
12958
12959         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12960         thought unnecessary.
12961         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12962
12963 2008-04-11  Ian Lance Taylor  <iant@google.com>
12964
12965         * output.h (class Output_section_data): Remove inline definition
12966         of set_addralign.
12967         * output.cc (Output_section_data::set_addralign): New function.
12968
12969 2008-04-11  Cary Coutant  <ccoutant@google.com>
12970
12971         Add support for TLS descriptors for i386 and x86_64.
12972         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12973         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12974         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12975         GOT_TYPE_TLS_DESC.
12976         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12977         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12978         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12979         relocations.
12980         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12981         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12982         Fix problem with initial-exec relocations.
12983         (Target_i386::Relocate::relocate_tls): Likewise.
12984         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12985         relaxation.
12986         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12987         support for section-plus-offset dynamic table entries.
12988         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12989         (Output_data_dynamic::Dynamic_entry): Add support for
12990         section-plus-offset dynamic table entries.
12991         (Output_data_dynamic::Classification): Likewise.
12992         (Output_data_dynamic::classification_): Renamed offset_.
12993         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12994         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12995         (Target_x86_64::make_plt_section): New function.
12996         (Target_x86_64::reserve_tlsdesc_entries): New function.
12997         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12998         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12999         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13000         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13001         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13002         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13003         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13004         add extra PLT entry for TLS descriptors.
13005         (Output_data_plt_x86_64::got_): New field.
13006         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13007         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13008         fields.
13009         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13010         descriptors.
13011         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13012         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13013         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13014         R_386_TLS_DESC_CALL relocations.
13015         (Target_x86_64::Scan::global): Likewise.
13016         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13017         for TLS descriptors.
13018         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13019         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13020         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13021         GD-to-IE relaxation.
13022         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13023         and TLS_DESCRIPTORS.
13024         * Makefile.in: Rebuild.
13025         * configure: Rebuild.
13026         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13027         (tls_test_shared2.so): New target.
13028         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13029         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13030         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13031         (tls_shared_gd_to_ie_test_LDADD): New variable.
13032         (tls_shared_gnu2_gd_to_ie_test): New target.
13033         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13034         New targets.
13035         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13036         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13037         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13038         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13039         (tls_shared_gnu2_test): New target.
13040         (tls_test_gnu2_shared.so): New target.
13041         (tls_shared_gnu2_test_SOURCES): New variable.
13042         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13043         (tls_shared_gnu2_test_LDFLAGS): New variable.
13044         (tls_shared_gnu2_test_LDADD): New variable.
13045         * testsuite/Makefile.in: Rebuild.
13046         * testsuite/Makefile.
13047
13048 2008-04-11  Ian Lance Taylor  <iant@google.com>
13049
13050         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13051         justsyms.t.
13052         * testsuite/Makefile.in: Rebuild.
13053
13054         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13055         long.
13056         * testsuite/script_test_2.cc (main): Adjust test.
13057
13058 2008-04-11  David S. Miller  <davem@davemloft.net>
13059             Ian Lance Taylor  <iant@google.com>
13060
13061         * options.h (General_options): Add entries for '-Y' and
13062         '-relax'.
13063         * options.cc (General_options:finalize): If -Y was used, add those
13064         entries to the library path instead of the default "/lib" and
13065         "/usr/lib".
13066
13067 2008-04-11  David S. Miller  <davem@davemloft.net>
13068
13069         * testsuite/justsyms.t: Start at 0x100.
13070         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13071         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13072         long.
13073         * testsuite/script_test_2.cc: Adjust string and section length
13074         checks.
13075
13076 2008-04-09  Ian Lance Taylor  <iant@google.com>
13077
13078         PR gold/5996
13079         * script-sections.cc (Sections_element::allocate_to_segment): Add
13080         orphan parameter.
13081         (Output_section_definition::allocate_to_segment): Likewise.
13082         (Orphan_output_section::allocate_to_segment): Likewise.
13083         (Script_sections::attach_sections_using_phdrs_clause): Don't
13084         propagate non-PT_LOAD segments to orphan sections.
13085         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13086         readelf rather than objdump.
13087         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13088         .interp section and PT_INTERP segment are the same size.
13089         * testsuite/Makefile.in: Rebuild.
13090
13091         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13092         aliases for symbols defined in the same object.
13093         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13094         (weak_alias_test_SOURCES): New variable.
13095         (weak_alias_test_DEPENDENCIES): New variable.
13096         (weak_alias_test_LDFLAGS): New variable.
13097         (weak_alias_test_LDADD): New variable.
13098         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13099         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13100         (weak_alias_test_3.o): New target.
13101         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13102         * testsuite/weak_alias_test_main.cc: New file.
13103         * testsuite/weak_alias_test_1.cc: New file.
13104         * testsuite/weak_alias_test_2.cc: New file.
13105         * testsuite/weak_alias_test_3.cc: New file.
13106
13107 2008-04-08  Ian Lance Taylor  <iant@google.com>
13108
13109         * options.h (class General_options): Add --noinhibit-exec option.
13110         * main.cc (main): Check --noinhibit-exec.
13111
13112         * options.h (class General_options): Define --wrap as a special
13113         option.  Add wrap_symbols_ field.
13114         (General_options::any_wrap_symbols): New function.
13115         (General_options::is_wrap_symbol): New function.
13116         * options.cc (General_options::parse_wrap): New function.
13117         (General_options::General_options): Initialize wrap_symbols_.
13118         * symtab.cc (Symbol_table::wrap_symbol): New function.
13119         (Symbol_table::add_from_object): Handle --wrap.
13120         * symtab.h (class Symbol_table): Declare wrap_symbol.
13121         * target.h (Target::wrap_char): New function.
13122         (Target::Target_info): Add wrap_char field.
13123         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13124         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13125         * testsuite/testfile.cc (Target_test::test_target_info):
13126         Likewise.
13127
13128         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13129         there is one.
13130
13131         * layout.h (class Layout): Add added_eh_frame_data_ field.
13132         * layout.cc (Layout::Layout): Initialize new field.
13133         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13134         output section until we find a section we merged successfully.
13135         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13136         that the size be non-zero.
13137
13138         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13139         qualifier.
13140
13141 2008-04-08  Craig Silverstein  <csilvers@google.com>
13142
13143         * configure.ac: Export new conditional variable HAVE_ZLIB.
13144         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13145         on HAVE_ZLIB.
13146         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13147         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13148
13149 2008-04-07  Ian Lance Taylor  <iant@google.com>
13150
13151         * version.cc (version_string): Set to "1.5".
13152
13153         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13154         Add issued_non_pic_error_ field.  Declare check_non_pic.
13155         (Target_x86_64::Scan::check_non_pic): New function.
13156         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13157         (Target_x86_64::Scan::global): Likewise.
13158
13159         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13160         addend parameter.  Change caller.  Handle merge sections.
13161         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13162         Address to Addend.  Don't add in the result of
13163         local_section_offset, pass down the addend and use the returned
13164         value.
13165         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13166         Update declarations of local_section_offset and symbol_value.
13167         * testsuite/two_file_test_1.cc (t18): New function.
13168         * testsuite/two_file_test_2.cc (f18): New function.
13169         * testsuite/two_file_test_main.cc (main): Call t18.
13170         * testsuite/two_file_test.h (t18, f18): Declare.
13171
13172         * configure.ac: Don't test for objdump, c++filt, or readelf.
13173         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13174         conditionals.
13175         (TEST_READELF): New variable.
13176         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13177         (check_PROGRAMS): Add two_file_strip_test.
13178         (two_file_strip_test): New target.
13179         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13180         (two_file_same_shared_strip_test_SOURCES): New variable.
13181         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13182         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13183         (two_file_same_shared_strip_test_LDADD): New variable.
13184         (two_file_shared_strip.so): New target.
13185         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13186         (ver_test_5.syms, ver_test_7.syms): Likewise.
13187         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13188         (strip_test_3.stdout): Use TEST_OBJDUMP.
13189         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13190
13191 2008-04-04  Cary Coutant  <ccoutant@google.com>
13192
13193         * symtab.h (Symbol::is_weak_undefined): New function.
13194         (Symbol::is_strong_undefined): New function.
13195         (Symbol::is_absolute): New function.
13196         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13197         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13198         absolute symbols.
13199         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13200         (weak_undef_test): New target.
13201         * testsuite/Makefile.in: Rebuild.
13202         * testsuite/weak_undef_file1.cc: New file.
13203         * testsuite/weak_undef_file2.cc: New file.
13204         * testsuite/weak_undef_test.cc: New file.
13205
13206 2008-04-03  Craig Silverstein  <csilvers@google.com>
13207
13208         * compressed_output.h (class Output_compressed_section): Use
13209         unsigned buffer.
13210         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13211         add zlib header.
13212         (zlib_compressed_suffix): Removed.
13213         (Output_compressed_section::set_final_data_size): Use unsigned
13214         buffers.
13215         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13216         Fix linker invocation.
13217         (flagstest_o_specialfile_and_compress_debug_sections):
13218         Likewise.
13219         * testsuite/Makefile.in: Regenerated.
13220
13221 2008-04-02  David S. Miller  <davem@davemloft.net>
13222
13223         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13224         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13225
13226 2008-04-02  Craig Silverstein  <csilvers@google.com>
13227
13228         * TODO: New file.
13229
13230 2008-04-02  Ian Lance Taylor  <iant@google.com>
13231
13232         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13233         parameters.  Update for new key type to views_.  Change all
13234         callers.
13235         (File_read::read): Adjust for byteshift in returned view.
13236         (File_read::add_view): New function, broken out of
13237         find_and_make_view.
13238         (File_read::make_view): New function, broken out of
13239         find_and_make_view.
13240         (File_read::find_or_make_view): Add offset and aligned
13241         parameters.  Rewrite accordingly.  Change all callers.
13242         (File_read::get_view): Add offset and aligned parameters.  Adjust
13243         for byteshift in return value.
13244         (File_read::get_lasting_view): Likewise.
13245         * fileread.h (class File_read): Update declarations.
13246         (class File_read::View): Add byteshift_ field.  Add byteshift to
13247         constructor.  Add byteshift method.
13248         * archive.h (Archive::clear_uncached_views): New function.
13249         (Archive::get_view): Add aligned parameter.  Change all callers.
13250         * object.h (Object::get_view): Add aligned parameter.  Change all
13251         callers.
13252         (Object::get_lasting_view): Likewise.
13253
13254         * fileread.cc (File_read::release): Don't call clear_views if
13255         there are multiple objects.
13256         * fileread.h (File_read::clear_uncached_views): New function.
13257         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13258         on the archive.
13259
13260 2008-03-31  Cary Coutant  <ccoutant@google.com>
13261
13262         Add thin archive support.
13263         * archive.cc (Archive::armagt): New const.
13264         (Archive::setup): Remove task parameter and calls to unlock.
13265         (Archive::unlock_nested_archives): New function.
13266         (Archive::read_header): Add nested_off parameter. Change
13267         all callers.
13268         (Archive::interpret_header): Likewise.
13269         (Archive::include_all_members): Change to handle thin
13270         archives.
13271         (Archive::include_member): Likewise.
13272         * archive.h (Archive::Archive): Add new parameters and
13273         initializers.
13274         (Archive::armagt): New const.
13275         (Archive::setup): Remove task parameter.
13276         (Archive::unlock_nested_archives): New function.
13277         (Archive::read_header): Add nested_off parameter.
13278         (Archive::interpret_header): Likewise.
13279         (Archive::Nested_archive_table): New typedef.
13280         (Archive::is_thin_archive_): New field.
13281         (Archive::nested_archives_): New field.
13282         (Archive::options_): New field.
13283         (Archive::dirpath_): New field.
13284         (Archive::task_): New field.
13285         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13286         for thin archives.  Pass additional parameters to
13287         Archive::Archive.  Unlock the archive file after calling
13288         Archive::setup.
13289
13290 2008-03-29  Ian Lance Taylor  <iant@google.com>
13291
13292         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13293         version symbol to be local.
13294         * testsuite/ver_test_4.sh: New file.
13295         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13296         (check_DATA): Add ver_test_4.syms.
13297         (ver_test_4.syms): New target.
13298         * testsuite/Makefile.in: Rebuild.
13299
13300         * output.cc
13301         (Output_section::Input_section_sort_entry::has_priority): New
13302         function.
13303         (Output_section::Input_section_sort_entry::match_file_name): New
13304         function.
13305         (Output_section::Input_section_sort_entry::match_section_name):
13306         Remove.
13307         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13308         Remove.
13309         (Output_section::Input_section_sort_entry::match_section_file):
13310         Remove.
13311         (Output_section::Input_section_sort_compare::operator()): Rewrite
13312         using new Input_section_sort_entry functions.  Sort crtbegin and
13313         crtend first.  Sort sections with no priority before sections with
13314         a priority.
13315         * testsuite/initpri1.c (d3): Check j != 4.
13316         (cd5): New constructor/destructor function.
13317         (main): Check j != 2.
13318
13319         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13320         new symbol when resolving, don't call set_is_default.
13321         * testsuite/ver_test_7.cc: New file.
13322         * testsuite/ver_test_7.sh: New file.
13323         * testsuite/Makefile.am (ver_test_7.so): New target.
13324         (ver_test_7.o): New target.
13325         (check_SCRIPTS): Add ver_test_7.sh.
13326         (check_DATA): Add ver_test_7.syms.
13327         (ver_test_7.syms): New target.
13328
13329 2008-03-28  Ian Lance Taylor  <iant@google.com>
13330
13331         * layout.cc (Layout::layout): If we see an input section with a
13332         name that needs sorting, set the must_sort flag for the output
13333         section.
13334         (Layout::make_output_section): If the name of the output section
13335         indicates that it might require sorting, set the may_sort flag.
13336         * output.h (Output_section::may_sort_attached_input_sections): New
13337         function.
13338         (Output_section::set_may_sort_attached_input_sections): New
13339         function.
13340         (Output_section::must_sort_attached_input_sections): New
13341         function.
13342         (Output_section::set_must_sort_attached_input_sections): New
13343         function.
13344         (class Output_section): Declare Input_section_sort_entry.  Define
13345         Input_section_sort_compare.  Declare
13346         sort_attached_input_sections.  Add new fields:
13347         may_sort_attached_input_sections_,
13348         must_sort_attached_input_sections_,
13349         attached_input_sections_are_sorted_.
13350         * output.cc (Output_section::Output_section): Initialize new
13351         fields.
13352         (Output_section::add_input_section): Add an entry to
13353         input_sections_ if may_sort or must_sort are true.
13354         (Output_section::set_final_data_size): Call
13355         sort_attached_input_sections if necessary.
13356         (Output_section::Input_section_sort_entry): Define new class.
13357         (Output_section::Input_section_sort_compare::operator()): New
13358         function.
13359         (Output_section::sort_attached_input_sections): New function.
13360         * configure.ac: Check whether the compiler supports constructor
13361         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13362         * testsuite/initpri1.c: New file.
13363         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13364         CONSTRUCTOR_PRIORITY.
13365         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13366         (initpri1_LDFLAGS): New variable.
13367         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13368
13369 2008-03-27  Ian Lance Taylor  <iant@google.com>
13370
13371         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13372         * testsuite/common_test_1.c: New file.
13373         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13374         (common_test_1_SOURCES): New variable.
13375         (common_test_1_DEPENDENCIES): New variable.
13376         (common_test_1_LDFLAGS): New variable.
13377
13378         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13379         and commons_ correctly when NAME/VERSION does not override
13380         NAME/NULL.
13381         * testsuite/ver_test_6.c: New file.
13382         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13383         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13384         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13385
13386 2008-03-26  Ian Lance Taylor  <iant@google.com>
13387
13388         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13389         of an undefined symbol from a version script.
13390         * testsuite/Makefile.am (ver_test_5.so): New target.
13391         (ver_test_5.o): New target.
13392         (check_SCRIPTS): Add ver_test_5.sh.
13393         (check_DATA): Add ver_test_5.syms.
13394         (ver_test_5.syms): New target.
13395         * testsuite/ver_test_5.cc: New file.
13396         * testsuite/ver_test_5.script: New file.
13397         * testsuite/ver_test_5.sh: New file.
13398         * Makefile.in, testsuite/Makefile.in: Rebuild.
13399
13400         PR gold/5986
13401         Fix problems building gold with gcc 4.3.0.
13402         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13403         (gold_error_at_location, gold_warning_at_location): Use it.
13404         * configure.ac: Check whether we can compile and use a template
13405         function with a printf attribute.
13406         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13407         when jumping over bytes.
13408         * object.cc: Instantiate Object::read_section_data.
13409         * debug.h: Include <cstring>
13410         * dwarf_reader.cc: Include <algorithm>
13411         * main.cc: Include <cstring>.
13412         * options.cc: Include <cstring>.
13413         * output.cc: Include <cstring>.
13414         * script.cc: Include <cstring>.
13415         * script.h: Include <string>.
13416         * symtab.cc: Include <cstring> and <algorithm>.
13417         * target-select.cc: Include <cstring>.
13418         * version.cc: Include <string>.
13419         * testsuite/testmain.cc: Include <cstdlib>.
13420         * configure, config.in: Rebuild.
13421
13422 2008-03-25  Ian Lance Taylor  <iant@google.com>
13423
13424         * options.cc: Include "../bfd/bfdver.h".
13425         (options::help): Print bug reporting address.
13426
13427         * version.cc (print_version): Adjust output for current value of
13428         BFD_VERSION_STRING.
13429
13430         * NEWS: New file.
13431
13432         * options.cc (options::help): Print list of supported targets.
13433         * target-select.h: Include <vector>.
13434         (class Target_selector): Make machine_, size_, and is_big_endian_
13435         fields const.  Add bfd_name_ and instantiated_target_ fields.
13436         (Target_selector::Target_selector): Add bfd_name parameter.
13437         (Target_selector::recognize): Make non-virtual, call
13438         do_recognize.
13439         (Target_selector::recognize_by_name): Make non-virtual, call
13440         do_recognize_by_name.
13441         (Target_selector::supported_names): New function.
13442         (Target_selector::bfd_name): New function.
13443         (Target_selector::do_instantiate_target): New pure virtual
13444         function.
13445         (Target_selector::do_recognize): New virtual function.
13446         (Target_selector::do_recognize_by_name): New virtual function.
13447         (Target_selector::instantiate_target): New private function.
13448         (supported_target_names): Declare.
13449         * target-select.cc (Target_selector::Target_selector): Update for
13450         new parameter and fields.
13451         (select_target_by_name): Check that the name matches before
13452         calling recognize_by_name.
13453         (supported_target_names): New function.
13454         * i386.cc (class Target_selector_i386): Update Target_selector
13455         constructor call.  Remove recognize and recognize_by_name.  Add
13456         do_instantiate_target.
13457         * x86_64.cc (class Target_selector_x86_64): Likewise.
13458         * testsuite/testfile.cc (class Target_selector_test): Update for
13459         changes to Target_selector.
13460
13461         * README: Rewrite, with some notes on unsupported features.
13462
13463 2008-03-24  Cary Coutant  <ccoutant@google.com>
13464
13465         * i386.cc (Target_i386::Got_type): New enum declaration.
13466         (Target_i386::Scan::local): Updated callers of Output_data_got
13467         member functions.
13468         (Target_i386::Scan::global): Likewise.
13469         (Target_i386::Relocate::relocate): Likewise.
13470         (Target_i386::Relocate::relocate_tls): Likewise.
13471         * object.h (Got_offset_list): New class.
13472         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13473         (Sized_relobj::local_got_offset): Likewise.
13474         (Sized_relobj::set_local_got_offset): Likewise.
13475         (Sized_relobj::local_has_tls_got_offset): Removed.
13476         (Sized_relobj::local_tls_got_offset): Removed.
13477         (Sized_relobj::set_local_tls_got_offset): Removed.
13478         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13479         * output.cc (Output_data_got::add_global): Added got_type parameter.
13480         (Output_data_got::add_global_with_rel): Likewise.
13481         (Output_data_got::add_global_with_rela): Likewise.
13482         (Output_data_got::add_global_pair_with_rel): New function.
13483         (Output_data_got::add_global_pair_with_rela): New function.
13484         (Output_data_got::add_local): Added got_type parameter.
13485         (Output_data_got::add_local_with_rel): Likewise.
13486         (Output_data_got::add_local_with_rela): Likewise.
13487         (Output_data_got::add_local_pair_with_rel): New function.
13488         (Output_data_got::add_local_pair_with_rela): New function.
13489         (Output_data_got::add_global_tls): Removed.
13490         (Output_data_got::add_global_tls_with_rel): Removed.
13491         (Output_data_got::add_global_tls_with_rela): Removed.
13492         (Output_data_got::add_local_tls): Removed.
13493         (Output_data_got::add_local_tls_with_rel): Removed.
13494         (Output_data_got::add_local_tls_with_rela): Removed.
13495         * output.h (Output_data_got::add_global): Added got_type parameter.
13496         (Output_data_got::add_global_with_rel): Likewise.
13497         (Output_data_got::add_global_with_rela): Likewise.
13498         (Output_data_got::add_global_pair_with_rel): New function.
13499         (Output_data_got::add_global_pair_with_rela): New function.
13500         (Output_data_got::add_local): Added got_type parameter.
13501         (Output_data_got::add_local_with_rel): Likewise.
13502         (Output_data_got::add_local_with_rela): Likewise.
13503         (Output_data_got::add_local_pair_with_rel): New function.
13504         (Output_data_got::add_local_pair_with_rela): New function.
13505         (Output_data_got::add_global_tls): Removed.
13506         (Output_data_got::add_global_tls_with_rel): Removed.
13507         (Output_data_got::add_global_tls_with_rela): Removed.
13508         (Output_data_got::add_local_tls): Removed.
13509         (Output_data_got::add_local_tls_with_rel): Removed.
13510         (Output_data_got::add_local_tls_with_rela): Removed.
13511         * resolve.cc (Symbol::override_base_with_special): Removed
13512         reference to has_got_offset_ field.
13513         * symtab.cc (Symbol::init_fields): Replaced initialization
13514         of got_offset_ with got_offsets_.  Removed initialization
13515         of has_got_offset_
13516         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13517         (Symbol::got_offset): Likewise.
13518         (Symbol::set_got_offset): Likewise.
13519         (Symbol::has_tls_got_offset): Removed.
13520         (Symbol::tls_got_offset): Removed.
13521         (Symbol::set_tls_got_offset): Removed.
13522         (Symbol::got_offset_): Removed.
13523         (Symbol::tls_mod_got_offset_): Removed.
13524         (Symbol::tls_pair_got_offset_): Removed.
13525         (Symbol::got_offsets_): New field.
13526         (Symbol::has_got_offset): Removed.
13527         (Symbol::has_tls_mod_got_offset): Removed.
13528         (Symbol::has_tls_pair_got_offset): Removed.
13529         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13530         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13531         member functions.
13532         (Target_x86_64::Scan::global): Likewise.
13533         (Target_x86_64::Relocate::relocate): Likewise.
13534         (Target_x86_64::Relocate::relocate_tls): Likewise.
13535
13536 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13537
13538         * yyscript.y: Fix spelling error in comment.
13539
13540 2008-03-24  Ian Lance Taylor  <iant@google.com>
13541
13542         * options.h (class General_options): Define build_id option.
13543         * layout.h (class Layout): Declare write_build_id, create_note,
13544         create_build_id.  Add build_id_note_ member.
13545         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13546         "libiberty.h", "md5.h", "sha1.h".
13547         (Layout::Layout): Initialize eh_frame_data_,
13548         eh_frame_hdr_section_, and build_id_note_.
13549         (Layout::finalize): Call create_build_id.
13550         (Layout::create_note): New function, broken out of
13551         Layout::create_gold_note.
13552         (Layout::create_gold_note): Call create_note.
13553         (Layout::create_build_id): New function.
13554         (Layout::write_build_id): New function.
13555         (Close_task_runner::run): Call write_build_id.
13556
13557         * x86_64.cc: Correct license to GPLv3.
13558
13559 2008-03-23  Ian Lance Taylor  <iant@google.com>
13560
13561         * options.cc: Include "demangle.h".
13562         (parse_optional_string): New function.
13563         (parse_long_option): Handle takes_optional_argument.
13564         (parse_short_option): Update dash_z initializer.  Handle
13565         takes_optional_argument.
13566         (General_options::General_options): Initialize do_demangle_.
13567         (General_options::finalize): Set do_demangle_.  Handle demangling
13568         style.
13569         * options.h (parse_optional_string): Declare.
13570         (struct One_option): Add optional_arg field.  Update constructor.
13571         Update call constructor calls.  Add takes_optional_argument
13572         function.
13573         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13574         (DEFINE_optional_string): Define.
13575         (General_options::demangle): Change from DEFINE_bool to
13576         DEFINE_optional_string.
13577         (General_options::no_demangle): New function.
13578         (General_options::do_demangle): New function.
13579         (General_options::set_do_demangle): New function.
13580         (General_options::execstack_status_): Move definition to end of
13581         class definition.
13582         (General_options::static_): Likewise.
13583         (General_options::do_demangle_): New field.
13584         * object.cc (big_endian>::get_symbol_location_info): Call
13585         Options::do_demangle, not Options::demangle.
13586         * symtab.cc (demangle): Likewise.
13587
13588 2008-03-22  Ian Lance Taylor  <iant@google.com>
13589
13590         * gold.h: Include <cstddef> and <sys/types.h>
13591         * options.h: Include <cstring>.
13592
13593 2008-03-21  Ian Lance Taylor  <iant@google.com>
13594
13595         * Added source code to GNU binutils.