* powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
[external/binutils.git] / gold / ChangeLog
1 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2
3         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4         --just-symbols.
5
6 2012-08-31  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
9         (Powerpc_relobj::toc_base_offset): New stub function.
10         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
11         got_mod_index_offset to tlsld_got_offset.  Update all refs.
12         (Target_powerpc::Relocate::enum skip_tls): New.
13         (Target_powerpc::call_tls_get_addr_): New var.
14         (Target_powerpc::is_branch_reloc): Move to file scope.
15         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
16         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
17         New functions.
18         (Target_powerpc::enum Got_type): Delete old values, add new ones.
19         (powerpc_info): Correct common_pagesize for ppc64.
20         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
21         (Powerpc_relocate_functions): Add overflow check enums and functions.
22         Add non-shift version of rela, rela_ua.  Delete all rel public
23         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
24         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
25         addr16_ha3, addr14 functions.
26         (Output_data_got_powerpc::add_constant_pair): New function.
27         (Output_data_got_powerpc::got_base_offset): Likewise.
28         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
29         (instruction constants): Sort, add some more.
30         (Output_data_glink::do_write): Add and use Address typedef.  Use
31         object->toc_base_offset() stub for 64-bit.
32         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
33         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
34         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
35         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
36         Always treat .opd relocs as against locally defined symbol.
37         Correct condition for RELATIVE relocs.
38         (Target_powerpc::do_finalize_sections): Test for NULL sections.
39         (Target_powerpc::Relocate::relocate): Use plt call stub as value
40         for 32-bit syms with a plt entry.  Correct ppc64 toc base
41         calculations.  Handle TLS relocs, and more.  Add overflow
42         checking and adjust for Powerpc_relocate_functions changes.
43         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
44         Reinstate --emit-relocs code with FIXME.
45
46 2012-08-30  Alan Modra  <amodra@gmail.com>
47
48         * layout.cc (Layout::set_segment_offsets): Set p_align to
49         abi_pagesize, not common_pagesize.
50         (Layout::relaxation_loop_body): Similarly use abi_pagesize
51         to determine whether file header can go in segment.
52
53 2012-08-30  Alan Modra  <amodra@gmail.com>
54
55         * output.h (Output_reloc::Output_reloc <output section>): Add
56         is_relative param.  Adjust calls.
57         (Output_reloc::add_output_section_relative): New functions.
58         * output.cc (Output_reloc::Output_reloc <output section>): Handle
59         is_relative.
60         (Output_reloc::symbol_value): Handle SECTION_CODE.
61
62 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
63
64         * gold.cc (queue_middle_tasks): Call layout again when unique
65         segments for sections is desired.
66         * layout.cc (Layout::Layout): Initialize new members.
67         (Layout::get_output_section_flags): New function.
68         (Layout::choose_output_section): Call get_output_section_flags.
69         (Layout::layout): Make output section for mapping to a unique segment.
70         (Layout::insert_section_segment_map): New function.
71         (Layout::attach_allocated_section_to_segment): Make unique segment for
72         output sections marked so.
73         (Layout::segment_precedes): Check for unique segments when sorting.
74         * layout.h (Layout::Unique_segment_info): New struct.
75         (Layout::Section_segment_map): New typedef.
76         (Layout::insert_section_segment_map): New function.
77         (Layout::get_output_section_flags): New function.
78         (Layout::is_unique_segment_for_sections_specified): New function.
79         (Layout::set_unique_segment_for_sections_specified): New function.
80         (Layout::unique_segment_for_sections_specified_): New member.
81         (Layout::section_segment_map_): New member.
82         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
83         Rename is_gc_pass_one to is_pass_one.
84         Rename is_gc_pass_two to is_pass_two.
85         Rename is_gc_or_icf to is_two_pass.
86         Check for which pass based on whether symbols data is present.
87         Make it two pass when unique segments for sections is desired.
88         * output.cc (Output_section::Output_section): Initialize new
89         members.
90         * output.h (Output_section::is_unique_segment): New function.
91         (Output_section::set_is_unique_segment): New function.
92         (Output_section::is_unique_segment_): New member.
93         (Output_section::extra_segment_flags): New function.
94         (Output_section::set_extra_segment_flags): New function.
95         (Output_section::extra_segment_flags_): New member.
96         (Output_section::segment_alignment): New function.
97         (Output_section::set_segment_alignment): New function.
98         (Output_section::segment_alignment_): New member.
99         (Output_segment::Output_segment): Initialize is_unique_segment_.
100         (Output_segment::is_unique_segment): New function.
101         (Output_segment::set_is_unique_segment): New function.
102         (Output_segment::is_unique_segment_): New member.
103         * plugin.cc (allow_unique_segment_for_sections): New function.
104         (unique_segment_for_sections): New function.
105         (Plugin::load): Add new functions to transfer vector.
106         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
107         * Makefile.in: Regenerate.
108         * testsuite/plugin_final_layout.sh: Check if unique segment
109         functionality works.
110         * testsuite/plugin_section_order.c (onload): Check if new interfaces
111         are available.
112         (allow_unique_segment_for_sections): New global.
113         (unique_segment_for_sections): New global.
114         (claim_file_hook): Call allow_unique_segment_for_sections.
115         (all_symbols_read_hook): Call unique_segment_for_sections.
116
117 2012-08-22  Cary Coutant  <ccoutant@google.com>
118
119         * layout.cc (Layout::include_section): Don't assert on GROUP
120         sections with --emit-relocs.
121
122 2012-08-21  Cary Coutant  <ccoutant@google.com>
123
124         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
125         if --export-dynamic-symbol names an undef symbol.
126
127 2012-08-18  Alan Modra  <amodra@gmail.com>
128
129         * powerpc.cc: Formatting and white space.
130         (Powerpc_relobj): Rename got2_section_ to special_.
131         Add opd_ent_shndx_ and opd_ent_off_ vectors.
132         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
133         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
134         (Target_powerpc): Add Address typedef and invalid_address.  Use
135         throughout.
136         (Target_powerpc::is_branch_reloc): New function.
137         (Powerpc_relocate_functions): Add Address typedef, use throughout.
138         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
139         for dst_mask, value and addend.
140         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
141         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
142         (Output_data_glink::do_write): Correct toc base.  Don't try to use
143         uint16_t for 24-bit offset.  Use get_output_section_offset and
144         check return.
145         (Target_powerpc::Scan::local): Handle more relocs.
146         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
147         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
148         Plug in toc restoring insn after plt calls.  Translate branches
149         to function descriptor symbols to corresponding entry point.
150         (Target_powerpc::relocate_for_relocatable): Check return from
151         get_output_section_offset.
152         * symtab.h: Comment typo.
153
154 2012-08-14  Ian Lance Taylor  <iant@google.com>
155
156         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
157         unsupported_relocal_local to call unsupported_reloc_global.
158
159 2012-08-14  Nick Clifton  <nickc@redhat.com>
160
161         PR ld/14265
162         * script-sections.cc (Sections_element::output_section_name): Add
163         keep return parameter.
164         (Output_section_element::match_name): Add keep return parameter.
165         Return the value of the keep_ member.
166         * script-sections.h (class Output_section): Update
167         output_section_name prototype.
168         * layout.cc (Layout::keep_input_section): New public member
169         function.
170         (Layout::choose_output_section): Pass keep parameter to
171         output_section_name.
172         * layout.h (class Layout): Add keep_input_section.
173         * object.cc (Sized_relobj_file::do_layout): Check for kept input
174         sections.
175         * testsuite/Makefile.am: Add a test.
176         * testsuite/Makefile.in: Regenerate.
177         * testsuite/pr14265.c: Source file for the test.
178         * testsuite/pr14265.t: Linker script for the test.
179         * testsuite/pr14265.sh: Shell script for the test.
180
181 2012-08-14  Alan Modra  <amodra@gmail.com>
182
183         * target.h (Target::output_section_name): New function.
184         (Target::do_output_section_name): New function.
185         * layout.cc (Layout::choose_output_section): Call the above.
186         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
187
188 2012-08-14  Alan Modra  <amodra@gmail.com>
189
190         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
191         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
192         for replace_constant call.
193         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
194         (Output_data_glink::do_print_to_mapfile): New function.
195         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
196         (Target_powerpc::Relocate::relocate): Likewise.
197
198 2012-08-14  Alan Modra  <amodra@gmail.com>
199
200         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
201         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
202         (Output_data_glink::add_entry,find_entry): Remove shndx param.
203         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
204         all references to shndx_.  Handle special case for R_PPC_PLTREL24
205         here.
206         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
207         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
208         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
209         here.
210         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
211         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
212
213 2012-08-12  Alan Modra  <amodra@gmail.com>
214
215         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
216         (glink insn constants): Use uint32_t.
217         (Output_data_glink::add_entry): Use insert, not [] operator.
218
219 2012-08-11  Alan Modra  <amodra@gmail.com>
220
221         * object.h (Sized_relobj_file::find_shdr): New function.
222         (Sized_relobj_file::find_special_sections): New function.
223         * object.cc (Sized_relobj_file::find_shdr): New function.
224         (Sized_relobj_file::find_eh_frame): Use find_shdr.
225         (Sized_relobj_file::find_special_sections): New function, split out..
226         (Sized_relobj_file::do_read_symbols): ..from here.
227         * output.h (Output_data_got::replace_constant): New function.
228         (Output_data_got::num_entries): New function.
229         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
230         (Output_data_got::got_offset): Protected rather than private.
231         (Output_data_got::replace_got_entry): New function.
232         * output.cc (Output_data_got::replace_got_entry): New function.
233         * powerpc.cc (class Powerpc_relobj): New.
234         (class Powerpc_relocate_functions): Delete all psymval variants or
235         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
236         Implement _ha functions using corresponding _hi function.
237         (Powerpc_relobj::find_special_sections): New function.
238         (Target_powerpc::do_make_elf_object): New function.
239         (class Output_data_got_powerpc): New.
240         (class Output_data_glink): New.
241         (class Powerpc_scan_relocatable_reloc): New.
242         Many more changes througout file.
243
244 2012-08-09  Nick Clifton  <nickc@redhat.com>
245
246         * po/vi.po: Updated Vietnamese translation.
247
248 2012-08-07  Ian Lance Taylor  <iant@google.com>
249
250         * layout.cc (Layout::add_target_dynamic_tags): If
251         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
252         plt_rel.
253
254 2012-07-30  Nick Clifton  <nickc@redhat.com>
255
256         * po/gold.pot: Updated template.
257         * po/es.po: Updated Spanish translation.
258
259 2012-07-18  Cary Coutant  <ccoutant@google.com>
260
261         PR gold/14344
262         * configure.ac: Add check for -gpubnames support.
263         * configure: Regenerate.
264         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
265         support; force -gno-pubnames.
266         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
267         support.
268         (gdb_index_test_4): New test.
269         * testsuite/Makefile.in: Regenerate.
270         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
271         * testsuite/gdb_index_test_2.sh: Likewise.
272         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
273         * testsuite/gdb_index_test_4.sh: New script.
274         * testsuite/gdb_index_test_comm.sh: New script with common code;
275         don't look for space after colon.
276
277 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
278
279         * gold.cc (queue_middle_tasks): Update function order only after
280         deferred objects due to plugins are processed.
281
282 2012-07-11  Ian Lance Taylor  <iant@google.com>
283
284         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
285         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
286         (Target_arm::scan_reloc_for_stub): Likewise.
287         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
288         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
289         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
290         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
291         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
292
293 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
294             Ian Lance Taylor  <iant@google.com>
295
296         PR gold/14309
297         * configure.ac: Test whether std::tr1::hash<off_t> works.
298         * gold.h: Add a specialization for std::tr1::hash<off_t> if
299         needed.
300         * output.h (class Output_fill): Add virtual destructor.
301         * configure, config.in: Rebuild.
302
303 2012-06-22  Roland McGrath  <mcgrathr@google.com>
304
305         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
306
307 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
308
309         * plugin.cc (Plugin::load): Handle position independent executables.
310
311 2012-06-06  Cary Coutant  <ccoutant@google.com>
312
313         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
314         add .debug_macro.
315         (lines_only_debug_sections): Likewise.
316         (gdb_fast_lookup_sections): New static array.
317         (is_gdb_debug_section): Rename formal parameter.
318         (is_lines_only_debug_section): Likewise.
319         (is_gdb_fast_lookup_section): New function.
320         (Layout::include_section): Check for ".zdebug_" prefix; pass
321         section name suffix to is_gdb_debug_section, et al.; check for
322         fast-lookup sections when building .gdb_index.
323         * options.h (--strip-debug-gdb): Update GDB version number.
324
325 2012-06-06  Cary Coutant  <ccoutant@google.com>
326
327         * configure.ac: Add check for fallocate.
328         * configure: Regenerate.
329         * config.in: Regenerate.
330
331         * options.h (class General_options): Add --mmap-output-file and
332         --posix-fallocate options.
333         * output.cc: (posix_fallocate): Remove; replace with...
334         (gold_fallocate): New function.
335         (Output_file::map_no_anonymous): Call gold_fallocate.
336         (Output_file::map): Check --mmap-output-file option.
337
338 2012-06-05  Jing Yu  <jingyu@google.com>
339
340         * gold.h (textdomain): Add do {} to empty while(0).
341         (bindtextdomain): Likewise.
342
343 2012-06-04  Cary Coutant  <ccoutant@google.com>
344
345         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
346         has_dynsym_index.
347
348 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
349
350         * symtab.cc (Symbol_table::define_special_symbol):
351         Initialize *poldsym to prevent uninitialized variable errors.
352
353 2012-05-23  Cary Coutant  <ccoutant@google.com>
354
355         * layout.cc (Layout::section_name_mapping): Add rules to handle
356         exact match on .data.rel.ro.local or .data.rel.ro.
357         (Layout::output_section_name): Check for exact matches.
358
359 2012-05-23  Cary Coutant  <ccoutant@google.com>
360
361         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
362         more carefully.
363
364 2012-05-22  Cary Coutant  <ccoutant@google.com>
365
366         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
367         object before exporting symbol.
368
369 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
370
371         * testsuite/tls_test.cc: Include "config.h" first.
372         * testsuite/tls_test_c.c: Likewise.
373
374 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
375             Nick Clifton  <nickc@redhat.com>
376
377         PR 14072
378         * configure.in: Add check that sysdep.h has been included before
379         any system header files.
380         * configure: Regenerate.
381         * config.in: Regenerate.
382
383 2012-05-14  Cary Coutant  <ccoutant@google.com>
384
385         * layout.cc (Layout::make_output_section): Mark .tdata section
386         as RELRO.
387         * testsuite/relro_test.cc: Add a TLS variable.
388
389 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
390
391         PR gold/14091
392         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
393         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
394         R_X86_64_64.
395
396 2012-05-08  Cary Coutant  <ccoutant@google.com>
397
398         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
399         (lines_only_debug_sections): Likewise.
400
401 2012-05-02  Roland McGrath  <mcgrathr@google.com>
402
403         * nacl.cc: New file.
404         * nacl.h: New file.
405         * Makefile.am (CCFILES, HFILES): Add them.
406         * Makefile.in: Regenerate.
407         * i386.cc (Output_data_plt_i386_nacl): New class.
408         (Output_data_plt_i386_nacl_exec): New class.
409         (Output_data_plt_i386_nacl_dyn): New class.
410         (Target_i386_nacl): New class.
411         (Target_selector_i386_nacl): New class.
412         (target_selector_i386): Use it instead of Target_selector_i386.
413         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
414         (Target_x86_64_nacl): New class.
415         (Target_selector_x86_64_nacl): New class.
416         (target_selector_x86_64, target_selector_x32): Use it instead of
417         Target_selector_x86_64.
418         * arm.cc (Output_data_plt_arm_nacl): New class.
419         (Target_arm_nacl): New class.
420         (Target_selector_arm_nacl): New class.
421         (target_selector_arm, target_selector_armbe): Use it instead of
422         Target_selector_arm.
423
424         * target-select.cc (select_target): Take new Input_file* and off_t
425         arguments, pass them on to recognize method of selector.
426         * object.cc (make_elf_sized_object): Update caller.
427         * parameters.cc (parameters_force_valid_target): Likewise.
428         * incremental.cc (make_sized_incremental_binary): Likewise.
429         * target-select.h: Update decl.
430         (Target_selector::recognize): Take new Input_file* argument,
431         pass it on to do_recognize.
432         (Target_selector::do_recognize): Take new Input_file* argument.
433         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
434         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
435         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
436         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
437
438         * target.h (Target::Target_info): New members isolate_execinstr
439         and rosegment_gap.
440         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
441         * arm.cc (Target_arm::arm_info): Update initializer.
442         * i386.cc (Target_i386::i386_info): Likewise.
443         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
444         * sparc.cc (Target_sparc::sparc_info): Likewise.
445         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
446         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
447         * layout.cc (Layout::attach_allocated_section_to_segment):
448         Take new const Target* argument.  If target->isolate_execinstr(), act
449         like --rosegment.
450         (Layout::find_first_load_seg): Take new const Target* argument;
451         if target->isolate_execinstr(), reject PF_X segments.
452         (Layout::relaxation_loop_body): Update caller.
453         (Layout::set_segment_offsets): If target->isolate_execinstr(),
454         reset file offset to zero when we hit LOAD_SEG, and then do a second
455         loop over the segments before LOAD_SEG to reassign offsets after
456         addresses have been determined.  Handle target->rosegment_gap().
457         (Layout::attach_section_to_segment): Take new const Target* argument;
458         pass it to attach_allocated_section_to_segment.
459         (Layout::make_output_section): Update caller.
460         (Layout::attach_sections_to_segments): Take new const Target* argument;
461         pass it to attach_section_to_segment.
462         * gold.cc (queue_middle_tasks): Update caller.
463         * layout.h (Layout): Update method decls with new arguments.
464
465         * arm.cc (Target_arm::Target_arm): Take optional argument for the
466         Target_info pointer to use.
467         (Target_arm::do_make_data_plt): New virtual method.
468         (Target_arm::make_data_plt): New method that calls it.
469         (Target_arm::make_plt_entry): Use it.
470         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
471         for the section alignment.
472         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
473         method.
474         (Output_data_plt_arm::first_plt_entry_offset): Call it.
475         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
476         method.
477         (Output_data_plt_arm::get_plt_entry_size): Call it.
478         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
479         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
480         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
481         method.
482         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
483         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
484         method instead of sizeof(plt_entry).
485         (Output_data_plt_arm::add_entry): Likewise.
486         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
487         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
488         than static method.
489         (Target_arm::plt_entry_size): Likewise.
490         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
491         Move to ...
492         (Output_data_plt_arm_standard): ... here, new class.
493         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
494         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
495         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
496
497         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
498         Take additional argument for the PLT entry size.
499         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
500         Use get_plt_entry_size method rather than plt_entry_size variable.
501         (Output_data_plt_x86_64::reserve_slot): Likewise.
502         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
503         (Output_data_plt_x86_64::add_entry): Likewise.
504         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
505         (Output_data_plt_x86_64::address_for_global): Likewise.
506         (Output_data_plt_x86_64::address_for_local): Likewise.
507         (Output_data_plt_x86_64::set_final_data_size): Likewise.
508         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
509         Make method non-static.
510         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
511         method.
512         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
513         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
514         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
515         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
516         virtual method.
517         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
518         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
519         virtual method.
520         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
521         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
522         virtual method.
523         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
524         (Output_data_plt_x86_64::plt_entry_size)
525         (Output_data_plt_x86_64::first_plt_entry)
526         (Output_data_plt_x86_64::plt_entry)
527         (Output_data_plt_x86_64::tlsdesc_plt_entry)
528         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
529         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
530         (Output_data_plt_x86_64_standard): ... here, new class.
531         (Target_x86_64::Target_x86_64): Take optional argument for the
532         Target_info pointer to use.
533         (Target_x86_64::do_make_data_plt): New virtual method.
534         (Target_x86_64::make_data_plt): New method to call it.
535         (Target_x86_64::init_got_plt_for_update): Use that.
536         Call this->plt_->add_eh_frame method here.
537         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
538         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
539         rather than static method.
540         (Target_x86_64::plt_entry_size): Likewise.
541         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
542         rather than plt_entry_size variable.  Move guts of PLT filling to...
543         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
544         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
545         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
546
547         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
548         additional argument for the section alignment.
549         Don't do add_eh_frame_for_plt here.
550         (Output_data_plt_i386::first_plt_entry_offset): Make the method
551         non-static.  Use get_plt_entry_size method rather than plt_entry_size
552         variable.
553         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
554         method.
555         (Output_data_plt_i386::get_plt_entry_size): Call it.
556         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
557         (Output_data_plt_i386::add_eh_frame): New method to call it.
558         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
559         method.
560         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
561         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
562         method.
563         (Output_data_plt_i386::fill_plt_entry): New method to call it.
564         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
565         method instead of plt_entry_size.
566         (Output_data_plt_i386::plt_entry_size)
567         (Output_data_plt_i386::plt_eh_frame_fde_size)
568         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
569         (Output_data_plt_i386_standard): ... here, new class.
570         (Output_data_plt_i386_exec): New class.
571         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
572         (Output_data_plt_i386_exec::first_plt_entry): ... here.
573         (Output_data_plt_i386::exec_plt_entry): Move to ...
574         (Output_data_plt_i386_exec::plt_entry): ... here.
575         (Output_data_plt_i386_dyn): New class.
576         (Output_data_plt_i386::first_plt_entry): Move to ...
577         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
578         (Output_data_plt_i386::dyn_plt_entry): Move to ...
579         (Output_data_plt_i386_dyn::plt_entry): ... here.
580         (Target_i386::Target_i386): Take optional argument for the Target_info
581         pointer to use.
582         (Target_i386::do_make_data_plt): New virtual method.
583         (Target_i386::make_data_plt): New method to call it.
584         (Target_i386::make_plt_section): Use that.
585         Call this->plt_->add_eh_frame method here.
586         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
587         rather than plt_entry_size variable.
588         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
589         (Output_data_plt_i386::address_for_local): Likewise.
590         (Output_data_plt_i386::do_write): Likewise.
591         Move guts of PLT filling to...
592         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
593         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
594         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
595         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
596
597 2012-05-01  Cary Coutant  <ccoutant@google.com>
598
599         * dwarf_reader.cc (Dwarf_die::read_attributes)
600         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
601         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
602         * reduced_debug_output.cc
603         (Output_reduced_debug_info_section::get_die_end): Remove
604         DW_FORM_GNU_ref_index.  Add default case.
605
606 2012-04-26  Mark Wielaard  <mjw@redhat.com>
607
608         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
609         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
610         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
611         DW_AT_high_pc as offset from DW_AT_low_pc.
612
613         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
614         * testsuite/Makefile.in: Regenerate.
615         * testsuite/gdb_index_test_3.c: New test source file.
616         * testsuite/gdb_index_test_3.sh: New test source file.
617
618 2012-04-25  Ian Lance Taylor  <iant@google.com>
619
620         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
621         pointer.
622         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
623         as a class, not a struct.
624         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
625         (Target_arm::apply_cortex_a8_workaround): Likewise.
626         * gc.h: Declare Reloc_types as a struct, not a class.
627         * object.h: Declare Symbols_data as a struct.
628         * reloc.h: Declare Read_relocs_data as a struct.
629         * target.h: Declare Relocate_info as a struct.
630
631 2012-04-24  David S. Miller  <davem@davemloft.net>
632
633         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
634         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
635         and R_SPARC_WPLT30.
636
637 2012-04-24  Cary Coutant  <ccoutant@google.com>
638
639         * incremental-dump.cc (find_input_containing_global): Replace
640         magic number with symbolic constant.
641         (dump_incremental_inputs): Update version number.
642         * incremental.cc (Output_section_incremental_inputs): Update version
643         number; import symbolic constants from Incremental_inputs_reader.
644         (Incremental_inputs::create_data_sections): Align relocations
645         section correctly for 64-bit targets.
646         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
647         constants; add padding.
648         (Output_section_incremental_inputs::write_header): Add assert for
649         header_size.
650         (Output_section_incremental_inputs::write_input_files): Add assert
651         for input_entry_size.
652         (Output_section_incremental_inputs::write_info_blocks): Add padding;
653         add assert for object_info_size, input_section_entry_size,
654         global_sym_entry_size.
655         * incremental.h (Incremental_inputs_reader): Add symbolic constants
656         for data structure sizes; use them.
657         (Incremental_input_entry_reader): Import symbolic constants from
658         Incremental_inputs_reader; use them.
659
660 2012-04-23  David S. Miller  <davem@davemloft.net>
661
662         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
663         and elf_flags_set_.
664         (Target_sparc::Target_sparc): Initialize new fields.
665         (Target_sparc::do_make_elf_object): New function.
666         (Target_sparc::do_adjust_elf_header): New function.
667
668 2012-04-23  Cary Coutant  <ccoutant@google.com>
669
670         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
671         CU range table of gdb index.
672
673 2012-04-20  David S. Miller  <davem@davemloft.net>
674
675         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
676         instead of false.
677
678 2012-04-16  David S. Miller  <davem@davemloft.net>
679
680         * sparc.cc (Target_sparc::got_address): New function.
681         (Sparc_relocate_functions::gdop_hix22): New function.
682         (Sparc_relocate_functions::gdop_lox10): New function.
683         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
684         relocs.
685         (Target_sparc::Scan::local): Likewise if the global symbol is not
686         preemptible and is not IFUNC.
687         (Target_sparc::Relocate::relocate): Perform GOTDATA code
688         transformations for local and non-preemptible non-IFUNC global
689         symbols.
690
691         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
692         writing out 64-bit part of ranges.
693
694         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
695         -fpic and -fpie respectively.
696         * Makefile.in: Regenerate.
697
698         * sparc.cc (class Target_sparc): Add rela_ifunc_.
699         (Target_sparc::Target_sparc): Initialize new field.
700         (Target_sparc::do_plt_section_for_global): New function.
701         (Target_sparc::do_plt_section_for_local): New function.
702         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
703         (Target_sparc::make_plt_section): New function, broken out of
704         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
705         (Target_sparc::make_plt_entry): Call make_plt_section.
706         (Target_sparc::make_local_ifunc_plt_entry): New function.
707         (Target_sparc::rela_ifunc_section): New function.
708         (Target_sparc::plt_section): Remove const.
709         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
710         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
711         and ifunc_count_ fields.
712         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
713         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
714         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
715         (Output_data_plt_sparc::rela_ifunc): New function.
716         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
717         (Output_data_plt_sparc::has_ifunc_section): New function.
718         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
719         (Output_data_plt_sparc::address_for_global): New function.
720         (Output_data_plt_sparc::address_for_local): New function.
721         (Output_data_plt_sparc::plt_index_to_offset): New function.
722         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
723         and entry_count.
724         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
725         entry_count.
726         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
727         R_SPARC_JMP_IREL to switch.
728         (Target_sparc::Scan::check_non_pic): Likewise.
729         (Target_sparc::Scan::local): Handle IFUNC symbols.
730         (Target_sparc::Scan::local): Likewise.
731         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
732         and plt_address_for_local.
733         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
734         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
735
736         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
737         (class Output_data_reloc): Adjust calls to Output_reloc_type.
738         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
739         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
740         global relocs too.
741         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
742         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
743         calls.
744         * sparc.cc (Target_sparc::Scan::global): Likewise.
745         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
746
747 2012-04-16  Cary Coutant  <ccoutant@google.com>
748
749         * archive.cc (Library_base::should_include_member): Check for
750         --export-dynamic-symbol.
751         * options.h (class General_options): Add --export-dynamic-symbol.
752         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
753         --export-dynamic-symbol.
754         (Symbol_table::gc_mark_undef_symbols): Likewise.
755         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
756
757 2012-04-12  David S. Miller  <davem@davemloft.net>
758
759         * sparc.cc (Reloc::wdisp10): New relocation method.
760         (Reloc::h34): Likewise.
761         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
762         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
763         R_SPARC_WDISP10.
764         (Target_sparc::Scan::local): Likewise.
765         (Target_sparc::Scan::global): Likewise.
766         (Target_sparc::Relocate::relocate): Likewise.
767
768 2012-04-09  Cary Coutant  <ccoutant@google.com>
769
770         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
771         low_pc == 0.
772
773 2012-04-06  Ian Lance Taylor  <iant@google.com>
774
775         * timer.cc: #include <unistd.h>.
776
777 2012-04-06  Roland McGrath  <mcgrathr@google.com>
778
779         * configure.in (AC_CHECK_HEADERS): Add locale.h.
780         * config.in: Regenerate.
781         * configure: Regenerate.
782
783 2012-04-05  Nick Clifton  <nickc@redhat.com>
784
785         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
786         (AM_LC_MESSAGES): Add.
787         * aclocal.m4: Regenerate.
788         * config.in: Regenerate.
789         * configure: Regenerate.
790
791 2012-03-21  Cary Coutant  <ccoutant@google.com>
792
793         * Makefile.am: Add gdb-index.cc, gdb-index.h.
794         * Makefile.in: Regenerate.
795         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
796         (Sized_elf_reloc_mapper::symbol_section): New function.
797         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
798         (make_elf_reloc_mapper): New function.
799         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
800         (Dwarf_abbrev_table::do_read_abbrevs): New function.
801         (Dwarf_abbrev_table::do_get_abbrev): New function.
802         (Dwarf_ranges_table::read_ranges_table): New function.
803         (Dwarf_ranges_table::read_range_list): New function.
804         (Dwarf_pubnames_table::read_section): New function.
805         (Dwarf_pubnames_table::read_header): New function.
806         (Dwarf_pubnames_table::next_name): New function.
807         (Dwarf_die::Dwarf_die): New function.
808         (Dwarf_die::read_attributes): New function.
809         (Dwarf_die::skip_attributes): New function.
810         (Dwarf_die::set_name): New function.
811         (Dwarf_die::set_linkage_name): New function.
812         (Dwarf_die::attribute): New function.
813         (Dwarf_die::string_attribute): New function.
814         (Dwarf_die::int_attribute): New function.
815         (Dwarf_die::uint_attribute): New function.
816         (Dwarf_die::ref_attribute): New function.
817         (Dwarf_die::child_offset): New function.
818         (Dwarf_die::sibling_offset): New function.
819         (Dwarf_info_reader::check_buffer): New function.
820         (Dwarf_info_reader::parse): New function.
821         (Dwarf_info_reader::do_parse): New function.
822         (Dwarf_info_reader::do_read_string_table): New function.
823         (Dwarf_info_reader::lookup_reloc): New function.
824         (Dwarf_info_reader::get_string): New function.
825         (Dwarf_info_reader::visit_compilation_unit): New function.
826         (Dwarf_info_reader::visit_type_unit): New function.
827         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
828         Sized_elf_reloc_mapper.
829         (Sized_dwarf_line_info::symbol_section): Remove function.
830         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
831         (Sized_dwarf_line_info::read_line_mappings): Remove object
832         parameter, adjust callers.
833         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
834         * dwarf_reader.h: Include <sys/types.h>.
835         (class Track_relocs): Remove forward declaration.
836         (class Elf_reloc_mapper): New class.
837         (class Sized_elf_reloc_mapper): New class.
838         (class Dwarf_abbrev_table): New class.
839         (class Dwarf_range_list): New class.
840         (class Dwarf_ranges_table): New class.
841         (class Dwarf_pubnames_table): New class.
842         (class Dwarf_die): New class.
843         (class Dwarf_info_reader): New class.
844         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
845         (Sized_dwarf_line_info::symbol_section): Remove member function.
846         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
847         base class.
848         * gdb-index.cc: New source file.
849         * gdb-index.h: New source file.
850         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
851         and .debug_types sections, call Layout::add_to_gdb_index.
852         (Sized_relobj_incr::do_section_name): Implement.
853         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
854         return type; Implement.
855         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
856         return type.
857         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
858         parameter list and return type.
859         (Sized_incr_dynobj::do_section_contents): Likewise.
860         * layout.cc: Include gdb-index.h.
861         (Layout::Layout): Initialize gdb_index_data_.
862         (Layout::init_fixed_output_section): Check for .gdb_index section.
863         (Layout::add_to_gdb_index): New function. Instantiate.
864         * layout.h: Add forward declaration for class Gdb_index.
865         (Layout::add_to_gdb_index): New member function.
866         (Layout::gdb_index_data_): New data member.
867         * main.cc: Include gdb-index.h.
868         (main): Print statistics for gdb index.
869         * object.cc (Object::section_contents): Move code into
870         do_section_contents.
871         (need_decompressed_section): Check for sections needed when building
872         gdb index.
873         (build_compressed_section_map): Likewise.
874         (Sized_relobj_file::do_read_symbols): Need local symbols when building
875         gdb index.
876         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
877         sections; call Layout::add_to_gdb_index.
878         (Sized_relobj_file::do_decompressed_section_contents): Call
879         do_section_contents directly.
880         * object.h (Object::do_section_contents): Adjust parameter list and
881         return type.
882         (Object::do_decompressed_section_contents): Call do_section_contents
883         directly.
884         (Sized_relobj_file::do_section_contents): Adjust parameter list and
885         return type.
886         * options.h (class General_options): Add --gdb-index option.
887         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
888         list and return type.
889         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
890         * reloc.h (Track_relocs::checkpoint): New function.
891         (Track_relocs::reset): New function.
892
893         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
894         New test cases.
895         * testsuite/Makefile.in: Regenerate.
896         * testsuite/gdb_index_test.cc: New test source file.
897         * testsuite/gdb_index_test_1.sh: New test source file.
898         * testsuite/gdb_index_test_2.sh: New test source file.
899
900 2012-03-19  Doug Kwan  <dougkwan@google.com>
901
902         * arm.cc (Target_arm::do_define_standard_symbols): New method.
903         (Target_arm::do_finalize_sections): Remove code which defines
904         __exidx_start and __exidx_end.  Make symbol table parameter
905         anonymous as it is not used.
906         * gold.cc (queue_middle_tasks): Call target hook to define any
907         target-specific symbols.
908         * target.h (Target::define_standard_symbols): New method.
909         (Target::do_define_standard_symbols): Same.
910         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
911         * testsuite/Makefile.in: Regenerate.
912         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
913         and __exidx_end.
914         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
915         relocations are generated for __exidx_start and __exidx_end.
916
917 2012-03-16  Doug Kwan  <dougkwan@google.com>
918
919         * testsuite/Makefile.am: Disable test initpri3b.
920         * testsuite/Makefile.in: Regenerate.
921
922 2012-03-15  Doug Kwan  <dougkwan@google.com>
923
924         * arm.cc (Target_arm::got_section): Make .got section read-only
925         if -z now is given.
926
927 2012-03-15  Ian Lance Taylor  <iant@google.com>
928
929         PR gold/13850
930         * layout.cc (Layout::make_output_section): Correctly mark
931         SHT_INIT_ARRAY, et. al., as relro.
932
933 2012-03-14  Doug Kwan  <dougkwan@google.com>
934
935         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
936         dynamic relocations for protected symbols in shared objects.
937
938 2012-03-13  Ian Lance Taylor  <iant@google.com>
939
940         * resolve.cc (Symbol_table::resolve): When merging common symbols,
941         keep the larger alignment.
942
943 2012-03-12  Cary Coutant  <ccoutant@google.com>
944
945         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
946         handling of DW_LNE_define_file.
947
948 2012-03-12  Cary Coutant  <ccoutant@google.com>
949
950         * reduced_debug_output.cc
951         (Output_reduced_debug_info_section::get_die_end): Add new FORM
952         codes to switch.
953
954 2012-02-29  Cary Coutant  <ccoutant@google.com>
955
956         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
957
958 2012-02-29  Cary Coutant  <ccoutant@google.com>
959
960         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
961         Call Object::decompressed_section_contents.
962         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
963         New dtor.
964         (Sized_dwarf_line_info::buffer_start_): New data member.
965         * merge.cc (Output_merge_data::do_add_input_section): Call
966         Object::decompressed_section_contents.
967         (Output_merge_string::do_add_input_section): Likewise.
968         * object.cc (need_decompressed_section): New function.
969         (build_compressed_section_map): Decompress sections needed later.
970         (Sized_relobj_file::do_decompressed_section_contents): New function.
971         (Sized_relobj_file::do_discard_decompressed_sections): New function.
972         * object.h (Object::decompressed_section_contents): New function.
973         (Object::discard_decompressed_sections): New function.
974         (Object::do_decompressed_section_contents): New function.
975         (Object::do_discard_decompressed_sections): New function.
976         (Compressed_section_info): New type.
977         (Compressed_section_map): Include decompressed section contents.
978         (Sized_relobj_file::do_decompressed_section_contents): New function.
979         (Sized_relobj_file::do_discard_decompressed_sections): New function.
980
981 2012-02-16  Cary Coutant  <ccoutant@google.com>
982
983         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
984         * testsuite/Makefile.in: Regenerate.
985
986 2012-02-14  Cary Coutant  <ccoutant@google.com>
987
988         * options.cc (General_options::finalize): Disallow -pie and -static.
989
990 2012-02-03  Doug Kwan  <dougkwan@google.com>
991
992         * arm.cc (Arm_relocate_functions::abs8,
993         Arm_relocate_functions::abs16): Use
994         Bits::has_signed_unsigned_overflow32.
995         (Arm_relocate_functions::thm_abs8): Correct range of
996         overflow check.
997         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
998         in assertions.
999
1000 2012-02-02  Doug Kwan  <dougkwan@google.com>
1001
1002         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1003         position independent outputs, not just shared objects.
1004
1005 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1006
1007         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1008         * configure: Regenerated.
1009
1010 2012-01-27  Ian Lance Taylor  <iant@google.com>
1011
1012         * reloc.h (Bits): New class with static functions, copied from
1013         namespace utils in arm.cc.
1014         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1015         instead.
1016
1017 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1018
1019         * incremental.cc (write_info_blocks): Correct relocation offset.
1020
1021 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1022
1023         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1024         (Relocate::tls_gd_to_le): Likewise.
1025
1026 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1027
1028         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1029
1030 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1031
1032         * configure.ac: Check if -mcmodel=medium works.
1033         * configure: Regenerated.
1034
1035 2012-01-24  Cary Coutant  <ccoutant@google.com>
1036
1037         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1038         definition and ...
1039         (read_unsigned_LEB_128_x): ... this new function.
1040         (read_signed_LEB_128): Replaced with inline definition and ...
1041         (read_signed_LEB_128_x): ... this new function.
1042         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1043         (read_unsigned_LEB_128): Add inline definition.
1044         (read_signed_LEB_128_x): New function.
1045         (read_signed_LEB_128): Add inline definition.
1046         * testsuite/Makefile.am (leb128_unittest): New unit test.
1047         * testsuite/Makefile.in: Regenerate.
1048         * testsuite/leb128_unittest.cc: New unit test.
1049
1050 2012-01-23  Ian Lance Taylor  <iant@google.com>
1051
1052         PR gold/13617
1053         * i386.cc (Target_i386::do_code_fill): When using a jmp
1054         instruction, pad with nop instructions.
1055         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1056
1057 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1058
1059         * x86_64.cc (gc_process_relocs): Add typename on types used in
1060         template.
1061         (scan_relocs): Likewise.
1062         (relocate_section): Likewise.
1063         (apply_relocation): Likewise.
1064
1065 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1066
1067         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1068         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1069         under x32.
1070
1071 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1072
1073         * x86_64.cc: Initial support for x32.
1074
1075 2012-01-03  Cary Coutant  <ccoutant@google.com>
1076
1077         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1078         Use abstract base class for GOT.
1079         * gold/output.h (class Output_data_got_base): New abstract base class.
1080         (class Output_data_got): Derive from new base class, adjust ctors.
1081         (Output_data_got::reserve_slot): Make virtual; rename to
1082         do_reserve_slot; Adjust callers.
1083         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1084         pointer to abstract base class.
1085         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1086
1087 2011-12-18  Ian Lance Taylor  <iant@google.com>
1088
1089         * object.h (Relobj::local_symbol_value): New function.
1090         (Relobj::local_plt_offset): New function.
1091         (Relobj::local_has_got_offset): New function.
1092         (Relobj::local_got_offset): New function.
1093         (Relobj::set_local_got_offset): New function.
1094         (Relobj::do_local_symbol_value): New pure virtual function.
1095         (Relobj::do_local_plt_offset): Likewise.
1096         (Relobj::do_local_has_got_offset): Likewise.
1097         (Relobj::do_local_got_offset): Likewise.
1098         (Relobj::do_set_local_got_offset): Likewise.
1099         (Sized_relobj::do_local_has_got_offset): Rename from
1100         local_has_got_offset.
1101         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1102         (Sized_relobj::do_set_local_got_offset): Rename from
1103         set_local_got_offset.
1104         (Sized_relobj_file::do_local_plt_offset): Rename from
1105         local_plt_offset.
1106         (Sized_relobj_file::do_local_symbol_value): New function.
1107         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1108         local_plt_offset.
1109         * output.cc (Output_data_got::Got_entry::write): Change object to
1110         Relobj.  Use local_symbol_value.
1111         (Output_data_got::add_global_with_rel): Change rel_dyn to
1112         Output_data_reloc_generic*.  Use add_global_generic.
1113         (Output_data_got::add_global_with_rela): Remove.  Change all
1114         callers to use add_global_with_rel.
1115         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1116         Output_data_reloc_generic*.  Use add_global_generic.
1117         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1118         callers to use add_global_pair_with_rel.
1119         (Output_data_got::add_local): Change object to Relobj*.
1120         (Output_data_got::add_local_plt): Likewise.
1121         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1122         change rel_dyn to Output_data_reloc_generic*.  Use
1123         add_local_generic.
1124         (Output_data_got::add_local_with_rela): Remove.  Change all
1125         callers to use all_local_with_rel.
1126         (Output_data_got::add_local_pair_with_rel): Change object to
1127         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1128         add_output_section_generic.
1129         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1130         callers to use add_local_pair_with_rel.
1131         (Output_data_got::reserve_local): Change object to Relobj*.
1132         * output.h: (class Output_data_reloc_generic): Add pure virtual
1133         declarations for add_global_generic, add_local_generic,
1134         add_output_section_generic.
1135         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1136         functions for Output_data_reloc_generic.  Update declarations for
1137         changes listed in output.cc.
1138         (class Output_data_got): Change template parameter to got_size.
1139         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1140         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1141         function.
1142         (Sized_relobj_incr::do_local_plt_offset): New function.
1143         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1144         add_global_generic.
1145
1146 2011-12-17  Cary Coutant  <ccoutant@google.com>
1147
1148         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1149         * resolve.cc (Symbol_table::resolve): Likewise.
1150         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1151         arrays.
1152         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1153
1154 2011-12-16  Ian Lance Taylor  <iant@google.com>
1155
1156         * output.h (Output_data_reloc_generic::add): Only call
1157         add_dynamic_reloc if this is a dynamic reloc section.
1158
1159 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1160
1161         PR gold/13505
1162         * target-reloc.h (apply_relocation): Replace <64, false> with
1163         <size, big_endian>.
1164
1165 2011-11-25  Nick Clifton  <nickc@redhat.com>
1166
1167         * po/it.po: New Italian translation.
1168
1169 2011-11-17  Sterling Augustine  <saugustine@google.com>
1170
1171         * script.cc (script_include_directive): Implement.
1172         (read_script_file): New local variables name and search_path. Update
1173         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1174         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1175         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1176
1177 2011-11-11  Sterling Augustine  <saugustine@google.com>
1178
1179         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1180         (file_or_sections_cmd): Likewise.
1181
1182 2011-11-11  Doug Kwan  <dougkwan@google.com>
1183
1184         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1185         if --just-symbols is given.
1186
1187 2011-11-10  Doug Kwan  <dougkwan@google.com>
1188
1189         PR gold/13362
1190         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1191         when processing data relocs.
1192         * reloc.h (Relocate_functions::rel_unaligned): New method.
1193         (Relocate_functions::pcrel_unaligned): Ditto.
1194         (Relocate_functions::rel32_unaligned): Ditto.
1195         (Relocate_functions::pcrel32_unaligned): Ditto.
1196
1197 2011-11-09  Doug Kwan  <dougkwan@google.com>
1198
1199         PR gold/13362
1200         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1201         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1202         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1203         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1204         (Relocate_functions::rel_unaligned): New.
1205         (Relocate_functions::rel32_unaligned): New.
1206         * target-reloc.h (relocate_for_relocatable): Add code to handle
1207         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1208         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1209         arm_unaligned_reloc_r): New targets.
1210         * testsuite/Makefile.in: Regenerate.
1211         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1212         linking.
1213
1214 2011-11-02  Ian Lance Taylor  <iant@google.com>
1215
1216         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1217         NATIVE_LINKER.
1218         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1219         * options.cc (General_options::finalize): Use library search path
1220         from configure script if specified.  If not native and no sysroot,
1221         only search TOOLLIBDIR.
1222         * options.h (Search_directory::Search_directory): Change name to
1223         const std::string&.
1224         (General_options::add_to_library_path_with_sysroot): Change arg to
1225         const std::string&.
1226         * configure, Makefile.in, config.in: Rebuild.
1227
1228 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1229
1230         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1231         we are working around the ARM1176 Erratum.
1232         * options.h (General_options::fix_arm1176): Add option.
1233         * testsuite/Makefile.am: Add testcases, and keep current ones
1234         working.
1235         * testsuite/Makefile.in: Regenerate.
1236         * testsuite/arm_fix_1176.s: New file.
1237         * testsuite/arm_fix_1176.sh: Likewise.
1238
1239 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1240
1241         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1242         may_use_blx_.
1243         (Target_arm::may_use_blx): Remove method.
1244         (Target_arm::set_may_use_blx): Likewise.
1245         (Target_arm::may_use_v4t_interworking): New method.
1246         (Target_arm::may_use_v5t_interworking): Likewise.
1247         (Target_arm::may_use_blx_): Remove member variable.
1248         (Arm_relocate_functions::arm_branch_common): Check for v5T
1249         interworking.
1250         (Arm_relocate_functions::thumb_branch_common): Likewise.
1251         (Reloc_stub::stub_type_for_reloc): Likewise.
1252         (Target_arm::do_finalize_sections): Correct interworking checks.
1253         * testsuite/Makefile.am: Add new tests.
1254         * testsuite/Makefile.in: Regenerate.
1255         * testsuite/arm_farcall_arm_arm.s: New test.
1256         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1257         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1258         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1259         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1260         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1261         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1262         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1263
1264 2011-10-31  Cary Coutant  <ccoutant@google.com>
1265
1266         PR gold/13023
1267         * expression.cc (Expression::eval_with_dot): Add
1268         is_section_dot_assignment parameter.
1269         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1270         absolute and assigning to dot within a section.
1271         * script-sections.cc
1272         (Output_section_element_assignment::set_section_addresses): Pass
1273         dot_section to set_if_absolute.
1274         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1275         as is_section_dot_assignment flag to eval_with_dot.
1276         (Output_section_element_dot_assignment::set_section_addresses):
1277         Likewise.
1278         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1279         parameter.  Also set value if relative to dot_section; set the
1280         symbol's output_section.
1281         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1282         parameter.  Adjust all callers.
1283         (Expression::eval_maybe_dot): Likewise.
1284         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1285         Adjust all callers.
1286         * testsuite/script_test_2.t: Test assignment of an absolute value
1287         to dot within an output section element.
1288
1289 2011-10-31  Cary Coutant  <ccoutant@google.com>
1290
1291         * options.h (class General_options): Add --[no-]gnu-unique options.
1292         * symtab.cc (Symbol_table::sized_write_globals): Convert
1293         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1294
1295 2011-10-31  Cary Coutant  <ccoutant@google.com>
1296
1297         PR gold/13359
1298         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1299         unnecessary assertion.
1300         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1301
1302 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1303
1304         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1305         gc_mark_symbol.
1306         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1307         gc_mark_symbol.
1308         Change to just keep the section associated with symbol.
1309         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1310         they are externally visible and --export-dynamic is turned on.
1311         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1312
1313 2011-10-19  Ian Lance Taylor  <iant@google.com>
1314
1315         PR gold/13163
1316         * script-sections.cc
1317         (Output_section_element_dot_assignment::needs_output_section): New
1318         function.
1319
1320 2011-10-19  Ian Lance Taylor  <iant@google.com>
1321
1322         PR gold/13204
1323         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1324         --section-start option was seen.
1325         * options.h (General_options::any_section_start): New function.
1326
1327 2011-10-18  David S. Miller  <davem@davemloft.net>
1328
1329         PR binutils/13301
1330         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1331         member to track relocation locations that have moved during TLS
1332         reloc optimizations.
1333         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1334         (Target_sparc::Relocate::relocate): Adjust view down by 4
1335         bytes if it matches reloc_adjust_addr_.
1336         (Target_sparc::Relocate::relocate_tls): Always move the
1337         __tls_get_addr call delay slot instruction forward 4 bytes when
1338         performing relaxation.
1339
1340 2011-10-18  Cary Coutant  <ccoutant@google.com>
1341
1342         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1343         (Output_file::map_no_anonymous): Check for non-zero
1344         return code from posix_fallocate.
1345
1346 2011-10-17  Cary Coutant  <ccoutant@google.com>
1347
1348         PR gold/13245
1349         * plugin.cc (is_visible_from_outside): Check for symbols
1350         referenced from dynamic objects.
1351         * resolve.cc (Symbol_table::resolve): Don't count references
1352         from dynamic objects as references from real ELF files.
1353         * testsuite/plugin_test_2.sh: Adjust expected result.
1354
1355 2011-10-17  Cary Coutant  <ccoutant@google.com>
1356
1357         * gold.cc: Include timer.h.
1358         (queue_middle_tasks): Stamp time.
1359         (queue_final_tasks): Likewise.
1360         * main.cc (main): Store timer in parameters.  Print timers
1361         for each pass.
1362         * parameters.cc (Parameters::Parameters): Initialize timer_.
1363         (Parameters::set_timer): New function.
1364         (set_parameters_timer): New function.
1365         * parameters.h (Parameters::set_timer): New function.
1366         (Parameters::timer): New function.
1367         (Parameters::timer_): New data member.
1368         (set_parameters_timer): New function.
1369         * timer.cc (Timer::stamp): New function.
1370         (Timer::get_pass_time): New function.
1371         * timer.h (Timer::stamp): New function.
1372         (Timer::get_pass_time): New function.
1373         (Timer::pass_times_): New data member.
1374
1375 2011-10-17  Cary Coutant  <ccoutant@google.com>
1376
1377         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1378         task for members of lib groups.
1379
1380 2011-10-17  Cary Coutant  <ccoutant@google.com>
1381
1382         PR gold/13288
1383         * fileread.cc (File_read::find_view): Add assert.
1384         (File_read::make_view): Move bounds check (replace with assert)...
1385         (File_read::find_or_make_view): ... to here.
1386
1387 2011-10-12  Cary Coutant  <ccoutant@google.com>
1388
1389         * output.cc (Output_file::open_base_file): Handle case where
1390         ::read returns less than requested size.
1391
1392 2011-10-10  Cary Coutant  <ccoutant@google.com>
1393
1394         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1395         Initialize defined_count_.
1396         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1397         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1398         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1399         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1400         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1401         * incremental.h (Sized_relobj_incr::defined_count_): New data
1402         member.
1403         (Sized_incr_dynobj::defined_count_): New data member.
1404         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1405         Return zeroes instead of internal error.
1406
1407 2011-10-10  Cary Coutant  <ccoutant@google.com>
1408
1409         PR gold/13249
1410         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1411         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1412         * output.h (class Output_reloc): Add use_plt_offset flag.
1413         (Output_reloc::type_): Adjust size of bit field.
1414         (Output_reloc::use_plt_offset_): New bit field.
1415         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1416         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1417         flag.  Adjust all callers.
1418         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1419         creating RELATIVE relocations.
1420
1421 2011-10-10  Nick Clifton  <nickc@redhat.com>
1422
1423         * po/es.po: Updated Spanish translation.
1424         * po/fi.po: Updated Finnish translation.
1425
1426 2011-10-03   Diego Novillo  <dnovillo@google.com>
1427
1428         * options.cc (parse_uint): Fix dereference of RETVAL.
1429
1430 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1431
1432         * layout.h (section_order_map_): New member.
1433         (get_section_order_map): New member function.
1434         * output.cc (Output_section::add_input_section): Check for patterns
1435         only when --section-ordering-file is specified.
1436         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1437         output_sections have been formed.
1438         * layout.cc (Layout_Layout): Initialize section_order_map_.
1439         * plugin.cc (update_section_order): Store order in order_map. Do not
1440         update the order.
1441         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1442         * testsuite/Makefile.in: Regenerate.
1443         * testsuite/plugin_section_order.c: New file.
1444         * testsuite/plugin_final_layout.cc: New file.
1445         * testsuite/plugin_final_layout.sh: New file.
1446
1447 2011-09-29  Cary Coutant  <ccoutant@google.com>
1448
1449         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1450         Check for NULL.
1451         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1452         symbols during incremental update.
1453         (Symbol_table::add_from_dynobj): Likewise.
1454
1455 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1456             Ian Lance Taylor  <iant@google.com>
1457
1458         * symtab.cc (Symbol_table::define_special_symbol): Always
1459         canonicalize version string.
1460
1461 2011-09-26  Cary Coutant  <ccoutant@google.com>
1462
1463         * gold.cc (queue_initial_tasks): Move option checks ...
1464         * options.cc (General_options::finalize): ... to here. Disable
1465         some options; make others fatal.
1466
1467 2011-09-26  Cary Coutant  <ccoutant@google.com>
1468
1469         gcc PR lto/47247
1470         * plugin.cc (get_symbols_v2): New function.
1471         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1472         (is_referenced_from_outside): New function.
1473         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1474         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1475         (get_symbols): Pass version parameter.
1476         (get_symbols_v2): New function.
1477         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1478         parameter.
1479         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1480         (onload): Add LDPT_GET_SYMBOLS_V2.
1481         (all_symbols_read_hook): Use get_symbols_v2; check for
1482         LDPR_PREVAILING_DEF_IRONLY_EXP.
1483         * testsuite/plugin_test_3.sh: Update expected results.
1484
1485 2011-09-23  Simon Baldwin  <simonb@google.com>
1486
1487         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1488         configuration options.
1489         * configure: Regenerate.
1490         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1491         * Makefile.in: Regenerate.
1492         * testsuite/Makefile.in: Regenerate.
1493
1494 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1495
1496         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1497
1498 2011-09-19  Cary Coutant  <ccoutant@google.com>
1499
1500         * incremental.cc (can_incremental_update): Fix typo in comment.
1501         * incremental.h (can_incremental_update): Likewise.
1502
1503 2011-09-18  Cary Coutant  <ccoutant@google.com>
1504
1505         * incremental.cc (can_incremental_update): New function.
1506         * incremental.h (can_incremental_update): New function.
1507         * layout.cc (Layout::init_fixed_output_section): Call it.
1508         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1509         * object.cc (Sized_relobj_file::do_layout): Call
1510         can_incremental_update.
1511
1512 2011-09-13  Cary Coutant  <ccoutant@google.com>
1513
1514         * configure.ac: Check for glibc support for gnu_indirect_function
1515         support with static linking, setting automake conditional
1516         IFUNC_STATIC.
1517         * Makefile.in: Regenerate.
1518         * configure: Regenerate.
1519
1520         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1521         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1522         for IFUNC_STATIC.
1523         * testsuite/Makefile.in: Regenerate.
1524
1525 2011-09-13  Cary Coutant  <ccoutant@google.com>
1526
1527         * incremental.cc (Sized_relobj_incr::do_layout): Call
1528         report_comdat_group for kept comdat sections.
1529         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1530         * testsuite/Makefile.in: Regenerate.
1531         * testsuite/incr_comdat_test_1.cc: New source file.
1532         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1533         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1534         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1535
1536 2011-09-13  Ian Lance Taylor  <iant@google.com>
1537
1538         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1539         variable external_symbols_offset.
1540
1541 2011-09-12  Ian Lance Taylor  <iant@google.com>
1542
1543         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1544         triggered if object has no symbols.
1545
1546 2011-09-09  David S. Miller  <davem@davemloft.net>
1547
1548         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1549         (Output_fill_debug_line::do_write): Likewise.
1550
1551 2011-08-29  Cary Coutant  <ccoutant@google.com>
1552
1553         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1554         casts to match formatting specs.
1555         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1556
1557 2011-08-26  Cary Coutant  <ccoutant@google.com>
1558
1559         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1560         remaining hole size when allocating.
1561         (Layout::make_output_section): Set fill methods for debug sections.
1562         * layout.h (Free_list::Free_list_node): Move from private to
1563         public.
1564         (Free_list::set_min_hole_size): New function.
1565         (Free_list::begin, Free_list::end): New functions.
1566         (Free_list::min_hole_): New data member.
1567         * output.cc: Include dwarf.h.
1568         (Output_fill_debug_info::do_minimum_hole_size): New function.
1569         (Output_fill_debug_info::do_write): New function.
1570         (Output_fill_debug_line::do_minimum_hole_size): New function.
1571         (Output_fill_debug_line::do_write): New function.
1572         (Output_section::Output_section): Initialize new data member.
1573         (Output_section::set_final_data_size): Ensure patch space is larger
1574         than minimum hole size.
1575         (Output_section::do_write): Fill holes in debug sections.
1576         * output.h (Output_fill): New class.
1577         (Output_fill_debug_info): New class.
1578         (Output_fill_debug_line): New class.
1579         (Output_section::set_free_space_fill): New function.
1580         (Output_section::free_space_fill_): New data member.
1581         * testsuite/Makefile.am (incremental_test_3): Add
1582         --incremental-patch option.
1583         (incremental_test_4): Likewise.
1584         (incremental_test_5): Likewise.
1585         (incremental_test_6): Likewise.
1586         (incremental_copy_test): Likewise.
1587         (incremental_common_test_1): Likewise.
1588         * testsuite/Makefile.in: Regenerate.
1589
1590 2011-08-26  Nick Clifton  <nickc@redhat.com>
1591
1592         * po/es.po: Updated Spanish translation.
1593
1594 2011-08-01  Cary Coutant  <ccoutant@google.com>
1595
1596         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1597         * gold/testsuite/Makefile.in: Regenerate.
1598         * gold/testsuite/justsyms_exec.c: New source file.
1599         * gold/testsuite/justsyms_lib.c: New source file.
1600
1601 2011-08-01  Cary Coutant  <ccoutant@google.com>
1602
1603         * layout.cc (Layout::set_segment_offsets): Don't realign text
1604         segment if -Ttext was specified.
1605         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1606         file type.
1607         * object.h (Sized_relobj_file::e_type): New function.
1608         (Sized_relobj_file::e_type_): New data member.
1609         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1610         base address for ET_EXEC files.
1611         * target.cc (Target::do_make_elf_object_implementation): Allow
1612         ET_EXEC files with --just-symbols option.
1613
1614 2011-07-28  Cary Coutant  <ccoutant@google.com>
1615
1616         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1617         Add thread_number parameter.
1618         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1619         * workqueue-threads.cc
1620         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1621         current thread if its thread number is greater than desired thread
1622         count.
1623         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1624         Add thread_number parameter.
1625         (Workqueue::should_cancel_thread): Likewise.
1626         (Workqueue::find_runnable_or_wait): Pass thread_number to
1627         should_cancel_thread.
1628         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1629         parameter.
1630
1631 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1632
1633         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1634         only after checking if it cannot be forced local.
1635         * symtab.h (is_externally_visible): Check if the symbol is not forced
1636         local.
1637
1638 2011-07-15  Ian Lance Taylor  <iant@google.com>
1639
1640         * options.h (class General_options): Add --print-output-format.
1641         Move -EL next to -EB, for  better --help output.
1642         * target-select.cc: Include <cstdio>, "options.h", and
1643         "parameters.h".
1644         (Target_selector::do_target_bfd_name): New function.
1645         (print_output_format): New function.
1646         * target-select.h (class Target_selector): Update declarations.
1647         (Target_selector::target_bfd_name): New function.
1648         (print_output_format): Declare.
1649         * main.cc: Include "target-select.h".
1650         (main): Handle --print-output-format.
1651         * gold.cc: Include "target-select.h".
1652         (queue_initial_tasks): Handle --print-output-format when there are
1653         no input files.
1654         * parameters.cc (parameters_force_valid_target): Give a better
1655         error message if -EB/-EL does not match target.
1656         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1657         function.
1658
1659 2011-07-15  Ian Lance Taylor  <iant@google.com>
1660
1661         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1662         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1663         (Output_data_plt_i386::do_write): Write address of .dynamic
1664         section to first entry in .got.plt section.
1665         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1666         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1667         Initialize layout_.
1668         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1669         section to first entry in .got.plt section.
1670         * layout.h (Layout::dynamic_section): New function.
1671
1672 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1673
1674         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1675         to claim_file call.
1676         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1677         input_section_position_, and input_section_glob_.
1678         (read_layout_from_file): Call function section_ordering_specified.
1679         * layout.h (is_section_ordering_specified): New function.
1680         (section_ordering_specified): New function.
1681         (section_ordering_specified_): New boolean member.
1682         * main.cc(main): Call load_plugins after layout object is defined.
1683         * output.cc (Output_section::add_input_section): Use
1684         function section_ordering_specified to check if section ordering is
1685         needed.
1686         * output.cc (Output_section::add_relaxed_input_section): Use
1687         function section_ordering_specified to check if section ordering is
1688         needed.
1689         (Output_section::update_section_layout): New function.
1690         (Output_section::sort_attached_input_sections): Check if input section
1691         must be reordered.
1692         * output.h (Output_section::update_section_layout): New function.
1693         * plugin.cc (get_section_count): New function.
1694         (get_section_type): New function.
1695         (get_section_name): New function.
1696         (get_section_contents): New function.
1697         (update_section_order): New function.
1698         (allow_section_ordering): New function.
1699         (Plugin::load): Add the new interfaces to the transfer vector.
1700         (Plugin_manager::load_plugins): New parameter.
1701         (Plugin_manager::all_symbols_read): New parameter.
1702         (Plugin_manager::claim_file): New parameter. Save the elf object for
1703         unclaimed objects.
1704         (Plugin_manager::get_elf_object): New function.
1705         (Plugin_manager::get_view): Change to directly use the bool to check
1706         if get_view is called from claim_file_hook.
1707         * plugin.h (input_objects): New function
1708         (Plugin__manager::load_plugins): New parameter.
1709         (Plugin_manager::claim_file): New parameter.
1710         (Plugin_manager::get_elf_object): New function.
1711         (Plugin_manager::in_claim_file_handler): New function.
1712         (Plugin_manager::in_claim_file_handler_): New member.
1713         (layout): New function.
1714         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1715         handler with an extra parameter. Make the elf object before calling
1716         claim_file handler.
1717         * testsuite/plugin_test.c (get_section_count): New function pointer.
1718         (get_section_type): New function pointer.
1719         (get_section_name): New function pointer.
1720         (get_section_contents): New function pointer.
1721         (update_section_order): New function pointer.
1722         (allow_section_ordering): New function pointer.
1723         (onload): Check if the new interfaces exist.
1724
1725 2011-07-13  Ian Lance Taylor  <iant@google.com>
1726
1727         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1728         relro section.
1729         * x86_64.cc (Target_x86_64::got_section): Likewise.
1730         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1731         (relro_now_test_SOURCES): New variable.
1732         (relro_now_test_DEPENDENCIES): New variable.
1733         (relro_now_test_LDFLAGS): New variable.
1734         (relro_now_test_LDADD): New variable.
1735         (relro_now_test.so): New target.
1736         * testsuite/Makefile.in: Rebuild.
1737
1738 2011-07-12  Ian Lance Taylor  <iant@google.com>
1739
1740         PR gold/12980
1741         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1742         GLOB_DAT relocation rather than a RELATIVE relocation for a
1743         protected symbol when creating a shared library.
1744         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1745         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1746         * testsuite/protected_main_1.cc (main): Test that protected
1747         function has same address.
1748
1749 2011-07-11  Ian Lance Taylor  <iant@google.com>
1750
1751         PR gold/12979
1752         * options.h (class General_options): Add -Bgroup.
1753         * options.cc (General_options::finalize): If -Bgroup is set,
1754         default to --unresolved-symbols=report-all.
1755         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1756         * target-reloc.h (issue_undefined_symbol_error): Handle
1757         --unresolved-symbols=report-all.
1758
1759 2011-07-08  Ian Lance Taylor  <iant@google.com>
1760
1761         PR gold/11985
1762         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1763         if linker script discards key sections.
1764         (Layout::create_dynamic_symtab): Likewise.
1765         (Layout::assign_local_dynsym_offsets): Likewise.
1766         (Layout::sized_create_version_sections): Likewise.
1767         (Layout::create_interp): Likewise.
1768         (Layout::finish_dynamic_section): Likewise.
1769         (Layout::set_dynamic_symbol_size): Likewise.
1770
1771 2011-07-08  Ian Lance Taylor  <iant@google.com>
1772
1773         PR gold/12386
1774         * options.h (class General_options): Add --unresolved-symbols.
1775         * target-reloc.h (issue_undefined_symbol_error): Check
1776         --unresolved-symbols.  Add comments.
1777
1778 2011-07-08  Ian Lance Taylor  <iant@google.com>
1779
1780         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1781         expression more complex.
1782
1783 2011-07-08  Ian Lance Taylor  <iant@google.com>
1784
1785         PR gold/11317
1786         * target-reloc.h (issue_undefined_symbol_error): New inline
1787         function, broken out of relocate_section.
1788         (relocate_section): Call issue_undefined_symbol_error.
1789         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1790         there is no TLS segment if we are about to issue an undefined
1791         symbol error.
1792         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1793
1794 2011-07-08  Ian Lance Taylor  <iant@google.com>
1795
1796         PR gold/12279
1797         * resolve.cc (Symbol_table::should_override): Add fromtype
1798         parameter.  Change all callers.  Give error when linking together
1799         TLS and non-TLS symbol.
1800         (Symbol_table::should_override_with_special): Add fromtype
1801         parameter.  Change all callers.
1802         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1803         there is no TLS segment if we have reported some errors.
1804         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1805
1806 2011-07-08  Ian Lance Taylor  <iant@google.com>
1807
1808         PR gold/12372
1809         * target.h (Target::plt_address_for_global): New function.
1810         (Target::plt_address_for_local): New function.
1811         (Target::plt_section_for_global): Remove.
1812         (Target::plt_section_for_local): Remove.
1813         (Target::do_plt_address_for_global): New virtual function.
1814         (Target::do_plt_address_for_local): New virtual function.
1815         (Target::do_plt_section_for_global): Remove.
1816         (Target::do_plt_section_for_local): Remove.
1817         (Target::register_global_plt_entry): Add Symbol_table and Layout
1818         parameters.
1819         * output.cc (Output_data_got::Got_entry::write): Use
1820         plt_address_for_global and plt_address_for_local.
1821         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1822         address of output section.
1823         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1824         got_irelative_, and irelative_count_ fields.  Update
1825         declarations.
1826         (Output_data_plt_i386::has_irelative_section): New function.
1827         (Output_data_plt_i386::entry_count): Add irelative_count_.
1828         (Output_data_plt_i386::set_final_data_size): Likewise.
1829         (class Target_i386): Add got_irelative_ and rel_irelative_
1830         fields.  Update declarations.
1831         (Target_i386::Target_i386): Initialize new fields.
1832         (Target_i386::do_plt_address_for_global): New function replacing
1833         do_plt_section_for_global.
1834         (Target_i386::do_plt_address_for_local): New function replacing
1835         do_plt_section_for_local.
1836         (Target_i386::got_section): Create got_irelative_.
1837         (Target_i386::rel_irelative_section): New function.
1838         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1839         fields.  Don't define __rel_iplt_{start,end}.
1840         (Output_data_plt_i386::add_entry): Add symtab and layout
1841         parameters.  Change all callers.  Use different PLT and GOT for
1842         IFUNC symbols.
1843         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1844         layout parameters.  Change all callers.  Use different PLT and
1845         GOT.
1846         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1847         (Output_data_plt_i386::rel_irelative): New function.
1848         (Output_data_plt_i386::address_for_global): New function.
1849         (Output_data_plt_i386::address_for_local): New function.
1850         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1851         IRELATIVE GOT when changing IFUNC GOT entries.
1852         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1853         reloc.
1854         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1855         if we didn't create an IRELATIVE GOT.
1856         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1857         plt_address_for_local.
1858         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1859         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1860         got_irelative_, and irelative_count_ fields.  Update
1861         declarations.
1862         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1863         Initialize new fields.  Remove symtab parameter.  Change all
1864         callers.
1865         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1866         irelative_count_.
1867         (Output_data_plt_x86_64::has_irelative_section): New function.
1868         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1869         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1870         fields.  Update declarations.
1871         (Target_x86_64::Target_x86_64): Initialize new fields.
1872         (Target_x86_64::do_plt_address_for_global): New function replacing
1873         do_plt_section_for_global.
1874         (Target_x86_64::do_plt_address_for_local): New function replacing
1875         do_plt_section_for_local.
1876         (Target_x86_64::got_section): Create got_irelative_.
1877         (Target_x86_64::rela_irelative_section): New function.
1878         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1879         all callers.  Don't create __rel_iplt_{start,end}.
1880         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1881         parameters.  Change all callers.  Use different PLT and GOT for
1882         IFUNC symbols.
1883         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1884         layout parameters.  Change all callers.  Use different PLT and
1885         GOT.
1886         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1887         parameters.  Change all callers.  Use different PLT and GOT for
1888         IFUNC symbols.
1889         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1890         (Output_data_plt_x86_64::rela_irelative): New function.
1891         (Output_data_plt_x86_64::address_for_global): New function.
1892         (Output_data_plt_x86_64::address_for_local): New function.
1893         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1894         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1895         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1896         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1897         parameters.
1898         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1899         reloc.
1900         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1901         symbols if we didn't create an IRELATIVE GOT.
1902         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1903         plt_address_for_local.
1904         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1905         * testsuite/ifuncvar1.c: New test file.
1906         * testsuite/ifuncvar2.c: New test file.
1907         * testsuite/ifuncvar3.c: New test file.
1908         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1909         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1910         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1911         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1912         * testsuite/Makefile.in: Rebuild.
1913
1914 2011-07-07  Cary Coutant  <ccoutant@google.com>
1915
1916         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1917         (two_file_test_1_ndebug.o): Likewise.
1918         (two_file_test_1b_ndebug.o): Likewise.
1919         (two_file_test_2_ndebug.o): Likewise.
1920         (two_file_test_main_ndebug.o): Likewise.
1921         (incremental_test_2): Link with no-debug versions.
1922
1923 2011-07-06  Cary Coutant  <ccoutant@google.com>
1924
1925         * gold/incremental.cc
1926         (Output_section_incremental_inputs::write_info_blocks): Check for
1927         hidden and internal symbols.
1928
1929 2011-07-06  Cary Coutant  <ccoutant@google.com>
1930
1931         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1932         Check disposition for startup file.
1933         (Incremental_inputs::report_command_line): Ignore
1934         --incremental-startup-unchanged option.
1935         * options.cc (General_options::parse_incremental_startup_unchanged):
1936         New function.
1937         (General_options::General_options): Initialize new data member.
1938         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1939         (General_options): Add --incremental-startup-unchanged option.
1940         (General_options::incremental_startup_disposition): New function.
1941         (General_options::incremental_startup_disposition_): New data member.
1942
1943 2011-07-06  Cary Coutant  <ccoutant@google.com>
1944
1945         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1946         input file index to Script_info ctor.
1947         (Sized_incremental_binary::do_file_has_changed): Find the
1948         command-line argument for files named in scripts.
1949         * incremental.h (Script_info::Script_info): New ctor
1950         with input file index.
1951         (Script_info::input_file_index): New function.
1952         (Script_info::input_file_index_): New data member.
1953         (Incremental_binary::get_library): Add const.
1954         (Incremental_binary::get_script_info): Add const.
1955         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1956         * testsuite/Makefile.am (incremental_test_5): New test case.
1957         (incremental_test_6): New test case.
1958         * testsuite/Makefile.in: Regenerate.
1959
1960 2011-07-06  Cary Coutant  <ccoutant@google.com>
1961
1962         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1963         debug output when command lines differ.
1964
1965 2011-07-06  Cary Coutant  <ccoutant@google.com>
1966
1967         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1968         --incremental-patch option.
1969         * layout.cc (Free_list::allocate): Extend allocation beyond original
1970         end if enabled.
1971         (Layout::make_output_section): Mark sections that should get
1972         patch space.
1973         * options.cc (parse_percent): New function.
1974         * options.h (parse_percent): New function.
1975         (DEFINE_percent): New macro.
1976         (General_options): Add --incremental-patch option.
1977         * output.cc (Output_section::Output_section): Initialize new data
1978         members.
1979         (Output_section::add_input_section): Print section name when out
1980         of patch space.
1981         (Output_section::add_output_section_data): Likewise.
1982         (Output_section::set_final_data_size): Add patch space when
1983         doing --incremental-full.
1984         (Output_section::do_reset_address_and_file_offset): Remove patch
1985         space.
1986         (Output_segment::set_section_list_addresses): Print debug output
1987         only if --incremental-update.
1988         * output.h (Output_section::set_is_patch_space_allowed): New function.
1989         (Output_section::is_patch_space_allowed_): New data member.
1990         (Output_section::patch_space_): New data member.
1991         * parameters.cc (Parameters::incremental_full): New function.
1992         * parameters.h (Parameters::incremental_full): New function
1993         * testsuite/Makefile.am (incremental_test_2): Add test for
1994         --incremental-patch option.
1995         * testsuite/Makefile.in: Regenerate.
1996         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1997         (t18): Remove function body.
1998
1999 2011-07-05  Doug Kwan  <dougkwan@google.com>
2000
2001         PR gold/12771
2002         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2003         Arm_Address type for relocation result.
2004         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2005         overflow check.
2006         (Arm_relocate_functions::abs32): Use unaligned access.
2007         (Arm_relocate_functions::rel32): Ditto.
2008         (Arm_relocate_functions::prel31): Ditto.
2009         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2010         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2011         static data relocations.
2012         * testsuite/Makefile.in: Regnerate.
2013         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2014
2015 2011-07-05  Ian Lance Taylor  <iant@google.com>
2016
2017         PR gold/12392
2018         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2019         symbols if necessary.
2020         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2021
2022 2011-07-05  Ian Lance Taylor  <iant@google.com>
2023
2024         PR gold/12952
2025         * resolve.cc (Symbol::override_base_with_special): Simply override
2026         version with special symbol version, ignoring previous version.
2027
2028 2011-07-05  Ian Lance Taylor  <iant@google.com>
2029
2030         * object.cc (Sized_relobj_file::include_section_group): Add
2031         information to comment about signature location.
2032
2033 2011-07-02  Ian Lance Taylor  <iant@google.com>
2034
2035         PR gold/12957
2036         * options.h (class General_options): Add -f and -F.
2037         * options.cc (General_options::finalize): Fatal error if -f/-F
2038         are used without -shared.
2039         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2040
2041 2011-07-02  Ian Lance Taylor  <iant@google.com>
2042
2043         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2044
2045 2011-07-01  Ian Lance Taylor  <iant@google.com>
2046
2047         PR gold/12525
2048         PR gold/12952
2049         * resolve.cc (Symbol::override_base_with_special): Don't override
2050         the version if the overriding symbol has a different name.
2051         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2052         all callers.  If we give an error about an undefined version,
2053         define the base version if necessary.
2054         * dynobj.h (class Versions): Update declaration.
2055         * testsuite/weak_alias_test_5.cc: New file.
2056         * testsuite/weak_alias_test.script: New file.
2057         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2058         and versioned_alias have the right value, and call t2.
2059         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2060         weak_alias_test_5.so.
2061         (weak_alias_test_LDADD): Likewise.
2062         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2063         * testsuite/Makefile.in: Rebuild.
2064
2065 2011-07-01  Ian Lance Taylor  <iant@google.com>
2066
2067         PR gold/12525
2068         * options.h (class General_options): Support -z notext.
2069         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2070         -Wl,-z,notext.
2071         (two_file_shared_nonpic.so): Likewise.
2072         (two_file_shared_mixed.so): Likewise.
2073         (two_file_shared_mixed_1.so): Likewise.
2074         (weak_undef_lib_nonpic.so): Likewise.
2075         (alt/weak_undef_lib_nonpic.so): Likewise.
2076         (tls_test_shared_nonpic.so): Likewise.
2077         * testsuite/Makefile.in: Rebuild.
2078
2079 2011-07-01  Ian Lance Taylor  <iant@google.com>
2080
2081         PR gold/12525
2082         * configure.ac: Test whether static linking works, setting
2083         the automake conditional HAVE_STATIC.
2084         * testsuite/Makefile.am: Disable tests using -static if
2085         HAVE_STATIC is not true.
2086         * configure, testsuite/Makefile.in: Rebuild.
2087
2088 2011-07-01  Ian Lance Taylor  <iant@google.com>
2089
2090         PR gold/12525
2091         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2092         Assert if we see DW_EH_PE_indirect.
2093         * target.h (Target::ehframe_datarel_base): New function.
2094         (Target::do_ehframe_datarel_base): New target function.
2095         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2096         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2097         function.
2098
2099 2011-07-01  Ian Lance Taylor  <iant@google.com>
2100
2101         PR gold/12571
2102         * options.h (class General_options): Add
2103         --ld-generated-unwind-info.
2104         * ehframe.cc (Fde::write): Add address parameter.  Change all
2105         callers.  If associated with PLT, fill in address and size.
2106         (Cie::set_output_offset): Only add merge mapping if there is an
2107         object.
2108         (Cie::write): Add address parameter.  Change all callers.
2109         (Eh_frame::add_ehframe_for_plt): New function.
2110         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2111         input_offset_ fields into union u_, with new plt field.
2112         (Fde::Fde): Adjust for new union field.
2113         (Fde::Fde) [Output_data version]: New constructor.
2114         (Fde::add_mapping): Only add merge mapping if there is an object.
2115         (class Cie): Update declarations.
2116         (class Eh_frame): Declare add_ehframe_for_plt.
2117         * layout.cc (Layout::layout_eh_frame): Break out code into
2118         make_eh_frame_section, and call it.
2119         (Layout::make_eh_frame_section): New function.
2120         (Layout::add_eh_frame_for_plt): New function.
2121         * layout.h (class Layout): Update declarations.
2122         * merge.cc (Merge_map::add_mapping): Add assertion.
2123         * i386.cc: Include "dwarf.h".
2124         (class Output_data_plt_i386): Make first_plt_entry,
2125         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2126         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2127         and plt_eh_frame_fde.
2128         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2129         boundary.  Call add_eh_frame_for_plt if appropriate.
2130         * x86_64.cc: Include "dwarf.h".
2131         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2132         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2133         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2134         and plt_eh_frame_fde.
2135         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2136         appropriate.
2137
2138 2011-06-29  Ian Lance Taylor  <iant@google.com>
2139
2140         PR gold/12629
2141         * object.cc (Sized_relobj_file::layout_section): Change shdr
2142         parameter to be const.
2143         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2144         out of do_layout.
2145         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2146         appropriate.  Call layout_eh_frame_section.
2147         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2148         sections.
2149         * object.h (class Sized_relobj_file): Update declarations.
2150
2151 2011-06-29  Ian Lance Taylor  <iant@google.com>
2152
2153         PR gold/12652
2154         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2155         modifier.
2156         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2157
2158 2011-06-29  Ian Lance Taylor  <iant@google.com>
2159
2160         PR gold/12675
2161         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2162         SHT_X86_64_UNWIND.
2163         * layout.cc (Layout::layout_eh_frame): Likewise.
2164
2165 2011-06-29  Ian Lance Taylor  <iant@google.com>
2166
2167         PR gold/12695
2168         * layout.cc (Layout::symtab_section_shndx): New function.
2169         * layout.h (class Layout): Declare symtab_section_shndx.
2170         * output.cc (Output_section::write_header): Call it.
2171
2172 2011-06-29  Ian Lance Taylor  <iant@google.com>
2173
2174         PR gold/12818
2175         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2176         symbols which are not used in a relocation.
2177
2178 2011-06-28  Ian Lance Taylor  <iant@google.com>
2179
2180         PR gold/12898
2181         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2182         script create indistinguishable segments.
2183         (Layout::set_segment_offsets): Use stable_sort when sorting
2184         segments.  Pass this to Compare_segments constructor.
2185         * layout.h (class Layout): Make segment_precedes non-static.
2186         (class Compare_segments): Change from struct to class.  Add
2187         layout_ field.  Add constructor.
2188         * script-sections.cc
2189         (Script_sections::attach_sections_using_phdrs_clause): Rename
2190         local orphan to is_orphan.  Don't report failure to put empty
2191         section in segment.  On attachment failure, report name of
2192         section, and attach to first PT_LOAD segment.
2193
2194 2011-06-28  Ian Lance Taylor  <iant@google.com>
2195
2196         PR gold/12934
2197         * target-select.cc (Target_selector::Target_selector): Add
2198         emulation parameter.  Change all callers.
2199         (select_target_by_bfd_name): Rename from select_target_by_name.
2200         Change all callers.
2201         (select_target_by_emulation): New function.
2202         (supported_emulation_names): New function.
2203         * target-select.h (class Target_selector): Add emulation_ field.
2204         Update declarations.
2205         (Target_selector::recognize_by_bfd_name): Rename from
2206         recognize_by_name.  Change all callers.
2207         (Target_selector::supported_bfd_names): Rename from
2208         supported_names.  Change all callers.
2209         (Target_selector::recognize_by_emulation): New function.
2210         (Target_selector::supported_emulations): New function.
2211         (Target_selector::emulation): New function.
2212         (Target_selector::do_recognize_by_bfd_name): Rename from
2213         do_recognize_by_name.  Change all callers.
2214         (Target_selector::do_supported_bfd_names): Rename from
2215         do_supported_names.  Change all callers.
2216         (Target_selector::do_recognize_by_emulation): New function.
2217         (Target_selector::do_supported_emulations): New function.
2218         (select_target_by_bfd_name): Change name in declaration.
2219         (select_target_by_emulation): Declare.
2220         (supported_emulation_names): Declare.
2221         * parameters.cc (parameters_force_valid_target): Try to find
2222         target based on emulation from -m option.
2223         * options.h (class General_options): Change doc string for -m.
2224         * options.cc (help): Print emulations.
2225         (General_options::parse_V): Likewise.
2226         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2227         Add emulation parameter.  Change all callers.
2228
2229 2011-06-28  Ian Lance Taylor  <iant@google.com>
2230
2231         * target.h (class Target): Add osabi_ field.
2232         (Target::osabi): New function.
2233         (Target::set_osabi): New function.
2234         (Target::Target): Initialize osabi_.
2235         (Target::do_adjust_elf_header): Make pure virtual.
2236         (Sized_target::do_adjust_elf_header): Declare.
2237         * target.cc (Sized_target::do_adjust_elf_header): New function.
2238         (class Sized_target): Instantiate all versions.
2239         * freebsd.h (class Target_freebsd): Remove.
2240         (Target_selector_freebsd::do_recognize): Call set_osabi on
2241         Target.
2242         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2243         (Target_selector_freebsd::set_osabi): Remove.
2244         * i386.cc (class Target_i386): Inherit from Sized_target rather
2245         than Target_freebsd.
2246         * x86_64.cc (class Target_x86_64): Likewise.
2247
2248 2011-06-28  Ian Lance Taylor  <iant@google.com>
2249
2250         * target.h (Target::can_check_for_function_pointers): Rewrite.
2251         Make non-virtual.
2252         (Target::can_icf_inline_merge_sections): Likewise.
2253         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2254         (Target::Target_info): Add can_icf_inline_merge_sections field.
2255         (Target::do_can_check_for_function_pointers): New virtual
2256         function.
2257         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2258         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2259         from can_check_for_function_pointers, move in file.
2260         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2261         section_may_have_icf_unsafe_poineters, move in file.
2262         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2263         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2264         Rename from can_check_for_function_pointers, move in file.
2265         (Target_i386::can_icf_inline_merge_sections): Remove.
2266         (Target_i386::i386_info): Initialize
2267         can_icf_inline_merge_sections.
2268         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2269         Initialize can_icf_inline_merge_sections.
2270         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2271         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2272         Rename from can_check_for_function_pointers, move in file.
2273         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2274         (Target_x86_64::x86_64_info): Initialize
2275         can_icf_inline_merge_sections.
2276         * testsuite/testfile.cc (Target_test::test_target_info):
2277         Likewise.
2278         * icf.cc (get_section_contents): Correct formatting.
2279
2280 2011-06-27  Ian Lance Taylor  <iant@google.com>
2281
2282         * symtab.cc (Symbol::versioned_name): New function.
2283         (Symbol_table::add_to_final_symtab): Use versioned_name when
2284         appropriate.
2285         (Symbol_table::sized_write_symbol): Likewise.
2286         * symtab.h (class Symbol): Declare versioned_name.
2287         * stringpool.h (class Stringpool_template): Add variant of add
2288         which takes a std::basic_string.
2289         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2290         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2291         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2292         (ver_test_12.o): New target.
2293         * testsuite/Makefile.in: Rebuild.
2294
2295 2011-06-27  Doug Kwan  <dougkwan@google.com>
2296
2297         * arm.cc (Arm_relocate_functions::thm_jump8,
2298         Arm_relocate_functions::thm_jump11): Use a wider signed
2299         type to compute offset.
2300         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2301         arm_thm_jump8.
2302         * testsuite/Makefile.in: Regenerate.
2303         * testsuite/arm_branch_in_range.sh: Check test results of
2304         arm_thm_jump11 and arm_thm_jump8.
2305         * testsuite/arm_thm_jump11.s: New test source file.
2306         * testsuite/arm_thm_jump11.t: New linker script.
2307         * testsuite/arm_thm_jump8.s: New test source file.
2308         * testsuite/arm_thm_jump8.t: New linker script.
2309
2310 2011-06-24  Ian Lance Taylor  <iant@google.com>
2311
2312         * layout.cc: Include "object.h".
2313         (ctors_sections_in_init_array): New static variable.
2314         (Layout::is_ctors_in_init_array): New function.
2315         (Layout::layout): Add entry to ctors_sections_in_init_array if
2316         appropriate.
2317         * layout.h (class Layout): Declare is_ctors_in_init_array.
2318         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2319         is_ctors_reverse_view is set.
2320         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2321         all callers.  Set is_ctors_reverse_view field of View_size.
2322         (Sized_relobj_file::reverse_words): New function.
2323         * object.h (Sized_relobj_file::View_size): Add
2324         is_ctors_reverse_view field.
2325         (class Sized_relobj_file): Update declarations.
2326         * testsuite/initpri3.c: New test.
2327         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2328         initpri3b.
2329         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2330         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2331         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2332         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2333         * testsuite/Makefile.in: Rebuild.
2334
2335 2011-06-24  Cary Coutant  <ccoutant@google.com>
2336
2337         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2338         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2339         (debug_msg_cdebug.err): New targets.
2340         * testsuite/Makefile.in: Regenerate.
2341         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2342         Fix checks for link with shared library.
2343
2344 2011-06-24  Doug Kwan  <dougkwan@google.com>
2345
2346         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2347         skip empty text sections.
2348         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2349
2350 2011-06-22  Ian Lance Taylor  <iant@google.com>
2351
2352         PR gold/12910
2353         * options.h (class General_options): Add --ctors-in-init-array.
2354         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2355         friends as SHT_PROGBITS for merging sections.
2356         (Layout::layout): Remove special handling of .init_array and
2357         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2358         and .dtors if ctors_in_init_array.
2359         (Layout::make_output_section): Force correct section types for
2360         .init_array and friends.  Don't sort if doing relocatable link,
2361         Don't sort .ctors and .dtors if ctors_in_init_array.
2362         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2363         (Layout::output_section_name): Add relobj parameter.  Change all
2364         callers.  Handle .ctors. and .dtors. in code rather than table.
2365         Handle .ctors and .dtors if ctors_in_init_array.
2366         (Layout::match_file_name): New function, moved from output.cc.
2367         * layout.h (class Layout): Update declarations.
2368         * output.cc: Include "layout.h".
2369         (Input_section_sort_entry::get_priority): New function.
2370         (Input_section_sort_entry::match_file_name): Just call
2371         Layout::match_file_name.
2372         (Output_section::Input_section_sort_init_fini_compare::operator()):
2373         Handle .ctors and .dtors.  Sort by explicit priority rather than
2374         by name.
2375         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2376         * testsuite/initpri2.c: New test.
2377         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2378         (check_PROGRAMS): Add initpri2.
2379         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2380         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2381         * configure, testsuite/Makefile.in: Rebuild.
2382
2383 2011-06-19  Ian Lance Taylor  <iant@google.com>
2384
2385         PR gold/12880
2386         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2387         .interp section to a PT_INTERP segment even if we have seen a
2388         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2389         clause in a linker script.
2390         (Layout::finalize): Don't create a .interp section if we've
2391         already create a PT_INTERP segment.
2392         (Layout::create_interp): Always call choose_output_section (revert
2393         patch of 2011-06-17).  Don't create PT_INTERP segment.
2394         * script-sections.cc
2395         (Script_sections::create_note_and_tls_segments): Add a .interp
2396         section to a PT_INTERP segment even if we have seen a
2397         --dynamic-linker option.
2398
2399 2011-06-18  Ian Lance Taylor  <iant@google.com>
2400
2401         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2402         merely because a non-PT_LOAD segment has a dynamic reloc.
2403
2404 2011-06-18  Ian Lance Taylor  <iant@google.com>
2405
2406         * layout.cc (Layout::finish_dynamic_section): Don't create
2407         DT_FLAGS entry if not needed.
2408
2409 2011-06-18  Ian Lance Taylor  <iant@google.com>
2410
2411         PR gold/12745
2412         * layout.cc (Layout::layout_eh_frame): Correct handling of
2413         writable .eh_frame section.
2414
2415 2011-06-17  Ian Lance Taylor  <iant@google.com>
2416
2417         PR gold/12893
2418         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2419         symbol is redefined with the exact same object and value.
2420
2421 2011-06-17  Ian Lance Taylor  <iant@google.com>
2422
2423         PR gold/12880
2424         * layout.h (class Layout): Add interp_segment_ field.
2425         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2426         (Layout::attach_allocated_section_to_segment): If making shared
2427         library, put .interp section in PT_INTERP segment.
2428         (Layout::finalize): Also call create_interp if -dynamic-linker
2429         option was used.
2430         (Layout::create_interp): Assert that there is no PT_INTERP
2431         segment.  If not using a SECTIONS clause, use make_output_section.
2432         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2433         * script-sections.cc
2434         (Script_sections::create_note_and_tls_segments): If making shared
2435         library, put .interp section in PT_INTERP segment.
2436
2437 2011-06-17  Ian Lance Taylor  <iant@google.com>
2438
2439         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2440         when making a shared library.
2441
2442 2011-06-17  Ian Lance Taylor  <iant@google.com>
2443
2444         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2445         parameter.  Change all callers.  Don't issue warning about PC32
2446         against locally defined symbol.
2447
2448 2011-06-16  Ian Lance Taylor  <iant@google.com>
2449
2450         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2451         occurs in same object.
2452
2453 2011-06-14  Alan Modra  <amodra@gmail.com>
2454
2455         * po/POTFILES.in: Regenerate.
2456
2457 2011-06-09  Ian Lance Taylor  <iant@google.com>
2458
2459         * script-sections.cc
2460         (Orphan_output_section::set_section_addresses): For a relocatable
2461         link set address to 0.
2462
2463 2011-06-09  Cary Coutant  <ccoutant@google.com>
2464
2465         PR gold/12804
2466         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2467         used with --compress-debug-sections.
2468         * gold/object.cc (Sized_relobj_file::do_layout): Report
2469         uncompressed size of compressed input sections.
2470
2471 2011-06-08  Cary Coutant  <ccoutant@google.com>
2472
2473         PR gold/12804
2474         * testsuite/two_file_test_2_v1.cc: Change initialization of
2475         v2 to keep it in .data.
2476
2477 2011-06-07  Cary Coutant  <ccoutant@google.com>
2478
2479         * common.cc (Symbol_table::do_allocate_commons_list): Call
2480         gold_fallback.
2481         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2482         (Errors::fallback): New function.
2483         (gold_fallback): New function.
2484         * errors.h (Errors::fallback): New function.
2485         * gold.cc (gold_exit): Change status parameter to enum; adjust
2486         all callers.
2487         (queue_initial_tasks): Call gold_fallback.
2488         * gold.h: Include cstdlib.
2489         (Exit_status): New enum type.
2490         (gold_exit): Change status parameter to enum.
2491         (gold_fallback): New function.
2492         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2493         (Layout::create_symtab_sections): Likewise.
2494         (Layout::create_shdrs): Likewise.
2495         * main.cc (main): Adjust call to gold_exit.
2496         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2497         (Output_data_got::add_got_entry_pair): Likewise.
2498         (Output_section::add_input_section): Likewise.
2499         (Output_section::add_output_section_data): Likewise.
2500         (Output_segment::set_section_list_addresses): Likewise.
2501         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2502
2503 2011-06-07  Cary Coutant  <ccoutant@google.com>
2504
2505         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2506         for incremental links.
2507         * output.cc (Output_segment::set_section_list_addresses): Remove
2508         FIXME and test for TLS or BSS.
2509
2510 2011-06-07  Cary Coutant  <ccoutant@google.com>
2511
2512         * testsuite/Makefile.am: Add incremental_copy_test,
2513         incremental_common_test_1.
2514         * testsuite/Makefile.in: Regenerate.
2515         * testsuite/common_test_1_v1.c: New source file.
2516         * testsuite/common_test_1_v2.c: New source file.
2517         * testsuite/copy_test_v1.cc: New source file.
2518
2519 2011-06-07  Cary Coutant  <ccoutant@google.com>
2520
2521         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2522         update, allocate common from bss section's free list.
2523         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2524         linker-defined symbols.
2525         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2526         Skip GOT and PLT entries that are no longer referenced.
2527         (Output_section_incremental_inputs::write_info_blocks): Mark
2528         linker-defined symbols.
2529         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2530         * output.cc (Output_section::allocate): New function.
2531         * output.h (Output_section::allocate): New function.
2532         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2533         linker-defined symbols.
2534         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2535         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2536         (Symbol::init_base_output_data): Likewise.
2537         (Symbol::init_base_output_segment): Likewise.
2538         (Symbol::init_base_constant): Likewise.
2539         (Sized_symbol::init_output_data): Likewise.
2540         (Sized_symbol::init_output_segment): Likewise.
2541         (Sized_symbol::init_constant): Likewise.
2542         (Symbol_table::do_define_in_output_data): Likewise.
2543         (Symbol_table::do_define_in_output_segment): Likewise.
2544         (Symbol_table::do_define_as_constant): Likewise.
2545         * symtab.h (Symbol::is_predefined): New function.
2546         (Symbol::init_base_output_data): Add is_predefined parameter.
2547         (Symbol::init_base_output_segment): Likewise.
2548         (Symbol::init_base_constant): Likewise.
2549         (Symbol::is_predefined_): New data member.
2550         (Sized_symbol::init_output_data): Add is_predefined parameter.
2551         (Sized_symbol::init_output_segment): Likewise.
2552         (Sized_symbol::init_constant): Likewise.
2553         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2554
2555 2011-06-07  Cary Coutant  <ccoutant@google.com>
2556
2557         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2558         instead of emit_copy_reloc.
2559         (Copy_relocs::emit_copy_reloc): Refactor.
2560         (Copy_relocs::make_copy_reloc): New function.
2561         (Copy_relocs::add_copy_reloc): Remove.
2562         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2563         section.
2564         (Copy_relocs::make_copy_reloc): New function.
2565         (Copy_relocs::add_copy_reloc): Remove.
2566         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2567         unchanged input files.
2568         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2569         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2570         Reserve BSS space for COPY relocations.
2571         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2572         (Output_section_incremental_inputs::write_info_blocks): Record
2573         whether a symbol is copied from a shared object.
2574         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2575         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2576         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2577         (Incremental_input_entry_reader::get_output_symbol_index): Add
2578         is_copy parameter.
2579         (Incremental_binary::emit_copy_relocs): New function.
2580         (Incremental_binary::do_emit_copy_relocs): New function.
2581         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2582         new data member.
2583         (Sized_incremental_binary::add_copy_reloc): New function.
2584         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2585         (Sized_incremental_binary::Copy_reloc): New struct.
2586         (Sized_incremental_binary::Copy_relocs): New typedef.
2587         (Sized_incremental_binary::copy_relocs_): New data member.
2588         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2589         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2590         * target.h (Sized_target::emit_copy_reloc): New function.
2591         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2592
2593 2011-06-02  Cary Coutant  <ccoutant@google.com>
2594
2595         PR gold/12163
2596         * gold/archive.cc (Archive::Archive): Initialize new data member.
2597         (Archive::include_all_members): Return if archive has already been
2598         included.
2599         * gold/archive.h (Archive::include_all_members_): New data member.
2600
2601 2011-06-02  Nick Clifton  <nickc@redhat.com>
2602
2603         * dynobj.h: Fix spelling mistake in comment.
2604         * output.cc: Likewise.
2605
2606 2011-05-31  Doug Kwan  <dougkwan@google.com>
2607             Asier Llano
2608
2609         PR gold/12826
2610         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2611         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2612         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2613         redundant arm_exidx_test.so.
2614         * testsuite/Makefile.in: Regenerate.
2615         (check_SCRIPTS): Add pr12826.sh
2616         (check_DATA): Add pr12826.stdout
2617         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2618         * testsuite/pr12826.sh: New file.
2619         * testsuite/pr12826_1.s: Ditto.
2620         * testsuite/pr12826_1.s: Ditto.
2621
2622 2011-05-30  Ian Lance Taylor  <iant@google.com>
2623
2624         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2625         sections.
2626
2627 2011-05-29  Ian Lance Taylor  <iant@google.com>
2628
2629         PR gold/12804
2630         * testsuite/Makefile.am: Use different file name for two_file_test
2631         temporary file for each incremental test.
2632         * testsuite/Makefile.in: Rebuild.
2633
2634 2011-05-29  Ian Lance Taylor  <iant@google.com>
2635
2636         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2637         binary input file is empty.
2638
2639 2011-05-27  Ian Lance Taylor  <iant@google.com>
2640
2641         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2642         (ver_test_9.so): Likewise.
2643         * testsuite/Makefile.in: Rebuild.
2644
2645 2011-05-26 Cary Coutant  <ccoutant@google.com>
2646
2647         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2648         * incremental.cc (Incremental_inputs::report_input_section): Fix
2649         comment, indentation.
2650         (Incremental_inputs::report_comdat_group): New function.
2651         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2652         of data for incremental input file entry.
2653         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2654         group count, COMDAT group signatures.
2655         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2656         an unchanged input file.
2657         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2658         Initialize new data member.
2659         (Incremental_object_entry::add_comdat_group): New function.
2660         (Incremental_object_entry::get_comdat_group_count): New function.
2661         (Incremental_object_entry::get_comdat_signature_key): New function.
2662         (Incremental_object_entry::groups_): New data member.
2663         (Incremental_inputs::report_comdat_group): New function.
2664         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2665         data for incremental input file entry.
2666         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2667         (Incremental_input_entry_reader::get_input_section): Adjust size of
2668         data for incremental input file entry.
2669         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2670         (Incremental_input_entry_reader::get_comdat_group_signature): New
2671         function.
2672         * object.cc (Sized_relobj::include_section_group): Report kept
2673         COMDAT groups for incremental links.
2674
2675 2011-05-24  David Meyer  <pdox@google.com>
2676
2677         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2678         with name parameter.  Add found_name parameter.
2679         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2680         * dirsearch.h (class Dirsearch): Update declaration.
2681
2682 2011-05-24  Ian Lance Taylor  <iant@google.com>
2683
2684         * archive.cc (Library_base::should_include_member): Pull in object
2685         from archive if it defines the entry symbol.
2686         * parameters.cc (Parameters::entry): New function.
2687         * parameters.h (class Parameters): Declare entry.
2688         * output.h (class Output_file_header): Remove entry_ field.
2689         * output.cc (Output_file_header::Output_file_header): Remove entry
2690         parameter.  Change all callers.
2691         (Output_file_header::entry): Use parameters->entry.
2692         * gold.cc (queue_middle_tasks): Likewise.
2693         * plugin.cc (Plugin_hook::run): Likewise.
2694
2695 2011-05-24 Cary Coutant  <ccoutant@google.com>
2696
2697         * gold.cc (queue_initial_tasks): Pass incremental base filename
2698         to Output_file::open_base_file; don't print error message.
2699         * incremental-dump.cc (main): Adjust call to
2700         Output_file::open_for_modification.
2701         * incremental-dump.cc (main): Likewise.
2702         * incremental.cc (Incremental_inputs::report_command_line):
2703         Ignore --incremental-base option when comparing command lines.
2704         Ignore parameter when given as separate argument.
2705         * options.h (class General_options): Add --incremental-base.
2706         * output.cc (Output_file::Output_file):
2707         (Output_file::open_base_file): Add base_name and writable parameters;
2708         read base file into new file; print error message here.
2709         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2710         callers.
2711         * output.h (Output_file::open_for_modification): Rename to...
2712         (Output_file::open_base_file): ...this; add base_name and
2713         writable parameters; adjust all callers.
2714         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2715         callers.
2716         * testsuite/Makefile.am (incremental_test_4): Test
2717         --incremental-base.
2718         * testsuite/Makefile.in: Regenerate.
2719
2720 2011-05-24 Cary Coutant  <ccoutant@google.com>
2721
2722         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2723         incremental_test_4.
2724         * testsuite/Makefile.in: Regenerate.
2725         * testsuite/two_file_test_1_v1.cc: New test source file.
2726         * testsuite/two_file_test_1b_v1.cc: New test source file.
2727         * testsuite/two_file_test_2_v1.cc: New test source file.
2728
2729 2011-05-24 Cary Coutant  <ccoutant@google.com>
2730
2731         * dynobj.h (Dynobj::do_dynobj): New function.
2732         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2733         flag and soname for shared objects.
2734         * incremental.cc (Incremental_inputs::report_object): Make
2735         either Incremental_object_entry or Incremental_dynobj_entry; add
2736         soname to string table.
2737         (Incremental_inputs::report_input_section): Add assertion.
2738         (Output_section_incremental_inputs::set_final_data_size): Adjust
2739         type of input file entry for shared libraries; adjust size of
2740         shared library info entry.
2741         (Output_section_incremental_inputs::write_input_files): Write
2742         as_needed flag for shared libraries.
2743         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2744         of input file entry for shared libraries; write soname.
2745         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2746         soname from incremental info.
2747         * incremental.h (enum Incremental_input_flags): Add
2748         INCREMENTAL_INPUT_AS_NEEDED.
2749         (Incremental_input_entry::Incremental_input_entry): Initialize new
2750         data member.
2751         (Incremental_input_entry::set_as_needed): New function.
2752         (Incremental_input_entry::as_needed): New function.
2753         (Incremental_input_entry::do_dynobj_entry): New function.
2754         (Incremental_input_entry::as_needed_): New data member.
2755         (Incremental_object_entry::Incremental_object_entry): Don't check
2756         for shared library.
2757         (Incremental_object_entry::do_type): Likewise.
2758         (class Incremental_dynobj_entry): New class.
2759         (Incremental_input_entry_reader::as_needed): New function.
2760         (Incremental_input_entry_reader::get_soname): New function.
2761         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2762         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2763         size of shared library info entry.
2764         * layout.cc (Layout::finish_dynamic_section): Don't test for
2765         incremental link when adding DT_NEEDED entries.
2766         * object.h (Object::Object): Initialize new data member.
2767         (Object::dynobj): New function.
2768         (Object::set_as_needed): New function.
2769         (Object::as_needed): New function.
2770         (Object::do_dynobj): New function.
2771         (Object::as_needed_): New data member.
2772
2773 2011-05-24 Cary Coutant  <ccoutant@google.com>
2774
2775         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2776         info; adjust display of GOT entries.
2777         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2778         vector of input objects; remove file_status_.
2779         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2780         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2781         got_plt reader; call target hooks to reserve GOT entries.
2782         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2783         of input file info header and GOT info entry.
2784         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2785         relocation info.
2786         (Got_plt_view_info::got_descriptor): Remove.
2787         (Got_plt_view_info::sym_index): New data member.
2788         (Got_plt_view_info::input_index): New data member.
2789         (Local_got_offset_visitor::visit): Write input file index.
2790         (Global_got_offset_visitor::visit): Write 0 for input file index.
2791         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2792         with sym_index and input_index.
2793         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2794         incremental info GOT entry; replace got_descriptor with input_index.
2795         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2796         map from input file index to object.
2797         (Sized_relobj_incr::do_layout): Replace direct data member reference
2798         with accessor function.
2799         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2800         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2801         Adjust size of input file info header.
2802         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2803         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2804         (Incremental_input_entry_reader::get_input_section): Adjust size of
2805         input file info header.
2806         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2807         of incremental info GOT entry.
2808         (Incremental_got_plt_reader::get_got_desc): Remove.
2809         (Incremental_got_plt_reader::get_got_symndx): New function.
2810         (Incremental_got_plt_reader::get_got_input_index): New function.
2811         (Sized_incremental_binary::Sized_incremental_binary): Remove
2812         file_status_; add input_objects_.
2813         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2814         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2815         (Sized_incremental_binary::file_is_unchanged): Remove.
2816         (Sized_incremental_binary::set_input_object): New function.
2817         (Sized_incremental_binary::input_object): New function.
2818         (Sized_incremental_binary::file_status_): Remove.
2819         (Sized_incremental_binary::input_objects_): New data member.
2820         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2821         references.
2822         (Sized_relobj_incr::invalid_address): Move to base class.
2823         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2824         class.
2825         (Sized_relobj_incr::do_output_section_offset): Likewise.
2826         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2827         (Sized_relobj_incr::section_offsets_): Likewise.
2828         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2829         function.
2830         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2831         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2832         with accessor function.
2833         (Sized_relobj_file::do_layout): Likewise.
2834         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2835         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2836         (Sized_relobj_file::compute_final_local_value): Replace refs to
2837         section_offsets_ with accessor function.
2838         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2839         * object.h (Relobj::Relobj): Initialize new data members.
2840         (Relobj::add_dyn_reloc): New function.
2841         (Relobj::first_dyn_reloc): New function.
2842         (Relobj::dyn_reloc_count): New function.
2843         (Relobj::first_dyn_reloc_): New data member.
2844         (Relobj::dyn_reloc_count_): New data member.
2845         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2846         references.
2847         (Sized_relobj::Address): New typedef.
2848         (Sized_relobj::invalid_address): Move here from child class.
2849         (Sized_relobj::Sized_relobj): Initialize new data members.
2850         (Sized_relobj::sized_relobj): New function.
2851         (Sized_relobj::is_output_section_offset_invalid): Move here from
2852         child class.
2853         (Sized_relobj::get_output_section_offset): Likewise.
2854         (Sized_relobj::local_has_got_offset): Likewise.
2855         (Sized_relobj::local_got_offset): Likewise.
2856         (Sized_relobj::set_local_got_offset): Likewise.
2857         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2858         (Sized_relobj::clear_got_offsets): New function.
2859         (Sized_relobj::section_offsets): Move here from child class.
2860         (Sized_relobj::do_output_section_offset): Likewise.
2861         (Sized_relobj::do_set_section_offset): Likewise.
2862         (Sized_relobj::Local_got_offsets): Likewise.
2863         (Sized_relobj::local_got_offsets_): Likewise.
2864         (Sized_relobj::section_offsets_): Likewise.
2865         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2866         references.
2867         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2868         class.
2869         (Sized_relobj_file::sized_relobj): New function
2870         (Sized_relobj_file::local_has_got_offset): Move to base class.
2871         (Sized_relobj_file::local_got_offset): Likewise.
2872         (Sized_relobj_file::set_local_got_offset): Likewise.
2873         (Sized_relobj_file::get_output_section_offset): Likewise.
2874         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2875         (Sized_relobj_file::do_output_section_offset): Likewise.
2876         (Sized_relobj_file::do_set_section_offset): Likewise.
2877         (Sized_relobj_file::Local_got_offsets): Likewise.
2878         (Sized_relobj_file::local_got_offsets_): Likewise.
2879         (Sized_relobj_file::section_offsets_): Likewise.
2880         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2881         (all constructors).
2882         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2883         (Output_reloc::get_symbol_index): Likewise.
2884         (Output_reloc::local_section_offset): Likewise.
2885         (Output_reloc::get_address): Likewise.
2886         (Output_reloc::symbol_value): Likewise.
2887         (Output_data_got::reserve_slot): Move to class definition.
2888         (Output_data_got::reserve_local): New function.
2889         (Output_data_got::reserve_slot_for_global): Remove.
2890         (Output_data_got::reserve_global): New function.
2891         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2892         (all constructors, two instantiations).
2893         (Output_reloc::get_relobj): New function (two instantiations).
2894         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2895         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2896         (Output_data_reloc::add_global): Adjust type of relobj.
2897         (Output_data_reloc::add_global_relative): Likewise.
2898         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2899         (Output_data_reloc::add_local): Likewise.
2900         (Output_data_reloc::add_local_relative): Likewise.
2901         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2902         (Output_data_reloc::add_local_section): Likewise.
2903         (Output_data_reloc::add_output_section): Likewise.
2904         (Output_data_reloc::add_absolute): Likewise.
2905         (Output_data_reloc::add_target_specific): Likewise.
2906         (Output_data_got::reserve_slot): Move definition here.
2907         (Output_data_got::reserve_local): New function.
2908         (Output_data_got::reserve_global): New function.
2909         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2910         section_offsets_ with accessor function.
2911         (Sized_relobj_file::write_sections): Likewise.
2912         (Sized_relobj_file::do_relocate_sections): Likewise.
2913         * target.h (Sized_target::reserve_local_got_entry): New function.
2914         (Sized_target::reserve_global_got_entry): New function.
2915         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2916         (Target_x86_64::reserve_global_got_entry): New function.
2917         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2918
2919 2011-05-23 Cary Coutant  <ccoutant@google.com>
2920
2921         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2922         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2923         bit when checking got_type.
2924         * incremental.cc (Sized_incremental_binary::setup_readers):
2925         Store symbol table and string table locations; initialize bit vector
2926         of file status flags.
2927         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2928         unchanged files.
2929         (Sized_incremental_binary::do_process_got_plt): New function.
2930         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2931         (Output_section_incremental_inputs::set_final_data_size): Record
2932         file index for each input file.
2933         (Output_section_incremental_inputs::write_got_plt): Store file index
2934         instead of input entry offset for each GOT entry.
2935         * incremental.h
2936         (Incremental_input_entry::Incremental_input_entry): Initialize new
2937         data member.
2938         (Incremental_input_entry::set_offset): Store file index.
2939         (Incremental_input_entry::get_file_index): New function.
2940         (Incremental_input_entry::file_index_): New data member.
2941         (Incremental_binary::process_got_plt): New function.
2942         (Incremental_binary::do_process_got_plt): New function.
2943         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2944         data members.
2945         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2946         (Sized_incremental_binary::set_file_is_unchanged): New function.
2947         (Sized_incremental_binary::file_is_unchanged): New function.
2948         (Sized_incremental_binary::do_process_got_plt): New function.
2949         (Sized_incremental_binary::file_status_): New data member.
2950         (Sized_incremental_binary::main_symtab_loc_): New data member.
2951         (Sized_incremental_binary::main_strtab_loc_): New data member.
2952         * output.cc (Output_data_got::Got_entry::write): Add case
2953         RESERVED_CODE.
2954         (Output_data_got::add_global): Call add_got_entry.
2955         (Output_data_got::add_global_plt): Likewise.
2956         (Output_data_got::add_global_with_rel): Likewise.
2957         (Output_data_got::add_global_with_rela): Likewise.
2958         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2959         (Output_data_got::add_global_pair_with_rela): Likewise.
2960         (Output_data_got::add_local): Call add_got_entry.
2961         (Output_data_got::add_local_plt): Likewise.
2962         (Output_data_got::add_local_with_rel): Likewise.
2963         (Output_data_got::add_local_with_rela): Likewise.
2964         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2965         (Output_data_got::add_local_pair_with_rela): Likewise.
2966         (Output_data_got::reserve_slot): New function.
2967         (Output_data_got::reserve_slot_for_global): New function.
2968         (Output_data_got::add_got_entry): New function.
2969         (Output_data_got::add_got_entry_pair): New function.
2970         (Output_section::add_output_section_data): Edit FIXME.
2971         * output.h
2972         (Output_section_data_build::Output_section_data_build): New
2973         constructor with size parameter.
2974         (Output_data_space::Output_data_space): Likewise.
2975         (Output_data_got::Output_data_got): Initialize new data member; new
2976         constructor with size parameter.
2977         (Output_data_got::add_constant): Call add_got_entry.
2978         (Output_data_got::reserve_slot): New function.
2979         (Output_data_got::reserve_slot_for_global): New function.
2980         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2981         (Output_data_got::add_got_entry): New function.
2982         (Output_data_got::add_got_entry_pair): New function.
2983         (Output_data_got::free_list_): New data member.
2984         * target.h (Sized_target::init_got_plt_for_update): New function.
2985         (Sized_target::register_global_plt_entry): New function.
2986         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2987         Initialize new data member; call init; add constructor with PLT count.
2988         (Output_data_plt_x86_64::init): New function.
2989         (Output_data_plt_x86_64::add_relocation): New function.
2990         (Output_data_plt_x86_64::reserve_slot): New function.
2991         (Output_data_plt_x86_64::free_list_): New data member.
2992         (Target_x86_64::init_got_plt_for_update): New function.
2993         (Target_x86_64::register_global_plt_entry): New function.
2994         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2995         incremental updates.
2996         (Output_data_plt_x86_64::add_relocation): New function.
2997         * testsuite/object_unittest.cc (Object_test): Set default options.
2998
2999 2011-05-16  Ian Lance Taylor  <iant@google.com>
3000
3001         * options.h (class General_options): Make -i a synonym for -r.
3002
3003 2011-05-16  Ian Lance Taylor  <iant@google.com>
3004
3005         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3006
3007 2011-05-10 Cary Coutant  <ccoutant@google.com>
3008
3009         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3010         strip_all (-s).
3011
3012 2011-05-06  Ian Lance Taylor  <iant@google.com>
3013
3014         * layout.cc (Layout::layout): If the output section flags change,
3015         update the ordering.
3016
3017 2011-04-25 Cary Coutant  <ccoutant@google.com>
3018
3019         * incremental-dump.cc (dump_incremental_inputs): Print local
3020         symbol info for each input file.
3021         * incremental.cc
3022         (Output_section_incremental_inputs::set_final_data_size): Add local
3023         symbol info to input file entries in incremental info.
3024         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3025         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3026         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3027         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3028         implementation.
3029         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3030         (Sized_incr_relobj::do_relocate): Write the local symbols.
3031         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3032         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3033         Adjust size of input file header.
3034         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3035         (Incremental_inputs_reader::get_local_symbol_count): New function.
3036         (Incremental_inputs_reader::get_input_section): Adjust size of input
3037         file header.
3038         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3039         (Sized_incr_relobj::This): New typedef.
3040         (Sized_incr_relobj::sym_size): New const data member.
3041         (Sized_incr_relobj::Local_symbol): New struct.
3042         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3043         (Sized_incr_relobj::do_local_symbol_offset): New function.
3044         (Sized_incr_relobj::local_symbol_count_): New data member.
3045         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3046         (Sized_incr_relobj::local_symbol_index_): New data member.
3047         (Sized_incr_relobj::local_symbol_offset_): New data member.
3048         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3049         (Sized_incr_relobj::local_symbols_): New data member.
3050         * object.h (Relobj::output_local_symbol_count): New function.
3051         (Relobj::local_symbol_offset): New function.
3052         (Relobj::do_output_local_symbol_count): New function.
3053         (Relobj::do_local_symbol_offset): New function.
3054         (Sized_relobj::do_output_local_symbol_count): New function.
3055         (Sized_relobj::do_local_symbol_offset): New function.
3056
3057 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3058
3059         * descriptors.cc (set_close_on_exec): New function.
3060         (Descriptors::open): Use set_close_on_exec.
3061         * output.cc (S_ISLNK): Define if not defined.
3062
3063 2011-04-22 Cary Coutant  <ccoutant@google.com>
3064
3065         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3066         global symbol map.
3067         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3068         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3069         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3070         relocations.
3071         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3072         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3073         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3074         * incremental.h
3075         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3076         function.
3077         (Incremental_binary::apply_incremental_relocs): New function.
3078         (Incremental_binary::do_apply_incremental_relocs): New function.
3079         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3080         data member.
3081         (Sized_incremental_binary::add_global_symbol): New function.
3082         (Sized_incremental_binary::global_symbol): New function.
3083         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3084         (Sized_incremental_binary::symbol_map_): New data member.
3085         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3086         * target.h (Sized_target::apply_relocation): New function.
3087         * target-reloc.h (apply_relocation): New function.
3088         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3089
3090 2011-04-22  Doug Kwan  <dougkwan@google.com>
3091
3092         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3093         flag of a SHT_ARM_EXIDX section.
3094         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3095         * testsuite/Makefile.in: Regenerate.
3096         * testsuite/arm_exidx_test.s: New file.
3097         * testsuite/arm_exidx_test.sh: Same.
3098
3099 2011-04-20 Cary Coutant  <ccoutant@google.com>
3100
3101         PR gold/12689
3102         * archive.h (Incremental_archive_entry::Archive_member):
3103         Initialize arg_serial_ (second constructor).
3104
3105 2011-04-17  Ian Lance Taylor  <iant@google.com>
3106
3107         * object.cc (Relocate_info::location): Simplify location string.
3108         * errors.cc (Errors::error_at_location): Don't print program
3109         name.
3110         (Errors::warning_at_location): Likewise.
3111         (Errors::undefined_symbol): Likewise.
3112         * testsuite/debug_msg.sh: Update accordingly.
3113
3114 2011-04-14 Cary Coutant  <ccoutant@google.com>
3115
3116         * gold/layout.cc (Layout::symtab_section_offset): New function.
3117         * gold/layout.h (Layout::symtab_section_offset): New function.
3118         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3119
3120 2011-04-12  Ian Lance Taylor  <iant@google.com>
3121
3122         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3123         with MREMAP_MAYMOVE.
3124         * output.h (class Output_file): Add map_is_allocated_ field.
3125         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3126         not available, provide stubs.  If mremap is not available, #define
3127         it to gold_mremap.
3128         (MREMAP_MAYMOVE): Define if not defined.
3129         (Output_file::Output_file): Initialize map_is_allocated_.
3130         (Output_file::resize): Check map_is_allocated_.
3131         (Output_file::map_anonymous): If mmap fails, use malloc.
3132         (Output_file::unmap): Don't do anything for an anonymous map.
3133         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3134         is not available, provide stubs.
3135         (File_read::View::~View): Use free rather than delete[].
3136         (File_read::make_view): Use malloc rather than new[].  If mmap
3137         fails, use malloc.
3138         (File_read::find_or_make_view): Use malloc rather than new[].
3139         * gold.h: Remove HAVE_REMAP code.
3140         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3141         exists.  Rename mremap to gold_mremap.  If mmap is not available
3142         don't do anything.
3143         * configure, config.in: Rebuild.
3144
3145 2011-04-11  Ian Lance Taylor  <iant@google.com>
3146
3147         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3148         initialize local variable v.
3149
3150 2011-04-11  Cary Coutant  <ccoutant@google.com>
3151
3152         * archive.cc (Archive::include_member): Adjust call to
3153         report_object.
3154         (Add_archive_symbols::run): Track argument serial numbers.
3155         (Lib_group::include_member): Likewise.
3156         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3157         * archive.h (Incremental_archive_entry::Archive_member):
3158         Initialize arg_serial_.
3159         (Archive_member::arg_serial_): New data member.
3160         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3161         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3162         incremental link.
3163         (Sized_dynobj::do_for_all_local_got_entries): New function.
3164         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3165         function.
3166         * fileread.cc (get_mtime): New function.
3167         * fileread.h (get_mtime): New function.
3168         * gold.cc (queue_initial_tasks): Check for incremental update.
3169         (process_incremental_input): New function.
3170         (queue_middle_tasks): Don't force valid target for incremental
3171         update.
3172         * incremental-dump.cc (find_input_containing_global): Adjust
3173         size of symbol info entry.
3174         (dump_incremental_inputs): Dump argument serial number and
3175         in_system_directory flag; bias shndx by 1; print symbol names
3176         when dumping per-file symbol lists; use new symbol info readers.
3177         * incremental.cc
3178         (Output_section_incremental_inputs:update_data_size): New function.
3179         (Sized_incremental_binary::setup_readers): Setup input readers
3180         for each input file; build maps for files added from libraries
3181         and scripts.
3182         (Sized_incremental_binary::check_input_args): New function.
3183         (Sized_incremental_binary::do_check_inputs): Build map of argument
3184         serial numbers to input arguments.
3185         (Sized_incremental_binary::do_file_has_changed): Rename
3186         do_file_is_unchanged to this; compare file modification times.
3187         (Sized_incremental_binary::do_init_layout): New function.
3188         (Sized_incremental_binary::do_reserve_layout): New function.
3189         (Sized_incremental_binary::do_get_input_reader): Remove.
3190         (Sized_incremental_binary::get_symtab_view): New function.
3191         (Incremental_checker::can_incrementally_link_output_file): Remove.
3192         (Incremental_inputs::report_command_line): Exclude --debug options.
3193         (Incremental_inputs::report_archive_begin): Add parameter; track
3194         argument serial numbers; don't put input file entry for archive
3195         before archive members.
3196         (Incremental_inputs::report_archive_end): Put input file entry
3197         for archive after archive members.
3198         (Incremental_inputs::report_object): Add parameter; track argument
3199         serial numbers and in_system_directory flag.
3200         (Incremental_inputs::report_script): Add parameter; track argument
3201         serial numbers.
3202         (Output_section_incremental_inputs::set_final_data_size): Adjust
3203         size of symbol info entry; check for forwarding symbols.
3204         (Output_section_incremental_inputs::write_input_files): Write
3205         in_system_directory flag and argument serial number.
3206         (Output_section_incremental_inputs::write_info_blocks): Map section
3207         indices between incremental info and original input file; store
3208         input section index for each symbol.
3209         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3210         change operator() to visit().
3211         (class Global_got_offset_visitor): Likewise.
3212         (class Global_symbol_visitor_got_plt):
3213         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3214         classes.
3215         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3216         (Sized_incr_relobj::do_read_symbols): New function.
3217         (Sized_incr_relobj::do_layout): New function.
3218         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3219         (Sized_incr_relobj::do_add_symbols): New function.
3220         (Sized_incr_relobj::do_should_include_member): New function.
3221         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3222         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3223         (Sized_incr_relobj::do_section_size): New function.
3224         (Sized_incr_relobj::do_section_name): New function.
3225         (Sized_incr_relobj::do_section_contents): New function.
3226         (Sized_incr_relobj::do_section_flags): New function.
3227         (Sized_incr_relobj::do_section_entsize): New function.
3228         (Sized_incr_relobj::do_section_address): New function.
3229         (Sized_incr_relobj::do_section_type): New function.
3230         (Sized_incr_relobj::do_section_link): New function.
3231         (Sized_incr_relobj::do_section_info): New function.
3232         (Sized_incr_relobj::do_section_addralign): New function.
3233         (Sized_incr_relobj::do_initialize_xindex): New function.
3234         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3235         (Sized_incr_relobj::do_read_relocs): New function.
3236         (Sized_incr_relobj::do_gc_process_relocs): New function.
3237         (Sized_incr_relobj::do_scan_relocs): New function.
3238         (Sized_incr_relobj::do_count_local_symbols): New function.
3239         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3240         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3241         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3242         (Sized_incr_relobj::do_relocate): New function.
3243         (Sized_incr_relobj::do_set_section_offset): New function.
3244         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3245         (Sized_incr_dynobj::do_read_symbols): New function.
3246         (Sized_incr_dynobj::do_layout): New function.
3247         (Sized_incr_dynobj::do_add_symbols): New function.
3248         (Sized_incr_dynobj::do_should_include_member): New function.
3249         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3250         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3251         (Sized_incr_dynobj::do_section_size): New function.
3252         (Sized_incr_dynobj::do_section_name): New function.
3253         (Sized_incr_dynobj::do_section_contents): New function.
3254         (Sized_incr_dynobj::do_section_flags): New function.
3255         (Sized_incr_dynobj::do_section_entsize): New function.
3256         (Sized_incr_dynobj::do_section_address): New function.
3257         (Sized_incr_dynobj::do_section_type): New function.
3258         (Sized_incr_dynobj::do_section_link): New function.
3259         (Sized_incr_dynobj::do_section_info): New function.
3260         (Sized_incr_dynobj::do_section_addralign): New function.
3261         (Sized_incr_dynobj::do_initialize_xindex): New function.
3262         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3263         (make_sized_incremental_object): New function.
3264         (Incremental_library::copy_unused_symbols): New function.
3265         (Incremental_library::do_for_all_unused_symbols): New function.
3266         * incremental.h (enum Incremental_input_flags): New type.
3267         (class Incremental_checker): Remove.
3268         (Incremental_input_entry::Incremental_input_entry): Add argument
3269         serial number.
3270         (Incremental_input_entry::arg_serial): New function.
3271         (Incremental_input_entry::set_is_in_system_directory): New function.
3272         (Incremental_input_entry::is_in_system_directory): New function.
3273         (Incremental_input_entry::arg_serial_): New data member.
3274         (Incremental_input_entry::is_in_system_directory_): New data member.
3275         (class Script_info): Move here from script.h.
3276         (Script_info::Script_info): Add filename parameter.
3277         (Script_info::filename): New function.
3278         (Script_info::filename_): New data member.
3279         (Incremental_script_entry::Incremental_script_entry): Add argument
3280         serial number.
3281         (Incremental_object_entry::Incremental_object_entry): Likewise.
3282         (Incremental_object_entry::add_input_section): Build list of input
3283         sections with map to original shndx.
3284         (Incremental_object_entry::get_input_section_index): New function.
3285         (Incremental_object_entry::shndx_): New data member.
3286         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3287         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3288         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3289         serial number.
3290         (Incremental_inputs::report_archive_begin): Likewise.
3291         (Incremental_inputs::report_object): Likewise.
3292         (Incremental_inputs::report_script): Likewise.
3293         (class Incremental_global_symbol_reader): New class.
3294         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3295         and store flags and input file type.
3296         (Incremental_input_entry_reader::arg_serial): New function.
3297         (Incremental_input_entry_reader::type): Extract type from flags.
3298         (Incremental_input_entry_reader::is_in_system_directory): New function.
3299         (Incremental_input_entry_reader::get_input_section_count): Call
3300         accessor function for type.
3301         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3302         function for type; adjust size of global symbol entry.
3303         (Incremental_input_entry_reader::get_global_symbol_count): Call
3304         accessor function for type.
3305         (Incremental_input_entry_reader::get_object_count): Likewise.
3306         (Incremental_input_entry_reader::get_object_offset): Likewise.
3307         (Incremental_input_entry_reader::get_member_count): Likewise.
3308         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3309         (Incremental_input_entry_reader::get_member_offset): Likewise.
3310         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3311         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3312         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3313         (Incremental_input_entry_reader::get_global_symbol_reader): New
3314         function.
3315         (Incremental_input_entry_reader::get_output_symbol_index): New
3316         function.
3317         (Incremental_input_entry_reader::type_): Remove.
3318         (Incremental_input_entry_reader::flags_): New data member.
3319         (Incremental_inputs_reader::input_file_offset): New function.
3320         (Incremental_inputs_reader::input_file_index): New function.
3321         (Incremental_inputs_reader::input_file): Call input_file_offset.
3322         (Incremental_inputs_reader::input_file_at_offset): New function.
3323         (Incremental_relocs_reader::get_r_type): Reformat.
3324         (Incremental_relocs_reader::get_r_shndx): Reformat.
3325         (Incremental_relocs_reader::get_r_offset): Reformat.
3326         (Incremental_relocs_reader::data): New function.
3327         (Incremental_binary::Incremental_binary): Initialize new data members.
3328         (Incremental_binary::check_inputs): Add cmdline parameter.
3329         (Incremental_binary::file_is_unchanged): Remove.
3330         (Input_reader::arg_serial): New function.
3331         (Input_reader::get_unused_symbol_count): New function.
3332         (Input_reader::get_unused_symbol): New function.
3333         (Input_reader::do_arg_serial): New function.
3334         (Input_reader::do_get_unused_symbol_count): New function.
3335         (Input_reader::do_get_unused_symbol): New function.
3336         (Incremental_binary::input_file_count): New function.
3337         (Incremental_binary::get_input_reader): Change signature to use
3338         index instead of filename.
3339         (Incremental_binary::file_has_changed): New function.
3340         (Incremental_binary::get_input_argument): New function.
3341         (Incremental_binary::get_library): New function.
3342         (Incremental_binary::get_script_info): New function.
3343         (Incremental_binary::init_layout): New function.
3344         (Incremental_binary::reserve_layout): New function.
3345         (Incremental_binary::output_file): New function.
3346         (Incremental_binary::do_check_inputs): New function.
3347         (Incremental_binary::do_file_is_unchanged): Remove.
3348         (Incremental_binary::do_file_has_changed): New function.
3349         (Incremental_binary::do_init_layout): New function.
3350         (Incremental_binary::do_reserve_layout): New function.
3351         (Incremental_binary::do_input_file_count): New function.
3352         (Incremental_binary::do_get_input_reader): Change signature.
3353         (Incremental_binary::input_args_map_): New data member.
3354         (Incremental_binary::library_map_): New data member.
3355         (Incremental_binary::script_map_): New data member.
3356         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3357         new data members.
3358         (Sized_incremental_binary::output_section): New function.
3359         (Sized_incremental_binary::inputs_reader): Add const.
3360         (Sized_incremental_binary::symtab_reader): Add const.
3361         (Sized_incremental_binary::relocs_reader): Add const.
3362         (Sized_incremental_binary::got_plt_reader): Add const.
3363         (Sized_incremental_binary::get_symtab_view): New function.
3364         (Sized_incremental_binary::Inputs_reader): New typedef.
3365         (Sized_incremental_binary::Input_entry_reader): New typedef.
3366         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3367         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3368         (Sized_incremental_binary::do_file_has_changed): New function.
3369         (Sized_incremental_binary::do_init_layout): New function.
3370         (Sized_incremental_binary::do_reserve_layout): New function.
3371         (Sized_input_reader::Inputs_reader): Remove.
3372         (Sized_input_reader::Input_entry_reader): Remove.
3373         (Sized_input_reader::do_arg_serial): New function.
3374         (Sized_input_reader::do_get_unused_symbol_count): New function.
3375         (Sized_input_reader::do_get_unused_symbol): New function.
3376         (Sized_incremental_binary::do_input_file_count): New function.
3377         (Sized_incremental_binary::do_get_input_reader): Change signature;
3378         use index instead of filename.
3379         (Sized_incremental_binary::section_map_): New data member.
3380         (Sized_incremental_binary::input_entry_readers_): New data member.
3381         (class Sized_incr_relobj): New class.
3382         (class Sized_incr_dynobj): New class.
3383         (make_sized_incremental_object): New function.
3384         (class Incremental_library): New class.
3385         * layout.cc (Free_list::num_lists): New static data member.
3386         (Free_list::num_nodes): New static data member.
3387         (Free_list::num_removes): New static data member.
3388         (Free_list::num_remove_visits): New static data member.
3389         (Free_list::num_allocates): New static data member.
3390         (Free_list::num_allocate_visits): New static data member.
3391         (Free_list::init): New function.
3392         (Free_list::remove): New function.
3393         (Free_list::allocate): New function.
3394         (Free_list::dump): New function.
3395         (Free_list::print_stats): New function.
3396         (Layout_task_runner::run): Resize output file for incremental updates.
3397         (Layout::Layout): Initialize new data members.
3398         (Layout::set_incremental_base): New function.
3399         (Layout::init_fixed_output_section): New function.
3400         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3401         incremental updates.
3402         (Layout::create_gold_note): Do not create gold note section for
3403         incremental updates.
3404         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3405         for incremental updates.
3406         (Layout::set_section_offsets): For incremental updates, allocate space
3407         from free list.
3408         (Layout::create_symtab_sections): Layout with offsets relative to
3409         start of section; for incremental updates, allocate space from free
3410         list.
3411         (Layout::create_shdrs): For incremental updates, allocate space from
3412         free list.
3413         (Layout::finish_dynamic_section): For incremental updates, do not
3414         check --as-needed (fixed in subsequent patch).
3415         * layout.h (class Free_list): New class.
3416         (Layout::set_incremental_base): New function.
3417         (Layout::incremental_base): New function.
3418         (Layout::init_fixed_output_section): New function.
3419         (Layout::allocate): New function.
3420         (Layout::incremental_base_): New data member.
3421         (Layout::free_list_): New data member.
3422         * main.cc (main): Print Free_list statistics.
3423         * object.cc (Relobj::finalize_incremental_relocs): Add
3424         clear_counts parameter; clear counts only when clear_counts is set.
3425         (Sized_relobj::Sized_relobj): Initialize new base class.
3426         (Sized_relobj::do_layout): Don't report special sections.
3427         (Sized_relobj::do_for_all_local_got_entries): New function.
3428         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3429         symtab_off to all symbol table offsets.
3430         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3431         * object.h (class Got_offset_list): Move to top of file.
3432         (Object::Object): Allow case where input_file == NULL.
3433         (Object::~Object): Likewise.
3434         (Object::input_file): Assert that input_file != NULL.
3435         (Object::lock): Allow case where input_file == NULL.
3436         (Object::unlock): Likewise.
3437         (Object::is_locked): Likewise.
3438         (Object::token): Likewise.
3439         (Object::release): Likewise.
3440         (Object::is_incremental): New function.
3441         (Object::get_mtime): New function.
3442         (Object::for_all_local_got_entries): New function.
3443         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3444         (Object::set_is_in_system_directory): New function.
3445         (Object::is_in_system_directory): New function.
3446         (Object::do_is_incremental): New function.
3447         (Object::do_get_mtime): New function.
3448         (Object::do_for_all_local_got_entries): New function.
3449         (Object::is_in_system_directory_): New data member.
3450         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3451         (class Sized_relobj_base): New class.
3452         (class Sized_relobj): Derive from Sized_relobj_base.
3453         (class Sized_relobj::Symbols): Redeclare from base class.
3454         (class Sized_relobj::local_got_offset_list): Remove.
3455         (class Sized_relobj::Output_sections): Redeclare from base class.
3456         (class Sized_relobj::do_for_all_local_got_entries): New function.
3457         (class Sized_relobj::write_local_symbols): Add offset parameter.
3458         (class Sized_relobj::local_symbol_offset_): Update comment.
3459         (class Sized_relobj::local_dynsym_offset_): Update comment.
3460         * options.cc (Input_arguments::add_file): Remove const.
3461         * options.h (Input_file_argument::Input_file_argument):
3462         Initialize arg_serial_ (all constructors).
3463         (Input_file_argument::set_arg_serial): New function.
3464         (Input_file_argument::arg_serial): New function.
3465         (Input_file_argument::arg_serial_): New data member.
3466         (Input_arguments::Input_arguments): Initialize file_count_.
3467         (Input_arguments::add_file): Remove const.
3468         (Input_arguments::number_of_input_files): New function.
3469         (Input_arguments::file_count_): New data member.
3470         (Command_line::number_of_input_files): Call
3471         Input_arguments::number_of_input_files.
3472         * output.cc (Output_segment_headers::Output_segment_headers):
3473         Set current size.
3474         (Output_section::Input_section::current_data_size): New function.
3475         (Output_section::Output_section): Initialize new data members.
3476         (Output_section::add_input_section): Don't do merge sections for
3477         an incremental link; allocate space from free list for an
3478         incremental update.
3479         (Output_section::add_output_section_data): Allocate space from
3480         free list for an incremental update.
3481         (Output_section::update_data_size): New function.
3482         (Output_section::set_fixed_layout): New function.
3483         (Output_section::reserve): New function.
3484         (Output_segment::set_section_addresses): Remove const.
3485         (Output_segment::set_section_list_addresses): Remove const; allocate
3486         space from free list for an incremental update.
3487         (Output_segment::set_offset): Adjust size of RELRO segment for an
3488         incremental update.
3489         * output.h (Output_data::current_data_size): Move here from
3490         child classes.
3491         (Output_data::pre_finalize_data_size): New function.
3492         (Output_data::update_data_size): New function.
3493         (Output_section_headers::update_data_size): new function.
3494         (Output_section_data_build::current_data_size): Move to Output_data.
3495         (Output_data_strtab::update_data_size): New function.
3496         (Output_section::current_data_size): Move to Output_data.
3497         (Output_section::set_fixed_layout): New function.
3498         (Output_section::has_fixed_layout): New function.
3499         (Output_section::reserve): New function.
3500         (Output_section::update_data_size): New function.
3501         (Output_section::has_fixed_layout_): New data member.
3502         (Output_section::free_list_): New data member.
3503         (Output_segment::set_section_addresses): Remove const.
3504         (Output_segment::set_section_list_addresses): Remove const.
3505         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3506         New function.
3507         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3508         New function.
3509         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3510         parameter when calling Add_symbols constructor; store argument
3511         serial number for members of a lib group.
3512         (Add_symbols::locks): Allow case where token == NULL.
3513         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3514         (Read_member::~Read_member): New function.
3515         (Read_member::is_runnable): New function.
3516         (Read_member::locks): New function.
3517         (Read_member::run): New function.
3518         (Check_script::~Check_script): New function.
3519         (Check_script::is_runnable): New function.
3520         (Check_script::locks): New function.
3521         (Check_script::run): New function.
3522         (Check_library::~Check_library): New function.
3523         (Check_library::is_runnable): New function.
3524         (Check_library::locks): New function.
3525         (Check_library::run): New function.
3526         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3527         (Add_symbols::library_): New data member.
3528         (class Read_member): New class.
3529         (class Check_script): New class.
3530         (class Check_library): New class.
3531         * reloc.cc (Read_relocs::is_runnable): Allow case where
3532         token == NULL.
3533         (Read_relocs::locks): Likewise.
3534         (Scan_relocs::locks): Likewise.
3535         (Relocate_task::locks): Likewise.
3536         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3537         to clear counters.
3538         (Sized_relobj::incremental_relocs_scan): Fix comment.
3539         (Sized_relobj::do_relocate): Pass output file offset to
3540         write_local_symbols.
3541         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3542         from class declaration.
3543         * script.cc (read_input_script): Allocate Script_info; pass
3544         argument serial number to report_script.
3545         * script.h (class Script_info): Move to incremental.h.
3546         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3547         * symtab.h (Symbol_table::add_from_incrobj): New function.
3548         (Symbol_table::set_file_offset): New function.
3549
3550 2011-04-05  Cary Coutant  <ccoutant@google.com>
3551
3552         * incremental-dump.cc (dump_incremental_inputs): Change signature
3553         to take a Sized_incremental_binary; change caller.  Use readers
3554         in Sized_incremental_binary.
3555         * incremental.cc
3556         (Sized_incremental_binary::find_incremental_inputs_sections):
3557         Rename do_find_incremental_inputs_sections to this.
3558         (Sized_incremental_binary::setup_readers): New function.
3559         (Sized_incremental_binary::do_check_inputs): Check
3560         has_incremental_info_ flag; move setup code to setup_readers;
3561         use input readers.
3562         (Sized_incremental_binary::do_file_is_unchanged): New function.
3563         (Sized_incremental_binary::do_get_input_reader): New function.
3564         * incremental.h (class Incremental_binary): Move to end of file.
3565         (Incremental_binary::file_is_unchanged): New function.
3566         (Incremental_binary::do_file_is_unchanged): New function.
3567         (Incremental_binary::Input_reader): New class.
3568         (Incremental_binary::get_input_reader): New function.
3569         (class Sized_incremental_binary): Move to end of file.
3570         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3571         input section reader classes.
3572         (Sized_incremental_binary::has_incremental_info): New function.
3573         (Sized_incremental_binary::inputs_reader): New function.
3574         (Sized_incremental_binary::symtab_reader): New function.
3575         (Sized_incremental_binary::relocs_reader): New function.
3576         (Sized_incremental_binary::got_plt_reader): New function.
3577         (Sized_incremental_binary::do_file_is_unchanged): New function.
3578         (Sized_incremental_binary::Sized_input_reader): New class.
3579         (Sized_incremental_binary::get_input_reader): New function.
3580         (Sized_incremental_binary::find_incremental_inputs_sections):
3581         Rename do_find_incremental_inputs_sections to this.
3582         (Sized_incremental_binary::setup_readers): New function.
3583         (Sized_incremental_binary::has_incremental_info_): New data member.
3584         (Sized_incremental_binary::inputs_reader_): New data member.
3585         (Sized_incremental_binary::symtab_reader_): New data member.
3586         (Sized_incremental_binary::relocs_reader_): New data member.
3587         (Sized_incremental_binary::got_plt_reader_): New data member.
3588         (Sized_incremental_binary::current_input_file_): New data member.
3589
3590 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3591
3592         PR gold/12640
3593         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3594         violation.
3595
3596 2011-03-30  Cary Coutant  <ccoutant@google.com>
3597
3598         * archive.cc (Archive::include_member): Adjust call to report_object.
3599         (Add_archive_symbols::run): Add script_info to call to
3600         report_archive_begin.
3601         (Lib_group::include_member): Adjust call to report_object.
3602         (Add_lib_group_symbols::run): Adjust call to report_object.
3603         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3604         blocks.  Add object count for script input files.
3605         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3606         script_info parameter; change all callers.
3607         (Incremental_inputs::report_object): Add script_info parameter;
3608         change all callers.
3609         (Incremental_inputs::report_script): Store backpointer to
3610         incremental info entry.
3611         (Output_section_incremental_inputs::set_final_data_size): Record
3612         additional information for scripts.
3613         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3614         * incremental.h (Incremental_script_entry::add_object): New function.
3615         (Incremental_script_entry::get_object_count): New function.
3616         (Incremental_script_entry::get_object): New function.
3617         (Incremental_script_entry::objects_): New data member; adjust
3618         constructor.
3619         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3620         (Incremental_inputs::report_object): Add script_info parameter.
3621         (Incremental_inputs_reader::get_object_count): New function.
3622         (Incremental_inputs_reader::get_object_offset): New function.
3623         * options.cc (Input_arguments::add_file): Return reference to
3624         new input argument.
3625         * options.h (Input_argument::set_script_info): New function.
3626         (Input_argument::script_info): New function.
3627         (Input_argument::script_info_): New data member; adjust all
3628         constructors.
3629         (Input_file_group::add_file): Return reference to new input argument.
3630         (Input_file_lib::add_file): Likewise.
3631         (Input_arguments::add_file): Likewise.
3632         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3633         * script.cc (Parser_closure::Parser_closure): Add script_info
3634         parameter; adjust all callers.
3635         (Parser_closure::script_info): New function.
3636         (Parser_closure::script_info_): New data member.
3637         (read_input_script): Report scripts earlier to incremental info.
3638         (script_add_file): Set script_info in Input_argument.
3639         (script_add_library): Likewise.
3640         * script.h (Script_options::Script_info): Rewrite class.
3641
3642 2011-03-29  Cary Coutant  <ccoutant@google.com>
3643
3644         * archive.cc (Library_base::should_include_member): Move
3645         method here from class Archive.
3646         (Archive::Archive): Initialize base class.
3647         (Archive::should_include_member): Move to base class.
3648         (Archive::do_for_all_unused_symbols): New function.
3649         (Add_archive_symbols::run): Remove redundant access to
3650         incremental_inputs.
3651         (Lib_group::Lib_group): Initialize base class.
3652         (Lib_group::do_filename): New function.
3653         (Lib_group::include_member): Pass pointer to Lib_group to
3654         report_object.
3655         (Lib_group::do_for_all_unused_symbols): New function.
3656         (Add_lib_group_symbols::run): Report archive information for
3657         incremental links.
3658         * archive.h (class Library_base): New base class.
3659         (class Archive): Derive from Library_base.
3660         (Archive::filename): Move to base class.
3661         (Archive::set_incremental_info): Likewise.
3662         (Archive::incremental_info): Likewise.
3663         (Archive::Should_include): Likewise.
3664         (Archive::should_include_member): Likewise.
3665         (Archive::Armap_entry): Remove.
3666         (Archive::Unused_symbol_iterator): Remove.
3667         (Archive::unused_symbols_begin): Remove.
3668         (Archive::unused_symbols_end): Remove.
3669         (Archive::do_filename): New function.
3670         (Archive::do_get_mtime): New function.
3671         (Archive::do_for_all_unused_symbols): New function.
3672         (Archive::task_): Move to base class.
3673         (Archive::incremental_info_): Likewise.
3674         (class Lib_group): Derive from Library_base.
3675         (Lib_group::do_filename): New function.
3676         (Lib_group::do_get_mtime): New function.
3677         (Lib_group::do_for_all_unused_symbols): New function.
3678         (Lib_group::task_): Move to base class.
3679         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3680         function.
3681         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3682         function.
3683         * incremental.cc (Incremental_inputs::report_archive_begin):
3684         Use Library_base; call library's get_mtime; add incremental inputs
3685         entry before members.
3686         (class Unused_symbol_visitor): New class.
3687         (Incremental_inputs::report_archive_end): Use Library_base; use
3688         visitor class to record unused symbols; don't add incremental inputs
3689         entry after members.
3690         (Incremental_inputs::report_object): Use Library_base.
3691         * incremental.h
3692         (Incremental_archive_entry::Incremental_archive_entry): Remove
3693         unused Archive parameter.
3694         (Incremental_inputs::report_archive_begin): Use Library_base.
3695         (Incremental_inputs::report_archive_end): Likewise.
3696         (Incremental_inputs::report_object): Likewise.
3697         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3698         function.
3699         * object.h (Object::for_all_global_symbols): New function.
3700         (Object::do_for_all_global_symbols): New function.
3701         (Sized_relobj::do_for_all_global_symbols): New function.
3702         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3703         function.
3704         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3705         function.
3706
3707 2011-03-27  Ian Lance Taylor  <iant@google.com>
3708
3709         * archive.cc (Archive::interpret_header): Return -1 if something
3710         goes wrong.  Change callers accordingly.
3711
3712 2011-03-25  Cary Coutant  <ccoutant@google.com>
3713
3714         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3715         * testsuite/Makefile.in: Regenerate.
3716
3717 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3718
3719         * plugin.cc (get_view): New.
3720         (Plugin::load): Pass get_view to the plugin.
3721         (Plugin_manager::get_view): New.
3722
3723 2011-03-21  Ian Lance Taylor  <iant@google.com>
3724
3725         * testsuite/final_layout.sh: Rewrite to not use dc.
3726         * testsuite/relro_test.sh: Fail if dc is not present.
3727
3728 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3729
3730         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3731         Change == to -eq.
3732         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3733         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3734         Change == to -eq.
3735         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3736         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3737
3738 2011-03-14  Ian Lance Taylor  <iant@google.com>
3739
3740         * script-sections.cc (Sort_output_sections::script_compare):
3741         Rename from is_before, change return type.
3742         (Sort_output_sections::operator()): Adjust accordingly.
3743
3744 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3745
3746         PR gold/12572
3747         * testsuite/odr_violation2.cc: Add comment to make all error line
3748         numbers double digits.
3749         * testsuite/debug_msg.sh: Adjust expected errors.
3750
3751 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3752
3753         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3754         but mark earlier ones as non-canonical
3755         (offset_to_iterator): Update search target and example
3756         (do_addr2line): Return extra lines in a vector*
3757         (format_file_lineno): Extract from do_addr2line
3758         (one_addr2line): Add vector* out-param
3759         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3760         when a lineno entry appeared last for its instruction
3761         (Dwarf_line_info): Add vector* out-param
3762         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3763         * symtab.cc (Odr_violation_compare): Include the lineno in the
3764         comparison again.
3765         (linenos_from_loc): New. Combine the canonical line for an
3766         address with its other lines.
3767         (True_if_intersect): New. Helper functor to make
3768         std::set_intersection a query.
3769         (detect_odr_violations): Compare sets of lines instead of just
3770         one line for each function. This became less deterministic, but
3771         has fewer false positives.
3772         * symtab.h: Declarations.
3773         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3774         mix an optimized and non-optimized object in the same binary
3775         (odr_violation2.so): Same.
3776         * testsuite/Makefile.in: Regenerate from Makefile.am.
3777         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3778         * testsuite/debug_msg.sh: Update line numbers and add
3779         assertions.
3780         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3781         non-optimized context.
3782         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3783         isn't inlined, and use OdrDerived in an optimized context.
3784         * testsuite/odr_header1.h: Defines OdrDerived, where
3785         optimization will change the
3786         first-instruction-in-the-destructor's file and line number.
3787         * testsuite/odr_header2.h: Defines OdrBase.
3788
3789 2011-03-09  Ian Lance Taylor  <iant@google.com>
3790
3791         * fileread.cc (File_read::clear_views): Don't delete the whole
3792         file view.
3793
3794 2011-03-08  Ian Lance Taylor  <iant@google.com>
3795
3796         PR gold/12525
3797         * fileread.cc: #include <climits>.
3798         (GOLD_IOV_MAX): Define.
3799         (File_read::read_multiple): Limit number of entries by iov_max.
3800         * fileread.h (class File_read): Always set max_readv_entries to
3801         128.
3802
3803 2011-03-07  Ian Lance Taylor  <iant@google.com>
3804
3805         PR gold/12525
3806         * options.h (class General_options): Add -dy and -dn.
3807
3808 2011-03-02  Cary Coutant  <ccoutant@google.com>
3809
3810         * testsuite/script_test_9.t: Add TLS segment.
3811
3812 2011-03-02  Simon Baldwin  <simonb@google.com>
3813
3814         * configure.ac: Add check for gnu_indirect_function support in
3815         the toolchain building binutils.
3816         * configure: Rebuild.
3817
3818 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3819
3820         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3821         plugin only symbols.
3822         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3823         in plugin files as not needed in the symbol table.
3824
3825 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3826
3827         * output.cc (Output_section::add_input_section): Delay fill
3828         generation for section ordering.
3829
3830 2011-02-09  Ian Lance Taylor  <iant@google.com>
3831
3832         PR gold/12316
3833         * object.h (class Sized_relobj): Remove clear_local_symbols.
3834         * reloc.cc (Sized_relobj::do_relocate): Don't call
3835         clear_local_symbols.
3836
3837 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3838
3839         * plugin.cc (is_visible_from_outside): Return true for symbols
3840         in the -u option.
3841
3842 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3843
3844         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3845         filename.
3846
3847 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3848
3849         * icf.h (is_section_foldable_candidate): Change type of parameter
3850         to std::string.
3851         * icf.cc (Icf::find_identical_sections): Change type of local variable
3852         section_name to be std::string.
3853         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3854
3855 2011-01-25  Ian Lance Taylor  <iant@google.com>
3856
3857         * script.cc (script_add_extern): Rewrite to use
3858         add_symbol_reference.
3859
3860 2011-01-25  Doug Kwan  <dougkwan@google.com>
3861
3862         * icf.cc (get_section_contents): Always lock section's object.
3863
3864 2011-01-24  Ian Lance Taylor  <iant@google.com>
3865
3866         * options.h (class General_options): Accept
3867         --no-detect-odr-violations.
3868
3869 2011-01-24  Ian Lance Taylor  <iant@google.com>
3870
3871         * version.cc (version_string): Bump to 1.11.
3872
3873 2011-01-24  Ian Lance Taylor  <iant@google.com>
3874
3875         * plugin.cc (class Plugin_rescan): Define new class.
3876         (Plugin_manager::claim_file): Set any_claimed_.
3877         (Plugin_manager::save_archive): New function.
3878         (Plugin_manager::save_input_group): New function.
3879         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3880         necessary.
3881         (Plugin_manager::new_undefined_symbol): New function.
3882         (Plugin_manager::rescan): New function.
3883         (Plugin_manager::rescannable_defines): New function.
3884         (Plugin_manager::add_input_file): Set any_added_.
3885         * plugin.h (class Plugin_manager): define new fields rescannable_,
3886         undefined_symbols_, any_claimed_, and any_added_.  Declare
3887         Plugin_rescan as friend.  Declare new functions.
3888         (Plugin_manager::Rescannable): Define type.
3889         (Plugin_manager::Rescannable_list): Define type.
3890         (Plugin_manager::Undefined_symbol_list): Define type.
3891         (Plugin_manager::Plugin_manager): Initialize new fields.
3892         * archive.cc (Archive::defines_symbol): New function.
3893         (Add_archive_symbols::run): Pass archive to plugins if any.
3894         * archive.h (class Archive): Declare defines_symbol.
3895         * readsyms.cc (Input_group::~Input_group): New function.
3896         (Finish_group::run): Pass input_group to plugins if any.
3897         * readsyms.h (class Input_group): Declare destructor.
3898         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3899         any.
3900
3901 2011-01-10  Ian Lance Taylor  <iant@google.com>
3902
3903         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3904         section as relro.
3905         (Layout::set_segment_offsets): Reset increase_relro before calling
3906         set_section_addresses a second time.
3907
3908 2011-01-04  Cary Coutant  <ccoutant@google.com>
3909
3910         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3911         sections before NOBITS sections.
3912
3913 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3914
3915         * version.cc (print_version): Update copyright to 2011.
3916
3917 2010-12-23  Cary Coutant  <ccoutant@google.com>
3918
3919         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3920         of OS to this->add.  Add OD parameter to second form of the function.
3921
3922 2010-12-20  Ian Lance Taylor  <iant@google.com>
3923
3924         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3925         second of two consecutive entries with same offset.
3926
3927 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3928
3929         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3930         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3931         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3932         to avoid unneeded links against $(LDADD).
3933         * testsuite/Makefile.in: Regenerate.
3934
3935 2010-12-15  Ian Lance Taylor  <iant@google.com>
3936
3937         PR gold/12324
3938         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3939         for R_X86_64_32 and R_X86_64_PC32.
3940         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3941         ver_matching_def_pic.o.
3942         (ver_matching_def_pic.o): New target.
3943
3944 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3945
3946         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3947         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3948         Move definition before File_read::View member definitions.
3949         (File_read::View::~View): Initialize and hold lock before
3950         updating current_mapped_bytes.
3951
3952 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3953
3954         * dwarf_reader.cc: Remove outdated comment.
3955         * gold-threads.cc: Fix typo in error message.
3956         * archive.cc: Fix typos in comments.
3957         * archive.h: Likewise.
3958         * arm-reloc-property.cc: Likewise.
3959         * arm-reloc-property.h: Likewise.
3960         * arm-reloc.def: Likewise.
3961         * arm.cc: Likewise.
3962         * attributes.h: Likewise.
3963         * cref.cc: Likewise.
3964         * ehframe.cc: Likewise.
3965         * fileread.h: Likewise.
3966         * gold.h: Likewise.
3967         * i386.cc: Likewise.
3968         * icf.cc: Likewise.
3969         * incremental.h: Likewise.
3970         * int_encoding.cc: Likewise.
3971         * layout.h: Likewise.
3972         * main.cc: Likewise.
3973         * merge.h: Likewise.
3974         * object.cc: Likewise.
3975         * object.h: Likewise.
3976         * options.cc: Likewise.
3977         * readsyms.cc: Likewise.
3978         * reduced_debug_output.cc: Likewise.
3979         * reloc.cc: Likewise.
3980         * script-sections.cc: Likewise.
3981         * sparc.cc: Likewise.
3982         * symtab.h: Likewise.
3983         * target-reloc.h: Likewise.
3984         * target.cc: Likewise.
3985         * target.h: Likewise.
3986         * timer.cc: Likewise.
3987         * timer.h: Likewise.
3988         * x86_64.cc: Likewise.
3989
3990 2010-12-09  Cary Coutant  <ccoutant@google.com>
3991
3992         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3993         stack.
3994         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3995         parameter; change all callers.
3996         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3997         * options.h (warn_execstack): New option.
3998
3999 2010-12-07  Doug Kwan  <dougkwan@google.com>
4000
4001         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4002         like function call relocations.
4003
4004 2010-12-07  Ian Lance Taylor  <iant@google.com>
4005
4006         * archive.cc (Archive::get_elf_object_for_member): Permit
4007         punconfigured to be NULL.
4008         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4009         (Archive::include_member): Pass NULL to get_elf_object_for_member
4010         if we searched for the archive and this is the first included
4011         object.
4012
4013 2010-12-01  Ian Lance Taylor  <iant@google.com>
4014
4015         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4016         track_relocs_type_ field.
4017         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4018         Set track_relocs_type_.
4019         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4020         contents when using RELA relocs.
4021         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4022         reloc_map_.
4023         * reloc.cc (Track_relocs::next_addend): New function.
4024         * reloc.h (class Track_relocs): Declare next_addend.
4025
4026 2010-12-01  Ian Lance Taylor  <iant@google.com>
4027
4028         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4029         virtual destructor.
4030
4031 2010-12-01  Ian Lance Taylor  <iant@google.com>
4032
4033         * README: Update compilers known to work and fail.
4034
4035 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4036
4037         * configure.in: For --enable-gold, handle value `default' instead of
4038         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4039         not the default.
4040         * configure: Regenerate.
4041
4042 2010-11-18  Doug Kwan  <dougkwan@google.com>
4043
4044         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4045         and right_alignment to be zero.  Store result alignment only if it is
4046         greater than existing alignment.
4047
4048 2010-11-16  Cary Coutant  <ccoutant@google.com>
4049
4050         PR gold/12220
4051         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4052         Check for ".zdebug_line".
4053
4054 2010-11-16  Doug Kwan  <dougkwan@google.com>
4055             Cary Coutant  <ccoutant@google.com>
4056
4057         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4058         by reference; adjust all callers.
4059         * output.cc (Output_segment::set_section_addresses): Adjust references
4060         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4061         list is empty.
4062         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4063         end at page boundary.
4064
4065 2010-11-16  Cary Coutant  <ccoutant@google.com>
4066
4067         PR gold/12220
4068         * layout.cc (Layout::choose_output_section): Transform names of
4069         compressed sections even when using a script with a SECTIONS clause.
4070         (Layout::output_section_name): Remove code to transform
4071         compressed debug section names.
4072         * output.cc (Output_section::add_input_section): Use uncompressed
4073         section size when tracking input sections.
4074
4075 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4076
4077         * symtab.h (Symbol::NON_PIC_REF): Remove.
4078         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4079         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4080         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4081         (Symbol::use_plt_offset): Take a flags argument and pass it
4082         directly to needs_dynamic_reloc.  Restrict check for undefined
4083         weak symbols to function calls.
4084         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4085         (Target_arm::Scan::global): Use it.
4086         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4087         (Target_arm::Relocate::relocate): Likewise.
4088         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4089         parameter with an r_type parameter.  Use get_reference_flags
4090         to get the flags.
4091         (Target_arm::Relocate::relocate): Update accordingly.
4092         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4093         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4094         (Target_i386::Scan::global): Likewise.
4095         (Target_i386::Relocate::relocate): Likewise.
4096         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4097         parameter with an r_type parameter.  Use get_reference_flags
4098         to get the flags.
4099         (Target_i386::Relocate::relocate): Update accordingly.
4100         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4101         (Target_powerpc::Scan::global): Use it.
4102         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4103         (Target_powerpc::Relocate::relocate): Likewise.
4104         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4105         (Target_sparc::Scan::global): Use it.
4106         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4107         (Target_sparc::Relocate::relocate): Likewise.
4108         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4109         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4110         (Target_x86_64::Scan::global): Likewise.
4111         (Target_x86_64::Relocate::relocate): Likewise.
4112
4113 2010-11-08  Doug Kwan  <dougkwan@google.com>
4114             Cary Coutant  <ccoutant@google.com>
4115
4116         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4117         (Arm_exidx_merge_section::section_contents_): New data member.
4118         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4119         (Arm_input_section::~Arm_input_section): De-allocate memory.
4120         (Arm_input_section::original_contents_): New data member.
4121         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4122         in parameters instead of calling Object::section_contents without
4123         locking.
4124         (Arm_output_section::group_section): New parameter TASK.  Pass it
4125         to callees that need locking objects.
4126         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4127         to lock EXIDX input sections.  Fix a formatting issue.  Call
4128         Arm_exidx_merged_section::build_contents to create merged section
4129         contents.
4130         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4131         to lock object of stub table owner.
4132         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4133         TEXT_SIZE to initialize data member TEXT_SIZE_.
4134         (Arm_exidx_input_section::addralign): Fix typo in comment.
4135         (Arm_exidx_input_section::text_size): New method.
4136         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4137         that require locking objects.  Lock objects before scanning for stubs
4138         and updating local symbols.
4139         (Arm_input_section<big_endian>::init): Copy contents of original
4140         input section.
4141         (Arm_input_section<big_endian>::do_write): Use saved contents of
4142         original input section instead of calling Object::section_contents
4143         without locking.
4144         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4145         size without calling Object::section_size().
4146         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4147         for size.  Allocate a buffer for merged EXIDX entries.
4148         (Arm_exidx_merged_section::build_contents): New method.
4149         (Arm_exidx_merged_section::do_write): Move merge section contents
4150         building code to Arm_exidx_merged_section::build_contetns.  Write
4151         out contetns in buffer instead of building it on the fly.
4152         (Arm_relobj::make_exidx_input_section): Also pass text section size
4153         to Arm_exidx_input_section constructor.
4154         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4155         (Arm_dynobj::do_read_symbols): Fix memory leak.
4156         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4157         * target.h: (class Task): Add forward declaration.
4158         (Target::relax): Add new parameter TASK and pass it to
4159         Target::do_relax().
4160         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4161
4162 2010-11-05  Cary Coutant  <ccoutant@google.com>
4163
4164         PR gold/10708
4165         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4166         object when reading from the file.
4167         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4168         second layout pass.
4169         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4170         when reading section contents.
4171         (get_section_contents): Likewise.
4172         (icf::find_identical_sections): Likewise.
4173         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4174         object when reading from the file.
4175         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4176         the object when doing deferred section layout.
4177
4178 2010-11-03  Nick Clifton  <nickc@redhat.com>
4179
4180         PR gold/12001
4181         * script.h (class Symbol_assignment: name): New member.  Returns
4182         the name of the symbol.
4183         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4184         Returns true if the given symbol name is on the list of
4185         assignments wating to be processed.
4186         * archive.cc (should_incldue_member): If the symbol is undefined,
4187         check to see if it is on the list of symbols pending assignment.
4188
4189 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4190
4191         * script-sections.cc (Script_sections::find_memory_region): Check
4192         for a NULL output section pointer.
4193
4194 2010-10-29  Doug Kwan  <dougkwan@google.com>
4195
4196         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4197         Output_section::add_relaxed_input_section.
4198         * output.cc (Output_section::add_relaxed_input_section): Add new
4199         arguments LAYOUT and NAME.  Set section order index.
4200         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4201         Copy section order index.
4202         * output.h (Output_section::add_relaxed_input_section): Add new
4203         arguments LAYOUT and NAME.
4204
4205 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4206
4207         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4208         NATIVE_OR_CROSS_LINKER.
4209         * testsuite/Makefile.in: Regenerate.
4210
4211 2010-10-20  Doug Kwan  <dougkwan@google.com>
4212
4213         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4214         without SHF_LINK_ORDER flags.
4215         * layout.cc (Layout::choose_output_section): Do not filter
4216         SHF_LINK_ORDER flag in a relocatable link.
4217
4218 2010-10-17  Cary Coutant  <ccoutant@google.com>
4219
4220         * output.h (Output_segment::set_section_addresses): Change function
4221         signature.  Update all callers.
4222         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4223         sections.
4224         (Output_segment::set_section_addresses): Align after last TLS
4225         section.  Add padding before last relro section instead of after.
4226
4227 2010-10-17  Doug Kwan  <dougkwan@google.com>
4228
4229         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4230         GOT output section to be writable.
4231
4232 2010-10-14  Cary Coutant  <ccoutant@google.com>
4233
4234         * debug.h (DEBUG_INCREMENTAL): New flag.
4235         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4236         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4237         mode.
4238         * incremental.cc (report_command_line): Ignore all forms of
4239         --incremental.
4240         * layout.cc (Layout::Layout): Check parameters for incremental link
4241         mode.
4242         * options.cc (General_options::parse_incremental): New function.
4243         (General_options::parse_no_incremental): New function.
4244         (General_options::parse_incremental_full): New function.
4245         (General_options::parse_incremental_update): New function.
4246         (General_options::incremental_mode_): New data member.
4247         (General_options::finalize): Check incremental_mode_.
4248         * options.h (General_options): Update help text for --incremental.
4249         Add --no-incremental, --incremental-full, --incremental-update.
4250         (General_options::Incremental_mode): New enum type.
4251         (General_options::incremental_mode): New function.
4252         (General_options::incremental_mode_): New data member.
4253         * parameters.cc (Parameters::incremental_mode_): New data member.
4254         (Parameters::set_options): Set incremental_mode_.
4255         (Parameters::set_incremental_full): New function.
4256         (Parameters::incremental): New function.
4257         (Parameters::incremental_update): New function.
4258         (set_parameters_incremental_full): New function.
4259         * parameters.h (Parameters::set_incremental_full): New function.
4260         (Parameters::incremental): New function.
4261         (Parameters::incremental_update): New function.
4262         (Parameters::incremental_mode_): New data member.
4263         (set_parameters_incremental_full): New function.
4264         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4265         incremental link mode.
4266         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4267         (Sized_relobj::do_relocate_sections): Likewise.
4268         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4269         option.
4270         * testsuite/Makefile.in: Regenerate.
4271         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4272
4273 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4274
4275         * script-sections.h (class Script_sections): Make
4276         Sections_elements typedef public.
4277         * script-sections.cc (class Sort_output_sections): Add elements_
4278         field.  Add constructor which sets it; change all callers.
4279         (Sort_output_sections::is_before): New function.
4280         (Sort_output_sections::operator()): Call is_before.
4281         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4282         conditional.
4283         * testsuite/script_test_10.sh: New test. Test script section
4284         order.
4285         * testsuite/script_test_10.t: Likewise.
4286         * testsuite/script_test_10.s: Likewise.
4287         * testsuite/Makefile.am: Wrap the cross linker tests and the
4288         common tests into NATIVE_OR_CROSS_LINKER.
4289         (check_SCRIPTS): Add script_test_10.sh.
4290         (check_DATA): Add script_test_10.stdout.
4291         (script_test_10.o, script_test_10): New targets.
4292         (script_test_10.stdout): New target.
4293         * configure, testsuite/Makefile.in: Regenerate.
4294
4295 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4296
4297         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4298         error for the deprecated relocations.
4299         (Target_arm::Scan::global): Likewise.
4300         (Target_arm::Relocate::relocate): Likewise.
4301
4302 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4303
4304         * fileread.cc (Input_file::find_file): Initialize *found_name
4305         and *namep when using the fallback search for case 4.
4306
4307 2010-10-11  Cary Coutant  <ccoutant@google.com>
4308
4309         * options.h (class General_options): Redefine -z lazy as an alias for
4310         the negation of -z now.
4311
4312 2010-10-11  Ian Lance Taylor  <iant@google.com>
4313
4314         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4315         binding.
4316
4317 2010-10-06  Nick Clifton  <nickc@redhat.com>
4318
4319         * script-sections.cc(class Memory_region): Remove
4320         current_lma_offset_ field.  Rename current_vma_offset_ to
4321         current_offset_.  Add last_section_ field.
4322         (Memory_region::get_current_vma_address): Rename to
4323         get_current_address.
4324         (Memory_region::get_current_lma_address): Delete.
4325         (Memory_region::increment_vma_offset): Rename to
4326         increment_offset.
4327         (Memory_region::increment_lma_offset): Delete.
4328         (Memory_region::attributes_compatible): New method.  Returns
4329         true if the provided section is compatible with the region.
4330         (Memory_region::get_last_section): New method.  Returns the last
4331         section to use the region.
4332         (Memory_region::set_last_section): New method.  Stores the last
4333         section to use the region.
4334         (Script_sections::block_in_region): New method.  Returns true if
4335         a block of memory is contained within a region.
4336         (Script_sections::find_memory_region): New method.  Locates a
4337         memory region to be used to set a VMA or LMA address.
4338         (Output_section_definition::set_section_addresses): Add code to
4339         check for addresses set by memory regions.
4340         (Output_segment::set_section_addresses): Remove memory region
4341         walking code.
4342         (Script_sections::create_segment): Add a warning if a header
4343         segment is created outside of any region.
4344         * script-sections.h (class Script_sections): Add prototypes for
4345         find_memory_region and block_in_region methods.
4346         * testsuite/memory_test.s: Use .long instead of .word.
4347         * testsuite/memory_test.t: Add some more output sections.
4348         * testsuite/memory_test.sh: Update expected output.
4349
4350 2010-10-02  Doug Kwan  <dougkwan@google.com>
4351
4352         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4353         defintion to symtab.h
4354         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4355         declaration to defintion.
4356
4357 2010-10-01  Nick Clifton  <nickc@redhat.com>
4358
4359         * expression.cc (eval): Replace dummy argument with NULL.
4360         (eval_maybe_dot): Check for a NULL result section pointer.
4361         (Symbol_expression::value): Likewise.
4362         (Dot_expression::value): Likewise.
4363         (BINARY_EXPRESSION): Likewise.
4364         (Max_expression::value): Likewise.
4365         (Min_expression::value): Likewise.
4366         (Absolute_expression::value): Likewise.
4367         (Addr_expression::value_from_output_section): Likewise.
4368         (Loaddddr_expression::value_from_output_section): Likewise.
4369         (Segment_start_expression::value): Likewise.
4370         * script-sections.cc
4371         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4372         argument with NULL.
4373         (Sections_elememt_dot_assignment::set_section_addresses):
4374         Likewise.
4375         (Output_data_expression::do_write_to_buffer): Likewise.
4376         (Output_section_definition::finalize_symbols): Likewise.
4377         (Output_section_definition::set_section_addresses): Likewise.
4378
4379 2010-09-30  Doug Kwan  <dougkwan@google.com>
4380
4381         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4382
4383 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4384
4385         * target.h (Target::can_icf_inline_merge_sections): New virtual
4386         function.
4387         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4388         virtual function.
4389         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4390         virtual function.
4391         * icf.cc (get_section_contents): Inline merge sections only when
4392         target allows it.
4393
4394 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4395
4396         * configure: Regenerate.
4397
4398 2010-09-17  Ian Lance Taylor  <iant@google.com>
4399
4400         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4401         * testsuite/Makefile.am (memory_test.o): New target.
4402         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4403         memory_test.t.
4404         * testsuite/Makefile.in: Rebuild.
4405
4406 2010-09-17  Doug Kwan  <dougkwan@google.com>
4407
4408         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4409         defintion if relocation uses GOT entries of the symbol.
4410         * testsuite/icf_safe_test.sh: Fix test.
4411         * testsuite/icf_safe_so_test.sh: Fix test.
4412
4413 2010-09-16  Cary Coutant  <ccoutant@google.com>
4414
4415         * script_sections.cc (class Memory_region): Remove "NULL" from
4416         vector initializations.
4417
4418 2010-09-15  Cary Coutant  <ccoutant@google.com>
4419
4420         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4421         Resolve forwarding symbols.
4422
4423 2010-09-15  Doug Kwan  <dougkwan@google.com>
4424
4425         * gold/testsuite/script_test_3.t: Add ARM special sections.
4426         * gold/testsuite/script_test_4.t: Same.
4427         * gold/testsuite/script_test_5.t: Same.
4428         * gold/testsuite/script_test_6.t: Same.
4429         * gold/testsuite/script_test_7.t: Same.
4430         * gold/testsuite/script_test_7.t: Same.
4431         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4432
4433 2010-09-14  Cary Coutant  <ccoutant@google.com>
4434
4435         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4436         (Target_x86_64::Relocate::relocate_tls): Replace check for
4437         saw_tls_block_reloc_ with test for executable section.
4438
4439 2010-09-12  Cary Coutant  <ccoutant@google.com>
4440
4441         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4442         position-independent executables to shared libraries need dynamic
4443         relocations.
4444         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4445         position-independent executables.
4446         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4447         * testsuite/Makefile.in: Regenerate.
4448
4449 2010-09-10  Nick Clifton  <nickc@redhat.com>
4450
4451         PR gold/11997
4452         * testsuite/memory_test.t: Discard any sections that are not
4453         needed.
4454
4455 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4456
4457         PR gold/11996
4458         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4459         "This::" to work around a bug in gcc 4.2.
4460
4461         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4462
4463 2010-09-09  Rafael Espindola  <espindola@google.com>
4464
4465         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4466         sections with different PF_X flags in the same segment.
4467         (Layout::find_first_load_seg): Search all segments to find the first
4468         one.
4469         * options.h (rosegment): New.
4470
4471 2010-09-08  Rafael Espindola  <espindola@google.com>
4472
4473         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4474
4475 2010-09-08  Doug Kwan  <dougkwan@google.com>
4476
4477         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4478         (Arm_relobj::do_relocate_sections): Add new parameter for output
4479         file to match the parent.
4480         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4481         of local symbols instead of input values.  Update code to track
4482         changes in gold::relocate_section.
4483         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4484         (Sized_relobj::compute_final_local_value_internal): New methods.
4485         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4486         body into private version of Sized_relobj::compute_final_local_value.
4487         Call the inline method.
4488         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4489         merged symbol value if there is one.
4490         (Symbol_value::has_output_value): New method defintiion.
4491         (Sized_relobj::Compute_final_local_value_status): New enum type.
4492         (Sized_relobj::compute_final_local_value): New methods.
4493         (Sized_relobj::compute_final_local_value_internal): New methods.
4494         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4495         and arm_cortex_a8.sh.
4496         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4497         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4498         New tests.
4499         * Makefile.in: Regenerate.
4500         * testsuite/arm_bl_out_of_range.s: Update test.
4501         * testsuite/thumb_bl_out_of_range.s: Ditto.
4502         * testsuite/thumb_blx_out_of_range.s: Ditto.
4503         * testsuite/arm_branch_out_of_range.sh: New file.
4504         * testsuite/arm_cortex_a8.sh: Ditto.
4505         * testsuite/arm_cortex_a8_b.s: Ditto.
4506         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4507         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4508         * testsuite/arm_cortex_a8_bl.s: Ditto.
4509         * testsuite/arm_cortex_a8_blx.s: Ditto.
4510         * testsuite/arm_cortex_a8_local.s: Ditto.
4511         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4512         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4513
4514 2010-09-08  Rafael Espindola  <espindola@google.com>
4515
4516         * Makefile.am (memory_test.stdout): Run readelf with -W.
4517         * Makefile.in: Regenerate.
4518         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4519         64 bit output.
4520
4521 2010-09-08  Rafael Espindola  <espindola@google.com>
4522
4523         * script-sections.cc (Script_sections::add_memory_region): Convert
4524         field precision to int.
4525         * script.cc (script_set_section_region, script_set_section_region):
4526         Convert field precision to int.
4527
4528 2010-09-08  Rafael Espindola  <espindola@google.com>
4529
4530         * arm.cc (do_finalize_sections): Create the __exidx_start and
4531         __exdix_end symbols even when the section is missing.
4532
4533 2010-09-08  Nick Clifton  <nickc@redhat.com>
4534
4535         * README: Remove claim that MEMORY is not supported.
4536         * expression.cc (script_exp_function_origin)
4537         (script_exp_function_length): Move from here to ...
4538         * script.cc: ... here.
4539         (script_set_section_region, script_add_memory)
4540         (script_parse_memory_attr, script_include_directive): New
4541         functions.
4542         * script-sections.cc
4543         (class Memory_region): New class.
4544         (class Output_section_definition): Add set_memory_region,
4545         set_section_vma, set_section_lma and get_section_name methods.
4546         (class Script_Sections): Add add_memory_region,
4547         find_memory_region, find_memory_region_origin,
4548         find_memory_region_length and set_memory_region methods.
4549         Have set_section_addresses method walk the list of set memory
4550         regions.
4551         Extend the print methos to display memory regions.
4552         * script-sections.h: Add prototypes for new methods.
4553         Add enum for MEMORY region attributes.
4554         * yyscript.y: Add support for parsing MEMORY regions.
4555         * script-c.h: Add prototypes for new functions.
4556         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4557         * testsuite/Makefile.in: Regenerate.
4558         * testsuite/memory_test.sh: New script.
4559         * testsuite/memory_test.s: New assembler source file.
4560         * testsuite/memory_test.t: New linker script.
4561
4562 2010-08-27  Doug Kwan  <dougkwan@google.com>
4563
4564         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4565         reference override an existing dynamic weak reference.
4566         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4567         * testsuite/Makefile.in: Regenerate.
4568         * testsuite/dyn_weak_ref.sh: New file.
4569         * testsuite/dyn_weak_ref_1.c: Ditto.
4570         * testsuite/dyn_weak_ref_2.c: Ditto.
4571
4572 2010-08-27  Ian Lance Taylor  <iant@google.com>
4573
4574         * incremental.h (class Incremental_input_entry): Add virtual
4575         destructor.
4576
4577 2010-08-27  Ian Lance Taylor  <iant@google.com>
4578
4579         * testsuite/start_lib_test_3.c: Mark t3 as used.
4580
4581 2010-08-27  Nick Clifton  <nickc@redhat.com>
4582
4583         * options.cc (version_script): Fix small typo in previous
4584         whitespace tidyup.
4585
4586 2010-08-25  Nick Clifton  <nickc@redhat.com>
4587
4588         * archive.cc: Formatting fixes: Remove whitespace between
4589         typename and following asterisk.  Remove whitespace between
4590         function name and opening parenthesis.
4591         * archive.h: Likewise.
4592         * arm.cc: Likewise.
4593         * attributes.cc: Likewise.
4594         * attributes.h: Likewise.
4595         * common.cc: Likewise.
4596         * copy-relocs.cc: Likewise.
4597         * dirsearch.h: Likewise.
4598         * dynobj.cc: Likewise.
4599         * ehframe.cc: Likewise.
4600         * ehframe.h: Likewise.
4601         * expression.cc: Likewise.
4602         * fileread.cc: Likewise.
4603         * fileread.h: Likewise.
4604         * gc.h: Likewise.
4605         * gold-threads.cc: Likewise.
4606         * gold.cc: Likewise.
4607         * i386.cc: Likewise.
4608         * icf.h: Likewise.
4609         * incremental-dump.cc: Likewise.
4610         * incremental.cc: Likewise.
4611         * layout.cc: Likewise.
4612         * layout.h: Likewise.
4613         * main.cc: Likewise.
4614         * merge.cc: Likewise.
4615         * merge.h: Likewise.
4616         * object.cc: Likewise.
4617         * object.h: Likewise.
4618         * options.cc: Likewise.
4619         * options.h: Likewise.
4620         * output.cc: Likewise.
4621         * output.h: Likewise.
4622         * plugin.cc: Likewise.
4623         * plugin.h: Likewise.
4624         * powerpc.cc: Likewise.
4625         * reloc.cc: Likewise.
4626         * script-c.h: Likewise.
4627         * script-sections.cc: Likewise.
4628         * script.cc: Likewise.
4629         * stringpool.cc: Likewise.
4630         * symtab.cc: Likewise.
4631         * symtab.h: Likewise.
4632         * target.cc: Likewise.
4633         * timer.cc: Likewise.
4634         * timer.h: Likewise.
4635         * version.cc: Likewise.
4636         * x86_64.cc: Likewise.
4637
4638 2010-08-24  Nick Clifton  <nickc@redhat.com>
4639
4640         PR 11899
4641         * layout.cc (segment_precedes): Sort segments by their physical
4642         addresses, if they have been set.
4643
4644 2010-08-23  Cary Coutant  <ccoutant@google.com>
4645
4646         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4647         symbols data.
4648         (Lib_group::include_member): Unlock object after deleting its
4649         symbols data.
4650         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4651         the bug fixed here.
4652
4653 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4654             Cary Coutant  <ccoutant@google.com>
4655
4656         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4657         constructor, and set_blocker.
4658         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4659         readsyms_blocker_.
4660         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4661         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4662         * testsuite/Makefile.am (start_lib_test): New test case.
4663         * testsuite/Makefile.in: Regenerate.
4664         * testsuite/start_lib_test_main.c: New file.
4665         * testsuite/start_lib_test_1.c: New file.
4666         * testsuite/start_lib_test_2.c: New file.
4667         * testsuite/start_lib_test_3.c: New file.
4668
4669 2010-08-19  Ian Lance Taylor  <iant@google.com>
4670
4671         * Makefile.in: Rebuild with automake 1.11.1.
4672         * aclocal.m4: Likewise.
4673         * testsuite/Makefile.in: Likewise.
4674
4675 2010-08-19  Ian Lance Taylor  <iant@google.com>
4676
4677         PR 10893
4678         * i386.cc (class Output_data_plt_i386): Update declarations.
4679         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4680         local_ifuncs_ fields.
4681         (Target_i386::do_plt_section_for_global): New function.
4682         (Target_i386::do_plt_section_for_local): New function.
4683         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4684         parameter; change all callers.  Initialize global_ifuncs_ and
4685         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4686         __rel_iplt_end.
4687         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4688         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4689         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4690         symbols.
4691         (Target_i386::make_plt_section): New function, broken out of
4692         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4693         (Target_i386::make_plt_entry): Call make_plt_section.
4694         (Target_i386::make_local_ifunc_plt_entry): New function.
4695         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4696         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4697         R_386_IRELATIVE to switch.
4698         (Target_i386::Scan::global): Likewise.
4699         (Target_i386::Relocate::relocate): Likewise.
4700         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4701         switch.
4702         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4703         (Target_x86_64::do_plt_section_for_global): New function.
4704         (Target_x86_64::do_plt_section_for_local): New function.
4705         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4706         parameter; change all callers.  If doing a static link define
4707         __rela_iplt_start and __rela_iplt_end.
4708         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4709         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4710         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4711         to point to .plt.
4712         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4713         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4714         switch.
4715         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4716         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4717         R_X86_64_IRELATIVE to switch.
4718         (Target_x86_64::Scan::global): Likewise.
4719         (Target_x86_64::Relocate::relocate): Likewise.
4720         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4721         switch.
4722         * target.h (class Target): Add plt_section_for_global and
4723         plt_section_for_local functions.  Add do_plt_section_for_global
4724         and do_plt_section_for_local virtual functions.
4725         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4726         clarifying comments.
4727         (Symbol::use_plt_offset): Handle IFUNC symbol.
4728         * object.cc (Sized_relobj::Sized_relobj): Initialize
4729         local_plt_offsets_.
4730         (Sized_relobj::local_has_plt_offset): New function.
4731         (Sized_relobj::local_plt_offset): New function.
4732         (Sized_relobj::set_local_plt_offset): New function.
4733         (Sized_relobj::do_count): Handle IFUNC symbol.
4734         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4735         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4736         is_ifunc_symbol functions.
4737         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4738         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4739         local_plt_offsets_ field.
4740         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4741         * output.h (class Output_section_data): Add non-const
4742         output_section function.
4743         (class Output_data_got): Update declarations.
4744         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4745         Add use_plt_offset parameter to global and local constructors.
4746         Change all callers.  Change local_sym_index_ field to 31 bits.
4747         Change GSYM_CODE and CONSTANT_CODE accordingly.
4748         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4749         doing a static link don't set sh_link field.
4750         (Output_data_got::Got_entry::write): Use PLT offset if
4751         appropriate.
4752         (Output_data_got::add_global_plt): New function.
4753         (Output_data_got::add_local_plt): New function.
4754         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4755         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4756         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4757         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4758         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4759         IFUNC conditional.
4760         * testsuite/ifunc-sel.h: New file.
4761         * testsuite/ifuncmain1.c: New file.
4762         * testsuite/ifuncmain1vis.c: New file.
4763         * testsuite/ifuncmod1.c: New file.
4764         * testsuite/ifuncdep2.c: New file.
4765         * testsuite/ifuncmain2.c: New file.
4766         * testsuite/ifuncmain3.c: New file.
4767         * testsuite/ifuncmod3.c: New file.
4768         * testsuite/ifuncmain4.c: New file.
4769         * testsuite/ifuncmain5.c: New file.
4770         * testsuite/ifuncmod5.c: New file.
4771         * testsuite/ifuncmain6pie.c: New file.
4772         * testsuite/ifuncmod6.c: New file.
4773         * testsuite/ifuncmain7.c: New file.
4774         * configure, testsuite/Makefile.in: Rebuild.
4775
4776 2010-08-18  Ian Lance Taylor  <iant@google.com>
4777
4778         * incremental.cc
4779         (Output_section_incremental_inputs::write_input_files): Add cast
4780         to avoid signed/unsigned comparison warning.
4781         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4782
4783 2010-08-12  Cary Coutant  <ccoutant@google.com>
4784
4785         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4786
4787 2010-08-13  Ian Lance Taylor  <iant@google.com>
4788
4789         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4790
4791 2010-08-12  Cary Coutant  <ccoutant@google.com>
4792             Doug Kwan  <dougkwan@google.com>
4793
4794         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4795         defintion overrides non-weak undef, remember that the original undef
4796         is not weak.
4797         * symtab.cc (Symbol_table::sized_write_global): For undef without
4798         an original weak binding, set binding to global in output.
4799         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4800         * testsuite/Makefile.in: Regenerate.
4801         * testsuite/strong_ref_weak_def.sh: New file.
4802         * testsuite/strong_ref_weak_def_1.c: Ditto.
4803         * testsuite/strong_ref_weak_def_2.c: Ditto.
4804
4805 2010-08-12  Cary Coutant  <ccoutant@google.com>
4806
4807         * testsuite/incremental_test.sh: Rewrite.
4808         * testsuite/incremental_test_1.c: Rewrite.
4809         * testsuite/incremental_test_2.c: Rewrite.
4810
4811 2010-08-12  Cary Coutant  <ccoutant@google.com>
4812
4813         * arm.cc (Target_arm::got_size): Add const.
4814         (Target_arm::got_entry_count): New function.
4815         (Target_arm::plt_entry_count): New function.
4816         (Target_arm::first_plt_entry_offset): New function.
4817         (Target_arm::plt_entry_size): New function.
4818         (Output_data_plt_arm::entry_count): New function.
4819         (Output_data_plt_arm::first_plt_entry_offset): New function.
4820         (Output_data_plt_arm::get_plt_entry_size): New function.
4821         * i386.cc (Target_i386::got_size): Add const.
4822         (Target_i386::got_entry_count): New function.
4823         (Target_i386::plt_entry_count): New function.
4824         (Target_i386::first_plt_entry_offset): New function.
4825         (Target_i386::plt_entry_size): New function.
4826         (Output_data_plt_i386::entry_count): New function.
4827         (Output_data_plt_i386::first_plt_entry_offset): New function.
4828         (Output_data_plt_i386::get_plt_entry_size): New function.
4829         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4830         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4831         * incremental.cc: Include target.h.
4832         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4833         parameter.  Adjust all callers.  Find incremental_got_plt section.
4834         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4835         section.
4836         (Output_section_incremental_inputs::set_final_data_size): Calculate
4837         size of incremental_got_plt section.
4838         (Output_section_incremental_inputs::do_write): Write the
4839         incremental_got_plt section.
4840         (Got_plt_view_info): New struct.
4841         (Local_got_offset_visitor): New class.
4842         (Global_got_offset_visitor): New class.
4843         (Global_symbol_visitor_got_plt): New class.
4844         (Output_section_incremental_inputs::write_got_plt): New function.
4845         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4846         Add parameter.  Adjust all callers.
4847         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4848         (Incremental_inputs::got_plt_section): New function.
4849         (Incremental_inputs::got_plt_section_): New data member.
4850         (Incremental_got_plt_reader): New class.
4851         * layout.cc (Layout::create_incremental_info_sections): Add the
4852         incremental_got_plt section.
4853         * object.h (Got_offset_list::get_list): New function.
4854         (Got offset_list::for_all_got_offsets): New function.
4855         (Sized_relobj::local_got_offset_list): New function.
4856         * powerpc.cc (Target_powerpc::got_size): Add const.
4857         (Target_powerpc::got_entry_count): New function.
4858         (Target_powerpc::plt_entry_count): New function.
4859         (Target_powerpc::first_plt_entry_offset): New function.
4860         (Target_powerpc::plt_entry_size): New function.
4861         (Output_data_plt_powerpc::entry_count): New function.
4862         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4863         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4864         * sparc.cc (Target_sparc::got_size): Add const.
4865         (Target_sparc::got_entry_count): New function.
4866         (Target_sparc::plt_entry_count): New function.
4867         (Target_sparc::first_plt_entry_offset): New function.
4868         (Target_sparc::plt_entry_size): New function.
4869         (Output_data_plt_sparc::entry_count): New function.
4870         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4871         (Output_data_plt_sparc::get_plt_entry_size): New function.
4872         * symtab.h (Symbol::got_offset_list): New function.
4873         (Symbol_table::for_all_symbols): New function.
4874         * target.h (Sized_target::got_entry_count): New function.
4875         (Sized_target::plt_entry_count): New function.
4876         (Sized_target::plt_entry_size): New function.
4877         * x86_64.cc (Target_x86_64::got_size): Add const.
4878         (Target_x86_64::got_entry_count): New function.
4879         (Target_x86_64::plt_entry_count): New function.
4880         (Target_x86_64::first_plt_entry_offset): New function.
4881         (Target_x86_64::plt_entry_size): New function.
4882         (Output_data_plt_x86_64::entry_count): New function.
4883         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4884         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4885
4886 2010-08-12  Cary Coutant  <ccoutant@google.com>
4887
4888         * archive.cc: Include incremental.h.
4889         (Archive::Archive): Initialize incremental_info_.
4890         (Archive::include_member): Record archive members in incremental info.
4891         (Add_archive_symbols::run): Record begin and end of an archive in
4892         incremental info.
4893         (Lib_group::include_member): Record objects in incremental info.
4894         * archive.h (Incremental_archive_entry): Forward declaration.
4895         (Archive::set_incremental_info): New member function.
4896         (Archive::incremental_info): New member function.
4897         (Archive::Unused_symbol_iterator): New class.
4898         (Archive::unused_symbols_begin): New member function.
4899         (Archive::unused_symbols_end): New member function.
4900         (Archive::incremental_info_): New data member.
4901         * incremental-dump.cc (find_input_containing_global): New function.
4902         (dump_incremental_inputs): Dump new incremental info sections.
4903         * incremental.cc: Include symtab.h.
4904         (Output_section_incremental_inputs): New class.
4905         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4906         new incremental info sections.
4907         (Sized_incremental_binary::do_check_inputs): Likewise.
4908         (Incremental_inputs::report_archive): Remove.
4909         (Incremental_inputs::report_archive_begin): New function.
4910         (Incremental_inputs::report_archive_end): New function.
4911         (Incremental_inputs::report_object): New function.
4912         (Incremental_inputs::finalize_inputs): Remove.
4913         (Incremental_inputs::report_input_section): New function.
4914         (Incremental_inputs::report_script): Rewrite.
4915         (Incremental_inputs::finalize): Do nothing but finalize string table.
4916         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4917         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4918         (Incremental_inputs::create_data_sections): New function.
4919         (Incremental_inputs::relocs_entsize): New function.
4920         (Output_section_incremental_inputs::set_final_data_size): New function.
4921         (Output_section_incremental_inputs::do_write): New function.
4922         (Output_section_incremental_inputs::write_header): New function.
4923         (Output_section_incremental_inputs::write_input_files): New function.
4924         (Output_section_incremental_inputs::write_info_blocks): New function.
4925         (Output_section_incremental_inputs::write_symtab): New function.
4926         * incremental.h (Incremental_script_entry): Forward declaration.
4927         (Incremental_object_entry): Forward declaration.
4928         (Incremental_archive_entry): Forward declaration.
4929         (Incremental_inputs): Forward declaration.
4930         (Incremental_inputs_header_data): Remove.
4931         (Incremental_inputs_header): Remove.
4932         (Incremental_inputs_header_write): Remove.
4933         (Incremental_inputs_entry_data): Remove.
4934         (Incremental_inputs_entry): Remove.
4935         (Incremental_inputs_entry_write): Remove.
4936         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4937         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4938         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4939         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4940         Likewise.
4941         (Incremental_input_entry): New class.
4942         (Incremental_script_entry): New class.
4943         (Incremental_object_entry): New class.
4944         (Incremental_archive_entry): New class.
4945         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4946         (Incremental_inputs::report_inputs): Remove.
4947         (Incremental_inputs::report_archive): Remove.
4948         (Incremental_inputs::report_archive_begin): New function.
4949         (Incremental_inputs::report_archive_end): New function.
4950         (Incremental_inputs::report_object): Change prototype.
4951         (Incremental_inputs::report_input_section): New function.
4952         (Incremental_inputs::report_script): Change prototype.
4953         (Incremental_inputs::get_reloc_count): New function.
4954         (Incremental_inputs::set_reloc_count): New function.
4955         (Incremental_inputs::create_data_sections): New function.
4956         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4957         (Incremental_inputs::inputs_section): New function.
4958         (Incremental_inputs::symtab_section): New function.
4959         (Incremental_inputs::relocs_section): New function.
4960         (Incremental_inputs::get_stringpool): Add const.
4961         (Incremental_inputs::command_line): Add const.
4962         (Incremental_inputs::inputs): Remove.
4963         (Incremental_inputs::command_line_key): New function.
4964         (Incremental_inputs::input_file_count): New function.
4965         (Incremental_inputs::input_files): New function.
4966         (Incremental_inputs::relocs_entsize): New function.
4967         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4968         (Incremental_inputs::finalize_inputs): Remove.
4969         (Incremental_inputs::Input_info): Remove.
4970         (Incremental_inputs::lock_): Remove.
4971         (Incremental_inputs::inputs_): Change type.
4972         (Incremental_inputs::inputs_map_): Remove.
4973         (Incremental_inputs::current_object_entry_): New data member.
4974         (Incremental_inputs::inputs_section_): New data member.
4975         (Incremental_inputs::symtab_section_): New data member.
4976         (Incremental_inputs::relocs_section_): New data member.
4977         (Incremental_inputs::reloc_count_): New data member.
4978         (Incremental_inputs_reader): New class.
4979         (Incremental_symtab_reader): New class.
4980         (Incremental_relocs_reader): New class.
4981         * layout.cc (Layout::finalize): Move finalization of incremental info
4982         and creation of incremental info sections to follow finalization of
4983         symbol table.  Set offsets for postprocessing sections.
4984         (Layout::create_incremental_info_sections): Call
4985         Incremental_inputs::create_data_sections.  Add incremental symtab
4986         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4987         sections to layout after input sections.
4988         * layout.h (struct Timespec): Forward declaration.
4989         (Layout::incremental_inputs): Add const.
4990         (Layout::create_incremental_info_sections): Add parameter.
4991         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4992         * object.cc: Include incremental.h.
4993         (Relobj::finalize_incremental_relocs): New function.
4994         (Sized_relobj::do_layout): Record input sections in incremental info.
4995         * object.h (Object::output_section): New function.
4996         (Object::output_section_offset): Moved from Relobj.
4997         (Object::get_incremental_reloc_base): New function.
4998         (Object::get_incremental_reloc_count): New function.
4999         (Object::do_output_section): New function.
5000         (Object::do_output_section_offset): Moved from Relobj.
5001         (Object::do_get_incremental_reloc_base): New function.
5002         (Object::do_get_incremental_reloc_count): New function.
5003         (Object::Object): Initialize new data members.
5004         (Relobj::output_section): Renamed do_output_section and moved to
5005         protected.
5006         (Relobj::output_section_offset): Moved to Object.
5007         (Relobj::do_get_incremental_reloc_base): New function.
5008         (Relobj::do_get_incremental_reloc_count): New function.
5009         (Relobj::allocate_incremental_reloc_counts): New function.
5010         (Relobj::count_incremental_reloc): New function.
5011         (Relobj::finalize_incremental_relocs): New function.
5012         (Relobj::next_incremental_reloc_index): New function.
5013         (Relobj::reloc_counts_): New data member.
5014         (Relobj::reloc_bases_): New data member.
5015         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5016         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5017         (Sized_relobj::incremental_relocs_scan): New function.
5018         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5019         (Sized_relobj::incremental_relocs_write): New function.
5020         (Sized_relobj::incremental_relocs_write_reltype): New function.
5021         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5022         incremental link.
5023         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5024         archives and object files elsewhere.
5025         (Add_symbols::run): Report object files here.
5026         (Finish_group::run): Report end of archive at end of group.
5027         * reloc.cc: Include layout.h, incremental.h.
5028         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5029         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5030         (Sized_relobj::incremental_relocs_scan): New function.
5031         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5032         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5033         (Sized_relobj::incremental_relocs_write): New function.
5034         (Sized_relobj::incremental_relocs_write_reltype): New function.
5035         * script.cc (read_input_script): Rewrite test for incremental link.
5036         Change call to Incremental_inputs::report_script.
5037         * symtab.h (Symbol_table::first_global_index): New function.
5038         (Symbol_table::output_count): New function.
5039
5040 2010-08-12  Doug Kwan  <dougkwan@google.com>
5041
5042         * arm.cc (Target_arm::merge_object_attributes): Check command line
5043         options --no-wchar-size-warning and --no-enum-size-warning.
5044         * options.h (General_options): Add ld-compatible options
5045         --no-enum-size-warning and --no-wchar-size-warning.
5046
5047 2010-08-04  Ian Lance Taylor  <iant@google.com>
5048
5049         * x86_64.cc (Target_x86_64::Scan::local): Use
5050         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5051         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5052         (Target_x86_64::Scan::global): Likewise.
5053         (Target_x86_64::Relocate::relocate): Likewise.
5054         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5055         Likewise.
5056
5057 2010-08-03  Cary Coutant  <ccoutant@google.com>
5058
5059         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5060         to reserve space in merged_strings vector. Keep total input size
5061         for stats.
5062         (Output_merge_string::do_print_merge_stats): Print total input size.
5063         * merge.h (Output_merge_string): Add input_size_ field.
5064         * stringpool.cc (Stringpool_template::string_length): Move
5065         implementations out of Stringpool_template class and place in
5066         stringpool.h.
5067         * stringpool.h (string_length): Move out of Stringpool_template.
5068
5069 2010-08-03  Ian Lance Taylor  <iant@google.com>
5070
5071         PR 11712
5072         * layout.cc (relaxation_loop_body): If address of load segment is
5073         set, adjust address to include headers if possible.
5074
5075 2010-08-03  Ian Lance Taylor  <iant@google.com>
5076
5077         * version.cc (version_string): Bump to 1.10.
5078
5079 2010-08-03  Ian Lance Taylor  <iant@google.com>
5080
5081         PR 11805
5082         * layout.h (enum Output_section_order): Define.
5083         (class Layout): Update declarations.
5084         * layout.cc (Layout::get_output_section): Add order parameter.
5085         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5086         is_first_non_relro parameters.  Change all callers.
5087         (Layout::choose_output_section): Likewise.
5088         (Layout::add_output_section_data): Likewise.
5089         (Layout::make_output_section): Likewise.  Set order.
5090         (Layout::default_section_order): New function.
5091         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5092         * output.cc (Output_section::Output_section): Initialize order_.
5093         Don't initialize deleted fields.
5094         (Output_segment::Output_segment): Don't initialize deleted
5095         fields.
5096         (Output_segment::add_output_section_to_load): New function
5097         replacing add_output_section.  Change all callers to call this or
5098         add_output_section_to_nonload.
5099         (Output_segment::add_output_section_to_nonload): New function.
5100         (Output_segment::remove_output_section): Rewrite.
5101         (Output_segment::add_initial_output_data): Likewise.
5102         (Output_segment::has_any_data_sections): Likewise.
5103         (Output_segment::is_first_section_relro): Likewise.
5104         (Output_segment::maximum_alignment): Likewise.
5105         (Output_segment::has_dynamic_reloc): New function replacing
5106         dynamic_reloc_count.  Change all callers.
5107         (Output_segment::has_dynamic_reloc_list): New function replacing
5108         dynamic_reloc_count_list.  Change all callers.
5109         (Output_segment::set_section_addresses): Rewrite.
5110         (Output_segment::set_offset): Rewrite.
5111         (Output_segment::find_first_and_last_list): Remove.
5112         (Output_segment::set_tls_offsets): Rewrite.
5113         (Output_segment::first_section_load_address): Likewise.
5114         (Output_segment::output_section_count): Likewise.
5115         (Output_segment::section_with_lowest_load_address): Likewise.
5116         (Output_segment::write_section_headers): Likewise.
5117         (Output_segment::print_sections_to_map): Likewise.
5118         * output.h (class Output_data): Remove dynamic_reloc_count_
5119         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5120         (Output_data::add_dynamic_reloc): Rewrite.
5121         (Output_data::has_dynamic_reloc): New function.
5122         (Output_data::dynamic_reloc_count): Remove.
5123         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5124         is_last_relro_, is_first_non_relro_, is_interp_,
5125         is_dynamic_linker_section_ fields.  Add order and set_order
5126         functions.  Remove is_relro_local, set_is_relro_local,
5127         is_last_relro, set_is_last_relro, is_first_non_relro,
5128         set_is_first_non_relro functions, is_interp, set_is_interp,
5129         is_dynamic_linker_section, and set_is_dynamic_linker_section
5130         functions.
5131         (class Output_segment): Change Output_data_list from std::list to
5132         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5133         output_bss_ fields.  Update declarations.
5134
5135 2010-08-02  Ian Lance Taylor  <iant@google.com>
5136
5137         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5138         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5139         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5140
5141 2010-08-02  Ian Lance Taylor  <iant@google.com>
5142
5143         PR 11855
5144         * script.cc (Script_options::Script_options): Initialize
5145         symbol_definitions_ and symbol_references_.
5146         (Script_options::add_symbol_assignment): Update
5147         symbol_definitions_ and symbol_references_.
5148         (Script_options::add_symbol_reference): New function.
5149         (script_symbol): New function.
5150         * script.h (class Script_options): Add symbol_definitions_ and
5151         symbol_references_ fields.
5152         (Script_options::referenced_const_iterator): New type.
5153         (Script_options::referenced_begin): New function.
5154         (Script_options::referenced_end): New function.
5155         (Script_options::is_referenced): New function.
5156         (Script_options::any_unreferenced): New function.
5157         * script-c.h (script_symbol): Declare.
5158         * yyscript.y (exp): Call script_symbol.
5159         * symtab.cc: Include "script.h".
5160         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5161         Change all callers.  Check symbols referenced by scripts.
5162         (Symbol_table::add_undefined_symbols_from_command_line): Add
5163         layout parameter.  Change all callers.
5164         (Symbol_table::do_add_undefined_symbols_from_command_line):
5165         Likewise.  Break out loop body.  Check symbols referenced by
5166         scripts.
5167         (Symbol_table::add_undefined_symbol_from_command_line): New
5168         function broken out of
5169         do_add_undefined_symbols_from_command_line.
5170         * symtab.h (class Symbol_table): Update declarations.
5171         * archive.cc: Include "layout.h".
5172         (Archive::should_include_member): Add layout parameter.  Change
5173         all callers.  Check for symbol mentioned in expression.
5174         * archive.h (class Archive): Update declaration.
5175         * object.cc (Sized_relobj::do_should_include_member): Add layout
5176         parameter.
5177         * object.h (Object::should_include_member): Add layout parameter.
5178         Change all callers.
5179         (Object::do_should_include_member): Add layout parameter.
5180         (class Sized_relobj): Update declaration.
5181         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5182         parameter.
5183         * dynobj.h (class Sized_dynobj): Update declaration.
5184         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5185         layout parameter.
5186         * plugin.h (class Sized_pluginobj): Update declaration.
5187
5188 2010-08-02  Ian Lance Taylor  <iant@google.com>
5189
5190         PR 11866
5191         * output.cc (Output_segment::set_offset): Search for the first and
5192         last sections rather than assuming that the list is in order.
5193         (Output_segment::find_first_and_last_list): New function.
5194         * output.h (class Output_segment): Update declarations.
5195         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5196         (relro_strip_test_SOURCES): New variable.
5197         (relro_strip_test_DEPENDENCIES): New variable.
5198         (relro_strip_test_LDFLAGS): New variable.
5199         (relro_strip_test_LDADD): New variable.
5200         (relro_strip_test.so): New target.
5201
5202 2010-08-02  Ian Lance Taylor  <iant@google.com>
5203
5204         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5205         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5206         (Target_i386::got_tlsdesc_section): New function.
5207         (Target_i386::got_section): Create space for GOT entries for
5208         TLSDESC relocations.
5209         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5210         R_386_TLS_GOTDESC.
5211         (Target_i386::Scan::global): Likewise.
5212         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5213         using TLSDESC GOT.
5214         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5215         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5216         (Target_x86_64::got_tlsdesc_section): New function.
5217         (Target_x86_64::got_section): Create space for GOT entries for
5218         TLSDESC relocations.
5219         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5220         R_386_TLS_GOTDESC.
5221         (Target_x86_64::Scan::global): Likewise.
5222         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5223         using TLSDESC GOT.
5224
5225 2010-08-02  Ian Lance Taylor  <iant@google.com>
5226
5227         * testsuite/final_layout.sh: Use dc to convert from hex to
5228         decimal.
5229
5230 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5231
5232         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5233         paramter to the call to gold::gc_process_relocs.
5234         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5235         paramter to the call to gold::gc_process_relocs.
5236         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5237         parameter to the call to gold::gc_process_relocs.
5238         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5239         template parameter to the call to gold::gc_process_relocs.
5240         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5241         paramter to the call to gold::gc_process_relocs.
5242         * gc.h (get_embedded_addend_size): New function.
5243         (gc_process_relocs): Save the size of the reloc for use by ICF.
5244         * icf.cc (get_section_contents): Get the addend from the text section
5245         for SHT_REL relocation sections.
5246         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5247         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5248         * int_encoding.h (read_from_pointer): New overloaded function.
5249         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5250         * testsuite/icf_sht_rel_addend_test.sh: New file.
5251         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5252         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5253
5254 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5255
5256         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5257         * Makefile.in: Regenerate.
5258         * testsuite/Makefile.in: Regenerate.
5259
5260 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5261
5262         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5263         * gold/testsuite/debug_msg.cc: Likewise.
5264         * gold/testsuite/odr_violation1.cc
5265         * gold/testsuite/odr_violation2.cc
5266
5267 2010-07-21  Cary Coutant  <ccoutant@google.com>
5268
5269         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5270         string, and length fields.
5271         (Output_merge_string::Merged_strings_list): New type.
5272         (Output_merge_string::Merged_strings_lists): New typedef.
5273         (Output_merge_string): Replace merged_strings_ with
5274         merged_strings_lists_.
5275         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5276         Merged_strings_list per input object and section.  Don't store pointer
5277         to the string.  Don't store length with each merged string entry.
5278         (Output_merge_string::finalize_merged_data): Loop over list of merged
5279         strings lists.  Recompute length of each merged string.
5280
5281 2010-07-15  Cary Coutant  <ccoutant@google.com>
5282
5283         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5284         here.
5285
5286 2010-07-14  Ian Lance Taylor  <iant@google.com>
5287
5288         * descriptors.cc (Descriptors::open): Report correct name in error
5289         message.
5290
5291 2010-07-13  Doug Kwan  <dougkwan@google.com>
5292
5293         * arm.cc (Arm_input_section::Arm_input_section): For a
5294         SHT_ARM_EXIDX section, always keeps the input sections.
5295         (Arm_input_section::set_exidx_section_link): New method.
5296         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5297         has_errors_ to false.
5298         (Arm_exidx_input_section::has_errors,
5299         Arm_exidx_input_section::set_has_errors): New methods.
5300         (Arm_exidx_input_section::has_errors_): New data member.
5301         (Arm_relobj::get_exidx_shndx_list): New method.
5302         (Arm_output_section::append_text_sections_to_list): Do not skip
5303         section without SHF_EXECINSTR.
5304         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5305         errors.
5306         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5307         section header.  Make error messages more verbose.  Check for
5308         a non-executable section linked to an EXIDX section.
5309         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5310         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5311         check that there is no deferred EXIDX section if we exit early.
5312         Instead of not making an EXIDX section in case of an error, make one
5313         and set the has_errors flag of it.
5314         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5315         in a relocatable link.
5316         (Target_arm::do_relax): Look for the EXIDX output section instead of
5317         assuming that it is called .ARM.exidx.
5318         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5319         section list.  Do not check for SHF_EXECINSTR section flags but
5320         skip any input section with errors.
5321         * output.cc (Output_section::Output_section): Initialize
5322         always_keeps_input_sections_ to false.
5323         (Output_section::add_input_section): Check for
5324         always_keeps_input_sections_.
5325         *  output.h (Output_section::always_keeps_input_sections,
5326         Output_section::set_always_keeps_input_sections): New methods.
5327         (Output_section::always_keeps_input_sections): New data member.
5328
5329 2010-07-13  Rafael Espindola  <espindola@google.com>
5330
5331         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5332         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5333
5334 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5335             Ian Lance Taylor  <iant@google.com>
5336
5337         * output.h (Output_section_lookup_maps::add_merge_section):
5338         Correct check of whether value was inserted.
5339         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5340         (Output_section_lookup_maps::add_relaxed_input_section):
5341         Likewise.
5342         * arm.cc (Target_arm::got_section): Remove used local os.
5343         * i386.cc (Target_i386::got_section): Likewise.
5344         * x86_64.cc (Target_x86_64::got_section): Likewise.
5345         * sparc.cc (Target_sparc::got_section): Likewise.
5346         (Target_sparc::relocate): Remove unused local have_got_offset.
5347         * powerpc.cc (Target_powerpc::relocate): Likewise.
5348
5349 2010-07-13  Ian Lance Taylor  <iant@google.com>
5350
5351         * compressed_output.cc (zlib_decompress): Fix signature in
5352         !HAVE_ZLIB_H case.
5353
5354         * archive.cc (Archive::include_member): Unlock an external member
5355         of a thin archive.  Don't bother to delete an object we know is
5356         NULL.
5357
5358 2010-07-12  Cary Coutant  <ccoutant@google.com>
5359
5360         * compressed_output.cc (zlib_decompress): New function.
5361         (get_uncompressed_size): New function.
5362         (decompress_input_section): New function.
5363         * compressed_output.h (get_uncompressed_size): New function.
5364         (decompress_input_section): New function.
5365         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5366         Handle compressed debug sections.
5367         * layout.cc (is_compressed_debug_section): New function.
5368         (Layout::output_section_name): Map compressed section names to
5369         canonical names.
5370         * layout.h (is_compressed_debug_section): New function.
5371         (is_debug_info_section): Recognize compressed debug sections.
5372         * merge.cc: Include compressed_output.h.
5373         (Output_merge_data::do_add_input_section): Handle compressed
5374         debug sections.
5375         (Output_merge_string::do_add_input_section): Handle compressed
5376         debug sections.
5377         * object.cc: Include compressed_output.h.
5378         (Sized_relobj::Sized_relobj): Initialize new data members.
5379         (build_compressed_section_map): New function.
5380         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5381         * object.h (Object::section_is_compressed): New method.
5382         (Object::do_section_is_compressed): New method.
5383         (Sized_relobj::Compressed_section_map): New type.
5384         (Sized_relobj::do_section_is_compressed): New method.
5385         (Sized_relobj::compressed_sections_): New data member.
5386         * output.cc (Output_section::add_input_section): Handle compressed
5387         debug sections.
5388         * reloc.cc: Include compressed_output.h.
5389         (Sized_relobj::write_sections): Handle compressed debug sections.
5390
5391 2010-07-08  Cary Coutant  <ccoutant@google.com>
5392
5393         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5394         weak when resolving to a dynamic def.
5395         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5396         for weak undef/dynamic def cases. Adjust callers.
5397         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5398         undef_binding_weak_.
5399         (Symbol_table::sized_write_globals): Adjust symbol binding.
5400         (Symbol_table::sized_write_symbol): Add binding parameter.
5401         * symtab.h (Symbol::set_undef_binding): New method.
5402         (Symbol::is_undef_binding_weak): New method.
5403         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5404         (Symbol_table::should_override): Add new parameter.
5405         (Symbol_table::sized_write_symbol): Add new parameter.
5406
5407         * testsuite/weak_undef_file1.cc: Add new test case.
5408         * testsuite/weak_undef_file2.cc: Fix header comment.
5409         * testsuite/weak_undef_test.cc: Add new test case.
5410
5411 2010-06-29  Doug Kwan  <dougkwan@google.com>
5412
5413         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5414         Initialize USE_SYMBOL_.
5415         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5416         definition.
5417         (Arm_reloc_property::uses_symbol_): New data member declaration.
5418         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5419         uses symbol value and symbol is undefined but not weakly undefined.
5420
5421 2010-06-28  Rafael Espindola  <espindola@google.com>
5422
5423         * plugin.cc (Plugin::load): Use dlerror.
5424
5425 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5426
5427         * symtab.cc (detect_odr_violations): When reporting an ODR
5428         violation, report an object where the symbol is defined.
5429
5430 2010-06-25  Doug Kwan  <dougkwan@google.com>
5431
5432         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5433         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5434         definition.
5435         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5436         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5437         target hook to detect function points.
5438         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5439         * icf.h (Icf::check_section_for_function_pointers): Change type of
5440         parameter SECTION_NAME to const reference to std::string.  Use
5441         target hook to determine if section may have unsafe pointers.
5442         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5443         method definition.
5444
5445 2010-06-21  Rafael Espindola  <espindola@google.com>
5446
5447         * fileread.cc (Input_file::find_fie): New
5448         (Input_file::open): Use Input_file::find_fie.
5449         * fileread.h (Input_file::find_fie): New
5450         * plugin.cc (set_extra_library_path): New.
5451         (Plugin::load): Add set_extra_library_path to the transfer vector.
5452         (Plugin_manager::set_extra_library_path): New.
5453         (Plugin_manager::add_input_file): Use the extra search path if set.
5454         (set_extra_library_path(): New.
5455         * plugin.h (Plugin_manager): Add set_extra_library_path and
5456         extra_search_path_.
5457
5458 2010-06-19  Cary Coutant  <ccoutant@google.com>
5459
5460         * layout.cc (gdb_sections): Add .debug_types.
5461         (lines_only_debug_sections): Likewise.
5462
5463 2010-06-18  Rafael Espindola  <espindola@google.com>
5464
5465         * plugin.cc (add_input_file,add_input_library)
5466         (Plugin_manager::add_input_file): Make filename arguments const.
5467         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5468         const.
5469
5470 2010-06-16  Doug Kwan  <dougkwan@google.com>
5471
5472         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5473         .ARM.attributes section if we have not merged any input
5474         attributes sections.
5475
5476 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5477
5478         * arm.cc: Allow combining objects with no EABI version
5479         information.
5480
5481 2010-06-15  Rafael Espindola  <espindola@google.com>
5482
5483         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5484
5485 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5486
5487         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5488         (struct iovec): Correct !HAVE_READV definition.
5489
5490 2010-06-10  Cary Coutant  <ccoutant@google.com>
5491
5492         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5493         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5494         reloc sections.
5495         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5496
5497         PR 11683
5498         * symtab.h (Symbol::is_placeholder): New member function.
5499         * target-reloc.h (relocate_section): Check for placeholder symbols.
5500
5501         * testsuite/Makefile.am (plugin_test_8): New test.
5502         (plugin_test_9): New test.
5503         * testsuite/Makefile.in: Regenerate.
5504
5505 2010-06-09  Nick Clifton  <nickc@redhat.com>
5506
5507         * yyscript.y (input_list_element): Allow strings prefixed with
5508         the '-' character.  Treat these as libraries.
5509         * script.cc (script_add_library): New function.  Adds a library
5510         specified by "-l<name>" found in an input script.
5511         * script-c.h: Add prototype for script_add_library.
5512
5513 2010-06-07  Doug Kwan  <dougkwan@google.com>
5514
5515         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5516         Restrict stub-group size to be within long conditional branch
5517         range when working around cortex-A8 erratum.
5518
5519 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5520
5521         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5522         #ifdef typo.
5523
5524 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5525
5526         PR gold/11658
5527         * output.cc
5528         (Output_section::Input_section_sort_entry::compare_section_ordering):
5529         Change to return non-zero correctly.
5530         (Output_section::Input_section_sort_section_order_index_compare
5531         ::operator()): Change to fix ambiguity in comparisons.
5532
5533 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5534
5535         * gold.h (is_wildcard_string): New function.
5536         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5537         (Layout::layout_eh_frame): Ditto.
5538         (Layout::find_section_order_index): New method.
5539         (Layout::read_layout_from_file): New method.
5540         * layout.h (Layout::find_section_order_index): New method.
5541         (Layout::read_layout_from_file): New method.
5542         (Layout::input_section_position_): New private member.
5543         (Layout::input_section_glob_): New private member.
5544         * main.cc (main): Call read_layout_from_file here.
5545         * options.h (--section-ordering-file): New option.
5546         * output.cc (Output_section::input_section_order_specified_): New
5547         member.
5548         (Output_section::Output_section): Initialize new member.
5549         (Output_section::add_input_section): Add new parameter.
5550         Keep input sections when --section-ordering-file is used.
5551         (Output_section::set_final_data_size): Sort input sections when
5552         section ordering file is specified.
5553         (Output_section::Input_section_sort_entry): Add new parameter.
5554         Check sorting type.
5555         (Output_section::Input_section_sort_entry::compare_section_ordering):
5556         New method.
5557         (Output_section::Input_section_sort_compare::operator()): Change to
5558         consider section_order_index.
5559         (Output_section::Input_section_sort_init_fini_compare::operator()):
5560         Change to consider section_order_index.
5561         (Output_section::Input_section_sort_section_order_index_compare
5562         ::operator()): New method.
5563         (Output_section::sort_attached_input_sections): Change to sort
5564         according to section order when specified.
5565         (Output_section::add_input_section<32, true>): Add new parameter.
5566         (Output_section::add_input_section<64, true>): Add new parameter.
5567         (Output_section::add_input_section<32, false>): Add new parameter.
5568         (Output_section::add_input_section<64, false>): Add new parameter.
5569         * output.h (Output_section::add_input_section): Add new parameter.
5570         (Output_section::input_section_order_specified): New
5571         method.
5572         (Output_section::set_input_section_order_specified): New method.
5573         (Input_section::Input_section): Initialize section_order_index_.
5574         (Input_section::section_order_index): New method.
5575         (Input_section::set_section_order_index): New method.
5576         (Input_section::section_order_index_): New member.
5577         (Input_section::Input_section_sort_section_order_index_compare): New
5578         struct.
5579         (Output_section::input_section_order_specified_): New member.
5580         * script-sections.cc (is_wildcard_string): Delete and move modified
5581         method to gold.h.
5582         (Output_section_element_input::Output_section_element_input): Modify
5583         call to is_wildcard_string.
5584         (Output_section_element_input::Input_section_pattern
5585         ::Input_section_pattern): Ditto.
5586         (Output_section_element_input::Output_section_element_input): Ditto.
5587         * testsuite/Makefile.am (final_layout): New test case.
5588         * testsuite/Makefile.in: Regenerate.
5589         * testsuite/final_layout.cc: New file.
5590         * testsuite/final_layout.sh: New file.
5591
5592 2010-06-01  Rafael Espindola  <espindola@google.com>
5593
5594         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5595
5596 2010-06-01  Rafael Espindola  <espindola@google.com>
5597
5598         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5599         visibility of symbols.
5600
5601 2010-05-27  Doug Kwan  <dougkwan@google.com>
5602
5603         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5604         from start of output section instead of address for a local symbol
5605         in a merged or relaxed section when doing a relocatable link.
5606
5607 2010-05-26  Rafael Espindola  <espindola@google.com>
5608
5609         PR 11604
5610         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5611         adding sections the garbage collector removed.
5612         * gold/testsuite/Makefile.am: Add test.
5613         * gold/testsuite/Makefile.in: Regenerate.
5614         * gold/testsuite/plugin_test_7.sh: New.
5615         * gold/testsuite/plugin_test_7_1.c: New.
5616         * gold/testsuite/plugin_test_7_2.c: New.
5617
5618 2010-05-26  Rafael Espindola  <espindola@google.com>
5619
5620         * script-sections.cc (Output_section_definition::set_section_addresses):
5621         Check for --section-start.
5622
5623 2010-05-26  Doug Kwan  <dougkwan@google.com>
5624
5625         * arm.cc (Arm_scan_relocatable_relocs): New class.
5626         (Target_arm::relocate_special_relocatable): New method.
5627         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5628         (Arm_relocate_functions::thumb_branch_common): Same.
5629         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5630         instead of Default_scan_relocatable_relocs.
5631         * target-reloc.h (relocate_for_relocatable): Let target handle
5632         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5633         * target.h (Sized_target::relocate_special_relocatable): New method.
5634
5635 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5636
5637         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5638
5639 2010-05-23  Doug Kwan  <dougkwan@google.com>
5640
5641         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5642         instead of a cast.
5643         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5644         with a direct branch, not a conditional branch, to a stub.
5645         * merge.cc (Output_merge_base::record_input_section): New method
5646         defintion.
5647         (Output_merge_data::do_add_input_section): Record input section if
5648         keeps-input-sections flag is set.
5649         (Output_merge_string::do_add_input_section): Ditto.
5650         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5651         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5652         INPUT_SECTIONS_.
5653         (Output_merge_base::keeps_input_sections,
5654         Output_merge_base::set_keeps_input_sections,
5655         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5656         method definitions.
5657         (Output_merge_base::Input_sections): New type declaration.
5658         (Output_merge_base::input_sections_begin,
5659         Output_merge_base::input_sections_end,
5660         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5661         (Output_merge_base::bool keeps_input_sections_,
5662         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5663         Output_merge_base::input_sections_): New data members.
5664         (Output_merge_data::do_set_keeps_input_sections): New method
5665         defintion.
5666         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5667         * output.cc (Output_section::Input_section::relobj): Move method
5668         defintion from class declaration to here and handle merge sections.
5669         (Output_section::Input_section::shndx): Ditto.
5670         (Output_section::Output_section): Remove initializations of removed
5671         data members and initialize new data member LOOKUP_MAPS_.
5672         (Output_section::add_input_section): Set keeps-input-sections flag
5673         for a newly created merge output section as appropriate.  Adjust code
5674         to use Output_section_lookup_maps class.
5675         (Output_section::add_relaxed_input_section): Adjst code for lookup
5676         maps code refactoring.
5677         (Output_section::add_merge_input_section): Add a new parameter
5678         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5679         class.  If adding input section to a newly created merge output
5680         section fails, remove the new merge section.
5681         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5682         Adjust code for use of the Output_section_lookup_maps class.
5683         (Output_section::find_merge_section): Ditto.
5684         (Output_section::build_lookup_maps): New method defintion.
5685         (Output_section::find_relaxed_input_section): Adjust code to use
5686         Output_section_lookup_maps class.
5687         (Output_section::get_input_sections): Export merge sections.  Adjust
5688         code to use Output_section_lookup_maps class.
5689         (Output_section:::add_script_input_section): Adjust code to use
5690         Output_section_lookup_maps class.  Update lookup maps for merge
5691         sections also.
5692         (Output_section::discard_states): Use Output_section_lookup_maps.
5693         (Output_section::restore_states): Same.
5694         * output.h (Merge_section_properties): Move class defintion out of
5695         Output_section.
5696         (Output_section_lookup_maps): New class.
5697         (Output_section::Input_section::is_merge_section): New method
5698         defintion.
5699         (Output_section::Input_section::relobj): Move defintion out of class
5700         defintion.  Declare method only.
5701         (Output_section::Input_section::shndx): Ditto.
5702         (Output_section::Input_section::output_merge_base): New method defintion.
5703         (Output_section::Input_section::u2_.pomb): New union field.
5704         (Output_section::Merge_section_by_properties_map,
5705         Output_section::Output_section_data_by_input_section_map,
5706         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5707         Remove types.
5708         (Output_section::add_merge_input_section): Add new parameter
5709         KEEPS_INPUT_SECTIONS.
5710         (Output_section::build_lookup_maps): New method declaration.
5711         (Output_section::merge_section_map_,
5712         Output_section::merge_section_by_properties_map_,
5713         Output_section::relaxed_input_section_map_,
5714         Output_section::is_relaxed_input_section_map_valid_): Remove data
5715         members.
5716         (Output_section::lookup_maps_): New data member.
5717
5718 2010-05-21  Doug Kwan  <dougkwan@google.com>
5719
5720         PR gold/11619
5721         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5722         avoid a compilation error.
5723
5724 2010-05-19  Rafael Espindola  <espindola@google.com>
5725
5726         * script-sections.cc (Output_section_definition::allocate_to_segment):
5727         Update the phdrs_list even when the output section is NULL.
5728         * testsuite/Makefile.am: Add test.
5729         * testsuite/Makefile.in: Regenerate.
5730         * testsuite/script_test_9.cc: New.
5731         * testsuite/script_test_9.sh: New.
5732         * testsuite/script_test_9.t: New.
5733
5734 2010-05-19  Doug Kwan  <dougkwan@google.com>
5735
5736         * arm.cc (Arm_input_section::original_size): New method.
5737         (Arm_input_section::do_addralign): Add a cast.
5738         (Arm_input_section::do_output_offset): Remove static cast.
5739         (Arm_input_section::original_addralign,
5740          Arm_input_section::original_size_): Change type to uint32_t.
5741         (Arm_input_section::init): Add safe casts for section alignment
5742         and size.
5743         (Arm_input_section::set_final_data_size): Do not set address and
5744         offset of stub table.
5745         (Arm_output_section::fix_exidx_coverage): Change use of of
5746         Output_section::Simple_input_section to that of
5747         Output_section::Input_section.
5748         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5749         except for the first pass.
5750         * output.cc (Output_section::get_input_sections): Change type of
5751         input_sections to std::list<Input_section>.
5752         (Output_section::add_script_input_section): Rename from
5753         Output_section::add_simple_input_section.  Change type of SIS
5754         parameter from Simple_input_section to Input_section.
5755         * output.h (Output_section::Simple_input_section): Remove class.
5756         (Output_section::Input_section): Change class visibility to public.
5757         (Output_section::Input_section::addralign): Use stored alignments
5758         for special input sections if set.
5759         (Output_section::Input_section::set_addralign): New method.
5760         (Output_section::get_input_sections): Change parameter type from
5761         list of Simple_input_section to list of Input_section.
5762         (Output_section::add_script_input_section): Rename from
5763         Output_section::add_simple_input_section. Change first parameter's
5764         type from Simple_input_section to Input_section and remove the
5765         second and third parameters.
5766         * script-sections.cc (Input_section::Input_section_list): Change
5767         type to list of Output_section::Input_section/
5768         (Input_section_info::Input_section_info): Change parameter type of
5769         INPUT_SECTION to Output_section::Input_section.
5770         (Input_section_info::input_section): Change return type.
5771         (Input_section_info::input_section_): Change type to
5772         Output_section::Input_section.
5773         (Output_section_element_input::set_section_addresses): Adjust code
5774         to use Output_section::Input_section instead of
5775         Output_section::Simple_input_section.  Adjust code for renaming
5776         of Output_section::add_simple_input_section.
5777         (Orphan_output_section::set_section_addresses): Ditto.
5778
5779 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5780
5781         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5782         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5783
5784 2010-05-18  Rafael Espindola  <espindola@google.com>
5785
5786         * options.cc (General_options::finalize): Handle -nostdlib.
5787         * options.h (nostdlib): New option.
5788         * script.cc (script_add_search_dir): Handle -nostdlib.
5789
5790 2010-05-12  Doug Kwan  <dougkwan@google.com>
5791
5792         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5793         attributes section only if there no attributes section after merging.
5794         (Target_arm::merge_object_attributes): Move value of
5795         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5796         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5797         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5798         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5799         and arm_attr_merge_7.stdout.
5800         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5801         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5802         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5803         arm_attr_merge_7b.o): New rules.
5804         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5805         arm_attr_merge_7
5806         * testsuite/Makefile.in: Regenerate.
5807         * testsuite/arm_attr_merge.sh: New file.
5808         * testsuite/arm_attr_merge_[67][ab].s: Same.
5809
5810 2010-05-05  Nick Clifton  <nickc@redhat.com>
5811
5812         * po/es.po: Updated Spanish translation.
5813
5814 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5815
5816         * Makefile.am (install-exec-local): Properly install gold as
5817         default cross linker.
5818         * Makefile.in: Regenerated.
5819
5820 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5821             Nick Clifton  <nickc@redhat.com>
5822
5823         * configure.ac (install_as_default): Define and set to false
5824         unless --enable-gold or --enable-gold=both/gold has been
5825         specified.
5826         * configure: Regenerate.
5827
5828         * Makefile.am (install-exec-local): Install the executable as
5829         'ld.gold'.  If install_as_default is true then also install it as
5830         'ld'.
5831         * Makefile.in: Regenerated.
5832
5833 2010-04-24  Ian Lance Taylor  <iant@google.com>
5834
5835         * layout.cc (Layout::layout_reloc): In relocatable link don't
5836         combine reloc sections for grouped sections.
5837
5838 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5839
5840         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5841         sections that are not ordinary to icf.
5842         * icf.cc (get_section_contents): Handle relocation pointing to section
5843         with no object or shndx information.
5844         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5845         * testsuite/Makefile.in: Regenerate.
5846         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5847         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5848
5849 2010-04-22  Ian Lance Taylor  <iant@google.com>
5850
5851         * expression.cc (Expression::Expression_eval_info): Add
5852         result_alignment_pointer field.
5853         (Expression::eval_with_dot): Add result_alignment_pointer
5854         parameter.  Change all callers.
5855         (Expression::eval_maybe_dot): Likewise.
5856         (class Binary_expression): Add alignment_pointer parameter to
5857         left_value and right_value.  Change all callers.
5858         (BINARY_EXPRESSION): Set result alignment.
5859         (class Trinary_expression): Add alignment_pointer parameter to
5860         arg2_value and arg3_value.  Change all callers.
5861         (Trinary_cond::value): Set result alignment.
5862         (Max_expression::value, Min_expression::value): Likewise.
5863         (Align_expression::value): Likewise.
5864         * script-sections.cc (class Sections_element): Add dot_alignment
5865         parameter to set_section_addresses virtual function.  Update
5866         instantiations.
5867         (class Output_section_element): Likewise.
5868         (Script_sections::create_segments): Add dot_alignment parameter.
5869         Change all callers.
5870         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5871         (Script_sections::set_phdrs_clause_addresses): Likewise.
5872         * script-sections.h: Update declarations.
5873         * script.h: Update declarations.
5874         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5875         min_p_align.
5876         * testsuite/script_test_3.t: Set large alignment.
5877         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5878         segment has expected alignment.
5879
5880 2010-04-22  Nick Clifton  <nickc@redhat.com>
5881
5882         * po/gold.pot: Updated by the Translation project.
5883         * po/vi.po: Updated Vietnamese translation.
5884
5885 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5886
5887         * testsuite/Makefile.am (check_PROGRAMS): Add
5888         icf_virtual_function_folding_test.
5889         * testsuite/Makefile.in: Regenerated.
5890
5891 2010-04-15  Andrew Haley  <aph@redhat.com>
5892
5893         * options.h (merge_exidx_entries): New option.
5894         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5895         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5896         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5897         (Target_arm::merge_exidx_entries): New function.
5898         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5899         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5900         to Arm_exidx_fixup constructor.
5901         Add new arg, merge_exidx_entries.
5902         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5903         Arm_output_section::fix_exidx_coverage.
5904
5905 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5906
5907         * icf.cc (get_section_contents): Check for preemptible functions.
5908         Ignore addend when appropriate.
5909         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5910         section folded.
5911         (add_from_relobj): Check for section folded.
5912         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5913         * symtab.h (should_add_dynsym_entry): Add new parameter.
5914         * target-reloc.h (scan_relocs): Check for section folded.
5915         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5916         Check reloc types for function pointers in shared objects.
5917         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5918         case.
5919         (icf_preemptible_functions_test): New test case.
5920         (icf_string_merge_test): New test case.
5921         * testsuite.Makefile.in: Regenerate.
5922         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5923         bar_glob.  Refactor code.
5924         * testsuite/icf_preemptible_functions_test.cc: New file.
5925         * testsuite/icf_preemptible_functions_test.sh: New file.
5926         * testsuite/icf_string_merge_test.cc: New file.
5927         * testsuite/icf_string_merge_test.sh: New file.
5928         * testsuite/icf_virtual_function_folding_test.cc: New file.
5929         * testsuite/icf_virtual_function_folding_test.sh: New file.
5930
5931 2010-04-14  Doug Kwan  <dougkwan@google.com>
5932
5933         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5934         for local symbol recounting if we remove a section due to ICF.
5935         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5936         there are no regular objects in input.
5937
5938 2010-04-13  Doug Kwan  <dougkwan@google.com>
5939
5940         * arm.cc (Arm_input_section::set_final_data_size): Compute
5941         accurate final data size instead of using current data size.
5942
5943 2010-04-09  Doug Kwan  <dougkwan@google.com>
5944
5945         * layout.cc (Layout::choose_output_section): Handle script section
5946         types.
5947         (Layout::make_output_section_for_script): Add section type parameter.
5948         Handle script section types.
5949         * layout.h (Layout::make_output_section_for_script): Add section
5950         type parameter.
5951         * output.cc (Output_section::Output_section): Initialize data member
5952         is_noload_.
5953         (Output_section::do_reset_address_and_file_offset): Do not set address
5954         to 0 if section is a NOLOAD section.
5955         * output.h (Output_section::is_noload): New method.
5956         (Output_section::set_is_noload): Ditto.
5957         (Output_section::is_noload_): New data member.
5958         * script-c.h (Script_section_type): New enum type.
5959         (struct Parser_output_section_header): Add new file section_type.
5960         * script-sections.cc (Sections_element::output_section_name): Add
5961         parameter for returning script section type.
5962         (Output_section_definition::output_section_name): Ditto.
5963         (Output_section_definition::section_type)P; New method.
5964         (Output_section_definiton::script_section_type_name): Ditto.
5965         (Output_section_definition::script_section_type_): New data member.
5966         (Output_section_definition::Output_section_definition): Initialize
5967         data member Output_section_definition::script_section_type_.
5968         (Output_section_definition::create_sections): Pass script section type
5969         to Layout::make_output_section_for_script.
5970         (Output_section_definition::output_section_name): Return script
5971         section type to caller.
5972         (Output_section_definition::set_section_address): Do not advance
5973         dot value and load address if section type is NOLOAD.  Set address
5974         of NOLOAD sections regardless of section flags.
5975         (Output_section_definition::print): Print section type if it is
5976         not SCRIPT_SECTION_TYPE_NONE.
5977         (Output_section_definition::section_type): New method.
5978         (Output_section_definition::script_section_type_name): Ditto.
5979         (Script_sections::output_section_name): Add new parameter
5980         PSECTION_TYPE for returning script section type.  Pass it to
5981         section elements.  Handle discard sections.
5982         (Sort_output_sections::operator()): Handle NOLOAD sections.
5983         * script-sections.h (Script_sections::Section_type): New enum type.
5984         (Script_sections::output_section_name): Add a new parameter for
5985         returning script section type.
5986         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5987         INFO and NOLOAD.
5988         * yyscript.y (union): Add new field SECTION_TYPE.
5989         (COPY, DSECT, INFO, NOLOAD): New tokens.
5990         (opt_address_and_section_type): Change type to output_section_header.
5991         (section_type): New non-terminal
5992         (section_header): Handle section type.
5993         (opt_address_and_section_type): Return section type value.
5994
5995 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5996
5997         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5998         * testsuite/plugin_common_test_2.c (foo): Likewise.
5999
6000 2010-04-08  Doug Kwan  <dougkwan@google.com>
6001
6002         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6003         Output_merge_data.
6004         * output.cc (Output_section::add_merge_input_section): Simplify
6005         code and return status of Output_merge_base::add_input_section.
6006         Update merge section map only if Output_merge_base::add_input_section
6007         returns true.
6008
6009 2010-04-07  Doug Kwan  <dougkwan@google.com>
6010
6011         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6012         if section is marked as containing instructions but has no mapping
6013         symbols.
6014         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6015         correct section index.
6016         (Arm_relobj::find_linked_text_section): Ditto.
6017
6018 2010-04-07  Cary Coutant  <ccoutant@google.com>
6019
6020         * archive.cc (include_member): Destroy Read_symbols_data object before
6021         releasing file.
6022         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6023         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6024         (Read_symbols_data::~Read_symbols_data) New destructor.
6025         (Section_relocs::Section_relocs) New constructor.
6026         (Section_relocs::~Section_relocs) New destructor.
6027         (Read_relocs_data::Read_relocs_data) New constructor.
6028         (Read_relocs_data::~Read_relocs_data) New destructor.
6029         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6030         pointers to NULL after deleting.
6031
6032 2010-04-07  Doug Kwan  <dougkwan@google.com>
6033
6034         * arm.cc: Replace "endianity" with "endianness" in comments.
6035         (Arm_exidx_cantunwind): Ditto.
6036         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6037         (Arm_relobj::merge_flags_and_attributes): New method.
6038         (Arm_relobj::merge_flags_and_attributes_): New data member.
6039         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6040         (Arm_relobj::scan_sections_for_stubs): Ditto.
6041         (Arm_relobj::do_read_symbols): Check to see if we really want to
6042         merge processor-specific flags and attributes.  Exit early if
6043         an object is empty except for section names and the undefined symbol.
6044         (Target_arm::do_finalize_sections): Move check for ELF format to
6045         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6046         attributes from a regular object only when we have determined that
6047         it is aapropriate.  Do not create an .ARM.attributes section in
6048         output if there is no regular input object.
6049         (Target_arm::merge_processor_specific_flags): Check
6050         --warn-mismatch before printing any error.
6051         (Target_arm::merge_object_attributes): Ditto.
6052         * gold.cc (queue_middle_tasks): Handle the case in which there is
6053         no regular object in input.
6054         * options.cc (General_options::parse_EB): New method.
6055         (General_options::parse_EL): Same.
6056         (General_options::General_options): Initialize endianness_.
6057         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6058         New options.
6059         (General_options::Endianness): New enum.
6060         (General_options::endianness): New method.
6061         (General_options::endianness_): New data member.
6062         * parameters.cc (Parameters::set_options): Check target endianness.
6063         (Parameters::set_target_once): Ditto.
6064         (Parameters::check_target_endianness): New method.
6065         (parameters_force_valid_target): If either -EL or -EB is specified,
6066         use it to define endianness of default target.
6067         * parameters.h (Parameters::check_target_endianness): New method
6068         declaration.
6069         * target.h (class Target): Change "endianity" to "endianness"
6070         in comments.
6071
6072 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6073
6074         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6075         * configure: Regenerate.
6076         * Makefile.in: Regenerate.
6077         * testsuite/Makefile.in: Regenerate.
6078
6079 2010-04-06  Cary Coutant  <ccoutant@google.com>
6080
6081         gcc PR lto/42757
6082         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6083         prevailing definitions of common symbols.
6084         * testsuite/plugin_test_6.sh: New test case.
6085         * testsuite/plugin_common_test_1.c: New test case.
6086         * testsuite/plugin_common_test_2.c: New test case.
6087         * testsuite/Makefile.am (plugin_test_6): New test case.
6088         * testsuite/Makefile.in: Regenerate.
6089
6090 2010-04-06  Nick Clifton  <nickc@redhat.com>
6091
6092         * po/vi.po: New Vietnamese translation.
6093
6094 2010-03-30  Doug Kwan  <dougkwan@google.com>
6095
6096         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6097
6098 2010-03-25  Doug Kwan  <dougkwan@google.com>
6099
6100         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6101         to avoid a conversion warning on a 32-bit host.
6102
6103 2010-03-24  Ian Lance Taylor  <iant@google.com>
6104
6105         * testsuite/script_test_3.t: Add a TLS segment.
6106         * testsuite/Makefile.am (check_PROGRAMS): Add
6107         tls_phdrs_script_test.
6108         (tls_phdrs_script_test_SOURCES): Define.
6109         (tls_phdrs_script_test_DEPENDENCIES): Define.
6110         (tls_phdrs_script_test_LDFLAGS): Define.
6111         (tls_phdrs_script_test_LDADD): Define.
6112         * testsuite/Makefile.in: Rebuild.
6113
6114 2010-03-23  Cary Coutant  <ccoutant@google.com>
6115
6116         * fileread.cc (find_or_make_view): Fix comment.
6117
6118 2010-03-23  Ian Lance Taylor  <iant@google.com>
6119
6120         * script-sections.cc (class Orphan_section_placement): Define
6121         PLACE_TLS and PLACE_TLS_BSS.
6122         (Orphan_section_placement::Orphan_section_placement): Initialize
6123         new places.
6124         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6125         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6126         (tls_script_test_SOURCES): Define.
6127         (tls_script_test_DEPENDENCIES): Define.
6128         (tls_script_test_LDFLAGS): Define.
6129         (tls_script_test_LDADD): Define.
6130         * testsuite/Makefile.in: Rebuild.
6131
6132 2010-03-22  Doug Kwan  <dougkwan@google.com>
6133
6134         * arm.cc (Arm_relocate_functions::abs8,
6135         Arm_relocate_functions::abs16): Use correct check for overflow
6136         specified in the ARM ELF specs.
6137         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6138         target of a BLX instruction specially.
6139         (Reloc_stub::stub_type_for_reloc): Ditto.
6140         (Relocate::relocate): Use symbolic names instead of numeric relocation
6141         codes to report error.
6142         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6143         workaround.
6144         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6145         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6146         thumb2_blx_out_of_range.stdout
6147         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6148         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6149         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6150         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6151         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6152         thumb2_blx_in_range, thumb2_blx_in_range.o,
6153         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6154         thumb2_blx_out_of_range.o): New rules.
6155         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6156         thumb2_blx_in_range and thumb2_blx_out_of_range.
6157         * testsuite/Makefile.in: Regenerate.
6158         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6159         * testsuite/thumb_blx_in_range.s: New file.
6160         * testsuite/thumb_blx_out_of_range.s: New file.
6161
6162 2010-03-22  Rafael Espindola  <espindola@google.com>
6163
6164         * archive.cc (Should_include): Move to archive.h.
6165         (should_include_member): Make it a member of Archive.
6166         (Lib_group): New.
6167         (Add_lib_group_symbols): New.
6168         * archive.h: Include options.h.
6169         (Archive_member): Moved from Archive.
6170         (Should_include): Moved from archive.cc.
6171         (Lib_group): New.
6172         (Add_lib_group_symbols): New.
6173         * dynobj.cc (do_should_include_member): New.
6174         * dynobj.h (do_should_include_member): New.
6175         * gold.cc (queue_initial_tasks): Update call to queue.
6176         * main.cc (main): Print lib group stats.
6177         * object.cc (do_should_include_member): New.
6178         * object.h: Include archive.h.
6179         (Object::should_include_member): New.
6180         (Object::do_should_include_member): New.
6181         (Sized_relobj::do_should_include_member): New.
6182         * options.cc (General_options::parse_start_lib): New.
6183         (General_options::parse_end_lib): New.
6184         (Input_arguments::add_file): Handle lib groups.
6185         (Input_arguments::start_group): Check we are not in a lib.
6186         (Input_arguments::start_lib): New.
6187         (Input_arguments::end_lib): New.
6188         * options.h (General_options): Add start_lib and end_lib.
6189         (Input_argument::lib_): New.
6190         (Input_argument::lib): New.
6191         (Input_argument::is_lib): New.
6192         (Input_file_lib): New.
6193         (Input_arguments::in_lib_): New.
6194         (Input_arguments::in_lib): New.
6195         (Input_arguments::start_lib): New.
6196         (Input_arguments::end_lib_): New.
6197         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6198         in unused members as preempted.
6199         (Sized_pluginobj::do_should_include_member): New.
6200         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6201         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6202         return the blocker.
6203         (Read_symbols::do_whole_lib_group): New.
6204         (Read_symbols::do_lib_group): New.
6205         (Read_symbols::do_read_symbols): Handle lib groups.
6206         (Read_symbols::get_name): Handle lib groups.
6207         * readsyms.h (Read_symbols): Add an archive member pointer.
6208         (Read_symbols::do_whole_lib_group): New.
6209         (Read_symbols::do_lib_group): New.
6210         (Read_symbols::member_): New.
6211         * script.cc (read_input_script): Update call to queue_soon.
6212
6213 2010-03-19  Doug Kwan  <dougkwan@google.com>
6214
6215         * arm.cc (Stub_table::Stub_table): Initialize new data members
6216         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6217         (Stub_table::add_reloc_stub): Assign stub offset and update
6218         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6219         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6220         New data members.
6221         (Stub_table::update_data_size_and_addralign): Use
6222         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6223         instead of going over all reloc stubs.
6224         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6225         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6226         Stringpool_template::offset_ to size of Stringpool_char.
6227         (Stringpool_template::new_key_offset): Remove code to initialize
6228         Stringpool_template::offset_.
6229         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6230         Stringpool_template::offset_ to zero.
6231
6232 2010-03-15  Doug Kwan  <dougkwan@google.com>
6233
6234         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6235         offset_.
6236         (Stringpool_template::new_key_offset): New method.
6237         (Stringpool_template::add_string): Assign offsets when adding new
6238         strings.
6239         (Stringpool_template::set_string_offsets): Do not set string offsets
6240         when not optimizing.
6241         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6242         member size_.
6243         (Chunked_vector::clear): Clear size_.
6244         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6245         (Chunked_vector::size): Return size_.
6246         (Chunked_vector::push_back): Use size_ to find insert position.
6247         (Chunked_vector::size_): New data member.
6248         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6249         (Stringpool_template::new_key_offset): New method declaration.
6250         (Stringpool_template::offset_): New data member.
6251
6252 2010-03-15   Rafael Espindola  <espindola@google.com>
6253
6254         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6255         Add_symbols' constructor.
6256         * readsyms.h (Add_symbols): Remove the input_group member.
6257
6258 2010-03-10  Ian Lance Taylor  <iant@google.com>
6259
6260         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6261         target to ask whether a reference to a symbol requires a stack
6262         split.
6263         * target.h (Target::is_call_to_non_split): New function.
6264         (Target::do_is_call_to_non_split): Declare virtual function.
6265         * target.cc: Include "symtab.h".
6266         (Target::do_is_call_to_non_split): New function.
6267         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6268
6269 2010-03-10  Cary Coutant  <ccoutant@google.com>
6270
6271         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6272         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6273         (File_read::open[2]): Add whole_file_view_ to list of views.
6274         (File_read::make_view): Remove test of whole_file_view_.
6275         (File_read::find_or_make_view): Create whole_file_view_ if
6276         necessary.
6277         (File_read::clear_views): Replace bool parameter with enum;
6278         adjust all callers.  Don't delete views with permanent data;
6279         do delete cached views and views from archives if
6280         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6281         if clearing the corresponding view.
6282         * fileread.h (File_read::Clear_views_mode): New enum.
6283         (File_read::View::is_permanent_view): New method.
6284         (File_read::clear_views): Replace bool parameter
6285         with enum; adjust all callers.
6286         * options.h (General_options): Change keep_files_mapped option;
6287         add map_whole_files.
6288         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6289         releasing the file.
6290         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6291         the file.
6292
6293 2010-03-10  David S. Miller  <davem@davemloft.net>
6294
6295         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6296
6297 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6298
6299         * icf.cc (get_section_contents): Add '@' marker after processing the
6300         merge reloc.
6301
6302 2010-03-08  Doug Kwan  <dougkwan@google.com>
6303
6304         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6305         due to a conversion warning.
6306         (Arm_relobj::update_output_local_symbol_count): Check for local
6307         symbol with unset output index.
6308
6309 2010-03-05  Ian Lance Taylor  <iant@google.com>
6310
6311         * options.h (class General_options): Add --spare-dynamic-tags.
6312         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6313         --spare-dynamic-tags.
6314
6315 2010-03-05  Ian Lance Taylor  <iant@google.com>
6316
6317         * incremental.cc: Include "libiberty.h".
6318
6319 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6320
6321         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6322         function, is_info_ member.
6323         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6324         (Versions::Versions): Update caller.
6325         (Versions::define_base_version): Likewise.
6326         (Versions::add_def): Likewise.
6327
6328 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6329
6330         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6331         (Scan::possible_function_pointer_reloc): New function.
6332         (Scan::local_reloc_may_be_function_pointer): Change to call
6333         possible_function_pointer_reloc.
6334         (Scan::global_reloc_may_be_function_pointer): Ditto.
6335         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6336         relocations in ".data.rel.ro._ZTV" section.
6337         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6338         * testsuite/icf_safe_so_test.cc: Ditto.
6339         * testsuite/icf_safe_test.cc: Ditto.
6340         * testsuite/icf_safe_test.sh: Ditto.
6341
6342 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6343             Ian Lance Taylor  <iant@google.com>
6344
6345         * target-reloc.h (relocate_section): Check the symbol table index
6346         for -1U before setting the local symbol index.
6347         (scan_relocatable_relocs): If copying the relocation, record that
6348         the local symbol is required.
6349         * object.h (Symbol_value::is_output_symtab_index_set): New
6350         function.
6351         (Symbol_value::may_be_discarded_from_output_symtab): New
6352         function.
6353         (Symbol_value::has_output_symtab_entry): New function.
6354         (Symbol_value::needs_output_symtab_entry): Remove.
6355         (Symbol_value::output_symtab_index): Make sure the symbol index is
6356         set.
6357         (Symbol_value::set_output_symtab_index): Make sure the symbol
6358         index is not set.  Make sure the new index is valid.
6359         (Symbol_value::set_must_have_output_symtab_entry): New function.
6360         (Symbol_value::has_output_dynsym_entry): New function.
6361         (Symbol_value::set_output_dynsym_index): Make sure the new index
6362         is valid.
6363         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6364         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6365         local symbol if permitted.
6366         (Sized_relobj::do_finalize_local_symbols): Call
6367         is_output_symtab_index_set rather than needs_output_symtab_entry.
6368         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6369         rather than needs_output_symtab_entry.  Call
6370         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6371         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6372         is_output_symtab_index_set rather than needs_output_symtab_entry.
6373         * testsuite/discard_locals_relocatable_test.c: New file.
6374         * testsuite/discard_locals_test.sh: Test -r.
6375         * testsuite/Makefile.am (check_DATA): Add
6376         discard_locals_relocatable_test1.syms,
6377         discard_local_relocatable_test2.syms.
6378         (MOSTLYCLEANFILES): Likewise.  Also add
6379         discard_locals_relocatable_test1.lout and
6380         discard_locals_relocatable_test2.out.
6381         (discard_locals_relocatable_test1.syms): New target.
6382         (discard_locals_relocatable_test.o): New target.
6383         (discard_locals_relocatable_test1.out): New target.
6384         (discard_locals_relocatable_test2.syms): New target.
6385         (discard_locals_relocatable_test2.out): New target.
6386         (various): Add missing ../ld-new dependencies.
6387         * testsuite/Makefile.in: Rebuild.
6388
6389 2010-03-03  Nick Clifton  <nickc@redhat.com>
6390
6391         * po/fi.po: New Finnish translation.
6392
6393 2010-03-01  Doug Kwan  <dougkwan@google.com>
6394
6395         * layout.cc (Layout::Layout): Force section types of .init_array*,
6396         .preinit_array* and .fini_array* sections.
6397         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6398         Fix check of return value of std::string::find.().
6399         (Output_section::Input_section_sort_compare::operator()): Remove
6400         comment about .init_array.
6401         (Output_section::Input_section_sort_init_fini_compare::operator()):
6402         New method.
6403         (Output_section::sort_attached_input_sections): Handle .init_array
6404         and .fini_array specially.
6405         * output.h (Output_section::Inut_section_sort_compare): Update
6406         comment.
6407         (Output_section::Input_section_sort_init_fini_compare): New struct.
6408
6409 2010-02-26  Doug Kwan  <dougkwan@google.com>
6410
6411         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6412         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6413         * testsuite/debug_msg.sh: Avoid matching source line number for
6414         use of global variable undef_int.
6415
6416 2010-02-26  Doug Kwan  <dougkwan@google.com>
6417
6418         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6419         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6420         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6421         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6422         * options.cc (General_options::General_options): Initialize member
6423         fix_v4bx_.
6424         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6425         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6426         and rm_no_fix_v4bx.stdout
6427         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6428         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6429         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6430         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6431         and arm_no_fix_v4bx.
6432         * Makefile.in: Regenerate.
6433         * testsuite/arm_fix_v4bx.s: New file.
6434         * testsuite/arm_fix_v4bx.sh: Ditto.
6435
6436 2010-02-24  Doug Kwan  <dougkwan@google.com>
6437
6438         * arm.cc (Target_arm::got_section): Make the .got section the first
6439         non RELRO section in the data segment.
6440         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6441         suffixes of section names.
6442
6443 2010-02-24  Doug Kwan  <dougkwan@google.com>
6444
6445         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6446         flags and attributes merging if an input file is a binary file.
6447         * fileread.cc (Input_file::open): Record format of original file.
6448         * fileread.h (Input_file::Format): New enum type.
6449         (Input_file::Input_file): Initialize data member format_.
6450         (Input_file::format): New method definition.
6451         (Input_file::format_):: New data member.
6452
6453 2010-02-24  Doug Kwan  <dougkwan@google.com>
6454
6455         * arm.cc (Arm_output_data_got): New class.
6456         (ARM_TCB_SIZE): New constant
6457         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6458         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6459         If user uses a script with a SECTIONS clause, issue only a warning
6460         for a misplaced EXIDX input section.  Otherwise, issue an error.
6461         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6462         garbage collection.
6463         (Target_arm::got_mode_index_entry): Handle static linking.
6464         (Target_arm::Scan::local): Ditto.
6465         (Target_arm::Scan::global): Ditto.
6466         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6467         all incorrectly implemented relocations.
6468         (Target_arm::fix_exidx_coverage): Pass layout to
6469         Arm_output_section::fix_exidx_coverage.
6470         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6471         from ".ARM.exidx." and ".ARM.extab.".
6472
6473 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6474
6475         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6476         section if it does not already exist.
6477         * attributes.cc (Attributes_section_data::Attributes_section_data):
6478         Don't crash if size is zero.
6479
6480 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6481             Ian Lance Taylor  <iant@google.com>
6482
6483         * gold.cc (queue_middle_tasks): If no input files were opened,
6484         exit.
6485         * workqueue.h (Task_function::Task_function): Assert that there is
6486         a blocker.
6487
6488 2010-02-22  Doug Kwan  <dougkwan@google.com>
6489
6490         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6491         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6492         types to avoid warnings due to different uint64_t implementations
6493         on different hosts.
6494
6495 2010-02-21  Doug Kwan  <dougkwan@google.com>
6496
6497         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6498         handling of the maximum backward branch offset.
6499         (Arm_relocate_functions::thumb_branch_common): Ditto.
6500         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6501         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6502         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6503         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6504         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6505         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6506         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6507         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6508         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6509         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6510         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6511         thumb2_bl_out_of_range.o): New rules.
6512         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6513         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6514         thumb2_bl_out_of_range
6515         * testsuite/Makefile.in: Regenerate.
6516         * testsuite/arm_bl_in_range.s: New file.
6517         * testsuite/arm_bl_out_of_range.s: Ditto.
6518         * testsuite/arm_branch_in_range.sh: Ditto.
6519         * testsuite/arm_branch_range.t: Ditto.
6520         * testsuite/thumb2_branch_range.t: Ditto.
6521         * testsuite/thumb_bl_in_range.s: Ditto.
6522         * testsuite/thumb_bl_out_of_range.s: Ditto.
6523         * testsuite/thumb_branch_range.t: Ditto.
6524
6525 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6526
6527         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6528         Add reloc offset information.
6529         * icf.cc (get_section_contents): Change iterators to point to the new
6530         vectors. Add reloc offset information to the contents.
6531         * icf.h (Icf::Sections_reachable_info): New typedef.
6532         (Icf::Sections_reachable_list): New typedef.
6533         (Icf::Offset_info): New typedef.
6534         (Icf::Reloc_info): New struct typedef.
6535         (Icf::Reloc_info_list): New typedef.
6536         (Icf::symbol_reloc_list): Delete method.
6537         (Icf::addend_reloc_list): Delete method.
6538         (Icf::section_reloc_list): Delete method.
6539         (Icf::reloc_info_list): New method.
6540         (Icf::reloc_info_list_): New member.
6541
6542 2010-02-19  Doug Kwan  <dougkwan@google.com>
6543
6544         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6545         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6546         * arm.cc (Arm_relocation_functions): New forward declaration.
6547         (Target_arm::Target_arm): Initialize new data members
6548         got_mod_index_offset_ and tls_base_symbol_defined_.
6549         (Target_arm::Relocate::relocate_tls): New method.
6550         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6551          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6552         New methods.
6553         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6554         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6555         (Target_arm::got_mod_index_offset_,
6556         Target_arm::tls_base_symbol_defined_): New data members.
6557         (Target_arm::Scan::local, Target::Scan::global,
6558         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6559         relocations.
6560
6561 2010-02-18  Doug Kwan  <dougkwan@google.com>
6562
6563         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6564         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6565         text section as a parameter becuase some broken tools may not set
6566         the link in section header.
6567         (Target_arm::has_got_section): New method.
6568         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6569         without any mapping symbol as data only.  Remove warning.
6570         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6571         link in its section header, try to discover the link by inspecting the
6572         REL31 relocation at the beginning of the section.
6573         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6574         in error message.
6575         (Target_arm::Scan::global): Treat any reference to the symbol
6576         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6577
6578 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6579
6580         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6581         (Scan::global_reloc_may_be_function_pointer): New function.
6582         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6583         (Scan::global_reloc_may_be_function_pointer): New function.
6584         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6585         (Scan::global_reloc_may_be_function_pointer): New function.
6586         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6587         (Scan::global_reloc_may_be_function_pointer): New function.
6588         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6589         (Scan::global_reloc_may_be_function_pointer): New function.
6590         (Scan::possible_function_pointer_reloc): New function.
6591         (Target_x86_64::can_check_for_function_pointers): New function.
6592         * gc.h (gc_process_relocs): Scan relocation types to determine if
6593         function pointers were taken for targets that support it.
6594         * icf.cc (Icf::find_identical_sections): Include functions for
6595         folding in safe ICF whose pointer is not taken.
6596         * icf.h (Secn_fptr_taken_set): New typedef.
6597         (fptr_section_id_): New member.
6598         (section_has_function_pointers): New function.
6599         (set_section_has_function_pointers): New function.
6600         (check_section_for_function_pointers): New function.
6601         * options.h: Fix comment for safe ICF option.
6602         * target.h (can_check_for_function_pointers): New function.
6603         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6604         Modify icf_safe_test for X86-64.
6605         * testsuite/Makefile.in: Regenerate.
6606         * testsuite/icf_safe_so_test.cc: New file.
6607         * testsuite/icf_safe_so_test.sh: New file.
6608         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6609         (main): Change to take pointer to function kept_func_3.
6610         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6611         folding is done correctly for X86-64.
6612
6613 2010-02-12  David S. Miller  <davem@davemloft.net>
6614
6615         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6616         is_symbolless parameter.
6617         (Output_reloc<SHT_REL>::is_symbolless): New.
6618         (Output_reloc<SHT_REL>::is_symbolless_): New.
6619         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6620         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6621         (Output_reloc<SHT_RELA>::is_symbolless): New.
6622         (Output_data_reloc::add_global): Handle is_symbolless.
6623         (Output_data_reloc::add_global_relative): Likewise.
6624         (Output_data_reloc::add_local): Likewise.
6625         (Output_data_reloc::add_local_relative): Likewise.
6626         (Output_data_reloc::add_symbolless_global_addend): New.
6627         (Output_data_reloc::add_symbolless_local_addend): New.
6628         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6629         is_symbolless.
6630         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6631         instead of ->is_relative_
6632         (Output_reloc::write): Likewise.
6633         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6634         (Output_reloc::write_rel): Simplify.
6635
6636         * sparc.cc (Target_sparc::Scan::local): Use
6637         ->add_symbolless_local_addend as needed.
6638         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6639         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6640         based upon relocation offset.
6641
6642 2010-02-11  Doug Kwan  <dougkwan@google.com>
6643
6644         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6645         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6646         beginning of function.
6647         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6648         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6649         parameter is_32bit in calls to should_apply_static_reloc.
6650         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6651         (check_DATA): Add arm_abs_global.stdout.
6652         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6653         arm_abs_global.stdout): New rules.
6654         (MOSTLLYCLEANFILES): Add arm_abs_global
6655         * Makefile.in: Regenerate.
6656         * testsuite/arm_abs_global.s: New file.
6657         * testsuite/arm_abs_global.sh: Ditto.
6658         * testsuite/arm_abs_lib.s: Ditto.
6659
6660 2010-02-11  Ian Lance Taylor  <iant@google.com>
6661
6662         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6663         Read_relocs task.
6664         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6665         Allocate_commons_task first.
6666         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6667         task, rather than symtab_lock_.
6668         (Gc_process_relocs::~Gc_process_relocs): New function.
6669         (Gc_process_relocs::is_runnable): Check this_blocker_.
6670         (Gc_process_relocs::locks): Use next_blocker_ rather than
6671         blocker_.
6672         (Scan_relocs::~Scan_relocs): New function.
6673         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6674         symtab_lock_.
6675         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6676         next_blocker_.
6677         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6678         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6679         constructor accordingly.
6680         (class Gc_process_relocs): Likewise.
6681         (class Scan_relocs): Likewise.
6682         * common.h (class Allocate_commons_task): Remove symtab_lock_
6683         field, and corresponding constructor parameter.
6684         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6685         symtab_lock_.
6686         (Allocate_commons_task::locks): Likewise.
6687
6688 2010-02-11  Ian Lance Taylor  <iant@google.com>
6689
6690         * gold-threads.h (class Once): Define.
6691         (class Initialize_lock): Rewrite as child of Once.
6692         * gold-threads.cc (class Once_initialize): Define.
6693         (once_pointer_control): New static variable.
6694         (once_pointer, once_arg): New static variables.
6695         (c_run_once): New static function.
6696         (Once::Once, Once::run_once, Once::internal_run): New functions.
6697         (class Initialize_lock_once): Remove.
6698         (initialize_lock_control): Remove.
6699         (initialize_lock_pointer): Remove.
6700         (initialize_lock_once): Remove.
6701         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6702         (Initialize_lock::initialize): Rewrite.
6703         (Initialize_lock::do_run_once): New function.
6704         * archive.cc (Archive::interpret_header): Only clear name if it is
6705         not already empty.
6706         * fileread.cc: Include "gold-threads.h"
6707         (file_counts_lock): New static variable.
6708         (file_counts_initialize_lock): Likewise.
6709         (File_read::release): Only increment counts when using --stats.
6710         Use a lock around the increment.
6711         * parameters.cc (class Set_parameters_target_once): Define.
6712         (set_parameters_target_once): New static variable.
6713         (Parameters::Parameters): Move here from parameters.h.
6714         (Parameters::set_target): Rewrite.
6715         (Parameters::set_target_once): New function.
6716         (Parameters::clear_target): Move here and rewrite.
6717         * parameters.h (class Parameters): Update declarations.  Add
6718         set_parameters_target_once_ field.
6719         (Parameters::Parameters): Move to parameters.cc.
6720         (Parameters::clear_target): Likewise.
6721         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6722         task.
6723         (Start_group::~Start_group): New function.
6724         (Start_group::is_runnable): New function.
6725         (Start_group::locks, Start_group::run): New functions.
6726         (Finish_group::run): Change saw_undefined to size_t.
6727         * readsyms.h (class Start_group): Define.
6728         (class Finish_group): Change saw_undefined_ field to size_t.
6729         (Finish_group::Finish_group): Remove saw_undefined and
6730         this_blocker parameters.  Change all callers.
6731         (Finish_group::set_saw_undefined): New function.
6732         (Finish_group::set_blocker): New function.
6733         * symtab.h (class Symbol_table): Change saw_undefined to return
6734         size_t.  Change saw_undefined_ field to size_t.
6735         * target-select.cc (Set_target_once::do_run_once): New function.
6736         (Target_selector::Target_selector): Initialize set_target_once_
6737         field.  Don't initialize lock_ and initialize_lock_ fields.
6738         (Target_selector::instantiate_target): Rewrite.
6739         (Target_selector::set_target): New function.
6740         * target-select.h (class Set_target_once): Define.
6741         (class Target_selector): Update declarations.  Make
6742         Set_target_once a friend.  Remove lock_ and initialize_lock_
6743         fields.  Add set_target_once_ field.
6744
6745 2010-02-10  Ian Lance Taylor  <iant@google.com>
6746
6747         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6748         queueing any tasks.
6749         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6750         (queue_middle_tasks): Add all blockers before queueing any tasks.
6751         (queue_final_tasks): Likewise.
6752         * token.h (Task_token::add_blockers): New function.
6753         * object.h (Input_objects::number_of_relobjs): New function.
6754
6755 2010-02-10  Ian Lance Taylor  <iant@google.com>
6756
6757         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6758         shared, not if not position independent.
6759         * x86_64.cc (Relocate::relocate_tls): Likewise.
6760         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6761         (tls_pie_pic_test): New target.
6762         * testsuite/Makefile.in: Rebuild.
6763
6764         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6765         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6766         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6767         * testsuite/Makefile.in: Rebuild.
6768
6769 2010-02-09  David S. Miller  <davem@davemloft.net>
6770
6771         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6772         R_SPARC_RELATIVE using ->add_local_relative().
6773         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6774
6775         * output.h (Output_data_dynamic::add_section_size): New method
6776         that takes two Output_data objects.
6777         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6778         entry param.  Handle it in initializers.
6779         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6780         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6781         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6782         arg.
6783         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6784         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6785         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6786         for dynrel_includes_plt.
6787         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6788         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6789         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6790         before .rela.plt
6791         (Target_sparc::do_finalize_sections): Update to pass true for
6792         dynrel_includes_plt.
6793         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6794         output before .rela.plt
6795         (Target_powerpc::do_finalize_sections): Update to pass true for
6796         dynrel_includes_plt when 32-bit.
6797
6798 2010-02-08  Doug Kwan  <dougkwan@google.com>
6799
6800         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6801         method.
6802         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6803         Arm_relobj::scan_section_for_cortex_a8_stubs,
6804         Arm_relobj::do_relocation_section): Instead of calling
6805         Output_section::output_address, use faster
6806         Arm_relobj::simple_input_section_output_address.
6807
6808 2010-02-08  David S. Miller  <davem@davemloft.net>
6809
6810         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6811         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6812         relocation helper function.
6813
6814         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6815         just like R_SPARC_GOT{10,13,22}.
6816         (Target_sparc::Scan::local): Likewise.
6817         (Target_sparc::Relocate:relocate): Likewise.
6818
6819 2010-02-06  Ian Lance Taylor  <iant@google.com>
6820
6821         * configure.ac: Rewrite targetobjs duplicate removal code to use
6822         only shell constructs.
6823         * configure: Rebuild.
6824
6825 2010-02-05  Doug Kwan  <dougkwan@google.com>
6826
6827         PR 11247
6828         * arm.cc (Arm_relobj::section_is_scannable): New method.
6829         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6830         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6831
6832 2010-02-04  Doug Kwan  <dougkwan@google.com>
6833
6834         PR 11247
6835         * arm-reloc-property.cc (cstdio): Include.
6836         * configure.ac (targetobjs): Remove duplicates.
6837         * configure: Regenerate.
6838         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6839         big and little endian version for a given address size.
6840
6841 2010-02-03  Doug Kwan  <dougkwan@google.com>
6842
6843         * arm-reloc-property.cc
6844         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6845         definition.
6846         * arm-reloc-property.h
6847         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6848         New method definition.
6849         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6850         declaration.
6851         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6852         overflow to N.
6853         (GOT_PREL): Change implemented to Y.
6854         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6855         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6856         (Arm_relocate_functions::movw_abs_nc): Remove method.
6857         (Arm_relocate_functions::movt_abs): Ditto.
6858         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6859         (Arm_relocate_functions::thm_movt_abs): Ditto.
6860         (Arm_relocate_functions::movw_rel_nc): Ditto.
6861         (Arm_relocate_functions::movw_rel): Ditto.
6862         (Arm_relocate_functions::movt_rel): Ditto.
6863         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6864         (Arm_relocate_functions:thm_movw_rel): Ditto.
6865         (Arm_relocate_functions:thm_movt_rel): Ditto.
6866         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6867         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6868         New method definitions.
6869         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6870         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6871         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6872         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6873         (Target_arm::Relocate::relocate): Check for non-static or
6874         unimplemented relocation code and exit early.  Change calls to
6875         Target_arm::reloc_uses_thumb_bit and
6876         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6877         instead.  Refactor code to handle similar relocations to increase
6878         code sharing.  Remove check for unsupported relocation code in switch
6879         statement.
6880         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6881         relocation property table to find out size.  Change error message to
6882         print out the name of a relocation code instead of the numeric value.
6883         (Target_arm::scan_reloc_for_stub): Use relocation property table
6884         instead of calling Target_arm::reloc_uses_thumb_bit().
6885
6886 2010-02-02  Doug Kwan  <dougkwan@google.com>
6887
6888         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6889         types of relaxed input section.
6890
6891 2010-02-02  Doug Kwan  <dougkwan@google.com>
6892
6893         * Makefile.am (HFILES): Add arm-reloc-property.h.
6894         (DEFFILES): New.
6895         (TARGETSOURCES): Add arm-reloc-property.cc
6896         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6897         (libgold_a_SOURCES): $(DEFFILES)
6898         * Makefile.in: Regenerate.
6899         * arm-reloc-property.cc: New file.
6900         * arm-reloc-property.h: New file.
6901         * arm-reloc.def: New file.
6902         * arm.cc: Update comments.
6903         (arm-reloc-property.h): New included header.
6904         (arm_reloc_property_table): New global variable.
6905         (Target_arm::do_select_as_default_target): New method definition.
6906         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6907         arm-reloc-property to targ_extra_obj.
6908         * parameters.cc (set_parameters_target): Call
6909         Target::select_as_default_target().
6910         * target.h (Target::select_as_default_target): New method definition.
6911         (Target::do_select_as_default_target): Same.
6912
6913 2010-02-01  Doug Kwan  <dougkwan@google.com>
6914
6915         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6916         first_output_text_section_.
6917         (Arm_exidx_fixup::first_output_text_section): New method definition.
6918         (Arm_exidx_fixup::first_output_text_section_): New data member.
6919         (Arm_exidx_fixup::process_exidx_section): Record the first text
6920         output section seen.
6921         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6922         and entsize in output section header.
6923
6924 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6925
6926         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6927         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6928         (Arm_relocate_functions::thm_alu11): New Method.
6929         (Arm_relocate_functions::thm_pc8): New Method.
6930         (Arm_relocate_functions::thm_pc12): New Method.
6931         (Target_arm::Scan::local): Handle the relocations.
6932         (Target_arm::Scan::global): Likewise.
6933         (Target_arm::Relocate::relocate): Likewise.
6934         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6935
6936 2010-01-29  Doug Kwan  <dougkwan@google.com>
6937
6938         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6939         of relocation types as ld.
6940
6941 2010-01-29  Doug Kwan  <dougkwan@google.com>
6942
6943         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6944         to public.
6945         (Arm_relocate_functions::thumb_branch_common): Ditto.
6946         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6947         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6948         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6949         Arm_relocate_functions::jump24): Remove.
6950         (Target_arm::Relocate::relocate): Adjust code to call
6951         Arm_relocation_functions::arm_branch_common and
6952         Arm_relocation_functions::thumb_branch_common instead of their removed
6953         wrappers.  Merge switch-cases together to reduce source code size.
6954
6955 2010-01-29  Doug Kwan  <dougkwan@google.com>
6956
6957         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6958         output_local_symbol_count_needs_update_.
6959         (Arm_relobj::output_local_symbol_count_needs_update,
6960          Arm_relobj::set_output_local_symbol_count_needs_update,
6961          Arm_relobj::update_output_local_symbol_count): New methods.
6962         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6963         member.
6964         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6965         of pointed function as in a R_ARM_PREL31 relocation.
6966         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6967         for output local symbol count updating.
6968         (Target_arm::do_relax): Update output local symbol counts in objects
6969         if necessary.
6970         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6971
6972 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6973
6974         * arm.cc: Added support for the ARM relocations:
6975         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6976         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6977         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6978         movw_prel_nc).
6979         (Arm_relocate_functions::movw_rel): New method.
6980         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6981         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6982         thm_movw_prel_nc).
6983         (Arm_relocate_functions::thm_movw_rel): New method.
6984         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6985         thm_movt_prel).
6986         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6987         relocations.
6988         (Target_arm::Scan::global): Likewise.
6989         (Target_arm::Relocate::relocate): Likewise.
6990         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6991         Likewise.
6992
6993 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6994
6995         * arm.cc: Added support for ARM group relocations.
6996         (Target_arm::reloc_needs_sym_origin): New method.
6997         (Arm_relocate_functions::calc_grp_kn): New method.
6998         (Arm_relocate_functions::calc_grp_residual): New method.
6999         (Arm_relocate_functions::calc_grp_gn): New method.
7000         (Arm_relocate_functions::arm_grp_alu): New Method.
7001         (Arm_relocate_functions::arm_grp_ldr): New Method.
7002         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7003         (Arm_relocate_functions::arm_grp_ldc): New Method.
7004         (Target_arm::Scan::local): Handle the ARM group relocations.
7005         (Target_arm::Scan::global): Likewise.
7006         (Target_arm::Relocate::relocate): Likewise.
7007         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7008         Likewise.
7009
7010 2010-01-26  Doug Kwan  <dougkwan@google.com>
7011
7012         * arm.cc (set): Include.
7013         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7014         pointer type.
7015         (Arm_output_section::Text_section_list): New type.
7016         (Arm_output_section::append_text_sections_to_list): New method.
7017         (Arm_output_section::fix_exidx_coverage): Ditto.
7018         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7019         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7020         Relobj::set_section_offset() instead of
7021         Sized_relobj::invalidate_section_offset().
7022         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7023         parameter for section headers. Ignore relocation sections for
7024         unallocated sections and EXIDX sections.
7025         (Target_arm::fix_exidx_coverage): New method.
7026         (Target_arm::output_section_address_less_than): New type.
7027         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7028         linked text section instead of the EXIDX section.
7029         (Arm_output_section::create_stub_group): Add an assertion to check
7030         that this is not an EXIDX output section.
7031         (Arm_output_section::append_text_sections_to_list): New method.
7032         (Arm_output_section::fix_exidx_coverage): Ditto.
7033         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7034         Arm_relobj::section_needs_reloc_stub_scanning.
7035         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7036         first pass.
7037         (Target_arm::fix_exidx_coverage): New method.
7038         * object.h (Relobj::set_output_section): New method.
7039         (Sized_relobj::invalidate_section_offset): Remove method.
7040         (Sized_relobj::do_invalidate_section_offset): Remove method.
7041         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7042
7043 2010-01-25  Doug Kwan  <dougkwan@google.com>
7044
7045         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7046         Fix warning due to signed and unsigned comparison on a 32-bit host.
7047
7048 2010-01-22  Doug Kwan  <dougkwan@google.com>
7049
7050         * arm.cc (Target_arm::do_relax): Record an output section for section
7051         offset adjustment it contains any stub table that has changed.
7052         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7053         offsets in an output section if necessary.
7054         * output.cc (Output_section::Output_section): Initialize
7055         section_offsets_need_adjustments_.
7056         (Output_section::add_input_section_for_script): Renamed to
7057         Output_section::add_simple_input_section.
7058         (Output_section::save_states): Add a comment.
7059         (Output_section::discard_states): New method defintion.
7060         (Output_section::adjust_section_offsets): Same.
7061         * output.h (Output_section::add_input_section_for_script): Renamed to
7062         Output_section::add_simple_input_section.
7063         (Output_section::discard_states): New method declaration.
7064         (Output_section::adjust_section_offsets): Same.
7065         (Output_section::section_offsets_need_adjustment,
7066         Output_section::set_section_offsets_need_adjustment): New method
7067         definitions.
7068         (Output_section::section_offsets_need_adjustment_): New data member.
7069         * script-sections.cc
7070         (Output_section_element_input::set_section_address): Adjust code for
7071         renaming of Output_section::add_input_section_for_script.
7072         (Orphan_output_section::set_section_address): Same.
7073
7074 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7075
7076         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7077         Fix_v4bx enum values .
7078         * gold/options.h (General_options): New option definitions.
7079         (General_options::fix_v4bx): New method.
7080         (General_options::Fix_v4bx): New enum.
7081         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7082         (General_options::parse_fix_v4bx_interworking): New method.
7083
7084 2010-01-22  Doug Kwan  <dougkwan@google.com>
7085
7086         * arm.cc (Arm_exidx_fixup): New class.
7087
7088 2010-01-21  Doug Kwan  <dougkwan@google.com>
7089
7090         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7091         classes.
7092         (Arm_exidx_section_offset_map): New type.
7093
7094 2010-01-21  Doug Kwan  <dougkwan@google.com>
7095
7096         * arm.cc (Arm_exidx_input_section): New class.
7097         (Arm_relobj::exidx_input_section_by_link,
7098         Arm_relobj::exidx_input_section_by_shndx,
7099         Arm_relobj::make_exidx_input_section): New methods.
7100         (read_arm_attributes_section): Remove.
7101         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7102         information about them.
7103         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7104         to here.
7105
7106 2010-01-20  Doug Kwan  <dougkwan@google.com>
7107
7108         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7109         Input_section_specifier to Section_id.
7110         (Target_arm::new_arm_input_section: Adjust code for change of key
7111         type.
7112         (Target_arm::find_arm_input_section): Ditto.
7113         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7114         (Section_id): Remove.
7115         (Garbage_collection::Section_id_hash): Remove.
7116         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7117         (Section_id): Remove.
7118         (Icf::Section_id_hash): Remove.
7119         * object.h (Section_id, Const_section_id, Section_id_hash,
7120         Const_section_id_hash): New type definitions.
7121         * output.cc (Output_section::add_relaxed_input_section): Change to
7122         use Const_section_id instead of Input_section_specifier as key type.
7123         (Output_section::add_merge_input_section): Ditto.
7124         (Output_section::build_relaxation_map): Change to use Section_id
7125         instead of Input_section_specifier as key type.
7126         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7127         Ditto.
7128         (Output_section::convert_input_sections_to_relaxed_sections): Change
7129         to use Const_section_id instead of Input_section_specifier as key type.
7130         (Output_section::find_merge_section): Ditto.
7131         (Output_section::find_relaxed_input_section): Ditto.
7132         * output.h (Input_section_specifier): Remove class.
7133         (Output_section::Output_section_data_by_input_section_map): Change
7134         key type to Const_section_id.
7135         (Output_section::Output_relaxed_input_section_by_input_section_map):
7136         Ditto.
7137         (Output_section::Relaxation_map): Change key type to Section_id.
7138
7139 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7140
7141         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7142         (class Arm_v4bx_stub): New class.
7143         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7144         (Stub_factory::make_arm_v4bx_stub): New method.
7145         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7146         (Stub_table::empty): Handle v4bx stubs.
7147         (Stub_table::add_arm_v4bx_stub): New method.
7148         (Stub_table::find_arm_v4bx_stub): New method.
7149         (Arm_relocate_functions::v4bx): New method.
7150         (Target_arm::fix_v4bx): New method.
7151         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7152         (Stub_table::relocate_stubs): Likewise.
7153         (Stub_table::do_write): Likewise.
7154         (Stub_table::update_data_size_and_addralign): Likewise.
7155         (Stub_table::finalize_stubs):  Likewise.
7156         (Target_arm::Scan::local): Likewise.
7157         (Target_arm::Scan::global): Likewise.
7158         (Target_arm::do_finalize_sections): Likewise.
7159         (Target_arm::Relocate::relocate): Likewise.
7160         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7161         Likewise.
7162         (Target_arm::scan_reloc_for_stub): Likewise.
7163         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7164
7165 2010-01-19  Ian Lance Taylor  <iant@google.com>
7166
7167         * output.cc (Output_section_headers::do_sized_write): Write large
7168         segment count to sh_info field.
7169         (Output_file_header::do_sized_write): For large segment count,
7170         write PN_XNUM to e_phnum field.
7171
7172 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7173
7174         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7175         (Arm_relocate_functions::thm_jump8): New function.
7176         (Arm_relocate_functions::thm_jump11): New function.
7177         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7178         R_ARM_THM_JUMP11.
7179         (Target_arm::Scan::global): Likewise.
7180         (Target_arm::Relocate::relocate): Likewise.
7181         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7182         Likewise.
7183
7184 2010-01-14  Doug Kwan  <dougkwan@google.com>
7185
7186         * arm.cc (map, utility): Include headers.
7187         (Target_arm::apply_cortex_a8_workaround): New method.
7188         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7189         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7190         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7191         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7192         the --[no-]fix-cortex-a8 command line options.
7193         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7194         (Target_arm::relocate_stub): Use addend in instruction template.
7195         * options.h (DEFINE_bool): Set the user-set flag.
7196         (General_options): Add --[no-]-fix-cortex options.
7197         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7198         : Update fast look-up map after conversion.
7199
7200 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7201
7202         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7203         in the first pass of do_layout.
7204
7205 2010-01-13  Doug Kwan  <dougkwan@google.com>
7206
7207         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7208         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7209         apparent compiler problem of not folding static constant integral
7210         data members of elfcpp::Elf_sizes<32>.
7211
7212 2010-01-13  Doug Kwan  <dougkwan@google.com>
7213
7214         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7215         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7216         Arm_relobj::scan_section_for_cortex_a8_erratum,
7217         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7218         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7219         sections to scan for relocation stubs into a new method
7220         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7221         relocation and Cortex-A8 stub scanning.
7222         (Target_arm::do_relax): Force stubs to be after stubbed sections
7223         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7224         the beginning of a new relaxation pass.  Update a comment.
7225         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7226
7227 2010-01-12  Ian Lance Taylor  <iant@google.com>
7228
7229         * target-reloc.h (visibility_error): New inline function.
7230         (relocate_section): Call visibility_error.
7231         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7232         (MOSTLYCLEANFILES): Likewise.
7233         (protected_4_pic.o, protected_3.err): New targets.
7234         * testsuite/protected_4.cc: New file.
7235
7236 2010-01-12  Doug Kwan  <dougkwan@google.com>
7237
7238         * arm.cc (Cortex_a8_reloc): New class.
7239         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7240         and cortex_a8_relocs_info_.
7241         (Target_arm::fix_cortex_a8): New method definition.
7242         (Target_arm::Cortex_a8_relocs_info): New type.
7243         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7244         New data member declarations.
7245         (Target_arm::scan_reloc_for_stub): Record information about
7246         relocations for THUMB branches that might be exempted from the
7247         Cortex-A8 workaround.
7248         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7249         at the beginning of a relaxation pass.
7250
7251 2010-01-12  Doug Kwan  <dougkwan@google.com>
7252
7253         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7254         (Arm_relobj::Mapping_symbol_position,
7255          Arm_reloj::Mapping_symbol_position_less,
7256          Arm_relobj::Mapping_symbols_info): New types.
7257         (Target_arm::is_mapping_symbol_name): New method definition.
7258         (Arm_relobj::do_count_local_symbols): Save information about mapping
7259         symbols.
7260
7261 2010-01-11  Doug Kwan  <dougkwan@google.com>
7262
7263         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7264         Arm_relocate_functions::thumb32_branch_upper,
7265         Arm_relocate_functions::thumb32_branch_lower,
7266         Arm_relocate_functions::thumb32_cond_branch_offset,
7267         Arm_relocate_functions::thumb32_cond_branch_upper,
7268         Arm_relocate_functions::thumb32_cond_branch_lower,
7269         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7270         branch offset encoding.
7271         (Arm_relocate_functions::thumb_branch_common): Use new branch
7272         offset encoding methods to avoid code duplication.
7273         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7274         (Stub_addend_reader::operator()): Use new branch encoding method
7275         to avoid code duplication.
7276
7277 2010-01-11  Doug Kwan  <dougkwan@google.com>
7278
7279         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7280         (Target_arm::do_finalize_sections): Define special EXIDX section
7281         symbols only if referenced.
7282         * gc.h (Garbage_collection::add_reference): New method.
7283         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7284         code duplication.
7285
7286 2010-01-11  Ian Lance Taylor  <iant@google.com>
7287
7288         * script.cc (Version_script_info::build_expression_list_lookup):
7289         Change complaing about duplicate wildcard match from error to
7290         warning.
7291
7292         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7293         of 2009-12-30.
7294         (Version_script_info::Version_script_info): Initialize globs_,
7295         default_version_, default_is_global_, and exact_.  Don't
7296         initialize globals_ or locals_.
7297         (Version_script_info::build_lookup_tables): Build local symbols
7298         first.
7299         (Version_script_info::unquote): New function.
7300         (Version_script_info::add_exact_match): New function.
7301         (Version_script_info::build_expression_list_lookup): Remove lookup
7302         parameter.  Add is_global parameter.  Change all callers.  Handle
7303         wildcard pattern specially.  Unquote pattern.  Call
7304         add_exact_match.
7305         (Version_script_info::get_name_to_match): New function.
7306         (Version_script_info::get_symbol_version): New function.
7307         (Version_script_info::get_symbol_version_helper): Remove.
7308         (Version_script_info::check_unmatched_names): Call unquote.
7309         * script.h (class Version_script_info): Change get_symbol_version
7310         to be non-inline and add is_global parameter; change all callers.
7311         Rewrite symbol_is_local.  Update declarations.  Define struct
7312         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7313         Remove globals_ and locals_ members.  Add exact_, globs_,
7314         default_version_, is_global_.
7315         (Version_script_info::Glob): Remove pattern, add expression and
7316         is_global.  Update constructor.  Change all callers.
7317         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7318         default version.
7319         (Versions::symbol_section_contents): If a symbol is undefined, or
7320         defined in a dynamic object, set the version index to
7321         VER_NDX_LOCAL.
7322         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7323         symbol_is_local.
7324         (Symbol_table::add_from_pluginobj): Likewise.
7325         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7326
7327 2010-01-11  Doug Kwan  <dougkwan@google.com>
7328
7329         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7330         (incremental_dump_LDADD): Add linking option for libintl.
7331         * Makefile.in: Regenerate.
7332
7333 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7334
7335         PR gold/11144
7336         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7337         instead of -Ds.
7338         * testsuite/Makefile.in: Regenerated.
7339
7340 2010-01-10  Doug Kwan  <dougkwan@google.com>
7341
7342         * options.h (DEFINE_var): Use parentheses around argument varname__
7343         in macro body to avoid any unintended subsequent substitutions.
7344
7345 2010-01-10  Ian Lance Taylor  <iant@google.com>
7346
7347         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7348         candidates before doing symbol resolution.
7349
7350         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7351         ODR candidates if only one is weak.
7352
7353 2010-01-08  Ian Lance Taylor  <iant@google.com>
7354
7355         * script.cc (Version_script_info::build_expression_list_lookup):
7356         Don't warn about ambiguous version, just record the ambiguity.
7357         (Version_script_info::get_symbol_version_helper): Give error if
7358         version is ambiguous.
7359
7360 2010-01-08  Doug Kwan  <dougkwan@google.com>
7361
7362         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7363         prev_data_size_ and prev_addralign_.  Remove initializer for
7364         deleted data member has_been_changed_.
7365         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7366         to determine if the table is empty.
7367         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7368         Remove.
7369         (Stub_table::add_reloc_stub): Define method in class definition
7370         instead of just declaring it there.
7371         (Stub_table::add_cortex_a8_stub): New method definition.
7372         (Stub_table::update_data_size_and_addralign): Ditto.
7373         (Stub_table::finalize_stubs): Ditto.
7374         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7375         (Stub_table::do_addralign_): Return address alignment in the
7376         (Stub_table::do_reset_address_and_file_offset): Define method in
7377         class definition instead of declaring it there.  Set current data
7378         size to be the data size of the previous pass.
7379         (Stub_table::set_final_data_size): Use current data size as the
7380         final data size.
7381         (Stub_table::relocate_stub): Change parameter type of stub from
7382         Reloc_stub pointer to Stub pointer.
7383         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7384         (Stub_table::Cortex_a8_stub_list): New typedef.
7385         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7386          Stub_table::prev_addralign_): New data member.
7387         (Arm_relobj::Arm_relobj): Initialize data member
7388         section_has_cortex_a8_workaround_.
7389         (Arm_relobj::section_has_cortex_a8_workaround,
7390          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7391          definitions.
7392         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7393         declarations.
7394         (Target_arm::relocate_stub): Change parameter type of stub from
7395         Reloc_stub pointer to Stub pointer.
7396         (Insn_template::size, Insn_template::alignment): Handle
7397         THUMB16_SPECIAL_TYPE.
7398         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7399          Stub_table::update_data_size_and_addralign,
7400          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7401         definitions.
7402         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7403         (Stub_table::do_write): Ditto.
7404         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7405
7406 2010-01-08  Ian Lance Taylor  <iant@google.com>
7407
7408         PR 11108
7409         * symtab.h (class Symbol): Remove fields is_target_special_ and
7410         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7411         (Symbol::is_defined_in_discarded_section): New function.
7412         (Symbol::set_is_defined_in_discarded_section): New function.
7413         (Symbol::has_plt_offset): Rewrite.
7414         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7415         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7416         Don't initialize is_target_special_ or has_plt_offset_.
7417         Initialize is_defined_in_discarded_section_.
7418         (Symbol_table::add_from_relobj): If appropriate, set
7419         is_defined_in_discarded_section.
7420         * resolve.cc (Symbol::override_base_with_special): Don't test
7421         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7422         * target-reloc.h (relocate_section): Do special handling for
7423         symbols defined in discarded sections for global symbols as well
7424         as local symbols.
7425
7426 2010-01-08  Ian Lance Taylor  <iant@google.com>
7427
7428         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7429         the SHT_SYMTAB case.
7430
7431 2010-01-08  Ian Lance Taylor  <iant@google.com>
7432
7433         * object.cc (Sized_relobj::do_layout): Don't get confused if
7434         layout_eh_frame returns NULL.
7435
7436 2010-01-08  Ian Lance Taylor  <iant@google.com>
7437
7438         PR 11084
7439         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7440         dynamic symbol table, use the normal symbol table.
7441         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7442         symbol table.
7443
7444 2010-01-08  Ian Lance Taylor  <iant@google.com>
7445
7446         PR 11072
7447         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7448         sections.
7449
7450 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7451
7452         * version.cc (print_version): Change to "Copyright 2010".
7453
7454 2010-01-08  Ian Lance Taylor  <iant@google.com>
7455
7456         PR 10287
7457         PR 11063
7458         * i386.cc (class Target_i386): Change return type of plt_section
7459         to be non-const.
7460         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7461         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7462         tls_desc_rel_ field.
7463         (Output_data_plt_i386::rel_tls_desc): New function.
7464         (Target_i386::rel_tls_desc_section): New function.
7465         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7466         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7467         R_386_TLS_DESC reloc in rel_tls_desc_section.
7468         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7469         Define struct Tlsdesc_info.
7470         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7471         (Target_x86_64::do_reloc_symbol_index): New function.
7472         (Target_x86_64::add_tlsdesc_info): New function.
7473         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7474         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7475         tlsdesc_rel_ field.
7476         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7477         all callers.
7478         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7479         (Target_x86_64::rela_tlsdesc_section): New function.
7480         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7481         handling.
7482         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7483         (Target_x86_64::do_reloc_addend): New function.
7484         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7485         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7486         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7487         (Output_reloc::type): New function.
7488         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7489         (Output_reloc::is_target_specific): New function.
7490         (Output_reloc::target_arg): New function.
7491         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7492         absolute relocs and target specific relocs.
7493         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7494         add_target_specific.
7495         (class Output_data_reloc) [SHT_RELA]: Likewise.
7496         * output.cc (Output_reloc::Output_reloc): Add four new versions
7497         for absolute relocs and target specific relocs.
7498         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7499         (Output_reloc::get_symbol_index): Likewise.
7500         (Output_reloc::local_section_offset): Check that local_sym_index_
7501         is not TARGET_CODE or 0.
7502         (Output_reloc::symbol_value): Likewise.
7503         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7504         reloc.
7505         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7506         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7507         functions.
7508         * layout.cc (add_target_dynamic_tags): Use output section for
7509         DT_PLTRELSZ and DT_JMPREL.
7510
7511 2010-01-07  Ian Lance Taylor  <iant@google.com>
7512
7513         PR 11061
7514         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7515         function.
7516         (class Output_data_reloc_generic): Define.
7517         (class Output_data_reloc_base): Change base class to
7518         Output_data_reloc_generic.  Change add() method to call
7519         bump_relative_reloc_count for a relative reloc.  Remove
7520         sort_relocs_ field.
7521         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7522         to sort_relocs().
7523         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7524         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7525         appropriate.
7526         * layout.h (class Layout): Update declaration.
7527
7528 2010-01-07  Ian Lance Taylor  <iant@google.com>
7529
7530         * output.h (class Output_data): Add const version of
7531         output_section and do_output_section.
7532         (class Output_section_data): Add const version of
7533         do_output_section.
7534         (class Output_section): Likewise.
7535         * layout.cc (Layout::add_target_dynamic_tags): New function.
7536         * layout.h (class Layout): Update declarations.
7537         * arm.cc (Target_arm::do_finalize_sections): Use
7538         add_target_dynamic_tags.
7539         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7540         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7541         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7542         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7543
7544 2010-01-07  Ian Lance Taylor  <iant@google.com>
7545
7546         PR 11042
7547         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7548         object as needed.
7549
7550 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7551             Ian Lance Taylor  <iant@google.com>
7552
7553         PR 11019
7554         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7555         Xindex::read_symtab_xindex.
7556
7557 2010-01-07  Doug Kwan  <dougkwan@google.com>
7558
7559         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7560         (Insn_template::thumb16_bcond_insn): New method declaration.
7561         (Insn_template): Fix spelling.
7562         (Stub::thumb16_special): New method declaration.
7563         (Stub::do_write): Define virtual method which was previously pure
7564         virtual.
7565         (Stub::do_thumb16_special): New method declaration.
7566         (Stub::do_fixed_endian_write): New template member.
7567         (Reloc_stub::do_write): Remove.
7568         (Reloc_stub::do_fixed_endian_write): Remove.
7569         (Cortex_a8_stub): New class definition.
7570         (Stub_factory::make_cortex_a8_stub): New method definition.
7571         (Stub_factory::Stub_factory): Add missing static storage class
7572         qualifier for elf32_arm_stub_a8_veneer_blx.
7573
7574 2010-01-07  Ian Lance Taylor  <iant@google.com>
7575
7576         PR 10980
7577         * options.h (class General_options): Add --warn-unresolved-symbols
7578         and --error-unresolved-symbols.
7579         * errors.cc (Errors::undefined_symbol): Implement
7580         --warn-unresolved-symbols.
7581
7582         * options.h (class General_options): Add -z text and -z textoff.
7583         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7584
7585 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7586
7587         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7588         (Garbage_collection::cident_sections): New function.
7589         (Garbage_collection::add_cident_section): New function.
7590         (Garbage_collection::cident_sections_): New member.
7591         (gc_process_relocs): Add references to sections whose names are C
7592         identifiers.
7593         * gold.h (cident_section_start_prefix): New constant.
7594         (cident_section_stop_prefix): New constant.
7595         (is_cident): New function.
7596         * layout.cc (Layout::define_section_symbols): Replace string constants
7597         with the newly defined constants.
7598         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7599         C identifiers.
7600         * testsuite/Makefile.am: Add gc_orphan_section_test.
7601         * testsuite/Makefile.in: Regenerate.
7602         * testsuite/gc_orphan_section_test.cc: New file.
7603         * testsuite/gc_orphan_section_test.sh: New file.
7604
7605 2010-01-06  Ian Lance Taylor  <iant@google.com>
7606
7607         PR 10980
7608         * options.h (class General_options): Add --warn-shared-textrel.
7609         * layout.cc (Layout::finish_dynamic_section): Implement
7610         --warn-shared-textrel.
7611
7612         PR 10980
7613         * options.h (class General_options): Add --warn-multiple-gp.
7614
7615 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7616
7617         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7618         $(THREADSLIB) and $(LIBDL).
7619         * Makefile.in: Rebuild.
7620
7621 2010-01-06  Ian Lance Taylor  <iant@google.com>
7622
7623         PR 10980
7624         * options.cc (General_options::parse_section_start): New function.
7625         (General_options::section_start): New function.
7626         (General_options::General_options): Initialize all members.
7627         * options.h: Include <map>
7628         (class General_options): Add --section-start.  Add section_starts_
7629         member.
7630         * layout.cc (Layout::attach_allocated_section_to_segment): If
7631         --section-start was used, set the address of the segment.  Remove
7632         local sort_sections.
7633         (Layout::relaxation_loop_body): If the address of the load segment
7634         has been set by --section-start, don't use it.
7635         * output.h (Output_segment::update_flags_for_output_section): New
7636         function.
7637         * output.cc (Output_segment::add_output_section): Call
7638         update_flags_for_output_section.
7639
7640 2010-01-05  Ian Lance Taylor  <iant@google.com>
7641
7642         PR 10980
7643         * options.h (class General_options): Add --undefined-version.
7644         * script.cc (struct Version_expression): Add was_matched_by_symbol
7645         field.
7646         (Version_script_info::matched_symbol): New function.
7647         (Version_script_info::get_symbol_version_helper): Call
7648         matched_symbol.
7649         (Version_script_info::check_unmatched_names): New function.
7650         * script.h (class Version_script_info): Update declarations.
7651         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7652
7653         * options.h (class General_options): Use DEFINE_bool_alias for
7654         allow_multiple_definition.
7655         * resolve.cc (Symbol_table::should_override): Don't test
7656         allow_multiple_definition.
7657
7658         PR 10980
7659         * options.h (class General_options): Add --cref.
7660         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7661         until after printing cref table.
7662         * cref.cc: Include "symtab.h".
7663         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7664         (Cref_table_compare::operator()): New function.
7665         (Cref_inputs::gather_cref): New function.
7666         (filecol): New static const.
7667         (Cref_inputs::print_cref): New function.
7668         (Cref::print_cref): New function.
7669         * cref.h: Include <cstdio>.
7670         (class Cref): Update declarations.
7671         * mapfile.h (Mapfile::file): New function.
7672         * object.h (class Object): Define Symbols.  Declare virtual
7673         do_get_global_symbols.
7674         (Object::get_global_symbols): New function.
7675         * object.cc (Input_objects::add_object): Pass object to cref_ if
7676         --cref.
7677         (Input_objects::archive_start): Likewise.
7678         (Input_objects::archive_stop): Likewise.
7679         (Input_objects::print_cref): New function.
7680         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7681         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7682         --cref.
7683         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7684         function.
7685         * plugin.h (class Sized_pluginobj): Update declarations.
7686
7687 2010-01-05  Ian Lance Taylor  <iant@google.com>
7688
7689         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7690         to is_default_version.  Rename insdef to insdefault.
7691         (Symbol_table::add_from_relobj): Rename def to is_default_version
7692         and local to is_forced_local.
7693         (Symbol_table::add_from_pluginobj): Likewise.
7694         (Symbol_table::add_from_dynobj): Likewise.
7695         (Symbol_table::define_special_symbol): Rename insdef to
7696         insdefault.
7697
7698 2010-01-04  Ian Lance Taylor  <iant@google.com>
7699
7700         PR 10980
7701         * options.h (class General_options): Add
7702         --allow-multiple-definition and -z muldefs.
7703         * resolve.cc (Symbol_table::should_override): Don't warn about a
7704         multiple symbol definition if --allow-multiple-definition or -z
7705         muldefs.
7706
7707         PR 10980
7708         * options.h (class General_options): Add --add-needed and
7709         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7710         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7711         error if --copy-dt-needed-entries aka --add-needed is used and
7712         would cause a change in behaviour.
7713
7714         PR 10980
7715         * options.h (class General_options): Add -G as a short version of
7716         --shared.  Add no-op options -assert, -g, and -i.
7717
7718 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7719
7720         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7721         check for .text or .gnu.linkonce.t sections.
7722         * icf.cc (Icf::find_identical_sections): Ditto.
7723         Change the detection for mangled function name within the section
7724         name.
7725         * icf.h (is_section_foldable_candidate): New function.
7726
7727 2009-12-30  Ian Lance Taylor  <iant@google.com>
7728
7729         PR 10980
7730         * options.h (class General_options): Permit two dashes with
7731         --retain-symbols-file.
7732
7733 2009-12-30  Ian Lance Taylor  <iant@google.com>
7734
7735         PR 10979
7736         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7737         don't put the file header and segment headers in the text
7738         segment.
7739
7740         PR 10979
7741         * common.cc (Sort_commons::operator()): Stabilize sort when both
7742         entries are NULL.
7743         (Symbol_table::do_allocate_commons_list): When allocating common
7744         symbols, skip a symbol which is no longer common.
7745         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7746         an object before checking its type.
7747         * testsuite/common_test_2.c: New file.
7748         * testsuite/common_test_3.c: New file.
7749         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7750         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7751         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7752         (common_test_2_pic.o, common_test_2.so): New targets.
7753         (common_test_3_pic.o, common_test_3.so): New targets.
7754         * testsuite/Makefile.in: Rebuild.
7755
7756         PR 10979
7757         * script.cc (read_input_script): If we see a new SECTIONS clause,
7758         and we have added an input section, give an error.
7759         * layout.h (class Layout): Add have_added_input_section function.
7760         Add have_added_input_section_ field.
7761         * layout.cc (Layout::Layout): Initialize
7762         have_added_input_section_.
7763         (Layout::layout): Set have_added_input_section_.
7764         (Layout::layout_eh_frame): Likewise.
7765
7766 2009-12-30  Ian Lance Taylor  <iant@google.com>
7767
7768         PR 10931
7769         * options.h (class General_options): Add --sort-common option.
7770         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7771         * common.cc (Sort_common): Add sort_order parameter to
7772         constructor.  Add sort_order_ field.
7773         (Sort_commons::operator): Check sort_order_.
7774         (Symbol_table::allocate_commons): Determine the sort order.
7775         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7776         Change all callers.
7777         (Symbol_table::do_allocate_commons_list): Likewise.
7778
7779 2009-12-30  Ian Lance Taylor  <iant@google.com>
7780
7781         PR 10916
7782         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7783         symbols from this object, don't change the visibility of an
7784         undefined symbol.
7785         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7786
7787 2009-12-30  Ian Lance Taylor  <iant@google.com>
7788
7789         PR 10861
7790         * script.h (class Version_script_info): Define Language enum.
7791         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7792         new fields globals_, locals_, and is_finalized_.
7793         * script.cc: Various formatting fixes.
7794         (class Parser_closure): Change language_stack_ from a vector of
7795         std::string to one of Version_script_info::Language.  Adjust all
7796         uses accordingly.
7797         (class Lazy_demangler): Remove.
7798         (struct Version_expression): Change language from std::string to
7799         Version_script_info::Language.
7800         (Version_script_info::Version_script_info): New function.
7801         (Version_script_info::~Version_script_info): Don't call clear.
7802         (Version_script_info::finalize): New function.
7803         (Version_script_info::build_lookup_tables): New function.
7804         (Version_script_info::build_expression_list_lookup): New
7805         function.
7806         (Version_script_info::get_symbol_version_helper): Rewrite to use
7807         lookup tables.
7808         (Version_script_info::print_expression_list): Adjust to use
7809         Version_script_info::Language.
7810         (script_push_lex_into_version_mode): Check that the version script
7811         has not been finalized.
7812         (version_script_push_lang): Change language string to
7813         Version_script_info::Language.
7814         * options.cc (Command_line::version_script): New function.
7815         * options.h (class General_options): Add finalize_dynamic_list
7816         function.  Change version_script from declaration to definition.
7817         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7818         * testsuite/version_script.map: Remove duplicate def of foo.
7819         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7820         version_script.map.
7821         * testsuite/Makefile.in: Rebuild.
7822
7823 2009-12-30  Ian Lance Taylor  <iant@google.com>
7824
7825         PR 10843
7826         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7827         if the input symbol index is 0, make the output symbol index 0.
7828
7829 2009-12-30  Ian Lance Taylor  <iant@google.com>
7830
7831         PR 10670
7832         * options.h (class General_options): Add -x/--discard-all.
7833         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7834         --discard-all.  If the local symbol needs a dynamic entry, check
7835         that before handling --discard-locals.
7836
7837 2009-12-30  Ian Lance Taylor  <iant@google.com>
7838
7839         PR 10450
7840         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7841         flags to PF_R.
7842         (Output_segment::add_output_section): Don't change the flags if
7843         the type is PT_TLS.
7844
7845         PR 10450
7846         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7847         GNU hash table if they need a dynamic value.  Otherwise, don't add
7848         them if they are defined in a dynamic object or are forced local.
7849
7850 2009-12-29  Ian Lance Taylor  <iant@google.com>
7851
7852         PR 10450
7853         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7854         .gnu.hash table for a 32-bit target.
7855
7856         PR 10450
7857         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7858         regular and a dynamic object only needs a dynamic symbol table
7859         entry if it is externally visible.
7860
7861         PR 10450
7862         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7863         constructor.  Add global_offset_table_ field.
7864         (Target_i386::got_section): Set global_offset_table_.
7865         (Target_i386::do_finalize_sections): Set global_offset_table_
7866         size.
7867         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7868         in constructor.  Add global_offset_table_ field.
7869         (Target_x86_64::got_section): Set global_offset_table_.
7870         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7871         size.
7872
7873         * layout.cc (Layout::Layout): Initialize increase_relro_.
7874         (Layout::get_output_section): Add is_relro, is_last_relro, and
7875         is_first_non_relro parameters.  Change all callers.
7876         (Layout::choose_output_section): Likewise.
7877         (Layout::add_output_section_data): Likewise.
7878         (Layout::make_output_section): Likewise.
7879         (Layout::set_segment_offsets): Clear increase_relro when using a
7880         linker script.
7881         * layout.h (class Layout): Add increase_relro method.  Add
7882         increase_relro_ field.  Update declarations.
7883         * output.cc (Output_section::Output_section): Initialize
7884         is_last_relro_ and is_first_non_relro_.
7885         (Output_segment::add_output_section): Group relro sections is
7886         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7887         (Output_segment::maximum_alignment): Remove relro handling.
7888         (Output_segment::set_section_addresses): Add increase_relro
7889         parameter.  Change all callers.  Add initial alignment to align
7890         relro sections on separate page.  Remove old relro handling.
7891         (Output_segment::set_section_list_addresses): Remove in_relro
7892         parameter.  Change all callers.
7893         (Output_segment::set_offset): Add increase parameter.  Change all
7894         callers.  Remove old relro handling.
7895         * output.h (class Output_section): Add new methods: is_last_relro,
7896         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7897         Add is_last_relro_ and is_first_non_relro_ fields.
7898         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7899         Create separate .got.plt section.  Call increase_relro.
7900         * x86_64.cc (Target_x86_64::got_section): Likewise.
7901         * testsuite/relro_script_test.t: Add .got.plt.
7902
7903         PR 10450
7904         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7905         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7906         (Layout::finalize): Call set_dynamic_symbol_size.
7907         (Layout::set_dynamic_symbol_size): New function.
7908         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7909         set_dynamic_symbol_size.
7910
7911         PR 10450
7912         * output.h (class Output_section): Add is_entsize_zero_ field.
7913         * output.cc (Output_section::Output_section): Initialize
7914         is_entsize_zero_.
7915         (Output_section::set_entsize): If two different entsizes are
7916         requested, force it to zero.
7917         (Output_section::add_input_section): Set flags for .debug_str
7918         before updating section flags.  Set entsize.
7919         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7920         and SHF_STRING if all input sections have those flags.
7921
7922 2009-12-29   Rafael Espindola  <espindola@google.com>
7923
7924         * main.cc (main): Fix the sys time reporting.
7925         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7926         reporting.
7927
7928 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7929
7930         * options.cc (General_options::parse_version): Allow -v to exit
7931         without an error if there is nothing to link.
7932
7933 2009-12-29  Ian Lance Taylor  <iant@google.com>
7934
7935         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7936         using a version of gcc before 4.1.
7937         * configure: Rebuild.
7938
7939 2009-12-28  Chris Demetriou  <cgd@google.com>
7940
7941         * attributes.cc (Output_attributes_section_data::do_write): Use
7942         std::vector::front rather than std::vector::data.
7943
7944 2009-12-28  Ian Lance Taylor  <iant@google.com>
7945
7946         * symtab.h (class Symbol_table): Add enum Defined.
7947         * resolve.cc (Symbol_table::should_override): Add defined
7948         parameter.  Change all callers.  Test whether object is NULL
7949         before calling a method on it.
7950         (Symbol_table::report_resolve_problem): Add defined parameter.
7951         Change all callers.
7952         (Symbol_table::should_override_with_special): Likewise.
7953         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7954         parameter.  Change all callers.
7955         (Symbol_table::do_define_in_output_data): Likewise.
7956         (Symbol_table::define_in_output_segment): Likewise.
7957         (Symbol_table::do_define_in_output_segment): Likewise.
7958         (Symbol_table::define_as_constant): Likewise.
7959         (Symbol_table::do_define_as_constant): Likewise.
7960         * script.h (class Symbol_assignment): Add is_defsym parameter to
7961         constructor; change all callers.
7962         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7963         parameter.  Change all callers.  Add is_defsym_ field.
7964         (class Parser_closure): Add parsing_defsym parameter to
7965         constructor; change all callers.  Add parsing_defsym accessor
7966         function.  Add parsing_defsym_ field.
7967
7968 2009-12-28  Ian Lance Taylor  <iant@google.com>
7969
7970         * gold.cc (queue_middle_tasks): Fix formatting.
7971         * object.cc (Relobj::is_section_name_included): Likewise.
7972
7973 2009-12-23  Ian Lance Taylor  <iant@google.com>
7974
7975         * i386.cc (Target_i386::do_calls_non_split): Recognize
7976         -fsplit-stack prologue for a function with a static chain.
7977         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7978         -fsplit-stack prologue when using %r11.
7979
7980 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7981
7982         * options.cc (General_options::parse_version): Make -v continue and do
7983         the link like GNU ld does.
7984
7985 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7986
7987         * Makefile.am (CCFILES): Add timer.cc.
7988         (HFILES): Add timer.h.
7989         * configure.ac: Check for sysconf and times.
7990         * main.cc: include timer.h.
7991         (main): Use Timer instead of get_run_time.
7992         * timer.cc: New.
7993         * timer.h: New.
7994         * workqueue.cc: include timer.h.
7995         (Workqueue::find_and_run_task):
7996         Report user, sys and wall time.
7997         * Makefile.in: Regenerate.
7998         * config.in: Regenerate.
7999         * configure: Regenerate.
8000
8001 2009-12-16  Doug Kwan  <dougkwan@google.com>
8002
8003         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8004         sections.
8005         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8006         relaxed input sections.
8007         * output.cc (Output_section::find_relaxed_input_section): Change
8008         return type to Output_relaxed_input_section pointer.  Adjust code
8009         for new type of relaxed_input_section_map_.
8010         * output.h (Output_section::find_relaxed_input_section): Change
8011         return type to Output_relaxed_input_section pointer.
8012         (Output_section::Output_relaxed_input_section_by_input_section_map):
8013         New type.
8014         (Output_section::relaxed_input_section_map_): Change type to
8015         Output_section::Output_relaxed_input_section_by_input_section_map.
8016         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8017         input section.
8018
8019 2009-12-15  Ian Lance Taylor  <iant@google.com>
8020
8021         * layout.cc (Layout::create_shstrtab): Only write out after input
8022         sections if we are compressing debug sections.
8023
8024 2009-12-15  Ian Lance Taylor  <iant@google.com>
8025
8026         * archive.cc (Archive::add_symbols): Only look up a symbol without
8027         a version if there is, in fact, a version.
8028
8029 2009-12-14  Ian Lance Taylor  <iant@google.com>
8030
8031         Revert -Wshadow changes, all changes from:
8032         2009-12-11  Doug Kwan  <dougkwan@google.com>
8033         2009-12-11  Nick Clifton  <nickc@redhat.com>
8034         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8035
8036 2009-12-11  Doug Kwan  <dougkwan@google.com>
8037
8038         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8039         due to -Wshadow.
8040         * attributes.cc (Object_attribute::size): Ditto.
8041         (Attributes_section_data::size): Ditto.
8042         (Attributes_section_data::Attributes_section_data): Ditto.
8043         (Output_attributes_section_data::do_write): Ditto.
8044         * attributes.h (Object_attribute::set_type): Ditto.
8045         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8046
8047 2009-12-11  Nick Clifton  <nickc@redhat.com>
8048
8049         * archive.cc: Fix shadowed variable warnings.
8050         * arm.cc: Likewise.
8051         * compressed_output.cc: Likewise.
8052         * compressed_output.h: Likewise.
8053         * configure: Likewise.
8054         * dwarf_reader.cc: Likewise.
8055         * dynobj.cc: Likewise.
8056         * dynobj.h: Likewise.
8057         * ehframe.cc: Likewise.
8058         * ehframe.h: Likewise.
8059         * errors.cc: Likewise.
8060         * expression.cc: Likewise.
8061         * fileread.cc: Likewise.
8062         * fileread.h: Likewise.
8063         * freebsd.h: Likewise.
8064         * i386.cc: Likewise.
8065         * icf.cc: Likewise.
8066         * incremental.h: Likewise.
8067         * layout.cc: Likewise.
8068         * layout.h: Likewise.
8069         * mapfile.cc: Likewise.
8070         * merge.cc: Likewise.
8071         * merge.h: Likewise.
8072         * object.cc: Likewise.
8073         * object.h: Likewise.
8074         * options.h: Likewise.
8075         * output.cc: Likewise.
8076         * output.h: Likewise.
8077         * parameters.cc: Likewise.
8078         * plugin.cc: Likewise.
8079         * powerpc.cc: Likewise.
8080         * reduced_debug_output.cc: Likewise.
8081         * reduced_debug_output.h: Likewise.
8082         * reloc.cc: Likewise.
8083         * reloc.h: Likewise.
8084         * resolve.cc: Likewise.
8085         * script-sections.cc: Likewise.
8086         * script.cc: Likewise.
8087         * script.h: Likewise.
8088         * sparc.cc: Likewise.
8089         * symtab.cc: Likewise.
8090         * symtab.h: Likewise.
8091         * target-select.cc: Likewise.
8092         * target-select.h: Likewise.
8093         * token.h: Likewise.
8094         * workqueue.cc: Likewise.
8095         * workqueue.h: Likewise.
8096         * x86_64.cc: Likewise.
8097
8098 2009-12-10  Doug Kwan  <dougkwan@google.com>
8099
8100         * arm.cc (attributes.h): New include.
8101         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8102         (Arm_relobj::~Arm_relobj): Delete object pointed by
8103         attributes_section_data_.
8104         (Arm_relobj::attributes_section_data): New method definition.
8105         (Arm_relobj::attributes_section_data_): New data member declaration.
8106         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8107         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8108         attributes_section_data_.
8109         (Arm_dynobj::attributes_section_data): New method definition.
8110         (Arm_dynobj::attributes_section_data_): New data member declaration.
8111         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8112         initialization value of may_use_blx_ to false.
8113         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8114         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8115         object attributes to compute results instead of hard-coding.
8116         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8117         Target_arm::get_secondary_compatible_arch,
8118         Target_arm::set_secondary_compatible_arch
8119         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8120         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8121         New method declarations.
8122         (Target_arm::get_aeabi_object_attribute): New method definition.
8123         (Target_arm::attributes_section_data_): New data member declaration.
8124         (read_arm_attributes_section): New template definition.
8125         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8126         (Arm_dynobj::do_read_symbols): Ditto.
8127         (Target_arm::do_finalize_sections): Merge attributes sections from
8128         input.  Check for BLX use after attributes section merging.
8129         Fix __exidx_start and __exidx_end visibility.  Create an
8130         .ARM.attributes section if necessary.
8131         (Target_arm::get_secondary_compatible_arch,
8132         Target_arm::set_secondary_compatible_arch,
8133         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8134         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8135         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8136         New method definitions.
8137
8138 2009-12-09  Ian Lance Taylor  <iant@google.com>
8139
8140         * plugin.cc (Plugin::load): Don't cast from void* to a function
8141         pointer.
8142
8143 2009-12-09  Ian Lance Taylor  <iant@google.com>
8144
8145         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8146         information fields.
8147
8148 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8149
8150         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8151         Replace two_file_shared_1.so with two_file_shared_2.so.
8152         * testsuite/Makefile.in: Regenerated.
8153
8154 2009-12-08  Doug Kwan  <dougkwan@google.com>
8155
8156         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8157         (HFILES): Add attributes.h and int_encoding.h.
8158         * Makefile.in: Regenerate.
8159         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8160         function definitions to int_encoding.cc
8161         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8162         prototypes to int_encoding.h
8163         * reduced_debug_output.cc (int_encoding.h): New include.
8164         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8165         function definitions to int_encoding.cc
8166         (insert_into_vector, read_from_pointer): Move template definitions to
8167         int_encoding.h
8168         * attributes.cc: New file.
8169         * attributes.h: New file.
8170         * int_encoding.cc: New file.
8171         * int_encoding.h: New file.
8172
8173 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8174
8175         PR gold/11055
8176         * incremental-dump.cc (dump_incremental_inputs): New.
8177         (main): Use dump_incremental_inputs.
8178
8179 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8180
8181         PR gold/10893
8182         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8183         checking elfcpp::STT_FUNC.
8184         (Target_i386::Relocate::relocate): Likewise.
8185         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8186
8187         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8188         symbols from shared libraries into normal FUNC symbols.
8189
8190         * symtab.h (Symbol): Add is_func and use it.
8191
8192 2009-12-05  Doug Kwan  <dougkwan@google.com>
8193
8194         * arm.cc (Target_arm::arm_info): Initialize new fields
8195         attributes_section and attributes_vendor.
8196         * i386.cc (Target_i386::i386_info): Same.
8197         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8198         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8199         fields attributes_section and attributes_vendor.
8200         * sparc.cc (Target_sparc::sparc_info): Same.
8201         * target.h (Target::attributes_section, Target::attributes_vendor,
8202         Target::is_attributes_section, Target::attribute_arg_type,
8203         Target::attributes_order): New method definitions.
8204         (Target::Target_info::attributes_section,
8205         Target::Target_info::attributes_vendor): New fields.
8206         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8207         virtual method definitions.
8208         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8209         attributes_section and attributes_vendor.
8210         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8211
8212 2009-12-05  Doug Kwan  <dougkwan@google.com>
8213
8214         * arm.cc: Update comments about interworking and stub generation.
8215         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8216         considered as non-PIC.
8217         (Arm_relocate_functions::base_abs): Fix formatting.
8218         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8219         of function to use GOT entry address instead of offset.
8220         (Target_arm::Scan::global): Issue an error if a symbol would need a
8221         PLT does not get one because it is untyped.  Remove code to create
8222         dynamic symbols for relative branches.
8223         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8224         takes unsigned integer instead of boolean.
8225
8226 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8227
8228         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8229         (two_file_test_LDADD): Likewise.
8230         (common_test_1_LDADD): Likewise.
8231         (exception_test_LDADD) Likewise.
8232         (weak_test_LDADD): Likewise.
8233         (many_sections_test_LDADD): Likewise.
8234         (initpri1_LDADD): Likewise.
8235         (script_test_1_LDADD): Likewise.
8236         (script_test_2_LDADD): Likewise.
8237         (justsyms_LDADD): Likewise.
8238         (binary_test_LDADD): Likewise.
8239         (large_LDADD): Likewise.
8240         * testsuite/Makefile.in: Regenerated.
8241
8242 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8243
8244         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8245         (Symbol_table::override_with_special): Likewise.
8246         (Symbol_table::add_from_object): Likewise.
8247
8248 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8249
8250         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8251         Don't set the data_offset twice.
8252
8253 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8254
8255         * testsuite/Makefile.in: Regenerate.
8256
8257 2009-12-03  Doug Kwan  <dougkwan@google.com>
8258
8259         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8260         (Target_arm::do_finalize_sections): Add parameter for symbol table
8261         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8262         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8263         parameter for symbol table pointer.
8264         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8265         an additional parameter for a pointer to symbol table.
8266         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8267         parameter for a symbol table pointer.
8268         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8269         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8270         Ditto.
8271         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8272         parameter for a symbol table pointer.
8273
8274 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8275
8276         * incremental.cc (Incremental_inputs_header)
8277         (Incremental_inputs_header_write, Incremental_inputs_entry)
8278         (Incremental_inputs_entry_write): Move ...
8279         * incremental.h (Incremental_inputs_header)
8280         (Incremental_inputs_header_write, Incremental_inputs_entry)
8281         (Incremental_inputs_entry_write): here.
8282
8283 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8284
8285         * incremental.cc (make_sized_incremental_binary): Set the target.
8286         Error if it is incompatible.
8287         * output.h (Output_file): Add filename method.
8288
8289 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8290
8291         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8292         from the get_* methods.
8293
8294 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8295
8296         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8297         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8298         Write 0 for the data_offset of scripts.
8299
8300 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8301
8302         * testsuite/Makefile.am: Add the incremental_test.sh test.
8303         * testsuite/incremental_test.sh: New.
8304         * testsuite/incremental_test_1.c: New.
8305         * testsuite/incremental_test_2.c: New.
8306
8307 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8308
8309         * incremental-dump.cc (main): Fix typos.
8310
8311 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8312
8313         PR gold/11025
8314         * incremental-dump.cc (main): Use llu to print 64 bit values.
8315
8316 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8317             H.J. Lu  <hongjiu.lu@intel.com>
8318
8319         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8320         $(LIBDL).
8321         (incremental_dump_LDADD): Likewise.
8322         * Makefile.in: Regenerated.
8323
8324 2009-11-25  Doug Kwan  <dougkwan@google.com>
8325
8326         Revert:
8327
8328         2009-11-25  Doug Kwan  <dougkwan@google.com>
8329
8330                 * arm.cc (Target_arm::Target_arm): Move method definition
8331                 outside of class definition.  Add code to handle
8332                 --target1-rel, --target1-abs and --target2= options.
8333                 (Target_arm::get_reloc_reloc_type): Change method to be
8334                 non-static and const.
8335                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8336                 New data member declaration.
8337                 (Target_arm::Scan::local, Target_arm::Scan::global,
8338                 Target_arm::Relocate::relocate,
8339                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8340                 Adjust call to Target_arm::get_real_reloc_type.
8341                 (Target_arm::get_real_reloc_type): Use command line options
8342                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8343                 * options.h (--target1-rel, --target1-abs, --target2): New
8344                 ARM-only options.
8345
8346 2009-11-25  Doug Kwan  <dougkwan@google.com>
8347
8348         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8349         class definition.  Add code to handle --target1-rel, --target1-abs
8350         and --target2= options.
8351         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8352         and const.
8353         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8354         member declaration.
8355         (Target_arm::Scan::local, Target_arm::Scan::global,
8356         Target_arm::Relocate::relocate,
8357         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8358         call to Target_arm::get_real_reloc_type.
8359         (Target_arm::get_real_reloc_type): Use command line options to
8360         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8361         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8362         options.
8363
8364 2009-11-25  Doug Kwan  <dougkwan@google.com>
8365
8366         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8367         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8368         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8369         formatting.
8370         (Arm_relocate_functions::thm_call): Replace body with a call to
8371         Arm_relocate_functions::thumb_branch_common.
8372         (Arm_relocate_functions::thm_jump24,
8373         Arm_relocate_functions::thm_xpc22): New method definitions.
8374         (Arm_relocate_functions::thumb_branch_common): New method definition.
8375         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8376         operator.
8377         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8378         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8379
8380 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8381
8382         * Makefile.am: Build incremental-dump
8383         * Makefile.in: Regenerate.
8384         * incremental-dump.cc: New.
8385         * incremental.cc (Incremental_inputs_header_data,
8386         Incremental_inputs_entry_data): Move to incremental.h
8387         * incremental.h: (Incremental_inputs_header_data,
8388         Incremental_inputs_entry_data): Move from incremental.cc
8389
8390 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8391
8392         * incremental.cc (Incremental_inputs_header,
8393         Incremental_inputs_header_write, Incremental_inputs_entry,
8394         Incremental_inputs_entry_write): Add a typedef with the data type.
8395
8396 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8397
8398         * incremental.cc (Incremental_inputs_header,
8399         Incremental_inputs_header_write, Incremental_inputs_entry,
8400         Incremental_inputs_entry_write): Update comment about which
8401         type has the filed descriptions.
8402
8403 2009-11-15  Doug Kwan  <dougkwan@google.com>
8404
8405         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8406         (Arm_relocate_functions::arm_branch_common): Change method defintion
8407         in class definition to a method declaration and update list of formal
8408         parameters.
8409         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8410         Arm_relocation_functions::jump24): Adjust call to
8411         Arm_relocate_functions::arm_branch_common.  Update list of formal
8412         parameters.
8413         (Arm_relocate_functions::xpc25): New method definition.
8414         (Arm_relocate_functions::arm_branch_common): Move method defintion
8415         out from class definition.  Use stubs for mode-switching and extending
8416         branch ranges.
8417         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8418         specially.  Change code to enable use of stubs in ARM branches.
8419
8420 2009-11-10  Doug Kwan  <dougkwan@google.com>
8421
8422         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8423         in method declaration.
8424         (Target_arm::relocate_stub): New method declaration.
8425         (Target_arm::default_target): Change to return a pointer instead of
8426         a const reference.
8427         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8428         Target_arm::default_target.
8429         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8430         method definition.
8431         (Target_arm::relocate_section): Adjust view.
8432         (Target_arm::relocate_stub): New method definition.
8433
8434 2009-11-10  Doug Kwan  <dougkwan@google.com>
8435
8436         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8437         a format warning.
8438         * incremental.cc (open_incremental_binary): Initialized local
8439         variables to avoid warnings.
8440         * object.cc (make_elf_object): Ditto.
8441         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8442         a format warning.
8443
8444 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8445
8446         PR gold/10930
8447         * testsuite/plugin_test.c: Include "config.h".
8448
8449 2009-11-09  Doug Kwan  <dougkwan@google.com>
8450
8451         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8452         (arm_symbol_value): Remove.
8453         (Arm_relocate_functions::arm_branch_common,
8454         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8455         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8456         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8457         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8458         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8459         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8460         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8461         Arm_relocate_functions::thm_mobw_abs_nc,
8462         Arm_relocate_functions::thm_mov_abs,
8463         Arm_relocate_functions::movw_prel_nc,
8464         Arm_relocate_functions::thm_movt_abs,
8465         Arm_relocate_functions::movt_prel,
8466         Arm_relocate_functions::thm_movw_prel_nc,
8467         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8468         (Target_arm::Relocate::relocate): Only decompose address into two
8469         parts if relocation type uses the thumb-bit and pass the actual
8470         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8471         calls to methods in Arm_relocate_functions for this change.
8472
8473 2009-11-08  Ian Lance Taylor  <iant@google.com>
8474
8475         PR 10925
8476         * reloc.cc: Instantiate
8477         Sized_relobj::initialize_input_to_output_maps and
8478         Sized_relobj:free_input_to_output_maps.
8479
8480 2009-11-06  Ian Lance Taylor  <iant@google.com>
8481
8482         PR 10876
8483         * defstd.cc (in_segment): Set only_if_ref true for "end".
8484
8485 2009-11-06  Doug Kwan  <dougkwan@google.com>
8486
8487         * arm.cc (class Reloc_stub): Correct a comment.
8488         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8489         (Target_arm::scan_section_for_stubs): New method declaration.
8490         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8491         Change methods from private to protected.
8492         (Target_arm::do_may_relax): New method definition.
8493         (Target_arm::do_relax, Target_arm::group_sections,
8494         Target_arm::scan_reloc_for_stub,
8495         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8496         (Target_arm::arm_input_section_map_): New data member declaration.
8497         (Target_arm::scan_reloc_for_stub,
8498         Target_arm::scan_reloc_section_for_stubs,
8499         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8500         Target_arm::do_relax): New method definitions.
8501
8502 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8503
8504         * configure.ac: Check for (struct stat)::st_mtim
8505         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8506         * config.in: Regenerate.
8507         * configure: Regenerate.
8508
8509 2009-11-05  Ian Lance Taylor  <iant@google.com>
8510
8511         PR 10910
8512         * output.cc (Output_segment::add_output_section): Add missing
8513         return statement.
8514
8515 2009-11-04  Ian Lance Taylor  <iant@google.com>
8516
8517         PR 10880
8518         * object.h (class Object): Add is_needed and set_is_needed
8519         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8520         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8521         defined in a dynamic object and referenced by a regular object,
8522         set is_needed for the dynamic object.
8523         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8524         if the file is marked with as_needed and it is not needed.
8525
8526 2009-11-04  Ian Lance Taylor  <iant@google.com>
8527
8528         PR 10887
8529         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8530         tags if data is discarded by linker script.
8531         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8532         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8533         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8534         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8535
8536 2009-11-04  Ian Lance Taylor  <iant@google.com>
8537
8538         * layout.cc (Layout::get_output_section): Add is_interp and
8539         is_dynamic_linker_section parameters.  Change all callers.
8540         (Layout::choose_output_section): Likewise.
8541         (Layout::make_output_section): Likewise.
8542         (Layout::add_output_section_data): Add is_dynamic_linker_section
8543         parameter.  Change all callers.
8544         * layout.h (class Layout): Update declarations.
8545         * output.h (class Output_section): Add is_interp, set_is_interp,
8546         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8547         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8548         generate_code_fills_at_write_ to a bitfield.
8549         * output.cc (Output_section::Output_sections): Initialize new
8550         fields.
8551         (Output_segment::add_output_section): Add do_sort parameter.
8552         Change all callers.
8553
8554 2009-11-03  Ian Lance Taylor  <iant@google.com>
8555
8556         PR 10860
8557         * options.h (class General_options): Add --warn-common.
8558         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8559         merging two common symbols.
8560         (Symbol_table::should_override): Handle --warn-common when merging
8561         a common symbol with a defined symbol.  Use report_resolve_problem
8562         for multiple definitions.
8563         (Symbol_table::report_resolve_problem): New function.
8564         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8565
8566 2009-11-03  Doug Kwan  <dougkwan@google.com>
8567
8568         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8569         stub_factory_.
8570         (Target_arm::stub_factory): New method definition.
8571         (Target_arm::new_arm_input_section,
8572         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8573         Target_arm::reloc_uses_thumb_bit): New method declarations.
8574         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8575         New type definitions.
8576         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8577         member declarations.
8578         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8579         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8580         New method definitions.
8581
8582 2009-11-03  Ian Lance Taylor  <iant@google.com>
8583
8584         * options.h (class General_options): Add --warn_constructors.
8585
8586 2009-11-03  Ian Lance Taylor  <iant@google.com>
8587
8588         PR 10893
8589         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8590         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8591
8592 2009-11-03  Ian Lance Taylor  <iant@google.com>
8593
8594         PR 10895
8595         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8596         --msgid-bugs-address.
8597         (install-pdf): New target.
8598         (install-data_yes): Look up one directory to find mkinstalldirs.
8599
8600 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8601
8602         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8603         tree.
8604
8605 2009-10-30  Doug Kwan  <dougkwan@google.com>
8606
8607         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8608
8609 2009-10-30  Doug Kwan  <dougkwan@google.com>
8610
8611         * arm.cc (Stub_addend_reader): New struct template definition
8612         and partial specializations.
8613         (Stub_addend_reader::operator()): New method definition for a
8614         partially specialized template.
8615
8616 2009-10-30  Doug Kwan  <dougkwan@google.com>
8617
8618         * arm.cc (Arm_relobj::processor_specific_flags): New method
8619         definition.
8620         (Arm_relobj::do_read_symbols): New method declaration.
8621         (Arm_relobj::processor_specific_flags_): New data member declaration.
8622         (Arm_dynobj): New class definition.
8623         (Target_arm::do_finalize_sections): Add input_objects parameter.
8624         (Target_arm::do_adjust_elf_header): New method declaration.
8625         (Target_arm::are_eabi_versions_compatible,
8626         (Target_arm::merge_processor_specific_flags): New method declaration.
8627         (Target_arm::do_make_elf_object): New overloaded method definitions
8628         and declaration.
8629         (Arm_relobj::do_read_symbols): New method definition.
8630         (Arm_dynobj::do_read_symbols): Ditto.
8631         (Target_arm::do_finalize_sections): Add input_objects parameters.
8632         Merge processor-specific flags from all input objects.
8633         (Target_arm::are_eabi_versions_compatible,
8634         Target_arm::merge_processor_specific_flags,
8635         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8636         New method definitions.
8637         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8638         Input_objects pointer type parameter.
8639         * layout.cc (Layout::finalize): Pass input objects to target's.
8640         finalize_sections function.
8641         * output.cc (Output_file_header::do_sized_write): Set ELF file
8642         header's processor-specific flags.
8643         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8644         Input_objects pointer type parameter.
8645         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8646         * target.h (Input_objects): New forward class declaration.
8647         (Target::processor_specific_flags,
8648         Target::are_processor_specific_flags_sect): New method definitions.
8649         (Target::finalize_sections): Add input_objects parameter.
8650         (Target::Target): Initialize processor_specific_flags_ and
8651         are_processor_specific_flags_set_.
8652         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8653         parameter.
8654         (Target::set_processor_specific_flags): New method definition.
8655         (Target::processor_specific_flags_,
8656         Target::are_processor_specific_flags_set_): New data member
8657         declarations.
8658         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8659         Input_objects pointer type parameter.
8660
8661 2009-10-30  Doug Kwan  <dougkwan@google.com>
8662
8663         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8664
8665 2009-10-28  Ian Lance Taylor  <iant@google.com>
8666
8667         * object.h (class Relobj): Drop options parameter from
8668         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8669         do_scan_relocs, do_relocate.  Change all callers.
8670         (class Sized_relobj): Drop options parameters from
8671         do_gc_process_relocs, do_scan_relocs, do_relocate,
8672         do_relocate_sections, relocate_sections, emit_relocs_scan,
8673         emit_relocs_scan_reltype.  Change all callers.
8674         (struct Relocate_info): Remove options field and all references to
8675         it.
8676         * reloc.h (class Read_relocs): Remove options constructor
8677         parameter and options_ field.  Change all callers.
8678         (class Gc_process_relocs, class Scan_relocs): Likewise.
8679         (class Relocate_task): Likewise.
8680         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8681         all callers.
8682         (scan_relocatable_relocs): Likewise.
8683         * target.h (class Sized_target): Remove options parameter from
8684         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8685         all callers.
8686         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8687         callers.
8688         * arm.cc: Update functions to remove options parameters.
8689         * i386.cc: Likewise.
8690         * powerpc.cc: Likewise.
8691         * sparc.cc: Likewise.
8692         * x86_64.cc: Likewise.
8693         * testsuite/testfile.cc: Likewise.
8694
8695 2009-10-28  Doug Kwan  <dougkwan@google.com>
8696
8697         * arm.cc (Arm_relobj): New class definition.
8698         (Arm_relobj::scan_sections_for_stubs,
8699         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8700         New method definitions.
8701
8702 2009-10-28  Cary Coutant  <ccoutant@google.com>
8703
8704         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8705         (Plugin::cleanup_done_): New member.
8706         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8707         (Plugin_manager::cleanup_done_): Remove.
8708         (Plugin_manager::add_input_file): Edit error message.
8709         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8710         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8711
8712 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8713
8714         * fileread.cc: (File_read::View::~View): Use the new
8715         data_ownership_ filed.
8716         (File_read::~File_read): Dispose the new whole_file_view_.
8717         (File_read::open): Mmap the whole file if needed.
8718         (File_read::open): Use whole_file_view_ instead of contents_.
8719         (File_read::find_view): Use whole_file_view_ if applicable.
8720         (File_read::do_read): Use whole_file_view_ instead of contents_.
8721         (File_read::make_view): Use whole_file_view_ instead of contents_,
8722         update File_read::View::View call.
8723         (File_read::find_or_make_view): Update File_read::View::View
8724         call.
8725         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8726         remove contents_
8727         (File_read::View::Data_ownership): New enum.
8728         (File_read::View::View): Replace bool mapped_ with Data_ownership
8729         argument.
8730         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8731         (File_read::View::data_ownership_): New field.
8732         (File_read::contents_): Remove (replaced by whole_file_view_).
8733         (File_read::whole_file_view_): New field.
8734         * options.h (class General_options): Add --keep-files-mapped.
8735
8736 2009-10-27  Cary Coutant  <ccoutant@google.com>
8737
8738         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8739         * testsuite/Makefile.am (plugin_test_5): New test case.
8740         * testsuite/Makefile.in: Regenerate.
8741
8742 2009-10-25  Doug Kwan  <dougkwan@google.com>
8743
8744         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8745         from private to protected to allow access by child class.
8746         (Sized_relobj::do_relocate_sections): New method declaration.
8747         (Sized_relobj::relocate_sections): Virtualize.
8748         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8749         Sized_relobj::relocate_sections.  Instantiate template explicitly
8750         for different target sizes and endianity.
8751
8752 2009-10-24  Doug Kwan  <dougkwan@google.com>
8753
8754         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8755         (Arm_input_section::as_arm_input_section): New method.
8756         (Arm_output_section): New class definition.
8757         (Arm_output_section::create_stub_group,
8758         Arm_output_section::group_sections): New method definitions.
8759
8760 2009-10-22  Doug Kwan  <dougkwan@google.com>
8761
8762         * arm.cc (Arm_input_section): New class definition.
8763         (Arm_input_section::init, Arm_input_section:do_write,
8764         Arm_input_section::set_final_data_size,
8765         Arm_input_section::do_reset_address_and_file_offset): New method
8766         definitions.
8767
8768 2009-10-21  Doug Kwan  <dougkwan@google.com>
8769
8770         * arm.cc (Stub_table, Arm_input_section): New forward class
8771         declarations.
8772         (Stub_table): New class defintion.
8773         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8774         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8775         New method definition.
8776
8777 2009-10-21  Doug Kwan  <dougkwan@google.com>
8778
8779         * arm.cc: Update copyright comments.
8780         (Target_arm): New forward class template declaration.
8781         (Arm_address): New type.
8782         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8783         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8784         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8785         constants.
8786         (Insn_template): Same.
8787         (DEF_STUBS): New macro.
8788         (Stub_type): New enum type.
8789         (Stub_template): New class definition.
8790         (Stub): Same.
8791         (Reloc_stub): Same.
8792         (Stub_factory): Same.
8793         (Target_arm::Target_arm): Initialize may_use_blx_ and
8794         should_force_pic_veneer_.
8795         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8796         Target_arm::should_force_pic_veneer,
8797         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8798         Target_arm::using_thumb_only, Target_arm:;default_target): New
8799         method defintions.
8800         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8801         New data member declarations.
8802         (Insn_template::size, Insn_template::alignment): New method defintions.
8803         (Stub_template::Stub_template): New method definition.
8804         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8805         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8806         (Stub_factory::Stub_factory): New method definition.
8807         * gold.h (string_hash): New template.
8808         * output.h (Input_section_specifier::hash_value): Use
8809         gold::string_hash.
8810         (Input_section_specifier::string_hash): Remove.
8811         * stringpool.cc (Stringpool_template::string_hash): Use
8812         gold::string_hash.
8813
8814 2009-10-20  Doug Kwan  <dougkwan@google.com>
8815
8816         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8817         symbols of relaxed input sections.
8818         * output.h (Output_section::find_relaxed_input_section): Make
8819         method public.
8820
8821 2009-10-16  Doug Kwan  <dougkwan@google.com>
8822
8823         * dynobj.cc (Versions::Versions): Initialize version_script_.
8824         Only insert base version symbol definition for a shared object
8825         if version script defines any version versions.
8826         (Versions::define_base_version): New method definition.
8827         (Versions::add_def): Check that base version is not needed.
8828         (Versions::add_need): Define base version lazily.
8829         * dynobj.h (Versions::define_base_version): New method declaration.
8830         (Versions::needs_base_version_): New data member declaration.
8831         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8832         (check_DATA): Add no_version_test.stdout.
8833         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8834         New make rules.
8835         * testsuite/Makefile.in: Regenerate.
8836         * testsuite/no_version_test.c: New file.
8837         * testsuite/no_version_test.sh: Ditto.
8838
8839 2009-10-16  Doug Kwan  <dougkwan@google.com>
8840
8841         * expression.cc (class Segment_start_expression): New class definition.
8842         (Segment_start_expression::value): New method definition.
8843         (script_exp_function_segment_start): Return a new
8844         Segment_start_expression.
8845         * gold/script-c.h (script_saw_segment_start_expression): New function
8846         prototype.
8847         * script-sections.cc (Script_sections::Script_sections): Initialize
8848         SAW_SEGMENT_START_EXPRESSION_ to false.
8849         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8850         and -Tbbs options to specify section addresses if given in
8851         command line and no SEGMENT_START expression is seen in a script.
8852         * script-sections.h (Script_sections::saw_segment_start_expression,
8853         Script_sections::set_saw_segment_start_expression): New method
8854         definition.
8855         (Script_sections::saw_segment_start_expression_): New data member
8856         declaration.
8857         * script.cc (script_saw_segment_start_expression): New function.
8858         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8859         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8860         script_test_7.sh and script_test_8.sh.
8861         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8862         script_test_8.stdout.
8863         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8864         (script_test_6, script_test_6.stdout, script_test_7,
8865         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8866         * Makefile.in: Regenerate.
8867         * testsuite/script_test_6.sh: New file.
8868         * testsuite/script_test_6.t: Same.
8869         * testsuite/script_test_7.sh: Same.
8870         * testsuite/script_test_7.t: Same.
8871         * testsuite/script_test_8.sh: Same.
8872
8873 2009-10-16  Doug Kwan  <dougkwan@google.com>
8874
8875         * output.cc (Output_segment::set_section_list_address): Cast
8876         expressions to unsigned long long type to avoid format warnings.
8877
8878 2009-10-15  Ian Lance Taylor  <iant@google.com>
8879
8880         * script.cc (Script_options::add_symbol_assignment): Always add a
8881         dot assignment to script_sections_.
8882         * script-sections.cc (Script_sections::add_dot_assignment):
8883         Initialize if necessary.
8884
8885         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8886         program headers with no load segment if there is a linker script.
8887
8888         * layout.cc (Layout::set_segment_offsets): Align the file offset
8889         to the segment aligment for -N or -n with no load segment.
8890         * output.cc (Output_segment::add_output_section): Don't crash if
8891         the first section is a TLS section.
8892         (Output_segment::set_section_list_addresses): Print an error
8893         message if the address moves backward in a linker script.
8894         * script-sections.cc
8895         (Output_section_element_input::set_section_addresses): Don't
8896         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8897         (Orphan_output_section::set_section_addresses): Likewise.
8898
8899 2009-10-15  Doug Kwan  <dougkwan@google.com>
8900
8901         * layout.cc (Layout::finish_dynamic_section): Generate tags
8902         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8903         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8904         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8905
8906 2009-10-14  Ian Lance Taylor  <iant@google.com>
8907
8908         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8909         fields.
8910         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8911         data_shdr fields of relinfo.
8912         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8913         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8914         R_386_TLS_LDO_32, adjust based on section flags.
8915         (Target_i386::Relocate::fix_up_ldo): Remove.
8916
8917 2009-10-13  Ian Lance Taylor  <iant@google.com>
8918
8919         Add support for -pie.
8920         * options.h (class General_options): Add -pie and
8921         --pic-executable.
8922         (General_options::output_is_position_independent): Test -pie.
8923         (General_options::output_is_executable): Return true if not shared
8924         and not relocatable.
8925         (General_options::output_is_pie): Remove.
8926         * options.cc (General_options::finalize): Reject incompatible uses
8927         of -pie.
8928         * gold.cc (queue_middle_tasks): A -pie link is not static.
8929         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8930         * symtab.cc (Symbol::final_value_is_known): Return false if
8931         output_is_position_independent.
8932         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8933         output_is_position_independent.
8934         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8935         output_is_position_independent.
8936         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8937         output_is_position_independent.
8938         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8939         two_file_pie_test.
8940         (basic_pie_test.o, basic_pie_test): New targets.
8941         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8942         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8943         (two_file_pie_test): New target.
8944         * testsuite/Makefile.in: Rebuild.
8945         * README: Remove note saying that -pie is not supported.
8946
8947 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8948
8949         * options.h (class General_options): Add -init and -fini.
8950         * layout.cc (Layout::finish_dynamic_section): Emit
8951         given init and fini functions.
8952
8953 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8954
8955         * gc.h (gc_process_relocs): Check if icf is enabled using new
8956         function.
8957         * gold.cc (queue_initial_tasks): Likewise.
8958         (queue_middle_tasks): Likewise.
8959         * object.cc (do_layout): Likewise.
8960         * symtab.cc (is_section_folded): Likewise.
8961         * main.cc (main): Likewise.
8962         * reloc.cc (Read_relocs::run): Likewise.
8963         (Sized_relobj::do_scan_relocs): Likewise.
8964         * icf.cc (is_function_ctor_or_dtor): New function.
8965         (Icf::find_identical_sections): Check if function is ctor or dtor when
8966         safe icf is chosen.
8967         * options.h (General_options::icf): Change option to be an enum.
8968         (Icf_status): New enum.
8969         (icf_enabled): New method.
8970         (icf_safe_folding): New method.
8971         (set_icf_status): New method.
8972         (icf_status_): New variable.
8973         * (options.cc) (General_options::finalize): Set icf_status_.
8974         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8975         icf_test and icf_keep_unique_test to use the --icf enum flag.
8976         * testsuite/icf_safe_test.sh: New file.
8977         * testsuite/icf_safe_test.cc: New file.
8978
8979 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8980
8981         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8982         includes to gc.h and icf.h.
8983         * arm.cc: Include gc.h.
8984         * gold.cc: Likewise.
8985         * i386.cc: Likewise.
8986         * powerpc.cc: Likewise.
8987         * sparc.cc: Likewise.
8988         * x86_64.cc: Likewise.
8989         * gc.h: Include icf.h.
8990
8991 2009-10-11  Ian Lance Taylor  <iant@google.com>
8992
8993         * plugin.cc: Include "gold.h" before other header files.
8994
8995 2009-10-10  Chris Demetriou  <cgd@google.com>
8996
8997         * options.h (Input_file_argument::Input_file_type): New enum.
8998         (Input_file_argument::is_lib_): Replace with...
8999         (Input_file_argument::type_): New member.
9000         (Input_file_argument::Input_file_argument): Take Input_file_type
9001         'type' rather than boolean 'is_lib' as second argument.
9002         (Input_file_argument::is_lib): Use type_.
9003         (Input_file_argument::is_searched_file): New function.
9004         (Input_file_argument::may_need_search): Handle is_searched_file.
9005         * options.cc (General_options::parse_library): Support -l:filename.
9006         (General_options::parse_just_symbols): Update for Input_file_argument
9007         changes.
9008         (Command_line::process): Likewise.
9009         * archive.cc (Archive::get_file_and_offset): Likewise.
9010         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9011         * script.cc (read_script_file, script_add_file): Likewise.
9012         * fileread.cc (Input_file::Input_file): Likewise.
9013         (Input_file::will_search_for): Handle is_searched_file.
9014         (Input_file::open): Likewise.
9015         * readsyms.cc (Read_symbols::get_name): Likewise.
9016         * testsuite/Makefile.am (searched_file_test): New test.
9017         * testsuite/Makefile.in: Regenerate.
9018         * testsuite/searched_file_test.cc: New file.
9019         * testsuite/searched_file_test_lib.cc: New file.
9020
9021 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9022             Ian Lance Taylor  <iant@google.com>
9023
9024         * descriptor.cc: Include <cstdio> and "binary-io.h".
9025         (Descriptors::open): Open the files in binary mode always.
9026         * script.cc (Lex::get_token): Treat \r as whitespace.
9027
9028 2009-10-09  Ian Lance Taylor  <iant@google.com>
9029
9030         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9031
9032 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9033             Ian Lance Taylor  <iant@google.com>
9034
9035         * configure.ac: Check for readv function also.
9036         * fileread.cc (readv): Define if not HAVE_READV.
9037         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9038         does not exist.
9039         * config.in: Regenerate.
9040         * configure: Regenerate.
9041
9042 2009-10-09  Doug Kwan  <dougkwan@google.com>
9043
9044         * layout.cc (Layout::make_output_section): Call target hook to make
9045         ordinary output section.
9046         (Layout::finalize): Adjust parameter list of call the
9047         Target::may_relax().
9048         * layout.h (class Layout::section_list): New method.
9049         * merge.h (Output_merge_base::entsize): Change visibility to public.
9050         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9051         New methods.
9052         (Output_merge_string::do_is_string): New method.
9053         * object.cc (Sized_relobj::do_setup): renamed from
9054         Sized_relobj::set_up.
9055         * object.h (Sized_relobj::adjust_shndx,
9056         Sized_relobj::initializ_input_to_output_maps,
9057         Sized_relobj::free_input_to_output_maps): Change visibilities to
9058         protected.
9059         (Sized_relobj::setup): Virtualize.
9060         (Sized_relobj::do_setup): New method declaration.
9061         (Sized_relobj::invalidate_section_offset,
9062         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9063         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9064         * options.cc (parse_int): New function.
9065         * options.h (parse_int): New declaration.
9066         (DEFINE_int): New macro.
9067         (stub_group_size): New option.
9068         * output.cc (Output_section::Output_section): Initialize memebers
9069         merge_section_map_, merge_section_by_properties_map_,
9070         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9071         (Output_section::add_input_section): Handled deferred code-fill
9072         generation and remove an old comment.
9073         (Output_section::add_relaxed_input_section): New method definition.
9074         (Output_section::add_merge_input_section): Use merge section by
9075         properties map to speed to search.  Update merge section maps
9076         as appropriate.
9077         (Output_section::build_relaxation_map): New method definition.
9078         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9079         Same.
9080         (Output_section::relax_input_section): Renamed to
9081         Output_section::convert_input_sections_to_relaxed_sections and change
9082         interface to take a vector of pointers to relaxed sections.
9083         (Output_section::find_merge_section,
9084         Output_section::find_relaxed_input_section): New method definitions.
9085         (Output_section::is_input_address_mapped,
9086         Output_section::output_offset, Output_section::output_address):
9087         Use output section data maps to speed up searching.
9088         (Output_section::find_starting_output_address): Add comments.
9089         (Output_section::do_write,
9090         Output_section::write_to_postprocessing_buffer): Do code-fill
9091         generation as appropriate.
9092         (Output_section::get_input_sections): Invalidate relaxed input section
9093         map.
9094         (Output_section::restore_states): Adjust type of checkpoint .
9095         Invalidate relaxed input section map.
9096         * output.h (Output_merge_base): New class declaration.
9097         (Input_section_specifier): New class defintion.
9098         (class Output_relaxed_input_section) Change base class to
9099         Output_section_data_build.
9100         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9101         base class initializer.
9102         (Output_section::add_relaxed_input_section): New method declaration.
9103         (Output_section::Input_section): Change visibility to protected.
9104         (Output_section::Input_section::relobj,
9105         Output_section::Input_section::shndx): Handle relaxed input sections.
9106         Output_section::input_sections) Change visibility to protected.  Also
9107         define overload to return a non-const pointer.
9108         (Output_section::Merge_section_properties): New class defintion.
9109         (Output_section::Merge_section_by_properties_map,
9110         Output_section::Output_section_data_by_input_section_map,
9111         Output_section::Relaxation_map): New types.
9112         (Output_section::relax_input_section): Rename method to
9113         Output_section::convert_input_sections_to_relaxed_sections and change
9114         interface to take a vector of relaxed section pointers.
9115         (Output_section::find_merge_section,
9116         Output_section::find_relaxed_input_section,
9117         Output_section::build_relaxation_map,
9118         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9119         New method declarations.
9120         (Output_section::merge_section_map_
9121         Output_section::merge_section_by_properties_map_,
9122         Output_section::relaxed_input_section_map_,
9123         Output_section::is_relaxed_input_section_map_valid_,
9124         Output_section::generate_code_fills_at_write_): New data members.
9125         * script-sections.cc
9126         (Output_section_element_input::set_section_addresses): Call
9127         current_data_size and addralign methods of relaxed input sections.
9128         (Orphan_output_section::set_section_addresses): Call current_data_size
9129         and addralign methods of relaxed input sections.
9130         * symtab.cc (Symbol_table::compute_final_value): Extract template
9131         from the body of Symbol_table::sized_finalize_symbol.
9132         (Symbol_table::sized_finalized_symbol): Call
9133         Symbol_table::compute_final_value.
9134         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9135         (Symbol_table::compute_final_value): New templated method declaration.
9136         * target.cc (Target::do_make_output_section): New method defintion.
9137         * target.h (Target::make_output_section): New method declaration.
9138         (Target::relax): Add more parameters for input objects, symbol table
9139         and layout.  Adjust call to do_relax.
9140         (Target::do_make_output_section): New method declaration.
9141         (Target::do_relax): Add parameters for input objects, symbol table
9142         and layout.
9143
9144 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9145
9146         * pread.c: Include stdio.h.
9147
9148 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9149
9150         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9151         defined.
9152
9153 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9154
9155         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9156         Change read_shndx type to unsigned int.
9157         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9158         int.
9159         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9160         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9161         Change read_shndx type to unsigned int.
9162         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9163         int.
9164         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9165         * layout.cc (Layout::create_symtab_sections): Cast the result of
9166         local_symcount * symsize to off_t in the gold_assert.
9167
9168 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9169
9170         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9171         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9172         R_ARM_BASE_ABS.
9173         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9174         (Arm_relocate_functions::thm_abs5): New function.
9175         (Arm_relocate_functions::abs12): New function.
9176         (Arm_relocate_functions::abs16): New function.
9177         (Arm_relocate_functions::base_abs): New function.
9178         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9179         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9180         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9181         R_ARM_BASE_ABS.
9182         (Scan::global): Likewise.
9183         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9184         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9185         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9186         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9187         R_ARM_BASE_ABS.
9188
9189 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9190
9191         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9192         (Arm_relocate_functions::movt_prel): New function.
9193         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9194         (Arm_relocate_functions::thm_movt_prel): New function.
9195         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9196         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9197         (Scan::global, Relocate::relocate): Likewise.
9198         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9199
9200 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9201
9202         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9203         Incremental_checker.
9204         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9205         unsigned int.
9206         (class Incremental_inputs_header): New class.
9207         (Incremental_inputs_header_writer): Edit comment.
9208         (Incremental_inputs_entry): New class.
9209         (Incremental_inputs_entry_writer): Edit comment.
9210         (Sized_incremental_binary::do_find_incremental_inputs_section):
9211         Add *strtab_shndx parameter, fill it.
9212         (Sized_incremental_binary::do_check_inputs): New method.
9213         (Incremental_checker::can_incrementally_link_output_file): Use
9214         Sized_incremental_binary::check_inputs.
9215         (Incremental_inputs::report_command_line): Save command line in
9216         command_line_.
9217         * incremental.h:
9218         (Incremental_binary::find_incremental_inputs_section): New
9219         method.
9220         (Incremental_binary::do_find_incremental_inputs_section): Add
9221         strtab_shndx parameter.
9222         (Incremental_binary::do_check_inputs): New pure virtual method.
9223         (Sized_incremental_binary::do_check_inputs): Declare.
9224         (Incremental_checker::Incremental_checker): Add incremental_inputs
9225         parameter, use it to initialize incremental_inputs_.
9226         (Incremental_checker::incremental_inputs_): New field.
9227         (Incremental_checker::command_line): New method.
9228         (Incremental_checker::inputs): New method.
9229         (Incremental_checker::command_line_): New field.
9230
9231 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9232
9233         * incremental.cc: Include <cstdarg> and "target-select.h".
9234         (vexplain_no_incremental): New function.
9235         (explain_no_incremental): New function.
9236         (Incremental_binary::error): New method.
9237         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9238         method.
9239         (make_sized_incremental_binary): New function.
9240         (open_incremental_binary): New function.
9241         (can_incrementally_link_file): Add checks if output is ELF and has
9242         inputs section.
9243         * incremental.h: Include "elfcpp_file.h" and "output.h".
9244         (Incremental_binary): New class.
9245         (Sized_incremental_binary): New class.
9246         (open_incremental_binary): Declare.
9247         * object.cc (is_elf_object): Use
9248         elfcpp::Elf_recognizer::is_elf_file.
9249         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9250         * output.h (Output_file::filesize): New method.
9251
9252 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9253
9254         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9255         New function.
9256         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9257         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9258         function.
9259         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9260         function.
9261         (Arm_relocate_functions::movw_abs_nc): New function.
9262         (Arm_relocate_functions::movt_abs): New function.
9263         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9264         (Arm_relocate_functions::thm_movt_abs): New function.
9265         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9266         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9267         (Scan::global): Likewise.
9268         (Relocate::relocate): Likewise.
9269         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9270
9271 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9272
9273         * arm.cc (Arm_relocate_functions::got_prel) New function.
9274         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9275         (Relocate::relocate): Likewise.
9276         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9277
9278 2009-10-06  Ian Lance Taylor  <iant@google.com>
9279
9280         * options.h (class General_options): Define
9281         split_stack_adjust_size parameter.
9282         * object.h (class Object): Add uses_split_stack_ and
9283         has_no_split_stack_ fields.  Add uses_split_stack and
9284         has_no_split_stack accessor functions.  Declare
9285         handle_split_stack_section.
9286         (class Reloc_symbol_changes): Define.
9287         (class Sized_relobj): Define Function_offsets.  Declare
9288         split_stack_adjust, split_stack_adjust_reltype, and
9289         find_functions.
9290         * object.cc (Object::handle_split_stack_section): New function.
9291         (Sized_relobj::do_layout): Call handle_split_stack_section.
9292         * dynobj.cc (Sized_dynobj::do_layout): Call
9293         handle_split_stack_section.
9294         * reloc.cc (Sized_relobj::relocate_sections): Call
9295         split_stack_adjust for executable sections in split_stack
9296         objects.  Pass reloc_map to relocate_section.
9297         (Sized_relobj::split_stack_adjust): New function.
9298         (Sized_relobj::split_stack_adjust_reltype): New function.
9299         (Sized_relobj::find_functions): New function.
9300         * target-reloc.h: Include "object.h".
9301         (relocate_section): Add reloc_symbol_changes parameter.  Change
9302         all callers.
9303         * target.h (class Target): Add calls_non_split method.  Declare
9304         do_calls_non_split virtual method.  Declare match_view and
9305         set_view_to_nop.
9306         * target.cc: Include "elfcpp.h".
9307         (Target::do_calls_non_split): New function.
9308         (Target::match_view): New function.
9309         (Target::set_view_to_nop): New function.
9310         * gold.cc (queue_middle_tasks): Give an error if mixing
9311         split-stack and non-split-stack objects with -r.
9312         * i386.cc (Target_i386::relocate_section): Add
9313         reloc_symbol_changes parameter.
9314         (Target_i386::do_calls_non_split): New function.
9315         * x86_64.cc (Target_x86_64::relocate_section): Add
9316         reloc_symbol_changes parameter.
9317         (Target_x86_64::do_calls_non_split): New function.
9318         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9319         parameter.
9320         * powerpc.cc (Target_powerpc::relocate_section): Add
9321         reloc_symbol_changes parameter.
9322         * sparc.cc (Target_sparc::relocate_section): Add
9323         reloc_symbol_changes parameter.
9324         * configure.ac: Call AM_CONDITIONAL for the default target.
9325         * configure: Rebuild.
9326         * testsuite/Makefile.am (TEST_AS): New variable.
9327         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9328         (check_DATA): Add split_i386 and split_x86_64 files.
9329         (SPLIT_DEFSYMS): Define.
9330         (split_i386_[1234n].o): New targets.
9331         (split_i386_[124]): New targets.
9332         (split_i386_[1234r].stdout): New targets.
9333         (split_x86_64_[1234n].o): New targets.
9334         (split_x86_64_[124]): New targets.
9335         (split_x86_64_[1234r].stdout): New targets.
9336         (MOSTLYCLEANFILES): Add new executables.
9337         * testsuite/split_i386.sh: New file.
9338         * testsuite/split_x86_64.sh: New file.
9339         * testsuite/split_i386_1.s: New file.
9340         * testsuite/split_i386_2.s: New file.
9341         * testsuite/split_i386_3.s: New file.
9342         * testsuite/split_i386_4.s: New file.
9343         * testsuite/split_i386_n.s: New file.
9344         * testsuite/split_x86_64_1.s: New file.
9345         * testsuite/split_x86_64_2.s: New file.
9346         * testsuite/split_x86_64_3.s: New file.
9347         * testsuite/split_x86_64_4.s: New file.
9348         * testsuite/split_x86_64_n.s: New file.
9349         * testsuite/testfile.cc (Target_test): Update relocation_section
9350         function.
9351         * testsuite/Makefile.in: Rebuild.
9352
9353 2009-10-06  Ian Lance Taylor  <iant@google.com>
9354
9355         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9356         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9357         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9358         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9359         the address on ldo_addrs_.
9360         (Target_i386::Relocate::fix_up_ldo): New function.
9361
9362 2009-10-06   Rafael Espindola  <espindola@google.com>
9363
9364         * plugin.cc (add_input_library): New.
9365         (Plugin::load): Add add_input_library to tv.
9366         (Plugin_manager::add_input_file): Add the is_lib argument.
9367         (add_input_file): Update call to Plugin_manager::add_input_file.
9368         (add_input_library): New.
9369         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9370
9371 2009-09-30  Doug Kwan  <dougkwan@google.com>
9372
9373         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9374         symbol and call Symbol::may_need_copy_reloc to determine if
9375         a copy reloc is needed.
9376         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9377         nocopyreloc is given in command line.
9378         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9379         given in command line.
9380         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9381         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9382         of the removed Target_i386::may_need_copy_reloc.
9383         * options.h (copyreloc): New option with default value false.
9384         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9385         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9386         instead of the removed Target_powerpc::may_need_copy_reloc.
9387         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9388         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9389         instead of the removed Target_sparc::may_need_copy_reloc.
9390         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9391         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9392         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9393         instead of the removed Target_x86_64::may_need_copy_reloc.
9394
9395 2009-09-30  Ian Lance Taylor  <iant@google.com>
9396
9397         * object.h (class Object): Remove target_ field, and target,
9398         sized_target, and set_target methods.
9399         (Object::sized_target): Remove.
9400         (class Sized_relobj): Update declarations.  Remove sized_target.
9401         * object.cc (Sized_relobj::setup): Remove target parameter.
9402         Change all callers.
9403         (Input_objects::add_object): Don't do anything with the target.
9404         (make_elf_sized_object): Add punconfigured parameter.  Change all
9405         callers.  Set or test parameter target.
9406         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9407         Change all callers.
9408         * parameters.cc (Parameters::set_target): Change parameter type to
9409         be non-const.
9410         (Parameters::default_target): Remove.
9411         (set_parameters_target): Change parameter type to be non-const.
9412         (parameters_force_valid_target): New function.
9413         (parameters_clear_target): New function.
9414         * parameters.h (class Parameters): Update declarations.  Remove
9415         default_target method.  Add sized_target and clear_target
9416         methods.  Change target_ to be non-const.
9417         (set_parameters_target): Update declaration.
9418         (parameters_force_valid_target): Declare.
9419         (parameters_clear_target): Declare.
9420         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9421         as NULL if we aren't searching.
9422         (Add_symbols::run): Don't check for compatible target.
9423         * fileread.cc (Input_file::open_binary): Call
9424         parameters_force_valid_target.
9425         * gold.cc (queue_middle_tasks): Likewise.
9426         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9427         set_target on object.
9428         * dynobj.h (class Sized_dynobj): Update declarations.
9429         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9430         make_elf_object returns NULL.
9431         (Archive::include_member): Don't check whether object target is
9432         compatible.
9433         * output.cc (Output_section::add_input_section): Get target from
9434         parameters.
9435         (Output_section::relax_input_section): Likewise.
9436         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9437         parameters.
9438         (Sized_relobj::do_scan_relocs): Likewise.
9439         (Sized_relobj::relocate_sections): Likewise.
9440         * resolve.cc (Symbol_table::resolve): Likewise.
9441         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9442         parameter.  Change all callers.
9443         (Symbol_table::add_from_object): Get target from parameters.
9444         (Symbol_table::add_from_relobj): Don't check object target.
9445         (Symbol_table::add_from_dynobj): Likewise.
9446         (Symbol_table::define_special_symbol): Get target from
9447         parameters.
9448         * symtab.h (class Symbol_table): Update declaration.
9449         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9450         parameter.  Change all callers.  Clear parameter target.
9451         (Binary_test): Test target here.
9452         * testsuite/object_unittest.cc (gold_testsuite): Remove
9453         target_test_pointer parameter.  Change all callers.
9454         (Object_test): Test target here.
9455
9456 2009-09-26  Ian Lance Taylor  <iant@google.com>
9457
9458         * testsuite/initpri1.c: Don't try to use constructor priorities if
9459         compiling with gcc before 4.3.
9460
9461 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9462
9463         * testsuite/retain_symbols_file_test.sh (check_present): Change
9464         output file name to retain_symbols_file_test.stdout.
9465         (check_absent): Likewise.
9466
9467 2009-09-18  Craig Silverstein  <csilvers@google.com>
9468
9469         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9470         * options.cc: Include <cerrno> and <fstream>.
9471         (General_options::finalize): Parse -retain-symbols-file tag.
9472         * options.h: New flag.
9473         (General_options): New method should_retain_symbol, new
9474         variable symbols_to_retain.
9475         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9476         should_retain_symbol map.
9477         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9478         * testsuite/Makefile.in: Regenerate.
9479         * testsuite/retain_symbols_file_test.sh: New file.
9480
9481 2009-09-18  Nick Clifton  <nickc@redhat.com>
9482
9483         * po/es.po: Updated Spanish translation.
9484
9485 2009-09-17  Doug Kwan  <dougkwan@google.com>
9486
9487         * debug.h (DEBUG_RELAXATION): New constant.
9488         (DEBUG_ALL): Add DEBUG_RELAXATION.
9489         (debug_string_to_enum): Add relaxation debug option.
9490         * layout.cc
9491         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9492         Layout::Relaxation_debug_check::read_sections,
9493         Layout::Relaxation_debug_check::read_sections): New method definitions.
9494         (Layout::Layout): Initialize data members
9495         record_output_section_data_from_scrips_,
9496         script_output_section_data_list_ and relaxation_debug_check_.
9497         (Layout::save_segments, Layout::restore_segments,
9498         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9499         Layout::relaxation_loop_body): New method definitions.
9500         (Layout::finalize): Support relaxation.  Move section layout code to
9501         Layout::relaxation_loop_body.
9502         (Layout::set_asection_address_from_script): Move code for orphan
9503         section placement out.
9504         (Layout::place_orphan_sections_in_script): New method definition.
9505         * layout.h (Output_segment_headers, Output_file_header):
9506         New forward class declarations.
9507         (Layout::~Layout): Define.
9508         (Layout::new_output_section_data_from_script): New method definition.
9509         (Layout::place_orphan_sections_in_script): New method declaration.
9510         (Layout::Segment_states): New type declaration.
9511         (Layout::save_segments, Layout::restore_segments,
9512         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9513         Layout::relaxation_loop_body): New method declarations.
9514         (Layout::Output_section_data_list): New type declaration.
9515         (Layout::Relaxation_debug_check): New class definition.
9516         (Layout::record_output_section_data_from_script_,
9517         Layout::script_output_section_data_list_, Layout::segment_states_,
9518         Layout::relaxation_debug_check_): New data members.
9519         * output.cc: (Output_section_headers::do_size): New method definition.
9520         (Output_section_headers::Output_section_headers): Move size
9521         computation to Output_section_headers::do_size.
9522         (Output_segment_headers::do_size): New method definition.
9523         (Output_file_header::Output_file_header): Move size computation to
9524         Output_file_header::do_size and call it.
9525         (Output_file_header::do_size): New method definition.
9526         (Output_data_group::Output_data_group): Adjust call to
9527         Output_section_data.
9528         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9529         (Output_symtab_xindex::do_write): Add array bound check.
9530         (Output_section::Input_section::print_to_mapfile): Handle
9531         RELAXED_INPUT_SECTION_CODE.
9532         (Output_section::Output_section): Initialize data member checkpoint_.
9533         (Output_section::~Output_section): Delete checkpoint object pointed
9534         by checkpoint_.
9535         (Output_section::add_input_section): Always add an Input_section if
9536         relaxing.
9537         (Output_section::add_merge_input_section): Add assert.
9538         (Output_section::relax_input_section): New method definition.
9539         (Output_section::set_final_data_size): Set load address to zero for
9540         an unallocated section.
9541         (Output_section::do_address_and_file_offset_have_reset_values):
9542         New method definition.
9543         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9544         Handle relaxed input section.
9545         (Output_section::sort_attached_input_sections): Checkpoint input
9546         section list lazily.
9547         (Output_section::get_input_sections): Change type of input_sections to
9548         list of Simple_input_section pointers.  Checkpoint input section list
9549         lazily.  Also handle relaxed input sections.
9550         (Output_section::add_input_section_for_script): Take a reference to
9551         a Simple_input_section object instead of Relobj pointer and section
9552         index as parameter.  Handle relaxed input sections.
9553         (Output_section::save_states, Output_section::restore_states): New
9554         method definitions.
9555         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9556         (Output_data::is_data_size_fixed): New method definition.
9557         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9558         if it is fixed.
9559         (Output_data::address_and_file_offset_have_reset_values): New method
9560         definition.
9561         (Output_data::do_address_and_file_offset_have_reset_values): New method
9562         definition.
9563         (Output_data::set_data_size): Check that data size is not fixed.
9564         (Output_data::fix_data_size): New method definition.
9565         (Output_data::is_data_size_fixed_): New data member.
9566         (Output_section_headers::set_final_data_size): New method definition.
9567         (Output_section_headers::do_size): New method declaration.
9568         (Output_segment_headers::set_final_data_size): New method definition.
9569         (Output_segment_headers::do_size): New method declaration.
9570         (Output_file_header::set_final_data_size)::New method definition.
9571         (Output_file_header::do_size)::New method declaration.
9572         (Output_section_data::Output_section_data): Add new parameter
9573         is_data_size_fixed and use it to fix data size.
9574         (Output_data_const::Output_data_const): Adjust call to base class
9575         constructor and fix data size.
9576         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9577         base class constructor and fix data size.
9578         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9579         base class constructor and fix data size.
9580         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9581         class constructor and fix data size.
9582         (Output_data_group::set_final_data_size): New method definition.
9583         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9584         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9585         class constructor and fix data size.
9586         (Output_relaxed_input_section): New class definition.
9587         (Output_section::Simple_input_section): New class definition.
9588         (Output_section::get_input_sections): Adjust parameter list.
9589         (Output_section::add_input_section_for_script): Same.
9590         (Output_section::save_states, Output_section::restore_states,
9591         Output_section::do_address_and_file_offset_have_reset_values,
9592         (Output_section::Input_section::Input_section): Handle
9593         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9594         Output_relaxed_input_section.
9595         (Output_section::Input_section::is_input_section,
9596         Output_section::Input_section::set_output_section): Handle relaxed
9597         input section.
9598         (Output_section::Input_section::is_relaxed_input_section,
9599         Output_section::Input_section::output_section_data,
9600         Output_section::Input_section::relaxed_input_section): New method
9601         definitions.
9602         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9603         value.
9604         (Output_section::Input_section::u1_): Update comments.
9605         (Output_section::Input_section::u2_): Add new union member poris.
9606         (Output_section::Checkpoint_output_section): New classs definition.
9607         (Output_section::relax_input_section): New method declaration.
9608         (Output_section::checkpoint_): New data member.
9609         (Output_segment): Update comments.
9610         (Output_segment::Output_segment): Un-privatize copy constructor.
9611         (Output_segment::operator=): Un-privatize.
9612         * script-sections.cc (Output_section_element::Input_section_list):
9613         Change element type to Output_section::Simple_input_section.
9614         (Output_section_element_dot_assignment::set_section_addresses):
9615         Register output section data for relaxation clean up.
9616         (Output_data_exression::Output_data_expression): Adjust call to base
9617         constructor to fix data size.
9618         (Output_section_element_data::set_section_addresses): Register
9619         Output_data_expression object for relaxation clean up.
9620         (struct Input_section_info): Replace Relobj pointer and section index
9621         pair with Output_section::Simple_input_section and Convert struct to a
9622         class.
9623         (Input_section_sorter::operator()): Adjust access to
9624         Input_section_info data member to use accessors.
9625         (Output_section_element_input::set_section_addresses): Use layout
9626         parameter.  Adjust code to use Output_section::Simple_input_section
9627         and Input_secction_info classes.  Register filler for relaxation
9628         clean up.
9629         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9630         and section index pair with Output_section::Simple_input_section
9631         class.  Adjust code accordingly.
9632         (Phdrs_element::release_segment): New method definition.
9633         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9634         segment list.
9635         (Script_sections::release_segments): New method definition.
9636         * gold/script-sections.h (Script_sections::release_segments): New
9637         method declaration.
9638         * gold/target.h (Target::may_relax, Target::relax,
9639         Target::do_may_relax, Target::do_relax): New method definitions.
9640
9641 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9642
9643         * arm.cc (has_signed_unsigned_overflow): New function.
9644         (Arm_relocate_functions::abs8): New function.
9645         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9646         (Target_arm::Scan::global): Likewise.
9647         (Target_arm::relocate::relocate): Likewise.
9648         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9649         Likewise.
9650
9651 2009-09-16  Cary Coutant  <ccoutant@google.com>
9652
9653         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9654         * testsuite/Makefile.in: Regenerate.
9655
9656 2009-09-11  Nick Clifton  <nickc@redhat.com>
9657
9658         * po/gold.pot: Updated by the Translation project.
9659
9660 2009-09-08  Cary Coutant  <ccoutant@google.com>
9661
9662         * output.cc (Output_file::open): Add execute permission to empty file.
9663         * testsuite/Makefile.am (permission_test): New test.
9664         * testsuite/Makefile.in: Regenerate.
9665
9666 2009-09-02  Ian Lance Taylor  <iant@google.com>
9667
9668         * output.cc (Output_file::resize): Call map_no_anonymous rather
9669         than map.
9670
9671 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9672
9673         * gold.cc: Include "incremental.h".
9674         (queue_initial_tasks): Call Incremental_checker methods.
9675         * incremental.cc: Include "output.h".
9676         (Incremental_checker::can_incrementally_link_output_file): New
9677         method.
9678         * incremental.h (Incremental_checker): New class.
9679
9680         * output.cc (Output_file::open_for_modification): New method.
9681         (Output_file::map_anonymous): Changed return type to bool.  Record
9682         map in base_ field.
9683         (Output_file::map_no_anonymous): New method, broken out of map.
9684         (Output_file::map): Use map_no_anonymous and map_anonymous.
9685         * output.h (class Output_file): Update declarations.
9686
9687 2009-08-24  Cary Coutant  <ccoutant@google.com>
9688
9689         * options.h (Command_line::Pre_options): New class.
9690         (Command_line::pre_options): New member.
9691         * options.cc (gold::options::ready_to_register): New variable.
9692         (One_option::register_option): Do nothing if not registering options.
9693         Assert if same short option registered twice.
9694         (General_options::General_options): Turn off option registration when
9695         done constructing.
9696         (Command_line::Pre_options::Pre_options): New constructor.
9697
9698 2009-08-24  Cary Coutant  <ccoutant@google.com>
9699
9700         * options.h (General_options::no_keep_memory): Remove incorrect
9701         short option.
9702
9703 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9704
9705         * Makefile.am (am__skiplex, am__skipyacc): New.
9706         * Makefile.in: Regenerate.
9707
9708 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9709
9710         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9711         (INCLUDES): ... this.
9712         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9713         (AM_CPPFLAGS): Renamed from ...
9714         (INCLUDE): ... this.
9715         * Makefile.in, testsuite/Makefile.in: Regenerate.
9716
9717         * Makefile.in: Regenerate.
9718         * aclocal.m4: Likewise.
9719         * config.in: Likewise.
9720         * configure: Likewise.
9721         * testsuite/Makefile.in: Likewise.
9722
9723         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9724         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9725         * Makefile.in: Regenerate.
9726         * testsuite/Makefile.in: Regenerate.
9727
9728 2009-08-19  Cary Coutant  <ccoutant@google.com>
9729
9730         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9731         symbols in shared libraries overridden by hidden or internal symbols
9732         in the main program.
9733
9734 2009-08-19  Chris Demetriou  <cgd@google.com>
9735
9736         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9737         checking source file names in error messages.
9738
9739 2009-08-18  Doug Kwan  <dougkwan@google.com>
9740
9741         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9742         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9743         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9744         an elfcpp::Ehdr as parameter.
9745         * object.cc (Object::set_target): Remove the version that looks up
9746         a target and sets it.
9747         (Sized_relobj::setup): Take a Target object instead of
9748         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9749         (make_elf_sized_object): Find target and ask target to
9750         make an ELF object.
9751         * object.h: (Object::set_target): Remove the version that looks up
9752         a target and sets it.
9753         (Sized_relobj::setup): Take a Target object instead of
9754         an elfcpp:Ehdr as parameter.
9755         * target.cc: Include dynobj.h.
9756         (Target::do_make_elf_object_implementation): New.
9757         (Target::do_make_elf_object): New.
9758         * target.h (Target::make_elf_object): New template declaration.
9759         (Target::do_make_elf_object): New method declarations.
9760         (Target::do_make_elf_object_implementation): New template declaration.
9761
9762 2009-08-14  Ian Lance Taylor  <iant@google.com>
9763
9764         * gold.h (FUNCTION_NAME): Define.
9765         (gold_unreachable): Use FUNCTION_NAME.
9766
9767 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9768
9769         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9770         symbol in the --keep-unique list is not found.
9771
9772 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9773
9774         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9775         been maked as --keep-unique.
9776         (Icf::unfold_section): New function.
9777         * icf.h (Icf::unfold_section): New function.
9778         * options.h (General_options::keep_unique): New option.
9779         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9780         * testsuite/Makefile.in: Regenerate.
9781         * testsuite/icf_keep_unique_test.sh: New file.
9782         * testsuite/icf_keep_unique_test.cc: New file.
9783
9784 2009-08-12  Cary Coutant  <ccoutant@google.com>
9785
9786         PR 10471
9787         * resolve.cc (Symbol_table::resolve): Check for references from
9788         dynamic objects to hidden and internal symbols.
9789         * testsuite/Makefile.am (hidden_test.sh): New test.
9790         * testsuite/Makefile.in: Regenerate.
9791         * testsuite/hidden_test.sh: New script.
9792         * testsuite/hidden_test_1.c: New test source.
9793         * testsuite/hidden_test_main.c: New test source.
9794
9795 2009-08-11  Doug Kwan  <dougkwan@google.com>
9796
9797         * arm.cc: Update comments.
9798         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9799         segment to locate the .ARM.exidx section if present.
9800
9801 2009-08-09  Doug Kwan  <dougkwan@google.com>
9802
9803         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9804         patch.
9805
9806 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9807         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9808         compiler warnings.
9809
9810 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9811
9812         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9813         valid tls_segment only for non-debug-section relocations.
9814         * testsuite/Makefile.am: Add gc_tls_test.
9815         * testsuite/Makefile.in: Regenerate.
9816         * testsuite/gc_tls_test.cc: New file.
9817         * testsuite/gc_tls_test.sh: New file.
9818
9819 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9820
9821         * icf.cc: New file.
9822         * icf.h: New file.
9823         * Makefile.am (CCFILES): Add icf.cc.
9824         (HFILES): Add icf.h
9825         * Makefile.in: Regenerate.
9826         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9827         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9828         section, symbol and addend information for the relocs.
9829         * gold.cc (queue_middle_tasks): Call identical code folding.
9830         * gold.h: Add defines for multimap.
9831         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9832         to the call of finalize_local_symbols.
9833         * main.cc (main): Create object of class Icf.
9834         * object.cc (Sized_relobj::do_layout): Allow this function to be
9835         called twice during icf.
9836         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9837         to sections marked as identical by icf.
9838         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9839         when available.
9840         (Sized_relobj::do_section_entsize): New function.
9841         * object.h (Object::section_entsize): New function.
9842         (Object::do_section_entsize): New pure virtual function.
9843         (Relobj::finalize_local_symbols): Add new parameter.
9844         (Relobj::do_section_entsize): New function.
9845         * options.h (General_options::icf): New option.
9846         (General_options::icf_iterations): New option.
9847         (General_options::print_icf_sections): New option.
9848         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9849         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9850         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9851         icf.
9852         * symtab.cc (Symbol_table::is_section_folded): New function.
9853         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9854         to sections marked as identical by icf.
9855         * symtab.h (Symbol_table::set_icf): New function.
9856         (Symbol_table::icf): New function.
9857         (Symbol_table::is_section_folded): New function.
9858         (Symbol_table::icf_): New data member.
9859         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9860         * testsuite/Makefile.am: Add commands to build icf_test.
9861         * testsuite/Makefile.in: Regenerate.
9862         * testsuite/icf_test.sh: New file.
9863         * testsuite/icf_test.cc: New file.
9864
9865 2009-07-24  Chris Demetriou  <cgd@google.com>
9866
9867         * layout.cc (is_compressible_debug_section): Fix incorrect
9868         comment about compressed section names.
9869
9870 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9871
9872         PR 10419
9873         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9874
9875 2009-07-16  Ian Lance Taylor  <iant@google.com>
9876
9877         PR 10400
9878         * layout.h: #include <map>.
9879         (class Kept_section): Change from struct to class.  Add accessors
9880         and setters.  Add section size to Comdat_group mapping.  Change
9881         Comdat_group to std::map.  Add is_comdat_ field.  Add
9882         linkonce_size field in union.
9883         (class Layout): Update declaration of find_or_add_kept_section.
9884         Don't declare find_kept_object.
9885         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9886         parameter.  Add object, shndx, is_comdat, and is_group_name
9887         parameters.  Change all callers.  Adjust for new Kept_section.
9888         (Layout::find_kept_object): Remove.
9889         * object.cc (Sized_relobj::include_section_group): Update use of
9890         Kept_section.  Rename secnum to shndx.  Only record
9891         Kept_comdat_section if sections are the same size.
9892         (Sized_relobj::include_linkonce_section): Update use of
9893         Kept_section.  Only record Kept_comdat_section if sections are the
9894         same size.  Set size of linkonce section.
9895         (Sized_relobj::map_to_kept_section): Update call to
9896         get_kept_comdat_section.
9897         * object.h (class Sized_relobj): Rename fields in
9898         Kept_comdat_section to drop trailing underscores; change object
9899         field to Relobj*.  Change Kept_comdat_section_table to store
9900         struct rather than pointer.
9901         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9902         Add kept_object and kept_shndx parameters.  Change all callers.
9903         (Sized_relobj::get_kept_comdat_section): Change return type to
9904         bool.  Add kept_object and kept_shndx parameters.  Change all
9905         callers.
9906         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9907         Layout::find_or_add_kept_section.
9908
9909 2009-07-09  Ian Lance Taylor  <iant@google.com>
9910
9911         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9912         Reserve space in the hash table.
9913
9914 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9915
9916         * fileread.cc (File_read::get_mtime): New method.
9917         * fileread.h (Timespec): New structure.
9918         (File_read::get_mtime): New method.
9919         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9920         Renamed from timestamp_nsec.
9921         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9922         Elf_Xword.
9923         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9924         timestamp_nsec.
9925         (Incremental_inputs::report_archive): Save mtime; style fix.
9926         (Incremental_inputs::report_obejct): Save mtime; style fix.
9927         (Incremental_inputs::report_script): Save mtime; style fix.
9928         (Incremental_inputs::finalize_inputs): Style fix.
9929         (Incremental_inputs::finalize): Style fix.
9930         (Incremental_inputs::create_input_section_data): Store inputs
9931         mtime.
9932         * incremental.h (Incremental_inputs::report_script): Add mtime
9933         argument.
9934         (Incremental_inputs::Input_info::Input_info): Intialize only one
9935         union member.
9936         (Incremental_inputs::Input_info::archive): Move to nameless
9937         union.
9938         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9939         (Incremental_inputs::Input_info::script): Move to nameless union.
9940         (Incremental_inputs::mtime): New field.
9941         * script.cc (read_input_script): Pass file mtime to
9942         Incremental_input.
9943         * script.h (Script_info::inputs): Style fix.
9944
9945 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9946
9947         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9948         instead of 32.
9949
9950 2009-06-24  Ian Lance Taylor  <iant@google.com>
9951
9952         PR 10156
9953         * layout.cc (Layout::choose_output_section): If we find an
9954         existing section, update the flags.
9955         (Layout::create_notes): New function, broken out of
9956         Layout::finalize.
9957         (Layout::finalize): Don't create note sections.
9958         (Layout::create_note): Don't crash if linker script discards
9959         section.
9960         (Layout::create_gold_note): Likewise.
9961         (Layout::create_build_id): Likewise.  Don't set
9962         after_input_sections on the section.
9963         (Layout::create_executable_stack_info): Remove target parameter.
9964         Change caller.
9965         * layout.h (class Layout): Declare create_notes.  Update
9966         declaration of create_executable_stack_info.
9967         * gold.cc (queue_middle_tasks): Call create_notes.
9968         * output.cc (Output_section::update_flags_for_input_section): Move
9969         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9970         invalid.
9971         * output.h (Output_data::mark_address_invalid): New function.
9972         (class Output_section): Only declare, not define,
9973         update_flags_for_input_section.  Remove set_flags.
9974
9975 2009-06-24  Ian Lance Taylor  <iant@google.com>
9976
9977         * script-sections.cc (Output_section_definition::
9978         set_section_addresses): Rename shadowing local load_address to
9979         laddr.
9980
9981 2009-06-24  Ian Lance Taylor  <iant@google.com>
9982
9983         PR 10244
9984         * reloc.cc (relocate_sections): Skip empty relocation sections.
9985
9986 2009-06-23  Ian Lance Taylor  <iant@google.com>
9987
9988         PR 10156
9989         * layout.cc (Layout::create_note): Use choose_output_section
9990         rather than make_output_section.
9991
9992 2009-06-23  Ian Lance Taylor  <iant@google.com>
9993
9994         PR 10237
9995         * options.cc (General_options::parse_V): Set printed_version_.
9996         (General_options::General_options): Initialize printed_version_.
9997         * options.h (class General_options): Add printed_version_ field.
9998         * gold.cc (queue_initial_tasks): If there are no input files,
9999         don't give a fatal error if we printed the version information.
10000         (queue_middle_tasks): If using -r with a shared object, give a
10001         fatal error rather than an ordinary error.
10002
10003 2009-06-23  Ian Lance Taylor  <iant@google.com>
10004
10005         PR 10219
10006         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10007         (Layout::make_output_section): Set have_stabstr_section_ if we see
10008         a .stab*str section.
10009         (Layout::finalize): Call link_stabs_sections.
10010         (Layout::link_stabs_sections): New file.
10011         * layout.h (class Layout): Add have_stabstr_section_ field.
10012         Declare link_stabs_sections.
10013
10014 2009-06-23  Doug Kwan  <dougkwan@google.com>
10015
10016         * Makefile.am (libgold_a_LIBADD): New.
10017         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10018         * Makefile.in: Regenerate.
10019         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10020         * configure: Regenerate.
10021         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10022         * fileread.cc: Include sys/state.h
10023         * gold.h: Declare memmem and strndup if found missing.
10024         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10025
10026 2009-06-23  Ian Lance Taylor  <iant@google.com>
10027
10028         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10029         * configure: Rebuild.
10030
10031 2009-06-23  Ian Lance Taylor  <iant@google.com>
10032
10033         PR 10147
10034         * object.cc (Object::section_contents): Don't try to get a view if
10035         the section has length zero.
10036         (Object::handle_gnu_warning_section): If the section is empty, use
10037         the name of the section as the warning.
10038
10039 2009-06-23  Ian Lance Taylor  <iant@google.com>
10040
10041         PR 10133
10042         * stringpool.h (class Stringpool_template): Add optimize_ field.
10043         (Stringpool_template::set_optimize): New function.
10044         * stringpool.cc (Stringpool_template::Stringpool_template):
10045         Initialize optimize_ field.
10046         (Stringpool_template::set_string_offsets): Test local optimize
10047         fild rather than parameter.
10048         * layout.cc (Layout::Layout): Call set_optimize on the section
10049         name stringpool.
10050
10051 2009-06-22  Ian Lance Taylor  <iant@google.com>
10052
10053         PR 10030
10054         * yyscript.y: Parse TARGET.
10055         * script.cc (script_set_target): New function.
10056         * script-c.h (script_set_target): Declare.
10057         * options.cc (General_options::string_to_object_format): Rename
10058         from string_to_object_format in anonymous namespace.  Change
10059         callers.
10060         * options.h (class General_options): Declare
10061         string_to_object_format.
10062
10063 2009-06-22  Ian Lance Taylor  <iant@google.com>
10064
10065         * script-sections.cc (Script_sections::create_segments): Don't put
10066         program headers in a PT_LOAD segment if -n or -N.
10067
10068 2009-06-22  Ian Lance Taylor  <iant@google.com>
10069
10070         PR 10141
10071         * options.h (class General_options): Add -z lazy and -z now.  Sort
10072         -z options into alphabetical order.
10073         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10074
10075 2009-06-21  Ian Lance Taylor  <iant@google.com>
10076
10077         * layout.cc (Layout::make_output_section): Call
10078         Target::new_output_section.
10079         (Layout::attach_allocated_section_to_segment): Put large section
10080         sections in a separate load segment with the large segment flag
10081         set.
10082         (Layout::segment_precedes): Sort large data segments after other
10083         load segments.
10084         (align_file_offset): New static function.
10085         (Layout::set_segment_offsets): Use align_file_offset.
10086         * output.h (class Output_section): Add is_small_section_ and
10087         is_large_section_ fields.
10088         (Output_section::is_small_section): New function.
10089         (Output_section::set_is_small_section):  New function.
10090         (Output_section::is_large_section): New function.
10091         (Output_section::set_is_large_section): New function.
10092         (Output_section::is_large_data_section): New function.
10093         (class Output_segment): Add is_large_data_segment_ field.
10094         (Output_segment::is_large_data_segment): New function.
10095         (Output_segment::set_is_large_data_segment): New function.
10096         * output.cc (Output_section::Output_section): Initialize new
10097         fields.
10098         (Output_segment::Output_segment): Likewise.
10099         (Output_segment::add_output_section): Add assertion that large
10100         data sections always go in large data segments.  Force small data
10101         sections to the end of the list of data sections.  Force small BSS
10102         sections to the start of the list of BSS sections.  For large BSS
10103         sections to the end of the list of BSS sections.
10104         * symtab.h (class Symbol): Declare is_common_shndx.
10105         (Symbol::is_defined): Check Symbol::is_common_shndx.
10106         (Symbol::is_common): Likewise.
10107         (class Symbol_table): Define enum Commons_section_type.  Update
10108         declarations.  Add small_commons_ and large_commons_ fields.
10109         * symtab.cc (Symbol::is_common_shndx): New function.
10110         (Symbol_table::Symbol_table): Initialize new fields.
10111         (Symbol_table::add_from_object): Put small and large common
10112         symbols in the right list.
10113         (Symbol_table::sized_finalized_symbol): Check
10114         Symbol::is_common_shndx.
10115         (Symbol_table::sized_write_globals): Likewise.
10116         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10117         common symbol lists.  Don't call do_allocate_commons_list if the
10118         list is empty.
10119         (Symbol_table::do_allocate_commons_list): Remove is_tls
10120         parameter.  Add comons_section_type parameter.  Change all
10121         callers.  Handle small and large common symbols.
10122         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10123         Symbol::is_common_shndx.
10124         * resolve.cc (symbol_to_bits): Likewise.
10125         * target.h (Target::small_common_shndx): New function.
10126         (Target::small_common_section_flags): New function.
10127         (Target::large_common_shndx): New function.
10128         (Target::large_common_section_flags): New function.
10129         (Target::new_output_section): New function.
10130         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10131         small_common_section_flags, and large_common_section_flags
10132         fields.
10133         (Target::do_new_output_section): New virtual function.
10134         * arm.cc (Target_arm::arm_info): Initialize new fields.
10135         * i386.cc (Target_i386::i386_info): Likewise.
10136         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10137         Likewise.
10138         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10139         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10140         (Target_x86_64::do_new_output_section): New function.
10141         * configure.ac: Define conditional MCMODEL_MEDIUM.
10142         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10143         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10144         (large_LDFLAGS): Define.
10145         * testsuite/large.c: New file.
10146         * testsuite/testfile.cc (Target_test::test_target_info):
10147         Initialize new fields.
10148         * configure, testsuite/Makefile.in: Rebuild.
10149
10150 2009-06-05  Doug Kwan  <dougkwan@google.com>
10151
10152         * Makefile.am (CCFILES): Add target.cc.
10153         * Makefile.in: Regenerate.
10154         * i386.cc (class Target_i386): Define new virtual method to
10155         override do_is_local_label_name in parent.
10156         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10157         local symbols if --discard-locals or -X is given.
10158         * options.h (class General_options): Declare new options
10159         '--discard-locals' and '-X' for discarding locals.
10160         * target.h (class Target): Define new methods is_local_label_name.
10161         Declare new virtual method do_is_local_label_name.
10162         * target.cc: New file.
10163         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10164         (check_SCRIPTS): Add discard_locals_test.sh.
10165         (check_DATA): Add discard_local_tests.syms.
10166         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10167         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10168         * testsuite/Makefile.in: Regenerate.
10169         * testsuite/discard_locals_test.c: New file.
10170         * testsuite/discard_locals_test.sh: Same.
10171
10172 2009-06-05  Doug Kwan  <dougkwan@google.com>
10173
10174         * object.cc (Sized_relobj::Sized_relobj): Initialize
10175         discarded_eh_frame_shndx_ to -1U.
10176         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10177         section.
10178         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10179         a discarded .eh_frame section.
10180         (Sized_relobj::do_finalize_local_symbols): Ditto.
10181         * object.h (class Sized_relobj): Declare new member
10182         discarded_eh_frame_shndx_.
10183         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10184         (local_labels_test.o, local_labels_test): New rules.
10185         * testsuite/Makefile.in: Regenerate.
10186
10187 2009-06-04  Doug Kwan  <dougkwan@google.com>
10188
10189         * layout.cc (Layout::section_name_mapping): Add mapping for
10190         special ARM sections.
10191
10192 2009-06-03  Doug Kwan  <dougkwan@google.com>
10193
10194         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10195         (utils::has_overflow): Same.
10196
10197 2009-06-03  Ian Lance Taylor  <iant@google.com>
10198
10199         * layout.cc (Layout::section_name_mapping): New array, replacing
10200         Layout::linkonce_mapping.
10201         (Layout::section_name_mapping_count): New variable, replacing
10202         Layout::linkonce_mapping_count.
10203         (Layout::linkonce_output_name): Remove.
10204         (Layout::output_section_name): Rewrite.
10205         * layout.h (class Layout): Rename Linkonce_mapping to
10206         Section_name_mapping, linkonce_mapping to section_name_mapping,
10207         linkonce_mapping_count to section_name_mapping_count.  Don't
10208         declare linkonce_output_name.
10209
10210 2009-06-03  Doug Kwan  <dougkwan@google.com>
10211
10212         * gold/arm.cc (namespace utils): New.
10213         (Target_arm::reloc_is_non_pic): Define new method.
10214         (class Arm_relocate_functions): New.
10215         (Target_arm::Relocate::relocate): Handle relocation types used by
10216         Android.
10217
10218 2009-06-03  Ian Lance Taylor  <iant@google.com>
10219
10220         * arm.cc (Target_arm::scan::global): Use || instead of |.
10221
10222 2009-06-02  Doug Kwan  <dougkwan@google.com>
10223
10224         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10225         issued_non_pic_error_.
10226         (class Target_arm::Scan): Declare new method check_non_pic.
10227         Define new method symbol_needs_plt_entry.
10228         Declare new data member issued_non_pic_error_.
10229         (class Target_arm::Relocate): Declare new method
10230         should_apply_static_reloc.
10231         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10232         (Target_arm::Scan::check_non_pic): Define new method.
10233         (Target_arm::Scan::local): Handle a small subset of reloc types used
10234         by Android.
10235         (Target_arm::Scan::local): Same.
10236         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10237
10238 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10239
10240         * incremental.cc (Incremental_inputs::report_command_line): Filter
10241         out --incremental-* options.
10242
10243 2009-05-29  Doug Kwan  <dougkwan@google.com>
10244
10245         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10246         template class.
10247         (class Target_arm): Update comment.
10248         (Target_arm::Target_arm): Initialize new data members GOT_,
10249         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10250         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10251         and Target_arm::rel_dyn_section.
10252         Declare new_enum Target_arm::Got_type.
10253         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10254         and DYNBSS_.
10255         Update commments for member do_dynsym_value.
10256         (Target_arm::got_size, Target_arm::plt_section,
10257         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10258         new methods inside class defintion.
10259         (Target_arm::got_section): Define new method.
10260         (Target_arm::rel_dyn_section): Same.
10261         (Output_data_plt_arm): New template class.
10262         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10263         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10264         (Output_data_plt_arm::add_entry): Same.
10265         (Output_data_plt_arm::first_plt_entry): Define new
10266         static data member for PLT instruction template.
10267         (Output_data_plt_arm::plt_entry): Same.
10268         (Output_data_plt_arm::do_write): Define new method.
10269         (Target_arm::make_plt_entry): Same.
10270         (Target_arm::do_finalize_sections): Same.
10271         (Target_arm::do_dynsym_value): Same.
10272
10273 2009-05-28  Doug Kwan  <dougkwan@google.com>
10274
10275         * Makefile.am (TARGETSOURCES): Add arm.cc.
10276         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10277         * Makefile.in: Regenerate.
10278         * arm.cc: New file.
10279         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10280
10281 2009-05-26  Doug Kwan  <dougkwan@google.com>
10282
10283         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10284         (General_options::check_excluded_libs): Strip off directories in
10285         archive name before matching like GNU ld does.
10286         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10287         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10288         (exclude_libs_test_LDFLAGS): Add linker option
10289         -Wl,--exclude-libs,libexclude_libs_test_3
10290         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10291         an explicit archive without using -l.
10292         (alt/libexclude_libs_test_3.a): New make rule.
10293         * testsuite/Makefile.in: Regenerate.
10294         * testsuite/exclude_libs_test.c : Declare lib3_default().
10295         (main): Call it.
10296         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10297         * exclude_libs_test_3.c: New file.
10298
10299 2009-05-26  Nick Clifton  <nickc@redhat.com>
10300
10301         * po/id.po: New Indonesian translation.
10302         * po/gold.pot: Updated template file.
10303
10304 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10305
10306         * testsuite/Makefile.am: Add -ffunction-sections to compile
10307         gc_comdat_test files.  Add -Wl,--gc-sections to build
10308         gc_comdat_test.
10309         * testsuite/Makefile.in: Regenerate.
10310         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10311
10312 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10313
10314         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10315         kept comdat section was garbage collected.
10316         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10317         * testsuite/Makefile.in: Regenerate.
10318         * testsuite/gc_comdat_test.sh: New file.
10319         * testsuite/gc_comdat_test_1.cc: New file.
10320         * testsuite/gc_comdat_test_2.cc: New file.
10321
10322 2009-05-19  Doug Kwan  <dougkwan@google.com>
10323
10324         * archive.cc (Archive::Archive): Move constructor from archive.h
10325         to here.  Initialize no_export_.
10326         (Archive::get_elf_object_for_member): Set no_export flag of object.
10327         * archive.h (Archive::Archive): Move constructor body to
10328         archive.cc.
10329         (Archive::no_export): New method.
10330         (Archive::no_export_): New field.
10331         * object.h (Object::Object): Initialize no_export_ to false.
10332         (Object::no_export, Object::set_no_export): New methods.
10333         (Object::no_export_): New field.
10334         * options.cc (General_options::parse_exclude_libs): New method.
10335         (General_options::check_excluded_libs) Same.
10336         * options.h (exclude_libs): New option.
10337         (General_options::check_excluded_libs): New method declaration.
10338         (General_options::excluded_libs_): New field.
10339         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10340         default or protected visibility if an object has no-export flag set.
10341         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10342         (check_SCRIPTS): Add exclude_libs_test.sh.
10343         (check_DATA): Add exclude_libs_test.syms.
10344         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10345         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10346         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10347         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10348         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10349         libexclude_libs_test_2.a): New rules.
10350         * testsuite/Makefile.in: Regenerate.
10351         * testsuite/exclude_libs_test.c: New file.
10352         * testsuite/exclude_libs_test.sh: Ditto.
10353         * testsuite/exclude_libs_test_1.c: Ditto.
10354         * testsuite/exclude_libs_test_2.c: Ditto.
10355
10356 2009-05-15  Ian Lance Taylor  <iant@google.com>
10357
10358         * configure.ac: Check for declarations for cases where libiberty.h
10359         checks HAVE_DECL_xxx.
10360         * configure, config.in: Rebuild.
10361
10362 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10363
10364         * gold.h (Incremental_argument_list): Remove (invalid) forward
10365         declaration.
10366         * incremental.cc (Incremental_inputs::report_achive): New method.
10367         (Incremental_inputs::report_object): New method.
10368         (Incremental_inputs::report_script): New method.
10369         (Incremental_inputs::finalize_inputs): New method.
10370         (Incremental_inputs::finalize): Call finalize_inputs().
10371         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10372         Create inputs entries.
10373         * incremental.h (Incremental_input_type): New enum.
10374         (Incremental_inputs::Incremental_input): Initialize new fields.
10375         (Incremental_inputs::report_inputs): New method.
10376         (Incremental_inputs::report_achive): New method.
10377         (Incremental_inputs::report_object): New method.
10378         (Incremental_inputs::report_script): New method.
10379         (Incremental_inputs::finalize_inputs): New method.
10380         (Incremental_inputs::Input_info): New struct.
10381         (Incremental_inputs::Input_info_map): New typedef.
10382         (Incremental_inputs::lock_): New field.
10383         (Incremental_inputs::Inputs_): New field.
10384         (Incremental_inputs::Inputs_map): New field.
10385         * main.cc (main): Call Incremental_input::report_inputs.
10386         * options.h (Input_argument_list): Typedef moved from
10387         Input_arguments.
10388         (Input_file_group::Files): Remove, use ::Input_argument_list.
10389         (Input_file_group::Input_argument_list): Remove, use
10390         ::Input_argument_list.
10391         * plugin.cc (Plugin_manager::add_input_file): Add error in
10392         incremental build.
10393         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10394         functions.
10395         * script.cc (read_input_script): Call
10396         Incremental_input::report_script.
10397         * script.h (Script_info): New class.
10398
10399 2009-04-27  Ian Lance Taylor  <iant@google.com>
10400
10401         * x86_64.cc (do_adjust_output_section): Set entsize to
10402         plt_entry_size.
10403
10404 2009-04-23  Elliott Hughes  <enh@google.com>
10405
10406         * output.cc (Output_file::close): After short writes, continue
10407         writing from the correct offset in the buffer being written.
10408
10409 2009-04-23  Chris Demetriou  <cgd@google.com>
10410
10411         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10412         * configure: Regenerate.
10413         * config.in: Regenerate.
10414         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10415         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10416
10417 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10418
10419         * incremental.cc (Incremental_inputs_header_data): Renamed from
10420         Incremental_input_header_data.
10421         (Incremental_inputs_header_data::data_size): New field.
10422         (Incremental_inputs_header_data::put_input_file_count): Renamed
10423         from input_file_count.
10424         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10425         from command_line_offset.
10426         (Incremental_inputs_header_data::put_reserved): Renamed from
10427         put_reserved.
10428         (Incremental_inputs_entry_data): Renamed from
10429         Incremental_input_entry_data.
10430         (Incremental_inputs_entry_data::data_size): New field.
10431         (Incremental_inputs::report_command_line): New method.
10432         (Incremental_inputs::finalize): New method.
10433         (Incremental_inputs::create_incremental_inputs_data): New method.
10434         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10435         * incremental.h: New file.
10436         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10437         (Layout::finalize): Create incremental inputs section in
10438         incremental builds.
10439         (Layout::create_incremental_info_sections): New method.
10440         * layout.h (Layout::incremental_inputs): New method.
10441         (Layout::create_incremental_info_sections): New method.
10442         (Layout::incremental_inputs_): New field.
10443         * main.cc (main): Notify Incremental_input of the command line.
10444
10445 2009-04-01  Ian Lance Taylor  <iant@google.com>
10446             Mikolaj Zalewski  <mikolajz@google.com>
10447
10448         * gold.h (reserve_unordered_map): Define, three versions, one for
10449         each version of Unordered_map.
10450         * layout.cc (Layout::Layout): Remove options parameter.  Add
10451         number_of_input_files parameter.  Don't initialize options_.
10452         Initialize number_of_input_files_ and resized_signatures_.  Move
10453         sections_are_attached_.
10454         (Layout::layout_group): Reserve space for group_signatures_.
10455         (Layout::find_or_add_kept_section): Change name parameter to be a
10456         reference.  Resize signatures_ map when it gets large enough.
10457         (Layout::layout_eh_frame): Use parameters->options() instead of
10458         this->options_.
10459         (Layout::make_output_section): Likewise.
10460         (Layout::attach_allocated_section_to_segment): Likewise.
10461         (Layout::finalize, Layout::create_executable_stack): Likewise.
10462         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10463         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10464         * layout.h (class Layout): Update declarations.  Remove options_
10465         field.  Add number_of_input_files_ and resized_signatures_
10466         fields.  Move sections_are_attached_ field.
10467         * main.cc (main): Pass number of input files to Layout
10468         constructor.  Don't pass options.
10469
10470 2009-03-30  Ian Lance Taylor  <iant@google.com>
10471
10472         * ffsll.c (ffsll): Correct implementation.
10473
10474 2009-03-27  Ian Lance Taylor  <iant@google.com>
10475
10476         * ffsll.c: New file.
10477         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10478         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10479         * ftruncate.c (ftruncate): Declare before definition.
10480         * mremap.c (mremap): Likewise.
10481         * pread.c (pread): Likewise.
10482         * configure, Makefile.in, config.in: Rebuild.
10483
10484         * mremap.c: New file.
10485         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10486         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10487         (mremap): Declare if HAVE_MREMAP is not defined.
10488         * configure, Makefile.in, config.in: Rebuild.
10489
10490 2009-03-27  Cary Coutant  <ccoutant@google.com>
10491
10492         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10493         position independent.
10494         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10495         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10496
10497 2009-03-24  Cary Coutant  <ccoutant@google.com>
10498
10499         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10500         an executable.
10501         (needs_dynamic_reloc): Likewise.
10502
10503 2009-03-24  Ian Lance Taylor  <iant@google.com>
10504
10505         * yyscript.y (file_cmd): Recognize EXTERN.
10506         (extern_name_list, extern_name_list_body): New nonterminals.
10507         * script.cc (script_add_extern): Define.
10508         * script-c.h (script_add_extern): Declare.
10509
10510 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10511
10512         * object.cc (is_elf_object): Define.
10513         * object.h (is_elf_object): Declare.
10514         * archive.cc (Archive::get_elf_object_for_member): Call
10515         is_elf_object.
10516         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10517
10518 2009-03-24  Elliott Hughes  <enh@google.com>
10519
10520         * output.cc (Output_file::map_anonymous): Define.
10521         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10522         try an anonymous one.  Report the size if the mmap fails.
10523         * output.h (class Output_file): Declare map_anonymous.
10524
10525 2009-03-24  Ian Lance Taylor  <iant@google.com>
10526
10527         * target-select.cc (instantiate_target): Don't acquire the lock if
10528         the instantiated_target_ field has already been set.
10529
10530 2009-03-23  Ian Lance Taylor  <iant@google.com>
10531
10532         * gold-threads.h (class Initialize_lock): Define.
10533         * gold-threads.cc (class Initialize_lock_once): Define.
10534         (initialize_lock_control): New static variable.
10535         (initialize_lock_pointer): New static variable.
10536         (initialize_lock_once): New static function.
10537         (Initialize_lock::Initialize_lock): Define.
10538         (Initialize_lock::initialize): Define.
10539         * target-select.h: Include "gold-threads.h".
10540         (class Target_selector): Add lock_ and initialize_lock_ fields.
10541         Don't define instantiate_target, just declare it.
10542         * target-select.cc (Target_selector::Target_selector): Initialize
10543         new fields.
10544         (Target_selector::instantiate_target): Define.
10545         * descriptors.h: Include "gold-threads.h".
10546         (class Descriptors): Add initialize_lock_ field.
10547         * descriptors.cc (Descriptors::Descriptors): Initialize new
10548         field.
10549         (Descriptors::open): Use initialize_lock_ field
10550         * errors.h (class Errors): Add initialize_lock_ field.
10551         * errors.cc (Errors::Errors): Initialize new field.
10552         (Errors::initialize_lock): Use initialize_lock_ field.
10553         * powerpc.cc (class Target_selector_powerpc): Remove
10554         instantiated_target_ field.  In do_recognize call
10555         instantiate_target rather than do_instantiate_target.  In
10556         do_instantiate_target just allocate a new target.
10557         * sparc.cc (class Target_selector_sparc): Likewise.
10558
10559         * freebsd.h: New file.
10560         * i386.cc: Include "freebsd.h".
10561         (Target_i386): Derive from Target_freebsd rather than
10562         Sized_target.
10563         (Target_selector_i386): Derive from Target_selector_freebsd rather
10564         than Target_selector.
10565         * x86_64.cc: Include "freebsd.h".
10566         (Target_x86_64): Derive from Target_freebsd rather than
10567         Sized_target.
10568         (Target_selector_x86_64): Derive from Target_selector_freebsd
10569         rather than Target_selector.
10570         * target.h (class Target): Add adjust_elf_header and
10571         do_adjust_elf_header.
10572         * output.cc (Output_file_header:: do_sized_write): Call target
10573         adjust_elf_header routine.
10574         * configure.tgt: Set targ_osabi.
10575         * configure.ac: Define GOLD_DEFAULT_OSABI.
10576         * parameters.cc (Parameters::default_target): Pass
10577         GOLD_DEFAULT_OSABI to select_target.
10578         * target-select.h (class Target_selector): Make instantiate_target
10579         protected rather than private.
10580         * Makefile.am (HFILES): Add freebsd.h.
10581         * configure, Makefile.in, config.in: Rebuild.
10582
10583         * merge.cc (do_add_input_section): Correct pend value.  Change
10584         message about last entry not being null terminated from error to
10585         warning.
10586
10587 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10588
10589         * incremental.cc: New file.
10590         * Makefile.am (CCFILES): Add incremental.cc.
10591         * Makefile.in: Rebuild.
10592
10593 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10594
10595         * layout.cc (Layout::output_section_name): Preserve names
10596         of '.note.' sections.
10597
10598 2009-03-19  Ian Lance Taylor  <iant@google.com>
10599
10600         * descriptors.cc (Descriptors::open): Check that the options are
10601         valid before using them.
10602
10603 2009-03-18  Ian Lance Taylor  <iant@google.com>
10604
10605         * script-sections.h: Include <list>.
10606         (class Script_sections): Change Sections_elements from std::vector
10607         to std::list.  Typedef public Elements_iterator.  Add
10608         orphan_section_placement_, data_segment_align_start_, and
10609         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10610         field.
10611         * script-sections.cc (class Orphan_section_placement): New class.
10612         (class Sections_element): Add virtual functions is_relro and
10613         orphan_section_init.  Remove virtual function place_orphan_here.
10614         (class Output_section_definition): Add is_relro and
10615         orphan_section_init.  Remove place_orphan_here.
10616         (class Orphan_output_section): Likewise.
10617         (Script_sections::Script_sections): Update for field changes.
10618         (Script_sections::data_segment_align): Set saw_data_segment_align_
10619         and data_segment_align_start_, not data_segment_align_index.
10620         (Script_sections::data_segment_relro_end): Check
10621         saw_data_segment_align_.  Use data_segment_align_start_ rather
10622         than data_segment_align_index_.
10623         (Script_sections::place_orphan): Rewrite to use
10624         Orphan_section_placement.
10625
10626 2009-03-17  Ian Lance Taylor  <iant@google.com>
10627
10628         * archive.cc (Archive::add_symbols): Check for a version attached
10629         to the symbol name in the archive map.
10630         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10631         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10632         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10633         (ver_test_11.a): New target.
10634         * testsuite/Makefile.in: Rebuild.
10635
10636         * configure.ac: Check for chsize and posix_fallocate.  Replace
10637         ftruncate.
10638         * ftruncate.c: New file, from gnulib.
10639         * output.cc (posix_fallocate): Define dummy version if not
10640         HAVE_POSIX_FALLOCATE.
10641         (Output_file::map): Call posix_fallocate rather than lseek and
10642         write.
10643         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10644         * configure, Makefile.in, config.in: Rebuild.
10645
10646 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10647
10648         * layout.h (Layout::create_note): Add section_name parameter.
10649         * layout.cc (Layout::create_note): Likewise.
10650         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10651
10652 2009-03-17  Ian Lance Taylor  <iant@google.com>
10653
10654         * descriptors.cc: Include "options.h".
10655         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10656         (Descriptors::open): Always use O_CLOEXEC when opening a new
10657         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10658         then set FD_CLOEXEC.
10659
10660         * sparc.cc (class Target_sparc): Add has_got_section.
10661         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10662         make sure we have a GOT section.
10663
10664         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10665         (Target_sparc::Scan::local): Likewise.
10666         (Target_sparc::Scan::global): Likewise.
10667         (Target_sparc::Relocate::relocate): Likewise.
10668         (Target_sparc::Relocate::relocate_tls): Likewise.
10669
10670         * symtab.cc (Symbol_table::define_default_version): New function,
10671         broken out of add_from_object.
10672         (Symbol_table::add_from_object): Call define_default_version.
10673         (Symbol_table::define_special_symbol): Add resolve_oldsym
10674         parameter.  Change all callers.  If the version for a symbol comes
10675         from a version script, resolve it with the symbol with the same
10676         name with no version.  Also add the symbol without a version if
10677         appropriate.
10678         (do_define_in_output_data): If resolving with oldsym, don't delete
10679         sym.
10680         (do_define_in_output_segment): Likewise.
10681         (do_define_as_constant): Likewise.
10682         * symtab.h (class Symbol_table): Update declarations.
10683
10684 2009-03-13  Ian Lance Taylor  <iant@google.com>
10685
10686         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10687         (Read_symbols::requeue): New function.
10688         (Read_symbols::do_read_symbols): If make_elf_object fails because
10689         the target type is not configured, and the file was searched for,
10690         issue a warning and retry with the next directory.
10691         (Add_symbols::run): If the file has an incompatible format, and
10692         it was searched for, requeue the Read_symbols task.  On error,
10693         release the object.
10694         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10695         dirindex parameter to constructor.  Change all callers.  Declare
10696         incompatible_warning and requeue.
10697         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10698         input_argument_ and input_group_ fields.  Add them to
10699         constructor.  Change all callers.
10700         (class Read_script): Add dirindex_ field.  Add it to constructor.
10701         Change all callers.
10702         * archive.cc (Archive::setup): Remove input_objects parameter.
10703         Change all callers.
10704         (Archive::get_file_and_offset): Likewise.
10705         (Archive::read_all_symbols): Likewise.
10706         (Archive::read_symbols): Likewise.
10707         (Archive::get_elf_object_for_member): Remove input_objects
10708         parameter.  Add punconfigured parameter.  Change all callers.
10709         (Archive::add_symbols): Change return type to bool.  Check return
10710         value of include_member.
10711         (Archive::include_all_members): Likewise.
10712         (Archive::include_member): Change return type to bool.  Return
10713         false if first included object has incompatible target.  Set
10714         included_member_ field.
10715         (Add_archive_symbols::run): If add_symbols returns false, requeue
10716         Read_symbols task.
10717         * archive.h (class Archive): Add included_member_ field.
10718         Initialize it in constructor.  Add input_file and searched_for
10719         methods.  Update declarations.
10720         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10721         input_argument_ fields.  Add them to constructor.  Change all
10722         callers.
10723         * script.cc: Include "target-select.h".
10724         (class Parser_closure): Add skip_on_incompatible_target_ and
10725         found_incompatible_target_ fields.  Add
10726         skip_on_incompatible_target parameter to constructor.  Change all
10727         callers.  Add methods skip_on_incompatible_target,
10728         clear_skip_on_incompatible_target, found_incompatible_target, and
10729         set_found_incompatible_target.
10730         (read_input_script): Add dirindex parameter.  Change all callers.
10731         If parser finds an incompatible target, requeue Read_symbols
10732         task.
10733         (script_set_symbol): Clear skip_on_incompatible_target in
10734         closure.
10735         (script_add_assertion, script_parse_option): Likewise.
10736         (script_start_sections, script_add_phdr): Likewise.
10737         (script_check_output_format): New function.
10738         * script.h (read_input_script): Update declaration.
10739         * script-c.h (script_check_output_format): Declare.
10740         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10741         (ignore_cmd): Remove OUTPUT_FORMAT.
10742         * fileread.cc (Input_file::Input_file): Add explicit this.
10743         (Input_file::will_search_for): New function.
10744         (Input_file::open): Add pindex parameter.  Change all callers.
10745         * fileread.h (class Input_file): Add input_file_argument method.
10746         Declare will_search_for.  Update declarations.
10747         * object.cc (make_elf_object): Add punconfigured parameter.
10748         Change all callers.
10749         * object.h (class Object): Make input_file public.  Add
10750         searched_for method.
10751         (make_elf_object): Update declaration.
10752         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10753         restart search.
10754         * dirsearch.h (class Dirsearch): Update declaration.
10755         * options.h (class General_options): Add --warn-search-mismatch.
10756         * parameters.cc (Parameters::is_compatible_target): New function.
10757         * parameters.h (class Parameters): Declare is_compatible_target.
10758         * workqueue.cc (Workqueue::add_blocker): New function.
10759         * workqueue.h (class Workqueue): Declare add_blocker.
10760
10761         * fileread.cc (Input_file::open): Remove options parameter.
10762         Change all callers.
10763         (Input_file::open_binary): Likewise.
10764         * script.cc (read_input_script): Likewise.
10765         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10766         options parameter from constructor.  Change all callers.
10767         (class Read_script): Likewise.
10768         * fileread.h (class Input_file): Update declarations.
10769         * script.h (read_input_script): Update declaration.
10770
10771 2009-03-10  Nick Clifton  <nickc@redhat.com>
10772
10773         * po/es.po: New Spanish translation.
10774
10775 2009-03-06  Cary Coutant  <ccoutant@google.com>
10776
10777         * options.cc (parse_short_option): Keep dash_z from registering itself.
10778
10779 2009-03-03  Ian Lance Taylor  <iant@google.com>
10780
10781         PR 9918
10782         * target-reloc.h (relocate_section): Pass output_section to
10783         relocate.
10784         * i386.cc (Target_i386::should_apply_static_reloc): Add
10785         output_section parameter.  Change all callers.
10786         (Target_i386::Relocate::relocate): Add output_section parameter.
10787         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10788         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10789         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10790         * testsuite/two_file_shared.sh: New script.
10791         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10792         (check_DATA): Add two_file_shared.dbg.
10793         (two_file_shared.dbg): New target.
10794         * testsuite/Makefile.in: Rebuild.
10795
10796 2009-03-01  Ian Lance Taylor  <iant@google.com>
10797
10798         * configure.ac: Check for byteswap.h.
10799         * configure: Rebuild.
10800         * config.in: Rebuild.
10801
10802 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10803
10804         * layout.cc (Layout::find_or_add_kept_section): New function.
10805         (Layout::add_comdat): Removed.
10806         * layout.h (struct Kept_section): Move out of class Layout.
10807         Remove trailing underscores from field names.  Add group_sections
10808         field.  Rename group_ field to is_group.  Change all uses.
10809         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10810         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10811         comdat_groups_ field.
10812         (Sized_relobj::include_section_group): Use
10813         find_or_add_kept_section and Kept_section::group_sections.
10814         (Sized_relobj::include_linkonce_section): Likewise.
10815         * object.cc (class Sized_relobj): Don't define Comdat_group or
10816         Comdat_group_table.  Remove find_comdat_group and
10817         add_comdat_group.  Remove comdat_groups_ field.
10818         * plugin.cc (include_comdat_group): Use
10819         Layout::find_or_add_kept_section.
10820
10821 2009-02-28  Ian Lance Taylor  <iant@google.com>
10822
10823         * README: --gc-sections and map files are now supported.  Document
10824         some build requirements.
10825
10826         PR 6992
10827         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10828         relocatable link set the value of the section symbol to zero.
10829         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10830         relocatable link don't include the section address in the local
10831         symbol value.
10832
10833 2009-02-27  Ian Lance Taylor  <iant@google.com>
10834
10835         PR 6811
10836         * options.h (class Search_directory): Add is_system_directory.
10837         (class General_options): Declare is_in_system_directory.
10838         * options.cc (get_relative_sysroot): Make static.
10839         (get_default_sysroot): Make static.
10840         (General_optoins::is_in_system_directory): New function.
10841         * fileread.cc (Input_file::is_in_system_directory): New function.
10842         * fileread.h (class Input_file): Declare is_in_system_directory.
10843         * object.h (class Object): Add is_in_system_directory.
10844         (class Input_objects): Remove system_library_directory_ field.
10845         * object.cc (Input_objects::add_object): Don't set
10846         system_library_directory_.
10847         (input_objects::found_in_system_library_directory): Remove.
10848         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10849         parameter.  Change all callers.
10850         (Symbol_table::sized_write_globals): Likewise.
10851         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10852         Call Object::is_in_system_directory.
10853         * symtab.h (class Symbol_table): Update declarations.
10854
10855         PR 5990
10856         * descriptors.h (Open_descriptor): Add is_on_stack field.
10857         * descriptors.cc (Descriptors::open): If the descriptor is on the
10858         top of the stack, remove it.  Initialize is_on_stack field.
10859         (Descriptors::release): Only add pod to stack if it is not on the
10860         stack already.
10861         (Descriptors::close_some_descriptor): Clear stack_next and
10862         is_on_stack fields.
10863
10864         PR 7091
10865         * output.cc (Output_section::find_starting_output_address): Rename
10866         from starting_output_address; add PADDR parameter; change return
10867         type.
10868         * output.h (class Output_section): Declare
10869         find_starting_output_address instead of starting_output_address.
10870         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10871         section symbol for which we can't find a merge section.
10872
10873         PR 9836
10874         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10875         hidden or internal, force the symbol to be local.
10876         * resolve.cc (Symbol::override_visibility): Define.
10877         (Symbol::override_base): Use override_visibility.
10878         (Symbol_table::resolve): Likewise.
10879         (Symbol::override_base_with_special): Likewise.
10880         (Symbol_table::override_with_special): If the visibility is hidden
10881         or internal, force the symbol to be local.
10882         * symtab.h (class Symbol): Add set_visibility and
10883         override_visibility.
10884         * testsuite/ver_test_1.sh: New file.
10885         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10886         (check_DATA): Add ver_test_1.syms.
10887         (ver_test_1.syms): New target.
10888         * testsuite/Makefile.in: Rebuild.
10889
10890 2009-02-25  Cary Coutant  <ccoutant@google.com>
10891
10892         * layout.cc (Layout::choose_output_section): Don't rename sections
10893         when using a linker script that has a SECTIONS clause.
10894         * Makefile.in: Regenerate.
10895
10896         * testsuite/Makefile.am (script_test_5.sh): New test case.
10897         * testsuite/Makefile.in: Regenerate.
10898         * testsuite/script_test_5.cc: New file.
10899         * testsuite/script_test_5.sh: New file.
10900         * testsuite/script_test_5.t: New file.
10901
10902 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10903
10904         * archive.cc (Archive::include_member): Update calls to add_symbols.
10905         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10906         the Layout argument.
10907         * dynobj.h (do_add_symbols): Add the Layout argument.
10908         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10909         Layout argument.
10910         * object.h (Object::add_symbols): Add the Layout argument.
10911         (Object::do_add_symbols): Add the Layout argument.
10912         (Sized_relobj::do_add_symbols): Add the Layout argument.
10913         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10914         Unify the two versions.
10915         (Add_plugin_symbols): Remove.
10916         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10917         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10918         (Add_plugin_symbols): Remove.
10919         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10920         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10921         (Add_symbols::run): Make it work with Pulginobj.
10922
10923 2009-02-06  Ian Lance Taylor  <iant@google.com>
10924
10925         * object.cc (Sized_relobj::do_layout): Make info message start
10926         with lower case letter.
10927
10928 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10929
10930         * binary.cc: Fix file comment.
10931
10932         * options.h (enum Incremental_disposition): Define.
10933         (class General_options): Add new options: --incremental,
10934         --incremental_changed, --incremental_unchanged,
10935         --incremental_unknown.  Add incremental_disposition_ and
10936         implicit_incremental_ fields.
10937         (General_options::incremental_disposition): New function.
10938         (class Position_dependent_options): Add incremental_disposition
10939         option.
10940         (Position_dependent_options::copy_from_options): Set incremental
10941         dispositions.
10942         * options.cc (General_options::parse_incremental_changed): New
10943         function.
10944         (General_options::parse_incremental_unchanged): New function.
10945         (General_options::parse_incremental_unknown): New function.
10946         (General_options::General_options): Initialize new fields
10947         incremental_disposition_ and implicit_incremental_.
10948         (General_options::finalize): Check for uasge of --incremental-*
10949         without --incremental.
10950
10951 2009-02-06  Chris Demetriou  <cgd@google.com>
10952
10953         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10954         pointer and to report location as the file name associated with
10955         the symbol.
10956         (gold_undefined_symbol_at_location): New function to replace the
10957         old gold_undefined_symbol functionality.
10958         * target-reloc.h (relocate_section): Update to use
10959         gold_undefined_symbol_at_location.
10960         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10961         Call gold_undefined_symbol function rather than gold_error.
10962         * errors.h (Errors::undefined_symbol): Take location as a
10963         string, rather than calculating it from a relocation.
10964         * errors.cc (Errors::fatal): Print "fatal error:" before the
10965         formatted message.
10966         (Errors::error, Errors::error_at_location): Print "error: "
10967         before the formatted message.
10968         (Errors::undefined_symbol): Take location as a string, rather
10969         than calculating it from a relocation.
10970         (gold_undefined_symbol_at_location): New function akin to
10971         old gold_undefined_symbol, calculates location from relocation.
10972         (gold_undefined_symbol): Change to take only a Symbol pointer
10973         and to report location as the file name associated with the symbol.
10974         * testsuite/debug_msg.sh: Update for changed error messages.
10975         * testsuite/undef_symbol.sh: Likewise.
10976
10977 2009-02-04  Duncan Sands  <baldrick@free.fr>
10978
10979         PR 9812
10980         * reduced_debug_output.h
10981         (Output_reduced_debug_abbrev_section::failed): Use format for
10982         gold_warning.
10983         (Output_reduced_debug_info_section::faild): Likewise.
10984
10985 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10986
10987         * script.cc (Lazy_demangler): New class.
10988         (Version_script_info::get_symbol_version_helper): Demangle a
10989         symbol only once.
10990
10991 2009-01-29  Cary Coutant  <ccoutant@google.com>
10992
10993         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10994         to __tls_get_addr.
10995         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10996
10997 2009-01-28  Ian Lance Taylor  <iant@google.com>
10998
10999         * version.cc (version_string): Bump to 1.9.
11000
11001         * gold.h: Include <cstring> and <stdint.h>.
11002         * version.cc: Include <cstdio>.
11003         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11004         warning.
11005         * reduced_debug_output.cc (insert_into_vector): Rename from
11006         Insert_into_vector; change all callers.  Use Swap_unaligned to
11007         avoid aliasing issue; remove union since it is unnecessary.
11008
11009 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11010
11011         * Makefile.am (CCFILES): Add gc.cc.
11012         (HFILES): Add gc.h.
11013         * Makefile.in: Regenerate.
11014         * gold.cc (Gc_runner): New class.
11015         (queue_initial_tasks): Call garbage collection related tasks
11016         when corresponding options are invoked.
11017         (queue_middle_gc_tasks): New function.
11018         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11019         processed early before laying out sections during garbage collection.
11020         * gold.h (queue_middle_gc_tasks): New function.
11021         (is_prefix_of): Move from "layout.cc".
11022         * i386.cc (Target_i386::gc_process_relocs): New function.
11023         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11024         * main.cc (main): Create object of class "Garbage_collection".
11025         * object.cc (Relobj::copy_symbols_data): New function.
11026         (Relobj::is_section_name_included): New function.
11027         (Sized_relobj::do_layout): Allow this function to be called twice
11028         during garbage collection and defer layout of section during the
11029         first call.
11030         * object.h (Relobj::get_symbols_data): New function.
11031         (Relobj::is_section_name_included): New function.
11032         (Relobj::copy_symbols_data): New function.
11033         (Relobj::set_symbols_data): New function.
11034         (Relobj::get_relocs_data): New function.
11035         (Relobj::set_relocs_data): New function.
11036         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11037         (Relobj::gc_process_relocs): New function.
11038         (Relobj::do_gc_process_relocs): New pure virtual function.
11039         (Relobj::sd_): New data member.
11040         (Sized_relobj::is_output_section_offset_invalid): New function.
11041         (Sized_relobj::do_gc_process_relocs): New function.
11042         * options.h (General_options::gc_sections): Modify to not be a no-op.
11043         (General_options::print_gc_sections): New option.
11044         * plugin.cc (Plugin_finish::run): Remove function call to
11045         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11046         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11047         * reloc.cc (Read_relocs::run): Add task to process relocs and
11048         determine unreferenced sections when doing garbage collection.
11049         (Gc_process_relocs): New class.
11050         (Sized_relobj::do_gc_process_relocs): New function.
11051         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11052         sections that are garbage collected.
11053         * reloc.h (Gc_process_relocs): New class.
11054         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11055         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11056         symbols whose corresponding sections are garbage collected.
11057         (Symbol_table::Symbol_table): Add new parameter for the garbage
11058         collection object.
11059         (Symbol_table::gc_mark_undef_symbols): New function.
11060         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11061         (Symbol_table::gc_mark_dyn_syms): New function.
11062         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11063         as garbage.
11064         (Symbol_table::add_from_object): Likewise.
11065         (Symbol_table::add_from_relobj): When building shared objects, do not
11066         treat externally visible symbols as garbage.
11067         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11068         table information for static and relocatable links.
11069         * symtab.h (Symbol_table::set_gc): New function.
11070         (Symbol_table::gc): New function.
11071         (Symbol_table::gc_mark_undef_symbols): New function.
11072         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11073         (Symbol_table::gc_mark_dyn_syms): New function.
11074         (Symbol_table::gc_): New data member.
11075         * target.h (Sized_target::gc_process_relocs): New pure virtual
11076         function.
11077         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11078         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11079
11080 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11081
11082         * options.h (General_options::gc_sections): Define as a no-op for now.
11083         (General_options::no_keep_memory): Ditto.
11084         (General_options::Bshareable): Define.
11085         * options.cc (General_options::finalize): Honor -Bshareable.
11086
11087 2009-01-20  Andreas Schwab  <schwab@suse.de>
11088
11089         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11090         read the value in the contents, since we don't use it.  Use the
11091         template endianness when writing.
11092         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11093
11094 2009-01-19  Andreas Schwab  <schwab@suse.de>
11095
11096         * configure.tgt (powerpc64-*): Fix targ_obj.
11097
11098 2009-01-15  Ian Lance Taylor  <iant@google.com>
11099
11100         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11101         local symbols when stripping all symbols.
11102
11103 2009-01-14  Cary Coutant  <ccoutant@google.com>
11104
11105         * output.cc (Output_reloc): Add explicit instantiations.
11106
11107 2009-01-14  Cary Coutant  <ccoutant@google.com>
11108
11109         * archive.cc (Archive::get_elf_object_for_member): Remove call
11110         to File_read::claim_for_plugin.
11111         * descriptors.cc (Descriptors::open): Remove reference to
11112         is_claimed.
11113         (Descriptors::claim_for_plugin): Remove.
11114         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11115         (Descriptors::is_claimed): Remove.
11116         (claim_descriptor_for_plugin): Remove.
11117         * fileread.cc (File_read::claim_for_plugin): Remove.
11118         * fileread.h (File_read::claim_for_plugin): Remove.
11119         (File_read::descriptor): Reopen descriptor if necessary.
11120         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11121         (Plugin_manager::all_symbols_read): Add task parameter. Change
11122         all callers.
11123         (Plugin_manager::get_input_file): New function.
11124         (Plugin_manager::release_input_file): New function.
11125         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11126         corresponding data member.
11127         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11128         and pass to base constructor. Change all callers.
11129         (get_input_file, release_input_file): New functions.
11130         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11131         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11132         (Plugin_manager::all_symbols_read): Add task parameter.
11133         (Plugin_manager::get_input_file): New function.
11134         (Plugin_manager::release_input_file): New function.
11135         (Plugin_manager::task_): New data member.
11136         (Pluginobj::Pluginobj): Add filesize parameter.
11137         (Pluginobj::filename): New function.
11138         (Pluginobj::descriptor): New function.
11139         (Pluginobj::filesize): New function.
11140         (Pluginobj::filesize_): New data member.
11141         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11142         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11143         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11144
11145         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11146         with archive libraries.
11147         * testsuite/Makefile.in: Regenerate.
11148         * testsuite/plugin_test.c (struct sym_info): New type.
11149         (get_input_file, release_input_file): New static variables.
11150         (onload): Capture new transfer vector entries.
11151         (claim_file_hook): Stop reading at end of file according to filesize.
11152         Factor out parsing of readelf output into separate function.
11153         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11154         APIs and get the source file name from the symbol table.  Convert
11155         source file name to corresponding object file name.  Print info
11156         message when adding new input files.
11157         (parse_readelf_line): New function.
11158         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11159         * testsuite/plugin_test_2.sh: Likewise.
11160         * testsuite/plugin_test_3.sh: Likewise.
11161         * testsuite/plugin_test_4.sh: New test case.
11162
11163 2009-01-07  Ian Lance Taylor  <iant@google.com>
11164
11165         * version.cc (version_string): Bump to 1.8.
11166
11167 2008-12-23  Cary Coutant  <ccoutant@google.com>
11168
11169         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11170         * plugin.cc (Plugin_manager::finish): Rename as
11171         layout_deferred_objects.  Move cleanup to separate function.
11172         (Plugin_manager::cleanup): New function.
11173         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11174         separately.
11175         * plugin.h (Plugin_manager::finish): Rename as
11176         layout_deferred_objects.
11177         (Plugin_manager::cleanup): New function.
11178         (Plugin_manager::cleanup_done): New field.
11179
11180 2008-12-23  Cary Coutant  <ccoutant@google.com>
11181
11182         * plugin.cc (is_visible_from_outside): New function.
11183         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11184         so we don't return "IR only" status for exported symbols or -r links.
11185
11186         * testsuite/Makefile.am (plugin_test_3): New test case.
11187         * testsuite/Makefile.in: Regenerate.
11188         * testsuite/plugin_test_3.sh: New file.
11189
11190 2008-12-22  Cary Coutant  <ccoutant@google.com>
11191
11192         * object.cc (Sized_relobj::layout_section): New function.
11193         (Sized_relobj::do_layout): Defer layout of input sections until after
11194         plugin has provided replacement files.
11195         (Sized_relobj::do_layout_deferred_sections): New function.
11196         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11197         (Relobj::layout_deferred_sections): New function.
11198         (Relobj::do_layout_deferred_sections): New function.
11199         (Sized_relobj::do_layout_deferred_sections): New function.
11200         (Sized_relobj::layout_section): New function.
11201         (Sized_relobj::Deferred_layout): New structure.
11202         (Sized_relobj::deferred_layout_): New field.
11203         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11204         Change all callers.  Layout deferred sections.
11205         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11206         references.
11207         (Plugin_hook::run): Move code from do_plugin_hook inline.
11208         (Plugin_hook::do_plugin_hook): Remove.
11209         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11210         (Plugin_manager::finish): Renamed, was cleanup.
11211         (Plugin_manager::should_defer_layout): New function.
11212         (Plugin_manager::add_deferred_layout_object): New function.
11213         (Plugin_manager::Deferred_layout_list): New type.
11214         (Plugin_manager::deferred_layout_objects_): New field.
11215         (Plugin_hook::do_plugin_hook): Remove.
11216
11217 2008-12-17  Ian Lance Taylor  <iant@google.com>
11218
11219         * options.h (class General_options): Add --no case for
11220         --export-dynamic.
11221
11222 2008-12-16  Cary Coutant  <ccoutant@google.com>
11223
11224         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11225         vector.
11226         (Plugin_manager::claim_file): Create plugin object even if
11227         plugin did not call the add_symbols callback.
11228         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11229         asking for more symbols than were added.
11230         * testsuite/Makefile.am (plugin_test_1): Add test case with
11231         no global symbols.
11232         (empty.syms): New target.
11233         * testsuite/Makefile.in: Regenerate.
11234         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11235         message. Don't call add_symbols if no globals.
11236         (all_symbols_read_hook): Don't provide replacement for empty
11237         claimed file.
11238
11239 2008-12-12  Ian Lance Taylor  <iant@google.com>
11240
11241         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11242         r_type == 0 for a local symbol with r_sym == 0.
11243         (scan_relocatable_relocs): Pass r_sym to
11244         local_non_section_strategy.
11245         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11246         r_sym parameter.
11247
11248         * configure.ac: Update test for TLS descriptors: they are
11249         supported as of glibc 2.9.
11250         * configure: Rebuild.
11251
11252 2008-12-11  Ian Lance Taylor  <iant@google.com>
11253
11254         PR 7091
11255         * target-reloc.h (Default_scan_relocatable_relocs): For each
11256         function, map r_type == 0 to RELOC_DISCARD.
11257
11258 2008-12-10  Cary Coutant  <ccoutant@google.com>
11259
11260         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11261         object to override a kept COMDAT group from a plugin object.
11262
11263 2008-12-09  Ian Lance Taylor  <iant@google.com>
11264
11265         PR 7088
11266         * yyscript.y (file_cmd): Handle INPUT.
11267
11268         * testsuite/initpri1.c: Change all declarations to be full
11269         prototypes by adding void, to avoid compiler warnings.
11270
11271 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11272
11273         * options.cc (General_options::parse_plugin_opt): New.
11274         (General_options::add_plugin): The argument now is just the filename.
11275         (General_options::add_plugin_option): New.
11276         * options.h (plugin_opt): New.
11277         (add_plugin): Change argument name.
11278         (add_plugin_option): New.
11279         * plugin.cc (Plugin::load): Don't parse the plugin option.
11280         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11281         (Plugin::add_option): New.
11282         (Plugin::args_): Change type.
11283         (Plugin::filename_): New.
11284         (Plugin_manager::add_plugin_option): New.
11285         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11286         * testsuite/Makefile.in: Regenerate.
11287
11288 2008-12-05  Cary Coutant  <ccoutant@google.com>
11289
11290         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11291         Handle --strip-lto-sections option.
11292         * options.h (strip_lto_sections): New option.
11293
11294 2008-12-01  Cary Coutant  <ccoutant@google.com>
11295
11296         * plugin.cc (ld_plugin_message): Change format parameter to const.
11297         Fix mismatch between new[] and delete.
11298
11299 2008-11-14  Cary Coutant  <ccoutant@google.com>
11300
11301         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11302         instead of -1U.
11303
11304 2008-11-05  Craig Silverstein  <csilvers@google.com>
11305
11306         * options.cc (General_options::parse_dynamic_list): New function.
11307         * options.h (General_options): New flags dynamic_list,
11308         dynamic_list_data, dynamic_list_cpp_new, and
11309         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11310         (General_options::in_dynamic_list): New function.
11311         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11312         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11313         (Lex::can_continue_name): Likewise.
11314         (yylex): Likewise.
11315         (read_script_file): New parameter script_options.
11316         (read_dynamic_list): New function.
11317         (Script_options::define_dynamic_list): New function.
11318         (dynamic_list_keyword_parsecodes): New variable.
11319         (dynamic_list_keywords): New variable.
11320         * script.h (Script_options::define_dynamic_list): New function
11321         prototype.
11322         (read_dynamic_list): New function prototype.
11323         * symtab.cc (strprefix): New macro.
11324         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11325         dynamic_list_data, dynamic_list_cpp_new, and
11326         dynamic_list_cpp_typeinfo.
11327         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11328         (dynamic_list_expr): New rule.
11329         (dynamic_list_nodes): Likewise.
11330         (dynamic_list_node): Likewise.
11331         * testsuite/Makefile.am (dynamic_list): New test.
11332         * testsuite/Makefile.in: Regenerated.
11333         * testsuite/dynamic_list.t: New file.
11334         * testsuite/dynamic_list.sh: New file.
11335
11336 2008-11-05  Craig Silverstein  <csilvers@google.com>
11337
11338         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11339         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11340         (t11_last): Likewise.
11341         * testsuite/ver_test_6.c (main): Likewise.
11342
11343 2008-10-07  Cary Coutant  <ccoutant@google.com>
11344
11345         * options.c (General_options::finalize): Add check for -static and
11346         -shared.
11347         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11348         is not empty.
11349
11350 2008-10-02  Cary Coutant  <ccoutant@google.com>
11351
11352         * plugin.cc (make_sized_plugin_object): Fix conditional
11353         compilation to work when not all targets are enabled.
11354
11355 2008-09-29  Cary Coutant  <ccoutant@google.com>
11356
11357         * archive.cc (Archive::get_file_and_offset): Use filename instead
11358         of name to get library path.
11359         (Archive::include_member): Unlock external member of a thin archive.
11360
11361         * testsuite/Makefile.am (TEST_AR): New variable.
11362         (thin_archive_test_1): New test.
11363         (thin_archive_test_2): New test.
11364         * testsuite/Makefile.in: Regenerate.
11365         * testsuite/thin_archive_main.cc: New file.
11366         * testsuite/thin_archive_test_1.cc: New file.
11367         * testsuite/thin_archive_test_2.cc: New file.
11368         * testsuite/thin_archive_test_3.cc: New file.
11369         * testsuite/thin_archive_test_4.cc: New file.
11370
11371 2008-09-29  Cary Coutant  <ccoutant@google.com>
11372
11373         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11374         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11375         instead of -1U.
11376         (Sized_relobj::do_finalize_local_symbols): Likewise.
11377         (Sized_relobj::map_to_kept_section): Likewise.
11378         * object.h (Sized_relobj::invalid_address): New constant.
11379         (Sized_relobj::do_output_section_offset): Check for invalid_address
11380         and return -1ULL.
11381         * output.cc (Output_reloc::local_section_offset): Use constant
11382         invalid_address instead of -1U.
11383         (Output_reloc::get_address): Likewise.
11384         (Output_section::output_address): Change -1U to -1ULL.
11385         * output.h (Output_reloc::invalid_address): New constant.
11386         * reloc.cc (Sized_relobj::write_sections): Use constant
11387         invalid_address instead of -1U.
11388         (Sized_relobj::relocate_sections): Likewise.
11389         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11390         values for merge sections.
11391         * target-reloc.h (relocate_for_relocatable): Use constant
11392         invalid_address instead of -1U.
11393
11394 2008-09-19  Cary Coutant  <ccoutant@google.com>
11395
11396         Add plugin functionality for link-time optimization (LTO).
11397         * configure.ac (plugins): Add --enable-plugins option.
11398         * configure: Regenerate.
11399         * config.in: Regenerate.
11400         * Makefile.am (LIBDL): New variable.
11401         (CCFILES): Add plugin.cc.
11402         (HFILES): Add plugin.h.
11403         (ldadd_var): Add LIBDL.
11404         * Makefile.in: Regenerate.
11405
11406         * archive.cc: Include "plugin.h".
11407         (Archive::setup): Don't preread archive symbols when using a plugin.
11408         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11409         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11410         files.
11411         (Archive::include_member): Add symbols from plugin objects.
11412         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11413         * descriptors.cc (Descriptors::open): Check for file descriptors
11414         abandoned by plugins.
11415         (Descriptors::claim_for_plugin): New function.
11416         * descriptors.h (Descriptors::claim_for_plugin): New function.
11417         (Open_descriptor::is_claimed): New field.
11418         (claim_descriptor_for_plugin): New function.
11419         * fileread.cc (File_read::claim_for_plugin): New function.
11420         * fileread.h (File_read::claim_for_plugin): New function.
11421         (File_read::descriptor): New function.
11422         * gold.cc: Include "plugin.h".
11423         (queue_initial_tasks): Add task to call plugin hooks for generating
11424         new object files.
11425         * main.cc: Include "plugin.h".
11426         (main): Load plugin libraries.
11427         * object.h (Pluginobj): Declare.
11428         (Object::pluginobj): New function.
11429         (Object::do_pluginobj): New function.
11430         (Object::set_target): New function.
11431         * options.cc: Include "plugin.h".
11432         (General_options::parse_plugin): New function.
11433         (General_options::General_options): Initialize plugins_ field.
11434         (General_options::add_plugin): New function.
11435         * options.h (Plugin_manager): Declare.
11436         (General_options): Add --plugin option.
11437         (General_options::has_plugins): New function.
11438         (General_options::plugins): New function.
11439         (General_options::add_plugin): New function.
11440         (General_options::plugins_): New field.
11441         * plugin.cc: New file.
11442         * plugin.h: New file.
11443         * readsyms.cc: Include "plugin.h".
11444         (Read_symbols::do_read_symbols): Check for archive before checking
11445         for ELF file.  Call plugin hooks to claim files.
11446         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11447         from a real object file; force override when processing replacement
11448         files.
11449         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11450         (Symbol::init_base_object): Likewise.
11451         (Symbol::init_base_output_data): Likewise.
11452         (Symbol::init_base_output_segment): Likewise.
11453         (Symbol::init_base_constant): Likewise.
11454         (Symbol::init_base_undefined): Likewise.
11455         (Symbol::output_section): Assert that object is not a plugin.
11456         (Symbol_table::add_from_pluginobj): New function.
11457         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11458         undefined.
11459         (Symbol_table::sized_write_globals): Likewise.
11460         (Symbol_table::add_from_pluginobj): Instantiate template.
11461         * symtab.h (Sized_pluginobj): Declare.
11462         (Symbol::in_real_elf): New function.
11463         (Symbol::set_in_real_elf): New function.
11464         (Symbol::in_real_elf_): New field.
11465         (Symbol_table::add_from_pluginobj): New function.
11466
11467         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11468         (LIBDL): New variable.
11469         (LDADD): Add LIBDL.
11470         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11471         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11472         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11473         (MOSTLYCLEANFILES): Likewise.
11474         * testsuite/Makefile.in: Regenerate.
11475         * testsuite/plugin_test.c: New file.
11476         * testsuite/plugin_test_1.sh: New file.
11477         * testsuite/plugin_test_2.sh: New file.
11478
11479 2008-09-16  Ian Lance Taylor  <iant@google.com>
11480
11481         * target-reloc.h (relocate_section): Check whether a symbol is
11482         defined by the ABI before reporting an undefined symbol error.
11483         * target.h (Target::is_defined_by_abi): Make parameter const.
11484         (Target::do_is_defined_by_abi): Likewise.
11485         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11486         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11487         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11488         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11489         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11490         * testsuite/Makefile.in: Rebuild.
11491
11492         * fileread.cc (make_view): Add casts to avoid warning.
11493
11494 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11495
11496         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11497         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11498
11499 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11500
11501         * options.h (General_options::output_is_executable): New.
11502         (General_options::output_is_pie): New.
11503         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11504         for shared libraries.
11505         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11506
11507 2008-09-11  Chris Demetriou  <cgd@google.com>
11508
11509         * options.h (origin): New -z option.
11510         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11511         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11512         in DT_FLAGS_1.
11513
11514 2008-09-05  Cary Coutant  <ccoutant@google.com>
11515
11516         * fileread.cc (File_read::make_view): Add check for attempt to map
11517         beyond end of file.
11518
11519 2008-09-05  Cary Coutant  <ccoutant@google.com>
11520
11521         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11522         explicit instantiations.
11523
11524 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11525
11526         PR gold/6858
11527         * options.cc (General_options::finalize): Allow undefined symbols
11528         in shlibs if linking -shared.
11529
11530         PR gold/6859
11531         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11532         symbols as not needing a dynsym entry.
11533
11534 2008-08-20  Craig Silverstein  <csilvers@google.com>
11535
11536         * fileread.cc (File_read::open): Do not lock the file unless it
11537         was successfully opened.
11538
11539 2008-08-14  Cary Coutant  <ccoutant@google.com>
11540
11541         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11542         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11543         * testsuite/tls_test.cc (struct int128): 128-bit struct
11544         for testing TLS relocs with non-zero addend.
11545         (v12): New TLS variable.
11546         (t12): New test.
11547         (t_last): Add check for v12.
11548         * testsuite/tls_test.h (t12): New function.
11549         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11550
11551 2008-08-13  Ian Lance Taylor  <iant@google.com>
11552
11553         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11554         set tls_segment_ or relro_segment_.
11555         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11556         when appropriate.
11557         * output.h (Output_section::clear_is_relro): New function.
11558         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11559         sections specially even when output_data_ is empty.
11560         (Output_segment::maximum_alignment): When first section is relro,
11561         only force alignment for PT_LOAD segments.
11562         * script.cc (script_data_segment_align): New function.
11563         (script_data_segment_relro_end): New function.
11564         * script-c.h (script_data_segment_align): Declare.
11565         (script_data_segment_relro_end): Declare.
11566         * script-sections.h (class Script_sections): Declare
11567         data_segment_align and data_segment_relro_end.  Add fields
11568         segment_align_index_ and saw_relro_end_.
11569         * script-sections.cc (class Sections_element): Add set_is_relro
11570         virtual function.  Add new bool* parameter to place_orphan_here.
11571         Add get_output_section virtual function.
11572         (class Output_section_definition): Add set_is_relro.  Add new
11573         bool* parameter to place_orphan_here.  Add get_output_section.
11574         Add is_relro_ field.
11575         (Output_section_definition::Output_section_definition): Initialize
11576         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11577         and is_relro_ fields.
11578         (Output_section_definition::place_orphan_here): Add is_relro
11579         parameter.
11580         (Output_section_definition::set_section_addresses): Set relro for
11581         output section.
11582         (Output_section_definition::alternate_constraint): Likewise.
11583         (class Orphan_output_section): Add new bool* parameter to
11584         place_orphan_here.  Add get_output_section.
11585         (Orphan_output_section::place_orphan_here): Add is_relro
11586         parameter.
11587         (Script_sections::Script_sections): Initialize
11588         data_segment_align_index_ and saw_relro_end_.
11589         (Script_sections::data_segment_align): New function.
11590         (Script_sections::data_segment_relro_end): New function.
11591         (Script_sections::place_orphan): Set or clear is_relro.
11592         (Script_sections::set_section_addresses): Force alignment of first
11593         TLS section.
11594         * yyscript.y (exp): Call script_data_segment_align and
11595         script_data_segment_relro_end.
11596         * testsuite/relro_script_test.t: New file.
11597         * testsuite/relro_test.cc (using_script): Declare.
11598         (t1, t2): Test using_script.
11599         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11600         (relro_script_test_SOURCES): Define.
11601         (relro_script_test_DEPENDENCIES): Define.
11602         (relro_script_test_LDFLAGS): Define.
11603         (relro_script_test_LDADD): Define.
11604         (relro_script_test.so): New target.
11605         * testsuite/Makefile.in: Rebuild.
11606
11607 2008-08-06  Cary Coutant <ccoutant@google.com>
11608
11609         * archive.cc (Archive::total_archives, Archive::total_members)
11610         (Archive::total_members_loaded): New variables.
11611         (Archive::setup): Add parameter.  Add option to preread
11612         archive symbols.
11613         (Archive::read_armap): Add counter.
11614         (Archive::get_file_and_offset): New function.
11615         (Archive::get_elf_object_for_member): New function.
11616         (Archive::read_all_symbols): New function.
11617         (Archive::read_symbols): New function.
11618         (Archive::add_symbols): Add counters.
11619         (Archive::include_all_members): Use armap to find members if it's
11620         already built.
11621         (Archive::include_member): Skip reading symbols if already read.
11622         Factored code into Archive::get_file_and_offset and
11623         Archive::get_elf_object_for_member.  Changed call to
11624         Mapfile::report_include_archive_member.
11625         (Archive::print_stats): New function.
11626         * archive.h: Declare Object and Read_symbols_data classes.
11627         (Archive::Archive): Add initializers for new members.
11628         (Archive::setup): Add parameter.
11629         (Archive::print_stats): New function.
11630         (Archive::total_archives, Archive::total_members)
11631         (Archive::total_members_loaded): New variables.
11632         (Archive::get_file_and_offset): New function.
11633         (Archive::get_elf_object_for_member): New function.
11634         (Archive::read_all_symbols): New function.
11635         (Archive::read_symbols): New function.
11636         (Archive::Archive_member): New class.
11637         (Archive::members_): New member.
11638         (Archive::num_members_): New member.
11639         * main.cc: Include archive.h.
11640         (main): Call Archive::print_stats.
11641         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11642         archive parameter; member_name is now the fully-decorated name.
11643         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11644         * options.h: (General_options): Add --preread-archive-symbols option.
11645         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11646         Archive::setup.
11647
11648 2008-08-04  Ian Lance Taylor  <iant@google.com>
11649
11650         * symtab.h (Symbol::use_plt_offset): New function.
11651         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11652         * powerpc.cc (Relocate::relocate): Likewise.
11653         * sparc.cc (Relocate::relocate): Likewise.
11654         * x86_64.cc (Relocate::relocate): Likewise.
11655         * testsuite/weak_plt.sh: New test.
11656         * testsuite/weak_plt_main.cc: New test.
11657         * testsuite/weak_plt_shared.cc: New test.
11658         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11659         (check_PROGRAMS): Add weak_plt.
11660         (check_DATA): Add weak_plt_shared.so.
11661         (weak_plt_main_pic.o, weak_plt): New targets.
11662         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11663         * testsuite/Makefile.in: Rebuild.
11664
11665         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11666         gcctestdir/ld.
11667         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11668         * testsuite/Makefile.in: Rebuild.
11669
11670 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11671
11672         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11673         * Makefile.in: Regenerate.
11674         * po/POTFILES.in: Regenerate.
11675
11676 2008-07-29  Ian Lance Taylor  <iant@google.com>
11677
11678         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11679         symbols before other symbols.
11680         * testsuite/script_test_2.cc (test_addr): Declare.
11681         (test_addr_alias): Declare.
11682         (main): Check that test_addr and test_addr_alias have the right
11683         values.
11684         * testsuite/script_test_2.t: Define test_addr_alias and
11685         test_addr.
11686
11687 2008-07-24  Ian Lance Taylor  <iant@google.com>
11688
11689         PR 5990
11690         * descriptors.cc: New file.
11691         * descriptors.h: New file.
11692         * gold-threads.h (class Hold_optional_lock): New class.
11693         * fileread.cc: Include "descriptors.h".
11694         (File_read::~File_read): Release descriptor rather than closing
11695         it.
11696         (File_read::open) [file]: Call open_descriptor rather than open.
11697         Set is_descriptor_opened_.
11698         (File_read::open) [memory]: Assert that descriptor is not open.
11699         (File_read::reopen_descriptor): New function.
11700         (File_read::release): Release descriptor.
11701         (File_read::do_read): Make non-const.  Reopen descriptor.
11702         (File_read::read): Make non-const.
11703         (File_read::make_view): Reopen descriptor.
11704         (File_read::do_readv): Likewise.
11705         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11706         Update declarations.
11707         * layout.cc: Include "descriptors.h".
11708         (Layout::create_build_id): Use open_descriptor rather than open.
11709         * output.cc: Include "descriptors.h".
11710         (Output_file::open): Use open_descriptor rather than open.
11711         * archive.cc (Archive::const_iterator): Change Archive to be
11712         non-const.
11713         (Archive::begin, Archive::end): Make non-const.
11714         (Archive::count_members): Likewise.
11715         * archive.h (class Archive): Update declarations.
11716         * object.h (Object::read): Make non-const.
11717         * Makefile.am (CCFILES): Add descriptors.cc.
11718         (HFILES): Add descriptors.h.
11719         * Makefile.in: Rebuild.
11720
11721         PR 6716
11722         * gold.h: Always include <clocale>.  Add Solaris workarounds
11723         following code in binutils/sysdep.h.
11724
11725         PR 6048
11726         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11727         this->eh_frame_hdr_ is NULL before using it.
11728
11729         * dynobj.cc (Versions::Versions): Update comment.
11730
11731         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11732         the base version name.
11733
11734         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11735         array size plus one.
11736         (Stringpool_template::set_string_offsets): Subtract one from key
11737         before using it as an array index.
11738         (Stringpool_template::get_offset_with_length): Likewise.
11739         (Stringpool_template::write_to_buffer): Likewise.
11740         * stringpool.h (Stringpool_template::get_offset_from_key):
11741         Likewise.
11742
11743 2008-07-23  Ian Lance Taylor  <iant@google.com>
11744
11745         PR 6658
11746         * object.h (Merged_symbol_value::value): Do our best to handle a
11747         negative addend.
11748
11749         PR 6647
11750         * script.cc (Version_script_info::get_versions): Don't add empty
11751         version tag to return value.
11752         (Version_script_info::get_symbol_version_helper): Change return
11753         type to bool.  Add pversion parameter.  Change all callers.
11754         (script_register_vers_node): Don't require a non-NULL tag.
11755         * script.h (class Version_script_info): Update declarations.
11756         (Version_script_info::get_symbol_version): Change return type to
11757         bool.  Add version parameter.  Change all callers.
11758         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11759         handling.  Handle an empty version from a version script.
11760         (Symbol_table::define_special_symbol): Likewise.
11761         * testsuite/ver_test_10.script: New file.
11762         * testsuite/ver_test_10.sh: New file.
11763         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11764         (check_DATA): Add ver_test_10.syms.
11765         (ver_test_10.syms, ver_test_10.so): New target.
11766         * testsuite/Makefile.in: Rebuild.
11767
11768 2008-07-23  Simon Baldwin  <simonb@google.com>
11769
11770         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11771         to zero for undefined symbols from dynamic libraries.
11772
11773 2008-07-23  Ian Lance Taylor  <iant@google.com>
11774
11775         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11776         Change all callers.
11777         * symtab.h (class Symbol_table): Update declaration.
11778         * testsuite/ver_test_9.cc: New file.
11779         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11780         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11781         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11782         (ver_test_9.so, ver_test_9.o): New targets.
11783         * testsuite/Makefile.in: Rebuild.
11784
11785 2008-07-22  Ian Lance Taylor  <iant@google.com>
11786
11787         * options.h (class General_options): Define --check-sections.
11788         * layout.cc (Layout::set_segment_offsets): Handle
11789         --check-sections.
11790
11791         * options.h (class General_options): Define -n/--nmagic and
11792         -N/--omagic.
11793         * options.cc (General_options::finalize): For -n/--nmagic or
11794         -N/--omagic, set -static.
11795         * layout.cc (Layout::attach_allocated_section_to_segment): If
11796         -N/--omagic, don't put read-only and read-write sections in
11797         different segments.
11798         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11799         finding a read-only segment.
11800         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11801         don't set the minimum segment alignment to the common page size,
11802         and don't set the file offset to the address modulo the page size.
11803         * script-sections.cc (Script_sections::create_segments): If
11804         -n/--omagic, don't put read-only and read-write sections in
11805         different segments.
11806
11807         * cref.cc: New file.
11808         * cref.h: New file.
11809         * options.h (class General_options): Add --print-symbol-counts.
11810         * main.cc (main): Issue defined symbol report if requested.
11811         * archive.cc (Archive::interpret_header): Make into a const member
11812         function.
11813         (Archive::add_symbols): Call Input_objects::archive_start and
11814         archive_stop.
11815         (Archive::const_iterator): Define new class.
11816         (Archive::begin, Archive::end): New functions.
11817         (Archive::include_all_members): Rewrite to use iterator.
11818         (Archive::count_members): New function.
11819         * archive.h (class Archive): Update declarations.
11820         (Archive::filename): New function.
11821         * object.cc: Include "cref.h".
11822         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11823         (Sized_relobj::do_get_global_symbol_counts): New function.
11824         (Input_objects::add_object): Add object to cross-referencer.
11825         (Input_objects::archive_start): New function.
11826         (Input_objects::archive_stop): New function.
11827         (Input_objects::print_symbol_counts): New function.
11828         * object.h: Declare Cref and Archive.
11829         (Object::get_global_symbol_counts): New function.
11830         (Object::do_get_global_symbol_counts): New pure virtual function.
11831         (class Sized_relobj): Add defined_count_ field.  Update
11832         declarations.
11833         (class Input_objects): Add cref_ field.  Update constructor.
11834         Update declarations.
11835         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11836         defined_count_.
11837         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11838         symbol counts.
11839         (Sized_dynobj::do_get_global_symbol_counts): New function.
11840         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11841         defined_count_.  Update declarations.  Define Symbols typedef.
11842         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11843         parameter.  Change all callers.
11844         (Symbol_table::add_from_dynobj): Add sympointers and defined
11845         parameters.  Change all callers.
11846         * symtab.h (class Symbol_table): Update declarations.
11847         * Makefile.am (CCFILES): Add cref.cc.
11848         (HFILES): Add cref.h.
11849         * Makefile.in: Rebuild.
11850
11851 2008-07-22  Simon Baldwin  <simonb@google.com>
11852
11853         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11854         to zero when writing undefined symbols.
11855
11856 2008-07-22  Ian Lance Taylor  <iant@google.com>
11857
11858         * output.cc (Output_section::add_input_section): Don't try to
11859         merge empty merge sections.
11860
11861 2008-07-21  Craig Silverstein  <csilvers@google.com>
11862
11863         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11864         Include symbol version in error message.
11865
11866 2008-07-20  Chris Demetriou  <cgd@google.com>
11867
11868         * configure.ac (gold_cv_c_random_seed): New configured variable.
11869         (RANDOM_SEED_CFLAGS): New substituted variable.
11870         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11871         * configure: Rebuild.
11872         * Makefile.in: Likewise.
11873         * testsuite/Makefile.in: Likewise.
11874
11875 2008-07-18  Ian Lance Taylor  <iant@google.com>
11876
11877         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11878         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11879         * testsuite/ver_test_main.cc (main): Call t4.
11880         (t4, t4_2a): Define.
11881         * testsuite/ver_test_2.cc (t4_2): Define.
11882         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11883         * testsuite/ver_test_4.cc (t4_2a): Define.
11884         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11885         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11886
11887 2008-07-17  Ian Lance Taylor  <iant@google.com>
11888
11889         * dynobj.cc (Versions::add_def): If we give an error about a
11890         missing version, go ahead and create the version anyhow.
11891
11892 2008-07-10  Ian Lance Taylor  <iant@google.com>
11893
11894         Handle output sections with more than 0x7fffffff bytes.
11895         * object.h (class Relobj): Change map_to_output_ to
11896         output_sections_, and just keep a section pointer.  Change all
11897         uses.  Move comdat group support to Sized_relobj.
11898         (Relobj::is_section_specially_mapped): Remove.
11899         (Relobj::output_section): Remove poff parameter.  Change all
11900         callers.
11901         (Relobj::output_section_offset): New function.
11902         (Relobj::set_section_offset): Rewrite.
11903         (Relobj::map_to_output): Remove.
11904         (Relobj::output_sections): New function.
11905         (Relobj::do_output_section_offset): New pure virtual function.
11906         (Relobj::do_set_section_offset): Likewise.
11907         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11908         group support from Relobj.  Update declarations.
11909         (Sized_relobj::get_output_section_offset): New function.
11910         (Sized_relobj::do_output_section_offset): New function.
11911         (Sized_relobj::do_set_section_offset): New function.
11912         * object.cc (Relobj::output_section_address): Remove.
11913         (Sized_relobj::Sized_relobj): Initialize new fields.
11914         (Sized_relobj::include_section_group): Cast find_kept_object to
11915         Sized_relobj.
11916         (Sized_relobj::include_linkonce_section): Likewise.
11917         (Sized_relobj::do_layout): Use separate arrays for output section
11918         and output offset.
11919         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11920         output_sections.
11921         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11922         output_sections and section_offsets.
11923         (Sized_relobj::write_local_symbols): Likewise.
11924         (map_to_kept_section): Compute output address directly.
11925         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11926         output_sections and section_offsets.
11927         (Sized_relobj::write_sections): Likewise.
11928         (Sized_relobj::relocate_sections): Likewise.
11929         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11930         * output.h (class Output_reloc): Update declarations.  Change
11931         u2_.relobj to Sized_relobj*.
11932         (class Output_data_reloc): Change add functions to use
11933         Sized_relobj*.
11934         * output.cc (Output_reloc::Output_reloc): Change relobj to
11935         Sized_relobj*.
11936         (Output_reloc::local_section_offset): Change return type to
11937         Elf_Addr.  Use get_output_section_offset.
11938         (Output_reloc::get_address): Likewise.
11939         (Output_section::is_input_address_mapped): Don't call
11940         is_section_specially_mapped.
11941         (Output_section::output_offset): Likewise.
11942         (Output_section::output_address): Likewise.
11943         (Output_section::starting_output_address): Likewise.
11944         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11945         parameter to Sized_relobj*.
11946         (Copy_relocs::need_copy_reloc): Likewise.
11947         (Copy_relocs::save): Likewise.
11948         * copy-relocs.h (class Copy_relocs): Update declarations.
11949         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11950         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11951         * target-reloc.h (relocate_for_relocatable): Change
11952         offset_in_output_section type to Elf_Addr.  Change code that uses
11953         it as well.
11954         * layout.cc (Layout::layout): Always set *off.
11955         * mapfile.cc (Mapfile::print_input_section): Use
11956         output_section_offset.
11957         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11958         Sized_relobj*.
11959         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11960         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11961         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11962
11963 2008-07-03  Ian Lance Taylor  <iant@google.com>
11964
11965         * layout.cc (Layout::include_section): Do not discard unrecognized
11966         SHT_STRTAB sections.
11967
11968 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11969
11970         * script.cc (Lex::can_continue_name): Make '?' allowable in
11971         version-script names.
11972         * testsuite/version_script.map: Change glob pattern to use '?'
11973
11974 2008-06-30  Manish Singh  <yosh@gimp.org>
11975
11976         PR 6585
11977         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11978         Correct typo.
11979
11980 2008-06-30  Ian Lance Taylor  <iant@google.com>
11981
11982         PR 6660
11983         PR 6682
11984         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11985         versions]: Don't try to read the value in the contents, since we
11986         don't use it.  Use the template endianness when writing.
11987
11988 2008-06-25  Cary Coutant  <ccoutant@google.com>
11989
11990         * fileread.cc (File_read::make_view): Assert on zero-length view.
11991         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11992         symbol table when there are no symbols to read.
11993
11994 2008-06-23  Craig Silverstein  <csilvers@google.com>
11995
11996         * version.cc (version_string): Bump to 1.7
11997
11998 2008-06-18  Craig Silverstein  <csilvers@google.com>
11999
12000         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12001         constant 0xFFFF to type Valtype.
12002         (Powerpc_relocate_functions::rel16_ha): Likewise.
12003
12004 2008-06-17  Ian Lance Taylor  <iant@google.com>
12005
12006         * output.h (Output_section::Input_section): Initialize p2align_ to
12007         zero for Output_section_data constructors.
12008         (Output_section::Input_section::addralign): If not an input
12009         section, return the alignment of the Output_section_data.
12010         * testsuite/copy_test.cc: New file.
12011         * testsuite/copy_test_1.cc: New file.
12012         * testsuite/copy_test_2.cc: New file.
12013         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12014         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12015         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12016         (copy_test_1_pic.o, copy_test_1.so): New targets.
12017         (copy_test_2_pic.o, copy_test_2.so): New targets.
12018         * testsuite/Makefile.in: Rebuild.
12019
12020         * script-sections.cc (Script_sections::place_orphan): Initialize
12021         local variable exact.
12022
12023 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12024
12025         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12026
12027 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12028             David S. Miller  <davem@davemloft.net>
12029
12030         * powerpc.cc: New file.
12031         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12032         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12033         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12034         * Makefile.in: Rebuild.
12035
12036 2008-06-09  Ian Lance Taylor  <iant@google.com>
12037
12038         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12039         <exception>.
12040         (throwing, orig_terminate): New static variables.
12041         (terminate_handler): New static function.
12042         (t2): Set terminate handler.
12043
12044 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12045
12046         PR 6584
12047         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12048         alignment.
12049
12050 2008-05-30  Cary Coutant  <ccoutant@google.com>
12051
12052         * archive.cc (Archive::include_all_members) Correct to step
12053         over symbol table and extended name table in thin archives.
12054
12055 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12056
12057         PR 6407
12058         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12059         calculation.
12060
12061 2008-05-28  Caleb Howe  <cshowe@google.com>
12062
12063         * reduced_debug_output.cc: New file.
12064         * reduced_debug_output.h: New file.
12065         * options.h (class General_options): Add --strip-debug-non-line.
12066         * options.cc (General_options::finalize): Add strip_debug_non_line
12067         to the strip heirarchy.
12068         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12069         fields.
12070         * layout.cc: Include "reduced_debug_output.h".
12071         (Layout::Layout): Initialize new fields.
12072         (line_only_debug_sections): New static array.
12073         (is_lines_only_debug_sections): New static inline function.
12074         (Layout::include_section): Handle --strip-debug-non-line.
12075         (Layout::make_output_section): If --strip-debug-non-line, build
12076         new output sections for .debug_abbrev and .debug_info.
12077         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12078         gold.  Warn about possible overflow.
12079         (read_signed_LEB_128): Likewise.
12080         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12081         (read_signed_LEB_128): Declare.
12082         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12083         (HFILES): Add reduced_debug_output.h.
12084         * Makefile.in: Rebuild.
12085
12086 2008-05-21  Ian Lance Taylor  <iant@google.com>
12087
12088         * mapfile.cc: New file.
12089         * mapfile.h: New file.
12090         * options.h (class General_options): Add -M/--print-map and -Map.
12091         * options.cc (General_options::finalize): Make -M equivalent to
12092         -Map -.
12093         * main.cc: Include <cstdio> and "mapfile.h".
12094         (main): Open mapfile if requested.
12095         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12096         constructor.  Change caller.
12097         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12098         (queue_middle_tasks): Likewise.
12099         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12100         declarations.
12101         * archive.cc: Include "mapfile.h".
12102         (Archive::add_symbols): Add mapfile parameter.  Change all
12103         callers.  Pass mapfile, symbol, and reason to include_member.
12104         (Archive::include_all_members): Add mapfile parameter.  Change all
12105         callers.
12106         (Archive::include_member): Add mapfile, sym, and why parameters.
12107         Change all callers.  Report inclusion to map file.
12108         * archive.h: Include "fileread.h".
12109         (class Archive): Update declarations.
12110         (Archive::file): New const method.
12111         (class Add_archive_symbols): Add mapfile_ field.  Update
12112         constructor.  Change all callers.
12113         * readsyms.h (class Read_symbols): Likewise.
12114         (class Finish_group): Likewise.
12115         (class Read_script): Likewise.
12116         * common.cc: Include "mapfile.h".
12117         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12118         all callers.
12119         (Symbol_table::do_allocate_commons): Likewise.
12120         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12121         symbol allocation to mapfile.
12122         * common.h (class Allocate_commons_task): Add mapfile_ field.
12123         Update constructor.  Change all callers.
12124         * symtab.h (class Symbol_table): Update declarations.
12125         * layout.cc: Include "mapfile.h".
12126         (Layout_task_runner::run): Print information to mapfile.
12127         (Layout::create_gold_note): Change Output_data_fixed_space to
12128         Output_data_zero_fill.
12129         (Layout::create_build_id): Likewise.
12130         (Layout::print_to_mapfile): New function.
12131         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12132         constructor.  Change caller.
12133         (class Layout): Declare print_to_mapfile.
12134         * output.cc (Output_section::Input_section::print_to_mapfile): New
12135         function.
12136         (Output_section::add_input_section): If producing a map, always
12137         add to input_sections_ list.
12138         (Output_section::do_print_to_mapfile): New function.
12139         (Output_segment::print_sections_to_mapfile): New function.
12140         (Output_segment::print_section_list_to_mapfile): New function.
12141         * output.h: Include "mapfile.h".
12142         (Output_data::print_to_mapfile): New function.
12143         (Output_data::do_print_to_mapfile): New virtual function.
12144         (Output_segment_headers::do_print_to_mapfile): New function.
12145         (Output_file_header::do_print_to_mapfile): New function.
12146         (Output_data_const::do_print_to_mapfile): New function.
12147         (class Output_data_const_buffer): Add map_name_ field.  Update
12148         constructor.  Change all callers.  Add do_print_to_mapfile
12149         function.
12150         (class Output_data_fixed_space): Likewise.
12151         (class Output_data_space): Likewise.
12152         (class Output_data_zero_fill): New class.
12153         (Output_data_strtab::do_print_to_mapfile): New function.
12154         (Output_data_reloc_base::do_print_to_mapfile): New function.
12155         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12156         (Output_data_group::do_print_to_mapfile): New function.
12157         (Output_data_got::do_print_to_mapfile): New function.
12158         (Output_data_dynamic::do_print_to_mapfile): New function.
12159         (Output_symtab_xindex::do_print_to_mapfile): New function.
12160         (class Output_section): Declare do_print_to_mapflie.  Declare
12161         print_to_mapfile in Input_section.
12162         (class Output_segment): Declare new functions.
12163         * object.h (Sized_relobj::symbol_count): New function.
12164         * script-sections.cc
12165         (Output_section_element_dot_assignment::set_section_addresses):
12166         Change Output_data_fixed_space to Output_data_zero_fill.
12167         (Output_data_expression::do_print_to_mapfile): New function.
12168         * script.cc (read_input_script): Add mapfile parameter.  Change
12169         all callers.
12170         * script.h (read_input_script): Update declaration.
12171         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12172         (Eh_frame::do_print_to_mapfile): New function.
12173         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12174         (Output_merge_string::do_print_to_mapfile): New function.
12175         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12176         function.
12177         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12178         function.
12179         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12180         function.
12181         * Makefile.am (CCFILES): Add mapfile.cc.
12182         (HFILES): Add mapfile.h.
12183         * Makefile.in: Rebuild.
12184
12185 2008-05-19  Ian Lance Taylor  <iant@google.com>
12186
12187         * options.h (class General_options): Add -z relro.
12188         * layout.cc (Layout::Layout): Initialize relro_segment_.
12189         (Layout::add_output_section_data): Return the output section.
12190         (Layout::make_output_section): Rcognize relro sections and mark
12191         them appropriately.
12192         (Layout::attach_allocated_section_to_segment): Put relro sections
12193         in a PT_GNU_RELRO segment.
12194         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12195         section as relro.
12196         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12197         PT_TLS segments.
12198         (Layout::linkonce_mapping): Map d.rel.ro.local to
12199         .data.rel.ro.local.
12200         (Layout::output_section_name): Us .data.rel.ro.local for any
12201         section which begins with that.
12202         * layout.h (class Layout): Update add_output_section_data
12203         declaration.  Add relro_segment_ field.
12204         * output.cc (Output_section::Output_section): Initialize is_relro_
12205         and is_relro_local_ fields.
12206         (Output_segment::add_output_section): Group relro sections.
12207         (Output_segment::is_first_section_relro): New function.
12208         (Output_segment::maximum_alignment): If there is a relro section,
12209         align the segment to the common page size.
12210         (Output_segment::set_section_addresses): Track whether we are
12211         looking at relro sections.  If the last section is a relro
12212         section, align to the common page size.
12213         (Output_segment::set_section_list_addresses): Add in_relro
12214         parameter.  Change all callers.  Align to the page size when
12215         moving from relro to non-relro section.
12216         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12217         segment.
12218         * output.h (class Output_section): Add is_relro_ and
12219         is_relro_local_ fields.
12220         (Output_section::is_relro): New function.
12221         (Output_section::set_is_relro): New function.
12222         (Output_section::is_relro_local): New function.
12223         (Output_section::set_is_relro_local): New function.
12224         (class Output_segment): Update declarations.
12225         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12226         * sparc.cc (Target_sparc::got_section): Likewise.
12227         * x86_64.cc (Target_x86_64::got_section): Likewise.
12228         * testsuite/relro_test_main.cc: New file.
12229         * testsuite/relro_test.cc: New file.
12230         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12231         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12232         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12233         (relro_test.so, relro_test_pic.o): New targets.
12234         * testsuite/Makefile.in: Rebuild.
12235
12236 2008-05-16  Ian Lance Taylor  <iant@google.com>
12237
12238         * output.cc (Output_segment::add_output_section): Remove front
12239         parameter.
12240         * output.h (class Output_segment): Remove
12241         add_initial_output_section and overloaded add_output_section.
12242         Update declaration of remaining add_output_section.
12243         * layout.cc (Layout::create_interp): Call add_output_section
12244         rather than add_initial_output_section.
12245         (Layout::finish_dynamic_section): Likewise.
12246
12247         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12248         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12249         know the dynamic type.
12250         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12251         field.  Initialize it in constructor.
12252         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12253         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12254         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12255         reloc.
12256
12257         * output.cc (Output_reloc::get_address): Change return type to
12258         Elf_Addr.
12259         * output.h (class Output_reloc): Update get_address declaration.
12260         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12261         for section addresses.
12262
12263 2008-05-09  Ian Lance Taylor  <iant@google.com>
12264
12265         PR 6493
12266         * gold.cc (gold_nomem): Use return value of write.
12267
12268 2008-05-08  Ian Lance Taylor  <iant@google.com>
12269
12270         * symtab.c (Symbol::init_base_output_data): Add version
12271         parameter.  Change all callers.
12272         (Symbol::init_base_output_segment): Likewise.
12273         (Symbol::init_base_constant): Likewise.
12274         (Symbol::init_base_undefined): Likewise.
12275         (Sized_symbol::init_output_data): Likewise.
12276         (Sized_symbol::init_output_segment): Likewise.
12277         (Sized_symbol::init_constant): Likewise.
12278         (Sized_symbol::init_undefined): Likewise.
12279         (Symbol_table::do_define_in_output_data): If the new symbol has a
12280         version, mark it as the default.
12281         (Symbol_table::do_define_in_output_segment): Likewise.
12282         (Symbol_table::do_define_as_constant): Likewise.
12283         * symtab.h (class Symbol): Update declarations.
12284         (class Sized_symbol): Likewise.
12285         * resolve.cc (Symbol::override_version): New function.
12286         (Symbol::override_base): Call override_version.
12287         (Symbol::override_base_with_special): Likewise.
12288         * testsuite/ver_script_8.script: New file.
12289         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12290         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12291         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12292         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12293
12294 2008-05-06  Ian Lance Taylor  <iant@google.com>
12295
12296         PR 6049
12297         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12298         functions.
12299         (class General_options): Remove existing --undefined, and add
12300         --no-undefined instead.  Add new --undefined as synonym for -u.
12301         * archive.cc (Archive::add_symbols): Check whether symbol was
12302         named with -u.
12303         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12304         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12305         all uses.  Add IS_UNDEFINED.  Update declarations to split
12306         different versions of init_base.  Declare init_base_undefined.
12307         (Symbol::is_defined): Handle IS_UNDEFINED.
12308         (Symbol::is_undefined): Likewise.
12309         (Symbol::is_weak_undefined): Call is_undefined.
12310         (Symbol::is_absolute): Handle IS_CONSTANT.
12311         (class Sized_symbol): Update declarations to split different
12312         versions of init.  Declare init_undefined.
12313         (class Symbol_table): Declare new functions.
12314         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12315         Change all callers.
12316         (Symbol::init_base_output_data): Likewise.
12317         (Symbol::init_base_output_segment): Likewise.
12318         (Symbol::init_base_constant): Likewise.
12319         (Symbol::init_base_undefined): New function.
12320         (Sized_symbol::init_object): Rename from init.  Change all
12321         callers.
12322         (Sized_symbol::init_output_data): Likewise.
12323         (Sized_symbol::init_output_segment): Likewise.
12324         (Sized_symbol::init_constant): Likewise.
12325         (Sized_symbol::init_undefined): New function.
12326         (Symbol_table::add_undefined_symbols_from_command_line): New
12327         function.
12328         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12329         function.
12330         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12331         (Symbol::output_section): Likewise.
12332         (Symbol::set_output_section): Likewise.
12333         (Symbol_table::sized_finalize_symbol): Likewise.
12334         (Symbol_table::sized_write_globals): Likewise.
12335         * resolve.cc (Symbol_table::should_override): Likewise.
12336         (Symbol::override_base_with_special): Likewise.
12337
12338         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12339         symbol, change it to have default visibility.
12340         * testsuite/protected_1.cc: New file.
12341         * testsuite/protected_2.cc: New file.
12342         * testsuite/protected_3.cc: New file.
12343         * testsuite/protected_main_1.cc: New file.
12344         * testsuite/protected_main_2.cc: New file.
12345         * testsuite/protected_main_3.cc: New file.
12346         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12347         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12348         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12349         (protected_1.so): New target.
12350         (protected_1_pic.o, protected_2_pic.o): New targets.
12351         (protected_3_pic.o): New target.
12352         (check_PROGRAMS): Add protected_2.
12353         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12354         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12355         * testsuite/Makefile.in: Rebuild.
12356
12357         * options.h (DEFINE_var): Add set_user_set_##varname__.
12358         (DEFINE_bool_alias): New macro.
12359         (class General_options): Define -Bstatic using DEFINE_bool_alias
12360         rather than DEFINE_special.  Add --undefined as an alias for -z
12361         defs.
12362         * options.cc (General_options::parse_Bstatic): Remove.
12363
12364         * options.h (class General_options): Add --fatal-warnings.
12365         * main.cc (main): Implement --fatal-warnings.
12366         * errors.h (Errors::warning_count): New function.
12367
12368         * options.h (class General_options): Add -Bsymbolic-functions.
12369         * symtab.h (Symbol::is_preemptible): Check for
12370         -Bsymbolic-functions.
12371
12372 2008-05-05  Ian Lance Taylor  <iant@google.com>
12373
12374         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12375         as noVARNAME rather than no-VARNAME.
12376         (class General_options): Add option -z combreloc.
12377         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12378         get_address.
12379         (Output_reloc::sort_before) [SHT_REL]: New function.
12380         (Output_reloc::sort_before) [SHT_RELA]: New function.
12381         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12382         Sort_relocs_comparison.
12383         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12384         parameter.  Change all callers.
12385         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12386         sort_relocs parameter.  Change all callers.
12387         * output.cc (Output_reloc::get_address): New function, broken out
12388         of write_rel.
12389         (Output_reloc::write_rel): Call it.
12390         (Output_reloc::compare): New function.
12391         (Output_data_reloc_base::do_write): Optionally sort relocs.
12392
12393         * configure.ac: If targ_extra_obj is set, link it in.
12394         * configure.tgt: Initialize all variables.
12395         (x86_64*): Set targ_extra_obj and targ_extra_size.
12396         * configure: Rebuild.
12397
12398         * object.cc (Sized_relobj::include_section_group): Adjust section
12399         indexes read from group data.  Build vector to pass to
12400         layout_group.
12401         * layout.cc (Layout::layout_group): Add flags and shndxes
12402         parameters.  Remove contents parameter.  Change caller.  Update
12403         explicit instantiations.
12404         * layout.h (class Layout): Update layout_group declaration.
12405         * output.cc (Output_data_group::Output_data_group): Add flags and
12406         input_shndxes parameters.  Remove contents parameter.  Change
12407         caller.
12408         (Output_data_group::do_write): Change input_sections_ to
12409         input_shndxes_.
12410         * output.h (class Output_data_group): Update constructor
12411         declaration.  Rename input_sections_ to input_shndxes_.
12412         * testsuite/many_sections_test.cc: Add template.
12413
12414 2008-04-30  Cary Coutant  <ccoutant@google.com>
12415
12416         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12417
12418         * layout.cc (Layout::include_section): Refactored check for debug
12419         info section.
12420         (Layout::add_comdat): Add new parameters.  Change type
12421         of signature parameter.  Add object and shndx to signatures table.
12422         (Layout::find_kept_object): New function.
12423         * layout.h: Include <cstring>.
12424         (Layout::is_debug_info_section): New function.
12425         (Layout::add_comdat): Add new parameters.
12426         (Layout::find_kept_object): New function.
12427         (Layout::Kept_section): New struct.
12428         (Layout::Signatures): Change type of map range.
12429         * object.cc (Relobj::output_section_address): New function.
12430         (Sized_relobj::include_section_group): Add new parameters.  Change
12431         calls to Layout::add_comdat.  Change to build table of kept comdat
12432         groups and table mapping discarded sections to kept sections.
12433         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12434         (Sized_relobj::do_layout): Change calls to include_section_group and
12435         include_linkonce_section.
12436         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12437         value to zero when section is discarded.
12438         (Sized_relobj::map_to_kept_section): New function.
12439         * object.h (Relobj::output_section_address): New function.
12440         (Relobj::Comdat_group): New type.
12441         (Relobj::find_comdat_group): New function.
12442         (Relobj::Comdat_group_table): New type.
12443         (Relobj::Kept_comdat_section): New type.
12444         (Relobj::Kept_comdat_section_table): New type.
12445         (Relobj::add_comdat_group): New function.
12446         (Relobj::set_kept_comdat_section): New function.
12447         (Relobj::get_kept_comdat_section): New function.
12448         (Relobj::comdat_groups_): New field.
12449         (Relobj::kept_comdat_sections_): New field.
12450         (Symbol_value::input_value): Update comment.
12451         (Sized_relobj::map_to_kept_section) New function.
12452         (Sized_relobj::include_linkonce_section): Add new parameter.
12453         * target-reloc.h (Comdat_behavior): New type.
12454         (get_comdat_behavior): New function.
12455         (relocate_section): Add code to map a discarded section to the
12456         corresponding kept section when applying a relocation.
12457
12458 2008-04-30  Craig Silverstein  <csilvers@google.com>
12459
12460         * dwarf_reader.cc (next_generation_count): New static var.
12461         (Addr2line_cache_entry): New struct.
12462         (addr2line_cache): New static var.
12463         (Dwarf_line_info::one_addr2line): Added caching.
12464         (Dwarf_line_info::clear_addr2line_cache): New function.
12465         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12466         cache-size parameter.
12467         (Dwarf_line_info::one_addr2line_cache): New function.
12468         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12469         new cache-size argument to one_addr2line(), and clear cache.
12470
12471 2008-04-28  Cary Coutant  <ccoutant@google.com>
12472
12473         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12474         R_386_PC8 relocations.
12475
12476 2008-04-23  Ian Lance Taylor  <iant@google.com>
12477
12478         * object.cc (Sized_relobj::include_section_group): Check for
12479         invalid section group.
12480
12481         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12482         header size.
12483
12484         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12485         than read for file header.
12486         * archive.cc (Archive::include_member): Likewise.
12487
12488 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12489
12490         * aclocal.m4: Regenerate.
12491         * configure: Regenerate.
12492
12493 2008-04-19  Ian Lance Taylor  <iant@google.com>
12494
12495         * version.cc (version_string): Bump to 1.6.
12496
12497         * testsuite/Makefile.am (many_sections_r_test): New target.
12498         (many_sections_r_test_SOURCES): Remove.
12499         (many_sections_r_test_DEPENDENCIES): Remove.
12500         (many_sections_r_test_LDFLAGS): Remove.
12501         (many_sections_r_test_LDADD): Remove.
12502
12503         * object.cc (Sized_relobj::do_add_symbols): Always pass
12504         local_symbol_count_ to add_from_relobj.
12505
12506         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12507         every thousand variables.
12508         * testsuite/Makefile.in: Rebuild.
12509
12510         * object.cc (Xindex::initialize_symtab_xindex): New function.
12511         (Xindex::read_symtab_xindex): New function.
12512         (Xindex::sym_xindex_to_shndx): New function.
12513         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12514         available.
12515         (Sized_relobj::do_initialize_xindex): New function.
12516         (Sized_relobj::do_read_symbols): Adjust section links.
12517         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12518         parameter.  Change all callers.
12519         (Sized_relobj::include_section_group): Adjust section links and
12520         symbol section indexes.
12521         (Sized_relobj::do_layout): Adjust section links.
12522         (Sized_relobj::do_count_local_symbols): Adjust section links and
12523         symbol section indexes.
12524         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12525         ordinary and special symbols.
12526         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12527         dynsym_xindex parameters.  Change all callers.  Adjust section
12528         links.  Use SHN_XINDEX when needed.
12529         (Sized_relobj::get_symbol_location_info): Adjust section links.
12530         Don't get fooled by special symbols.
12531         * object.h (class Xindex): Define.
12532         (class Object): Add xindex_ parameter.  Declare virtual functoin
12533         do_initialize_xindex.
12534         (Object::adjust_sym_shndx): New function.
12535         (Object::set_xindex): New protected function.
12536         (class Symbol_value): Add is_ordinary_shndx_ field.
12537         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12538         (Symbol_value::value): Assert ordinary section.
12539         (Symbol_value::initialize_input_to_output_map): Likewise.
12540         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12541         Change all callers.
12542         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12543         all callers.
12544         (class Sized_relobj): Update declarations.
12545         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12546         parameter.  Change all callers.
12547         (Sized_relobj::adjust_shndx): New function.
12548         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12549         field.
12550         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12551         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12552         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12553         (Sized_dynobj::read_dynsym_section): Adjust section links.
12554         (Sized_dynobj::read_dynamic): Likewise.
12555         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12556         section links.
12557         (Sized_dynobj::do_initialize_xindex): New function.
12558         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12559         do_initialize_xindex.
12560         (Sized_dynobj::adjust_shndx): New function.
12561         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12562         dynsym_xindex_ fields.
12563         (Layout::finalize): Add a call to set_section_indexes before
12564         creating the symtab sections.
12565         (Layout::set_section_indexes): Don't do anything if the section
12566         already has a section index.
12567         (Layout::create_symtab_sections): Add shnum parameter.  Change
12568         caller.  Create .symtab_shndx section if needed.
12569         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12570         caller.
12571         (Layout::allocated_output_section_count): New function.
12572         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12573         needed.
12574         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12575         fields.  Update declarations.
12576         (Layout::symtab_xindex): New function.
12577         (Layout::dynsym_xindex): New function.
12578         (class Write_symbols_task): Add layout_ field.
12579         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12580         Change caller.
12581         * output.cc (Output_section_headers::Output_section_headers): Add
12582         shstrtab_section parameter.  Change all callers.
12583         (Output_section_headers::do_sized_write): Store overflow values
12584         for section count and section string table section index in
12585         section header zero.
12586         (Output_file_header::do_sized_write): Check for overflow of
12587         section count and section string table section index.
12588         (Output_symtab_xindex::do_write): New function.
12589         (Output_symtab_xindex::endian_do_write): New function.
12590         * output.h (class Output_section_headers): Add shstrtab_section_.
12591         Update declarations.
12592         (class Output_symtab_xindex): Define.
12593         (Output_section::has_out_shndx): New function.
12594         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12595         field.
12596         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12597         Change all callers.
12598         (Sized_symbol::init): Likewise.
12599         (Symbol::output_section): Check for ordinary symbol.
12600         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12601         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12602         callers.
12603         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12604         Change all callers.  Simplify handling of symbols from sections
12605         not included in the link.
12606         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12607         distinction.
12608         (Weak_alias_sorter::operator()): Assert that symbols are
12609         ordinary.
12610         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12611         distinction.
12612         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12613         parameters.  Change all callers.
12614         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12615         symbol distinction.  Use SHN_XINDEX when needed.
12616         (Symbol_table::write_section_symbol): Add symtab_xindex
12617         parameter.  Change all callers.
12618         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12619         SHN_XINDEX when needed.
12620         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12621         declarations.
12622         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12623         (Symbol::is_defined): Check is_ordinary.
12624         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12625         (Symbol::is_absolute, Symbol::is_common): Likewise.
12626         (class Sized_symbol): Update declarations.
12627         (class Symbol_table): Update declarations.
12628         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12629         parameters.  Change all callers.
12630         (Sized_symbol::override): Likewise.
12631         (Symbol_table::override): Likewise.
12632         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12633         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12634         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12635         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12636         to be in an ordinary section.
12637         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12638         object and is_ordinary parameters.  Change all callers.
12639         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12640         Change all callers.  Don't add undefined or non-ordinary symbols
12641         to reloc_map_.
12642         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12643         Change all callers.
12644         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12645         declarations.
12646         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12647         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12648         (Sized_relobj::relocate_sections): Likewise.
12649         * target-reloc.h (scan_relocs): Adjust section symbol index.
12650         (scan_relocatable_relocs): Likewise.
12651         * i386.cc (Scan::local): Check for ordinary symbols.
12652         * sparc.cc (Scan::local): Likewise.
12653         * x86_64.cc (Scan::local): Likewise.
12654         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12655         to symbol_section_and_value.
12656         * testsuite/many_sections_test.cc: New file.
12657         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12658         (check_PROGRAMS): Add many_sections_test.
12659         (many_sections_test_SOURCES): Define.
12660         (many_sections_test_DEPENDENCIES): Define.
12661         (many_sections_test_LDFLAGS): Define.
12662         (BUILT_SOURCES): Add many_sections_define.h.
12663         (many_sections_define.h): New target.
12664         (BUILT_SOURCES): Add many_sections_check.h.
12665         (many_sections_check.h): New target.
12666         (check_PROGRAMS): Add many_sections_r_test.
12667         (many_sections_r_test_SOURCES): Define.
12668         (many_sections_r_test_DEPENDENCIES): Define.
12669         (many_sections_r_test_LDFLAGS): Define.
12670         (many_sections_r_test_LDADD): Define.
12671         (many_sections_r_test.o): New target.
12672         * testsuite/Makefile.in: Rebuild.
12673
12674 2008-04-17  Cary Coutant  <ccoutant@google.com>
12675
12676         * errors.cc (Errors::info): New function.
12677         (gold_info): New function.
12678         * errors.h (Errors::info): New function.
12679         * gold.h (gold_info): New function.
12680         * object.cc (Input_objects::add_object): Print trace output.
12681         * options.cc (options::parse_set): New function.
12682         (General_options::parse_wrap): Deleted.
12683         (General_options::General_options): Deleted initializer.
12684         * options.h (options::String_set): New typedef.
12685         (options::parse_set): New function.
12686         (DEFINE_set): New macro.
12687         (General_options::wrap): Changed to use DEFINE_set. Changed
12688         callers of any_wrap_symbols and is_wrap_symbol.
12689         (General_options::trace, General_options::trace_symbol):
12690         New options.
12691         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12692         (General_options::wrap_symbols_): Deleted.
12693         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12694
12695 2008-04-17  David S. Miller  <davem@davemloft.net>
12696
12697         * options.cc (General_options::parse_V): New function.
12698         * options.h: Add entries for -V and -Qy.
12699
12700 2008-04-17  Ian Lance Taylor  <iant@google.com>
12701
12702         * common.cc (Symbol_table::allocate_commons): Remove options
12703         parameter.  Change caller.
12704         (Symbol_table::do_allocate_commons): Remove options parameter.
12705         Change caller.  Just call do_allocate_commons_list twice.
12706         (Symbol_table::do_allocate_commons_list): New function, broken out
12707         of do_allocate_commons.
12708         * common.h (class Allocate_commons_task): Remove options_ field.
12709         Update constructor.
12710         * symtab.cc (Symbol_table::Symbol_table): Initialize
12711         tls_commons_.
12712         (Symbol_table::add_from_object): Put TLS common symbols on
12713         tls_commons_ list.
12714         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12715         which are IN_OUTPUT_DATA.
12716         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12717         allocate_commons and do_allocate_commons declarations.  Declare
12718         do_allocate_commons_list.
12719         * gold.cc (queue_middle_tasks): Update creation of
12720         Allocate_commons_task to not pass options.
12721         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12722         (TLS_TEST_C_FLAGS): New variable.
12723         (tls_test_c_pic.o): New target.
12724         (tls_test_shared.so): Link in tls_test_c_pic.o.
12725         (tls_test_c_pic_ie.o): New target.
12726         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12727         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12728         (tls_test_c.o): New target.
12729         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12730         (tls_pic_test_LDADD): Likewise.
12731         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12732         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12733         (tls_test_c_gnu2.o): New target.
12734         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12735         tls_test_c_gnu2.o.
12736         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12737         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12738         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12739         * testsuite/tls_test.cc: Include "config.h".
12740         (t_last): Call t11_last.
12741         * testsuite/tls_test.h (t11, t11_last): Declare.
12742         * testsuite/tls_test_c.c: New file.
12743         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12744         * configure.ac: Check for OpenMP support.
12745         * configure, config.in, Makefile.in: Rebuild.
12746         * testsuite/Makefile.in: Rebuild.
12747
12748 2008-04-16  Cary Coutant  <ccoutant@google.com>
12749
12750         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12751         (Target_i386::tls_base_symbol_defined_): New field.
12752         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12753         (Target_i386::Scan::global): Likewise.
12754         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12755         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12756         (Target_x86_64::tls_base_symbol_defined_): New field.
12757         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12758         (Target_x86_64::Scan::global): Likewise.
12759
12760 2008-04-16  Cary Coutant  <ccoutant@google.com>
12761
12762         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12763         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12764         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12765         building shared libraries.
12766         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12767         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12768         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12769         * testsuite/Makefile.in: Rebuild.
12770         * testsuite/weak_undef.h: New file.
12771         * testsuite/weak_undef_file1.cc: Add extra test cases.
12772         * testsuite/weak_undef_file2.cc: Likewise.
12773         * testsuite/weak_undef_test.cc: Likewise.
12774
12775 2008-04-16  David S. Miller  <davem@davemloft.net>
12776
12777         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12778         Add issued_non_pic_error_ field.  Declare check_non_pic.
12779         (Target_sparc::Scan::check_non_pic): New function.
12780         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12781         (Target_sparc::Scan::global): Likewise.
12782
12783         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12784         * configure: Rebuild.
12785
12786         * options.h (DEFINE_enable): New macro.
12787         (new_dtags): New enable option.
12788         (initfirst, interpose, loadfltr, nodefaultlib,
12789         nodelete, nodlopen, nodump): New -z options.
12790         * layout.cc (Layout:finish_dynamic_section): If new
12791         dtags enabled, emit DT_RUNPATH.  Also, emit a
12792         DT_FLAGS_1 containing any specified -z flags.
12793
12794 2008-04-16  Ian Lance Taylor  <iant@google.com>
12795
12796         * copy-relocs.cc: New file.
12797         * copy-relocs.h: New file.
12798         * reloc.cc: Remove Copy_relocs code.
12799         * reloc.h: Likewise.
12800         * reloc-types.h (struct Reloc_types) [both versions]: Add
12801         get_reloc_addend_noerror.
12802         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12803         variants of add_global which take an addend which must be zero.
12804         * i386.cc: Include "copy-relocs.h".
12805         (class Target_i386): Change type of copy_relocs_ to variable,
12806         update initializer.
12807         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12808         Change all callers.
12809         (Target_i386::do_finalize_sections): Change handling of
12810         copy_relocs_.
12811         * sparc.cc: Include "copy-relocs.h".
12812         (class Target_sparc): Change type of copy_relocs_ to variable,
12813         update initializer.
12814         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12815         Change all callers.
12816         (Target_sparc::do_finalize_sections): Change handling of
12817         copy_relocs_.
12818         * x86_64.cc: Include "copy-relocs.h".
12819         (class Target_x86_64): Change type of copy_relocs_ to variable,
12820         update initializer.
12821         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12822         class.  Change all callers.
12823         (Target_x86_64::do_finalize_sections): Change handling of
12824         copy_relocs_.
12825         * Makefile.am (CCFILES): Add copy-relocs.cc.
12826         (HFILES): Add copy-relocs.h.
12827
12828         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12829
12830         * testsuite/script_test_4.sh: Permit leading zeroes.
12831
12832 2008-04-15  Ian Lance Taylor  <iant@google.com>
12833
12834         * script-sections.cc (Script_sections::create_segments): Use
12835         header_size_adjustment even when there is enough room for the
12836         headers.
12837         * testsuite/script_test_4.sh: New file.
12838         * testsuite/script_test_4.t: New file.
12839         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12840         (check_DATA): Add script_test_4.stdout.
12841         (MOSTLYCLEANFILES): Likewise.
12842         (script_test_4): New target.
12843         (script_test_4.stdout): New target.
12844         * testsuite/Makefile.in: Rebuild.
12845
12846         * sparc.cc: Add definitions for Output_data_plt_sparc class
12847         constants.
12848
12849 2008-04-14  David S. Miller  <davem@davemloft.net>
12850
12851         * sparc.cc: New file.
12852         * Makefile.am (TARGETSOURCES): Add sparc.cc
12853         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12854         * configure.tgt: Document targ_extra_size and
12855         targ_extra_big_endian.  Add entries for sparc-* and
12856         sparc64-*.
12857         * configure.ac: Handle targ_extra_size and
12858         targ_extra_big_endian.
12859         * Makefile.in: Rebuild.
12860         * configure: Likewise.
12861         * po/POTFILES.in: Likewise.
12862         * po/gold.pot: Likewise.
12863
12864 2008-04-14  Ian Lance Taylor  <iant@google.com>
12865
12866         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12867         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12868         in the name/type/flags to section mapping.  Don't call
12869         allocate_output_section.
12870         (Layout::choose_output_section): Change parameter from adjust_name
12871         to is_input_section.  Don't permit input sections after sections
12872         are attached to segments.  Don't call allocate_output_section.
12873         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12874         not write_enable_output_section.
12875         (Layout::make_output_section): Don't push to
12876         unattached_section_list_ nor call attach_to_segment.  Call
12877         attach_section_to_segment if sections are attached.
12878         (Layout::attach_sections_to_segments): New function.
12879         (Layout::attach_section_to_segment): New function.
12880         (Layout::attach_allocated_section_to_segment): Rename from
12881         attach_to_segment.  Remove flags parameter.
12882         (Layout::allocate_output_section): Remove function.
12883         (Layout::write_enable_output_section): Remove function.
12884         * layout.h (class Layout): Update for above changes.  Add new
12885         field sections_are_attached_.
12886         * output.h (Output_section::update_flags_for_input_section): New
12887         function.
12888         * output.cc (Output_section::add_input_section): Call
12889         update_flags_for_input_section.
12890         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12891
12892 2008-04-11  Cary Coutant  <ccoutant@google.com>
12893
12894         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12895         thought unnecessary.
12896         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12897
12898 2008-04-11  Ian Lance Taylor  <iant@google.com>
12899
12900         * output.h (class Output_section_data): Remove inline definition
12901         of set_addralign.
12902         * output.cc (Output_section_data::set_addralign): New function.
12903
12904 2008-04-11  Cary Coutant  <ccoutant@google.com>
12905
12906         Add support for TLS descriptors for i386 and x86_64.
12907         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12908         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12909         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12910         GOT_TYPE_TLS_DESC.
12911         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12912         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12913         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12914         relocations.
12915         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12916         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12917         Fix problem with initial-exec relocations.
12918         (Target_i386::Relocate::relocate_tls): Likewise.
12919         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12920         relaxation.
12921         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12922         support for section-plus-offset dynamic table entries.
12923         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12924         (Output_data_dynamic::Dynamic_entry): Add support for
12925         section-plus-offset dynamic table entries.
12926         (Output_data_dynamic::Classification): Likewise.
12927         (Output_data_dynamic::classification_): Renamed offset_.
12928         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12929         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12930         (Target_x86_64::make_plt_section): New function.
12931         (Target_x86_64::reserve_tlsdesc_entries): New function.
12932         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12933         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12934         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12935         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12936         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12937         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12938         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12939         add extra PLT entry for TLS descriptors.
12940         (Output_data_plt_x86_64::got_): New field.
12941         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12942         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12943         fields.
12944         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12945         descriptors.
12946         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12947         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12948         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12949         R_386_TLS_DESC_CALL relocations.
12950         (Target_x86_64::Scan::global): Likewise.
12951         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12952         for TLS descriptors.
12953         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12954         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12955         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12956         GD-to-IE relaxation.
12957         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12958         and TLS_DESCRIPTORS.
12959         * Makefile.in: Rebuild.
12960         * configure: Rebuild.
12961         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12962         (tls_test_shared2.so): New target.
12963         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12964         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12965         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12966         (tls_shared_gd_to_ie_test_LDADD): New variable.
12967         (tls_shared_gnu2_gd_to_ie_test): New target.
12968         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12969         New targets.
12970         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12971         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12972         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12973         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12974         (tls_shared_gnu2_test): New target.
12975         (tls_test_gnu2_shared.so): New target.
12976         (tls_shared_gnu2_test_SOURCES): New variable.
12977         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12978         (tls_shared_gnu2_test_LDFLAGS): New variable.
12979         (tls_shared_gnu2_test_LDADD): New variable.
12980         * testsuite/Makefile.in: Rebuild.
12981         * testsuite/Makefile.
12982
12983 2008-04-11  Ian Lance Taylor  <iant@google.com>
12984
12985         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12986         justsyms.t.
12987         * testsuite/Makefile.in: Rebuild.
12988
12989         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12990         long.
12991         * testsuite/script_test_2.cc (main): Adjust test.
12992
12993 2008-04-11  David S. Miller  <davem@davemloft.net>
12994             Ian Lance Taylor  <iant@google.com>
12995
12996         * options.h (General_options): Add entries for '-Y' and
12997         '-relax'.
12998         * options.cc (General_options:finalize): If -Y was used, add those
12999         entries to the library path instead of the default "/lib" and
13000         "/usr/lib".
13001
13002 2008-04-11  David S. Miller  <davem@davemloft.net>
13003
13004         * testsuite/justsyms.t: Start at 0x100.
13005         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13006         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13007         long.
13008         * testsuite/script_test_2.cc: Adjust string and section length
13009         checks.
13010
13011 2008-04-09  Ian Lance Taylor  <iant@google.com>
13012
13013         PR gold/5996
13014         * script-sections.cc (Sections_element::allocate_to_segment): Add
13015         orphan parameter.
13016         (Output_section_definition::allocate_to_segment): Likewise.
13017         (Orphan_output_section::allocate_to_segment): Likewise.
13018         (Script_sections::attach_sections_using_phdrs_clause): Don't
13019         propagate non-PT_LOAD segments to orphan sections.
13020         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13021         readelf rather than objdump.
13022         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13023         .interp section and PT_INTERP segment are the same size.
13024         * testsuite/Makefile.in: Rebuild.
13025
13026         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13027         aliases for symbols defined in the same object.
13028         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13029         (weak_alias_test_SOURCES): New variable.
13030         (weak_alias_test_DEPENDENCIES): New variable.
13031         (weak_alias_test_LDFLAGS): New variable.
13032         (weak_alias_test_LDADD): New variable.
13033         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13034         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13035         (weak_alias_test_3.o): New target.
13036         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13037         * testsuite/weak_alias_test_main.cc: New file.
13038         * testsuite/weak_alias_test_1.cc: New file.
13039         * testsuite/weak_alias_test_2.cc: New file.
13040         * testsuite/weak_alias_test_3.cc: New file.
13041
13042 2008-04-08  Ian Lance Taylor  <iant@google.com>
13043
13044         * options.h (class General_options): Add --noinhibit-exec option.
13045         * main.cc (main): Check --noinhibit-exec.
13046
13047         * options.h (class General_options): Define --wrap as a special
13048         option.  Add wrap_symbols_ field.
13049         (General_options::any_wrap_symbols): New function.
13050         (General_options::is_wrap_symbol): New function.
13051         * options.cc (General_options::parse_wrap): New function.
13052         (General_options::General_options): Initialize wrap_symbols_.
13053         * symtab.cc (Symbol_table::wrap_symbol): New function.
13054         (Symbol_table::add_from_object): Handle --wrap.
13055         * symtab.h (class Symbol_table): Declare wrap_symbol.
13056         * target.h (Target::wrap_char): New function.
13057         (Target::Target_info): Add wrap_char field.
13058         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13059         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13060         * testsuite/testfile.cc (Target_test::test_target_info):
13061         Likewise.
13062
13063         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13064         there is one.
13065
13066         * layout.h (class Layout): Add added_eh_frame_data_ field.
13067         * layout.cc (Layout::Layout): Initialize new field.
13068         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13069         output section until we find a section we merged successfully.
13070         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13071         that the size be non-zero.
13072
13073         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13074         qualifier.
13075
13076 2008-04-08  Craig Silverstein  <csilvers@google.com>
13077
13078         * configure.ac: Export new conditional variable HAVE_ZLIB.
13079         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13080         on HAVE_ZLIB.
13081         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13082         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13083
13084 2008-04-07  Ian Lance Taylor  <iant@google.com>
13085
13086         * version.cc (version_string): Set to "1.5".
13087
13088         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13089         Add issued_non_pic_error_ field.  Declare check_non_pic.
13090         (Target_x86_64::Scan::check_non_pic): New function.
13091         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13092         (Target_x86_64::Scan::global): Likewise.
13093
13094         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13095         addend parameter.  Change caller.  Handle merge sections.
13096         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13097         Address to Addend.  Don't add in the result of
13098         local_section_offset, pass down the addend and use the returned
13099         value.
13100         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13101         Update declarations of local_section_offset and symbol_value.
13102         * testsuite/two_file_test_1.cc (t18): New function.
13103         * testsuite/two_file_test_2.cc (f18): New function.
13104         * testsuite/two_file_test_main.cc (main): Call t18.
13105         * testsuite/two_file_test.h (t18, f18): Declare.
13106
13107         * configure.ac: Don't test for objdump, c++filt, or readelf.
13108         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13109         conditionals.
13110         (TEST_READELF): New variable.
13111         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13112         (check_PROGRAMS): Add two_file_strip_test.
13113         (two_file_strip_test): New target.
13114         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13115         (two_file_same_shared_strip_test_SOURCES): New variable.
13116         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13117         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13118         (two_file_same_shared_strip_test_LDADD): New variable.
13119         (two_file_shared_strip.so): New target.
13120         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13121         (ver_test_5.syms, ver_test_7.syms): Likewise.
13122         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13123         (strip_test_3.stdout): Use TEST_OBJDUMP.
13124         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13125
13126 2008-04-04  Cary Coutant  <ccoutant@google.com>
13127
13128         * symtab.h (Symbol::is_weak_undefined): New function.
13129         (Symbol::is_strong_undefined): New function.
13130         (Symbol::is_absolute): New function.
13131         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13132         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13133         absolute symbols.
13134         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13135         (weak_undef_test): New target.
13136         * testsuite/Makefile.in: Rebuild.
13137         * testsuite/weak_undef_file1.cc: New file.
13138         * testsuite/weak_undef_file2.cc: New file.
13139         * testsuite/weak_undef_test.cc: New file.
13140
13141 2008-04-03  Craig Silverstein  <csilvers@google.com>
13142
13143         * compressed_output.h (class Output_compressed_section): Use
13144         unsigned buffer.
13145         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13146         add zlib header.
13147         (zlib_compressed_suffix): Removed.
13148         (Output_compressed_section::set_final_data_size): Use unsigned
13149         buffers.
13150         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13151         Fix linker invocation.
13152         (flagstest_o_specialfile_and_compress_debug_sections):
13153         Likewise.
13154         * testsuite/Makefile.in: Regenerated.
13155
13156 2008-04-02  David S. Miller  <davem@davemloft.net>
13157
13158         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13159         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13160
13161 2008-04-02  Craig Silverstein  <csilvers@google.com>
13162
13163         * TODO: New file.
13164
13165 2008-04-02  Ian Lance Taylor  <iant@google.com>
13166
13167         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13168         parameters.  Update for new key type to views_.  Change all
13169         callers.
13170         (File_read::read): Adjust for byteshift in returned view.
13171         (File_read::add_view): New function, broken out of
13172         find_and_make_view.
13173         (File_read::make_view): New function, broken out of
13174         find_and_make_view.
13175         (File_read::find_or_make_view): Add offset and aligned
13176         parameters.  Rewrite accordingly.  Change all callers.
13177         (File_read::get_view): Add offset and aligned parameters.  Adjust
13178         for byteshift in return value.
13179         (File_read::get_lasting_view): Likewise.
13180         * fileread.h (class File_read): Update declarations.
13181         (class File_read::View): Add byteshift_ field.  Add byteshift to
13182         constructor.  Add byteshift method.
13183         * archive.h (Archive::clear_uncached_views): New function.
13184         (Archive::get_view): Add aligned parameter.  Change all callers.
13185         * object.h (Object::get_view): Add aligned parameter.  Change all
13186         callers.
13187         (Object::get_lasting_view): Likewise.
13188
13189         * fileread.cc (File_read::release): Don't call clear_views if
13190         there are multiple objects.
13191         * fileread.h (File_read::clear_uncached_views): New function.
13192         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13193         on the archive.
13194
13195 2008-03-31  Cary Coutant  <ccoutant@google.com>
13196
13197         Add thin archive support.
13198         * archive.cc (Archive::armagt): New const.
13199         (Archive::setup): Remove task parameter and calls to unlock.
13200         (Archive::unlock_nested_archives): New function.
13201         (Archive::read_header): Add nested_off parameter. Change
13202         all callers.
13203         (Archive::interpret_header): Likewise.
13204         (Archive::include_all_members): Change to handle thin
13205         archives.
13206         (Archive::include_member): Likewise.
13207         * archive.h (Archive::Archive): Add new parameters and
13208         initializers.
13209         (Archive::armagt): New const.
13210         (Archive::setup): Remove task parameter.
13211         (Archive::unlock_nested_archives): New function.
13212         (Archive::read_header): Add nested_off parameter.
13213         (Archive::interpret_header): Likewise.
13214         (Archive::Nested_archive_table): New typedef.
13215         (Archive::is_thin_archive_): New field.
13216         (Archive::nested_archives_): New field.
13217         (Archive::options_): New field.
13218         (Archive::dirpath_): New field.
13219         (Archive::task_): New field.
13220         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13221         for thin archives.  Pass additional parameters to
13222         Archive::Archive.  Unlock the archive file after calling
13223         Archive::setup.
13224
13225 2008-03-29  Ian Lance Taylor  <iant@google.com>
13226
13227         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13228         version symbol to be local.
13229         * testsuite/ver_test_4.sh: New file.
13230         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13231         (check_DATA): Add ver_test_4.syms.
13232         (ver_test_4.syms): New target.
13233         * testsuite/Makefile.in: Rebuild.
13234
13235         * output.cc
13236         (Output_section::Input_section_sort_entry::has_priority): New
13237         function.
13238         (Output_section::Input_section_sort_entry::match_file_name): New
13239         function.
13240         (Output_section::Input_section_sort_entry::match_section_name):
13241         Remove.
13242         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13243         Remove.
13244         (Output_section::Input_section_sort_entry::match_section_file):
13245         Remove.
13246         (Output_section::Input_section_sort_compare::operator()): Rewrite
13247         using new Input_section_sort_entry functions.  Sort crtbegin and
13248         crtend first.  Sort sections with no priority before sections with
13249         a priority.
13250         * testsuite/initpri1.c (d3): Check j != 4.
13251         (cd5): New constructor/destructor function.
13252         (main): Check j != 2.
13253
13254         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13255         new symbol when resolving, don't call set_is_default.
13256         * testsuite/ver_test_7.cc: New file.
13257         * testsuite/ver_test_7.sh: New file.
13258         * testsuite/Makefile.am (ver_test_7.so): New target.
13259         (ver_test_7.o): New target.
13260         (check_SCRIPTS): Add ver_test_7.sh.
13261         (check_DATA): Add ver_test_7.syms.
13262         (ver_test_7.syms): New target.
13263
13264 2008-03-28  Ian Lance Taylor  <iant@google.com>
13265
13266         * layout.cc (Layout::layout): If we see an input section with a
13267         name that needs sorting, set the must_sort flag for the output
13268         section.
13269         (Layout::make_output_section): If the name of the output section
13270         indicates that it might require sorting, set the may_sort flag.
13271         * output.h (Output_section::may_sort_attached_input_sections): New
13272         function.
13273         (Output_section::set_may_sort_attached_input_sections): New
13274         function.
13275         (Output_section::must_sort_attached_input_sections): New
13276         function.
13277         (Output_section::set_must_sort_attached_input_sections): New
13278         function.
13279         (class Output_section): Declare Input_section_sort_entry.  Define
13280         Input_section_sort_compare.  Declare
13281         sort_attached_input_sections.  Add new fields:
13282         may_sort_attached_input_sections_,
13283         must_sort_attached_input_sections_,
13284         attached_input_sections_are_sorted_.
13285         * output.cc (Output_section::Output_section): Initialize new
13286         fields.
13287         (Output_section::add_input_section): Add an entry to
13288         input_sections_ if may_sort or must_sort are true.
13289         (Output_section::set_final_data_size): Call
13290         sort_attached_input_sections if necessary.
13291         (Output_section::Input_section_sort_entry): Define new class.
13292         (Output_section::Input_section_sort_compare::operator()): New
13293         function.
13294         (Output_section::sort_attached_input_sections): New function.
13295         * configure.ac: Check whether the compiler supports constructor
13296         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13297         * testsuite/initpri1.c: New file.
13298         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13299         CONSTRUCTOR_PRIORITY.
13300         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13301         (initpri1_LDFLAGS): New variable.
13302         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13303
13304 2008-03-27  Ian Lance Taylor  <iant@google.com>
13305
13306         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13307         * testsuite/common_test_1.c: New file.
13308         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13309         (common_test_1_SOURCES): New variable.
13310         (common_test_1_DEPENDENCIES): New variable.
13311         (common_test_1_LDFLAGS): New variable.
13312
13313         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13314         and commons_ correctly when NAME/VERSION does not override
13315         NAME/NULL.
13316         * testsuite/ver_test_6.c: New file.
13317         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13318         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13319         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13320
13321 2008-03-26  Ian Lance Taylor  <iant@google.com>
13322
13323         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13324         of an undefined symbol from a version script.
13325         * testsuite/Makefile.am (ver_test_5.so): New target.
13326         (ver_test_5.o): New target.
13327         (check_SCRIPTS): Add ver_test_5.sh.
13328         (check_DATA): Add ver_test_5.syms.
13329         (ver_test_5.syms): New target.
13330         * testsuite/ver_test_5.cc: New file.
13331         * testsuite/ver_test_5.script: New file.
13332         * testsuite/ver_test_5.sh: New file.
13333         * Makefile.in, testsuite/Makefile.in: Rebuild.
13334
13335         PR gold/5986
13336         Fix problems building gold with gcc 4.3.0.
13337         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13338         (gold_error_at_location, gold_warning_at_location): Use it.
13339         * configure.ac: Check whether we can compile and use a template
13340         function with a printf attribute.
13341         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13342         when jumping over bytes.
13343         * object.cc: Instantiate Object::read_section_data.
13344         * debug.h: Include <cstring>
13345         * dwarf_reader.cc: Include <algorithm>
13346         * main.cc: Include <cstring>.
13347         * options.cc: Include <cstring>.
13348         * output.cc: Include <cstring>.
13349         * script.cc: Include <cstring>.
13350         * script.h: Include <string>.
13351         * symtab.cc: Include <cstring> and <algorithm>.
13352         * target-select.cc: Include <cstring>.
13353         * version.cc: Include <string>.
13354         * testsuite/testmain.cc: Include <cstdlib>.
13355         * configure, config.in: Rebuild.
13356
13357 2008-03-25  Ian Lance Taylor  <iant@google.com>
13358
13359         * options.cc: Include "../bfd/bfdver.h".
13360         (options::help): Print bug reporting address.
13361
13362         * version.cc (print_version): Adjust output for current value of
13363         BFD_VERSION_STRING.
13364
13365         * NEWS: New file.
13366
13367         * options.cc (options::help): Print list of supported targets.
13368         * target-select.h: Include <vector>.
13369         (class Target_selector): Make machine_, size_, and is_big_endian_
13370         fields const.  Add bfd_name_ and instantiated_target_ fields.
13371         (Target_selector::Target_selector): Add bfd_name parameter.
13372         (Target_selector::recognize): Make non-virtual, call
13373         do_recognize.
13374         (Target_selector::recognize_by_name): Make non-virtual, call
13375         do_recognize_by_name.
13376         (Target_selector::supported_names): New function.
13377         (Target_selector::bfd_name): New function.
13378         (Target_selector::do_instantiate_target): New pure virtual
13379         function.
13380         (Target_selector::do_recognize): New virtual function.
13381         (Target_selector::do_recognize_by_name): New virtual function.
13382         (Target_selector::instantiate_target): New private function.
13383         (supported_target_names): Declare.
13384         * target-select.cc (Target_selector::Target_selector): Update for
13385         new parameter and fields.
13386         (select_target_by_name): Check that the name matches before
13387         calling recognize_by_name.
13388         (supported_target_names): New function.
13389         * i386.cc (class Target_selector_i386): Update Target_selector
13390         constructor call.  Remove recognize and recognize_by_name.  Add
13391         do_instantiate_target.
13392         * x86_64.cc (class Target_selector_x86_64): Likewise.
13393         * testsuite/testfile.cc (class Target_selector_test): Update for
13394         changes to Target_selector.
13395
13396         * README: Rewrite, with some notes on unsupported features.
13397
13398 2008-03-24  Cary Coutant  <ccoutant@google.com>
13399
13400         * i386.cc (Target_i386::Got_type): New enum declaration.
13401         (Target_i386::Scan::local): Updated callers of Output_data_got
13402         member functions.
13403         (Target_i386::Scan::global): Likewise.
13404         (Target_i386::Relocate::relocate): Likewise.
13405         (Target_i386::Relocate::relocate_tls): Likewise.
13406         * object.h (Got_offset_list): New class.
13407         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13408         (Sized_relobj::local_got_offset): Likewise.
13409         (Sized_relobj::set_local_got_offset): Likewise.
13410         (Sized_relobj::local_has_tls_got_offset): Removed.
13411         (Sized_relobj::local_tls_got_offset): Removed.
13412         (Sized_relobj::set_local_tls_got_offset): Removed.
13413         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13414         * output.cc (Output_data_got::add_global): Added got_type parameter.
13415         (Output_data_got::add_global_with_rel): Likewise.
13416         (Output_data_got::add_global_with_rela): Likewise.
13417         (Output_data_got::add_global_pair_with_rel): New function.
13418         (Output_data_got::add_global_pair_with_rela): New function.
13419         (Output_data_got::add_local): Added got_type parameter.
13420         (Output_data_got::add_local_with_rel): Likewise.
13421         (Output_data_got::add_local_with_rela): Likewise.
13422         (Output_data_got::add_local_pair_with_rel): New function.
13423         (Output_data_got::add_local_pair_with_rela): New function.
13424         (Output_data_got::add_global_tls): Removed.
13425         (Output_data_got::add_global_tls_with_rel): Removed.
13426         (Output_data_got::add_global_tls_with_rela): Removed.
13427         (Output_data_got::add_local_tls): Removed.
13428         (Output_data_got::add_local_tls_with_rel): Removed.
13429         (Output_data_got::add_local_tls_with_rela): Removed.
13430         * output.h (Output_data_got::add_global): Added got_type parameter.
13431         (Output_data_got::add_global_with_rel): Likewise.
13432         (Output_data_got::add_global_with_rela): Likewise.
13433         (Output_data_got::add_global_pair_with_rel): New function.
13434         (Output_data_got::add_global_pair_with_rela): New function.
13435         (Output_data_got::add_local): Added got_type parameter.
13436         (Output_data_got::add_local_with_rel): Likewise.
13437         (Output_data_got::add_local_with_rela): Likewise.
13438         (Output_data_got::add_local_pair_with_rel): New function.
13439         (Output_data_got::add_local_pair_with_rela): New function.
13440         (Output_data_got::add_global_tls): Removed.
13441         (Output_data_got::add_global_tls_with_rel): Removed.
13442         (Output_data_got::add_global_tls_with_rela): Removed.
13443         (Output_data_got::add_local_tls): Removed.
13444         (Output_data_got::add_local_tls_with_rel): Removed.
13445         (Output_data_got::add_local_tls_with_rela): Removed.
13446         * resolve.cc (Symbol::override_base_with_special): Removed
13447         reference to has_got_offset_ field.
13448         * symtab.cc (Symbol::init_fields): Replaced initialization
13449         of got_offset_ with got_offsets_.  Removed initialization
13450         of has_got_offset_
13451         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13452         (Symbol::got_offset): Likewise.
13453         (Symbol::set_got_offset): Likewise.
13454         (Symbol::has_tls_got_offset): Removed.
13455         (Symbol::tls_got_offset): Removed.
13456         (Symbol::set_tls_got_offset): Removed.
13457         (Symbol::got_offset_): Removed.
13458         (Symbol::tls_mod_got_offset_): Removed.
13459         (Symbol::tls_pair_got_offset_): Removed.
13460         (Symbol::got_offsets_): New field.
13461         (Symbol::has_got_offset): Removed.
13462         (Symbol::has_tls_mod_got_offset): Removed.
13463         (Symbol::has_tls_pair_got_offset): Removed.
13464         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13465         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13466         member functions.
13467         (Target_x86_64::Scan::global): Likewise.
13468         (Target_x86_64::Relocate::relocate): Likewise.
13469         (Target_x86_64::Relocate::relocate_tls): Likewise.
13470
13471 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13472
13473         * yyscript.y: Fix spelling error in comment.
13474
13475 2008-03-24  Ian Lance Taylor  <iant@google.com>
13476
13477         * options.h (class General_options): Define build_id option.
13478         * layout.h (class Layout): Declare write_build_id, create_note,
13479         create_build_id.  Add build_id_note_ member.
13480         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13481         "libiberty.h", "md5.h", "sha1.h".
13482         (Layout::Layout): Initialize eh_frame_data_,
13483         eh_frame_hdr_section_, and build_id_note_.
13484         (Layout::finalize): Call create_build_id.
13485         (Layout::create_note): New function, broken out of
13486         Layout::create_gold_note.
13487         (Layout::create_gold_note): Call create_note.
13488         (Layout::create_build_id): New function.
13489         (Layout::write_build_id): New function.
13490         (Close_task_runner::run): Call write_build_id.
13491
13492         * x86_64.cc: Correct license to GPLv3.
13493
13494 2008-03-23  Ian Lance Taylor  <iant@google.com>
13495
13496         * options.cc: Include "demangle.h".
13497         (parse_optional_string): New function.
13498         (parse_long_option): Handle takes_optional_argument.
13499         (parse_short_option): Update dash_z initializer.  Handle
13500         takes_optional_argument.
13501         (General_options::General_options): Initialize do_demangle_.
13502         (General_options::finalize): Set do_demangle_.  Handle demangling
13503         style.
13504         * options.h (parse_optional_string): Declare.
13505         (struct One_option): Add optional_arg field.  Update constructor.
13506         Update call constructor calls.  Add takes_optional_argument
13507         function.
13508         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13509         (DEFINE_optional_string): Define.
13510         (General_options::demangle): Change from DEFINE_bool to
13511         DEFINE_optional_string.
13512         (General_options::no_demangle): New function.
13513         (General_options::do_demangle): New function.
13514         (General_options::set_do_demangle): New function.
13515         (General_options::execstack_status_): Move definition to end of
13516         class definition.
13517         (General_options::static_): Likewise.
13518         (General_options::do_demangle_): New field.
13519         * object.cc (big_endian>::get_symbol_location_info): Call
13520         Options::do_demangle, not Options::demangle.
13521         * symtab.cc (demangle): Likewise.
13522
13523 2008-03-22  Ian Lance Taylor  <iant@google.com>
13524
13525         * gold.h: Include <cstddef> and <sys/types.h>
13526         * options.h: Include <cstring>.
13527
13528 2008-03-21  Ian Lance Taylor  <iant@google.com>
13529
13530         * Added source code to GNU binutils.