* output.h (Output_reloc::Output_reloc <output section>): Add
[external/binutils.git] / gold / ChangeLog
1 2012-08-30  Alan Modra  <amodra@gmail.com>
2
3         * output.h (Output_reloc::Output_reloc <output section>): Add
4         is_relative param.  Adjust calls.
5         (Output_reloc::add_output_section_relative): New functions.
6         * output.cc (Output_reloc::Output_reloc <output section>): Handle
7         is_relative.
8         (Output_reloc::symbol_value): Handle SECTION_CODE.
9
10 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
11
12         * gold.cc (queue_middle_tasks): Call layout again when unique
13         segments for sections is desired.
14         * layout.cc (Layout::Layout): Initialize new members.
15         (Layout::get_output_section_flags): New function.
16         (Layout::choose_output_section): Call get_output_section_flags.
17         (Layout::layout): Make output section for mapping to a unique segment.
18         (Layout::insert_section_segment_map): New function.
19         (Layout::attach_allocated_section_to_segment): Make unique segment for
20         output sections marked so.
21         (Layout::segment_precedes): Check for unique segments when sorting.
22         * layout.h (Layout::Unique_segment_info): New struct.
23         (Layout::Section_segment_map): New typedef.
24         (Layout::insert_section_segment_map): New function.
25         (Layout::get_output_section_flags): New function.
26         (Layout::is_unique_segment_for_sections_specified): New function.
27         (Layout::set_unique_segment_for_sections_specified): New function.
28         (Layout::unique_segment_for_sections_specified_): New member.
29         (Layout::section_segment_map_): New member.
30         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
31         Rename is_gc_pass_one to is_pass_one.
32         Rename is_gc_pass_two to is_pass_two.
33         Rename is_gc_or_icf to is_two_pass.
34         Check for which pass based on whether symbols data is present.
35         Make it two pass when unique segments for sections is desired.
36         * output.cc (Output_section::Output_section): Initialize new
37         members.
38         * output.h (Output_section::is_unique_segment): New function.
39         (Output_section::set_is_unique_segment): New function.
40         (Output_section::is_unique_segment_): New member.
41         (Output_section::extra_segment_flags): New function.
42         (Output_section::set_extra_segment_flags): New function.
43         (Output_section::extra_segment_flags_): New member.
44         (Output_section::segment_alignment): New function.
45         (Output_section::set_segment_alignment): New function.
46         (Output_section::segment_alignment_): New member.
47         (Output_segment::Output_segment): Initialize is_unique_segment_.
48         (Output_segment::is_unique_segment): New function.
49         (Output_segment::set_is_unique_segment): New function.
50         (Output_segment::is_unique_segment_): New member.
51         * plugin.cc (allow_unique_segment_for_sections): New function.
52         (unique_segment_for_sections): New function.
53         (Plugin::load): Add new functions to transfer vector.
54         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
55         * Makefile.in: Regenerate.
56         * testsuite/plugin_final_layout.sh: Check if unique segment
57         functionality works.
58         * testsuite/plugin_section_order.c (onload): Check if new interfaces
59         are available.
60         (allow_unique_segment_for_sections): New global.
61         (unique_segment_for_sections): New global.
62         (claim_file_hook): Call allow_unique_segment_for_sections.
63         (all_symbols_read_hook): Call unique_segment_for_sections.
64
65 2012-08-22  Cary Coutant  <ccoutant@google.com>
66
67         * layout.cc (Layout::include_section): Don't assert on GROUP
68         sections with --emit-relocs.
69
70 2012-08-21  Cary Coutant  <ccoutant@google.com>
71
72         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
73         if --export-dynamic-symbol names an undef symbol.
74
75 2012-08-18  Alan Modra  <amodra@gmail.com>
76
77         * powerpc.cc: Formatting and white space.
78         (Powerpc_relobj): Rename got2_section_ to special_.
79         Add opd_ent_shndx_ and opd_ent_off_ vectors.
80         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
81         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
82         (Target_powerpc): Add Address typedef and invalid_address.  Use
83         throughout.
84         (Target_powerpc::is_branch_reloc): New function.
85         (Powerpc_relocate_functions): Add Address typedef, use throughout.
86         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
87         for dst_mask, value and addend.
88         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
89         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
90         (Output_data_glink::do_write): Correct toc base.  Don't try to use
91         uint16_t for 24-bit offset.  Use get_output_section_offset and
92         check return.
93         (Target_powerpc::Scan::local): Handle more relocs.
94         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
95         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
96         Plug in toc restoring insn after plt calls.  Translate branches
97         to function descriptor symbols to corresponding entry point.
98         (Target_powerpc::relocate_for_relocatable): Check return from
99         get_output_section_offset.
100         * symtab.h: Comment typo.
101
102 2012-08-14  Ian Lance Taylor  <iant@google.com>
103
104         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
105         unsupported_relocal_local to call unsupported_reloc_global.
106
107 2012-08-14  Nick Clifton  <nickc@redhat.com>
108
109         PR ld/14265
110         * script-sections.cc (Sections_element::output_section_name): Add
111         keep return parameter.
112         (Output_section_element::match_name): Add keep return parameter.
113         Return the value of the keep_ member.
114         * script-sections.h (class Output_section): Update
115         output_section_name prototype.
116         * layout.cc (Layout::keep_input_section): New public member
117         function.
118         (Layout::choose_output_section): Pass keep parameter to
119         output_section_name.
120         * layout.h (class Layout): Add keep_input_section.
121         * object.cc (Sized_relobj_file::do_layout): Check for kept input
122         sections.
123         * testsuite/Makefile.am: Add a test.
124         * testsuite/Makefile.in: Regenerate.
125         * testsuite/pr14265.c: Source file for the test.
126         * testsuite/pr14265.t: Linker script for the test.
127         * testsuite/pr14265.sh: Shell script for the test.
128
129 2012-08-14  Alan Modra  <amodra@gmail.com>
130
131         * target.h (Target::output_section_name): New function.
132         (Target::do_output_section_name): New function.
133         * layout.cc (Layout::choose_output_section): Call the above.
134         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
135
136 2012-08-14  Alan Modra  <amodra@gmail.com>
137
138         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
139         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
140         for replace_constant call.
141         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
142         (Output_data_glink::do_print_to_mapfile): New function.
143         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
144         (Target_powerpc::Relocate::relocate): Likewise.
145
146 2012-08-14  Alan Modra  <amodra@gmail.com>
147
148         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
149         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
150         (Output_data_glink::add_entry,find_entry): Remove shndx param.
151         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
152         all references to shndx_.  Handle special case for R_PPC_PLTREL24
153         here.
154         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
155         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
156         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
157         here.
158         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
159         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
160
161 2012-08-12  Alan Modra  <amodra@gmail.com>
162
163         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
164         (glink insn constants): Use uint32_t.
165         (Output_data_glink::add_entry): Use insert, not [] operator.
166
167 2012-08-11  Alan Modra  <amodra@gmail.com>
168
169         * object.h (Sized_relobj_file::find_shdr): New function.
170         (Sized_relobj_file::find_special_sections): New function.
171         * object.cc (Sized_relobj_file::find_shdr): New function.
172         (Sized_relobj_file::find_eh_frame): Use find_shdr.
173         (Sized_relobj_file::find_special_sections): New function, split out..
174         (Sized_relobj_file::do_read_symbols): ..from here.
175         * output.h (Output_data_got::replace_constant): New function.
176         (Output_data_got::num_entries): New function.
177         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
178         (Output_data_got::got_offset): Protected rather than private.
179         (Output_data_got::replace_got_entry): New function.
180         * output.cc (Output_data_got::replace_got_entry): New function.
181         * powerpc.cc (class Powerpc_relobj): New.
182         (class Powerpc_relocate_functions): Delete all psymval variants or
183         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
184         Implement _ha functions using corresponding _hi function.
185         (Powerpc_relobj::find_special_sections): New function.
186         (Target_powerpc::do_make_elf_object): New function.
187         (class Output_data_got_powerpc): New.
188         (class Output_data_glink): New.
189         (class Powerpc_scan_relocatable_reloc): New.
190         Many more changes througout file.
191
192 2012-08-09  Nick Clifton  <nickc@redhat.com>
193
194         * po/vi.po: Updated Vietnamese translation.
195
196 2012-08-07  Ian Lance Taylor  <iant@google.com>
197
198         * layout.cc (Layout::add_target_dynamic_tags): If
199         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
200         plt_rel.
201
202 2012-07-30  Nick Clifton  <nickc@redhat.com>
203
204         * po/gold.pot: Updated template.
205         * po/es.po: Updated Spanish translation.
206
207 2012-07-18  Cary Coutant  <ccoutant@google.com>
208
209         PR gold/14344
210         * configure.ac: Add check for -gpubnames support.
211         * configure: Regenerate.
212         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
213         support; force -gno-pubnames.
214         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
215         support.
216         (gdb_index_test_4): New test.
217         * testsuite/Makefile.in: Regenerate.
218         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
219         * testsuite/gdb_index_test_2.sh: Likewise.
220         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
221         * testsuite/gdb_index_test_4.sh: New script.
222         * testsuite/gdb_index_test_comm.sh: New script with common code;
223         don't look for space after colon.
224
225 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
226
227         * gold.cc (queue_middle_tasks): Update function order only after
228         deferred objects due to plugins are processed.
229
230 2012-07-11  Ian Lance Taylor  <iant@google.com>
231
232         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
233         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
234         (Target_arm::scan_reloc_for_stub): Likewise.
235         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
236         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
237         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
238         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
239         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
240
241 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
242             Ian Lance Taylor  <iant@google.com>
243
244         PR gold/14309
245         * configure.ac: Test whether std::tr1::hash<off_t> works.
246         * gold.h: Add a specialization for std::tr1::hash<off_t> if
247         needed.
248         * output.h (class Output_fill): Add virtual destructor.
249         * configure, config.in: Rebuild.
250
251 2012-06-22  Roland McGrath  <mcgrathr@google.com>
252
253         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
254
255 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
256
257         * plugin.cc (Plugin::load): Handle position independent executables.
258
259 2012-06-06  Cary Coutant  <ccoutant@google.com>
260
261         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
262         add .debug_macro.
263         (lines_only_debug_sections): Likewise.
264         (gdb_fast_lookup_sections): New static array.
265         (is_gdb_debug_section): Rename formal parameter.
266         (is_lines_only_debug_section): Likewise.
267         (is_gdb_fast_lookup_section): New function.
268         (Layout::include_section): Check for ".zdebug_" prefix; pass
269         section name suffix to is_gdb_debug_section, et al.; check for
270         fast-lookup sections when building .gdb_index.
271         * options.h (--strip-debug-gdb): Update GDB version number.
272
273 2012-06-06  Cary Coutant  <ccoutant@google.com>
274
275         * configure.ac: Add check for fallocate.
276         * configure: Regenerate.
277         * config.in: Regenerate.
278
279         * options.h (class General_options): Add --mmap-output-file and
280         --posix-fallocate options.
281         * output.cc: (posix_fallocate): Remove; replace with...
282         (gold_fallocate): New function.
283         (Output_file::map_no_anonymous): Call gold_fallocate.
284         (Output_file::map): Check --mmap-output-file option.
285
286 2012-06-05  Jing Yu  <jingyu@google.com>
287
288         * gold.h (textdomain): Add do {} to empty while(0).
289         (bindtextdomain): Likewise.
290
291 2012-06-04  Cary Coutant  <ccoutant@google.com>
292
293         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
294         has_dynsym_index.
295
296 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
297
298         * symtab.cc (Symbol_table::define_special_symbol):
299         Initialize *poldsym to prevent uninitialized variable errors.
300
301 2012-05-23  Cary Coutant  <ccoutant@google.com>
302
303         * layout.cc (Layout::section_name_mapping): Add rules to handle
304         exact match on .data.rel.ro.local or .data.rel.ro.
305         (Layout::output_section_name): Check for exact matches.
306
307 2012-05-23  Cary Coutant  <ccoutant@google.com>
308
309         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
310         more carefully.
311
312 2012-05-22  Cary Coutant  <ccoutant@google.com>
313
314         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
315         object before exporting symbol.
316
317 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
318
319         * testsuite/tls_test.cc: Include "config.h" first.
320         * testsuite/tls_test_c.c: Likewise.
321
322 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
323             Nick Clifton  <nickc@redhat.com>
324
325         PR 14072
326         * configure.in: Add check that sysdep.h has been included before
327         any system header files.
328         * configure: Regenerate.
329         * config.in: Regenerate.
330
331 2012-05-14  Cary Coutant  <ccoutant@google.com>
332
333         * layout.cc (Layout::make_output_section): Mark .tdata section
334         as RELRO.
335         * testsuite/relro_test.cc: Add a TLS variable.
336
337 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
338
339         PR gold/14091
340         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
341         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
342         R_X86_64_64.
343
344 2012-05-08  Cary Coutant  <ccoutant@google.com>
345
346         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
347         (lines_only_debug_sections): Likewise.
348
349 2012-05-02  Roland McGrath  <mcgrathr@google.com>
350
351         * nacl.cc: New file.
352         * nacl.h: New file.
353         * Makefile.am (CCFILES, HFILES): Add them.
354         * Makefile.in: Regenerate.
355         * i386.cc (Output_data_plt_i386_nacl): New class.
356         (Output_data_plt_i386_nacl_exec): New class.
357         (Output_data_plt_i386_nacl_dyn): New class.
358         (Target_i386_nacl): New class.
359         (Target_selector_i386_nacl): New class.
360         (target_selector_i386): Use it instead of Target_selector_i386.
361         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
362         (Target_x86_64_nacl): New class.
363         (Target_selector_x86_64_nacl): New class.
364         (target_selector_x86_64, target_selector_x32): Use it instead of
365         Target_selector_x86_64.
366         * arm.cc (Output_data_plt_arm_nacl): New class.
367         (Target_arm_nacl): New class.
368         (Target_selector_arm_nacl): New class.
369         (target_selector_arm, target_selector_armbe): Use it instead of
370         Target_selector_arm.
371
372         * target-select.cc (select_target): Take new Input_file* and off_t
373         arguments, pass them on to recognize method of selector.
374         * object.cc (make_elf_sized_object): Update caller.
375         * parameters.cc (parameters_force_valid_target): Likewise.
376         * incremental.cc (make_sized_incremental_binary): Likewise.
377         * target-select.h: Update decl.
378         (Target_selector::recognize): Take new Input_file* argument,
379         pass it on to do_recognize.
380         (Target_selector::do_recognize): Take new Input_file* argument.
381         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
382         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
383         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
384         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
385
386         * target.h (Target::Target_info): New members isolate_execinstr
387         and rosegment_gap.
388         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
389         * arm.cc (Target_arm::arm_info): Update initializer.
390         * i386.cc (Target_i386::i386_info): Likewise.
391         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
392         * sparc.cc (Target_sparc::sparc_info): Likewise.
393         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
394         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
395         * layout.cc (Layout::attach_allocated_section_to_segment):
396         Take new const Target* argument.  If target->isolate_execinstr(), act
397         like --rosegment.
398         (Layout::find_first_load_seg): Take new const Target* argument;
399         if target->isolate_execinstr(), reject PF_X segments.
400         (Layout::relaxation_loop_body): Update caller.
401         (Layout::set_segment_offsets): If target->isolate_execinstr(),
402         reset file offset to zero when we hit LOAD_SEG, and then do a second
403         loop over the segments before LOAD_SEG to reassign offsets after
404         addresses have been determined.  Handle target->rosegment_gap().
405         (Layout::attach_section_to_segment): Take new const Target* argument;
406         pass it to attach_allocated_section_to_segment.
407         (Layout::make_output_section): Update caller.
408         (Layout::attach_sections_to_segments): Take new const Target* argument;
409         pass it to attach_section_to_segment.
410         * gold.cc (queue_middle_tasks): Update caller.
411         * layout.h (Layout): Update method decls with new arguments.
412
413         * arm.cc (Target_arm::Target_arm): Take optional argument for the
414         Target_info pointer to use.
415         (Target_arm::do_make_data_plt): New virtual method.
416         (Target_arm::make_data_plt): New method that calls it.
417         (Target_arm::make_plt_entry): Use it.
418         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
419         for the section alignment.
420         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
421         method.
422         (Output_data_plt_arm::first_plt_entry_offset): Call it.
423         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
424         method.
425         (Output_data_plt_arm::get_plt_entry_size): Call it.
426         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
427         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
428         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
429         method.
430         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
431         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
432         method instead of sizeof(plt_entry).
433         (Output_data_plt_arm::add_entry): Likewise.
434         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
435         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
436         than static method.
437         (Target_arm::plt_entry_size): Likewise.
438         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
439         Move to ...
440         (Output_data_plt_arm_standard): ... here, new class.
441         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
442         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
443         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
444
445         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
446         Take additional argument for the PLT entry size.
447         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
448         Use get_plt_entry_size method rather than plt_entry_size variable.
449         (Output_data_plt_x86_64::reserve_slot): Likewise.
450         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
451         (Output_data_plt_x86_64::add_entry): Likewise.
452         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
453         (Output_data_plt_x86_64::address_for_global): Likewise.
454         (Output_data_plt_x86_64::address_for_local): Likewise.
455         (Output_data_plt_x86_64::set_final_data_size): Likewise.
456         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
457         Make method non-static.
458         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
459         method.
460         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
461         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
462         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
463         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
464         virtual method.
465         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
466         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
467         virtual method.
468         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
469         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
470         virtual method.
471         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
472         (Output_data_plt_x86_64::plt_entry_size)
473         (Output_data_plt_x86_64::first_plt_entry)
474         (Output_data_plt_x86_64::plt_entry)
475         (Output_data_plt_x86_64::tlsdesc_plt_entry)
476         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
477         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
478         (Output_data_plt_x86_64_standard): ... here, new class.
479         (Target_x86_64::Target_x86_64): Take optional argument for the
480         Target_info pointer to use.
481         (Target_x86_64::do_make_data_plt): New virtual method.
482         (Target_x86_64::make_data_plt): New method to call it.
483         (Target_x86_64::init_got_plt_for_update): Use that.
484         Call this->plt_->add_eh_frame method here.
485         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
486         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
487         rather than static method.
488         (Target_x86_64::plt_entry_size): Likewise.
489         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
490         rather than plt_entry_size variable.  Move guts of PLT filling to...
491         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
492         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
493         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
494
495         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
496         additional argument for the section alignment.
497         Don't do add_eh_frame_for_plt here.
498         (Output_data_plt_i386::first_plt_entry_offset): Make the method
499         non-static.  Use get_plt_entry_size method rather than plt_entry_size
500         variable.
501         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
502         method.
503         (Output_data_plt_i386::get_plt_entry_size): Call it.
504         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
505         (Output_data_plt_i386::add_eh_frame): New method to call it.
506         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
507         method.
508         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
509         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
510         method.
511         (Output_data_plt_i386::fill_plt_entry): New method to call it.
512         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
513         method instead of plt_entry_size.
514         (Output_data_plt_i386::plt_entry_size)
515         (Output_data_plt_i386::plt_eh_frame_fde_size)
516         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
517         (Output_data_plt_i386_standard): ... here, new class.
518         (Output_data_plt_i386_exec): New class.
519         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
520         (Output_data_plt_i386_exec::first_plt_entry): ... here.
521         (Output_data_plt_i386::exec_plt_entry): Move to ...
522         (Output_data_plt_i386_exec::plt_entry): ... here.
523         (Output_data_plt_i386_dyn): New class.
524         (Output_data_plt_i386::first_plt_entry): Move to ...
525         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
526         (Output_data_plt_i386::dyn_plt_entry): Move to ...
527         (Output_data_plt_i386_dyn::plt_entry): ... here.
528         (Target_i386::Target_i386): Take optional argument for the Target_info
529         pointer to use.
530         (Target_i386::do_make_data_plt): New virtual method.
531         (Target_i386::make_data_plt): New method to call it.
532         (Target_i386::make_plt_section): Use that.
533         Call this->plt_->add_eh_frame method here.
534         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
535         rather than plt_entry_size variable.
536         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
537         (Output_data_plt_i386::address_for_local): Likewise.
538         (Output_data_plt_i386::do_write): Likewise.
539         Move guts of PLT filling to...
540         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
541         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
542         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
543         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
544
545 2012-05-01  Cary Coutant  <ccoutant@google.com>
546
547         * dwarf_reader.cc (Dwarf_die::read_attributes)
548         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
549         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
550         * reduced_debug_output.cc
551         (Output_reduced_debug_info_section::get_die_end): Remove
552         DW_FORM_GNU_ref_index.  Add default case.
553
554 2012-04-26  Mark Wielaard  <mjw@redhat.com>
555
556         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
557         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
558         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
559         DW_AT_high_pc as offset from DW_AT_low_pc.
560
561         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
562         * testsuite/Makefile.in: Regenerate.
563         * testsuite/gdb_index_test_3.c: New test source file.
564         * testsuite/gdb_index_test_3.sh: New test source file.
565
566 2012-04-25  Ian Lance Taylor  <iant@google.com>
567
568         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
569         pointer.
570         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
571         as a class, not a struct.
572         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
573         (Target_arm::apply_cortex_a8_workaround): Likewise.
574         * gc.h: Declare Reloc_types as a struct, not a class.
575         * object.h: Declare Symbols_data as a struct.
576         * reloc.h: Declare Read_relocs_data as a struct.
577         * target.h: Declare Relocate_info as a struct.
578
579 2012-04-24  David S. Miller  <davem@davemloft.net>
580
581         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
582         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
583         and R_SPARC_WPLT30.
584
585 2012-04-24  Cary Coutant  <ccoutant@google.com>
586
587         * incremental-dump.cc (find_input_containing_global): Replace
588         magic number with symbolic constant.
589         (dump_incremental_inputs): Update version number.
590         * incremental.cc (Output_section_incremental_inputs): Update version
591         number; import symbolic constants from Incremental_inputs_reader.
592         (Incremental_inputs::create_data_sections): Align relocations
593         section correctly for 64-bit targets.
594         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
595         constants; add padding.
596         (Output_section_incremental_inputs::write_header): Add assert for
597         header_size.
598         (Output_section_incremental_inputs::write_input_files): Add assert
599         for input_entry_size.
600         (Output_section_incremental_inputs::write_info_blocks): Add padding;
601         add assert for object_info_size, input_section_entry_size,
602         global_sym_entry_size.
603         * incremental.h (Incremental_inputs_reader): Add symbolic constants
604         for data structure sizes; use them.
605         (Incremental_input_entry_reader): Import symbolic constants from
606         Incremental_inputs_reader; use them.
607
608 2012-04-23  David S. Miller  <davem@davemloft.net>
609
610         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
611         and elf_flags_set_.
612         (Target_sparc::Target_sparc): Initialize new fields.
613         (Target_sparc::do_make_elf_object): New function.
614         (Target_sparc::do_adjust_elf_header): New function.
615
616 2012-04-23  Cary Coutant  <ccoutant@google.com>
617
618         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
619         CU range table of gdb index.
620
621 2012-04-20  David S. Miller  <davem@davemloft.net>
622
623         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
624         instead of false.
625
626 2012-04-16  David S. Miller  <davem@davemloft.net>
627
628         * sparc.cc (Target_sparc::got_address): New function.
629         (Sparc_relocate_functions::gdop_hix22): New function.
630         (Sparc_relocate_functions::gdop_lox10): New function.
631         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
632         relocs.
633         (Target_sparc::Scan::local): Likewise if the global symbol is not
634         preemptible and is not IFUNC.
635         (Target_sparc::Relocate::relocate): Perform GOTDATA code
636         transformations for local and non-preemptible non-IFUNC global
637         symbols.
638
639         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
640         writing out 64-bit part of ranges.
641
642         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
643         -fpic and -fpie respectively.
644         * Makefile.in: Regenerate.
645
646         * sparc.cc (class Target_sparc): Add rela_ifunc_.
647         (Target_sparc::Target_sparc): Initialize new field.
648         (Target_sparc::do_plt_section_for_global): New function.
649         (Target_sparc::do_plt_section_for_local): New function.
650         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
651         (Target_sparc::make_plt_section): New function, broken out of
652         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
653         (Target_sparc::make_plt_entry): Call make_plt_section.
654         (Target_sparc::make_local_ifunc_plt_entry): New function.
655         (Target_sparc::rela_ifunc_section): New function.
656         (Target_sparc::plt_section): Remove const.
657         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
658         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
659         and ifunc_count_ fields.
660         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
661         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
662         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
663         (Output_data_plt_sparc::rela_ifunc): New function.
664         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
665         (Output_data_plt_sparc::has_ifunc_section): New function.
666         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
667         (Output_data_plt_sparc::address_for_global): New function.
668         (Output_data_plt_sparc::address_for_local): New function.
669         (Output_data_plt_sparc::plt_index_to_offset): New function.
670         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
671         and entry_count.
672         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
673         entry_count.
674         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
675         R_SPARC_JMP_IREL to switch.
676         (Target_sparc::Scan::check_non_pic): Likewise.
677         (Target_sparc::Scan::local): Handle IFUNC symbols.
678         (Target_sparc::Scan::local): Likewise.
679         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
680         and plt_address_for_local.
681         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
682         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
683
684         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
685         (class Output_data_reloc): Adjust calls to Output_reloc_type.
686         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
687         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
688         global relocs too.
689         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
690         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
691         calls.
692         * sparc.cc (Target_sparc::Scan::global): Likewise.
693         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
694
695 2012-04-16  Cary Coutant  <ccoutant@google.com>
696
697         * archive.cc (Library_base::should_include_member): Check for
698         --export-dynamic-symbol.
699         * options.h (class General_options): Add --export-dynamic-symbol.
700         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
701         --export-dynamic-symbol.
702         (Symbol_table::gc_mark_undef_symbols): Likewise.
703         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
704
705 2012-04-12  David S. Miller  <davem@davemloft.net>
706
707         * sparc.cc (Reloc::wdisp10): New relocation method.
708         (Reloc::h34): Likewise.
709         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
710         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
711         R_SPARC_WDISP10.
712         (Target_sparc::Scan::local): Likewise.
713         (Target_sparc::Scan::global): Likewise.
714         (Target_sparc::Relocate::relocate): Likewise.
715
716 2012-04-09  Cary Coutant  <ccoutant@google.com>
717
718         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
719         low_pc == 0.
720
721 2012-04-06  Ian Lance Taylor  <iant@google.com>
722
723         * timer.cc: #include <unistd.h>.
724
725 2012-04-06  Roland McGrath  <mcgrathr@google.com>
726
727         * configure.in (AC_CHECK_HEADERS): Add locale.h.
728         * config.in: Regenerate.
729         * configure: Regenerate.
730
731 2012-04-05  Nick Clifton  <nickc@redhat.com>
732
733         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
734         (AM_LC_MESSAGES): Add.
735         * aclocal.m4: Regenerate.
736         * config.in: Regenerate.
737         * configure: Regenerate.
738
739 2012-03-21  Cary Coutant  <ccoutant@google.com>
740
741         * Makefile.am: Add gdb-index.cc, gdb-index.h.
742         * Makefile.in: Regenerate.
743         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
744         (Sized_elf_reloc_mapper::symbol_section): New function.
745         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
746         (make_elf_reloc_mapper): New function.
747         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
748         (Dwarf_abbrev_table::do_read_abbrevs): New function.
749         (Dwarf_abbrev_table::do_get_abbrev): New function.
750         (Dwarf_ranges_table::read_ranges_table): New function.
751         (Dwarf_ranges_table::read_range_list): New function.
752         (Dwarf_pubnames_table::read_section): New function.
753         (Dwarf_pubnames_table::read_header): New function.
754         (Dwarf_pubnames_table::next_name): New function.
755         (Dwarf_die::Dwarf_die): New function.
756         (Dwarf_die::read_attributes): New function.
757         (Dwarf_die::skip_attributes): New function.
758         (Dwarf_die::set_name): New function.
759         (Dwarf_die::set_linkage_name): New function.
760         (Dwarf_die::attribute): New function.
761         (Dwarf_die::string_attribute): New function.
762         (Dwarf_die::int_attribute): New function.
763         (Dwarf_die::uint_attribute): New function.
764         (Dwarf_die::ref_attribute): New function.
765         (Dwarf_die::child_offset): New function.
766         (Dwarf_die::sibling_offset): New function.
767         (Dwarf_info_reader::check_buffer): New function.
768         (Dwarf_info_reader::parse): New function.
769         (Dwarf_info_reader::do_parse): New function.
770         (Dwarf_info_reader::do_read_string_table): New function.
771         (Dwarf_info_reader::lookup_reloc): New function.
772         (Dwarf_info_reader::get_string): New function.
773         (Dwarf_info_reader::visit_compilation_unit): New function.
774         (Dwarf_info_reader::visit_type_unit): New function.
775         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
776         Sized_elf_reloc_mapper.
777         (Sized_dwarf_line_info::symbol_section): Remove function.
778         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
779         (Sized_dwarf_line_info::read_line_mappings): Remove object
780         parameter, adjust callers.
781         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
782         * dwarf_reader.h: Include <sys/types.h>.
783         (class Track_relocs): Remove forward declaration.
784         (class Elf_reloc_mapper): New class.
785         (class Sized_elf_reloc_mapper): New class.
786         (class Dwarf_abbrev_table): New class.
787         (class Dwarf_range_list): New class.
788         (class Dwarf_ranges_table): New class.
789         (class Dwarf_pubnames_table): New class.
790         (class Dwarf_die): New class.
791         (class Dwarf_info_reader): New class.
792         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
793         (Sized_dwarf_line_info::symbol_section): Remove member function.
794         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
795         base class.
796         * gdb-index.cc: New source file.
797         * gdb-index.h: New source file.
798         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
799         and .debug_types sections, call Layout::add_to_gdb_index.
800         (Sized_relobj_incr::do_section_name): Implement.
801         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
802         return type; Implement.
803         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
804         return type.
805         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
806         parameter list and return type.
807         (Sized_incr_dynobj::do_section_contents): Likewise.
808         * layout.cc: Include gdb-index.h.
809         (Layout::Layout): Initialize gdb_index_data_.
810         (Layout::init_fixed_output_section): Check for .gdb_index section.
811         (Layout::add_to_gdb_index): New function. Instantiate.
812         * layout.h: Add forward declaration for class Gdb_index.
813         (Layout::add_to_gdb_index): New member function.
814         (Layout::gdb_index_data_): New data member.
815         * main.cc: Include gdb-index.h.
816         (main): Print statistics for gdb index.
817         * object.cc (Object::section_contents): Move code into
818         do_section_contents.
819         (need_decompressed_section): Check for sections needed when building
820         gdb index.
821         (build_compressed_section_map): Likewise.
822         (Sized_relobj_file::do_read_symbols): Need local symbols when building
823         gdb index.
824         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
825         sections; call Layout::add_to_gdb_index.
826         (Sized_relobj_file::do_decompressed_section_contents): Call
827         do_section_contents directly.
828         * object.h (Object::do_section_contents): Adjust parameter list and
829         return type.
830         (Object::do_decompressed_section_contents): Call do_section_contents
831         directly.
832         (Sized_relobj_file::do_section_contents): Adjust parameter list and
833         return type.
834         * options.h (class General_options): Add --gdb-index option.
835         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
836         list and return type.
837         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
838         * reloc.h (Track_relocs::checkpoint): New function.
839         (Track_relocs::reset): New function.
840
841         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
842         New test cases.
843         * testsuite/Makefile.in: Regenerate.
844         * testsuite/gdb_index_test.cc: New test source file.
845         * testsuite/gdb_index_test_1.sh: New test source file.
846         * testsuite/gdb_index_test_2.sh: New test source file.
847
848 2012-03-19  Doug Kwan  <dougkwan@google.com>
849
850         * arm.cc (Target_arm::do_define_standard_symbols): New method.
851         (Target_arm::do_finalize_sections): Remove code which defines
852         __exidx_start and __exidx_end.  Make symbol table parameter
853         anonymous as it is not used.
854         * gold.cc (queue_middle_tasks): Call target hook to define any
855         target-specific symbols.
856         * target.h (Target::define_standard_symbols): New method.
857         (Target::do_define_standard_symbols): Same.
858         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
859         * testsuite/Makefile.in: Regenerate.
860         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
861         and __exidx_end.
862         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
863         relocations are generated for __exidx_start and __exidx_end.
864
865 2012-03-16  Doug Kwan  <dougkwan@google.com>
866
867         * testsuite/Makefile.am: Disable test initpri3b.
868         * testsuite/Makefile.in: Regenerate.
869
870 2012-03-15  Doug Kwan  <dougkwan@google.com>
871
872         * arm.cc (Target_arm::got_section): Make .got section read-only
873         if -z now is given.
874
875 2012-03-15  Ian Lance Taylor  <iant@google.com>
876
877         PR gold/13850
878         * layout.cc (Layout::make_output_section): Correctly mark
879         SHT_INIT_ARRAY, et. al., as relro.
880
881 2012-03-14  Doug Kwan  <dougkwan@google.com>
882
883         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
884         dynamic relocations for protected symbols in shared objects.
885
886 2012-03-13  Ian Lance Taylor  <iant@google.com>
887
888         * resolve.cc (Symbol_table::resolve): When merging common symbols,
889         keep the larger alignment.
890
891 2012-03-12  Cary Coutant  <ccoutant@google.com>
892
893         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
894         handling of DW_LNE_define_file.
895
896 2012-03-12  Cary Coutant  <ccoutant@google.com>
897
898         * reduced_debug_output.cc
899         (Output_reduced_debug_info_section::get_die_end): Add new FORM
900         codes to switch.
901
902 2012-02-29  Cary Coutant  <ccoutant@google.com>
903
904         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
905
906 2012-02-29  Cary Coutant  <ccoutant@google.com>
907
908         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
909         Call Object::decompressed_section_contents.
910         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
911         New dtor.
912         (Sized_dwarf_line_info::buffer_start_): New data member.
913         * merge.cc (Output_merge_data::do_add_input_section): Call
914         Object::decompressed_section_contents.
915         (Output_merge_string::do_add_input_section): Likewise.
916         * object.cc (need_decompressed_section): New function.
917         (build_compressed_section_map): Decompress sections needed later.
918         (Sized_relobj_file::do_decompressed_section_contents): New function.
919         (Sized_relobj_file::do_discard_decompressed_sections): New function.
920         * object.h (Object::decompressed_section_contents): New function.
921         (Object::discard_decompressed_sections): New function.
922         (Object::do_decompressed_section_contents): New function.
923         (Object::do_discard_decompressed_sections): New function.
924         (Compressed_section_info): New type.
925         (Compressed_section_map): Include decompressed section contents.
926         (Sized_relobj_file::do_decompressed_section_contents): New function.
927         (Sized_relobj_file::do_discard_decompressed_sections): New function.
928
929 2012-02-16  Cary Coutant  <ccoutant@google.com>
930
931         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
932         * testsuite/Makefile.in: Regenerate.
933
934 2012-02-14  Cary Coutant  <ccoutant@google.com>
935
936         * options.cc (General_options::finalize): Disallow -pie and -static.
937
938 2012-02-03  Doug Kwan  <dougkwan@google.com>
939
940         * arm.cc (Arm_relocate_functions::abs8,
941         Arm_relocate_functions::abs16): Use
942         Bits::has_signed_unsigned_overflow32.
943         (Arm_relocate_functions::thm_abs8): Correct range of
944         overflow check.
945         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
946         in assertions.
947
948 2012-02-02  Doug Kwan  <dougkwan@google.com>
949
950         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
951         position independent outputs, not just shared objects.
952
953 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
954
955         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
956         * configure: Regenerated.
957
958 2012-01-27  Ian Lance Taylor  <iant@google.com>
959
960         * reloc.h (Bits): New class with static functions, copied from
961         namespace utils in arm.cc.
962         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
963         instead.
964
965 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
966
967         * incremental.cc (write_info_blocks): Correct relocation offset.
968
969 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
970
971         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
972         (Relocate::tls_gd_to_le): Likewise.
973
974 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
975
976         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
977
978 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
979
980         * configure.ac: Check if -mcmodel=medium works.
981         * configure: Regenerated.
982
983 2012-01-24  Cary Coutant  <ccoutant@google.com>
984
985         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
986         definition and ...
987         (read_unsigned_LEB_128_x): ... this new function.
988         (read_signed_LEB_128): Replaced with inline definition and ...
989         (read_signed_LEB_128_x): ... this new function.
990         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
991         (read_unsigned_LEB_128): Add inline definition.
992         (read_signed_LEB_128_x): New function.
993         (read_signed_LEB_128): Add inline definition.
994         * testsuite/Makefile.am (leb128_unittest): New unit test.
995         * testsuite/Makefile.in: Regenerate.
996         * testsuite/leb128_unittest.cc: New unit test.
997
998 2012-01-23  Ian Lance Taylor  <iant@google.com>
999
1000         PR gold/13617
1001         * i386.cc (Target_i386::do_code_fill): When using a jmp
1002         instruction, pad with nop instructions.
1003         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1004
1005 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1006
1007         * x86_64.cc (gc_process_relocs): Add typename on types used in
1008         template.
1009         (scan_relocs): Likewise.
1010         (relocate_section): Likewise.
1011         (apply_relocation): Likewise.
1012
1013 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1014
1015         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1016         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1017         under x32.
1018
1019 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1020
1021         * x86_64.cc: Initial support for x32.
1022
1023 2012-01-03  Cary Coutant  <ccoutant@google.com>
1024
1025         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1026         Use abstract base class for GOT.
1027         * gold/output.h (class Output_data_got_base): New abstract base class.
1028         (class Output_data_got): Derive from new base class, adjust ctors.
1029         (Output_data_got::reserve_slot): Make virtual; rename to
1030         do_reserve_slot; Adjust callers.
1031         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1032         pointer to abstract base class.
1033         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1034
1035 2011-12-18  Ian Lance Taylor  <iant@google.com>
1036
1037         * object.h (Relobj::local_symbol_value): New function.
1038         (Relobj::local_plt_offset): New function.
1039         (Relobj::local_has_got_offset): New function.
1040         (Relobj::local_got_offset): New function.
1041         (Relobj::set_local_got_offset): New function.
1042         (Relobj::do_local_symbol_value): New pure virtual function.
1043         (Relobj::do_local_plt_offset): Likewise.
1044         (Relobj::do_local_has_got_offset): Likewise.
1045         (Relobj::do_local_got_offset): Likewise.
1046         (Relobj::do_set_local_got_offset): Likewise.
1047         (Sized_relobj::do_local_has_got_offset): Rename from
1048         local_has_got_offset.
1049         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1050         (Sized_relobj::do_set_local_got_offset): Rename from
1051         set_local_got_offset.
1052         (Sized_relobj_file::do_local_plt_offset): Rename from
1053         local_plt_offset.
1054         (Sized_relobj_file::do_local_symbol_value): New function.
1055         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1056         local_plt_offset.
1057         * output.cc (Output_data_got::Got_entry::write): Change object to
1058         Relobj.  Use local_symbol_value.
1059         (Output_data_got::add_global_with_rel): Change rel_dyn to
1060         Output_data_reloc_generic*.  Use add_global_generic.
1061         (Output_data_got::add_global_with_rela): Remove.  Change all
1062         callers to use add_global_with_rel.
1063         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1064         Output_data_reloc_generic*.  Use add_global_generic.
1065         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1066         callers to use add_global_pair_with_rel.
1067         (Output_data_got::add_local): Change object to Relobj*.
1068         (Output_data_got::add_local_plt): Likewise.
1069         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1070         change rel_dyn to Output_data_reloc_generic*.  Use
1071         add_local_generic.
1072         (Output_data_got::add_local_with_rela): Remove.  Change all
1073         callers to use all_local_with_rel.
1074         (Output_data_got::add_local_pair_with_rel): Change object to
1075         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1076         add_output_section_generic.
1077         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1078         callers to use add_local_pair_with_rel.
1079         (Output_data_got::reserve_local): Change object to Relobj*.
1080         * output.h: (class Output_data_reloc_generic): Add pure virtual
1081         declarations for add_global_generic, add_local_generic,
1082         add_output_section_generic.
1083         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1084         functions for Output_data_reloc_generic.  Update declarations for
1085         changes listed in output.cc.
1086         (class Output_data_got): Change template parameter to got_size.
1087         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1088         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1089         function.
1090         (Sized_relobj_incr::do_local_plt_offset): New function.
1091         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1092         add_global_generic.
1093
1094 2011-12-17  Cary Coutant  <ccoutant@google.com>
1095
1096         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1097         * resolve.cc (Symbol_table::resolve): Likewise.
1098         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1099         arrays.
1100         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1101
1102 2011-12-16  Ian Lance Taylor  <iant@google.com>
1103
1104         * output.h (Output_data_reloc_generic::add): Only call
1105         add_dynamic_reloc if this is a dynamic reloc section.
1106
1107 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1108
1109         PR gold/13505
1110         * target-reloc.h (apply_relocation): Replace <64, false> with
1111         <size, big_endian>.
1112
1113 2011-11-25  Nick Clifton  <nickc@redhat.com>
1114
1115         * po/it.po: New Italian translation.
1116
1117 2011-11-17  Sterling Augustine  <saugustine@google.com>
1118
1119         * script.cc (script_include_directive): Implement.
1120         (read_script_file): New local variables name and search_path. Update
1121         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1122         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1123         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1124
1125 2011-11-11  Sterling Augustine  <saugustine@google.com>
1126
1127         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1128         (file_or_sections_cmd): Likewise.
1129
1130 2011-11-11  Doug Kwan  <dougkwan@google.com>
1131
1132         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1133         if --just-symbols is given.
1134
1135 2011-11-10  Doug Kwan  <dougkwan@google.com>
1136
1137         PR gold/13362
1138         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1139         when processing data relocs.
1140         * reloc.h (Relocate_functions::rel_unaligned): New method.
1141         (Relocate_functions::pcrel_unaligned): Ditto.
1142         (Relocate_functions::rel32_unaligned): Ditto.
1143         (Relocate_functions::pcrel32_unaligned): Ditto.
1144
1145 2011-11-09  Doug Kwan  <dougkwan@google.com>
1146
1147         PR gold/13362
1148         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1149         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1150         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1151         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1152         (Relocate_functions::rel_unaligned): New.
1153         (Relocate_functions::rel32_unaligned): New.
1154         * target-reloc.h (relocate_for_relocatable): Add code to handle
1155         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1156         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1157         arm_unaligned_reloc_r): New targets.
1158         * testsuite/Makefile.in: Regenerate.
1159         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1160         linking.
1161
1162 2011-11-02  Ian Lance Taylor  <iant@google.com>
1163
1164         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1165         NATIVE_LINKER.
1166         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1167         * options.cc (General_options::finalize): Use library search path
1168         from configure script if specified.  If not native and no sysroot,
1169         only search TOOLLIBDIR.
1170         * options.h (Search_directory::Search_directory): Change name to
1171         const std::string&.
1172         (General_options::add_to_library_path_with_sysroot): Change arg to
1173         const std::string&.
1174         * configure, Makefile.in, config.in: Rebuild.
1175
1176 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1177
1178         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1179         we are working around the ARM1176 Erratum.
1180         * options.h (General_options::fix_arm1176): Add option.
1181         * testsuite/Makefile.am: Add testcases, and keep current ones
1182         working.
1183         * testsuite/Makefile.in: Regenerate.
1184         * testsuite/arm_fix_1176.s: New file.
1185         * testsuite/arm_fix_1176.sh: Likewise.
1186
1187 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1188
1189         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1190         may_use_blx_.
1191         (Target_arm::may_use_blx): Remove method.
1192         (Target_arm::set_may_use_blx): Likewise.
1193         (Target_arm::may_use_v4t_interworking): New method.
1194         (Target_arm::may_use_v5t_interworking): Likewise.
1195         (Target_arm::may_use_blx_): Remove member variable.
1196         (Arm_relocate_functions::arm_branch_common): Check for v5T
1197         interworking.
1198         (Arm_relocate_functions::thumb_branch_common): Likewise.
1199         (Reloc_stub::stub_type_for_reloc): Likewise.
1200         (Target_arm::do_finalize_sections): Correct interworking checks.
1201         * testsuite/Makefile.am: Add new tests.
1202         * testsuite/Makefile.in: Regenerate.
1203         * testsuite/arm_farcall_arm_arm.s: New test.
1204         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1205         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1206         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1207         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1208         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1209         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1210         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1211
1212 2011-10-31  Cary Coutant  <ccoutant@google.com>
1213
1214         PR gold/13023
1215         * expression.cc (Expression::eval_with_dot): Add
1216         is_section_dot_assignment parameter.
1217         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1218         absolute and assigning to dot within a section.
1219         * script-sections.cc
1220         (Output_section_element_assignment::set_section_addresses): Pass
1221         dot_section to set_if_absolute.
1222         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1223         as is_section_dot_assignment flag to eval_with_dot.
1224         (Output_section_element_dot_assignment::set_section_addresses):
1225         Likewise.
1226         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1227         parameter.  Also set value if relative to dot_section; set the
1228         symbol's output_section.
1229         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1230         parameter.  Adjust all callers.
1231         (Expression::eval_maybe_dot): Likewise.
1232         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1233         Adjust all callers.
1234         * testsuite/script_test_2.t: Test assignment of an absolute value
1235         to dot within an output section element.
1236
1237 2011-10-31  Cary Coutant  <ccoutant@google.com>
1238
1239         * options.h (class General_options): Add --[no-]gnu-unique options.
1240         * symtab.cc (Symbol_table::sized_write_globals): Convert
1241         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1242
1243 2011-10-31  Cary Coutant  <ccoutant@google.com>
1244
1245         PR gold/13359
1246         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1247         unnecessary assertion.
1248         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1249
1250 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1251
1252         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1253         gc_mark_symbol.
1254         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1255         gc_mark_symbol.
1256         Change to just keep the section associated with symbol.
1257         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1258         they are externally visible and --export-dynamic is turned on.
1259         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1260
1261 2011-10-19  Ian Lance Taylor  <iant@google.com>
1262
1263         PR gold/13163
1264         * script-sections.cc
1265         (Output_section_element_dot_assignment::needs_output_section): New
1266         function.
1267
1268 2011-10-19  Ian Lance Taylor  <iant@google.com>
1269
1270         PR gold/13204
1271         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1272         --section-start option was seen.
1273         * options.h (General_options::any_section_start): New function.
1274
1275 2011-10-18  David S. Miller  <davem@davemloft.net>
1276
1277         PR binutils/13301
1278         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1279         member to track relocation locations that have moved during TLS
1280         reloc optimizations.
1281         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1282         (Target_sparc::Relocate::relocate): Adjust view down by 4
1283         bytes if it matches reloc_adjust_addr_.
1284         (Target_sparc::Relocate::relocate_tls): Always move the
1285         __tls_get_addr call delay slot instruction forward 4 bytes when
1286         performing relaxation.
1287
1288 2011-10-18  Cary Coutant  <ccoutant@google.com>
1289
1290         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1291         (Output_file::map_no_anonymous): Check for non-zero
1292         return code from posix_fallocate.
1293
1294 2011-10-17  Cary Coutant  <ccoutant@google.com>
1295
1296         PR gold/13245
1297         * plugin.cc (is_visible_from_outside): Check for symbols
1298         referenced from dynamic objects.
1299         * resolve.cc (Symbol_table::resolve): Don't count references
1300         from dynamic objects as references from real ELF files.
1301         * testsuite/plugin_test_2.sh: Adjust expected result.
1302
1303 2011-10-17  Cary Coutant  <ccoutant@google.com>
1304
1305         * gold.cc: Include timer.h.
1306         (queue_middle_tasks): Stamp time.
1307         (queue_final_tasks): Likewise.
1308         * main.cc (main): Store timer in parameters.  Print timers
1309         for each pass.
1310         * parameters.cc (Parameters::Parameters): Initialize timer_.
1311         (Parameters::set_timer): New function.
1312         (set_parameters_timer): New function.
1313         * parameters.h (Parameters::set_timer): New function.
1314         (Parameters::timer): New function.
1315         (Parameters::timer_): New data member.
1316         (set_parameters_timer): New function.
1317         * timer.cc (Timer::stamp): New function.
1318         (Timer::get_pass_time): New function.
1319         * timer.h (Timer::stamp): New function.
1320         (Timer::get_pass_time): New function.
1321         (Timer::pass_times_): New data member.
1322
1323 2011-10-17  Cary Coutant  <ccoutant@google.com>
1324
1325         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1326         task for members of lib groups.
1327
1328 2011-10-17  Cary Coutant  <ccoutant@google.com>
1329
1330         PR gold/13288
1331         * fileread.cc (File_read::find_view): Add assert.
1332         (File_read::make_view): Move bounds check (replace with assert)...
1333         (File_read::find_or_make_view): ... to here.
1334
1335 2011-10-12  Cary Coutant  <ccoutant@google.com>
1336
1337         * output.cc (Output_file::open_base_file): Handle case where
1338         ::read returns less than requested size.
1339
1340 2011-10-10  Cary Coutant  <ccoutant@google.com>
1341
1342         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1343         Initialize defined_count_.
1344         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1345         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1346         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1347         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1348         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1349         * incremental.h (Sized_relobj_incr::defined_count_): New data
1350         member.
1351         (Sized_incr_dynobj::defined_count_): New data member.
1352         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1353         Return zeroes instead of internal error.
1354
1355 2011-10-10  Cary Coutant  <ccoutant@google.com>
1356
1357         PR gold/13249
1358         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1359         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1360         * output.h (class Output_reloc): Add use_plt_offset flag.
1361         (Output_reloc::type_): Adjust size of bit field.
1362         (Output_reloc::use_plt_offset_): New bit field.
1363         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1364         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1365         flag.  Adjust all callers.
1366         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1367         creating RELATIVE relocations.
1368
1369 2011-10-10  Nick Clifton  <nickc@redhat.com>
1370
1371         * po/es.po: Updated Spanish translation.
1372         * po/fi.po: Updated Finnish translation.
1373
1374 2011-10-03   Diego Novillo  <dnovillo@google.com>
1375
1376         * options.cc (parse_uint): Fix dereference of RETVAL.
1377
1378 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1379
1380         * layout.h (section_order_map_): New member.
1381         (get_section_order_map): New member function.
1382         * output.cc (Output_section::add_input_section): Check for patterns
1383         only when --section-ordering-file is specified.
1384         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1385         output_sections have been formed.
1386         * layout.cc (Layout_Layout): Initialize section_order_map_.
1387         * plugin.cc (update_section_order): Store order in order_map. Do not
1388         update the order.
1389         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1390         * testsuite/Makefile.in: Regenerate.
1391         * testsuite/plugin_section_order.c: New file.
1392         * testsuite/plugin_final_layout.cc: New file.
1393         * testsuite/plugin_final_layout.sh: New file.
1394
1395 2011-09-29  Cary Coutant  <ccoutant@google.com>
1396
1397         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1398         Check for NULL.
1399         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1400         symbols during incremental update.
1401         (Symbol_table::add_from_dynobj): Likewise.
1402
1403 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1404             Ian Lance Taylor  <iant@google.com>
1405
1406         * symtab.cc (Symbol_table::define_special_symbol): Always
1407         canonicalize version string.
1408
1409 2011-09-26  Cary Coutant  <ccoutant@google.com>
1410
1411         * gold.cc (queue_initial_tasks): Move option checks ...
1412         * options.cc (General_options::finalize): ... to here. Disable
1413         some options; make others fatal.
1414
1415 2011-09-26  Cary Coutant  <ccoutant@google.com>
1416
1417         gcc PR lto/47247
1418         * plugin.cc (get_symbols_v2): New function.
1419         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1420         (is_referenced_from_outside): New function.
1421         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1422         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1423         (get_symbols): Pass version parameter.
1424         (get_symbols_v2): New function.
1425         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1426         parameter.
1427         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1428         (onload): Add LDPT_GET_SYMBOLS_V2.
1429         (all_symbols_read_hook): Use get_symbols_v2; check for
1430         LDPR_PREVAILING_DEF_IRONLY_EXP.
1431         * testsuite/plugin_test_3.sh: Update expected results.
1432
1433 2011-09-23  Simon Baldwin  <simonb@google.com>
1434
1435         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1436         configuration options.
1437         * configure: Regenerate.
1438         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1439         * Makefile.in: Regenerate.
1440         * testsuite/Makefile.in: Regenerate.
1441
1442 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1443
1444         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1445
1446 2011-09-19  Cary Coutant  <ccoutant@google.com>
1447
1448         * incremental.cc (can_incremental_update): Fix typo in comment.
1449         * incremental.h (can_incremental_update): Likewise.
1450
1451 2011-09-18  Cary Coutant  <ccoutant@google.com>
1452
1453         * incremental.cc (can_incremental_update): New function.
1454         * incremental.h (can_incremental_update): New function.
1455         * layout.cc (Layout::init_fixed_output_section): Call it.
1456         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1457         * object.cc (Sized_relobj_file::do_layout): Call
1458         can_incremental_update.
1459
1460 2011-09-13  Cary Coutant  <ccoutant@google.com>
1461
1462         * configure.ac: Check for glibc support for gnu_indirect_function
1463         support with static linking, setting automake conditional
1464         IFUNC_STATIC.
1465         * Makefile.in: Regenerate.
1466         * configure: Regenerate.
1467
1468         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1469         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1470         for IFUNC_STATIC.
1471         * testsuite/Makefile.in: Regenerate.
1472
1473 2011-09-13  Cary Coutant  <ccoutant@google.com>
1474
1475         * incremental.cc (Sized_relobj_incr::do_layout): Call
1476         report_comdat_group for kept comdat sections.
1477         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1478         * testsuite/Makefile.in: Regenerate.
1479         * testsuite/incr_comdat_test_1.cc: New source file.
1480         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1481         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1482         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1483
1484 2011-09-13  Ian Lance Taylor  <iant@google.com>
1485
1486         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1487         variable external_symbols_offset.
1488
1489 2011-09-12  Ian Lance Taylor  <iant@google.com>
1490
1491         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1492         triggered if object has no symbols.
1493
1494 2011-09-09  David S. Miller  <davem@davemloft.net>
1495
1496         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1497         (Output_fill_debug_line::do_write): Likewise.
1498
1499 2011-08-29  Cary Coutant  <ccoutant@google.com>
1500
1501         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1502         casts to match formatting specs.
1503         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1504
1505 2011-08-26  Cary Coutant  <ccoutant@google.com>
1506
1507         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1508         remaining hole size when allocating.
1509         (Layout::make_output_section): Set fill methods for debug sections.
1510         * layout.h (Free_list::Free_list_node): Move from private to
1511         public.
1512         (Free_list::set_min_hole_size): New function.
1513         (Free_list::begin, Free_list::end): New functions.
1514         (Free_list::min_hole_): New data member.
1515         * output.cc: Include dwarf.h.
1516         (Output_fill_debug_info::do_minimum_hole_size): New function.
1517         (Output_fill_debug_info::do_write): New function.
1518         (Output_fill_debug_line::do_minimum_hole_size): New function.
1519         (Output_fill_debug_line::do_write): New function.
1520         (Output_section::Output_section): Initialize new data member.
1521         (Output_section::set_final_data_size): Ensure patch space is larger
1522         than minimum hole size.
1523         (Output_section::do_write): Fill holes in debug sections.
1524         * output.h (Output_fill): New class.
1525         (Output_fill_debug_info): New class.
1526         (Output_fill_debug_line): New class.
1527         (Output_section::set_free_space_fill): New function.
1528         (Output_section::free_space_fill_): New data member.
1529         * testsuite/Makefile.am (incremental_test_3): Add
1530         --incremental-patch option.
1531         (incremental_test_4): Likewise.
1532         (incremental_test_5): Likewise.
1533         (incremental_test_6): Likewise.
1534         (incremental_copy_test): Likewise.
1535         (incremental_common_test_1): Likewise.
1536         * testsuite/Makefile.in: Regenerate.
1537
1538 2011-08-26  Nick Clifton  <nickc@redhat.com>
1539
1540         * po/es.po: Updated Spanish translation.
1541
1542 2011-08-01  Cary Coutant  <ccoutant@google.com>
1543
1544         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1545         * gold/testsuite/Makefile.in: Regenerate.
1546         * gold/testsuite/justsyms_exec.c: New source file.
1547         * gold/testsuite/justsyms_lib.c: New source file.
1548
1549 2011-08-01  Cary Coutant  <ccoutant@google.com>
1550
1551         * layout.cc (Layout::set_segment_offsets): Don't realign text
1552         segment if -Ttext was specified.
1553         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1554         file type.
1555         * object.h (Sized_relobj_file::e_type): New function.
1556         (Sized_relobj_file::e_type_): New data member.
1557         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1558         base address for ET_EXEC files.
1559         * target.cc (Target::do_make_elf_object_implementation): Allow
1560         ET_EXEC files with --just-symbols option.
1561
1562 2011-07-28  Cary Coutant  <ccoutant@google.com>
1563
1564         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1565         Add thread_number parameter.
1566         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1567         * workqueue-threads.cc
1568         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1569         current thread if its thread number is greater than desired thread
1570         count.
1571         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1572         Add thread_number parameter.
1573         (Workqueue::should_cancel_thread): Likewise.
1574         (Workqueue::find_runnable_or_wait): Pass thread_number to
1575         should_cancel_thread.
1576         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1577         parameter.
1578
1579 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1580
1581         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1582         only after checking if it cannot be forced local.
1583         * symtab.h (is_externally_visible): Check if the symbol is not forced
1584         local.
1585
1586 2011-07-15  Ian Lance Taylor  <iant@google.com>
1587
1588         * options.h (class General_options): Add --print-output-format.
1589         Move -EL next to -EB, for  better --help output.
1590         * target-select.cc: Include <cstdio>, "options.h", and
1591         "parameters.h".
1592         (Target_selector::do_target_bfd_name): New function.
1593         (print_output_format): New function.
1594         * target-select.h (class Target_selector): Update declarations.
1595         (Target_selector::target_bfd_name): New function.
1596         (print_output_format): Declare.
1597         * main.cc: Include "target-select.h".
1598         (main): Handle --print-output-format.
1599         * gold.cc: Include "target-select.h".
1600         (queue_initial_tasks): Handle --print-output-format when there are
1601         no input files.
1602         * parameters.cc (parameters_force_valid_target): Give a better
1603         error message if -EB/-EL does not match target.
1604         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1605         function.
1606
1607 2011-07-15  Ian Lance Taylor  <iant@google.com>
1608
1609         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1610         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1611         (Output_data_plt_i386::do_write): Write address of .dynamic
1612         section to first entry in .got.plt section.
1613         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1614         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1615         Initialize layout_.
1616         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1617         section to first entry in .got.plt section.
1618         * layout.h (Layout::dynamic_section): New function.
1619
1620 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1621
1622         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1623         to claim_file call.
1624         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1625         input_section_position_, and input_section_glob_.
1626         (read_layout_from_file): Call function section_ordering_specified.
1627         * layout.h (is_section_ordering_specified): New function.
1628         (section_ordering_specified): New function.
1629         (section_ordering_specified_): New boolean member.
1630         * main.cc(main): Call load_plugins after layout object is defined.
1631         * output.cc (Output_section::add_input_section): Use
1632         function section_ordering_specified to check if section ordering is
1633         needed.
1634         * output.cc (Output_section::add_relaxed_input_section): Use
1635         function section_ordering_specified to check if section ordering is
1636         needed.
1637         (Output_section::update_section_layout): New function.
1638         (Output_section::sort_attached_input_sections): Check if input section
1639         must be reordered.
1640         * output.h (Output_section::update_section_layout): New function.
1641         * plugin.cc (get_section_count): New function.
1642         (get_section_type): New function.
1643         (get_section_name): New function.
1644         (get_section_contents): New function.
1645         (update_section_order): New function.
1646         (allow_section_ordering): New function.
1647         (Plugin::load): Add the new interfaces to the transfer vector.
1648         (Plugin_manager::load_plugins): New parameter.
1649         (Plugin_manager::all_symbols_read): New parameter.
1650         (Plugin_manager::claim_file): New parameter. Save the elf object for
1651         unclaimed objects.
1652         (Plugin_manager::get_elf_object): New function.
1653         (Plugin_manager::get_view): Change to directly use the bool to check
1654         if get_view is called from claim_file_hook.
1655         * plugin.h (input_objects): New function
1656         (Plugin__manager::load_plugins): New parameter.
1657         (Plugin_manager::claim_file): New parameter.
1658         (Plugin_manager::get_elf_object): New function.
1659         (Plugin_manager::in_claim_file_handler): New function.
1660         (Plugin_manager::in_claim_file_handler_): New member.
1661         (layout): New function.
1662         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1663         handler with an extra parameter. Make the elf object before calling
1664         claim_file handler.
1665         * testsuite/plugin_test.c (get_section_count): New function pointer.
1666         (get_section_type): New function pointer.
1667         (get_section_name): New function pointer.
1668         (get_section_contents): New function pointer.
1669         (update_section_order): New function pointer.
1670         (allow_section_ordering): New function pointer.
1671         (onload): Check if the new interfaces exist.
1672
1673 2011-07-13  Ian Lance Taylor  <iant@google.com>
1674
1675         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1676         relro section.
1677         * x86_64.cc (Target_x86_64::got_section): Likewise.
1678         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1679         (relro_now_test_SOURCES): New variable.
1680         (relro_now_test_DEPENDENCIES): New variable.
1681         (relro_now_test_LDFLAGS): New variable.
1682         (relro_now_test_LDADD): New variable.
1683         (relro_now_test.so): New target.
1684         * testsuite/Makefile.in: Rebuild.
1685
1686 2011-07-12  Ian Lance Taylor  <iant@google.com>
1687
1688         PR gold/12980
1689         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1690         GLOB_DAT relocation rather than a RELATIVE relocation for a
1691         protected symbol when creating a shared library.
1692         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1693         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1694         * testsuite/protected_main_1.cc (main): Test that protected
1695         function has same address.
1696
1697 2011-07-11  Ian Lance Taylor  <iant@google.com>
1698
1699         PR gold/12979
1700         * options.h (class General_options): Add -Bgroup.
1701         * options.cc (General_options::finalize): If -Bgroup is set,
1702         default to --unresolved-symbols=report-all.
1703         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1704         * target-reloc.h (issue_undefined_symbol_error): Handle
1705         --unresolved-symbols=report-all.
1706
1707 2011-07-08  Ian Lance Taylor  <iant@google.com>
1708
1709         PR gold/11985
1710         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1711         if linker script discards key sections.
1712         (Layout::create_dynamic_symtab): Likewise.
1713         (Layout::assign_local_dynsym_offsets): Likewise.
1714         (Layout::sized_create_version_sections): Likewise.
1715         (Layout::create_interp): Likewise.
1716         (Layout::finish_dynamic_section): Likewise.
1717         (Layout::set_dynamic_symbol_size): Likewise.
1718
1719 2011-07-08  Ian Lance Taylor  <iant@google.com>
1720
1721         PR gold/12386
1722         * options.h (class General_options): Add --unresolved-symbols.
1723         * target-reloc.h (issue_undefined_symbol_error): Check
1724         --unresolved-symbols.  Add comments.
1725
1726 2011-07-08  Ian Lance Taylor  <iant@google.com>
1727
1728         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1729         expression more complex.
1730
1731 2011-07-08  Ian Lance Taylor  <iant@google.com>
1732
1733         PR gold/11317
1734         * target-reloc.h (issue_undefined_symbol_error): New inline
1735         function, broken out of relocate_section.
1736         (relocate_section): Call issue_undefined_symbol_error.
1737         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1738         there is no TLS segment if we are about to issue an undefined
1739         symbol error.
1740         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1741
1742 2011-07-08  Ian Lance Taylor  <iant@google.com>
1743
1744         PR gold/12279
1745         * resolve.cc (Symbol_table::should_override): Add fromtype
1746         parameter.  Change all callers.  Give error when linking together
1747         TLS and non-TLS symbol.
1748         (Symbol_table::should_override_with_special): Add fromtype
1749         parameter.  Change all callers.
1750         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1751         there is no TLS segment if we have reported some errors.
1752         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1753
1754 2011-07-08  Ian Lance Taylor  <iant@google.com>
1755
1756         PR gold/12372
1757         * target.h (Target::plt_address_for_global): New function.
1758         (Target::plt_address_for_local): New function.
1759         (Target::plt_section_for_global): Remove.
1760         (Target::plt_section_for_local): Remove.
1761         (Target::do_plt_address_for_global): New virtual function.
1762         (Target::do_plt_address_for_local): New virtual function.
1763         (Target::do_plt_section_for_global): Remove.
1764         (Target::do_plt_section_for_local): Remove.
1765         (Target::register_global_plt_entry): Add Symbol_table and Layout
1766         parameters.
1767         * output.cc (Output_data_got::Got_entry::write): Use
1768         plt_address_for_global and plt_address_for_local.
1769         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1770         address of output section.
1771         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1772         got_irelative_, and irelative_count_ fields.  Update
1773         declarations.
1774         (Output_data_plt_i386::has_irelative_section): New function.
1775         (Output_data_plt_i386::entry_count): Add irelative_count_.
1776         (Output_data_plt_i386::set_final_data_size): Likewise.
1777         (class Target_i386): Add got_irelative_ and rel_irelative_
1778         fields.  Update declarations.
1779         (Target_i386::Target_i386): Initialize new fields.
1780         (Target_i386::do_plt_address_for_global): New function replacing
1781         do_plt_section_for_global.
1782         (Target_i386::do_plt_address_for_local): New function replacing
1783         do_plt_section_for_local.
1784         (Target_i386::got_section): Create got_irelative_.
1785         (Target_i386::rel_irelative_section): New function.
1786         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1787         fields.  Don't define __rel_iplt_{start,end}.
1788         (Output_data_plt_i386::add_entry): Add symtab and layout
1789         parameters.  Change all callers.  Use different PLT and GOT for
1790         IFUNC symbols.
1791         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1792         layout parameters.  Change all callers.  Use different PLT and
1793         GOT.
1794         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1795         (Output_data_plt_i386::rel_irelative): New function.
1796         (Output_data_plt_i386::address_for_global): New function.
1797         (Output_data_plt_i386::address_for_local): New function.
1798         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1799         IRELATIVE GOT when changing IFUNC GOT entries.
1800         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1801         reloc.
1802         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1803         if we didn't create an IRELATIVE GOT.
1804         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1805         plt_address_for_local.
1806         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1807         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1808         got_irelative_, and irelative_count_ fields.  Update
1809         declarations.
1810         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1811         Initialize new fields.  Remove symtab parameter.  Change all
1812         callers.
1813         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1814         irelative_count_.
1815         (Output_data_plt_x86_64::has_irelative_section): New function.
1816         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1817         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1818         fields.  Update declarations.
1819         (Target_x86_64::Target_x86_64): Initialize new fields.
1820         (Target_x86_64::do_plt_address_for_global): New function replacing
1821         do_plt_section_for_global.
1822         (Target_x86_64::do_plt_address_for_local): New function replacing
1823         do_plt_section_for_local.
1824         (Target_x86_64::got_section): Create got_irelative_.
1825         (Target_x86_64::rela_irelative_section): New function.
1826         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1827         all callers.  Don't create __rel_iplt_{start,end}.
1828         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1829         parameters.  Change all callers.  Use different PLT and GOT for
1830         IFUNC symbols.
1831         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1832         layout parameters.  Change all callers.  Use different PLT and
1833         GOT.
1834         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1835         parameters.  Change all callers.  Use different PLT and GOT for
1836         IFUNC symbols.
1837         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1838         (Output_data_plt_x86_64::rela_irelative): New function.
1839         (Output_data_plt_x86_64::address_for_global): New function.
1840         (Output_data_plt_x86_64::address_for_local): New function.
1841         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1842         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1843         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1844         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1845         parameters.
1846         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1847         reloc.
1848         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1849         symbols if we didn't create an IRELATIVE GOT.
1850         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1851         plt_address_for_local.
1852         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1853         * testsuite/ifuncvar1.c: New test file.
1854         * testsuite/ifuncvar2.c: New test file.
1855         * testsuite/ifuncvar3.c: New test file.
1856         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1857         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1858         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1859         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1860         * testsuite/Makefile.in: Rebuild.
1861
1862 2011-07-07  Cary Coutant  <ccoutant@google.com>
1863
1864         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1865         (two_file_test_1_ndebug.o): Likewise.
1866         (two_file_test_1b_ndebug.o): Likewise.
1867         (two_file_test_2_ndebug.o): Likewise.
1868         (two_file_test_main_ndebug.o): Likewise.
1869         (incremental_test_2): Link with no-debug versions.
1870
1871 2011-07-06  Cary Coutant  <ccoutant@google.com>
1872
1873         * gold/incremental.cc
1874         (Output_section_incremental_inputs::write_info_blocks): Check for
1875         hidden and internal symbols.
1876
1877 2011-07-06  Cary Coutant  <ccoutant@google.com>
1878
1879         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1880         Check disposition for startup file.
1881         (Incremental_inputs::report_command_line): Ignore
1882         --incremental-startup-unchanged option.
1883         * options.cc (General_options::parse_incremental_startup_unchanged):
1884         New function.
1885         (General_options::General_options): Initialize new data member.
1886         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1887         (General_options): Add --incremental-startup-unchanged option.
1888         (General_options::incremental_startup_disposition): New function.
1889         (General_options::incremental_startup_disposition_): New data member.
1890
1891 2011-07-06  Cary Coutant  <ccoutant@google.com>
1892
1893         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1894         input file index to Script_info ctor.
1895         (Sized_incremental_binary::do_file_has_changed): Find the
1896         command-line argument for files named in scripts.
1897         * incremental.h (Script_info::Script_info): New ctor
1898         with input file index.
1899         (Script_info::input_file_index): New function.
1900         (Script_info::input_file_index_): New data member.
1901         (Incremental_binary::get_library): Add const.
1902         (Incremental_binary::get_script_info): Add const.
1903         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1904         * testsuite/Makefile.am (incremental_test_5): New test case.
1905         (incremental_test_6): New test case.
1906         * testsuite/Makefile.in: Regenerate.
1907
1908 2011-07-06  Cary Coutant  <ccoutant@google.com>
1909
1910         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1911         debug output when command lines differ.
1912
1913 2011-07-06  Cary Coutant  <ccoutant@google.com>
1914
1915         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1916         --incremental-patch option.
1917         * layout.cc (Free_list::allocate): Extend allocation beyond original
1918         end if enabled.
1919         (Layout::make_output_section): Mark sections that should get
1920         patch space.
1921         * options.cc (parse_percent): New function.
1922         * options.h (parse_percent): New function.
1923         (DEFINE_percent): New macro.
1924         (General_options): Add --incremental-patch option.
1925         * output.cc (Output_section::Output_section): Initialize new data
1926         members.
1927         (Output_section::add_input_section): Print section name when out
1928         of patch space.
1929         (Output_section::add_output_section_data): Likewise.
1930         (Output_section::set_final_data_size): Add patch space when
1931         doing --incremental-full.
1932         (Output_section::do_reset_address_and_file_offset): Remove patch
1933         space.
1934         (Output_segment::set_section_list_addresses): Print debug output
1935         only if --incremental-update.
1936         * output.h (Output_section::set_is_patch_space_allowed): New function.
1937         (Output_section::is_patch_space_allowed_): New data member.
1938         (Output_section::patch_space_): New data member.
1939         * parameters.cc (Parameters::incremental_full): New function.
1940         * parameters.h (Parameters::incremental_full): New function
1941         * testsuite/Makefile.am (incremental_test_2): Add test for
1942         --incremental-patch option.
1943         * testsuite/Makefile.in: Regenerate.
1944         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1945         (t18): Remove function body.
1946
1947 2011-07-05  Doug Kwan  <dougkwan@google.com>
1948
1949         PR gold/12771
1950         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1951         Arm_Address type for relocation result.
1952         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1953         overflow check.
1954         (Arm_relocate_functions::abs32): Use unaligned access.
1955         (Arm_relocate_functions::rel32): Ditto.
1956         (Arm_relocate_functions::prel31): Ditto.
1957         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1958         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1959         static data relocations.
1960         * testsuite/Makefile.in: Regnerate.
1961         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1962
1963 2011-07-05  Ian Lance Taylor  <iant@google.com>
1964
1965         PR gold/12392
1966         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1967         symbols if necessary.
1968         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1969
1970 2011-07-05  Ian Lance Taylor  <iant@google.com>
1971
1972         PR gold/12952
1973         * resolve.cc (Symbol::override_base_with_special): Simply override
1974         version with special symbol version, ignoring previous version.
1975
1976 2011-07-05  Ian Lance Taylor  <iant@google.com>
1977
1978         * object.cc (Sized_relobj_file::include_section_group): Add
1979         information to comment about signature location.
1980
1981 2011-07-02  Ian Lance Taylor  <iant@google.com>
1982
1983         PR gold/12957
1984         * options.h (class General_options): Add -f and -F.
1985         * options.cc (General_options::finalize): Fatal error if -f/-F
1986         are used without -shared.
1987         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1988
1989 2011-07-02  Ian Lance Taylor  <iant@google.com>
1990
1991         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1992
1993 2011-07-01  Ian Lance Taylor  <iant@google.com>
1994
1995         PR gold/12525
1996         PR gold/12952
1997         * resolve.cc (Symbol::override_base_with_special): Don't override
1998         the version if the overriding symbol has a different name.
1999         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2000         all callers.  If we give an error about an undefined version,
2001         define the base version if necessary.
2002         * dynobj.h (class Versions): Update declaration.
2003         * testsuite/weak_alias_test_5.cc: New file.
2004         * testsuite/weak_alias_test.script: New file.
2005         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2006         and versioned_alias have the right value, and call t2.
2007         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2008         weak_alias_test_5.so.
2009         (weak_alias_test_LDADD): Likewise.
2010         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2011         * testsuite/Makefile.in: Rebuild.
2012
2013 2011-07-01  Ian Lance Taylor  <iant@google.com>
2014
2015         PR gold/12525
2016         * options.h (class General_options): Support -z notext.
2017         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2018         -Wl,-z,notext.
2019         (two_file_shared_nonpic.so): Likewise.
2020         (two_file_shared_mixed.so): Likewise.
2021         (two_file_shared_mixed_1.so): Likewise.
2022         (weak_undef_lib_nonpic.so): Likewise.
2023         (alt/weak_undef_lib_nonpic.so): Likewise.
2024         (tls_test_shared_nonpic.so): Likewise.
2025         * testsuite/Makefile.in: Rebuild.
2026
2027 2011-07-01  Ian Lance Taylor  <iant@google.com>
2028
2029         PR gold/12525
2030         * configure.ac: Test whether static linking works, setting
2031         the automake conditional HAVE_STATIC.
2032         * testsuite/Makefile.am: Disable tests using -static if
2033         HAVE_STATIC is not true.
2034         * configure, testsuite/Makefile.in: Rebuild.
2035
2036 2011-07-01  Ian Lance Taylor  <iant@google.com>
2037
2038         PR gold/12525
2039         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2040         Assert if we see DW_EH_PE_indirect.
2041         * target.h (Target::ehframe_datarel_base): New function.
2042         (Target::do_ehframe_datarel_base): New target function.
2043         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2044         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2045         function.
2046
2047 2011-07-01  Ian Lance Taylor  <iant@google.com>
2048
2049         PR gold/12571
2050         * options.h (class General_options): Add
2051         --ld-generated-unwind-info.
2052         * ehframe.cc (Fde::write): Add address parameter.  Change all
2053         callers.  If associated with PLT, fill in address and size.
2054         (Cie::set_output_offset): Only add merge mapping if there is an
2055         object.
2056         (Cie::write): Add address parameter.  Change all callers.
2057         (Eh_frame::add_ehframe_for_plt): New function.
2058         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2059         input_offset_ fields into union u_, with new plt field.
2060         (Fde::Fde): Adjust for new union field.
2061         (Fde::Fde) [Output_data version]: New constructor.
2062         (Fde::add_mapping): Only add merge mapping if there is an object.
2063         (class Cie): Update declarations.
2064         (class Eh_frame): Declare add_ehframe_for_plt.
2065         * layout.cc (Layout::layout_eh_frame): Break out code into
2066         make_eh_frame_section, and call it.
2067         (Layout::make_eh_frame_section): New function.
2068         (Layout::add_eh_frame_for_plt): New function.
2069         * layout.h (class Layout): Update declarations.
2070         * merge.cc (Merge_map::add_mapping): Add assertion.
2071         * i386.cc: Include "dwarf.h".
2072         (class Output_data_plt_i386): Make first_plt_entry,
2073         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2074         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2075         and plt_eh_frame_fde.
2076         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2077         boundary.  Call add_eh_frame_for_plt if appropriate.
2078         * x86_64.cc: Include "dwarf.h".
2079         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2080         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2081         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2082         and plt_eh_frame_fde.
2083         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2084         appropriate.
2085
2086 2011-06-29  Ian Lance Taylor  <iant@google.com>
2087
2088         PR gold/12629
2089         * object.cc (Sized_relobj_file::layout_section): Change shdr
2090         parameter to be const.
2091         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2092         out of do_layout.
2093         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2094         appropriate.  Call layout_eh_frame_section.
2095         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2096         sections.
2097         * object.h (class Sized_relobj_file): Update declarations.
2098
2099 2011-06-29  Ian Lance Taylor  <iant@google.com>
2100
2101         PR gold/12652
2102         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2103         modifier.
2104         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2105
2106 2011-06-29  Ian Lance Taylor  <iant@google.com>
2107
2108         PR gold/12675
2109         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2110         SHT_X86_64_UNWIND.
2111         * layout.cc (Layout::layout_eh_frame): Likewise.
2112
2113 2011-06-29  Ian Lance Taylor  <iant@google.com>
2114
2115         PR gold/12695
2116         * layout.cc (Layout::symtab_section_shndx): New function.
2117         * layout.h (class Layout): Declare symtab_section_shndx.
2118         * output.cc (Output_section::write_header): Call it.
2119
2120 2011-06-29  Ian Lance Taylor  <iant@google.com>
2121
2122         PR gold/12818
2123         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2124         symbols which are not used in a relocation.
2125
2126 2011-06-28  Ian Lance Taylor  <iant@google.com>
2127
2128         PR gold/12898
2129         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2130         script create indistinguishable segments.
2131         (Layout::set_segment_offsets): Use stable_sort when sorting
2132         segments.  Pass this to Compare_segments constructor.
2133         * layout.h (class Layout): Make segment_precedes non-static.
2134         (class Compare_segments): Change from struct to class.  Add
2135         layout_ field.  Add constructor.
2136         * script-sections.cc
2137         (Script_sections::attach_sections_using_phdrs_clause): Rename
2138         local orphan to is_orphan.  Don't report failure to put empty
2139         section in segment.  On attachment failure, report name of
2140         section, and attach to first PT_LOAD segment.
2141
2142 2011-06-28  Ian Lance Taylor  <iant@google.com>
2143
2144         PR gold/12934
2145         * target-select.cc (Target_selector::Target_selector): Add
2146         emulation parameter.  Change all callers.
2147         (select_target_by_bfd_name): Rename from select_target_by_name.
2148         Change all callers.
2149         (select_target_by_emulation): New function.
2150         (supported_emulation_names): New function.
2151         * target-select.h (class Target_selector): Add emulation_ field.
2152         Update declarations.
2153         (Target_selector::recognize_by_bfd_name): Rename from
2154         recognize_by_name.  Change all callers.
2155         (Target_selector::supported_bfd_names): Rename from
2156         supported_names.  Change all callers.
2157         (Target_selector::recognize_by_emulation): New function.
2158         (Target_selector::supported_emulations): New function.
2159         (Target_selector::emulation): New function.
2160         (Target_selector::do_recognize_by_bfd_name): Rename from
2161         do_recognize_by_name.  Change all callers.
2162         (Target_selector::do_supported_bfd_names): Rename from
2163         do_supported_names.  Change all callers.
2164         (Target_selector::do_recognize_by_emulation): New function.
2165         (Target_selector::do_supported_emulations): New function.
2166         (select_target_by_bfd_name): Change name in declaration.
2167         (select_target_by_emulation): Declare.
2168         (supported_emulation_names): Declare.
2169         * parameters.cc (parameters_force_valid_target): Try to find
2170         target based on emulation from -m option.
2171         * options.h (class General_options): Change doc string for -m.
2172         * options.cc (help): Print emulations.
2173         (General_options::parse_V): Likewise.
2174         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2175         Add emulation parameter.  Change all callers.
2176
2177 2011-06-28  Ian Lance Taylor  <iant@google.com>
2178
2179         * target.h (class Target): Add osabi_ field.
2180         (Target::osabi): New function.
2181         (Target::set_osabi): New function.
2182         (Target::Target): Initialize osabi_.
2183         (Target::do_adjust_elf_header): Make pure virtual.
2184         (Sized_target::do_adjust_elf_header): Declare.
2185         * target.cc (Sized_target::do_adjust_elf_header): New function.
2186         (class Sized_target): Instantiate all versions.
2187         * freebsd.h (class Target_freebsd): Remove.
2188         (Target_selector_freebsd::do_recognize): Call set_osabi on
2189         Target.
2190         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2191         (Target_selector_freebsd::set_osabi): Remove.
2192         * i386.cc (class Target_i386): Inherit from Sized_target rather
2193         than Target_freebsd.
2194         * x86_64.cc (class Target_x86_64): Likewise.
2195
2196 2011-06-28  Ian Lance Taylor  <iant@google.com>
2197
2198         * target.h (Target::can_check_for_function_pointers): Rewrite.
2199         Make non-virtual.
2200         (Target::can_icf_inline_merge_sections): Likewise.
2201         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2202         (Target::Target_info): Add can_icf_inline_merge_sections field.
2203         (Target::do_can_check_for_function_pointers): New virtual
2204         function.
2205         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2206         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2207         from can_check_for_function_pointers, move in file.
2208         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2209         section_may_have_icf_unsafe_poineters, move in file.
2210         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2211         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2212         Rename from can_check_for_function_pointers, move in file.
2213         (Target_i386::can_icf_inline_merge_sections): Remove.
2214         (Target_i386::i386_info): Initialize
2215         can_icf_inline_merge_sections.
2216         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2217         Initialize can_icf_inline_merge_sections.
2218         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2219         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2220         Rename from can_check_for_function_pointers, move in file.
2221         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2222         (Target_x86_64::x86_64_info): Initialize
2223         can_icf_inline_merge_sections.
2224         * testsuite/testfile.cc (Target_test::test_target_info):
2225         Likewise.
2226         * icf.cc (get_section_contents): Correct formatting.
2227
2228 2011-06-27  Ian Lance Taylor  <iant@google.com>
2229
2230         * symtab.cc (Symbol::versioned_name): New function.
2231         (Symbol_table::add_to_final_symtab): Use versioned_name when
2232         appropriate.
2233         (Symbol_table::sized_write_symbol): Likewise.
2234         * symtab.h (class Symbol): Declare versioned_name.
2235         * stringpool.h (class Stringpool_template): Add variant of add
2236         which takes a std::basic_string.
2237         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2238         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2239         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2240         (ver_test_12.o): New target.
2241         * testsuite/Makefile.in: Rebuild.
2242
2243 2011-06-27  Doug Kwan  <dougkwan@google.com>
2244
2245         * arm.cc (Arm_relocate_functions::thm_jump8,
2246         Arm_relocate_functions::thm_jump11): Use a wider signed
2247         type to compute offset.
2248         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2249         arm_thm_jump8.
2250         * testsuite/Makefile.in: Regenerate.
2251         * testsuite/arm_branch_in_range.sh: Check test results of
2252         arm_thm_jump11 and arm_thm_jump8.
2253         * testsuite/arm_thm_jump11.s: New test source file.
2254         * testsuite/arm_thm_jump11.t: New linker script.
2255         * testsuite/arm_thm_jump8.s: New test source file.
2256         * testsuite/arm_thm_jump8.t: New linker script.
2257
2258 2011-06-24  Ian Lance Taylor  <iant@google.com>
2259
2260         * layout.cc: Include "object.h".
2261         (ctors_sections_in_init_array): New static variable.
2262         (Layout::is_ctors_in_init_array): New function.
2263         (Layout::layout): Add entry to ctors_sections_in_init_array if
2264         appropriate.
2265         * layout.h (class Layout): Declare is_ctors_in_init_array.
2266         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2267         is_ctors_reverse_view is set.
2268         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2269         all callers.  Set is_ctors_reverse_view field of View_size.
2270         (Sized_relobj_file::reverse_words): New function.
2271         * object.h (Sized_relobj_file::View_size): Add
2272         is_ctors_reverse_view field.
2273         (class Sized_relobj_file): Update declarations.
2274         * testsuite/initpri3.c: New test.
2275         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2276         initpri3b.
2277         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2278         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2279         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2280         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2281         * testsuite/Makefile.in: Rebuild.
2282
2283 2011-06-24  Cary Coutant  <ccoutant@google.com>
2284
2285         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2286         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2287         (debug_msg_cdebug.err): New targets.
2288         * testsuite/Makefile.in: Regenerate.
2289         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2290         Fix checks for link with shared library.
2291
2292 2011-06-24  Doug Kwan  <dougkwan@google.com>
2293
2294         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2295         skip empty text sections.
2296         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2297
2298 2011-06-22  Ian Lance Taylor  <iant@google.com>
2299
2300         PR gold/12910
2301         * options.h (class General_options): Add --ctors-in-init-array.
2302         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2303         friends as SHT_PROGBITS for merging sections.
2304         (Layout::layout): Remove special handling of .init_array and
2305         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2306         and .dtors if ctors_in_init_array.
2307         (Layout::make_output_section): Force correct section types for
2308         .init_array and friends.  Don't sort if doing relocatable link,
2309         Don't sort .ctors and .dtors if ctors_in_init_array.
2310         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2311         (Layout::output_section_name): Add relobj parameter.  Change all
2312         callers.  Handle .ctors. and .dtors. in code rather than table.
2313         Handle .ctors and .dtors if ctors_in_init_array.
2314         (Layout::match_file_name): New function, moved from output.cc.
2315         * layout.h (class Layout): Update declarations.
2316         * output.cc: Include "layout.h".
2317         (Input_section_sort_entry::get_priority): New function.
2318         (Input_section_sort_entry::match_file_name): Just call
2319         Layout::match_file_name.
2320         (Output_section::Input_section_sort_init_fini_compare::operator()):
2321         Handle .ctors and .dtors.  Sort by explicit priority rather than
2322         by name.
2323         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2324         * testsuite/initpri2.c: New test.
2325         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2326         (check_PROGRAMS): Add initpri2.
2327         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2328         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2329         * configure, testsuite/Makefile.in: Rebuild.
2330
2331 2011-06-19  Ian Lance Taylor  <iant@google.com>
2332
2333         PR gold/12880
2334         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2335         .interp section to a PT_INTERP segment even if we have seen a
2336         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2337         clause in a linker script.
2338         (Layout::finalize): Don't create a .interp section if we've
2339         already create a PT_INTERP segment.
2340         (Layout::create_interp): Always call choose_output_section (revert
2341         patch of 2011-06-17).  Don't create PT_INTERP segment.
2342         * script-sections.cc
2343         (Script_sections::create_note_and_tls_segments): Add a .interp
2344         section to a PT_INTERP segment even if we have seen a
2345         --dynamic-linker option.
2346
2347 2011-06-18  Ian Lance Taylor  <iant@google.com>
2348
2349         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2350         merely because a non-PT_LOAD segment has a dynamic reloc.
2351
2352 2011-06-18  Ian Lance Taylor  <iant@google.com>
2353
2354         * layout.cc (Layout::finish_dynamic_section): Don't create
2355         DT_FLAGS entry if not needed.
2356
2357 2011-06-18  Ian Lance Taylor  <iant@google.com>
2358
2359         PR gold/12745
2360         * layout.cc (Layout::layout_eh_frame): Correct handling of
2361         writable .eh_frame section.
2362
2363 2011-06-17  Ian Lance Taylor  <iant@google.com>
2364
2365         PR gold/12893
2366         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2367         symbol is redefined with the exact same object and value.
2368
2369 2011-06-17  Ian Lance Taylor  <iant@google.com>
2370
2371         PR gold/12880
2372         * layout.h (class Layout): Add interp_segment_ field.
2373         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2374         (Layout::attach_allocated_section_to_segment): If making shared
2375         library, put .interp section in PT_INTERP segment.
2376         (Layout::finalize): Also call create_interp if -dynamic-linker
2377         option was used.
2378         (Layout::create_interp): Assert that there is no PT_INTERP
2379         segment.  If not using a SECTIONS clause, use make_output_section.
2380         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2381         * script-sections.cc
2382         (Script_sections::create_note_and_tls_segments): If making shared
2383         library, put .interp section in PT_INTERP segment.
2384
2385 2011-06-17  Ian Lance Taylor  <iant@google.com>
2386
2387         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2388         when making a shared library.
2389
2390 2011-06-17  Ian Lance Taylor  <iant@google.com>
2391
2392         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2393         parameter.  Change all callers.  Don't issue warning about PC32
2394         against locally defined symbol.
2395
2396 2011-06-16  Ian Lance Taylor  <iant@google.com>
2397
2398         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2399         occurs in same object.
2400
2401 2011-06-14  Alan Modra  <amodra@gmail.com>
2402
2403         * po/POTFILES.in: Regenerate.
2404
2405 2011-06-09  Ian Lance Taylor  <iant@google.com>
2406
2407         * script-sections.cc
2408         (Orphan_output_section::set_section_addresses): For a relocatable
2409         link set address to 0.
2410
2411 2011-06-09  Cary Coutant  <ccoutant@google.com>
2412
2413         PR gold/12804
2414         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2415         used with --compress-debug-sections.
2416         * gold/object.cc (Sized_relobj_file::do_layout): Report
2417         uncompressed size of compressed input sections.
2418
2419 2011-06-08  Cary Coutant  <ccoutant@google.com>
2420
2421         PR gold/12804
2422         * testsuite/two_file_test_2_v1.cc: Change initialization of
2423         v2 to keep it in .data.
2424
2425 2011-06-07  Cary Coutant  <ccoutant@google.com>
2426
2427         * common.cc (Symbol_table::do_allocate_commons_list): Call
2428         gold_fallback.
2429         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2430         (Errors::fallback): New function.
2431         (gold_fallback): New function.
2432         * errors.h (Errors::fallback): New function.
2433         * gold.cc (gold_exit): Change status parameter to enum; adjust
2434         all callers.
2435         (queue_initial_tasks): Call gold_fallback.
2436         * gold.h: Include cstdlib.
2437         (Exit_status): New enum type.
2438         (gold_exit): Change status parameter to enum.
2439         (gold_fallback): New function.
2440         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2441         (Layout::create_symtab_sections): Likewise.
2442         (Layout::create_shdrs): Likewise.
2443         * main.cc (main): Adjust call to gold_exit.
2444         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2445         (Output_data_got::add_got_entry_pair): Likewise.
2446         (Output_section::add_input_section): Likewise.
2447         (Output_section::add_output_section_data): Likewise.
2448         (Output_segment::set_section_list_addresses): Likewise.
2449         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2450
2451 2011-06-07  Cary Coutant  <ccoutant@google.com>
2452
2453         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2454         for incremental links.
2455         * output.cc (Output_segment::set_section_list_addresses): Remove
2456         FIXME and test for TLS or BSS.
2457
2458 2011-06-07  Cary Coutant  <ccoutant@google.com>
2459
2460         * testsuite/Makefile.am: Add incremental_copy_test,
2461         incremental_common_test_1.
2462         * testsuite/Makefile.in: Regenerate.
2463         * testsuite/common_test_1_v1.c: New source file.
2464         * testsuite/common_test_1_v2.c: New source file.
2465         * testsuite/copy_test_v1.cc: New source file.
2466
2467 2011-06-07  Cary Coutant  <ccoutant@google.com>
2468
2469         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2470         update, allocate common from bss section's free list.
2471         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2472         linker-defined symbols.
2473         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2474         Skip GOT and PLT entries that are no longer referenced.
2475         (Output_section_incremental_inputs::write_info_blocks): Mark
2476         linker-defined symbols.
2477         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2478         * output.cc (Output_section::allocate): New function.
2479         * output.h (Output_section::allocate): New function.
2480         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2481         linker-defined symbols.
2482         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2483         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2484         (Symbol::init_base_output_data): Likewise.
2485         (Symbol::init_base_output_segment): Likewise.
2486         (Symbol::init_base_constant): Likewise.
2487         (Sized_symbol::init_output_data): Likewise.
2488         (Sized_symbol::init_output_segment): Likewise.
2489         (Sized_symbol::init_constant): Likewise.
2490         (Symbol_table::do_define_in_output_data): Likewise.
2491         (Symbol_table::do_define_in_output_segment): Likewise.
2492         (Symbol_table::do_define_as_constant): Likewise.
2493         * symtab.h (Symbol::is_predefined): New function.
2494         (Symbol::init_base_output_data): Add is_predefined parameter.
2495         (Symbol::init_base_output_segment): Likewise.
2496         (Symbol::init_base_constant): Likewise.
2497         (Symbol::is_predefined_): New data member.
2498         (Sized_symbol::init_output_data): Add is_predefined parameter.
2499         (Sized_symbol::init_output_segment): Likewise.
2500         (Sized_symbol::init_constant): Likewise.
2501         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2502
2503 2011-06-07  Cary Coutant  <ccoutant@google.com>
2504
2505         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2506         instead of emit_copy_reloc.
2507         (Copy_relocs::emit_copy_reloc): Refactor.
2508         (Copy_relocs::make_copy_reloc): New function.
2509         (Copy_relocs::add_copy_reloc): Remove.
2510         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2511         section.
2512         (Copy_relocs::make_copy_reloc): New function.
2513         (Copy_relocs::add_copy_reloc): Remove.
2514         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2515         unchanged input files.
2516         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2517         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2518         Reserve BSS space for COPY relocations.
2519         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2520         (Output_section_incremental_inputs::write_info_blocks): Record
2521         whether a symbol is copied from a shared object.
2522         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2523         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2524         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2525         (Incremental_input_entry_reader::get_output_symbol_index): Add
2526         is_copy parameter.
2527         (Incremental_binary::emit_copy_relocs): New function.
2528         (Incremental_binary::do_emit_copy_relocs): New function.
2529         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2530         new data member.
2531         (Sized_incremental_binary::add_copy_reloc): New function.
2532         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2533         (Sized_incremental_binary::Copy_reloc): New struct.
2534         (Sized_incremental_binary::Copy_relocs): New typedef.
2535         (Sized_incremental_binary::copy_relocs_): New data member.
2536         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2537         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2538         * target.h (Sized_target::emit_copy_reloc): New function.
2539         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2540
2541 2011-06-02  Cary Coutant  <ccoutant@google.com>
2542
2543         PR gold/12163
2544         * gold/archive.cc (Archive::Archive): Initialize new data member.
2545         (Archive::include_all_members): Return if archive has already been
2546         included.
2547         * gold/archive.h (Archive::include_all_members_): New data member.
2548
2549 2011-06-02  Nick Clifton  <nickc@redhat.com>
2550
2551         * dynobj.h: Fix spelling mistake in comment.
2552         * output.cc: Likewise.
2553
2554 2011-05-31  Doug Kwan  <dougkwan@google.com>
2555             Asier Llano
2556
2557         PR gold/12826
2558         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2559         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2560         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2561         redundant arm_exidx_test.so.
2562         * testsuite/Makefile.in: Regenerate.
2563         (check_SCRIPTS): Add pr12826.sh
2564         (check_DATA): Add pr12826.stdout
2565         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2566         * testsuite/pr12826.sh: New file.
2567         * testsuite/pr12826_1.s: Ditto.
2568         * testsuite/pr12826_1.s: Ditto.
2569
2570 2011-05-30  Ian Lance Taylor  <iant@google.com>
2571
2572         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2573         sections.
2574
2575 2011-05-29  Ian Lance Taylor  <iant@google.com>
2576
2577         PR gold/12804
2578         * testsuite/Makefile.am: Use different file name for two_file_test
2579         temporary file for each incremental test.
2580         * testsuite/Makefile.in: Rebuild.
2581
2582 2011-05-29  Ian Lance Taylor  <iant@google.com>
2583
2584         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2585         binary input file is empty.
2586
2587 2011-05-27  Ian Lance Taylor  <iant@google.com>
2588
2589         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2590         (ver_test_9.so): Likewise.
2591         * testsuite/Makefile.in: Rebuild.
2592
2593 2011-05-26 Cary Coutant  <ccoutant@google.com>
2594
2595         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2596         * incremental.cc (Incremental_inputs::report_input_section): Fix
2597         comment, indentation.
2598         (Incremental_inputs::report_comdat_group): New function.
2599         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2600         of data for incremental input file entry.
2601         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2602         group count, COMDAT group signatures.
2603         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2604         an unchanged input file.
2605         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2606         Initialize new data member.
2607         (Incremental_object_entry::add_comdat_group): New function.
2608         (Incremental_object_entry::get_comdat_group_count): New function.
2609         (Incremental_object_entry::get_comdat_signature_key): New function.
2610         (Incremental_object_entry::groups_): New data member.
2611         (Incremental_inputs::report_comdat_group): New function.
2612         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2613         data for incremental input file entry.
2614         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2615         (Incremental_input_entry_reader::get_input_section): Adjust size of
2616         data for incremental input file entry.
2617         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2618         (Incremental_input_entry_reader::get_comdat_group_signature): New
2619         function.
2620         * object.cc (Sized_relobj::include_section_group): Report kept
2621         COMDAT groups for incremental links.
2622
2623 2011-05-24  David Meyer  <pdox@google.com>
2624
2625         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2626         with name parameter.  Add found_name parameter.
2627         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2628         * dirsearch.h (class Dirsearch): Update declaration.
2629
2630 2011-05-24  Ian Lance Taylor  <iant@google.com>
2631
2632         * archive.cc (Library_base::should_include_member): Pull in object
2633         from archive if it defines the entry symbol.
2634         * parameters.cc (Parameters::entry): New function.
2635         * parameters.h (class Parameters): Declare entry.
2636         * output.h (class Output_file_header): Remove entry_ field.
2637         * output.cc (Output_file_header::Output_file_header): Remove entry
2638         parameter.  Change all callers.
2639         (Output_file_header::entry): Use parameters->entry.
2640         * gold.cc (queue_middle_tasks): Likewise.
2641         * plugin.cc (Plugin_hook::run): Likewise.
2642
2643 2011-05-24 Cary Coutant  <ccoutant@google.com>
2644
2645         * gold.cc (queue_initial_tasks): Pass incremental base filename
2646         to Output_file::open_base_file; don't print error message.
2647         * incremental-dump.cc (main): Adjust call to
2648         Output_file::open_for_modification.
2649         * incremental-dump.cc (main): Likewise.
2650         * incremental.cc (Incremental_inputs::report_command_line):
2651         Ignore --incremental-base option when comparing command lines.
2652         Ignore parameter when given as separate argument.
2653         * options.h (class General_options): Add --incremental-base.
2654         * output.cc (Output_file::Output_file):
2655         (Output_file::open_base_file): Add base_name and writable parameters;
2656         read base file into new file; print error message here.
2657         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2658         callers.
2659         * output.h (Output_file::open_for_modification): Rename to...
2660         (Output_file::open_base_file): ...this; add base_name and
2661         writable parameters; adjust all callers.
2662         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2663         callers.
2664         * testsuite/Makefile.am (incremental_test_4): Test
2665         --incremental-base.
2666         * testsuite/Makefile.in: Regenerate.
2667
2668 2011-05-24 Cary Coutant  <ccoutant@google.com>
2669
2670         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2671         incremental_test_4.
2672         * testsuite/Makefile.in: Regenerate.
2673         * testsuite/two_file_test_1_v1.cc: New test source file.
2674         * testsuite/two_file_test_1b_v1.cc: New test source file.
2675         * testsuite/two_file_test_2_v1.cc: New test source file.
2676
2677 2011-05-24 Cary Coutant  <ccoutant@google.com>
2678
2679         * dynobj.h (Dynobj::do_dynobj): New function.
2680         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2681         flag and soname for shared objects.
2682         * incremental.cc (Incremental_inputs::report_object): Make
2683         either Incremental_object_entry or Incremental_dynobj_entry; add
2684         soname to string table.
2685         (Incremental_inputs::report_input_section): Add assertion.
2686         (Output_section_incremental_inputs::set_final_data_size): Adjust
2687         type of input file entry for shared libraries; adjust size of
2688         shared library info entry.
2689         (Output_section_incremental_inputs::write_input_files): Write
2690         as_needed flag for shared libraries.
2691         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2692         of input file entry for shared libraries; write soname.
2693         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2694         soname from incremental info.
2695         * incremental.h (enum Incremental_input_flags): Add
2696         INCREMENTAL_INPUT_AS_NEEDED.
2697         (Incremental_input_entry::Incremental_input_entry): Initialize new
2698         data member.
2699         (Incremental_input_entry::set_as_needed): New function.
2700         (Incremental_input_entry::as_needed): New function.
2701         (Incremental_input_entry::do_dynobj_entry): New function.
2702         (Incremental_input_entry::as_needed_): New data member.
2703         (Incremental_object_entry::Incremental_object_entry): Don't check
2704         for shared library.
2705         (Incremental_object_entry::do_type): Likewise.
2706         (class Incremental_dynobj_entry): New class.
2707         (Incremental_input_entry_reader::as_needed): New function.
2708         (Incremental_input_entry_reader::get_soname): New function.
2709         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2710         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2711         size of shared library info entry.
2712         * layout.cc (Layout::finish_dynamic_section): Don't test for
2713         incremental link when adding DT_NEEDED entries.
2714         * object.h (Object::Object): Initialize new data member.
2715         (Object::dynobj): New function.
2716         (Object::set_as_needed): New function.
2717         (Object::as_needed): New function.
2718         (Object::do_dynobj): New function.
2719         (Object::as_needed_): New data member.
2720
2721 2011-05-24 Cary Coutant  <ccoutant@google.com>
2722
2723         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2724         info; adjust display of GOT entries.
2725         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2726         vector of input objects; remove file_status_.
2727         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2728         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2729         got_plt reader; call target hooks to reserve GOT entries.
2730         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2731         of input file info header and GOT info entry.
2732         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2733         relocation info.
2734         (Got_plt_view_info::got_descriptor): Remove.
2735         (Got_plt_view_info::sym_index): New data member.
2736         (Got_plt_view_info::input_index): New data member.
2737         (Local_got_offset_visitor::visit): Write input file index.
2738         (Global_got_offset_visitor::visit): Write 0 for input file index.
2739         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2740         with sym_index and input_index.
2741         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2742         incremental info GOT entry; replace got_descriptor with input_index.
2743         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2744         map from input file index to object.
2745         (Sized_relobj_incr::do_layout): Replace direct data member reference
2746         with accessor function.
2747         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2748         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2749         Adjust size of input file info header.
2750         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2751         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2752         (Incremental_input_entry_reader::get_input_section): Adjust size of
2753         input file info header.
2754         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2755         of incremental info GOT entry.
2756         (Incremental_got_plt_reader::get_got_desc): Remove.
2757         (Incremental_got_plt_reader::get_got_symndx): New function.
2758         (Incremental_got_plt_reader::get_got_input_index): New function.
2759         (Sized_incremental_binary::Sized_incremental_binary): Remove
2760         file_status_; add input_objects_.
2761         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2762         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2763         (Sized_incremental_binary::file_is_unchanged): Remove.
2764         (Sized_incremental_binary::set_input_object): New function.
2765         (Sized_incremental_binary::input_object): New function.
2766         (Sized_incremental_binary::file_status_): Remove.
2767         (Sized_incremental_binary::input_objects_): New data member.
2768         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2769         references.
2770         (Sized_relobj_incr::invalid_address): Move to base class.
2771         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2772         class.
2773         (Sized_relobj_incr::do_output_section_offset): Likewise.
2774         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2775         (Sized_relobj_incr::section_offsets_): Likewise.
2776         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2777         function.
2778         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2779         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2780         with accessor function.
2781         (Sized_relobj_file::do_layout): Likewise.
2782         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2783         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2784         (Sized_relobj_file::compute_final_local_value): Replace refs to
2785         section_offsets_ with accessor function.
2786         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2787         * object.h (Relobj::Relobj): Initialize new data members.
2788         (Relobj::add_dyn_reloc): New function.
2789         (Relobj::first_dyn_reloc): New function.
2790         (Relobj::dyn_reloc_count): New function.
2791         (Relobj::first_dyn_reloc_): New data member.
2792         (Relobj::dyn_reloc_count_): New data member.
2793         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2794         references.
2795         (Sized_relobj::Address): New typedef.
2796         (Sized_relobj::invalid_address): Move here from child class.
2797         (Sized_relobj::Sized_relobj): Initialize new data members.
2798         (Sized_relobj::sized_relobj): New function.
2799         (Sized_relobj::is_output_section_offset_invalid): Move here from
2800         child class.
2801         (Sized_relobj::get_output_section_offset): Likewise.
2802         (Sized_relobj::local_has_got_offset): Likewise.
2803         (Sized_relobj::local_got_offset): Likewise.
2804         (Sized_relobj::set_local_got_offset): Likewise.
2805         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2806         (Sized_relobj::clear_got_offsets): New function.
2807         (Sized_relobj::section_offsets): Move here from child class.
2808         (Sized_relobj::do_output_section_offset): Likewise.
2809         (Sized_relobj::do_set_section_offset): Likewise.
2810         (Sized_relobj::Local_got_offsets): Likewise.
2811         (Sized_relobj::local_got_offsets_): Likewise.
2812         (Sized_relobj::section_offsets_): Likewise.
2813         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2814         references.
2815         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2816         class.
2817         (Sized_relobj_file::sized_relobj): New function
2818         (Sized_relobj_file::local_has_got_offset): Move to base class.
2819         (Sized_relobj_file::local_got_offset): Likewise.
2820         (Sized_relobj_file::set_local_got_offset): Likewise.
2821         (Sized_relobj_file::get_output_section_offset): Likewise.
2822         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2823         (Sized_relobj_file::do_output_section_offset): Likewise.
2824         (Sized_relobj_file::do_set_section_offset): Likewise.
2825         (Sized_relobj_file::Local_got_offsets): Likewise.
2826         (Sized_relobj_file::local_got_offsets_): Likewise.
2827         (Sized_relobj_file::section_offsets_): Likewise.
2828         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2829         (all constructors).
2830         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2831         (Output_reloc::get_symbol_index): Likewise.
2832         (Output_reloc::local_section_offset): Likewise.
2833         (Output_reloc::get_address): Likewise.
2834         (Output_reloc::symbol_value): Likewise.
2835         (Output_data_got::reserve_slot): Move to class definition.
2836         (Output_data_got::reserve_local): New function.
2837         (Output_data_got::reserve_slot_for_global): Remove.
2838         (Output_data_got::reserve_global): New function.
2839         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2840         (all constructors, two instantiations).
2841         (Output_reloc::get_relobj): New function (two instantiations).
2842         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2843         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2844         (Output_data_reloc::add_global): Adjust type of relobj.
2845         (Output_data_reloc::add_global_relative): Likewise.
2846         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2847         (Output_data_reloc::add_local): Likewise.
2848         (Output_data_reloc::add_local_relative): Likewise.
2849         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2850         (Output_data_reloc::add_local_section): Likewise.
2851         (Output_data_reloc::add_output_section): Likewise.
2852         (Output_data_reloc::add_absolute): Likewise.
2853         (Output_data_reloc::add_target_specific): Likewise.
2854         (Output_data_got::reserve_slot): Move definition here.
2855         (Output_data_got::reserve_local): New function.
2856         (Output_data_got::reserve_global): New function.
2857         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2858         section_offsets_ with accessor function.
2859         (Sized_relobj_file::write_sections): Likewise.
2860         (Sized_relobj_file::do_relocate_sections): Likewise.
2861         * target.h (Sized_target::reserve_local_got_entry): New function.
2862         (Sized_target::reserve_global_got_entry): New function.
2863         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2864         (Target_x86_64::reserve_global_got_entry): New function.
2865         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2866
2867 2011-05-23 Cary Coutant  <ccoutant@google.com>
2868
2869         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2870         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2871         bit when checking got_type.
2872         * incremental.cc (Sized_incremental_binary::setup_readers):
2873         Store symbol table and string table locations; initialize bit vector
2874         of file status flags.
2875         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2876         unchanged files.
2877         (Sized_incremental_binary::do_process_got_plt): New function.
2878         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2879         (Output_section_incremental_inputs::set_final_data_size): Record
2880         file index for each input file.
2881         (Output_section_incremental_inputs::write_got_plt): Store file index
2882         instead of input entry offset for each GOT entry.
2883         * incremental.h
2884         (Incremental_input_entry::Incremental_input_entry): Initialize new
2885         data member.
2886         (Incremental_input_entry::set_offset): Store file index.
2887         (Incremental_input_entry::get_file_index): New function.
2888         (Incremental_input_entry::file_index_): New data member.
2889         (Incremental_binary::process_got_plt): New function.
2890         (Incremental_binary::do_process_got_plt): New function.
2891         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2892         data members.
2893         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2894         (Sized_incremental_binary::set_file_is_unchanged): New function.
2895         (Sized_incremental_binary::file_is_unchanged): New function.
2896         (Sized_incremental_binary::do_process_got_plt): New function.
2897         (Sized_incremental_binary::file_status_): New data member.
2898         (Sized_incremental_binary::main_symtab_loc_): New data member.
2899         (Sized_incremental_binary::main_strtab_loc_): New data member.
2900         * output.cc (Output_data_got::Got_entry::write): Add case
2901         RESERVED_CODE.
2902         (Output_data_got::add_global): Call add_got_entry.
2903         (Output_data_got::add_global_plt): Likewise.
2904         (Output_data_got::add_global_with_rel): Likewise.
2905         (Output_data_got::add_global_with_rela): Likewise.
2906         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2907         (Output_data_got::add_global_pair_with_rela): Likewise.
2908         (Output_data_got::add_local): Call add_got_entry.
2909         (Output_data_got::add_local_plt): Likewise.
2910         (Output_data_got::add_local_with_rel): Likewise.
2911         (Output_data_got::add_local_with_rela): Likewise.
2912         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2913         (Output_data_got::add_local_pair_with_rela): Likewise.
2914         (Output_data_got::reserve_slot): New function.
2915         (Output_data_got::reserve_slot_for_global): New function.
2916         (Output_data_got::add_got_entry): New function.
2917         (Output_data_got::add_got_entry_pair): New function.
2918         (Output_section::add_output_section_data): Edit FIXME.
2919         * output.h
2920         (Output_section_data_build::Output_section_data_build): New
2921         constructor with size parameter.
2922         (Output_data_space::Output_data_space): Likewise.
2923         (Output_data_got::Output_data_got): Initialize new data member; new
2924         constructor with size parameter.
2925         (Output_data_got::add_constant): Call add_got_entry.
2926         (Output_data_got::reserve_slot): New function.
2927         (Output_data_got::reserve_slot_for_global): New function.
2928         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2929         (Output_data_got::add_got_entry): New function.
2930         (Output_data_got::add_got_entry_pair): New function.
2931         (Output_data_got::free_list_): New data member.
2932         * target.h (Sized_target::init_got_plt_for_update): New function.
2933         (Sized_target::register_global_plt_entry): New function.
2934         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2935         Initialize new data member; call init; add constructor with PLT count.
2936         (Output_data_plt_x86_64::init): New function.
2937         (Output_data_plt_x86_64::add_relocation): New function.
2938         (Output_data_plt_x86_64::reserve_slot): New function.
2939         (Output_data_plt_x86_64::free_list_): New data member.
2940         (Target_x86_64::init_got_plt_for_update): New function.
2941         (Target_x86_64::register_global_plt_entry): New function.
2942         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2943         incremental updates.
2944         (Output_data_plt_x86_64::add_relocation): New function.
2945         * testsuite/object_unittest.cc (Object_test): Set default options.
2946
2947 2011-05-16  Ian Lance Taylor  <iant@google.com>
2948
2949         * options.h (class General_options): Make -i a synonym for -r.
2950
2951 2011-05-16  Ian Lance Taylor  <iant@google.com>
2952
2953         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2954
2955 2011-05-10 Cary Coutant  <ccoutant@google.com>
2956
2957         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2958         strip_all (-s).
2959
2960 2011-05-06  Ian Lance Taylor  <iant@google.com>
2961
2962         * layout.cc (Layout::layout): If the output section flags change,
2963         update the ordering.
2964
2965 2011-04-25 Cary Coutant  <ccoutant@google.com>
2966
2967         * incremental-dump.cc (dump_incremental_inputs): Print local
2968         symbol info for each input file.
2969         * incremental.cc
2970         (Output_section_incremental_inputs::set_final_data_size): Add local
2971         symbol info to input file entries in incremental info.
2972         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2973         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2974         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2975         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2976         implementation.
2977         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2978         (Sized_incr_relobj::do_relocate): Write the local symbols.
2979         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2980         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2981         Adjust size of input file header.
2982         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2983         (Incremental_inputs_reader::get_local_symbol_count): New function.
2984         (Incremental_inputs_reader::get_input_section): Adjust size of input
2985         file header.
2986         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2987         (Sized_incr_relobj::This): New typedef.
2988         (Sized_incr_relobj::sym_size): New const data member.
2989         (Sized_incr_relobj::Local_symbol): New struct.
2990         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2991         (Sized_incr_relobj::do_local_symbol_offset): New function.
2992         (Sized_incr_relobj::local_symbol_count_): New data member.
2993         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2994         (Sized_incr_relobj::local_symbol_index_): New data member.
2995         (Sized_incr_relobj::local_symbol_offset_): New data member.
2996         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2997         (Sized_incr_relobj::local_symbols_): New data member.
2998         * object.h (Relobj::output_local_symbol_count): New function.
2999         (Relobj::local_symbol_offset): New function.
3000         (Relobj::do_output_local_symbol_count): New function.
3001         (Relobj::do_local_symbol_offset): New function.
3002         (Sized_relobj::do_output_local_symbol_count): New function.
3003         (Sized_relobj::do_local_symbol_offset): New function.
3004
3005 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3006
3007         * descriptors.cc (set_close_on_exec): New function.
3008         (Descriptors::open): Use set_close_on_exec.
3009         * output.cc (S_ISLNK): Define if not defined.
3010
3011 2011-04-22 Cary Coutant  <ccoutant@google.com>
3012
3013         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3014         global symbol map.
3015         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3016         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3017         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3018         relocations.
3019         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3020         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3021         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3022         * incremental.h
3023         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3024         function.
3025         (Incremental_binary::apply_incremental_relocs): New function.
3026         (Incremental_binary::do_apply_incremental_relocs): New function.
3027         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3028         data member.
3029         (Sized_incremental_binary::add_global_symbol): New function.
3030         (Sized_incremental_binary::global_symbol): New function.
3031         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3032         (Sized_incremental_binary::symbol_map_): New data member.
3033         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3034         * target.h (Sized_target::apply_relocation): New function.
3035         * target-reloc.h (apply_relocation): New function.
3036         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3037
3038 2011-04-22  Doug Kwan  <dougkwan@google.com>
3039
3040         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3041         flag of a SHT_ARM_EXIDX section.
3042         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3043         * testsuite/Makefile.in: Regenerate.
3044         * testsuite/arm_exidx_test.s: New file.
3045         * testsuite/arm_exidx_test.sh: Same.
3046
3047 2011-04-20 Cary Coutant  <ccoutant@google.com>
3048
3049         PR gold/12689
3050         * archive.h (Incremental_archive_entry::Archive_member):
3051         Initialize arg_serial_ (second constructor).
3052
3053 2011-04-17  Ian Lance Taylor  <iant@google.com>
3054
3055         * object.cc (Relocate_info::location): Simplify location string.
3056         * errors.cc (Errors::error_at_location): Don't print program
3057         name.
3058         (Errors::warning_at_location): Likewise.
3059         (Errors::undefined_symbol): Likewise.
3060         * testsuite/debug_msg.sh: Update accordingly.
3061
3062 2011-04-14 Cary Coutant  <ccoutant@google.com>
3063
3064         * gold/layout.cc (Layout::symtab_section_offset): New function.
3065         * gold/layout.h (Layout::symtab_section_offset): New function.
3066         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3067
3068 2011-04-12  Ian Lance Taylor  <iant@google.com>
3069
3070         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3071         with MREMAP_MAYMOVE.
3072         * output.h (class Output_file): Add map_is_allocated_ field.
3073         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3074         not available, provide stubs.  If mremap is not available, #define
3075         it to gold_mremap.
3076         (MREMAP_MAYMOVE): Define if not defined.
3077         (Output_file::Output_file): Initialize map_is_allocated_.
3078         (Output_file::resize): Check map_is_allocated_.
3079         (Output_file::map_anonymous): If mmap fails, use malloc.
3080         (Output_file::unmap): Don't do anything for an anonymous map.
3081         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3082         is not available, provide stubs.
3083         (File_read::View::~View): Use free rather than delete[].
3084         (File_read::make_view): Use malloc rather than new[].  If mmap
3085         fails, use malloc.
3086         (File_read::find_or_make_view): Use malloc rather than new[].
3087         * gold.h: Remove HAVE_REMAP code.
3088         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3089         exists.  Rename mremap to gold_mremap.  If mmap is not available
3090         don't do anything.
3091         * configure, config.in: Rebuild.
3092
3093 2011-04-11  Ian Lance Taylor  <iant@google.com>
3094
3095         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3096         initialize local variable v.
3097
3098 2011-04-11  Cary Coutant  <ccoutant@google.com>
3099
3100         * archive.cc (Archive::include_member): Adjust call to
3101         report_object.
3102         (Add_archive_symbols::run): Track argument serial numbers.
3103         (Lib_group::include_member): Likewise.
3104         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3105         * archive.h (Incremental_archive_entry::Archive_member):
3106         Initialize arg_serial_.
3107         (Archive_member::arg_serial_): New data member.
3108         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3109         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3110         incremental link.
3111         (Sized_dynobj::do_for_all_local_got_entries): New function.
3112         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3113         function.
3114         * fileread.cc (get_mtime): New function.
3115         * fileread.h (get_mtime): New function.
3116         * gold.cc (queue_initial_tasks): Check for incremental update.
3117         (process_incremental_input): New function.
3118         (queue_middle_tasks): Don't force valid target for incremental
3119         update.
3120         * incremental-dump.cc (find_input_containing_global): Adjust
3121         size of symbol info entry.
3122         (dump_incremental_inputs): Dump argument serial number and
3123         in_system_directory flag; bias shndx by 1; print symbol names
3124         when dumping per-file symbol lists; use new symbol info readers.
3125         * incremental.cc
3126         (Output_section_incremental_inputs:update_data_size): New function.
3127         (Sized_incremental_binary::setup_readers): Setup input readers
3128         for each input file; build maps for files added from libraries
3129         and scripts.
3130         (Sized_incremental_binary::check_input_args): New function.
3131         (Sized_incremental_binary::do_check_inputs): Build map of argument
3132         serial numbers to input arguments.
3133         (Sized_incremental_binary::do_file_has_changed): Rename
3134         do_file_is_unchanged to this; compare file modification times.
3135         (Sized_incremental_binary::do_init_layout): New function.
3136         (Sized_incremental_binary::do_reserve_layout): New function.
3137         (Sized_incremental_binary::do_get_input_reader): Remove.
3138         (Sized_incremental_binary::get_symtab_view): New function.
3139         (Incremental_checker::can_incrementally_link_output_file): Remove.
3140         (Incremental_inputs::report_command_line): Exclude --debug options.
3141         (Incremental_inputs::report_archive_begin): Add parameter; track
3142         argument serial numbers; don't put input file entry for archive
3143         before archive members.
3144         (Incremental_inputs::report_archive_end): Put input file entry
3145         for archive after archive members.
3146         (Incremental_inputs::report_object): Add parameter; track argument
3147         serial numbers and in_system_directory flag.
3148         (Incremental_inputs::report_script): Add parameter; track argument
3149         serial numbers.
3150         (Output_section_incremental_inputs::set_final_data_size): Adjust
3151         size of symbol info entry; check for forwarding symbols.
3152         (Output_section_incremental_inputs::write_input_files): Write
3153         in_system_directory flag and argument serial number.
3154         (Output_section_incremental_inputs::write_info_blocks): Map section
3155         indices between incremental info and original input file; store
3156         input section index for each symbol.
3157         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3158         change operator() to visit().
3159         (class Global_got_offset_visitor): Likewise.
3160         (class Global_symbol_visitor_got_plt):
3161         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3162         classes.
3163         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3164         (Sized_incr_relobj::do_read_symbols): New function.
3165         (Sized_incr_relobj::do_layout): New function.
3166         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3167         (Sized_incr_relobj::do_add_symbols): New function.
3168         (Sized_incr_relobj::do_should_include_member): New function.
3169         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3170         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3171         (Sized_incr_relobj::do_section_size): New function.
3172         (Sized_incr_relobj::do_section_name): New function.
3173         (Sized_incr_relobj::do_section_contents): New function.
3174         (Sized_incr_relobj::do_section_flags): New function.
3175         (Sized_incr_relobj::do_section_entsize): New function.
3176         (Sized_incr_relobj::do_section_address): New function.
3177         (Sized_incr_relobj::do_section_type): New function.
3178         (Sized_incr_relobj::do_section_link): New function.
3179         (Sized_incr_relobj::do_section_info): New function.
3180         (Sized_incr_relobj::do_section_addralign): New function.
3181         (Sized_incr_relobj::do_initialize_xindex): New function.
3182         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3183         (Sized_incr_relobj::do_read_relocs): New function.
3184         (Sized_incr_relobj::do_gc_process_relocs): New function.
3185         (Sized_incr_relobj::do_scan_relocs): New function.
3186         (Sized_incr_relobj::do_count_local_symbols): New function.
3187         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3188         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3189         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3190         (Sized_incr_relobj::do_relocate): New function.
3191         (Sized_incr_relobj::do_set_section_offset): New function.
3192         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3193         (Sized_incr_dynobj::do_read_symbols): New function.
3194         (Sized_incr_dynobj::do_layout): New function.
3195         (Sized_incr_dynobj::do_add_symbols): New function.
3196         (Sized_incr_dynobj::do_should_include_member): New function.
3197         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3198         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3199         (Sized_incr_dynobj::do_section_size): New function.
3200         (Sized_incr_dynobj::do_section_name): New function.
3201         (Sized_incr_dynobj::do_section_contents): New function.
3202         (Sized_incr_dynobj::do_section_flags): New function.
3203         (Sized_incr_dynobj::do_section_entsize): New function.
3204         (Sized_incr_dynobj::do_section_address): New function.
3205         (Sized_incr_dynobj::do_section_type): New function.
3206         (Sized_incr_dynobj::do_section_link): New function.
3207         (Sized_incr_dynobj::do_section_info): New function.
3208         (Sized_incr_dynobj::do_section_addralign): New function.
3209         (Sized_incr_dynobj::do_initialize_xindex): New function.
3210         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3211         (make_sized_incremental_object): New function.
3212         (Incremental_library::copy_unused_symbols): New function.
3213         (Incremental_library::do_for_all_unused_symbols): New function.
3214         * incremental.h (enum Incremental_input_flags): New type.
3215         (class Incremental_checker): Remove.
3216         (Incremental_input_entry::Incremental_input_entry): Add argument
3217         serial number.
3218         (Incremental_input_entry::arg_serial): New function.
3219         (Incremental_input_entry::set_is_in_system_directory): New function.
3220         (Incremental_input_entry::is_in_system_directory): New function.
3221         (Incremental_input_entry::arg_serial_): New data member.
3222         (Incremental_input_entry::is_in_system_directory_): New data member.
3223         (class Script_info): Move here from script.h.
3224         (Script_info::Script_info): Add filename parameter.
3225         (Script_info::filename): New function.
3226         (Script_info::filename_): New data member.
3227         (Incremental_script_entry::Incremental_script_entry): Add argument
3228         serial number.
3229         (Incremental_object_entry::Incremental_object_entry): Likewise.
3230         (Incremental_object_entry::add_input_section): Build list of input
3231         sections with map to original shndx.
3232         (Incremental_object_entry::get_input_section_index): New function.
3233         (Incremental_object_entry::shndx_): New data member.
3234         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3235         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3236         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3237         serial number.
3238         (Incremental_inputs::report_archive_begin): Likewise.
3239         (Incremental_inputs::report_object): Likewise.
3240         (Incremental_inputs::report_script): Likewise.
3241         (class Incremental_global_symbol_reader): New class.
3242         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3243         and store flags and input file type.
3244         (Incremental_input_entry_reader::arg_serial): New function.
3245         (Incremental_input_entry_reader::type): Extract type from flags.
3246         (Incremental_input_entry_reader::is_in_system_directory): New function.
3247         (Incremental_input_entry_reader::get_input_section_count): Call
3248         accessor function for type.
3249         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3250         function for type; adjust size of global symbol entry.
3251         (Incremental_input_entry_reader::get_global_symbol_count): Call
3252         accessor function for type.
3253         (Incremental_input_entry_reader::get_object_count): Likewise.
3254         (Incremental_input_entry_reader::get_object_offset): Likewise.
3255         (Incremental_input_entry_reader::get_member_count): Likewise.
3256         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3257         (Incremental_input_entry_reader::get_member_offset): Likewise.
3258         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3259         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3260         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3261         (Incremental_input_entry_reader::get_global_symbol_reader): New
3262         function.
3263         (Incremental_input_entry_reader::get_output_symbol_index): New
3264         function.
3265         (Incremental_input_entry_reader::type_): Remove.
3266         (Incremental_input_entry_reader::flags_): New data member.
3267         (Incremental_inputs_reader::input_file_offset): New function.
3268         (Incremental_inputs_reader::input_file_index): New function.
3269         (Incremental_inputs_reader::input_file): Call input_file_offset.
3270         (Incremental_inputs_reader::input_file_at_offset): New function.
3271         (Incremental_relocs_reader::get_r_type): Reformat.
3272         (Incremental_relocs_reader::get_r_shndx): Reformat.
3273         (Incremental_relocs_reader::get_r_offset): Reformat.
3274         (Incremental_relocs_reader::data): New function.
3275         (Incremental_binary::Incremental_binary): Initialize new data members.
3276         (Incremental_binary::check_inputs): Add cmdline parameter.
3277         (Incremental_binary::file_is_unchanged): Remove.
3278         (Input_reader::arg_serial): New function.
3279         (Input_reader::get_unused_symbol_count): New function.
3280         (Input_reader::get_unused_symbol): New function.
3281         (Input_reader::do_arg_serial): New function.
3282         (Input_reader::do_get_unused_symbol_count): New function.
3283         (Input_reader::do_get_unused_symbol): New function.
3284         (Incremental_binary::input_file_count): New function.
3285         (Incremental_binary::get_input_reader): Change signature to use
3286         index instead of filename.
3287         (Incremental_binary::file_has_changed): New function.
3288         (Incremental_binary::get_input_argument): New function.
3289         (Incremental_binary::get_library): New function.
3290         (Incremental_binary::get_script_info): New function.
3291         (Incremental_binary::init_layout): New function.
3292         (Incremental_binary::reserve_layout): New function.
3293         (Incremental_binary::output_file): New function.
3294         (Incremental_binary::do_check_inputs): New function.
3295         (Incremental_binary::do_file_is_unchanged): Remove.
3296         (Incremental_binary::do_file_has_changed): New function.
3297         (Incremental_binary::do_init_layout): New function.
3298         (Incremental_binary::do_reserve_layout): New function.
3299         (Incremental_binary::do_input_file_count): New function.
3300         (Incremental_binary::do_get_input_reader): Change signature.
3301         (Incremental_binary::input_args_map_): New data member.
3302         (Incremental_binary::library_map_): New data member.
3303         (Incremental_binary::script_map_): New data member.
3304         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3305         new data members.
3306         (Sized_incremental_binary::output_section): New function.
3307         (Sized_incremental_binary::inputs_reader): Add const.
3308         (Sized_incremental_binary::symtab_reader): Add const.
3309         (Sized_incremental_binary::relocs_reader): Add const.
3310         (Sized_incremental_binary::got_plt_reader): Add const.
3311         (Sized_incremental_binary::get_symtab_view): New function.
3312         (Sized_incremental_binary::Inputs_reader): New typedef.
3313         (Sized_incremental_binary::Input_entry_reader): New typedef.
3314         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3315         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3316         (Sized_incremental_binary::do_file_has_changed): New function.
3317         (Sized_incremental_binary::do_init_layout): New function.
3318         (Sized_incremental_binary::do_reserve_layout): New function.
3319         (Sized_input_reader::Inputs_reader): Remove.
3320         (Sized_input_reader::Input_entry_reader): Remove.
3321         (Sized_input_reader::do_arg_serial): New function.
3322         (Sized_input_reader::do_get_unused_symbol_count): New function.
3323         (Sized_input_reader::do_get_unused_symbol): New function.
3324         (Sized_incremental_binary::do_input_file_count): New function.
3325         (Sized_incremental_binary::do_get_input_reader): Change signature;
3326         use index instead of filename.
3327         (Sized_incremental_binary::section_map_): New data member.
3328         (Sized_incremental_binary::input_entry_readers_): New data member.
3329         (class Sized_incr_relobj): New class.
3330         (class Sized_incr_dynobj): New class.
3331         (make_sized_incremental_object): New function.
3332         (class Incremental_library): New class.
3333         * layout.cc (Free_list::num_lists): New static data member.
3334         (Free_list::num_nodes): New static data member.
3335         (Free_list::num_removes): New static data member.
3336         (Free_list::num_remove_visits): New static data member.
3337         (Free_list::num_allocates): New static data member.
3338         (Free_list::num_allocate_visits): New static data member.
3339         (Free_list::init): New function.
3340         (Free_list::remove): New function.
3341         (Free_list::allocate): New function.
3342         (Free_list::dump): New function.
3343         (Free_list::print_stats): New function.
3344         (Layout_task_runner::run): Resize output file for incremental updates.
3345         (Layout::Layout): Initialize new data members.
3346         (Layout::set_incremental_base): New function.
3347         (Layout::init_fixed_output_section): New function.
3348         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3349         incremental updates.
3350         (Layout::create_gold_note): Do not create gold note section for
3351         incremental updates.
3352         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3353         for incremental updates.
3354         (Layout::set_section_offsets): For incremental updates, allocate space
3355         from free list.
3356         (Layout::create_symtab_sections): Layout with offsets relative to
3357         start of section; for incremental updates, allocate space from free
3358         list.
3359         (Layout::create_shdrs): For incremental updates, allocate space from
3360         free list.
3361         (Layout::finish_dynamic_section): For incremental updates, do not
3362         check --as-needed (fixed in subsequent patch).
3363         * layout.h (class Free_list): New class.
3364         (Layout::set_incremental_base): New function.
3365         (Layout::incremental_base): New function.
3366         (Layout::init_fixed_output_section): New function.
3367         (Layout::allocate): New function.
3368         (Layout::incremental_base_): New data member.
3369         (Layout::free_list_): New data member.
3370         * main.cc (main): Print Free_list statistics.
3371         * object.cc (Relobj::finalize_incremental_relocs): Add
3372         clear_counts parameter; clear counts only when clear_counts is set.
3373         (Sized_relobj::Sized_relobj): Initialize new base class.
3374         (Sized_relobj::do_layout): Don't report special sections.
3375         (Sized_relobj::do_for_all_local_got_entries): New function.
3376         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3377         symtab_off to all symbol table offsets.
3378         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3379         * object.h (class Got_offset_list): Move to top of file.
3380         (Object::Object): Allow case where input_file == NULL.
3381         (Object::~Object): Likewise.
3382         (Object::input_file): Assert that input_file != NULL.
3383         (Object::lock): Allow case where input_file == NULL.
3384         (Object::unlock): Likewise.
3385         (Object::is_locked): Likewise.
3386         (Object::token): Likewise.
3387         (Object::release): Likewise.
3388         (Object::is_incremental): New function.
3389         (Object::get_mtime): New function.
3390         (Object::for_all_local_got_entries): New function.
3391         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3392         (Object::set_is_in_system_directory): New function.
3393         (Object::is_in_system_directory): New function.
3394         (Object::do_is_incremental): New function.
3395         (Object::do_get_mtime): New function.
3396         (Object::do_for_all_local_got_entries): New function.
3397         (Object::is_in_system_directory_): New data member.
3398         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3399         (class Sized_relobj_base): New class.
3400         (class Sized_relobj): Derive from Sized_relobj_base.
3401         (class Sized_relobj::Symbols): Redeclare from base class.
3402         (class Sized_relobj::local_got_offset_list): Remove.
3403         (class Sized_relobj::Output_sections): Redeclare from base class.
3404         (class Sized_relobj::do_for_all_local_got_entries): New function.
3405         (class Sized_relobj::write_local_symbols): Add offset parameter.
3406         (class Sized_relobj::local_symbol_offset_): Update comment.
3407         (class Sized_relobj::local_dynsym_offset_): Update comment.
3408         * options.cc (Input_arguments::add_file): Remove const.
3409         * options.h (Input_file_argument::Input_file_argument):
3410         Initialize arg_serial_ (all constructors).
3411         (Input_file_argument::set_arg_serial): New function.
3412         (Input_file_argument::arg_serial): New function.
3413         (Input_file_argument::arg_serial_): New data member.
3414         (Input_arguments::Input_arguments): Initialize file_count_.
3415         (Input_arguments::add_file): Remove const.
3416         (Input_arguments::number_of_input_files): New function.
3417         (Input_arguments::file_count_): New data member.
3418         (Command_line::number_of_input_files): Call
3419         Input_arguments::number_of_input_files.
3420         * output.cc (Output_segment_headers::Output_segment_headers):
3421         Set current size.
3422         (Output_section::Input_section::current_data_size): New function.
3423         (Output_section::Output_section): Initialize new data members.
3424         (Output_section::add_input_section): Don't do merge sections for
3425         an incremental link; allocate space from free list for an
3426         incremental update.
3427         (Output_section::add_output_section_data): Allocate space from
3428         free list for an incremental update.
3429         (Output_section::update_data_size): New function.
3430         (Output_section::set_fixed_layout): New function.
3431         (Output_section::reserve): New function.
3432         (Output_segment::set_section_addresses): Remove const.
3433         (Output_segment::set_section_list_addresses): Remove const; allocate
3434         space from free list for an incremental update.
3435         (Output_segment::set_offset): Adjust size of RELRO segment for an
3436         incremental update.
3437         * output.h (Output_data::current_data_size): Move here from
3438         child classes.
3439         (Output_data::pre_finalize_data_size): New function.
3440         (Output_data::update_data_size): New function.
3441         (Output_section_headers::update_data_size): new function.
3442         (Output_section_data_build::current_data_size): Move to Output_data.
3443         (Output_data_strtab::update_data_size): New function.
3444         (Output_section::current_data_size): Move to Output_data.
3445         (Output_section::set_fixed_layout): New function.
3446         (Output_section::has_fixed_layout): New function.
3447         (Output_section::reserve): New function.
3448         (Output_section::update_data_size): New function.
3449         (Output_section::has_fixed_layout_): New data member.
3450         (Output_section::free_list_): New data member.
3451         (Output_segment::set_section_addresses): Remove const.
3452         (Output_segment::set_section_list_addresses): Remove const.
3453         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3454         New function.
3455         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3456         New function.
3457         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3458         parameter when calling Add_symbols constructor; store argument
3459         serial number for members of a lib group.
3460         (Add_symbols::locks): Allow case where token == NULL.
3461         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3462         (Read_member::~Read_member): New function.
3463         (Read_member::is_runnable): New function.
3464         (Read_member::locks): New function.
3465         (Read_member::run): New function.
3466         (Check_script::~Check_script): New function.
3467         (Check_script::is_runnable): New function.
3468         (Check_script::locks): New function.
3469         (Check_script::run): New function.
3470         (Check_library::~Check_library): New function.
3471         (Check_library::is_runnable): New function.
3472         (Check_library::locks): New function.
3473         (Check_library::run): New function.
3474         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3475         (Add_symbols::library_): New data member.
3476         (class Read_member): New class.
3477         (class Check_script): New class.
3478         (class Check_library): New class.
3479         * reloc.cc (Read_relocs::is_runnable): Allow case where
3480         token == NULL.
3481         (Read_relocs::locks): Likewise.
3482         (Scan_relocs::locks): Likewise.
3483         (Relocate_task::locks): Likewise.
3484         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3485         to clear counters.
3486         (Sized_relobj::incremental_relocs_scan): Fix comment.
3487         (Sized_relobj::do_relocate): Pass output file offset to
3488         write_local_symbols.
3489         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3490         from class declaration.
3491         * script.cc (read_input_script): Allocate Script_info; pass
3492         argument serial number to report_script.
3493         * script.h (class Script_info): Move to incremental.h.
3494         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3495         * symtab.h (Symbol_table::add_from_incrobj): New function.
3496         (Symbol_table::set_file_offset): New function.
3497
3498 2011-04-05  Cary Coutant  <ccoutant@google.com>
3499
3500         * incremental-dump.cc (dump_incremental_inputs): Change signature
3501         to take a Sized_incremental_binary; change caller.  Use readers
3502         in Sized_incremental_binary.
3503         * incremental.cc
3504         (Sized_incremental_binary::find_incremental_inputs_sections):
3505         Rename do_find_incremental_inputs_sections to this.
3506         (Sized_incremental_binary::setup_readers): New function.
3507         (Sized_incremental_binary::do_check_inputs): Check
3508         has_incremental_info_ flag; move setup code to setup_readers;
3509         use input readers.
3510         (Sized_incremental_binary::do_file_is_unchanged): New function.
3511         (Sized_incremental_binary::do_get_input_reader): New function.
3512         * incremental.h (class Incremental_binary): Move to end of file.
3513         (Incremental_binary::file_is_unchanged): New function.
3514         (Incremental_binary::do_file_is_unchanged): New function.
3515         (Incremental_binary::Input_reader): New class.
3516         (Incremental_binary::get_input_reader): New function.
3517         (class Sized_incremental_binary): Move to end of file.
3518         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3519         input section reader classes.
3520         (Sized_incremental_binary::has_incremental_info): New function.
3521         (Sized_incremental_binary::inputs_reader): New function.
3522         (Sized_incremental_binary::symtab_reader): New function.
3523         (Sized_incremental_binary::relocs_reader): New function.
3524         (Sized_incremental_binary::got_plt_reader): New function.
3525         (Sized_incremental_binary::do_file_is_unchanged): New function.
3526         (Sized_incremental_binary::Sized_input_reader): New class.
3527         (Sized_incremental_binary::get_input_reader): New function.
3528         (Sized_incremental_binary::find_incremental_inputs_sections):
3529         Rename do_find_incremental_inputs_sections to this.
3530         (Sized_incremental_binary::setup_readers): New function.
3531         (Sized_incremental_binary::has_incremental_info_): New data member.
3532         (Sized_incremental_binary::inputs_reader_): New data member.
3533         (Sized_incremental_binary::symtab_reader_): New data member.
3534         (Sized_incremental_binary::relocs_reader_): New data member.
3535         (Sized_incremental_binary::got_plt_reader_): New data member.
3536         (Sized_incremental_binary::current_input_file_): New data member.
3537
3538 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3539
3540         PR gold/12640
3541         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3542         violation.
3543
3544 2011-03-30  Cary Coutant  <ccoutant@google.com>
3545
3546         * archive.cc (Archive::include_member): Adjust call to report_object.
3547         (Add_archive_symbols::run): Add script_info to call to
3548         report_archive_begin.
3549         (Lib_group::include_member): Adjust call to report_object.
3550         (Add_lib_group_symbols::run): Adjust call to report_object.
3551         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3552         blocks.  Add object count for script input files.
3553         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3554         script_info parameter; change all callers.
3555         (Incremental_inputs::report_object): Add script_info parameter;
3556         change all callers.
3557         (Incremental_inputs::report_script): Store backpointer to
3558         incremental info entry.
3559         (Output_section_incremental_inputs::set_final_data_size): Record
3560         additional information for scripts.
3561         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3562         * incremental.h (Incremental_script_entry::add_object): New function.
3563         (Incremental_script_entry::get_object_count): New function.
3564         (Incremental_script_entry::get_object): New function.
3565         (Incremental_script_entry::objects_): New data member; adjust
3566         constructor.
3567         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3568         (Incremental_inputs::report_object): Add script_info parameter.
3569         (Incremental_inputs_reader::get_object_count): New function.
3570         (Incremental_inputs_reader::get_object_offset): New function.
3571         * options.cc (Input_arguments::add_file): Return reference to
3572         new input argument.
3573         * options.h (Input_argument::set_script_info): New function.
3574         (Input_argument::script_info): New function.
3575         (Input_argument::script_info_): New data member; adjust all
3576         constructors.
3577         (Input_file_group::add_file): Return reference to new input argument.
3578         (Input_file_lib::add_file): Likewise.
3579         (Input_arguments::add_file): Likewise.
3580         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3581         * script.cc (Parser_closure::Parser_closure): Add script_info
3582         parameter; adjust all callers.
3583         (Parser_closure::script_info): New function.
3584         (Parser_closure::script_info_): New data member.
3585         (read_input_script): Report scripts earlier to incremental info.
3586         (script_add_file): Set script_info in Input_argument.
3587         (script_add_library): Likewise.
3588         * script.h (Script_options::Script_info): Rewrite class.
3589
3590 2011-03-29  Cary Coutant  <ccoutant@google.com>
3591
3592         * archive.cc (Library_base::should_include_member): Move
3593         method here from class Archive.
3594         (Archive::Archive): Initialize base class.
3595         (Archive::should_include_member): Move to base class.
3596         (Archive::do_for_all_unused_symbols): New function.
3597         (Add_archive_symbols::run): Remove redundant access to
3598         incremental_inputs.
3599         (Lib_group::Lib_group): Initialize base class.
3600         (Lib_group::do_filename): New function.
3601         (Lib_group::include_member): Pass pointer to Lib_group to
3602         report_object.
3603         (Lib_group::do_for_all_unused_symbols): New function.
3604         (Add_lib_group_symbols::run): Report archive information for
3605         incremental links.
3606         * archive.h (class Library_base): New base class.
3607         (class Archive): Derive from Library_base.
3608         (Archive::filename): Move to base class.
3609         (Archive::set_incremental_info): Likewise.
3610         (Archive::incremental_info): Likewise.
3611         (Archive::Should_include): Likewise.
3612         (Archive::should_include_member): Likewise.
3613         (Archive::Armap_entry): Remove.
3614         (Archive::Unused_symbol_iterator): Remove.
3615         (Archive::unused_symbols_begin): Remove.
3616         (Archive::unused_symbols_end): Remove.
3617         (Archive::do_filename): New function.
3618         (Archive::do_get_mtime): New function.
3619         (Archive::do_for_all_unused_symbols): New function.
3620         (Archive::task_): Move to base class.
3621         (Archive::incremental_info_): Likewise.
3622         (class Lib_group): Derive from Library_base.
3623         (Lib_group::do_filename): New function.
3624         (Lib_group::do_get_mtime): New function.
3625         (Lib_group::do_for_all_unused_symbols): New function.
3626         (Lib_group::task_): Move to base class.
3627         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3628         function.
3629         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3630         function.
3631         * incremental.cc (Incremental_inputs::report_archive_begin):
3632         Use Library_base; call library's get_mtime; add incremental inputs
3633         entry before members.
3634         (class Unused_symbol_visitor): New class.
3635         (Incremental_inputs::report_archive_end): Use Library_base; use
3636         visitor class to record unused symbols; don't add incremental inputs
3637         entry after members.
3638         (Incremental_inputs::report_object): Use Library_base.
3639         * incremental.h
3640         (Incremental_archive_entry::Incremental_archive_entry): Remove
3641         unused Archive parameter.
3642         (Incremental_inputs::report_archive_begin): Use Library_base.
3643         (Incremental_inputs::report_archive_end): Likewise.
3644         (Incremental_inputs::report_object): Likewise.
3645         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3646         function.
3647         * object.h (Object::for_all_global_symbols): New function.
3648         (Object::do_for_all_global_symbols): New function.
3649         (Sized_relobj::do_for_all_global_symbols): New function.
3650         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3651         function.
3652         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3653         function.
3654
3655 2011-03-27  Ian Lance Taylor  <iant@google.com>
3656
3657         * archive.cc (Archive::interpret_header): Return -1 if something
3658         goes wrong.  Change callers accordingly.
3659
3660 2011-03-25  Cary Coutant  <ccoutant@google.com>
3661
3662         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3663         * testsuite/Makefile.in: Regenerate.
3664
3665 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3666
3667         * plugin.cc (get_view): New.
3668         (Plugin::load): Pass get_view to the plugin.
3669         (Plugin_manager::get_view): New.
3670
3671 2011-03-21  Ian Lance Taylor  <iant@google.com>
3672
3673         * testsuite/final_layout.sh: Rewrite to not use dc.
3674         * testsuite/relro_test.sh: Fail if dc is not present.
3675
3676 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3677
3678         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3679         Change == to -eq.
3680         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3681         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3682         Change == to -eq.
3683         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3684         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3685
3686 2011-03-14  Ian Lance Taylor  <iant@google.com>
3687
3688         * script-sections.cc (Sort_output_sections::script_compare):
3689         Rename from is_before, change return type.
3690         (Sort_output_sections::operator()): Adjust accordingly.
3691
3692 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3693
3694         PR gold/12572
3695         * testsuite/odr_violation2.cc: Add comment to make all error line
3696         numbers double digits.
3697         * testsuite/debug_msg.sh: Adjust expected errors.
3698
3699 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3700
3701         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3702         but mark earlier ones as non-canonical
3703         (offset_to_iterator): Update search target and example
3704         (do_addr2line): Return extra lines in a vector*
3705         (format_file_lineno): Extract from do_addr2line
3706         (one_addr2line): Add vector* out-param
3707         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3708         when a lineno entry appeared last for its instruction
3709         (Dwarf_line_info): Add vector* out-param
3710         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3711         * symtab.cc (Odr_violation_compare): Include the lineno in the
3712         comparison again.
3713         (linenos_from_loc): New. Combine the canonical line for an
3714         address with its other lines.
3715         (True_if_intersect): New. Helper functor to make
3716         std::set_intersection a query.
3717         (detect_odr_violations): Compare sets of lines instead of just
3718         one line for each function. This became less deterministic, but
3719         has fewer false positives.
3720         * symtab.h: Declarations.
3721         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3722         mix an optimized and non-optimized object in the same binary
3723         (odr_violation2.so): Same.
3724         * testsuite/Makefile.in: Regenerate from Makefile.am.
3725         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3726         * testsuite/debug_msg.sh: Update line numbers and add
3727         assertions.
3728         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3729         non-optimized context.
3730         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3731         isn't inlined, and use OdrDerived in an optimized context.
3732         * testsuite/odr_header1.h: Defines OdrDerived, where
3733         optimization will change the
3734         first-instruction-in-the-destructor's file and line number.
3735         * testsuite/odr_header2.h: Defines OdrBase.
3736
3737 2011-03-09  Ian Lance Taylor  <iant@google.com>
3738
3739         * fileread.cc (File_read::clear_views): Don't delete the whole
3740         file view.
3741
3742 2011-03-08  Ian Lance Taylor  <iant@google.com>
3743
3744         PR gold/12525
3745         * fileread.cc: #include <climits>.
3746         (GOLD_IOV_MAX): Define.
3747         (File_read::read_multiple): Limit number of entries by iov_max.
3748         * fileread.h (class File_read): Always set max_readv_entries to
3749         128.
3750
3751 2011-03-07  Ian Lance Taylor  <iant@google.com>
3752
3753         PR gold/12525
3754         * options.h (class General_options): Add -dy and -dn.
3755
3756 2011-03-02  Cary Coutant  <ccoutant@google.com>
3757
3758         * testsuite/script_test_9.t: Add TLS segment.
3759
3760 2011-03-02  Simon Baldwin  <simonb@google.com>
3761
3762         * configure.ac: Add check for gnu_indirect_function support in
3763         the toolchain building binutils.
3764         * configure: Rebuild.
3765
3766 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3767
3768         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3769         plugin only symbols.
3770         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3771         in plugin files as not needed in the symbol table.
3772
3773 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3774
3775         * output.cc (Output_section::add_input_section): Delay fill
3776         generation for section ordering.
3777
3778 2011-02-09  Ian Lance Taylor  <iant@google.com>
3779
3780         PR gold/12316
3781         * object.h (class Sized_relobj): Remove clear_local_symbols.
3782         * reloc.cc (Sized_relobj::do_relocate): Don't call
3783         clear_local_symbols.
3784
3785 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3786
3787         * plugin.cc (is_visible_from_outside): Return true for symbols
3788         in the -u option.
3789
3790 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3791
3792         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3793         filename.
3794
3795 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3796
3797         * icf.h (is_section_foldable_candidate): Change type of parameter
3798         to std::string.
3799         * icf.cc (Icf::find_identical_sections): Change type of local variable
3800         section_name to be std::string.
3801         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3802
3803 2011-01-25  Ian Lance Taylor  <iant@google.com>
3804
3805         * script.cc (script_add_extern): Rewrite to use
3806         add_symbol_reference.
3807
3808 2011-01-25  Doug Kwan  <dougkwan@google.com>
3809
3810         * icf.cc (get_section_contents): Always lock section's object.
3811
3812 2011-01-24  Ian Lance Taylor  <iant@google.com>
3813
3814         * options.h (class General_options): Accept
3815         --no-detect-odr-violations.
3816
3817 2011-01-24  Ian Lance Taylor  <iant@google.com>
3818
3819         * version.cc (version_string): Bump to 1.11.
3820
3821 2011-01-24  Ian Lance Taylor  <iant@google.com>
3822
3823         * plugin.cc (class Plugin_rescan): Define new class.
3824         (Plugin_manager::claim_file): Set any_claimed_.
3825         (Plugin_manager::save_archive): New function.
3826         (Plugin_manager::save_input_group): New function.
3827         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3828         necessary.
3829         (Plugin_manager::new_undefined_symbol): New function.
3830         (Plugin_manager::rescan): New function.
3831         (Plugin_manager::rescannable_defines): New function.
3832         (Plugin_manager::add_input_file): Set any_added_.
3833         * plugin.h (class Plugin_manager): define new fields rescannable_,
3834         undefined_symbols_, any_claimed_, and any_added_.  Declare
3835         Plugin_rescan as friend.  Declare new functions.
3836         (Plugin_manager::Rescannable): Define type.
3837         (Plugin_manager::Rescannable_list): Define type.
3838         (Plugin_manager::Undefined_symbol_list): Define type.
3839         (Plugin_manager::Plugin_manager): Initialize new fields.
3840         * archive.cc (Archive::defines_symbol): New function.
3841         (Add_archive_symbols::run): Pass archive to plugins if any.
3842         * archive.h (class Archive): Declare defines_symbol.
3843         * readsyms.cc (Input_group::~Input_group): New function.
3844         (Finish_group::run): Pass input_group to plugins if any.
3845         * readsyms.h (class Input_group): Declare destructor.
3846         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3847         any.
3848
3849 2011-01-10  Ian Lance Taylor  <iant@google.com>
3850
3851         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3852         section as relro.
3853         (Layout::set_segment_offsets): Reset increase_relro before calling
3854         set_section_addresses a second time.
3855
3856 2011-01-04  Cary Coutant  <ccoutant@google.com>
3857
3858         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3859         sections before NOBITS sections.
3860
3861 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3862
3863         * version.cc (print_version): Update copyright to 2011.
3864
3865 2010-12-23  Cary Coutant  <ccoutant@google.com>
3866
3867         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3868         of OS to this->add.  Add OD parameter to second form of the function.
3869
3870 2010-12-20  Ian Lance Taylor  <iant@google.com>
3871
3872         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3873         second of two consecutive entries with same offset.
3874
3875 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3876
3877         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3878         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3879         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3880         to avoid unneeded links against $(LDADD).
3881         * testsuite/Makefile.in: Regenerate.
3882
3883 2010-12-15  Ian Lance Taylor  <iant@google.com>
3884
3885         PR gold/12324
3886         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3887         for R_X86_64_32 and R_X86_64_PC32.
3888         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3889         ver_matching_def_pic.o.
3890         (ver_matching_def_pic.o): New target.
3891
3892 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3893
3894         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3895         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3896         Move definition before File_read::View member definitions.
3897         (File_read::View::~View): Initialize and hold lock before
3898         updating current_mapped_bytes.
3899
3900 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3901
3902         * dwarf_reader.cc: Remove outdated comment.
3903         * gold-threads.cc: Fix typo in error message.
3904         * archive.cc: Fix typos in comments.
3905         * archive.h: Likewise.
3906         * arm-reloc-property.cc: Likewise.
3907         * arm-reloc-property.h: Likewise.
3908         * arm-reloc.def: Likewise.
3909         * arm.cc: Likewise.
3910         * attributes.h: Likewise.
3911         * cref.cc: Likewise.
3912         * ehframe.cc: Likewise.
3913         * fileread.h: Likewise.
3914         * gold.h: Likewise.
3915         * i386.cc: Likewise.
3916         * icf.cc: Likewise.
3917         * incremental.h: Likewise.
3918         * int_encoding.cc: Likewise.
3919         * layout.h: Likewise.
3920         * main.cc: Likewise.
3921         * merge.h: Likewise.
3922         * object.cc: Likewise.
3923         * object.h: Likewise.
3924         * options.cc: Likewise.
3925         * readsyms.cc: Likewise.
3926         * reduced_debug_output.cc: Likewise.
3927         * reloc.cc: Likewise.
3928         * script-sections.cc: Likewise.
3929         * sparc.cc: Likewise.
3930         * symtab.h: Likewise.
3931         * target-reloc.h: Likewise.
3932         * target.cc: Likewise.
3933         * target.h: Likewise.
3934         * timer.cc: Likewise.
3935         * timer.h: Likewise.
3936         * x86_64.cc: Likewise.
3937
3938 2010-12-09  Cary Coutant  <ccoutant@google.com>
3939
3940         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3941         stack.
3942         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3943         parameter; change all callers.
3944         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3945         * options.h (warn_execstack): New option.
3946
3947 2010-12-07  Doug Kwan  <dougkwan@google.com>
3948
3949         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3950         like function call relocations.
3951
3952 2010-12-07  Ian Lance Taylor  <iant@google.com>
3953
3954         * archive.cc (Archive::get_elf_object_for_member): Permit
3955         punconfigured to be NULL.
3956         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3957         (Archive::include_member): Pass NULL to get_elf_object_for_member
3958         if we searched for the archive and this is the first included
3959         object.
3960
3961 2010-12-01  Ian Lance Taylor  <iant@google.com>
3962
3963         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3964         track_relocs_type_ field.
3965         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3966         Set track_relocs_type_.
3967         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3968         contents when using RELA relocs.
3969         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3970         reloc_map_.
3971         * reloc.cc (Track_relocs::next_addend): New function.
3972         * reloc.h (class Track_relocs): Declare next_addend.
3973
3974 2010-12-01  Ian Lance Taylor  <iant@google.com>
3975
3976         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3977         virtual destructor.
3978
3979 2010-12-01  Ian Lance Taylor  <iant@google.com>
3980
3981         * README: Update compilers known to work and fail.
3982
3983 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3984
3985         * configure.in: For --enable-gold, handle value `default' instead of
3986         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3987         not the default.
3988         * configure: Regenerate.
3989
3990 2010-11-18  Doug Kwan  <dougkwan@google.com>
3991
3992         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3993         and right_alignment to be zero.  Store result alignment only if it is
3994         greater than existing alignment.
3995
3996 2010-11-16  Cary Coutant  <ccoutant@google.com>
3997
3998         PR gold/12220
3999         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4000         Check for ".zdebug_line".
4001
4002 2010-11-16  Doug Kwan  <dougkwan@google.com>
4003             Cary Coutant  <ccoutant@google.com>
4004
4005         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4006         by reference; adjust all callers.
4007         * output.cc (Output_segment::set_section_addresses): Adjust references
4008         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4009         list is empty.
4010         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4011         end at page boundary.
4012
4013 2010-11-16  Cary Coutant  <ccoutant@google.com>
4014
4015         PR gold/12220
4016         * layout.cc (Layout::choose_output_section): Transform names of
4017         compressed sections even when using a script with a SECTIONS clause.
4018         (Layout::output_section_name): Remove code to transform
4019         compressed debug section names.
4020         * output.cc (Output_section::add_input_section): Use uncompressed
4021         section size when tracking input sections.
4022
4023 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4024
4025         * symtab.h (Symbol::NON_PIC_REF): Remove.
4026         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4027         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4028         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4029         (Symbol::use_plt_offset): Take a flags argument and pass it
4030         directly to needs_dynamic_reloc.  Restrict check for undefined
4031         weak symbols to function calls.
4032         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4033         (Target_arm::Scan::global): Use it.
4034         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4035         (Target_arm::Relocate::relocate): Likewise.
4036         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4037         parameter with an r_type parameter.  Use get_reference_flags
4038         to get the flags.
4039         (Target_arm::Relocate::relocate): Update accordingly.
4040         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4041         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4042         (Target_i386::Scan::global): Likewise.
4043         (Target_i386::Relocate::relocate): Likewise.
4044         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4045         parameter with an r_type parameter.  Use get_reference_flags
4046         to get the flags.
4047         (Target_i386::Relocate::relocate): Update accordingly.
4048         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4049         (Target_powerpc::Scan::global): Use it.
4050         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4051         (Target_powerpc::Relocate::relocate): Likewise.
4052         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4053         (Target_sparc::Scan::global): Use it.
4054         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4055         (Target_sparc::Relocate::relocate): Likewise.
4056         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4057         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4058         (Target_x86_64::Scan::global): Likewise.
4059         (Target_x86_64::Relocate::relocate): Likewise.
4060
4061 2010-11-08  Doug Kwan  <dougkwan@google.com>
4062             Cary Coutant  <ccoutant@google.com>
4063
4064         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4065         (Arm_exidx_merge_section::section_contents_): New data member.
4066         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4067         (Arm_input_section::~Arm_input_section): De-allocate memory.
4068         (Arm_input_section::original_contents_): New data member.
4069         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4070         in parameters instead of calling Object::section_contents without
4071         locking.
4072         (Arm_output_section::group_section): New parameter TASK.  Pass it
4073         to callees that need locking objects.
4074         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4075         to lock EXIDX input sections.  Fix a formatting issue.  Call
4076         Arm_exidx_merged_section::build_contents to create merged section
4077         contents.
4078         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4079         to lock object of stub table owner.
4080         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4081         TEXT_SIZE to initialize data member TEXT_SIZE_.
4082         (Arm_exidx_input_section::addralign): Fix typo in comment.
4083         (Arm_exidx_input_section::text_size): New method.
4084         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4085         that require locking objects.  Lock objects before scanning for stubs
4086         and updating local symbols.
4087         (Arm_input_section<big_endian>::init): Copy contents of original
4088         input section.
4089         (Arm_input_section<big_endian>::do_write): Use saved contents of
4090         original input section instead of calling Object::section_contents
4091         without locking.
4092         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4093         size without calling Object::section_size().
4094         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4095         for size.  Allocate a buffer for merged EXIDX entries.
4096         (Arm_exidx_merged_section::build_contents): New method.
4097         (Arm_exidx_merged_section::do_write): Move merge section contents
4098         building code to Arm_exidx_merged_section::build_contetns.  Write
4099         out contetns in buffer instead of building it on the fly.
4100         (Arm_relobj::make_exidx_input_section): Also pass text section size
4101         to Arm_exidx_input_section constructor.
4102         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4103         (Arm_dynobj::do_read_symbols): Fix memory leak.
4104         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4105         * target.h: (class Task): Add forward declaration.
4106         (Target::relax): Add new parameter TASK and pass it to
4107         Target::do_relax().
4108         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4109
4110 2010-11-05  Cary Coutant  <ccoutant@google.com>
4111
4112         PR gold/10708
4113         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4114         object when reading from the file.
4115         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4116         second layout pass.
4117         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4118         when reading section contents.
4119         (get_section_contents): Likewise.
4120         (icf::find_identical_sections): Likewise.
4121         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4122         object when reading from the file.
4123         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4124         the object when doing deferred section layout.
4125
4126 2010-11-03  Nick Clifton  <nickc@redhat.com>
4127
4128         PR gold/12001
4129         * script.h (class Symbol_assignment: name): New member.  Returns
4130         the name of the symbol.
4131         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4132         Returns true if the given symbol name is on the list of
4133         assignments wating to be processed.
4134         * archive.cc (should_incldue_member): If the symbol is undefined,
4135         check to see if it is on the list of symbols pending assignment.
4136
4137 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4138
4139         * script-sections.cc (Script_sections::find_memory_region): Check
4140         for a NULL output section pointer.
4141
4142 2010-10-29  Doug Kwan  <dougkwan@google.com>
4143
4144         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4145         Output_section::add_relaxed_input_section.
4146         * output.cc (Output_section::add_relaxed_input_section): Add new
4147         arguments LAYOUT and NAME.  Set section order index.
4148         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4149         Copy section order index.
4150         * output.h (Output_section::add_relaxed_input_section): Add new
4151         arguments LAYOUT and NAME.
4152
4153 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4154
4155         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4156         NATIVE_OR_CROSS_LINKER.
4157         * testsuite/Makefile.in: Regenerate.
4158
4159 2010-10-20  Doug Kwan  <dougkwan@google.com>
4160
4161         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4162         without SHF_LINK_ORDER flags.
4163         * layout.cc (Layout::choose_output_section): Do not filter
4164         SHF_LINK_ORDER flag in a relocatable link.
4165
4166 2010-10-17  Cary Coutant  <ccoutant@google.com>
4167
4168         * output.h (Output_segment::set_section_addresses): Change function
4169         signature.  Update all callers.
4170         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4171         sections.
4172         (Output_segment::set_section_addresses): Align after last TLS
4173         section.  Add padding before last relro section instead of after.
4174
4175 2010-10-17  Doug Kwan  <dougkwan@google.com>
4176
4177         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4178         GOT output section to be writable.
4179
4180 2010-10-14  Cary Coutant  <ccoutant@google.com>
4181
4182         * debug.h (DEBUG_INCREMENTAL): New flag.
4183         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4184         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4185         mode.
4186         * incremental.cc (report_command_line): Ignore all forms of
4187         --incremental.
4188         * layout.cc (Layout::Layout): Check parameters for incremental link
4189         mode.
4190         * options.cc (General_options::parse_incremental): New function.
4191         (General_options::parse_no_incremental): New function.
4192         (General_options::parse_incremental_full): New function.
4193         (General_options::parse_incremental_update): New function.
4194         (General_options::incremental_mode_): New data member.
4195         (General_options::finalize): Check incremental_mode_.
4196         * options.h (General_options): Update help text for --incremental.
4197         Add --no-incremental, --incremental-full, --incremental-update.
4198         (General_options::Incremental_mode): New enum type.
4199         (General_options::incremental_mode): New function.
4200         (General_options::incremental_mode_): New data member.
4201         * parameters.cc (Parameters::incremental_mode_): New data member.
4202         (Parameters::set_options): Set incremental_mode_.
4203         (Parameters::set_incremental_full): New function.
4204         (Parameters::incremental): New function.
4205         (Parameters::incremental_update): New function.
4206         (set_parameters_incremental_full): New function.
4207         * parameters.h (Parameters::set_incremental_full): New function.
4208         (Parameters::incremental): New function.
4209         (Parameters::incremental_update): New function.
4210         (Parameters::incremental_mode_): New data member.
4211         (set_parameters_incremental_full): New function.
4212         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4213         incremental link mode.
4214         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4215         (Sized_relobj::do_relocate_sections): Likewise.
4216         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4217         option.
4218         * testsuite/Makefile.in: Regenerate.
4219         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4220
4221 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4222
4223         * script-sections.h (class Script_sections): Make
4224         Sections_elements typedef public.
4225         * script-sections.cc (class Sort_output_sections): Add elements_
4226         field.  Add constructor which sets it; change all callers.
4227         (Sort_output_sections::is_before): New function.
4228         (Sort_output_sections::operator()): Call is_before.
4229         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4230         conditional.
4231         * testsuite/script_test_10.sh: New test. Test script section
4232         order.
4233         * testsuite/script_test_10.t: Likewise.
4234         * testsuite/script_test_10.s: Likewise.
4235         * testsuite/Makefile.am: Wrap the cross linker tests and the
4236         common tests into NATIVE_OR_CROSS_LINKER.
4237         (check_SCRIPTS): Add script_test_10.sh.
4238         (check_DATA): Add script_test_10.stdout.
4239         (script_test_10.o, script_test_10): New targets.
4240         (script_test_10.stdout): New target.
4241         * configure, testsuite/Makefile.in: Regenerate.
4242
4243 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4244
4245         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4246         error for the deprecated relocations.
4247         (Target_arm::Scan::global): Likewise.
4248         (Target_arm::Relocate::relocate): Likewise.
4249
4250 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4251
4252         * fileread.cc (Input_file::find_file): Initialize *found_name
4253         and *namep when using the fallback search for case 4.
4254
4255 2010-10-11  Cary Coutant  <ccoutant@google.com>
4256
4257         * options.h (class General_options): Redefine -z lazy as an alias for
4258         the negation of -z now.
4259
4260 2010-10-11  Ian Lance Taylor  <iant@google.com>
4261
4262         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4263         binding.
4264
4265 2010-10-06  Nick Clifton  <nickc@redhat.com>
4266
4267         * script-sections.cc(class Memory_region): Remove
4268         current_lma_offset_ field.  Rename current_vma_offset_ to
4269         current_offset_.  Add last_section_ field.
4270         (Memory_region::get_current_vma_address): Rename to
4271         get_current_address.
4272         (Memory_region::get_current_lma_address): Delete.
4273         (Memory_region::increment_vma_offset): Rename to
4274         increment_offset.
4275         (Memory_region::increment_lma_offset): Delete.
4276         (Memory_region::attributes_compatible): New method.  Returns
4277         true if the provided section is compatible with the region.
4278         (Memory_region::get_last_section): New method.  Returns the last
4279         section to use the region.
4280         (Memory_region::set_last_section): New method.  Stores the last
4281         section to use the region.
4282         (Script_sections::block_in_region): New method.  Returns true if
4283         a block of memory is contained within a region.
4284         (Script_sections::find_memory_region): New method.  Locates a
4285         memory region to be used to set a VMA or LMA address.
4286         (Output_section_definition::set_section_addresses): Add code to
4287         check for addresses set by memory regions.
4288         (Output_segment::set_section_addresses): Remove memory region
4289         walking code.
4290         (Script_sections::create_segment): Add a warning if a header
4291         segment is created outside of any region.
4292         * script-sections.h (class Script_sections): Add prototypes for
4293         find_memory_region and block_in_region methods.
4294         * testsuite/memory_test.s: Use .long instead of .word.
4295         * testsuite/memory_test.t: Add some more output sections.
4296         * testsuite/memory_test.sh: Update expected output.
4297
4298 2010-10-02  Doug Kwan  <dougkwan@google.com>
4299
4300         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4301         defintion to symtab.h
4302         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4303         declaration to defintion.
4304
4305 2010-10-01  Nick Clifton  <nickc@redhat.com>
4306
4307         * expression.cc (eval): Replace dummy argument with NULL.
4308         (eval_maybe_dot): Check for a NULL result section pointer.
4309         (Symbol_expression::value): Likewise.
4310         (Dot_expression::value): Likewise.
4311         (BINARY_EXPRESSION): Likewise.
4312         (Max_expression::value): Likewise.
4313         (Min_expression::value): Likewise.
4314         (Absolute_expression::value): Likewise.
4315         (Addr_expression::value_from_output_section): Likewise.
4316         (Loaddddr_expression::value_from_output_section): Likewise.
4317         (Segment_start_expression::value): Likewise.
4318         * script-sections.cc
4319         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4320         argument with NULL.
4321         (Sections_elememt_dot_assignment::set_section_addresses):
4322         Likewise.
4323         (Output_data_expression::do_write_to_buffer): Likewise.
4324         (Output_section_definition::finalize_symbols): Likewise.
4325         (Output_section_definition::set_section_addresses): Likewise.
4326
4327 2010-09-30  Doug Kwan  <dougkwan@google.com>
4328
4329         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4330
4331 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4332
4333         * target.h (Target::can_icf_inline_merge_sections): New virtual
4334         function.
4335         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4336         virtual function.
4337         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4338         virtual function.
4339         * icf.cc (get_section_contents): Inline merge sections only when
4340         target allows it.
4341
4342 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4343
4344         * configure: Regenerate.
4345
4346 2010-09-17  Ian Lance Taylor  <iant@google.com>
4347
4348         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4349         * testsuite/Makefile.am (memory_test.o): New target.
4350         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4351         memory_test.t.
4352         * testsuite/Makefile.in: Rebuild.
4353
4354 2010-09-17  Doug Kwan  <dougkwan@google.com>
4355
4356         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4357         defintion if relocation uses GOT entries of the symbol.
4358         * testsuite/icf_safe_test.sh: Fix test.
4359         * testsuite/icf_safe_so_test.sh: Fix test.
4360
4361 2010-09-16  Cary Coutant  <ccoutant@google.com>
4362
4363         * script_sections.cc (class Memory_region): Remove "NULL" from
4364         vector initializations.
4365
4366 2010-09-15  Cary Coutant  <ccoutant@google.com>
4367
4368         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4369         Resolve forwarding symbols.
4370
4371 2010-09-15  Doug Kwan  <dougkwan@google.com>
4372
4373         * gold/testsuite/script_test_3.t: Add ARM special sections.
4374         * gold/testsuite/script_test_4.t: Same.
4375         * gold/testsuite/script_test_5.t: Same.
4376         * gold/testsuite/script_test_6.t: Same.
4377         * gold/testsuite/script_test_7.t: Same.
4378         * gold/testsuite/script_test_7.t: Same.
4379         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4380
4381 2010-09-14  Cary Coutant  <ccoutant@google.com>
4382
4383         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4384         (Target_x86_64::Relocate::relocate_tls): Replace check for
4385         saw_tls_block_reloc_ with test for executable section.
4386
4387 2010-09-12  Cary Coutant  <ccoutant@google.com>
4388
4389         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4390         position-independent executables to shared libraries need dynamic
4391         relocations.
4392         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4393         position-independent executables.
4394         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4395         * testsuite/Makefile.in: Regenerate.
4396
4397 2010-09-10  Nick Clifton  <nickc@redhat.com>
4398
4399         PR gold/11997
4400         * testsuite/memory_test.t: Discard any sections that are not
4401         needed.
4402
4403 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4404
4405         PR gold/11996
4406         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4407         "This::" to work around a bug in gcc 4.2.
4408
4409         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4410
4411 2010-09-09  Rafael Espindola  <espindola@google.com>
4412
4413         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4414         sections with different PF_X flags in the same segment.
4415         (Layout::find_first_load_seg): Search all segments to find the first
4416         one.
4417         * options.h (rosegment): New.
4418
4419 2010-09-08  Rafael Espindola  <espindola@google.com>
4420
4421         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4422
4423 2010-09-08  Doug Kwan  <dougkwan@google.com>
4424
4425         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4426         (Arm_relobj::do_relocate_sections): Add new parameter for output
4427         file to match the parent.
4428         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4429         of local symbols instead of input values.  Update code to track
4430         changes in gold::relocate_section.
4431         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4432         (Sized_relobj::compute_final_local_value_internal): New methods.
4433         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4434         body into private version of Sized_relobj::compute_final_local_value.
4435         Call the inline method.
4436         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4437         merged symbol value if there is one.
4438         (Symbol_value::has_output_value): New method defintiion.
4439         (Sized_relobj::Compute_final_local_value_status): New enum type.
4440         (Sized_relobj::compute_final_local_value): New methods.
4441         (Sized_relobj::compute_final_local_value_internal): New methods.
4442         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4443         and arm_cortex_a8.sh.
4444         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4445         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4446         New tests.
4447         * Makefile.in: Regenerate.
4448         * testsuite/arm_bl_out_of_range.s: Update test.
4449         * testsuite/thumb_bl_out_of_range.s: Ditto.
4450         * testsuite/thumb_blx_out_of_range.s: Ditto.
4451         * testsuite/arm_branch_out_of_range.sh: New file.
4452         * testsuite/arm_cortex_a8.sh: Ditto.
4453         * testsuite/arm_cortex_a8_b.s: Ditto.
4454         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4455         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4456         * testsuite/arm_cortex_a8_bl.s: Ditto.
4457         * testsuite/arm_cortex_a8_blx.s: Ditto.
4458         * testsuite/arm_cortex_a8_local.s: Ditto.
4459         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4460         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4461
4462 2010-09-08  Rafael Espindola  <espindola@google.com>
4463
4464         * Makefile.am (memory_test.stdout): Run readelf with -W.
4465         * Makefile.in: Regenerate.
4466         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4467         64 bit output.
4468
4469 2010-09-08  Rafael Espindola  <espindola@google.com>
4470
4471         * script-sections.cc (Script_sections::add_memory_region): Convert
4472         field precision to int.
4473         * script.cc (script_set_section_region, script_set_section_region):
4474         Convert field precision to int.
4475
4476 2010-09-08  Rafael Espindola  <espindola@google.com>
4477
4478         * arm.cc (do_finalize_sections): Create the __exidx_start and
4479         __exdix_end symbols even when the section is missing.
4480
4481 2010-09-08  Nick Clifton  <nickc@redhat.com>
4482
4483         * README: Remove claim that MEMORY is not supported.
4484         * expression.cc (script_exp_function_origin)
4485         (script_exp_function_length): Move from here to ...
4486         * script.cc: ... here.
4487         (script_set_section_region, script_add_memory)
4488         (script_parse_memory_attr, script_include_directive): New
4489         functions.
4490         * script-sections.cc
4491         (class Memory_region): New class.
4492         (class Output_section_definition): Add set_memory_region,
4493         set_section_vma, set_section_lma and get_section_name methods.
4494         (class Script_Sections): Add add_memory_region,
4495         find_memory_region, find_memory_region_origin,
4496         find_memory_region_length and set_memory_region methods.
4497         Have set_section_addresses method walk the list of set memory
4498         regions.
4499         Extend the print methos to display memory regions.
4500         * script-sections.h: Add prototypes for new methods.
4501         Add enum for MEMORY region attributes.
4502         * yyscript.y: Add support for parsing MEMORY regions.
4503         * script-c.h: Add prototypes for new functions.
4504         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4505         * testsuite/Makefile.in: Regenerate.
4506         * testsuite/memory_test.sh: New script.
4507         * testsuite/memory_test.s: New assembler source file.
4508         * testsuite/memory_test.t: New linker script.
4509
4510 2010-08-27  Doug Kwan  <dougkwan@google.com>
4511
4512         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4513         reference override an existing dynamic weak reference.
4514         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4515         * testsuite/Makefile.in: Regenerate.
4516         * testsuite/dyn_weak_ref.sh: New file.
4517         * testsuite/dyn_weak_ref_1.c: Ditto.
4518         * testsuite/dyn_weak_ref_2.c: Ditto.
4519
4520 2010-08-27  Ian Lance Taylor  <iant@google.com>
4521
4522         * incremental.h (class Incremental_input_entry): Add virtual
4523         destructor.
4524
4525 2010-08-27  Ian Lance Taylor  <iant@google.com>
4526
4527         * testsuite/start_lib_test_3.c: Mark t3 as used.
4528
4529 2010-08-27  Nick Clifton  <nickc@redhat.com>
4530
4531         * options.cc (version_script): Fix small typo in previous
4532         whitespace tidyup.
4533
4534 2010-08-25  Nick Clifton  <nickc@redhat.com>
4535
4536         * archive.cc: Formatting fixes: Remove whitespace between
4537         typename and following asterisk.  Remove whitespace between
4538         function name and opening parenthesis.
4539         * archive.h: Likewise.
4540         * arm.cc: Likewise.
4541         * attributes.cc: Likewise.
4542         * attributes.h: Likewise.
4543         * common.cc: Likewise.
4544         * copy-relocs.cc: Likewise.
4545         * dirsearch.h: Likewise.
4546         * dynobj.cc: Likewise.
4547         * ehframe.cc: Likewise.
4548         * ehframe.h: Likewise.
4549         * expression.cc: Likewise.
4550         * fileread.cc: Likewise.
4551         * fileread.h: Likewise.
4552         * gc.h: Likewise.
4553         * gold-threads.cc: Likewise.
4554         * gold.cc: Likewise.
4555         * i386.cc: Likewise.
4556         * icf.h: Likewise.
4557         * incremental-dump.cc: Likewise.
4558         * incremental.cc: Likewise.
4559         * layout.cc: Likewise.
4560         * layout.h: Likewise.
4561         * main.cc: Likewise.
4562         * merge.cc: Likewise.
4563         * merge.h: Likewise.
4564         * object.cc: Likewise.
4565         * object.h: Likewise.
4566         * options.cc: Likewise.
4567         * options.h: Likewise.
4568         * output.cc: Likewise.
4569         * output.h: Likewise.
4570         * plugin.cc: Likewise.
4571         * plugin.h: Likewise.
4572         * powerpc.cc: Likewise.
4573         * reloc.cc: Likewise.
4574         * script-c.h: Likewise.
4575         * script-sections.cc: Likewise.
4576         * script.cc: Likewise.
4577         * stringpool.cc: Likewise.
4578         * symtab.cc: Likewise.
4579         * symtab.h: Likewise.
4580         * target.cc: Likewise.
4581         * timer.cc: Likewise.
4582         * timer.h: Likewise.
4583         * version.cc: Likewise.
4584         * x86_64.cc: Likewise.
4585
4586 2010-08-24  Nick Clifton  <nickc@redhat.com>
4587
4588         PR 11899
4589         * layout.cc (segment_precedes): Sort segments by their physical
4590         addresses, if they have been set.
4591
4592 2010-08-23  Cary Coutant  <ccoutant@google.com>
4593
4594         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4595         symbols data.
4596         (Lib_group::include_member): Unlock object after deleting its
4597         symbols data.
4598         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4599         the bug fixed here.
4600
4601 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4602             Cary Coutant  <ccoutant@google.com>
4603
4604         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4605         constructor, and set_blocker.
4606         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4607         readsyms_blocker_.
4608         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4609         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4610         * testsuite/Makefile.am (start_lib_test): New test case.
4611         * testsuite/Makefile.in: Regenerate.
4612         * testsuite/start_lib_test_main.c: New file.
4613         * testsuite/start_lib_test_1.c: New file.
4614         * testsuite/start_lib_test_2.c: New file.
4615         * testsuite/start_lib_test_3.c: New file.
4616
4617 2010-08-19  Ian Lance Taylor  <iant@google.com>
4618
4619         * Makefile.in: Rebuild with automake 1.11.1.
4620         * aclocal.m4: Likewise.
4621         * testsuite/Makefile.in: Likewise.
4622
4623 2010-08-19  Ian Lance Taylor  <iant@google.com>
4624
4625         PR 10893
4626         * i386.cc (class Output_data_plt_i386): Update declarations.
4627         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4628         local_ifuncs_ fields.
4629         (Target_i386::do_plt_section_for_global): New function.
4630         (Target_i386::do_plt_section_for_local): New function.
4631         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4632         parameter; change all callers.  Initialize global_ifuncs_ and
4633         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4634         __rel_iplt_end.
4635         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4636         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4637         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4638         symbols.
4639         (Target_i386::make_plt_section): New function, broken out of
4640         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4641         (Target_i386::make_plt_entry): Call make_plt_section.
4642         (Target_i386::make_local_ifunc_plt_entry): New function.
4643         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4644         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4645         R_386_IRELATIVE to switch.
4646         (Target_i386::Scan::global): Likewise.
4647         (Target_i386::Relocate::relocate): Likewise.
4648         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4649         switch.
4650         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4651         (Target_x86_64::do_plt_section_for_global): New function.
4652         (Target_x86_64::do_plt_section_for_local): New function.
4653         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4654         parameter; change all callers.  If doing a static link define
4655         __rela_iplt_start and __rela_iplt_end.
4656         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4657         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4658         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4659         to point to .plt.
4660         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4661         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4662         switch.
4663         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4664         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4665         R_X86_64_IRELATIVE to switch.
4666         (Target_x86_64::Scan::global): Likewise.
4667         (Target_x86_64::Relocate::relocate): Likewise.
4668         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4669         switch.
4670         * target.h (class Target): Add plt_section_for_global and
4671         plt_section_for_local functions.  Add do_plt_section_for_global
4672         and do_plt_section_for_local virtual functions.
4673         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4674         clarifying comments.
4675         (Symbol::use_plt_offset): Handle IFUNC symbol.
4676         * object.cc (Sized_relobj::Sized_relobj): Initialize
4677         local_plt_offsets_.
4678         (Sized_relobj::local_has_plt_offset): New function.
4679         (Sized_relobj::local_plt_offset): New function.
4680         (Sized_relobj::set_local_plt_offset): New function.
4681         (Sized_relobj::do_count): Handle IFUNC symbol.
4682         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4683         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4684         is_ifunc_symbol functions.
4685         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4686         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4687         local_plt_offsets_ field.
4688         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4689         * output.h (class Output_section_data): Add non-const
4690         output_section function.
4691         (class Output_data_got): Update declarations.
4692         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4693         Add use_plt_offset parameter to global and local constructors.
4694         Change all callers.  Change local_sym_index_ field to 31 bits.
4695         Change GSYM_CODE and CONSTANT_CODE accordingly.
4696         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4697         doing a static link don't set sh_link field.
4698         (Output_data_got::Got_entry::write): Use PLT offset if
4699         appropriate.
4700         (Output_data_got::add_global_plt): New function.
4701         (Output_data_got::add_local_plt): New function.
4702         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4703         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4704         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4705         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4706         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4707         IFUNC conditional.
4708         * testsuite/ifunc-sel.h: New file.
4709         * testsuite/ifuncmain1.c: New file.
4710         * testsuite/ifuncmain1vis.c: New file.
4711         * testsuite/ifuncmod1.c: New file.
4712         * testsuite/ifuncdep2.c: New file.
4713         * testsuite/ifuncmain2.c: New file.
4714         * testsuite/ifuncmain3.c: New file.
4715         * testsuite/ifuncmod3.c: New file.
4716         * testsuite/ifuncmain4.c: New file.
4717         * testsuite/ifuncmain5.c: New file.
4718         * testsuite/ifuncmod5.c: New file.
4719         * testsuite/ifuncmain6pie.c: New file.
4720         * testsuite/ifuncmod6.c: New file.
4721         * testsuite/ifuncmain7.c: New file.
4722         * configure, testsuite/Makefile.in: Rebuild.
4723
4724 2010-08-18  Ian Lance Taylor  <iant@google.com>
4725
4726         * incremental.cc
4727         (Output_section_incremental_inputs::write_input_files): Add cast
4728         to avoid signed/unsigned comparison warning.
4729         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4730
4731 2010-08-12  Cary Coutant  <ccoutant@google.com>
4732
4733         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4734
4735 2010-08-13  Ian Lance Taylor  <iant@google.com>
4736
4737         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4738
4739 2010-08-12  Cary Coutant  <ccoutant@google.com>
4740             Doug Kwan  <dougkwan@google.com>
4741
4742         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4743         defintion overrides non-weak undef, remember that the original undef
4744         is not weak.
4745         * symtab.cc (Symbol_table::sized_write_global): For undef without
4746         an original weak binding, set binding to global in output.
4747         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4748         * testsuite/Makefile.in: Regenerate.
4749         * testsuite/strong_ref_weak_def.sh: New file.
4750         * testsuite/strong_ref_weak_def_1.c: Ditto.
4751         * testsuite/strong_ref_weak_def_2.c: Ditto.
4752
4753 2010-08-12  Cary Coutant  <ccoutant@google.com>
4754
4755         * testsuite/incremental_test.sh: Rewrite.
4756         * testsuite/incremental_test_1.c: Rewrite.
4757         * testsuite/incremental_test_2.c: Rewrite.
4758
4759 2010-08-12  Cary Coutant  <ccoutant@google.com>
4760
4761         * arm.cc (Target_arm::got_size): Add const.
4762         (Target_arm::got_entry_count): New function.
4763         (Target_arm::plt_entry_count): New function.
4764         (Target_arm::first_plt_entry_offset): New function.
4765         (Target_arm::plt_entry_size): New function.
4766         (Output_data_plt_arm::entry_count): New function.
4767         (Output_data_plt_arm::first_plt_entry_offset): New function.
4768         (Output_data_plt_arm::get_plt_entry_size): New function.
4769         * i386.cc (Target_i386::got_size): Add const.
4770         (Target_i386::got_entry_count): New function.
4771         (Target_i386::plt_entry_count): New function.
4772         (Target_i386::first_plt_entry_offset): New function.
4773         (Target_i386::plt_entry_size): New function.
4774         (Output_data_plt_i386::entry_count): New function.
4775         (Output_data_plt_i386::first_plt_entry_offset): New function.
4776         (Output_data_plt_i386::get_plt_entry_size): New function.
4777         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4778         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4779         * incremental.cc: Include target.h.
4780         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4781         parameter.  Adjust all callers.  Find incremental_got_plt section.
4782         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4783         section.
4784         (Output_section_incremental_inputs::set_final_data_size): Calculate
4785         size of incremental_got_plt section.
4786         (Output_section_incremental_inputs::do_write): Write the
4787         incremental_got_plt section.
4788         (Got_plt_view_info): New struct.
4789         (Local_got_offset_visitor): New class.
4790         (Global_got_offset_visitor): New class.
4791         (Global_symbol_visitor_got_plt): New class.
4792         (Output_section_incremental_inputs::write_got_plt): New function.
4793         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4794         Add parameter.  Adjust all callers.
4795         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4796         (Incremental_inputs::got_plt_section): New function.
4797         (Incremental_inputs::got_plt_section_): New data member.
4798         (Incremental_got_plt_reader): New class.
4799         * layout.cc (Layout::create_incremental_info_sections): Add the
4800         incremental_got_plt section.
4801         * object.h (Got_offset_list::get_list): New function.
4802         (Got offset_list::for_all_got_offsets): New function.
4803         (Sized_relobj::local_got_offset_list): New function.
4804         * powerpc.cc (Target_powerpc::got_size): Add const.
4805         (Target_powerpc::got_entry_count): New function.
4806         (Target_powerpc::plt_entry_count): New function.
4807         (Target_powerpc::first_plt_entry_offset): New function.
4808         (Target_powerpc::plt_entry_size): New function.
4809         (Output_data_plt_powerpc::entry_count): New function.
4810         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4811         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4812         * sparc.cc (Target_sparc::got_size): Add const.
4813         (Target_sparc::got_entry_count): New function.
4814         (Target_sparc::plt_entry_count): New function.
4815         (Target_sparc::first_plt_entry_offset): New function.
4816         (Target_sparc::plt_entry_size): New function.
4817         (Output_data_plt_sparc::entry_count): New function.
4818         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4819         (Output_data_plt_sparc::get_plt_entry_size): New function.
4820         * symtab.h (Symbol::got_offset_list): New function.
4821         (Symbol_table::for_all_symbols): New function.
4822         * target.h (Sized_target::got_entry_count): New function.
4823         (Sized_target::plt_entry_count): New function.
4824         (Sized_target::plt_entry_size): New function.
4825         * x86_64.cc (Target_x86_64::got_size): Add const.
4826         (Target_x86_64::got_entry_count): New function.
4827         (Target_x86_64::plt_entry_count): New function.
4828         (Target_x86_64::first_plt_entry_offset): New function.
4829         (Target_x86_64::plt_entry_size): New function.
4830         (Output_data_plt_x86_64::entry_count): New function.
4831         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4832         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4833
4834 2010-08-12  Cary Coutant  <ccoutant@google.com>
4835
4836         * archive.cc: Include incremental.h.
4837         (Archive::Archive): Initialize incremental_info_.
4838         (Archive::include_member): Record archive members in incremental info.
4839         (Add_archive_symbols::run): Record begin and end of an archive in
4840         incremental info.
4841         (Lib_group::include_member): Record objects in incremental info.
4842         * archive.h (Incremental_archive_entry): Forward declaration.
4843         (Archive::set_incremental_info): New member function.
4844         (Archive::incremental_info): New member function.
4845         (Archive::Unused_symbol_iterator): New class.
4846         (Archive::unused_symbols_begin): New member function.
4847         (Archive::unused_symbols_end): New member function.
4848         (Archive::incremental_info_): New data member.
4849         * incremental-dump.cc (find_input_containing_global): New function.
4850         (dump_incremental_inputs): Dump new incremental info sections.
4851         * incremental.cc: Include symtab.h.
4852         (Output_section_incremental_inputs): New class.
4853         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4854         new incremental info sections.
4855         (Sized_incremental_binary::do_check_inputs): Likewise.
4856         (Incremental_inputs::report_archive): Remove.
4857         (Incremental_inputs::report_archive_begin): New function.
4858         (Incremental_inputs::report_archive_end): New function.
4859         (Incremental_inputs::report_object): New function.
4860         (Incremental_inputs::finalize_inputs): Remove.
4861         (Incremental_inputs::report_input_section): New function.
4862         (Incremental_inputs::report_script): Rewrite.
4863         (Incremental_inputs::finalize): Do nothing but finalize string table.
4864         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4865         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4866         (Incremental_inputs::create_data_sections): New function.
4867         (Incremental_inputs::relocs_entsize): New function.
4868         (Output_section_incremental_inputs::set_final_data_size): New function.
4869         (Output_section_incremental_inputs::do_write): New function.
4870         (Output_section_incremental_inputs::write_header): New function.
4871         (Output_section_incremental_inputs::write_input_files): New function.
4872         (Output_section_incremental_inputs::write_info_blocks): New function.
4873         (Output_section_incremental_inputs::write_symtab): New function.
4874         * incremental.h (Incremental_script_entry): Forward declaration.
4875         (Incremental_object_entry): Forward declaration.
4876         (Incremental_archive_entry): Forward declaration.
4877         (Incremental_inputs): Forward declaration.
4878         (Incremental_inputs_header_data): Remove.
4879         (Incremental_inputs_header): Remove.
4880         (Incremental_inputs_header_write): Remove.
4881         (Incremental_inputs_entry_data): Remove.
4882         (Incremental_inputs_entry): Remove.
4883         (Incremental_inputs_entry_write): Remove.
4884         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4885         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4886         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4887         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4888         Likewise.
4889         (Incremental_input_entry): New class.
4890         (Incremental_script_entry): New class.
4891         (Incremental_object_entry): New class.
4892         (Incremental_archive_entry): New class.
4893         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4894         (Incremental_inputs::report_inputs): Remove.
4895         (Incremental_inputs::report_archive): Remove.
4896         (Incremental_inputs::report_archive_begin): New function.
4897         (Incremental_inputs::report_archive_end): New function.
4898         (Incremental_inputs::report_object): Change prototype.
4899         (Incremental_inputs::report_input_section): New function.
4900         (Incremental_inputs::report_script): Change prototype.
4901         (Incremental_inputs::get_reloc_count): New function.
4902         (Incremental_inputs::set_reloc_count): New function.
4903         (Incremental_inputs::create_data_sections): New function.
4904         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4905         (Incremental_inputs::inputs_section): New function.
4906         (Incremental_inputs::symtab_section): New function.
4907         (Incremental_inputs::relocs_section): New function.
4908         (Incremental_inputs::get_stringpool): Add const.
4909         (Incremental_inputs::command_line): Add const.
4910         (Incremental_inputs::inputs): Remove.
4911         (Incremental_inputs::command_line_key): New function.
4912         (Incremental_inputs::input_file_count): New function.
4913         (Incremental_inputs::input_files): New function.
4914         (Incremental_inputs::relocs_entsize): New function.
4915         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4916         (Incremental_inputs::finalize_inputs): Remove.
4917         (Incremental_inputs::Input_info): Remove.
4918         (Incremental_inputs::lock_): Remove.
4919         (Incremental_inputs::inputs_): Change type.
4920         (Incremental_inputs::inputs_map_): Remove.
4921         (Incremental_inputs::current_object_entry_): New data member.
4922         (Incremental_inputs::inputs_section_): New data member.
4923         (Incremental_inputs::symtab_section_): New data member.
4924         (Incremental_inputs::relocs_section_): New data member.
4925         (Incremental_inputs::reloc_count_): New data member.
4926         (Incremental_inputs_reader): New class.
4927         (Incremental_symtab_reader): New class.
4928         (Incremental_relocs_reader): New class.
4929         * layout.cc (Layout::finalize): Move finalization of incremental info
4930         and creation of incremental info sections to follow finalization of
4931         symbol table.  Set offsets for postprocessing sections.
4932         (Layout::create_incremental_info_sections): Call
4933         Incremental_inputs::create_data_sections.  Add incremental symtab
4934         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4935         sections to layout after input sections.
4936         * layout.h (struct Timespec): Forward declaration.
4937         (Layout::incremental_inputs): Add const.
4938         (Layout::create_incremental_info_sections): Add parameter.
4939         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4940         * object.cc: Include incremental.h.
4941         (Relobj::finalize_incremental_relocs): New function.
4942         (Sized_relobj::do_layout): Record input sections in incremental info.
4943         * object.h (Object::output_section): New function.
4944         (Object::output_section_offset): Moved from Relobj.
4945         (Object::get_incremental_reloc_base): New function.
4946         (Object::get_incremental_reloc_count): New function.
4947         (Object::do_output_section): New function.
4948         (Object::do_output_section_offset): Moved from Relobj.
4949         (Object::do_get_incremental_reloc_base): New function.
4950         (Object::do_get_incremental_reloc_count): New function.
4951         (Object::Object): Initialize new data members.
4952         (Relobj::output_section): Renamed do_output_section and moved to
4953         protected.
4954         (Relobj::output_section_offset): Moved to Object.
4955         (Relobj::do_get_incremental_reloc_base): New function.
4956         (Relobj::do_get_incremental_reloc_count): New function.
4957         (Relobj::allocate_incremental_reloc_counts): New function.
4958         (Relobj::count_incremental_reloc): New function.
4959         (Relobj::finalize_incremental_relocs): New function.
4960         (Relobj::next_incremental_reloc_index): New function.
4961         (Relobj::reloc_counts_): New data member.
4962         (Relobj::reloc_bases_): New data member.
4963         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4964         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4965         (Sized_relobj::incremental_relocs_scan): New function.
4966         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4967         (Sized_relobj::incremental_relocs_write): New function.
4968         (Sized_relobj::incremental_relocs_write_reltype): New function.
4969         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4970         incremental link.
4971         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4972         archives and object files elsewhere.
4973         (Add_symbols::run): Report object files here.
4974         (Finish_group::run): Report end of archive at end of group.
4975         * reloc.cc: Include layout.h, incremental.h.
4976         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4977         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4978         (Sized_relobj::incremental_relocs_scan): New function.
4979         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4980         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4981         (Sized_relobj::incremental_relocs_write): New function.
4982         (Sized_relobj::incremental_relocs_write_reltype): New function.
4983         * script.cc (read_input_script): Rewrite test for incremental link.
4984         Change call to Incremental_inputs::report_script.
4985         * symtab.h (Symbol_table::first_global_index): New function.
4986         (Symbol_table::output_count): New function.
4987
4988 2010-08-12  Doug Kwan  <dougkwan@google.com>
4989
4990         * arm.cc (Target_arm::merge_object_attributes): Check command line
4991         options --no-wchar-size-warning and --no-enum-size-warning.
4992         * options.h (General_options): Add ld-compatible options
4993         --no-enum-size-warning and --no-wchar-size-warning.
4994
4995 2010-08-04  Ian Lance Taylor  <iant@google.com>
4996
4997         * x86_64.cc (Target_x86_64::Scan::local): Use
4998         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4999         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5000         (Target_x86_64::Scan::global): Likewise.
5001         (Target_x86_64::Relocate::relocate): Likewise.
5002         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5003         Likewise.
5004
5005 2010-08-03  Cary Coutant  <ccoutant@google.com>
5006
5007         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5008         to reserve space in merged_strings vector. Keep total input size
5009         for stats.
5010         (Output_merge_string::do_print_merge_stats): Print total input size.
5011         * merge.h (Output_merge_string): Add input_size_ field.
5012         * stringpool.cc (Stringpool_template::string_length): Move
5013         implementations out of Stringpool_template class and place in
5014         stringpool.h.
5015         * stringpool.h (string_length): Move out of Stringpool_template.
5016
5017 2010-08-03  Ian Lance Taylor  <iant@google.com>
5018
5019         PR 11712
5020         * layout.cc (relaxation_loop_body): If address of load segment is
5021         set, adjust address to include headers if possible.
5022
5023 2010-08-03  Ian Lance Taylor  <iant@google.com>
5024
5025         * version.cc (version_string): Bump to 1.10.
5026
5027 2010-08-03  Ian Lance Taylor  <iant@google.com>
5028
5029         PR 11805
5030         * layout.h (enum Output_section_order): Define.
5031         (class Layout): Update declarations.
5032         * layout.cc (Layout::get_output_section): Add order parameter.
5033         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5034         is_first_non_relro parameters.  Change all callers.
5035         (Layout::choose_output_section): Likewise.
5036         (Layout::add_output_section_data): Likewise.
5037         (Layout::make_output_section): Likewise.  Set order.
5038         (Layout::default_section_order): New function.
5039         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5040         * output.cc (Output_section::Output_section): Initialize order_.
5041         Don't initialize deleted fields.
5042         (Output_segment::Output_segment): Don't initialize deleted
5043         fields.
5044         (Output_segment::add_output_section_to_load): New function
5045         replacing add_output_section.  Change all callers to call this or
5046         add_output_section_to_nonload.
5047         (Output_segment::add_output_section_to_nonload): New function.
5048         (Output_segment::remove_output_section): Rewrite.
5049         (Output_segment::add_initial_output_data): Likewise.
5050         (Output_segment::has_any_data_sections): Likewise.
5051         (Output_segment::is_first_section_relro): Likewise.
5052         (Output_segment::maximum_alignment): Likewise.
5053         (Output_segment::has_dynamic_reloc): New function replacing
5054         dynamic_reloc_count.  Change all callers.
5055         (Output_segment::has_dynamic_reloc_list): New function replacing
5056         dynamic_reloc_count_list.  Change all callers.
5057         (Output_segment::set_section_addresses): Rewrite.
5058         (Output_segment::set_offset): Rewrite.
5059         (Output_segment::find_first_and_last_list): Remove.
5060         (Output_segment::set_tls_offsets): Rewrite.
5061         (Output_segment::first_section_load_address): Likewise.
5062         (Output_segment::output_section_count): Likewise.
5063         (Output_segment::section_with_lowest_load_address): Likewise.
5064         (Output_segment::write_section_headers): Likewise.
5065         (Output_segment::print_sections_to_map): Likewise.
5066         * output.h (class Output_data): Remove dynamic_reloc_count_
5067         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5068         (Output_data::add_dynamic_reloc): Rewrite.
5069         (Output_data::has_dynamic_reloc): New function.
5070         (Output_data::dynamic_reloc_count): Remove.
5071         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5072         is_last_relro_, is_first_non_relro_, is_interp_,
5073         is_dynamic_linker_section_ fields.  Add order and set_order
5074         functions.  Remove is_relro_local, set_is_relro_local,
5075         is_last_relro, set_is_last_relro, is_first_non_relro,
5076         set_is_first_non_relro functions, is_interp, set_is_interp,
5077         is_dynamic_linker_section, and set_is_dynamic_linker_section
5078         functions.
5079         (class Output_segment): Change Output_data_list from std::list to
5080         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5081         output_bss_ fields.  Update declarations.
5082
5083 2010-08-02  Ian Lance Taylor  <iant@google.com>
5084
5085         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5086         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5087         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5088
5089 2010-08-02  Ian Lance Taylor  <iant@google.com>
5090
5091         PR 11855
5092         * script.cc (Script_options::Script_options): Initialize
5093         symbol_definitions_ and symbol_references_.
5094         (Script_options::add_symbol_assignment): Update
5095         symbol_definitions_ and symbol_references_.
5096         (Script_options::add_symbol_reference): New function.
5097         (script_symbol): New function.
5098         * script.h (class Script_options): Add symbol_definitions_ and
5099         symbol_references_ fields.
5100         (Script_options::referenced_const_iterator): New type.
5101         (Script_options::referenced_begin): New function.
5102         (Script_options::referenced_end): New function.
5103         (Script_options::is_referenced): New function.
5104         (Script_options::any_unreferenced): New function.
5105         * script-c.h (script_symbol): Declare.
5106         * yyscript.y (exp): Call script_symbol.
5107         * symtab.cc: Include "script.h".
5108         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5109         Change all callers.  Check symbols referenced by scripts.
5110         (Symbol_table::add_undefined_symbols_from_command_line): Add
5111         layout parameter.  Change all callers.
5112         (Symbol_table::do_add_undefined_symbols_from_command_line):
5113         Likewise.  Break out loop body.  Check symbols referenced by
5114         scripts.
5115         (Symbol_table::add_undefined_symbol_from_command_line): New
5116         function broken out of
5117         do_add_undefined_symbols_from_command_line.
5118         * symtab.h (class Symbol_table): Update declarations.
5119         * archive.cc: Include "layout.h".
5120         (Archive::should_include_member): Add layout parameter.  Change
5121         all callers.  Check for symbol mentioned in expression.
5122         * archive.h (class Archive): Update declaration.
5123         * object.cc (Sized_relobj::do_should_include_member): Add layout
5124         parameter.
5125         * object.h (Object::should_include_member): Add layout parameter.
5126         Change all callers.
5127         (Object::do_should_include_member): Add layout parameter.
5128         (class Sized_relobj): Update declaration.
5129         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5130         parameter.
5131         * dynobj.h (class Sized_dynobj): Update declaration.
5132         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5133         layout parameter.
5134         * plugin.h (class Sized_pluginobj): Update declaration.
5135
5136 2010-08-02  Ian Lance Taylor  <iant@google.com>
5137
5138         PR 11866
5139         * output.cc (Output_segment::set_offset): Search for the first and
5140         last sections rather than assuming that the list is in order.
5141         (Output_segment::find_first_and_last_list): New function.
5142         * output.h (class Output_segment): Update declarations.
5143         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5144         (relro_strip_test_SOURCES): New variable.
5145         (relro_strip_test_DEPENDENCIES): New variable.
5146         (relro_strip_test_LDFLAGS): New variable.
5147         (relro_strip_test_LDADD): New variable.
5148         (relro_strip_test.so): New target.
5149
5150 2010-08-02  Ian Lance Taylor  <iant@google.com>
5151
5152         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5153         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5154         (Target_i386::got_tlsdesc_section): New function.
5155         (Target_i386::got_section): Create space for GOT entries for
5156         TLSDESC relocations.
5157         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5158         R_386_TLS_GOTDESC.
5159         (Target_i386::Scan::global): Likewise.
5160         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5161         using TLSDESC GOT.
5162         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5163         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5164         (Target_x86_64::got_tlsdesc_section): New function.
5165         (Target_x86_64::got_section): Create space for GOT entries for
5166         TLSDESC relocations.
5167         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5168         R_386_TLS_GOTDESC.
5169         (Target_x86_64::Scan::global): Likewise.
5170         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5171         using TLSDESC GOT.
5172
5173 2010-08-02  Ian Lance Taylor  <iant@google.com>
5174
5175         * testsuite/final_layout.sh: Use dc to convert from hex to
5176         decimal.
5177
5178 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5179
5180         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5181         paramter to the call to gold::gc_process_relocs.
5182         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5183         paramter to the call to gold::gc_process_relocs.
5184         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5185         parameter to the call to gold::gc_process_relocs.
5186         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5187         template parameter to the call to gold::gc_process_relocs.
5188         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5189         paramter to the call to gold::gc_process_relocs.
5190         * gc.h (get_embedded_addend_size): New function.
5191         (gc_process_relocs): Save the size of the reloc for use by ICF.
5192         * icf.cc (get_section_contents): Get the addend from the text section
5193         for SHT_REL relocation sections.
5194         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5195         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5196         * int_encoding.h (read_from_pointer): New overloaded function.
5197         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5198         * testsuite/icf_sht_rel_addend_test.sh: New file.
5199         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5200         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5201
5202 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5203
5204         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5205         * Makefile.in: Regenerate.
5206         * testsuite/Makefile.in: Regenerate.
5207
5208 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5209
5210         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5211         * gold/testsuite/debug_msg.cc: Likewise.
5212         * gold/testsuite/odr_violation1.cc
5213         * gold/testsuite/odr_violation2.cc
5214
5215 2010-07-21  Cary Coutant  <ccoutant@google.com>
5216
5217         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5218         string, and length fields.
5219         (Output_merge_string::Merged_strings_list): New type.
5220         (Output_merge_string::Merged_strings_lists): New typedef.
5221         (Output_merge_string): Replace merged_strings_ with
5222         merged_strings_lists_.
5223         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5224         Merged_strings_list per input object and section.  Don't store pointer
5225         to the string.  Don't store length with each merged string entry.
5226         (Output_merge_string::finalize_merged_data): Loop over list of merged
5227         strings lists.  Recompute length of each merged string.
5228
5229 2010-07-15  Cary Coutant  <ccoutant@google.com>
5230
5231         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5232         here.
5233
5234 2010-07-14  Ian Lance Taylor  <iant@google.com>
5235
5236         * descriptors.cc (Descriptors::open): Report correct name in error
5237         message.
5238
5239 2010-07-13  Doug Kwan  <dougkwan@google.com>
5240
5241         * arm.cc (Arm_input_section::Arm_input_section): For a
5242         SHT_ARM_EXIDX section, always keeps the input sections.
5243         (Arm_input_section::set_exidx_section_link): New method.
5244         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5245         has_errors_ to false.
5246         (Arm_exidx_input_section::has_errors,
5247         Arm_exidx_input_section::set_has_errors): New methods.
5248         (Arm_exidx_input_section::has_errors_): New data member.
5249         (Arm_relobj::get_exidx_shndx_list): New method.
5250         (Arm_output_section::append_text_sections_to_list): Do not skip
5251         section without SHF_EXECINSTR.
5252         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5253         errors.
5254         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5255         section header.  Make error messages more verbose.  Check for
5256         a non-executable section linked to an EXIDX section.
5257         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5258         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5259         check that there is no deferred EXIDX section if we exit early.
5260         Instead of not making an EXIDX section in case of an error, make one
5261         and set the has_errors flag of it.
5262         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5263         in a relocatable link.
5264         (Target_arm::do_relax): Look for the EXIDX output section instead of
5265         assuming that it is called .ARM.exidx.
5266         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5267         section list.  Do not check for SHF_EXECINSTR section flags but
5268         skip any input section with errors.
5269         * output.cc (Output_section::Output_section): Initialize
5270         always_keeps_input_sections_ to false.
5271         (Output_section::add_input_section): Check for
5272         always_keeps_input_sections_.
5273         *  output.h (Output_section::always_keeps_input_sections,
5274         Output_section::set_always_keeps_input_sections): New methods.
5275         (Output_section::always_keeps_input_sections): New data member.
5276
5277 2010-07-13  Rafael Espindola  <espindola@google.com>
5278
5279         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5280         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5281
5282 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5283             Ian Lance Taylor  <iant@google.com>
5284
5285         * output.h (Output_section_lookup_maps::add_merge_section):
5286         Correct check of whether value was inserted.
5287         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5288         (Output_section_lookup_maps::add_relaxed_input_section):
5289         Likewise.
5290         * arm.cc (Target_arm::got_section): Remove used local os.
5291         * i386.cc (Target_i386::got_section): Likewise.
5292         * x86_64.cc (Target_x86_64::got_section): Likewise.
5293         * sparc.cc (Target_sparc::got_section): Likewise.
5294         (Target_sparc::relocate): Remove unused local have_got_offset.
5295         * powerpc.cc (Target_powerpc::relocate): Likewise.
5296
5297 2010-07-13  Ian Lance Taylor  <iant@google.com>
5298
5299         * compressed_output.cc (zlib_decompress): Fix signature in
5300         !HAVE_ZLIB_H case.
5301
5302         * archive.cc (Archive::include_member): Unlock an external member
5303         of a thin archive.  Don't bother to delete an object we know is
5304         NULL.
5305
5306 2010-07-12  Cary Coutant  <ccoutant@google.com>
5307
5308         * compressed_output.cc (zlib_decompress): New function.
5309         (get_uncompressed_size): New function.
5310         (decompress_input_section): New function.
5311         * compressed_output.h (get_uncompressed_size): New function.
5312         (decompress_input_section): New function.
5313         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5314         Handle compressed debug sections.
5315         * layout.cc (is_compressed_debug_section): New function.
5316         (Layout::output_section_name): Map compressed section names to
5317         canonical names.
5318         * layout.h (is_compressed_debug_section): New function.
5319         (is_debug_info_section): Recognize compressed debug sections.
5320         * merge.cc: Include compressed_output.h.
5321         (Output_merge_data::do_add_input_section): Handle compressed
5322         debug sections.
5323         (Output_merge_string::do_add_input_section): Handle compressed
5324         debug sections.
5325         * object.cc: Include compressed_output.h.
5326         (Sized_relobj::Sized_relobj): Initialize new data members.
5327         (build_compressed_section_map): New function.
5328         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5329         * object.h (Object::section_is_compressed): New method.
5330         (Object::do_section_is_compressed): New method.
5331         (Sized_relobj::Compressed_section_map): New type.
5332         (Sized_relobj::do_section_is_compressed): New method.
5333         (Sized_relobj::compressed_sections_): New data member.
5334         * output.cc (Output_section::add_input_section): Handle compressed
5335         debug sections.
5336         * reloc.cc: Include compressed_output.h.
5337         (Sized_relobj::write_sections): Handle compressed debug sections.
5338
5339 2010-07-08  Cary Coutant  <ccoutant@google.com>
5340
5341         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5342         weak when resolving to a dynamic def.
5343         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5344         for weak undef/dynamic def cases. Adjust callers.
5345         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5346         undef_binding_weak_.
5347         (Symbol_table::sized_write_globals): Adjust symbol binding.
5348         (Symbol_table::sized_write_symbol): Add binding parameter.
5349         * symtab.h (Symbol::set_undef_binding): New method.
5350         (Symbol::is_undef_binding_weak): New method.
5351         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5352         (Symbol_table::should_override): Add new parameter.
5353         (Symbol_table::sized_write_symbol): Add new parameter.
5354
5355         * testsuite/weak_undef_file1.cc: Add new test case.
5356         * testsuite/weak_undef_file2.cc: Fix header comment.
5357         * testsuite/weak_undef_test.cc: Add new test case.
5358
5359 2010-06-29  Doug Kwan  <dougkwan@google.com>
5360
5361         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5362         Initialize USE_SYMBOL_.
5363         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5364         definition.
5365         (Arm_reloc_property::uses_symbol_): New data member declaration.
5366         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5367         uses symbol value and symbol is undefined but not weakly undefined.
5368
5369 2010-06-28  Rafael Espindola  <espindola@google.com>
5370
5371         * plugin.cc (Plugin::load): Use dlerror.
5372
5373 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5374
5375         * symtab.cc (detect_odr_violations): When reporting an ODR
5376         violation, report an object where the symbol is defined.
5377
5378 2010-06-25  Doug Kwan  <dougkwan@google.com>
5379
5380         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5381         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5382         definition.
5383         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5384         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5385         target hook to detect function points.
5386         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5387         * icf.h (Icf::check_section_for_function_pointers): Change type of
5388         parameter SECTION_NAME to const reference to std::string.  Use
5389         target hook to determine if section may have unsafe pointers.
5390         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5391         method definition.
5392
5393 2010-06-21  Rafael Espindola  <espindola@google.com>
5394
5395         * fileread.cc (Input_file::find_fie): New
5396         (Input_file::open): Use Input_file::find_fie.
5397         * fileread.h (Input_file::find_fie): New
5398         * plugin.cc (set_extra_library_path): New.
5399         (Plugin::load): Add set_extra_library_path to the transfer vector.
5400         (Plugin_manager::set_extra_library_path): New.
5401         (Plugin_manager::add_input_file): Use the extra search path if set.
5402         (set_extra_library_path(): New.
5403         * plugin.h (Plugin_manager): Add set_extra_library_path and
5404         extra_search_path_.
5405
5406 2010-06-19  Cary Coutant  <ccoutant@google.com>
5407
5408         * layout.cc (gdb_sections): Add .debug_types.
5409         (lines_only_debug_sections): Likewise.
5410
5411 2010-06-18  Rafael Espindola  <espindola@google.com>
5412
5413         * plugin.cc (add_input_file,add_input_library)
5414         (Plugin_manager::add_input_file): Make filename arguments const.
5415         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5416         const.
5417
5418 2010-06-16  Doug Kwan  <dougkwan@google.com>
5419
5420         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5421         .ARM.attributes section if we have not merged any input
5422         attributes sections.
5423
5424 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5425
5426         * arm.cc: Allow combining objects with no EABI version
5427         information.
5428
5429 2010-06-15  Rafael Espindola  <espindola@google.com>
5430
5431         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5432
5433 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5434
5435         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5436         (struct iovec): Correct !HAVE_READV definition.
5437
5438 2010-06-10  Cary Coutant  <ccoutant@google.com>
5439
5440         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5441         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5442         reloc sections.
5443         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5444
5445         PR 11683
5446         * symtab.h (Symbol::is_placeholder): New member function.
5447         * target-reloc.h (relocate_section): Check for placeholder symbols.
5448
5449         * testsuite/Makefile.am (plugin_test_8): New test.
5450         (plugin_test_9): New test.
5451         * testsuite/Makefile.in: Regenerate.
5452
5453 2010-06-09  Nick Clifton  <nickc@redhat.com>
5454
5455         * yyscript.y (input_list_element): Allow strings prefixed with
5456         the '-' character.  Treat these as libraries.
5457         * script.cc (script_add_library): New function.  Adds a library
5458         specified by "-l<name>" found in an input script.
5459         * script-c.h: Add prototype for script_add_library.
5460
5461 2010-06-07  Doug Kwan  <dougkwan@google.com>
5462
5463         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5464         Restrict stub-group size to be within long conditional branch
5465         range when working around cortex-A8 erratum.
5466
5467 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5468
5469         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5470         #ifdef typo.
5471
5472 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5473
5474         PR gold/11658
5475         * output.cc
5476         (Output_section::Input_section_sort_entry::compare_section_ordering):
5477         Change to return non-zero correctly.
5478         (Output_section::Input_section_sort_section_order_index_compare
5479         ::operator()): Change to fix ambiguity in comparisons.
5480
5481 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5482
5483         * gold.h (is_wildcard_string): New function.
5484         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5485         (Layout::layout_eh_frame): Ditto.
5486         (Layout::find_section_order_index): New method.
5487         (Layout::read_layout_from_file): New method.
5488         * layout.h (Layout::find_section_order_index): New method.
5489         (Layout::read_layout_from_file): New method.
5490         (Layout::input_section_position_): New private member.
5491         (Layout::input_section_glob_): New private member.
5492         * main.cc (main): Call read_layout_from_file here.
5493         * options.h (--section-ordering-file): New option.
5494         * output.cc (Output_section::input_section_order_specified_): New
5495         member.
5496         (Output_section::Output_section): Initialize new member.
5497         (Output_section::add_input_section): Add new parameter.
5498         Keep input sections when --section-ordering-file is used.
5499         (Output_section::set_final_data_size): Sort input sections when
5500         section ordering file is specified.
5501         (Output_section::Input_section_sort_entry): Add new parameter.
5502         Check sorting type.
5503         (Output_section::Input_section_sort_entry::compare_section_ordering):
5504         New method.
5505         (Output_section::Input_section_sort_compare::operator()): Change to
5506         consider section_order_index.
5507         (Output_section::Input_section_sort_init_fini_compare::operator()):
5508         Change to consider section_order_index.
5509         (Output_section::Input_section_sort_section_order_index_compare
5510         ::operator()): New method.
5511         (Output_section::sort_attached_input_sections): Change to sort
5512         according to section order when specified.
5513         (Output_section::add_input_section<32, true>): Add new parameter.
5514         (Output_section::add_input_section<64, true>): Add new parameter.
5515         (Output_section::add_input_section<32, false>): Add new parameter.
5516         (Output_section::add_input_section<64, false>): Add new parameter.
5517         * output.h (Output_section::add_input_section): Add new parameter.
5518         (Output_section::input_section_order_specified): New
5519         method.
5520         (Output_section::set_input_section_order_specified): New method.
5521         (Input_section::Input_section): Initialize section_order_index_.
5522         (Input_section::section_order_index): New method.
5523         (Input_section::set_section_order_index): New method.
5524         (Input_section::section_order_index_): New member.
5525         (Input_section::Input_section_sort_section_order_index_compare): New
5526         struct.
5527         (Output_section::input_section_order_specified_): New member.
5528         * script-sections.cc (is_wildcard_string): Delete and move modified
5529         method to gold.h.
5530         (Output_section_element_input::Output_section_element_input): Modify
5531         call to is_wildcard_string.
5532         (Output_section_element_input::Input_section_pattern
5533         ::Input_section_pattern): Ditto.
5534         (Output_section_element_input::Output_section_element_input): Ditto.
5535         * testsuite/Makefile.am (final_layout): New test case.
5536         * testsuite/Makefile.in: Regenerate.
5537         * testsuite/final_layout.cc: New file.
5538         * testsuite/final_layout.sh: New file.
5539
5540 2010-06-01  Rafael Espindola  <espindola@google.com>
5541
5542         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5543
5544 2010-06-01  Rafael Espindola  <espindola@google.com>
5545
5546         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5547         visibility of symbols.
5548
5549 2010-05-27  Doug Kwan  <dougkwan@google.com>
5550
5551         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5552         from start of output section instead of address for a local symbol
5553         in a merged or relaxed section when doing a relocatable link.
5554
5555 2010-05-26  Rafael Espindola  <espindola@google.com>
5556
5557         PR 11604
5558         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5559         adding sections the garbage collector removed.
5560         * gold/testsuite/Makefile.am: Add test.
5561         * gold/testsuite/Makefile.in: Regenerate.
5562         * gold/testsuite/plugin_test_7.sh: New.
5563         * gold/testsuite/plugin_test_7_1.c: New.
5564         * gold/testsuite/plugin_test_7_2.c: New.
5565
5566 2010-05-26  Rafael Espindola  <espindola@google.com>
5567
5568         * script-sections.cc (Output_section_definition::set_section_addresses):
5569         Check for --section-start.
5570
5571 2010-05-26  Doug Kwan  <dougkwan@google.com>
5572
5573         * arm.cc (Arm_scan_relocatable_relocs): New class.
5574         (Target_arm::relocate_special_relocatable): New method.
5575         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5576         (Arm_relocate_functions::thumb_branch_common): Same.
5577         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5578         instead of Default_scan_relocatable_relocs.
5579         * target-reloc.h (relocate_for_relocatable): Let target handle
5580         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5581         * target.h (Sized_target::relocate_special_relocatable): New method.
5582
5583 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5584
5585         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5586
5587 2010-05-23  Doug Kwan  <dougkwan@google.com>
5588
5589         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5590         instead of a cast.
5591         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5592         with a direct branch, not a conditional branch, to a stub.
5593         * merge.cc (Output_merge_base::record_input_section): New method
5594         defintion.
5595         (Output_merge_data::do_add_input_section): Record input section if
5596         keeps-input-sections flag is set.
5597         (Output_merge_string::do_add_input_section): Ditto.
5598         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5599         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5600         INPUT_SECTIONS_.
5601         (Output_merge_base::keeps_input_sections,
5602         Output_merge_base::set_keeps_input_sections,
5603         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5604         method definitions.
5605         (Output_merge_base::Input_sections): New type declaration.
5606         (Output_merge_base::input_sections_begin,
5607         Output_merge_base::input_sections_end,
5608         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5609         (Output_merge_base::bool keeps_input_sections_,
5610         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5611         Output_merge_base::input_sections_): New data members.
5612         (Output_merge_data::do_set_keeps_input_sections): New method
5613         defintion.
5614         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5615         * output.cc (Output_section::Input_section::relobj): Move method
5616         defintion from class declaration to here and handle merge sections.
5617         (Output_section::Input_section::shndx): Ditto.
5618         (Output_section::Output_section): Remove initializations of removed
5619         data members and initialize new data member LOOKUP_MAPS_.
5620         (Output_section::add_input_section): Set keeps-input-sections flag
5621         for a newly created merge output section as appropriate.  Adjust code
5622         to use Output_section_lookup_maps class.
5623         (Output_section::add_relaxed_input_section): Adjst code for lookup
5624         maps code refactoring.
5625         (Output_section::add_merge_input_section): Add a new parameter
5626         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5627         class.  If adding input section to a newly created merge output
5628         section fails, remove the new merge section.
5629         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5630         Adjust code for use of the Output_section_lookup_maps class.
5631         (Output_section::find_merge_section): Ditto.
5632         (Output_section::build_lookup_maps): New method defintion.
5633         (Output_section::find_relaxed_input_section): Adjust code to use
5634         Output_section_lookup_maps class.
5635         (Output_section::get_input_sections): Export merge sections.  Adjust
5636         code to use Output_section_lookup_maps class.
5637         (Output_section:::add_script_input_section): Adjust code to use
5638         Output_section_lookup_maps class.  Update lookup maps for merge
5639         sections also.
5640         (Output_section::discard_states): Use Output_section_lookup_maps.
5641         (Output_section::restore_states): Same.
5642         * output.h (Merge_section_properties): Move class defintion out of
5643         Output_section.
5644         (Output_section_lookup_maps): New class.
5645         (Output_section::Input_section::is_merge_section): New method
5646         defintion.
5647         (Output_section::Input_section::relobj): Move defintion out of class
5648         defintion.  Declare method only.
5649         (Output_section::Input_section::shndx): Ditto.
5650         (Output_section::Input_section::output_merge_base): New method defintion.
5651         (Output_section::Input_section::u2_.pomb): New union field.
5652         (Output_section::Merge_section_by_properties_map,
5653         Output_section::Output_section_data_by_input_section_map,
5654         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5655         Remove types.
5656         (Output_section::add_merge_input_section): Add new parameter
5657         KEEPS_INPUT_SECTIONS.
5658         (Output_section::build_lookup_maps): New method declaration.
5659         (Output_section::merge_section_map_,
5660         Output_section::merge_section_by_properties_map_,
5661         Output_section::relaxed_input_section_map_,
5662         Output_section::is_relaxed_input_section_map_valid_): Remove data
5663         members.
5664         (Output_section::lookup_maps_): New data member.
5665
5666 2010-05-21  Doug Kwan  <dougkwan@google.com>
5667
5668         PR gold/11619
5669         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5670         avoid a compilation error.
5671
5672 2010-05-19  Rafael Espindola  <espindola@google.com>
5673
5674         * script-sections.cc (Output_section_definition::allocate_to_segment):
5675         Update the phdrs_list even when the output section is NULL.
5676         * testsuite/Makefile.am: Add test.
5677         * testsuite/Makefile.in: Regenerate.
5678         * testsuite/script_test_9.cc: New.
5679         * testsuite/script_test_9.sh: New.
5680         * testsuite/script_test_9.t: New.
5681
5682 2010-05-19  Doug Kwan  <dougkwan@google.com>
5683
5684         * arm.cc (Arm_input_section::original_size): New method.
5685         (Arm_input_section::do_addralign): Add a cast.
5686         (Arm_input_section::do_output_offset): Remove static cast.
5687         (Arm_input_section::original_addralign,
5688          Arm_input_section::original_size_): Change type to uint32_t.
5689         (Arm_input_section::init): Add safe casts for section alignment
5690         and size.
5691         (Arm_input_section::set_final_data_size): Do not set address and
5692         offset of stub table.
5693         (Arm_output_section::fix_exidx_coverage): Change use of of
5694         Output_section::Simple_input_section to that of
5695         Output_section::Input_section.
5696         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5697         except for the first pass.
5698         * output.cc (Output_section::get_input_sections): Change type of
5699         input_sections to std::list<Input_section>.
5700         (Output_section::add_script_input_section): Rename from
5701         Output_section::add_simple_input_section.  Change type of SIS
5702         parameter from Simple_input_section to Input_section.
5703         * output.h (Output_section::Simple_input_section): Remove class.
5704         (Output_section::Input_section): Change class visibility to public.
5705         (Output_section::Input_section::addralign): Use stored alignments
5706         for special input sections if set.
5707         (Output_section::Input_section::set_addralign): New method.
5708         (Output_section::get_input_sections): Change parameter type from
5709         list of Simple_input_section to list of Input_section.
5710         (Output_section::add_script_input_section): Rename from
5711         Output_section::add_simple_input_section. Change first parameter's
5712         type from Simple_input_section to Input_section and remove the
5713         second and third parameters.
5714         * script-sections.cc (Input_section::Input_section_list): Change
5715         type to list of Output_section::Input_section/
5716         (Input_section_info::Input_section_info): Change parameter type of
5717         INPUT_SECTION to Output_section::Input_section.
5718         (Input_section_info::input_section): Change return type.
5719         (Input_section_info::input_section_): Change type to
5720         Output_section::Input_section.
5721         (Output_section_element_input::set_section_addresses): Adjust code
5722         to use Output_section::Input_section instead of
5723         Output_section::Simple_input_section.  Adjust code for renaming
5724         of Output_section::add_simple_input_section.
5725         (Orphan_output_section::set_section_addresses): Ditto.
5726
5727 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5728
5729         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5730         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5731
5732 2010-05-18  Rafael Espindola  <espindola@google.com>
5733
5734         * options.cc (General_options::finalize): Handle -nostdlib.
5735         * options.h (nostdlib): New option.
5736         * script.cc (script_add_search_dir): Handle -nostdlib.
5737
5738 2010-05-12  Doug Kwan  <dougkwan@google.com>
5739
5740         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5741         attributes section only if there no attributes section after merging.
5742         (Target_arm::merge_object_attributes): Move value of
5743         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5744         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5745         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5746         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5747         and arm_attr_merge_7.stdout.
5748         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5749         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5750         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5751         arm_attr_merge_7b.o): New rules.
5752         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5753         arm_attr_merge_7
5754         * testsuite/Makefile.in: Regenerate.
5755         * testsuite/arm_attr_merge.sh: New file.
5756         * testsuite/arm_attr_merge_[67][ab].s: Same.
5757
5758 2010-05-05  Nick Clifton  <nickc@redhat.com>
5759
5760         * po/es.po: Updated Spanish translation.
5761
5762 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5763
5764         * Makefile.am (install-exec-local): Properly install gold as
5765         default cross linker.
5766         * Makefile.in: Regenerated.
5767
5768 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5769             Nick Clifton  <nickc@redhat.com>
5770
5771         * configure.ac (install_as_default): Define and set to false
5772         unless --enable-gold or --enable-gold=both/gold has been
5773         specified.
5774         * configure: Regenerate.
5775
5776         * Makefile.am (install-exec-local): Install the executable as
5777         'ld.gold'.  If install_as_default is true then also install it as
5778         'ld'.
5779         * Makefile.in: Regenerated.
5780
5781 2010-04-24  Ian Lance Taylor  <iant@google.com>
5782
5783         * layout.cc (Layout::layout_reloc): In relocatable link don't
5784         combine reloc sections for grouped sections.
5785
5786 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5787
5788         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5789         sections that are not ordinary to icf.
5790         * icf.cc (get_section_contents): Handle relocation pointing to section
5791         with no object or shndx information.
5792         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5793         * testsuite/Makefile.in: Regenerate.
5794         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5795         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5796
5797 2010-04-22  Ian Lance Taylor  <iant@google.com>
5798
5799         * expression.cc (Expression::Expression_eval_info): Add
5800         result_alignment_pointer field.
5801         (Expression::eval_with_dot): Add result_alignment_pointer
5802         parameter.  Change all callers.
5803         (Expression::eval_maybe_dot): Likewise.
5804         (class Binary_expression): Add alignment_pointer parameter to
5805         left_value and right_value.  Change all callers.
5806         (BINARY_EXPRESSION): Set result alignment.
5807         (class Trinary_expression): Add alignment_pointer parameter to
5808         arg2_value and arg3_value.  Change all callers.
5809         (Trinary_cond::value): Set result alignment.
5810         (Max_expression::value, Min_expression::value): Likewise.
5811         (Align_expression::value): Likewise.
5812         * script-sections.cc (class Sections_element): Add dot_alignment
5813         parameter to set_section_addresses virtual function.  Update
5814         instantiations.
5815         (class Output_section_element): Likewise.
5816         (Script_sections::create_segments): Add dot_alignment parameter.
5817         Change all callers.
5818         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5819         (Script_sections::set_phdrs_clause_addresses): Likewise.
5820         * script-sections.h: Update declarations.
5821         * script.h: Update declarations.
5822         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5823         min_p_align.
5824         * testsuite/script_test_3.t: Set large alignment.
5825         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5826         segment has expected alignment.
5827
5828 2010-04-22  Nick Clifton  <nickc@redhat.com>
5829
5830         * po/gold.pot: Updated by the Translation project.
5831         * po/vi.po: Updated Vietnamese translation.
5832
5833 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5834
5835         * testsuite/Makefile.am (check_PROGRAMS): Add
5836         icf_virtual_function_folding_test.
5837         * testsuite/Makefile.in: Regenerated.
5838
5839 2010-04-15  Andrew Haley  <aph@redhat.com>
5840
5841         * options.h (merge_exidx_entries): New option.
5842         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5843         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5844         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5845         (Target_arm::merge_exidx_entries): New function.
5846         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5847         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5848         to Arm_exidx_fixup constructor.
5849         Add new arg, merge_exidx_entries.
5850         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5851         Arm_output_section::fix_exidx_coverage.
5852
5853 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5854
5855         * icf.cc (get_section_contents): Check for preemptible functions.
5856         Ignore addend when appropriate.
5857         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5858         section folded.
5859         (add_from_relobj): Check for section folded.
5860         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5861         * symtab.h (should_add_dynsym_entry): Add new parameter.
5862         * target-reloc.h (scan_relocs): Check for section folded.
5863         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5864         Check reloc types for function pointers in shared objects.
5865         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5866         case.
5867         (icf_preemptible_functions_test): New test case.
5868         (icf_string_merge_test): New test case.
5869         * testsuite.Makefile.in: Regenerate.
5870         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5871         bar_glob.  Refactor code.
5872         * testsuite/icf_preemptible_functions_test.cc: New file.
5873         * testsuite/icf_preemptible_functions_test.sh: New file.
5874         * testsuite/icf_string_merge_test.cc: New file.
5875         * testsuite/icf_string_merge_test.sh: New file.
5876         * testsuite/icf_virtual_function_folding_test.cc: New file.
5877         * testsuite/icf_virtual_function_folding_test.sh: New file.
5878
5879 2010-04-14  Doug Kwan  <dougkwan@google.com>
5880
5881         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5882         for local symbol recounting if we remove a section due to ICF.
5883         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5884         there are no regular objects in input.
5885
5886 2010-04-13  Doug Kwan  <dougkwan@google.com>
5887
5888         * arm.cc (Arm_input_section::set_final_data_size): Compute
5889         accurate final data size instead of using current data size.
5890
5891 2010-04-09  Doug Kwan  <dougkwan@google.com>
5892
5893         * layout.cc (Layout::choose_output_section): Handle script section
5894         types.
5895         (Layout::make_output_section_for_script): Add section type parameter.
5896         Handle script section types.
5897         * layout.h (Layout::make_output_section_for_script): Add section
5898         type parameter.
5899         * output.cc (Output_section::Output_section): Initialize data member
5900         is_noload_.
5901         (Output_section::do_reset_address_and_file_offset): Do not set address
5902         to 0 if section is a NOLOAD section.
5903         * output.h (Output_section::is_noload): New method.
5904         (Output_section::set_is_noload): Ditto.
5905         (Output_section::is_noload_): New data member.
5906         * script-c.h (Script_section_type): New enum type.
5907         (struct Parser_output_section_header): Add new file section_type.
5908         * script-sections.cc (Sections_element::output_section_name): Add
5909         parameter for returning script section type.
5910         (Output_section_definition::output_section_name): Ditto.
5911         (Output_section_definition::section_type)P; New method.
5912         (Output_section_definiton::script_section_type_name): Ditto.
5913         (Output_section_definition::script_section_type_): New data member.
5914         (Output_section_definition::Output_section_definition): Initialize
5915         data member Output_section_definition::script_section_type_.
5916         (Output_section_definition::create_sections): Pass script section type
5917         to Layout::make_output_section_for_script.
5918         (Output_section_definition::output_section_name): Return script
5919         section type to caller.
5920         (Output_section_definition::set_section_address): Do not advance
5921         dot value and load address if section type is NOLOAD.  Set address
5922         of NOLOAD sections regardless of section flags.
5923         (Output_section_definition::print): Print section type if it is
5924         not SCRIPT_SECTION_TYPE_NONE.
5925         (Output_section_definition::section_type): New method.
5926         (Output_section_definition::script_section_type_name): Ditto.
5927         (Script_sections::output_section_name): Add new parameter
5928         PSECTION_TYPE for returning script section type.  Pass it to
5929         section elements.  Handle discard sections.
5930         (Sort_output_sections::operator()): Handle NOLOAD sections.
5931         * script-sections.h (Script_sections::Section_type): New enum type.
5932         (Script_sections::output_section_name): Add a new parameter for
5933         returning script section type.
5934         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5935         INFO and NOLOAD.
5936         * yyscript.y (union): Add new field SECTION_TYPE.
5937         (COPY, DSECT, INFO, NOLOAD): New tokens.
5938         (opt_address_and_section_type): Change type to output_section_header.
5939         (section_type): New non-terminal
5940         (section_header): Handle section type.
5941         (opt_address_and_section_type): Return section type value.
5942
5943 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5944
5945         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5946         * testsuite/plugin_common_test_2.c (foo): Likewise.
5947
5948 2010-04-08  Doug Kwan  <dougkwan@google.com>
5949
5950         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5951         Output_merge_data.
5952         * output.cc (Output_section::add_merge_input_section): Simplify
5953         code and return status of Output_merge_base::add_input_section.
5954         Update merge section map only if Output_merge_base::add_input_section
5955         returns true.
5956
5957 2010-04-07  Doug Kwan  <dougkwan@google.com>
5958
5959         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5960         if section is marked as containing instructions but has no mapping
5961         symbols.
5962         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5963         correct section index.
5964         (Arm_relobj::find_linked_text_section): Ditto.
5965
5966 2010-04-07  Cary Coutant  <ccoutant@google.com>
5967
5968         * archive.cc (include_member): Destroy Read_symbols_data object before
5969         releasing file.
5970         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5971         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5972         (Read_symbols_data::~Read_symbols_data) New destructor.
5973         (Section_relocs::Section_relocs) New constructor.
5974         (Section_relocs::~Section_relocs) New destructor.
5975         (Read_relocs_data::Read_relocs_data) New constructor.
5976         (Read_relocs_data::~Read_relocs_data) New destructor.
5977         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5978         pointers to NULL after deleting.
5979
5980 2010-04-07  Doug Kwan  <dougkwan@google.com>
5981
5982         * arm.cc: Replace "endianity" with "endianness" in comments.
5983         (Arm_exidx_cantunwind): Ditto.
5984         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5985         (Arm_relobj::merge_flags_and_attributes): New method.
5986         (Arm_relobj::merge_flags_and_attributes_): New data member.
5987         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5988         (Arm_relobj::scan_sections_for_stubs): Ditto.
5989         (Arm_relobj::do_read_symbols): Check to see if we really want to
5990         merge processor-specific flags and attributes.  Exit early if
5991         an object is empty except for section names and the undefined symbol.
5992         (Target_arm::do_finalize_sections): Move check for ELF format to
5993         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5994         attributes from a regular object only when we have determined that
5995         it is aapropriate.  Do not create an .ARM.attributes section in
5996         output if there is no regular input object.
5997         (Target_arm::merge_processor_specific_flags): Check
5998         --warn-mismatch before printing any error.
5999         (Target_arm::merge_object_attributes): Ditto.
6000         * gold.cc (queue_middle_tasks): Handle the case in which there is
6001         no regular object in input.
6002         * options.cc (General_options::parse_EB): New method.
6003         (General_options::parse_EL): Same.
6004         (General_options::General_options): Initialize endianness_.
6005         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6006         New options.
6007         (General_options::Endianness): New enum.
6008         (General_options::endianness): New method.
6009         (General_options::endianness_): New data member.
6010         * parameters.cc (Parameters::set_options): Check target endianness.
6011         (Parameters::set_target_once): Ditto.
6012         (Parameters::check_target_endianness): New method.
6013         (parameters_force_valid_target): If either -EL or -EB is specified,
6014         use it to define endianness of default target.
6015         * parameters.h (Parameters::check_target_endianness): New method
6016         declaration.
6017         * target.h (class Target): Change "endianity" to "endianness"
6018         in comments.
6019
6020 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6021
6022         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6023         * configure: Regenerate.
6024         * Makefile.in: Regenerate.
6025         * testsuite/Makefile.in: Regenerate.
6026
6027 2010-04-06  Cary Coutant  <ccoutant@google.com>
6028
6029         gcc PR lto/42757
6030         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6031         prevailing definitions of common symbols.
6032         * testsuite/plugin_test_6.sh: New test case.
6033         * testsuite/plugin_common_test_1.c: New test case.
6034         * testsuite/plugin_common_test_2.c: New test case.
6035         * testsuite/Makefile.am (plugin_test_6): New test case.
6036         * testsuite/Makefile.in: Regenerate.
6037
6038 2010-04-06  Nick Clifton  <nickc@redhat.com>
6039
6040         * po/vi.po: New Vietnamese translation.
6041
6042 2010-03-30  Doug Kwan  <dougkwan@google.com>
6043
6044         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6045
6046 2010-03-25  Doug Kwan  <dougkwan@google.com>
6047
6048         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6049         to avoid a conversion warning on a 32-bit host.
6050
6051 2010-03-24  Ian Lance Taylor  <iant@google.com>
6052
6053         * testsuite/script_test_3.t: Add a TLS segment.
6054         * testsuite/Makefile.am (check_PROGRAMS): Add
6055         tls_phdrs_script_test.
6056         (tls_phdrs_script_test_SOURCES): Define.
6057         (tls_phdrs_script_test_DEPENDENCIES): Define.
6058         (tls_phdrs_script_test_LDFLAGS): Define.
6059         (tls_phdrs_script_test_LDADD): Define.
6060         * testsuite/Makefile.in: Rebuild.
6061
6062 2010-03-23  Cary Coutant  <ccoutant@google.com>
6063
6064         * fileread.cc (find_or_make_view): Fix comment.
6065
6066 2010-03-23  Ian Lance Taylor  <iant@google.com>
6067
6068         * script-sections.cc (class Orphan_section_placement): Define
6069         PLACE_TLS and PLACE_TLS_BSS.
6070         (Orphan_section_placement::Orphan_section_placement): Initialize
6071         new places.
6072         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6073         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6074         (tls_script_test_SOURCES): Define.
6075         (tls_script_test_DEPENDENCIES): Define.
6076         (tls_script_test_LDFLAGS): Define.
6077         (tls_script_test_LDADD): Define.
6078         * testsuite/Makefile.in: Rebuild.
6079
6080 2010-03-22  Doug Kwan  <dougkwan@google.com>
6081
6082         * arm.cc (Arm_relocate_functions::abs8,
6083         Arm_relocate_functions::abs16): Use correct check for overflow
6084         specified in the ARM ELF specs.
6085         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6086         target of a BLX instruction specially.
6087         (Reloc_stub::stub_type_for_reloc): Ditto.
6088         (Relocate::relocate): Use symbolic names instead of numeric relocation
6089         codes to report error.
6090         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6091         workaround.
6092         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6093         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6094         thumb2_blx_out_of_range.stdout
6095         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6096         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6097         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6098         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6099         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6100         thumb2_blx_in_range, thumb2_blx_in_range.o,
6101         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6102         thumb2_blx_out_of_range.o): New rules.
6103         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6104         thumb2_blx_in_range and thumb2_blx_out_of_range.
6105         * testsuite/Makefile.in: Regenerate.
6106         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6107         * testsuite/thumb_blx_in_range.s: New file.
6108         * testsuite/thumb_blx_out_of_range.s: New file.
6109
6110 2010-03-22  Rafael Espindola  <espindola@google.com>
6111
6112         * archive.cc (Should_include): Move to archive.h.
6113         (should_include_member): Make it a member of Archive.
6114         (Lib_group): New.
6115         (Add_lib_group_symbols): New.
6116         * archive.h: Include options.h.
6117         (Archive_member): Moved from Archive.
6118         (Should_include): Moved from archive.cc.
6119         (Lib_group): New.
6120         (Add_lib_group_symbols): New.
6121         * dynobj.cc (do_should_include_member): New.
6122         * dynobj.h (do_should_include_member): New.
6123         * gold.cc (queue_initial_tasks): Update call to queue.
6124         * main.cc (main): Print lib group stats.
6125         * object.cc (do_should_include_member): New.
6126         * object.h: Include archive.h.
6127         (Object::should_include_member): New.
6128         (Object::do_should_include_member): New.
6129         (Sized_relobj::do_should_include_member): New.
6130         * options.cc (General_options::parse_start_lib): New.
6131         (General_options::parse_end_lib): New.
6132         (Input_arguments::add_file): Handle lib groups.
6133         (Input_arguments::start_group): Check we are not in a lib.
6134         (Input_arguments::start_lib): New.
6135         (Input_arguments::end_lib): New.
6136         * options.h (General_options): Add start_lib and end_lib.
6137         (Input_argument::lib_): New.
6138         (Input_argument::lib): New.
6139         (Input_argument::is_lib): New.
6140         (Input_file_lib): New.
6141         (Input_arguments::in_lib_): New.
6142         (Input_arguments::in_lib): New.
6143         (Input_arguments::start_lib): New.
6144         (Input_arguments::end_lib_): New.
6145         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6146         in unused members as preempted.
6147         (Sized_pluginobj::do_should_include_member): New.
6148         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6149         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6150         return the blocker.
6151         (Read_symbols::do_whole_lib_group): New.
6152         (Read_symbols::do_lib_group): New.
6153         (Read_symbols::do_read_symbols): Handle lib groups.
6154         (Read_symbols::get_name): Handle lib groups.
6155         * readsyms.h (Read_symbols): Add an archive member pointer.
6156         (Read_symbols::do_whole_lib_group): New.
6157         (Read_symbols::do_lib_group): New.
6158         (Read_symbols::member_): New.
6159         * script.cc (read_input_script): Update call to queue_soon.
6160
6161 2010-03-19  Doug Kwan  <dougkwan@google.com>
6162
6163         * arm.cc (Stub_table::Stub_table): Initialize new data members
6164         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6165         (Stub_table::add_reloc_stub): Assign stub offset and update
6166         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6167         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6168         New data members.
6169         (Stub_table::update_data_size_and_addralign): Use
6170         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6171         instead of going over all reloc stubs.
6172         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6173         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6174         Stringpool_template::offset_ to size of Stringpool_char.
6175         (Stringpool_template::new_key_offset): Remove code to initialize
6176         Stringpool_template::offset_.
6177         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6178         Stringpool_template::offset_ to zero.
6179
6180 2010-03-15  Doug Kwan  <dougkwan@google.com>
6181
6182         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6183         offset_.
6184         (Stringpool_template::new_key_offset): New method.
6185         (Stringpool_template::add_string): Assign offsets when adding new
6186         strings.
6187         (Stringpool_template::set_string_offsets): Do not set string offsets
6188         when not optimizing.
6189         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6190         member size_.
6191         (Chunked_vector::clear): Clear size_.
6192         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6193         (Chunked_vector::size): Return size_.
6194         (Chunked_vector::push_back): Use size_ to find insert position.
6195         (Chunked_vector::size_): New data member.
6196         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6197         (Stringpool_template::new_key_offset): New method declaration.
6198         (Stringpool_template::offset_): New data member.
6199
6200 2010-03-15   Rafael Espindola  <espindola@google.com>
6201
6202         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6203         Add_symbols' constructor.
6204         * readsyms.h (Add_symbols): Remove the input_group member.
6205
6206 2010-03-10  Ian Lance Taylor  <iant@google.com>
6207
6208         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6209         target to ask whether a reference to a symbol requires a stack
6210         split.
6211         * target.h (Target::is_call_to_non_split): New function.
6212         (Target::do_is_call_to_non_split): Declare virtual function.
6213         * target.cc: Include "symtab.h".
6214         (Target::do_is_call_to_non_split): New function.
6215         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6216
6217 2010-03-10  Cary Coutant  <ccoutant@google.com>
6218
6219         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6220         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6221         (File_read::open[2]): Add whole_file_view_ to list of views.
6222         (File_read::make_view): Remove test of whole_file_view_.
6223         (File_read::find_or_make_view): Create whole_file_view_ if
6224         necessary.
6225         (File_read::clear_views): Replace bool parameter with enum;
6226         adjust all callers.  Don't delete views with permanent data;
6227         do delete cached views and views from archives if
6228         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6229         if clearing the corresponding view.
6230         * fileread.h (File_read::Clear_views_mode): New enum.
6231         (File_read::View::is_permanent_view): New method.
6232         (File_read::clear_views): Replace bool parameter
6233         with enum; adjust all callers.
6234         * options.h (General_options): Change keep_files_mapped option;
6235         add map_whole_files.
6236         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6237         releasing the file.
6238         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6239         the file.
6240
6241 2010-03-10  David S. Miller  <davem@davemloft.net>
6242
6243         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6244
6245 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6246
6247         * icf.cc (get_section_contents): Add '@' marker after processing the
6248         merge reloc.
6249
6250 2010-03-08  Doug Kwan  <dougkwan@google.com>
6251
6252         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6253         due to a conversion warning.
6254         (Arm_relobj::update_output_local_symbol_count): Check for local
6255         symbol with unset output index.
6256
6257 2010-03-05  Ian Lance Taylor  <iant@google.com>
6258
6259         * options.h (class General_options): Add --spare-dynamic-tags.
6260         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6261         --spare-dynamic-tags.
6262
6263 2010-03-05  Ian Lance Taylor  <iant@google.com>
6264
6265         * incremental.cc: Include "libiberty.h".
6266
6267 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6268
6269         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6270         function, is_info_ member.
6271         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6272         (Versions::Versions): Update caller.
6273         (Versions::define_base_version): Likewise.
6274         (Versions::add_def): Likewise.
6275
6276 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6277
6278         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6279         (Scan::possible_function_pointer_reloc): New function.
6280         (Scan::local_reloc_may_be_function_pointer): Change to call
6281         possible_function_pointer_reloc.
6282         (Scan::global_reloc_may_be_function_pointer): Ditto.
6283         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6284         relocations in ".data.rel.ro._ZTV" section.
6285         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6286         * testsuite/icf_safe_so_test.cc: Ditto.
6287         * testsuite/icf_safe_test.cc: Ditto.
6288         * testsuite/icf_safe_test.sh: Ditto.
6289
6290 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6291             Ian Lance Taylor  <iant@google.com>
6292
6293         * target-reloc.h (relocate_section): Check the symbol table index
6294         for -1U before setting the local symbol index.
6295         (scan_relocatable_relocs): If copying the relocation, record that
6296         the local symbol is required.
6297         * object.h (Symbol_value::is_output_symtab_index_set): New
6298         function.
6299         (Symbol_value::may_be_discarded_from_output_symtab): New
6300         function.
6301         (Symbol_value::has_output_symtab_entry): New function.
6302         (Symbol_value::needs_output_symtab_entry): Remove.
6303         (Symbol_value::output_symtab_index): Make sure the symbol index is
6304         set.
6305         (Symbol_value::set_output_symtab_index): Make sure the symbol
6306         index is not set.  Make sure the new index is valid.
6307         (Symbol_value::set_must_have_output_symtab_entry): New function.
6308         (Symbol_value::has_output_dynsym_entry): New function.
6309         (Symbol_value::set_output_dynsym_index): Make sure the new index
6310         is valid.
6311         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6312         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6313         local symbol if permitted.
6314         (Sized_relobj::do_finalize_local_symbols): Call
6315         is_output_symtab_index_set rather than needs_output_symtab_entry.
6316         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6317         rather than needs_output_symtab_entry.  Call
6318         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6319         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6320         is_output_symtab_index_set rather than needs_output_symtab_entry.
6321         * testsuite/discard_locals_relocatable_test.c: New file.
6322         * testsuite/discard_locals_test.sh: Test -r.
6323         * testsuite/Makefile.am (check_DATA): Add
6324         discard_locals_relocatable_test1.syms,
6325         discard_local_relocatable_test2.syms.
6326         (MOSTLYCLEANFILES): Likewise.  Also add
6327         discard_locals_relocatable_test1.lout and
6328         discard_locals_relocatable_test2.out.
6329         (discard_locals_relocatable_test1.syms): New target.
6330         (discard_locals_relocatable_test.o): New target.
6331         (discard_locals_relocatable_test1.out): New target.
6332         (discard_locals_relocatable_test2.syms): New target.
6333         (discard_locals_relocatable_test2.out): New target.
6334         (various): Add missing ../ld-new dependencies.
6335         * testsuite/Makefile.in: Rebuild.
6336
6337 2010-03-03  Nick Clifton  <nickc@redhat.com>
6338
6339         * po/fi.po: New Finnish translation.
6340
6341 2010-03-01  Doug Kwan  <dougkwan@google.com>
6342
6343         * layout.cc (Layout::Layout): Force section types of .init_array*,
6344         .preinit_array* and .fini_array* sections.
6345         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6346         Fix check of return value of std::string::find.().
6347         (Output_section::Input_section_sort_compare::operator()): Remove
6348         comment about .init_array.
6349         (Output_section::Input_section_sort_init_fini_compare::operator()):
6350         New method.
6351         (Output_section::sort_attached_input_sections): Handle .init_array
6352         and .fini_array specially.
6353         * output.h (Output_section::Inut_section_sort_compare): Update
6354         comment.
6355         (Output_section::Input_section_sort_init_fini_compare): New struct.
6356
6357 2010-02-26  Doug Kwan  <dougkwan@google.com>
6358
6359         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6360         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6361         * testsuite/debug_msg.sh: Avoid matching source line number for
6362         use of global variable undef_int.
6363
6364 2010-02-26  Doug Kwan  <dougkwan@google.com>
6365
6366         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6367         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6368         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6369         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6370         * options.cc (General_options::General_options): Initialize member
6371         fix_v4bx_.
6372         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6373         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6374         and rm_no_fix_v4bx.stdout
6375         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6376         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6377         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6378         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6379         and arm_no_fix_v4bx.
6380         * Makefile.in: Regenerate.
6381         * testsuite/arm_fix_v4bx.s: New file.
6382         * testsuite/arm_fix_v4bx.sh: Ditto.
6383
6384 2010-02-24  Doug Kwan  <dougkwan@google.com>
6385
6386         * arm.cc (Target_arm::got_section): Make the .got section the first
6387         non RELRO section in the data segment.
6388         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6389         suffixes of section names.
6390
6391 2010-02-24  Doug Kwan  <dougkwan@google.com>
6392
6393         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6394         flags and attributes merging if an input file is a binary file.
6395         * fileread.cc (Input_file::open): Record format of original file.
6396         * fileread.h (Input_file::Format): New enum type.
6397         (Input_file::Input_file): Initialize data member format_.
6398         (Input_file::format): New method definition.
6399         (Input_file::format_):: New data member.
6400
6401 2010-02-24  Doug Kwan  <dougkwan@google.com>
6402
6403         * arm.cc (Arm_output_data_got): New class.
6404         (ARM_TCB_SIZE): New constant
6405         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6406         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6407         If user uses a script with a SECTIONS clause, issue only a warning
6408         for a misplaced EXIDX input section.  Otherwise, issue an error.
6409         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6410         garbage collection.
6411         (Target_arm::got_mode_index_entry): Handle static linking.
6412         (Target_arm::Scan::local): Ditto.
6413         (Target_arm::Scan::global): Ditto.
6414         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6415         all incorrectly implemented relocations.
6416         (Target_arm::fix_exidx_coverage): Pass layout to
6417         Arm_output_section::fix_exidx_coverage.
6418         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6419         from ".ARM.exidx." and ".ARM.extab.".
6420
6421 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6422
6423         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6424         section if it does not already exist.
6425         * attributes.cc (Attributes_section_data::Attributes_section_data):
6426         Don't crash if size is zero.
6427
6428 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6429             Ian Lance Taylor  <iant@google.com>
6430
6431         * gold.cc (queue_middle_tasks): If no input files were opened,
6432         exit.
6433         * workqueue.h (Task_function::Task_function): Assert that there is
6434         a blocker.
6435
6436 2010-02-22  Doug Kwan  <dougkwan@google.com>
6437
6438         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6439         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6440         types to avoid warnings due to different uint64_t implementations
6441         on different hosts.
6442
6443 2010-02-21  Doug Kwan  <dougkwan@google.com>
6444
6445         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6446         handling of the maximum backward branch offset.
6447         (Arm_relocate_functions::thumb_branch_common): Ditto.
6448         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6449         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6450         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6451         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6452         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6453         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6454         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6455         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6456         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6457         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6458         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6459         thumb2_bl_out_of_range.o): New rules.
6460         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6461         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6462         thumb2_bl_out_of_range
6463         * testsuite/Makefile.in: Regenerate.
6464         * testsuite/arm_bl_in_range.s: New file.
6465         * testsuite/arm_bl_out_of_range.s: Ditto.
6466         * testsuite/arm_branch_in_range.sh: Ditto.
6467         * testsuite/arm_branch_range.t: Ditto.
6468         * testsuite/thumb2_branch_range.t: Ditto.
6469         * testsuite/thumb_bl_in_range.s: Ditto.
6470         * testsuite/thumb_bl_out_of_range.s: Ditto.
6471         * testsuite/thumb_branch_range.t: Ditto.
6472
6473 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6474
6475         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6476         Add reloc offset information.
6477         * icf.cc (get_section_contents): Change iterators to point to the new
6478         vectors. Add reloc offset information to the contents.
6479         * icf.h (Icf::Sections_reachable_info): New typedef.
6480         (Icf::Sections_reachable_list): New typedef.
6481         (Icf::Offset_info): New typedef.
6482         (Icf::Reloc_info): New struct typedef.
6483         (Icf::Reloc_info_list): New typedef.
6484         (Icf::symbol_reloc_list): Delete method.
6485         (Icf::addend_reloc_list): Delete method.
6486         (Icf::section_reloc_list): Delete method.
6487         (Icf::reloc_info_list): New method.
6488         (Icf::reloc_info_list_): New member.
6489
6490 2010-02-19  Doug Kwan  <dougkwan@google.com>
6491
6492         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6493         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6494         * arm.cc (Arm_relocation_functions): New forward declaration.
6495         (Target_arm::Target_arm): Initialize new data members
6496         got_mod_index_offset_ and tls_base_symbol_defined_.
6497         (Target_arm::Relocate::relocate_tls): New method.
6498         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6499          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6500         New methods.
6501         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6502         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6503         (Target_arm::got_mod_index_offset_,
6504         Target_arm::tls_base_symbol_defined_): New data members.
6505         (Target_arm::Scan::local, Target::Scan::global,
6506         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6507         relocations.
6508
6509 2010-02-18  Doug Kwan  <dougkwan@google.com>
6510
6511         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6512         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6513         text section as a parameter becuase some broken tools may not set
6514         the link in section header.
6515         (Target_arm::has_got_section): New method.
6516         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6517         without any mapping symbol as data only.  Remove warning.
6518         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6519         link in its section header, try to discover the link by inspecting the
6520         REL31 relocation at the beginning of the section.
6521         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6522         in error message.
6523         (Target_arm::Scan::global): Treat any reference to the symbol
6524         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6525
6526 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6527
6528         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6529         (Scan::global_reloc_may_be_function_pointer): New function.
6530         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6531         (Scan::global_reloc_may_be_function_pointer): New function.
6532         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6533         (Scan::global_reloc_may_be_function_pointer): New function.
6534         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6535         (Scan::global_reloc_may_be_function_pointer): New function.
6536         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6537         (Scan::global_reloc_may_be_function_pointer): New function.
6538         (Scan::possible_function_pointer_reloc): New function.
6539         (Target_x86_64::can_check_for_function_pointers): New function.
6540         * gc.h (gc_process_relocs): Scan relocation types to determine if
6541         function pointers were taken for targets that support it.
6542         * icf.cc (Icf::find_identical_sections): Include functions for
6543         folding in safe ICF whose pointer is not taken.
6544         * icf.h (Secn_fptr_taken_set): New typedef.
6545         (fptr_section_id_): New member.
6546         (section_has_function_pointers): New function.
6547         (set_section_has_function_pointers): New function.
6548         (check_section_for_function_pointers): New function.
6549         * options.h: Fix comment for safe ICF option.
6550         * target.h (can_check_for_function_pointers): New function.
6551         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6552         Modify icf_safe_test for X86-64.
6553         * testsuite/Makefile.in: Regenerate.
6554         * testsuite/icf_safe_so_test.cc: New file.
6555         * testsuite/icf_safe_so_test.sh: New file.
6556         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6557         (main): Change to take pointer to function kept_func_3.
6558         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6559         folding is done correctly for X86-64.
6560
6561 2010-02-12  David S. Miller  <davem@davemloft.net>
6562
6563         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6564         is_symbolless parameter.
6565         (Output_reloc<SHT_REL>::is_symbolless): New.
6566         (Output_reloc<SHT_REL>::is_symbolless_): New.
6567         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6568         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6569         (Output_reloc<SHT_RELA>::is_symbolless): New.
6570         (Output_data_reloc::add_global): Handle is_symbolless.
6571         (Output_data_reloc::add_global_relative): Likewise.
6572         (Output_data_reloc::add_local): Likewise.
6573         (Output_data_reloc::add_local_relative): Likewise.
6574         (Output_data_reloc::add_symbolless_global_addend): New.
6575         (Output_data_reloc::add_symbolless_local_addend): New.
6576         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6577         is_symbolless.
6578         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6579         instead of ->is_relative_
6580         (Output_reloc::write): Likewise.
6581         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6582         (Output_reloc::write_rel): Simplify.
6583
6584         * sparc.cc (Target_sparc::Scan::local): Use
6585         ->add_symbolless_local_addend as needed.
6586         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6587         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6588         based upon relocation offset.
6589
6590 2010-02-11  Doug Kwan  <dougkwan@google.com>
6591
6592         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6593         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6594         beginning of function.
6595         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6596         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6597         parameter is_32bit in calls to should_apply_static_reloc.
6598         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6599         (check_DATA): Add arm_abs_global.stdout.
6600         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6601         arm_abs_global.stdout): New rules.
6602         (MOSTLLYCLEANFILES): Add arm_abs_global
6603         * Makefile.in: Regenerate.
6604         * testsuite/arm_abs_global.s: New file.
6605         * testsuite/arm_abs_global.sh: Ditto.
6606         * testsuite/arm_abs_lib.s: Ditto.
6607
6608 2010-02-11  Ian Lance Taylor  <iant@google.com>
6609
6610         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6611         Read_relocs task.
6612         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6613         Allocate_commons_task first.
6614         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6615         task, rather than symtab_lock_.
6616         (Gc_process_relocs::~Gc_process_relocs): New function.
6617         (Gc_process_relocs::is_runnable): Check this_blocker_.
6618         (Gc_process_relocs::locks): Use next_blocker_ rather than
6619         blocker_.
6620         (Scan_relocs::~Scan_relocs): New function.
6621         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6622         symtab_lock_.
6623         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6624         next_blocker_.
6625         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6626         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6627         constructor accordingly.
6628         (class Gc_process_relocs): Likewise.
6629         (class Scan_relocs): Likewise.
6630         * common.h (class Allocate_commons_task): Remove symtab_lock_
6631         field, and corresponding constructor parameter.
6632         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6633         symtab_lock_.
6634         (Allocate_commons_task::locks): Likewise.
6635
6636 2010-02-11  Ian Lance Taylor  <iant@google.com>
6637
6638         * gold-threads.h (class Once): Define.
6639         (class Initialize_lock): Rewrite as child of Once.
6640         * gold-threads.cc (class Once_initialize): Define.
6641         (once_pointer_control): New static variable.
6642         (once_pointer, once_arg): New static variables.
6643         (c_run_once): New static function.
6644         (Once::Once, Once::run_once, Once::internal_run): New functions.
6645         (class Initialize_lock_once): Remove.
6646         (initialize_lock_control): Remove.
6647         (initialize_lock_pointer): Remove.
6648         (initialize_lock_once): Remove.
6649         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6650         (Initialize_lock::initialize): Rewrite.
6651         (Initialize_lock::do_run_once): New function.
6652         * archive.cc (Archive::interpret_header): Only clear name if it is
6653         not already empty.
6654         * fileread.cc: Include "gold-threads.h"
6655         (file_counts_lock): New static variable.
6656         (file_counts_initialize_lock): Likewise.
6657         (File_read::release): Only increment counts when using --stats.
6658         Use a lock around the increment.
6659         * parameters.cc (class Set_parameters_target_once): Define.
6660         (set_parameters_target_once): New static variable.
6661         (Parameters::Parameters): Move here from parameters.h.
6662         (Parameters::set_target): Rewrite.
6663         (Parameters::set_target_once): New function.
6664         (Parameters::clear_target): Move here and rewrite.
6665         * parameters.h (class Parameters): Update declarations.  Add
6666         set_parameters_target_once_ field.
6667         (Parameters::Parameters): Move to parameters.cc.
6668         (Parameters::clear_target): Likewise.
6669         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6670         task.
6671         (Start_group::~Start_group): New function.
6672         (Start_group::is_runnable): New function.
6673         (Start_group::locks, Start_group::run): New functions.
6674         (Finish_group::run): Change saw_undefined to size_t.
6675         * readsyms.h (class Start_group): Define.
6676         (class Finish_group): Change saw_undefined_ field to size_t.
6677         (Finish_group::Finish_group): Remove saw_undefined and
6678         this_blocker parameters.  Change all callers.
6679         (Finish_group::set_saw_undefined): New function.
6680         (Finish_group::set_blocker): New function.
6681         * symtab.h (class Symbol_table): Change saw_undefined to return
6682         size_t.  Change saw_undefined_ field to size_t.
6683         * target-select.cc (Set_target_once::do_run_once): New function.
6684         (Target_selector::Target_selector): Initialize set_target_once_
6685         field.  Don't initialize lock_ and initialize_lock_ fields.
6686         (Target_selector::instantiate_target): Rewrite.
6687         (Target_selector::set_target): New function.
6688         * target-select.h (class Set_target_once): Define.
6689         (class Target_selector): Update declarations.  Make
6690         Set_target_once a friend.  Remove lock_ and initialize_lock_
6691         fields.  Add set_target_once_ field.
6692
6693 2010-02-10  Ian Lance Taylor  <iant@google.com>
6694
6695         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6696         queueing any tasks.
6697         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6698         (queue_middle_tasks): Add all blockers before queueing any tasks.
6699         (queue_final_tasks): Likewise.
6700         * token.h (Task_token::add_blockers): New function.
6701         * object.h (Input_objects::number_of_relobjs): New function.
6702
6703 2010-02-10  Ian Lance Taylor  <iant@google.com>
6704
6705         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6706         shared, not if not position independent.
6707         * x86_64.cc (Relocate::relocate_tls): Likewise.
6708         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6709         (tls_pie_pic_test): New target.
6710         * testsuite/Makefile.in: Rebuild.
6711
6712         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6713         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6714         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6715         * testsuite/Makefile.in: Rebuild.
6716
6717 2010-02-09  David S. Miller  <davem@davemloft.net>
6718
6719         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6720         R_SPARC_RELATIVE using ->add_local_relative().
6721         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6722
6723         * output.h (Output_data_dynamic::add_section_size): New method
6724         that takes two Output_data objects.
6725         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6726         entry param.  Handle it in initializers.
6727         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6728         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6729         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6730         arg.
6731         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6732         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6733         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6734         for dynrel_includes_plt.
6735         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6736         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6737         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6738         before .rela.plt
6739         (Target_sparc::do_finalize_sections): Update to pass true for
6740         dynrel_includes_plt.
6741         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6742         output before .rela.plt
6743         (Target_powerpc::do_finalize_sections): Update to pass true for
6744         dynrel_includes_plt when 32-bit.
6745
6746 2010-02-08  Doug Kwan  <dougkwan@google.com>
6747
6748         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6749         method.
6750         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6751         Arm_relobj::scan_section_for_cortex_a8_stubs,
6752         Arm_relobj::do_relocation_section): Instead of calling
6753         Output_section::output_address, use faster
6754         Arm_relobj::simple_input_section_output_address.
6755
6756 2010-02-08  David S. Miller  <davem@davemloft.net>
6757
6758         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6759         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6760         relocation helper function.
6761
6762         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6763         just like R_SPARC_GOT{10,13,22}.
6764         (Target_sparc::Scan::local): Likewise.
6765         (Target_sparc::Relocate:relocate): Likewise.
6766
6767 2010-02-06  Ian Lance Taylor  <iant@google.com>
6768
6769         * configure.ac: Rewrite targetobjs duplicate removal code to use
6770         only shell constructs.
6771         * configure: Rebuild.
6772
6773 2010-02-05  Doug Kwan  <dougkwan@google.com>
6774
6775         PR 11247
6776         * arm.cc (Arm_relobj::section_is_scannable): New method.
6777         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6778         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6779
6780 2010-02-04  Doug Kwan  <dougkwan@google.com>
6781
6782         PR 11247
6783         * arm-reloc-property.cc (cstdio): Include.
6784         * configure.ac (targetobjs): Remove duplicates.
6785         * configure: Regenerate.
6786         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6787         big and little endian version for a given address size.
6788
6789 2010-02-03  Doug Kwan  <dougkwan@google.com>
6790
6791         * arm-reloc-property.cc
6792         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6793         definition.
6794         * arm-reloc-property.h
6795         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6796         New method definition.
6797         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6798         declaration.
6799         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6800         overflow to N.
6801         (GOT_PREL): Change implemented to Y.
6802         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6803         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6804         (Arm_relocate_functions::movw_abs_nc): Remove method.
6805         (Arm_relocate_functions::movt_abs): Ditto.
6806         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6807         (Arm_relocate_functions::thm_movt_abs): Ditto.
6808         (Arm_relocate_functions::movw_rel_nc): Ditto.
6809         (Arm_relocate_functions::movw_rel): Ditto.
6810         (Arm_relocate_functions::movt_rel): Ditto.
6811         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6812         (Arm_relocate_functions:thm_movw_rel): Ditto.
6813         (Arm_relocate_functions:thm_movt_rel): Ditto.
6814         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6815         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6816         New method definitions.
6817         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6818         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6819         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6820         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6821         (Target_arm::Relocate::relocate): Check for non-static or
6822         unimplemented relocation code and exit early.  Change calls to
6823         Target_arm::reloc_uses_thumb_bit and
6824         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6825         instead.  Refactor code to handle similar relocations to increase
6826         code sharing.  Remove check for unsupported relocation code in switch
6827         statement.
6828         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6829         relocation property table to find out size.  Change error message to
6830         print out the name of a relocation code instead of the numeric value.
6831         (Target_arm::scan_reloc_for_stub): Use relocation property table
6832         instead of calling Target_arm::reloc_uses_thumb_bit().
6833
6834 2010-02-02  Doug Kwan  <dougkwan@google.com>
6835
6836         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6837         types of relaxed input section.
6838
6839 2010-02-02  Doug Kwan  <dougkwan@google.com>
6840
6841         * Makefile.am (HFILES): Add arm-reloc-property.h.
6842         (DEFFILES): New.
6843         (TARGETSOURCES): Add arm-reloc-property.cc
6844         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6845         (libgold_a_SOURCES): $(DEFFILES)
6846         * Makefile.in: Regenerate.
6847         * arm-reloc-property.cc: New file.
6848         * arm-reloc-property.h: New file.
6849         * arm-reloc.def: New file.
6850         * arm.cc: Update comments.
6851         (arm-reloc-property.h): New included header.
6852         (arm_reloc_property_table): New global variable.
6853         (Target_arm::do_select_as_default_target): New method definition.
6854         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6855         arm-reloc-property to targ_extra_obj.
6856         * parameters.cc (set_parameters_target): Call
6857         Target::select_as_default_target().
6858         * target.h (Target::select_as_default_target): New method definition.
6859         (Target::do_select_as_default_target): Same.
6860
6861 2010-02-01  Doug Kwan  <dougkwan@google.com>
6862
6863         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6864         first_output_text_section_.
6865         (Arm_exidx_fixup::first_output_text_section): New method definition.
6866         (Arm_exidx_fixup::first_output_text_section_): New data member.
6867         (Arm_exidx_fixup::process_exidx_section): Record the first text
6868         output section seen.
6869         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6870         and entsize in output section header.
6871
6872 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6873
6874         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6875         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6876         (Arm_relocate_functions::thm_alu11): New Method.
6877         (Arm_relocate_functions::thm_pc8): New Method.
6878         (Arm_relocate_functions::thm_pc12): New Method.
6879         (Target_arm::Scan::local): Handle the relocations.
6880         (Target_arm::Scan::global): Likewise.
6881         (Target_arm::Relocate::relocate): Likewise.
6882         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6883
6884 2010-01-29  Doug Kwan  <dougkwan@google.com>
6885
6886         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6887         of relocation types as ld.
6888
6889 2010-01-29  Doug Kwan  <dougkwan@google.com>
6890
6891         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6892         to public.
6893         (Arm_relocate_functions::thumb_branch_common): Ditto.
6894         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6895         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6896         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6897         Arm_relocate_functions::jump24): Remove.
6898         (Target_arm::Relocate::relocate): Adjust code to call
6899         Arm_relocation_functions::arm_branch_common and
6900         Arm_relocation_functions::thumb_branch_common instead of their removed
6901         wrappers.  Merge switch-cases together to reduce source code size.
6902
6903 2010-01-29  Doug Kwan  <dougkwan@google.com>
6904
6905         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6906         output_local_symbol_count_needs_update_.
6907         (Arm_relobj::output_local_symbol_count_needs_update,
6908          Arm_relobj::set_output_local_symbol_count_needs_update,
6909          Arm_relobj::update_output_local_symbol_count): New methods.
6910         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6911         member.
6912         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6913         of pointed function as in a R_ARM_PREL31 relocation.
6914         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6915         for output local symbol count updating.
6916         (Target_arm::do_relax): Update output local symbol counts in objects
6917         if necessary.
6918         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6919
6920 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6921
6922         * arm.cc: Added support for the ARM relocations:
6923         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6924         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6925         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6926         movw_prel_nc).
6927         (Arm_relocate_functions::movw_rel): New method.
6928         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6929         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6930         thm_movw_prel_nc).
6931         (Arm_relocate_functions::thm_movw_rel): New method.
6932         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6933         thm_movt_prel).
6934         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6935         relocations.
6936         (Target_arm::Scan::global): Likewise.
6937         (Target_arm::Relocate::relocate): Likewise.
6938         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6939         Likewise.
6940
6941 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6942
6943         * arm.cc: Added support for ARM group relocations.
6944         (Target_arm::reloc_needs_sym_origin): New method.
6945         (Arm_relocate_functions::calc_grp_kn): New method.
6946         (Arm_relocate_functions::calc_grp_residual): New method.
6947         (Arm_relocate_functions::calc_grp_gn): New method.
6948         (Arm_relocate_functions::arm_grp_alu): New Method.
6949         (Arm_relocate_functions::arm_grp_ldr): New Method.
6950         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6951         (Arm_relocate_functions::arm_grp_ldc): New Method.
6952         (Target_arm::Scan::local): Handle the ARM group relocations.
6953         (Target_arm::Scan::global): Likewise.
6954         (Target_arm::Relocate::relocate): Likewise.
6955         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6956         Likewise.
6957
6958 2010-01-26  Doug Kwan  <dougkwan@google.com>
6959
6960         * arm.cc (set): Include.
6961         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6962         pointer type.
6963         (Arm_output_section::Text_section_list): New type.
6964         (Arm_output_section::append_text_sections_to_list): New method.
6965         (Arm_output_section::fix_exidx_coverage): Ditto.
6966         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6967         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6968         Relobj::set_section_offset() instead of
6969         Sized_relobj::invalidate_section_offset().
6970         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6971         parameter for section headers. Ignore relocation sections for
6972         unallocated sections and EXIDX sections.
6973         (Target_arm::fix_exidx_coverage): New method.
6974         (Target_arm::output_section_address_less_than): New type.
6975         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6976         linked text section instead of the EXIDX section.
6977         (Arm_output_section::create_stub_group): Add an assertion to check
6978         that this is not an EXIDX output section.
6979         (Arm_output_section::append_text_sections_to_list): New method.
6980         (Arm_output_section::fix_exidx_coverage): Ditto.
6981         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6982         Arm_relobj::section_needs_reloc_stub_scanning.
6983         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6984         first pass.
6985         (Target_arm::fix_exidx_coverage): New method.
6986         * object.h (Relobj::set_output_section): New method.
6987         (Sized_relobj::invalidate_section_offset): Remove method.
6988         (Sized_relobj::do_invalidate_section_offset): Remove method.
6989         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6990
6991 2010-01-25  Doug Kwan  <dougkwan@google.com>
6992
6993         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6994         Fix warning due to signed and unsigned comparison on a 32-bit host.
6995
6996 2010-01-22  Doug Kwan  <dougkwan@google.com>
6997
6998         * arm.cc (Target_arm::do_relax): Record an output section for section
6999         offset adjustment it contains any stub table that has changed.
7000         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7001         offsets in an output section if necessary.
7002         * output.cc (Output_section::Output_section): Initialize
7003         section_offsets_need_adjustments_.
7004         (Output_section::add_input_section_for_script): Renamed to
7005         Output_section::add_simple_input_section.
7006         (Output_section::save_states): Add a comment.
7007         (Output_section::discard_states): New method defintion.
7008         (Output_section::adjust_section_offsets): Same.
7009         * output.h (Output_section::add_input_section_for_script): Renamed to
7010         Output_section::add_simple_input_section.
7011         (Output_section::discard_states): New method declaration.
7012         (Output_section::adjust_section_offsets): Same.
7013         (Output_section::section_offsets_need_adjustment,
7014         Output_section::set_section_offsets_need_adjustment): New method
7015         definitions.
7016         (Output_section::section_offsets_need_adjustment_): New data member.
7017         * script-sections.cc
7018         (Output_section_element_input::set_section_address): Adjust code for
7019         renaming of Output_section::add_input_section_for_script.
7020         (Orphan_output_section::set_section_address): Same.
7021
7022 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7023
7024         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7025         Fix_v4bx enum values .
7026         * gold/options.h (General_options): New option definitions.
7027         (General_options::fix_v4bx): New method.
7028         (General_options::Fix_v4bx): New enum.
7029         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7030         (General_options::parse_fix_v4bx_interworking): New method.
7031
7032 2010-01-22  Doug Kwan  <dougkwan@google.com>
7033
7034         * arm.cc (Arm_exidx_fixup): New class.
7035
7036 2010-01-21  Doug Kwan  <dougkwan@google.com>
7037
7038         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7039         classes.
7040         (Arm_exidx_section_offset_map): New type.
7041
7042 2010-01-21  Doug Kwan  <dougkwan@google.com>
7043
7044         * arm.cc (Arm_exidx_input_section): New class.
7045         (Arm_relobj::exidx_input_section_by_link,
7046         Arm_relobj::exidx_input_section_by_shndx,
7047         Arm_relobj::make_exidx_input_section): New methods.
7048         (read_arm_attributes_section): Remove.
7049         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7050         information about them.
7051         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7052         to here.
7053
7054 2010-01-20  Doug Kwan  <dougkwan@google.com>
7055
7056         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7057         Input_section_specifier to Section_id.
7058         (Target_arm::new_arm_input_section: Adjust code for change of key
7059         type.
7060         (Target_arm::find_arm_input_section): Ditto.
7061         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7062         (Section_id): Remove.
7063         (Garbage_collection::Section_id_hash): Remove.
7064         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7065         (Section_id): Remove.
7066         (Icf::Section_id_hash): Remove.
7067         * object.h (Section_id, Const_section_id, Section_id_hash,
7068         Const_section_id_hash): New type definitions.
7069         * output.cc (Output_section::add_relaxed_input_section): Change to
7070         use Const_section_id instead of Input_section_specifier as key type.
7071         (Output_section::add_merge_input_section): Ditto.
7072         (Output_section::build_relaxation_map): Change to use Section_id
7073         instead of Input_section_specifier as key type.
7074         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7075         Ditto.
7076         (Output_section::convert_input_sections_to_relaxed_sections): Change
7077         to use Const_section_id instead of Input_section_specifier as key type.
7078         (Output_section::find_merge_section): Ditto.
7079         (Output_section::find_relaxed_input_section): Ditto.
7080         * output.h (Input_section_specifier): Remove class.
7081         (Output_section::Output_section_data_by_input_section_map): Change
7082         key type to Const_section_id.
7083         (Output_section::Output_relaxed_input_section_by_input_section_map):
7084         Ditto.
7085         (Output_section::Relaxation_map): Change key type to Section_id.
7086
7087 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7088
7089         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7090         (class Arm_v4bx_stub): New class.
7091         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7092         (Stub_factory::make_arm_v4bx_stub): New method.
7093         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7094         (Stub_table::empty): Handle v4bx stubs.
7095         (Stub_table::add_arm_v4bx_stub): New method.
7096         (Stub_table::find_arm_v4bx_stub): New method.
7097         (Arm_relocate_functions::v4bx): New method.
7098         (Target_arm::fix_v4bx): New method.
7099         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7100         (Stub_table::relocate_stubs): Likewise.
7101         (Stub_table::do_write): Likewise.
7102         (Stub_table::update_data_size_and_addralign): Likewise.
7103         (Stub_table::finalize_stubs):  Likewise.
7104         (Target_arm::Scan::local): Likewise.
7105         (Target_arm::Scan::global): Likewise.
7106         (Target_arm::do_finalize_sections): Likewise.
7107         (Target_arm::Relocate::relocate): Likewise.
7108         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7109         Likewise.
7110         (Target_arm::scan_reloc_for_stub): Likewise.
7111         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7112
7113 2010-01-19  Ian Lance Taylor  <iant@google.com>
7114
7115         * output.cc (Output_section_headers::do_sized_write): Write large
7116         segment count to sh_info field.
7117         (Output_file_header::do_sized_write): For large segment count,
7118         write PN_XNUM to e_phnum field.
7119
7120 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7121
7122         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7123         (Arm_relocate_functions::thm_jump8): New function.
7124         (Arm_relocate_functions::thm_jump11): New function.
7125         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7126         R_ARM_THM_JUMP11.
7127         (Target_arm::Scan::global): Likewise.
7128         (Target_arm::Relocate::relocate): Likewise.
7129         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7130         Likewise.
7131
7132 2010-01-14  Doug Kwan  <dougkwan@google.com>
7133
7134         * arm.cc (map, utility): Include headers.
7135         (Target_arm::apply_cortex_a8_workaround): New method.
7136         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7137         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7138         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7139         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7140         the --[no-]fix-cortex-a8 command line options.
7141         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7142         (Target_arm::relocate_stub): Use addend in instruction template.
7143         * options.h (DEFINE_bool): Set the user-set flag.
7144         (General_options): Add --[no-]-fix-cortex options.
7145         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7146         : Update fast look-up map after conversion.
7147
7148 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7149
7150         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7151         in the first pass of do_layout.
7152
7153 2010-01-13  Doug Kwan  <dougkwan@google.com>
7154
7155         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7156         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7157         apparent compiler problem of not folding static constant integral
7158         data members of elfcpp::Elf_sizes<32>.
7159
7160 2010-01-13  Doug Kwan  <dougkwan@google.com>
7161
7162         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7163         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7164         Arm_relobj::scan_section_for_cortex_a8_erratum,
7165         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7166         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7167         sections to scan for relocation stubs into a new method
7168         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7169         relocation and Cortex-A8 stub scanning.
7170         (Target_arm::do_relax): Force stubs to be after stubbed sections
7171         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7172         the beginning of a new relaxation pass.  Update a comment.
7173         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7174
7175 2010-01-12  Ian Lance Taylor  <iant@google.com>
7176
7177         * target-reloc.h (visibility_error): New inline function.
7178         (relocate_section): Call visibility_error.
7179         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7180         (MOSTLYCLEANFILES): Likewise.
7181         (protected_4_pic.o, protected_3.err): New targets.
7182         * testsuite/protected_4.cc: New file.
7183
7184 2010-01-12  Doug Kwan  <dougkwan@google.com>
7185
7186         * arm.cc (Cortex_a8_reloc): New class.
7187         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7188         and cortex_a8_relocs_info_.
7189         (Target_arm::fix_cortex_a8): New method definition.
7190         (Target_arm::Cortex_a8_relocs_info): New type.
7191         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7192         New data member declarations.
7193         (Target_arm::scan_reloc_for_stub): Record information about
7194         relocations for THUMB branches that might be exempted from the
7195         Cortex-A8 workaround.
7196         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7197         at the beginning of a relaxation pass.
7198
7199 2010-01-12  Doug Kwan  <dougkwan@google.com>
7200
7201         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7202         (Arm_relobj::Mapping_symbol_position,
7203          Arm_reloj::Mapping_symbol_position_less,
7204          Arm_relobj::Mapping_symbols_info): New types.
7205         (Target_arm::is_mapping_symbol_name): New method definition.
7206         (Arm_relobj::do_count_local_symbols): Save information about mapping
7207         symbols.
7208
7209 2010-01-11  Doug Kwan  <dougkwan@google.com>
7210
7211         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7212         Arm_relocate_functions::thumb32_branch_upper,
7213         Arm_relocate_functions::thumb32_branch_lower,
7214         Arm_relocate_functions::thumb32_cond_branch_offset,
7215         Arm_relocate_functions::thumb32_cond_branch_upper,
7216         Arm_relocate_functions::thumb32_cond_branch_lower,
7217         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7218         branch offset encoding.
7219         (Arm_relocate_functions::thumb_branch_common): Use new branch
7220         offset encoding methods to avoid code duplication.
7221         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7222         (Stub_addend_reader::operator()): Use new branch encoding method
7223         to avoid code duplication.
7224
7225 2010-01-11  Doug Kwan  <dougkwan@google.com>
7226
7227         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7228         (Target_arm::do_finalize_sections): Define special EXIDX section
7229         symbols only if referenced.
7230         * gc.h (Garbage_collection::add_reference): New method.
7231         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7232         code duplication.
7233
7234 2010-01-11  Ian Lance Taylor  <iant@google.com>
7235
7236         * script.cc (Version_script_info::build_expression_list_lookup):
7237         Change complaing about duplicate wildcard match from error to
7238         warning.
7239
7240         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7241         of 2009-12-30.
7242         (Version_script_info::Version_script_info): Initialize globs_,
7243         default_version_, default_is_global_, and exact_.  Don't
7244         initialize globals_ or locals_.
7245         (Version_script_info::build_lookup_tables): Build local symbols
7246         first.
7247         (Version_script_info::unquote): New function.
7248         (Version_script_info::add_exact_match): New function.
7249         (Version_script_info::build_expression_list_lookup): Remove lookup
7250         parameter.  Add is_global parameter.  Change all callers.  Handle
7251         wildcard pattern specially.  Unquote pattern.  Call
7252         add_exact_match.
7253         (Version_script_info::get_name_to_match): New function.
7254         (Version_script_info::get_symbol_version): New function.
7255         (Version_script_info::get_symbol_version_helper): Remove.
7256         (Version_script_info::check_unmatched_names): Call unquote.
7257         * script.h (class Version_script_info): Change get_symbol_version
7258         to be non-inline and add is_global parameter; change all callers.
7259         Rewrite symbol_is_local.  Update declarations.  Define struct
7260         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7261         Remove globals_ and locals_ members.  Add exact_, globs_,
7262         default_version_, is_global_.
7263         (Version_script_info::Glob): Remove pattern, add expression and
7264         is_global.  Update constructor.  Change all callers.
7265         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7266         default version.
7267         (Versions::symbol_section_contents): If a symbol is undefined, or
7268         defined in a dynamic object, set the version index to
7269         VER_NDX_LOCAL.
7270         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7271         symbol_is_local.
7272         (Symbol_table::add_from_pluginobj): Likewise.
7273         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7274
7275 2010-01-11  Doug Kwan  <dougkwan@google.com>
7276
7277         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7278         (incremental_dump_LDADD): Add linking option for libintl.
7279         * Makefile.in: Regenerate.
7280
7281 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7282
7283         PR gold/11144
7284         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7285         instead of -Ds.
7286         * testsuite/Makefile.in: Regenerated.
7287
7288 2010-01-10  Doug Kwan  <dougkwan@google.com>
7289
7290         * options.h (DEFINE_var): Use parentheses around argument varname__
7291         in macro body to avoid any unintended subsequent substitutions.
7292
7293 2010-01-10  Ian Lance Taylor  <iant@google.com>
7294
7295         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7296         candidates before doing symbol resolution.
7297
7298         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7299         ODR candidates if only one is weak.
7300
7301 2010-01-08  Ian Lance Taylor  <iant@google.com>
7302
7303         * script.cc (Version_script_info::build_expression_list_lookup):
7304         Don't warn about ambiguous version, just record the ambiguity.
7305         (Version_script_info::get_symbol_version_helper): Give error if
7306         version is ambiguous.
7307
7308 2010-01-08  Doug Kwan  <dougkwan@google.com>
7309
7310         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7311         prev_data_size_ and prev_addralign_.  Remove initializer for
7312         deleted data member has_been_changed_.
7313         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7314         to determine if the table is empty.
7315         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7316         Remove.
7317         (Stub_table::add_reloc_stub): Define method in class definition
7318         instead of just declaring it there.
7319         (Stub_table::add_cortex_a8_stub): New method definition.
7320         (Stub_table::update_data_size_and_addralign): Ditto.
7321         (Stub_table::finalize_stubs): Ditto.
7322         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7323         (Stub_table::do_addralign_): Return address alignment in the
7324         (Stub_table::do_reset_address_and_file_offset): Define method in
7325         class definition instead of declaring it there.  Set current data
7326         size to be the data size of the previous pass.
7327         (Stub_table::set_final_data_size): Use current data size as the
7328         final data size.
7329         (Stub_table::relocate_stub): Change parameter type of stub from
7330         Reloc_stub pointer to Stub pointer.
7331         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7332         (Stub_table::Cortex_a8_stub_list): New typedef.
7333         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7334          Stub_table::prev_addralign_): New data member.
7335         (Arm_relobj::Arm_relobj): Initialize data member
7336         section_has_cortex_a8_workaround_.
7337         (Arm_relobj::section_has_cortex_a8_workaround,
7338          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7339          definitions.
7340         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7341         declarations.
7342         (Target_arm::relocate_stub): Change parameter type of stub from
7343         Reloc_stub pointer to Stub pointer.
7344         (Insn_template::size, Insn_template::alignment): Handle
7345         THUMB16_SPECIAL_TYPE.
7346         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7347          Stub_table::update_data_size_and_addralign,
7348          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7349         definitions.
7350         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7351         (Stub_table::do_write): Ditto.
7352         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7353
7354 2010-01-08  Ian Lance Taylor  <iant@google.com>
7355
7356         PR 11108
7357         * symtab.h (class Symbol): Remove fields is_target_special_ and
7358         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7359         (Symbol::is_defined_in_discarded_section): New function.
7360         (Symbol::set_is_defined_in_discarded_section): New function.
7361         (Symbol::has_plt_offset): Rewrite.
7362         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7363         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7364         Don't initialize is_target_special_ or has_plt_offset_.
7365         Initialize is_defined_in_discarded_section_.
7366         (Symbol_table::add_from_relobj): If appropriate, set
7367         is_defined_in_discarded_section.
7368         * resolve.cc (Symbol::override_base_with_special): Don't test
7369         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7370         * target-reloc.h (relocate_section): Do special handling for
7371         symbols defined in discarded sections for global symbols as well
7372         as local symbols.
7373
7374 2010-01-08  Ian Lance Taylor  <iant@google.com>
7375
7376         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7377         the SHT_SYMTAB case.
7378
7379 2010-01-08  Ian Lance Taylor  <iant@google.com>
7380
7381         * object.cc (Sized_relobj::do_layout): Don't get confused if
7382         layout_eh_frame returns NULL.
7383
7384 2010-01-08  Ian Lance Taylor  <iant@google.com>
7385
7386         PR 11084
7387         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7388         dynamic symbol table, use the normal symbol table.
7389         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7390         symbol table.
7391
7392 2010-01-08  Ian Lance Taylor  <iant@google.com>
7393
7394         PR 11072
7395         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7396         sections.
7397
7398 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7399
7400         * version.cc (print_version): Change to "Copyright 2010".
7401
7402 2010-01-08  Ian Lance Taylor  <iant@google.com>
7403
7404         PR 10287
7405         PR 11063
7406         * i386.cc (class Target_i386): Change return type of plt_section
7407         to be non-const.
7408         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7409         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7410         tls_desc_rel_ field.
7411         (Output_data_plt_i386::rel_tls_desc): New function.
7412         (Target_i386::rel_tls_desc_section): New function.
7413         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7414         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7415         R_386_TLS_DESC reloc in rel_tls_desc_section.
7416         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7417         Define struct Tlsdesc_info.
7418         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7419         (Target_x86_64::do_reloc_symbol_index): New function.
7420         (Target_x86_64::add_tlsdesc_info): New function.
7421         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7422         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7423         tlsdesc_rel_ field.
7424         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7425         all callers.
7426         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7427         (Target_x86_64::rela_tlsdesc_section): New function.
7428         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7429         handling.
7430         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7431         (Target_x86_64::do_reloc_addend): New function.
7432         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7433         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7434         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7435         (Output_reloc::type): New function.
7436         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7437         (Output_reloc::is_target_specific): New function.
7438         (Output_reloc::target_arg): New function.
7439         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7440         absolute relocs and target specific relocs.
7441         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7442         add_target_specific.
7443         (class Output_data_reloc) [SHT_RELA]: Likewise.
7444         * output.cc (Output_reloc::Output_reloc): Add four new versions
7445         for absolute relocs and target specific relocs.
7446         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7447         (Output_reloc::get_symbol_index): Likewise.
7448         (Output_reloc::local_section_offset): Check that local_sym_index_
7449         is not TARGET_CODE or 0.
7450         (Output_reloc::symbol_value): Likewise.
7451         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7452         reloc.
7453         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7454         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7455         functions.
7456         * layout.cc (add_target_dynamic_tags): Use output section for
7457         DT_PLTRELSZ and DT_JMPREL.
7458
7459 2010-01-07  Ian Lance Taylor  <iant@google.com>
7460
7461         PR 11061
7462         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7463         function.
7464         (class Output_data_reloc_generic): Define.
7465         (class Output_data_reloc_base): Change base class to
7466         Output_data_reloc_generic.  Change add() method to call
7467         bump_relative_reloc_count for a relative reloc.  Remove
7468         sort_relocs_ field.
7469         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7470         to sort_relocs().
7471         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7472         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7473         appropriate.
7474         * layout.h (class Layout): Update declaration.
7475
7476 2010-01-07  Ian Lance Taylor  <iant@google.com>
7477
7478         * output.h (class Output_data): Add const version of
7479         output_section and do_output_section.
7480         (class Output_section_data): Add const version of
7481         do_output_section.
7482         (class Output_section): Likewise.
7483         * layout.cc (Layout::add_target_dynamic_tags): New function.
7484         * layout.h (class Layout): Update declarations.
7485         * arm.cc (Target_arm::do_finalize_sections): Use
7486         add_target_dynamic_tags.
7487         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7488         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7489         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7490         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7491
7492 2010-01-07  Ian Lance Taylor  <iant@google.com>
7493
7494         PR 11042
7495         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7496         object as needed.
7497
7498 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7499             Ian Lance Taylor  <iant@google.com>
7500
7501         PR 11019
7502         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7503         Xindex::read_symtab_xindex.
7504
7505 2010-01-07  Doug Kwan  <dougkwan@google.com>
7506
7507         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7508         (Insn_template::thumb16_bcond_insn): New method declaration.
7509         (Insn_template): Fix spelling.
7510         (Stub::thumb16_special): New method declaration.
7511         (Stub::do_write): Define virtual method which was previously pure
7512         virtual.
7513         (Stub::do_thumb16_special): New method declaration.
7514         (Stub::do_fixed_endian_write): New template member.
7515         (Reloc_stub::do_write): Remove.
7516         (Reloc_stub::do_fixed_endian_write): Remove.
7517         (Cortex_a8_stub): New class definition.
7518         (Stub_factory::make_cortex_a8_stub): New method definition.
7519         (Stub_factory::Stub_factory): Add missing static storage class
7520         qualifier for elf32_arm_stub_a8_veneer_blx.
7521
7522 2010-01-07  Ian Lance Taylor  <iant@google.com>
7523
7524         PR 10980
7525         * options.h (class General_options): Add --warn-unresolved-symbols
7526         and --error-unresolved-symbols.
7527         * errors.cc (Errors::undefined_symbol): Implement
7528         --warn-unresolved-symbols.
7529
7530         * options.h (class General_options): Add -z text and -z textoff.
7531         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7532
7533 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7534
7535         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7536         (Garbage_collection::cident_sections): New function.
7537         (Garbage_collection::add_cident_section): New function.
7538         (Garbage_collection::cident_sections_): New member.
7539         (gc_process_relocs): Add references to sections whose names are C
7540         identifiers.
7541         * gold.h (cident_section_start_prefix): New constant.
7542         (cident_section_stop_prefix): New constant.
7543         (is_cident): New function.
7544         * layout.cc (Layout::define_section_symbols): Replace string constants
7545         with the newly defined constants.
7546         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7547         C identifiers.
7548         * testsuite/Makefile.am: Add gc_orphan_section_test.
7549         * testsuite/Makefile.in: Regenerate.
7550         * testsuite/gc_orphan_section_test.cc: New file.
7551         * testsuite/gc_orphan_section_test.sh: New file.
7552
7553 2010-01-06  Ian Lance Taylor  <iant@google.com>
7554
7555         PR 10980
7556         * options.h (class General_options): Add --warn-shared-textrel.
7557         * layout.cc (Layout::finish_dynamic_section): Implement
7558         --warn-shared-textrel.
7559
7560         PR 10980
7561         * options.h (class General_options): Add --warn-multiple-gp.
7562
7563 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7564
7565         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7566         $(THREADSLIB) and $(LIBDL).
7567         * Makefile.in: Rebuild.
7568
7569 2010-01-06  Ian Lance Taylor  <iant@google.com>
7570
7571         PR 10980
7572         * options.cc (General_options::parse_section_start): New function.
7573         (General_options::section_start): New function.
7574         (General_options::General_options): Initialize all members.
7575         * options.h: Include <map>
7576         (class General_options): Add --section-start.  Add section_starts_
7577         member.
7578         * layout.cc (Layout::attach_allocated_section_to_segment): If
7579         --section-start was used, set the address of the segment.  Remove
7580         local sort_sections.
7581         (Layout::relaxation_loop_body): If the address of the load segment
7582         has been set by --section-start, don't use it.
7583         * output.h (Output_segment::update_flags_for_output_section): New
7584         function.
7585         * output.cc (Output_segment::add_output_section): Call
7586         update_flags_for_output_section.
7587
7588 2010-01-05  Ian Lance Taylor  <iant@google.com>
7589
7590         PR 10980
7591         * options.h (class General_options): Add --undefined-version.
7592         * script.cc (struct Version_expression): Add was_matched_by_symbol
7593         field.
7594         (Version_script_info::matched_symbol): New function.
7595         (Version_script_info::get_symbol_version_helper): Call
7596         matched_symbol.
7597         (Version_script_info::check_unmatched_names): New function.
7598         * script.h (class Version_script_info): Update declarations.
7599         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7600
7601         * options.h (class General_options): Use DEFINE_bool_alias for
7602         allow_multiple_definition.
7603         * resolve.cc (Symbol_table::should_override): Don't test
7604         allow_multiple_definition.
7605
7606         PR 10980
7607         * options.h (class General_options): Add --cref.
7608         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7609         until after printing cref table.
7610         * cref.cc: Include "symtab.h".
7611         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7612         (Cref_table_compare::operator()): New function.
7613         (Cref_inputs::gather_cref): New function.
7614         (filecol): New static const.
7615         (Cref_inputs::print_cref): New function.
7616         (Cref::print_cref): New function.
7617         * cref.h: Include <cstdio>.
7618         (class Cref): Update declarations.
7619         * mapfile.h (Mapfile::file): New function.
7620         * object.h (class Object): Define Symbols.  Declare virtual
7621         do_get_global_symbols.
7622         (Object::get_global_symbols): New function.
7623         * object.cc (Input_objects::add_object): Pass object to cref_ if
7624         --cref.
7625         (Input_objects::archive_start): Likewise.
7626         (Input_objects::archive_stop): Likewise.
7627         (Input_objects::print_cref): New function.
7628         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7629         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7630         --cref.
7631         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7632         function.
7633         * plugin.h (class Sized_pluginobj): Update declarations.
7634
7635 2010-01-05  Ian Lance Taylor  <iant@google.com>
7636
7637         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7638         to is_default_version.  Rename insdef to insdefault.
7639         (Symbol_table::add_from_relobj): Rename def to is_default_version
7640         and local to is_forced_local.
7641         (Symbol_table::add_from_pluginobj): Likewise.
7642         (Symbol_table::add_from_dynobj): Likewise.
7643         (Symbol_table::define_special_symbol): Rename insdef to
7644         insdefault.
7645
7646 2010-01-04  Ian Lance Taylor  <iant@google.com>
7647
7648         PR 10980
7649         * options.h (class General_options): Add
7650         --allow-multiple-definition and -z muldefs.
7651         * resolve.cc (Symbol_table::should_override): Don't warn about a
7652         multiple symbol definition if --allow-multiple-definition or -z
7653         muldefs.
7654
7655         PR 10980
7656         * options.h (class General_options): Add --add-needed and
7657         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7658         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7659         error if --copy-dt-needed-entries aka --add-needed is used and
7660         would cause a change in behaviour.
7661
7662         PR 10980
7663         * options.h (class General_options): Add -G as a short version of
7664         --shared.  Add no-op options -assert, -g, and -i.
7665
7666 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7667
7668         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7669         check for .text or .gnu.linkonce.t sections.
7670         * icf.cc (Icf::find_identical_sections): Ditto.
7671         Change the detection for mangled function name within the section
7672         name.
7673         * icf.h (is_section_foldable_candidate): New function.
7674
7675 2009-12-30  Ian Lance Taylor  <iant@google.com>
7676
7677         PR 10980
7678         * options.h (class General_options): Permit two dashes with
7679         --retain-symbols-file.
7680
7681 2009-12-30  Ian Lance Taylor  <iant@google.com>
7682
7683         PR 10979
7684         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7685         don't put the file header and segment headers in the text
7686         segment.
7687
7688         PR 10979
7689         * common.cc (Sort_commons::operator()): Stabilize sort when both
7690         entries are NULL.
7691         (Symbol_table::do_allocate_commons_list): When allocating common
7692         symbols, skip a symbol which is no longer common.
7693         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7694         an object before checking its type.
7695         * testsuite/common_test_2.c: New file.
7696         * testsuite/common_test_3.c: New file.
7697         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7698         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7699         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7700         (common_test_2_pic.o, common_test_2.so): New targets.
7701         (common_test_3_pic.o, common_test_3.so): New targets.
7702         * testsuite/Makefile.in: Rebuild.
7703
7704         PR 10979
7705         * script.cc (read_input_script): If we see a new SECTIONS clause,
7706         and we have added an input section, give an error.
7707         * layout.h (class Layout): Add have_added_input_section function.
7708         Add have_added_input_section_ field.
7709         * layout.cc (Layout::Layout): Initialize
7710         have_added_input_section_.
7711         (Layout::layout): Set have_added_input_section_.
7712         (Layout::layout_eh_frame): Likewise.
7713
7714 2009-12-30  Ian Lance Taylor  <iant@google.com>
7715
7716         PR 10931
7717         * options.h (class General_options): Add --sort-common option.
7718         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7719         * common.cc (Sort_common): Add sort_order parameter to
7720         constructor.  Add sort_order_ field.
7721         (Sort_commons::operator): Check sort_order_.
7722         (Symbol_table::allocate_commons): Determine the sort order.
7723         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7724         Change all callers.
7725         (Symbol_table::do_allocate_commons_list): Likewise.
7726
7727 2009-12-30  Ian Lance Taylor  <iant@google.com>
7728
7729         PR 10916
7730         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7731         symbols from this object, don't change the visibility of an
7732         undefined symbol.
7733         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7734
7735 2009-12-30  Ian Lance Taylor  <iant@google.com>
7736
7737         PR 10861
7738         * script.h (class Version_script_info): Define Language enum.
7739         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7740         new fields globals_, locals_, and is_finalized_.
7741         * script.cc: Various formatting fixes.
7742         (class Parser_closure): Change language_stack_ from a vector of
7743         std::string to one of Version_script_info::Language.  Adjust all
7744         uses accordingly.
7745         (class Lazy_demangler): Remove.
7746         (struct Version_expression): Change language from std::string to
7747         Version_script_info::Language.
7748         (Version_script_info::Version_script_info): New function.
7749         (Version_script_info::~Version_script_info): Don't call clear.
7750         (Version_script_info::finalize): New function.
7751         (Version_script_info::build_lookup_tables): New function.
7752         (Version_script_info::build_expression_list_lookup): New
7753         function.
7754         (Version_script_info::get_symbol_version_helper): Rewrite to use
7755         lookup tables.
7756         (Version_script_info::print_expression_list): Adjust to use
7757         Version_script_info::Language.
7758         (script_push_lex_into_version_mode): Check that the version script
7759         has not been finalized.
7760         (version_script_push_lang): Change language string to
7761         Version_script_info::Language.
7762         * options.cc (Command_line::version_script): New function.
7763         * options.h (class General_options): Add finalize_dynamic_list
7764         function.  Change version_script from declaration to definition.
7765         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7766         * testsuite/version_script.map: Remove duplicate def of foo.
7767         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7768         version_script.map.
7769         * testsuite/Makefile.in: Rebuild.
7770
7771 2009-12-30  Ian Lance Taylor  <iant@google.com>
7772
7773         PR 10843
7774         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7775         if the input symbol index is 0, make the output symbol index 0.
7776
7777 2009-12-30  Ian Lance Taylor  <iant@google.com>
7778
7779         PR 10670
7780         * options.h (class General_options): Add -x/--discard-all.
7781         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7782         --discard-all.  If the local symbol needs a dynamic entry, check
7783         that before handling --discard-locals.
7784
7785 2009-12-30  Ian Lance Taylor  <iant@google.com>
7786
7787         PR 10450
7788         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7789         flags to PF_R.
7790         (Output_segment::add_output_section): Don't change the flags if
7791         the type is PT_TLS.
7792
7793         PR 10450
7794         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7795         GNU hash table if they need a dynamic value.  Otherwise, don't add
7796         them if they are defined in a dynamic object or are forced local.
7797
7798 2009-12-29  Ian Lance Taylor  <iant@google.com>
7799
7800         PR 10450
7801         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7802         .gnu.hash table for a 32-bit target.
7803
7804         PR 10450
7805         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7806         regular and a dynamic object only needs a dynamic symbol table
7807         entry if it is externally visible.
7808
7809         PR 10450
7810         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7811         constructor.  Add global_offset_table_ field.
7812         (Target_i386::got_section): Set global_offset_table_.
7813         (Target_i386::do_finalize_sections): Set global_offset_table_
7814         size.
7815         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7816         in constructor.  Add global_offset_table_ field.
7817         (Target_x86_64::got_section): Set global_offset_table_.
7818         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7819         size.
7820
7821         * layout.cc (Layout::Layout): Initialize increase_relro_.
7822         (Layout::get_output_section): Add is_relro, is_last_relro, and
7823         is_first_non_relro parameters.  Change all callers.
7824         (Layout::choose_output_section): Likewise.
7825         (Layout::add_output_section_data): Likewise.
7826         (Layout::make_output_section): Likewise.
7827         (Layout::set_segment_offsets): Clear increase_relro when using a
7828         linker script.
7829         * layout.h (class Layout): Add increase_relro method.  Add
7830         increase_relro_ field.  Update declarations.
7831         * output.cc (Output_section::Output_section): Initialize
7832         is_last_relro_ and is_first_non_relro_.
7833         (Output_segment::add_output_section): Group relro sections is
7834         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7835         (Output_segment::maximum_alignment): Remove relro handling.
7836         (Output_segment::set_section_addresses): Add increase_relro
7837         parameter.  Change all callers.  Add initial alignment to align
7838         relro sections on separate page.  Remove old relro handling.
7839         (Output_segment::set_section_list_addresses): Remove in_relro
7840         parameter.  Change all callers.
7841         (Output_segment::set_offset): Add increase parameter.  Change all
7842         callers.  Remove old relro handling.
7843         * output.h (class Output_section): Add new methods: is_last_relro,
7844         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7845         Add is_last_relro_ and is_first_non_relro_ fields.
7846         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7847         Create separate .got.plt section.  Call increase_relro.
7848         * x86_64.cc (Target_x86_64::got_section): Likewise.
7849         * testsuite/relro_script_test.t: Add .got.plt.
7850
7851         PR 10450
7852         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7853         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7854         (Layout::finalize): Call set_dynamic_symbol_size.
7855         (Layout::set_dynamic_symbol_size): New function.
7856         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7857         set_dynamic_symbol_size.
7858
7859         PR 10450
7860         * output.h (class Output_section): Add is_entsize_zero_ field.
7861         * output.cc (Output_section::Output_section): Initialize
7862         is_entsize_zero_.
7863         (Output_section::set_entsize): If two different entsizes are
7864         requested, force it to zero.
7865         (Output_section::add_input_section): Set flags for .debug_str
7866         before updating section flags.  Set entsize.
7867         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7868         and SHF_STRING if all input sections have those flags.
7869
7870 2009-12-29   Rafael Espindola  <espindola@google.com>
7871
7872         * main.cc (main): Fix the sys time reporting.
7873         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7874         reporting.
7875
7876 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7877
7878         * options.cc (General_options::parse_version): Allow -v to exit
7879         without an error if there is nothing to link.
7880
7881 2009-12-29  Ian Lance Taylor  <iant@google.com>
7882
7883         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7884         using a version of gcc before 4.1.
7885         * configure: Rebuild.
7886
7887 2009-12-28  Chris Demetriou  <cgd@google.com>
7888
7889         * attributes.cc (Output_attributes_section_data::do_write): Use
7890         std::vector::front rather than std::vector::data.
7891
7892 2009-12-28  Ian Lance Taylor  <iant@google.com>
7893
7894         * symtab.h (class Symbol_table): Add enum Defined.
7895         * resolve.cc (Symbol_table::should_override): Add defined
7896         parameter.  Change all callers.  Test whether object is NULL
7897         before calling a method on it.
7898         (Symbol_table::report_resolve_problem): Add defined parameter.
7899         Change all callers.
7900         (Symbol_table::should_override_with_special): Likewise.
7901         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7902         parameter.  Change all callers.
7903         (Symbol_table::do_define_in_output_data): Likewise.
7904         (Symbol_table::define_in_output_segment): Likewise.
7905         (Symbol_table::do_define_in_output_segment): Likewise.
7906         (Symbol_table::define_as_constant): Likewise.
7907         (Symbol_table::do_define_as_constant): Likewise.
7908         * script.h (class Symbol_assignment): Add is_defsym parameter to
7909         constructor; change all callers.
7910         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7911         parameter.  Change all callers.  Add is_defsym_ field.
7912         (class Parser_closure): Add parsing_defsym parameter to
7913         constructor; change all callers.  Add parsing_defsym accessor
7914         function.  Add parsing_defsym_ field.
7915
7916 2009-12-28  Ian Lance Taylor  <iant@google.com>
7917
7918         * gold.cc (queue_middle_tasks): Fix formatting.
7919         * object.cc (Relobj::is_section_name_included): Likewise.
7920
7921 2009-12-23  Ian Lance Taylor  <iant@google.com>
7922
7923         * i386.cc (Target_i386::do_calls_non_split): Recognize
7924         -fsplit-stack prologue for a function with a static chain.
7925         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7926         -fsplit-stack prologue when using %r11.
7927
7928 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7929
7930         * options.cc (General_options::parse_version): Make -v continue and do
7931         the link like GNU ld does.
7932
7933 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7934
7935         * Makefile.am (CCFILES): Add timer.cc.
7936         (HFILES): Add timer.h.
7937         * configure.ac: Check for sysconf and times.
7938         * main.cc: include timer.h.
7939         (main): Use Timer instead of get_run_time.
7940         * timer.cc: New.
7941         * timer.h: New.
7942         * workqueue.cc: include timer.h.
7943         (Workqueue::find_and_run_task):
7944         Report user, sys and wall time.
7945         * Makefile.in: Regenerate.
7946         * config.in: Regenerate.
7947         * configure: Regenerate.
7948
7949 2009-12-16  Doug Kwan  <dougkwan@google.com>
7950
7951         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7952         sections.
7953         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7954         relaxed input sections.
7955         * output.cc (Output_section::find_relaxed_input_section): Change
7956         return type to Output_relaxed_input_section pointer.  Adjust code
7957         for new type of relaxed_input_section_map_.
7958         * output.h (Output_section::find_relaxed_input_section): Change
7959         return type to Output_relaxed_input_section pointer.
7960         (Output_section::Output_relaxed_input_section_by_input_section_map):
7961         New type.
7962         (Output_section::relaxed_input_section_map_): Change type to
7963         Output_section::Output_relaxed_input_section_by_input_section_map.
7964         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7965         input section.
7966
7967 2009-12-15  Ian Lance Taylor  <iant@google.com>
7968
7969         * layout.cc (Layout::create_shstrtab): Only write out after input
7970         sections if we are compressing debug sections.
7971
7972 2009-12-15  Ian Lance Taylor  <iant@google.com>
7973
7974         * archive.cc (Archive::add_symbols): Only look up a symbol without
7975         a version if there is, in fact, a version.
7976
7977 2009-12-14  Ian Lance Taylor  <iant@google.com>
7978
7979         Revert -Wshadow changes, all changes from:
7980         2009-12-11  Doug Kwan  <dougkwan@google.com>
7981         2009-12-11  Nick Clifton  <nickc@redhat.com>
7982         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7983
7984 2009-12-11  Doug Kwan  <dougkwan@google.com>
7985
7986         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7987         due to -Wshadow.
7988         * attributes.cc (Object_attribute::size): Ditto.
7989         (Attributes_section_data::size): Ditto.
7990         (Attributes_section_data::Attributes_section_data): Ditto.
7991         (Output_attributes_section_data::do_write): Ditto.
7992         * attributes.h (Object_attribute::set_type): Ditto.
7993         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7994
7995 2009-12-11  Nick Clifton  <nickc@redhat.com>
7996
7997         * archive.cc: Fix shadowed variable warnings.
7998         * arm.cc: Likewise.
7999         * compressed_output.cc: Likewise.
8000         * compressed_output.h: Likewise.
8001         * configure: Likewise.
8002         * dwarf_reader.cc: Likewise.
8003         * dynobj.cc: Likewise.
8004         * dynobj.h: Likewise.
8005         * ehframe.cc: Likewise.
8006         * ehframe.h: Likewise.
8007         * errors.cc: Likewise.
8008         * expression.cc: Likewise.
8009         * fileread.cc: Likewise.
8010         * fileread.h: Likewise.
8011         * freebsd.h: Likewise.
8012         * i386.cc: Likewise.
8013         * icf.cc: Likewise.
8014         * incremental.h: Likewise.
8015         * layout.cc: Likewise.
8016         * layout.h: Likewise.
8017         * mapfile.cc: Likewise.
8018         * merge.cc: Likewise.
8019         * merge.h: Likewise.
8020         * object.cc: Likewise.
8021         * object.h: Likewise.
8022         * options.h: Likewise.
8023         * output.cc: Likewise.
8024         * output.h: Likewise.
8025         * parameters.cc: Likewise.
8026         * plugin.cc: Likewise.
8027         * powerpc.cc: Likewise.
8028         * reduced_debug_output.cc: Likewise.
8029         * reduced_debug_output.h: Likewise.
8030         * reloc.cc: Likewise.
8031         * reloc.h: Likewise.
8032         * resolve.cc: Likewise.
8033         * script-sections.cc: Likewise.
8034         * script.cc: Likewise.
8035         * script.h: Likewise.
8036         * sparc.cc: Likewise.
8037         * symtab.cc: Likewise.
8038         * symtab.h: Likewise.
8039         * target-select.cc: Likewise.
8040         * target-select.h: Likewise.
8041         * token.h: Likewise.
8042         * workqueue.cc: Likewise.
8043         * workqueue.h: Likewise.
8044         * x86_64.cc: Likewise.
8045
8046 2009-12-10  Doug Kwan  <dougkwan@google.com>
8047
8048         * arm.cc (attributes.h): New include.
8049         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8050         (Arm_relobj::~Arm_relobj): Delete object pointed by
8051         attributes_section_data_.
8052         (Arm_relobj::attributes_section_data): New method definition.
8053         (Arm_relobj::attributes_section_data_): New data member declaration.
8054         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8055         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8056         attributes_section_data_.
8057         (Arm_dynobj::attributes_section_data): New method definition.
8058         (Arm_dynobj::attributes_section_data_): New data member declaration.
8059         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8060         initialization value of may_use_blx_ to false.
8061         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8062         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8063         object attributes to compute results instead of hard-coding.
8064         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8065         Target_arm::get_secondary_compatible_arch,
8066         Target_arm::set_secondary_compatible_arch
8067         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8068         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8069         New method declarations.
8070         (Target_arm::get_aeabi_object_attribute): New method definition.
8071         (Target_arm::attributes_section_data_): New data member declaration.
8072         (read_arm_attributes_section): New template definition.
8073         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8074         (Arm_dynobj::do_read_symbols): Ditto.
8075         (Target_arm::do_finalize_sections): Merge attributes sections from
8076         input.  Check for BLX use after attributes section merging.
8077         Fix __exidx_start and __exidx_end visibility.  Create an
8078         .ARM.attributes section if necessary.
8079         (Target_arm::get_secondary_compatible_arch,
8080         Target_arm::set_secondary_compatible_arch,
8081         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8082         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8083         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8084         New method definitions.
8085
8086 2009-12-09  Ian Lance Taylor  <iant@google.com>
8087
8088         * plugin.cc (Plugin::load): Don't cast from void* to a function
8089         pointer.
8090
8091 2009-12-09  Ian Lance Taylor  <iant@google.com>
8092
8093         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8094         information fields.
8095
8096 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8097
8098         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8099         Replace two_file_shared_1.so with two_file_shared_2.so.
8100         * testsuite/Makefile.in: Regenerated.
8101
8102 2009-12-08  Doug Kwan  <dougkwan@google.com>
8103
8104         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8105         (HFILES): Add attributes.h and int_encoding.h.
8106         * Makefile.in: Regenerate.
8107         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8108         function definitions to int_encoding.cc
8109         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8110         prototypes to int_encoding.h
8111         * reduced_debug_output.cc (int_encoding.h): New include.
8112         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8113         function definitions to int_encoding.cc
8114         (insert_into_vector, read_from_pointer): Move template definitions to
8115         int_encoding.h
8116         * attributes.cc: New file.
8117         * attributes.h: New file.
8118         * int_encoding.cc: New file.
8119         * int_encoding.h: New file.
8120
8121 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8122
8123         PR gold/11055
8124         * incremental-dump.cc (dump_incremental_inputs): New.
8125         (main): Use dump_incremental_inputs.
8126
8127 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8128
8129         PR gold/10893
8130         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8131         checking elfcpp::STT_FUNC.
8132         (Target_i386::Relocate::relocate): Likewise.
8133         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8134
8135         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8136         symbols from shared libraries into normal FUNC symbols.
8137
8138         * symtab.h (Symbol): Add is_func and use it.
8139
8140 2009-12-05  Doug Kwan  <dougkwan@google.com>
8141
8142         * arm.cc (Target_arm::arm_info): Initialize new fields
8143         attributes_section and attributes_vendor.
8144         * i386.cc (Target_i386::i386_info): Same.
8145         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8146         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8147         fields attributes_section and attributes_vendor.
8148         * sparc.cc (Target_sparc::sparc_info): Same.
8149         * target.h (Target::attributes_section, Target::attributes_vendor,
8150         Target::is_attributes_section, Target::attribute_arg_type,
8151         Target::attributes_order): New method definitions.
8152         (Target::Target_info::attributes_section,
8153         Target::Target_info::attributes_vendor): New fields.
8154         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8155         virtual method definitions.
8156         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8157         attributes_section and attributes_vendor.
8158         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8159
8160 2009-12-05  Doug Kwan  <dougkwan@google.com>
8161
8162         * arm.cc: Update comments about interworking and stub generation.
8163         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8164         considered as non-PIC.
8165         (Arm_relocate_functions::base_abs): Fix formatting.
8166         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8167         of function to use GOT entry address instead of offset.
8168         (Target_arm::Scan::global): Issue an error if a symbol would need a
8169         PLT does not get one because it is untyped.  Remove code to create
8170         dynamic symbols for relative branches.
8171         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8172         takes unsigned integer instead of boolean.
8173
8174 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8175
8176         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8177         (two_file_test_LDADD): Likewise.
8178         (common_test_1_LDADD): Likewise.
8179         (exception_test_LDADD) Likewise.
8180         (weak_test_LDADD): Likewise.
8181         (many_sections_test_LDADD): Likewise.
8182         (initpri1_LDADD): Likewise.
8183         (script_test_1_LDADD): Likewise.
8184         (script_test_2_LDADD): Likewise.
8185         (justsyms_LDADD): Likewise.
8186         (binary_test_LDADD): Likewise.
8187         (large_LDADD): Likewise.
8188         * testsuite/Makefile.in: Regenerated.
8189
8190 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8191
8192         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8193         (Symbol_table::override_with_special): Likewise.
8194         (Symbol_table::add_from_object): Likewise.
8195
8196 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8197
8198         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8199         Don't set the data_offset twice.
8200
8201 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8202
8203         * testsuite/Makefile.in: Regenerate.
8204
8205 2009-12-03  Doug Kwan  <dougkwan@google.com>
8206
8207         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8208         (Target_arm::do_finalize_sections): Add parameter for symbol table
8209         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8210         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8211         parameter for symbol table pointer.
8212         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8213         an additional parameter for a pointer to symbol table.
8214         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8215         parameter for a symbol table pointer.
8216         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8217         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8218         Ditto.
8219         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8220         parameter for a symbol table pointer.
8221
8222 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8223
8224         * incremental.cc (Incremental_inputs_header)
8225         (Incremental_inputs_header_write, Incremental_inputs_entry)
8226         (Incremental_inputs_entry_write): Move ...
8227         * incremental.h (Incremental_inputs_header)
8228         (Incremental_inputs_header_write, Incremental_inputs_entry)
8229         (Incremental_inputs_entry_write): here.
8230
8231 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8232
8233         * incremental.cc (make_sized_incremental_binary): Set the target.
8234         Error if it is incompatible.
8235         * output.h (Output_file): Add filename method.
8236
8237 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8238
8239         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8240         from the get_* methods.
8241
8242 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8243
8244         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8245         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8246         Write 0 for the data_offset of scripts.
8247
8248 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8249
8250         * testsuite/Makefile.am: Add the incremental_test.sh test.
8251         * testsuite/incremental_test.sh: New.
8252         * testsuite/incremental_test_1.c: New.
8253         * testsuite/incremental_test_2.c: New.
8254
8255 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8256
8257         * incremental-dump.cc (main): Fix typos.
8258
8259 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8260
8261         PR gold/11025
8262         * incremental-dump.cc (main): Use llu to print 64 bit values.
8263
8264 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8265             H.J. Lu  <hongjiu.lu@intel.com>
8266
8267         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8268         $(LIBDL).
8269         (incremental_dump_LDADD): Likewise.
8270         * Makefile.in: Regenerated.
8271
8272 2009-11-25  Doug Kwan  <dougkwan@google.com>
8273
8274         Revert:
8275
8276         2009-11-25  Doug Kwan  <dougkwan@google.com>
8277
8278                 * arm.cc (Target_arm::Target_arm): Move method definition
8279                 outside of class definition.  Add code to handle
8280                 --target1-rel, --target1-abs and --target2= options.
8281                 (Target_arm::get_reloc_reloc_type): Change method to be
8282                 non-static and const.
8283                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8284                 New data member declaration.
8285                 (Target_arm::Scan::local, Target_arm::Scan::global,
8286                 Target_arm::Relocate::relocate,
8287                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8288                 Adjust call to Target_arm::get_real_reloc_type.
8289                 (Target_arm::get_real_reloc_type): Use command line options
8290                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8291                 * options.h (--target1-rel, --target1-abs, --target2): New
8292                 ARM-only options.
8293
8294 2009-11-25  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8297         class definition.  Add code to handle --target1-rel, --target1-abs
8298         and --target2= options.
8299         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8300         and const.
8301         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8302         member declaration.
8303         (Target_arm::Scan::local, Target_arm::Scan::global,
8304         Target_arm::Relocate::relocate,
8305         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8306         call to Target_arm::get_real_reloc_type.
8307         (Target_arm::get_real_reloc_type): Use command line options to
8308         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8309         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8310         options.
8311
8312 2009-11-25  Doug Kwan  <dougkwan@google.com>
8313
8314         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8315         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8316         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8317         formatting.
8318         (Arm_relocate_functions::thm_call): Replace body with a call to
8319         Arm_relocate_functions::thumb_branch_common.
8320         (Arm_relocate_functions::thm_jump24,
8321         Arm_relocate_functions::thm_xpc22): New method definitions.
8322         (Arm_relocate_functions::thumb_branch_common): New method definition.
8323         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8324         operator.
8325         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8326         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8327
8328 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8329
8330         * Makefile.am: Build incremental-dump
8331         * Makefile.in: Regenerate.
8332         * incremental-dump.cc: New.
8333         * incremental.cc (Incremental_inputs_header_data,
8334         Incremental_inputs_entry_data): Move to incremental.h
8335         * incremental.h: (Incremental_inputs_header_data,
8336         Incremental_inputs_entry_data): Move from incremental.cc
8337
8338 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8339
8340         * incremental.cc (Incremental_inputs_header,
8341         Incremental_inputs_header_write, Incremental_inputs_entry,
8342         Incremental_inputs_entry_write): Add a typedef with the data type.
8343
8344 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8345
8346         * incremental.cc (Incremental_inputs_header,
8347         Incremental_inputs_header_write, Incremental_inputs_entry,
8348         Incremental_inputs_entry_write): Update comment about which
8349         type has the filed descriptions.
8350
8351 2009-11-15  Doug Kwan  <dougkwan@google.com>
8352
8353         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8354         (Arm_relocate_functions::arm_branch_common): Change method defintion
8355         in class definition to a method declaration and update list of formal
8356         parameters.
8357         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8358         Arm_relocation_functions::jump24): Adjust call to
8359         Arm_relocate_functions::arm_branch_common.  Update list of formal
8360         parameters.
8361         (Arm_relocate_functions::xpc25): New method definition.
8362         (Arm_relocate_functions::arm_branch_common): Move method defintion
8363         out from class definition.  Use stubs for mode-switching and extending
8364         branch ranges.
8365         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8366         specially.  Change code to enable use of stubs in ARM branches.
8367
8368 2009-11-10  Doug Kwan  <dougkwan@google.com>
8369
8370         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8371         in method declaration.
8372         (Target_arm::relocate_stub): New method declaration.
8373         (Target_arm::default_target): Change to return a pointer instead of
8374         a const reference.
8375         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8376         Target_arm::default_target.
8377         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8378         method definition.
8379         (Target_arm::relocate_section): Adjust view.
8380         (Target_arm::relocate_stub): New method definition.
8381
8382 2009-11-10  Doug Kwan  <dougkwan@google.com>
8383
8384         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8385         a format warning.
8386         * incremental.cc (open_incremental_binary): Initialized local
8387         variables to avoid warnings.
8388         * object.cc (make_elf_object): Ditto.
8389         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8390         a format warning.
8391
8392 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8393
8394         PR gold/10930
8395         * testsuite/plugin_test.c: Include "config.h".
8396
8397 2009-11-09  Doug Kwan  <dougkwan@google.com>
8398
8399         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8400         (arm_symbol_value): Remove.
8401         (Arm_relocate_functions::arm_branch_common,
8402         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8403         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8404         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8405         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8406         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8407         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8408         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8409         Arm_relocate_functions::thm_mobw_abs_nc,
8410         Arm_relocate_functions::thm_mov_abs,
8411         Arm_relocate_functions::movw_prel_nc,
8412         Arm_relocate_functions::thm_movt_abs,
8413         Arm_relocate_functions::movt_prel,
8414         Arm_relocate_functions::thm_movw_prel_nc,
8415         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8416         (Target_arm::Relocate::relocate): Only decompose address into two
8417         parts if relocation type uses the thumb-bit and pass the actual
8418         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8419         calls to methods in Arm_relocate_functions for this change.
8420
8421 2009-11-08  Ian Lance Taylor  <iant@google.com>
8422
8423         PR 10925
8424         * reloc.cc: Instantiate
8425         Sized_relobj::initialize_input_to_output_maps and
8426         Sized_relobj:free_input_to_output_maps.
8427
8428 2009-11-06  Ian Lance Taylor  <iant@google.com>
8429
8430         PR 10876
8431         * defstd.cc (in_segment): Set only_if_ref true for "end".
8432
8433 2009-11-06  Doug Kwan  <dougkwan@google.com>
8434
8435         * arm.cc (class Reloc_stub): Correct a comment.
8436         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8437         (Target_arm::scan_section_for_stubs): New method declaration.
8438         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8439         Change methods from private to protected.
8440         (Target_arm::do_may_relax): New method definition.
8441         (Target_arm::do_relax, Target_arm::group_sections,
8442         Target_arm::scan_reloc_for_stub,
8443         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8444         (Target_arm::arm_input_section_map_): New data member declaration.
8445         (Target_arm::scan_reloc_for_stub,
8446         Target_arm::scan_reloc_section_for_stubs,
8447         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8448         Target_arm::do_relax): New method definitions.
8449
8450 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8451
8452         * configure.ac: Check for (struct stat)::st_mtim
8453         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8454         * config.in: Regenerate.
8455         * configure: Regenerate.
8456
8457 2009-11-05  Ian Lance Taylor  <iant@google.com>
8458
8459         PR 10910
8460         * output.cc (Output_segment::add_output_section): Add missing
8461         return statement.
8462
8463 2009-11-04  Ian Lance Taylor  <iant@google.com>
8464
8465         PR 10880
8466         * object.h (class Object): Add is_needed and set_is_needed
8467         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8468         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8469         defined in a dynamic object and referenced by a regular object,
8470         set is_needed for the dynamic object.
8471         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8472         if the file is marked with as_needed and it is not needed.
8473
8474 2009-11-04  Ian Lance Taylor  <iant@google.com>
8475
8476         PR 10887
8477         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8478         tags if data is discarded by linker script.
8479         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8480         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8481         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8482         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8483
8484 2009-11-04  Ian Lance Taylor  <iant@google.com>
8485
8486         * layout.cc (Layout::get_output_section): Add is_interp and
8487         is_dynamic_linker_section parameters.  Change all callers.
8488         (Layout::choose_output_section): Likewise.
8489         (Layout::make_output_section): Likewise.
8490         (Layout::add_output_section_data): Add is_dynamic_linker_section
8491         parameter.  Change all callers.
8492         * layout.h (class Layout): Update declarations.
8493         * output.h (class Output_section): Add is_interp, set_is_interp,
8494         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8495         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8496         generate_code_fills_at_write_ to a bitfield.
8497         * output.cc (Output_section::Output_sections): Initialize new
8498         fields.
8499         (Output_segment::add_output_section): Add do_sort parameter.
8500         Change all callers.
8501
8502 2009-11-03  Ian Lance Taylor  <iant@google.com>
8503
8504         PR 10860
8505         * options.h (class General_options): Add --warn-common.
8506         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8507         merging two common symbols.
8508         (Symbol_table::should_override): Handle --warn-common when merging
8509         a common symbol with a defined symbol.  Use report_resolve_problem
8510         for multiple definitions.
8511         (Symbol_table::report_resolve_problem): New function.
8512         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8513
8514 2009-11-03  Doug Kwan  <dougkwan@google.com>
8515
8516         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8517         stub_factory_.
8518         (Target_arm::stub_factory): New method definition.
8519         (Target_arm::new_arm_input_section,
8520         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8521         Target_arm::reloc_uses_thumb_bit): New method declarations.
8522         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8523         New type definitions.
8524         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8525         member declarations.
8526         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8527         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8528         New method definitions.
8529
8530 2009-11-03  Ian Lance Taylor  <iant@google.com>
8531
8532         * options.h (class General_options): Add --warn_constructors.
8533
8534 2009-11-03  Ian Lance Taylor  <iant@google.com>
8535
8536         PR 10893
8537         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8538         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8539
8540 2009-11-03  Ian Lance Taylor  <iant@google.com>
8541
8542         PR 10895
8543         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8544         --msgid-bugs-address.
8545         (install-pdf): New target.
8546         (install-data_yes): Look up one directory to find mkinstalldirs.
8547
8548 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8549
8550         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8551         tree.
8552
8553 2009-10-30  Doug Kwan  <dougkwan@google.com>
8554
8555         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8556
8557 2009-10-30  Doug Kwan  <dougkwan@google.com>
8558
8559         * arm.cc (Stub_addend_reader): New struct template definition
8560         and partial specializations.
8561         (Stub_addend_reader::operator()): New method definition for a
8562         partially specialized template.
8563
8564 2009-10-30  Doug Kwan  <dougkwan@google.com>
8565
8566         * arm.cc (Arm_relobj::processor_specific_flags): New method
8567         definition.
8568         (Arm_relobj::do_read_symbols): New method declaration.
8569         (Arm_relobj::processor_specific_flags_): New data member declaration.
8570         (Arm_dynobj): New class definition.
8571         (Target_arm::do_finalize_sections): Add input_objects parameter.
8572         (Target_arm::do_adjust_elf_header): New method declaration.
8573         (Target_arm::are_eabi_versions_compatible,
8574         (Target_arm::merge_processor_specific_flags): New method declaration.
8575         (Target_arm::do_make_elf_object): New overloaded method definitions
8576         and declaration.
8577         (Arm_relobj::do_read_symbols): New method definition.
8578         (Arm_dynobj::do_read_symbols): Ditto.
8579         (Target_arm::do_finalize_sections): Add input_objects parameters.
8580         Merge processor-specific flags from all input objects.
8581         (Target_arm::are_eabi_versions_compatible,
8582         Target_arm::merge_processor_specific_flags,
8583         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8584         New method definitions.
8585         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8586         Input_objects pointer type parameter.
8587         * layout.cc (Layout::finalize): Pass input objects to target's.
8588         finalize_sections function.
8589         * output.cc (Output_file_header::do_sized_write): Set ELF file
8590         header's processor-specific flags.
8591         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8592         Input_objects pointer type parameter.
8593         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8594         * target.h (Input_objects): New forward class declaration.
8595         (Target::processor_specific_flags,
8596         Target::are_processor_specific_flags_sect): New method definitions.
8597         (Target::finalize_sections): Add input_objects parameter.
8598         (Target::Target): Initialize processor_specific_flags_ and
8599         are_processor_specific_flags_set_.
8600         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8601         parameter.
8602         (Target::set_processor_specific_flags): New method definition.
8603         (Target::processor_specific_flags_,
8604         Target::are_processor_specific_flags_set_): New data member
8605         declarations.
8606         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8607         Input_objects pointer type parameter.
8608
8609 2009-10-30  Doug Kwan  <dougkwan@google.com>
8610
8611         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8612
8613 2009-10-28  Ian Lance Taylor  <iant@google.com>
8614
8615         * object.h (class Relobj): Drop options parameter from
8616         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8617         do_scan_relocs, do_relocate.  Change all callers.
8618         (class Sized_relobj): Drop options parameters from
8619         do_gc_process_relocs, do_scan_relocs, do_relocate,
8620         do_relocate_sections, relocate_sections, emit_relocs_scan,
8621         emit_relocs_scan_reltype.  Change all callers.
8622         (struct Relocate_info): Remove options field and all references to
8623         it.
8624         * reloc.h (class Read_relocs): Remove options constructor
8625         parameter and options_ field.  Change all callers.
8626         (class Gc_process_relocs, class Scan_relocs): Likewise.
8627         (class Relocate_task): Likewise.
8628         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8629         all callers.
8630         (scan_relocatable_relocs): Likewise.
8631         * target.h (class Sized_target): Remove options parameter from
8632         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8633         all callers.
8634         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8635         callers.
8636         * arm.cc: Update functions to remove options parameters.
8637         * i386.cc: Likewise.
8638         * powerpc.cc: Likewise.
8639         * sparc.cc: Likewise.
8640         * x86_64.cc: Likewise.
8641         * testsuite/testfile.cc: Likewise.
8642
8643 2009-10-28  Doug Kwan  <dougkwan@google.com>
8644
8645         * arm.cc (Arm_relobj): New class definition.
8646         (Arm_relobj::scan_sections_for_stubs,
8647         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8648         New method definitions.
8649
8650 2009-10-28  Cary Coutant  <ccoutant@google.com>
8651
8652         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8653         (Plugin::cleanup_done_): New member.
8654         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8655         (Plugin_manager::cleanup_done_): Remove.
8656         (Plugin_manager::add_input_file): Edit error message.
8657         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8658         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8659
8660 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8661
8662         * fileread.cc: (File_read::View::~View): Use the new
8663         data_ownership_ filed.
8664         (File_read::~File_read): Dispose the new whole_file_view_.
8665         (File_read::open): Mmap the whole file if needed.
8666         (File_read::open): Use whole_file_view_ instead of contents_.
8667         (File_read::find_view): Use whole_file_view_ if applicable.
8668         (File_read::do_read): Use whole_file_view_ instead of contents_.
8669         (File_read::make_view): Use whole_file_view_ instead of contents_,
8670         update File_read::View::View call.
8671         (File_read::find_or_make_view): Update File_read::View::View
8672         call.
8673         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8674         remove contents_
8675         (File_read::View::Data_ownership): New enum.
8676         (File_read::View::View): Replace bool mapped_ with Data_ownership
8677         argument.
8678         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8679         (File_read::View::data_ownership_): New field.
8680         (File_read::contents_): Remove (replaced by whole_file_view_).
8681         (File_read::whole_file_view_): New field.
8682         * options.h (class General_options): Add --keep-files-mapped.
8683
8684 2009-10-27  Cary Coutant  <ccoutant@google.com>
8685
8686         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8687         * testsuite/Makefile.am (plugin_test_5): New test case.
8688         * testsuite/Makefile.in: Regenerate.
8689
8690 2009-10-25  Doug Kwan  <dougkwan@google.com>
8691
8692         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8693         from private to protected to allow access by child class.
8694         (Sized_relobj::do_relocate_sections): New method declaration.
8695         (Sized_relobj::relocate_sections): Virtualize.
8696         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8697         Sized_relobj::relocate_sections.  Instantiate template explicitly
8698         for different target sizes and endianity.
8699
8700 2009-10-24  Doug Kwan  <dougkwan@google.com>
8701
8702         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8703         (Arm_input_section::as_arm_input_section): New method.
8704         (Arm_output_section): New class definition.
8705         (Arm_output_section::create_stub_group,
8706         Arm_output_section::group_sections): New method definitions.
8707
8708 2009-10-22  Doug Kwan  <dougkwan@google.com>
8709
8710         * arm.cc (Arm_input_section): New class definition.
8711         (Arm_input_section::init, Arm_input_section:do_write,
8712         Arm_input_section::set_final_data_size,
8713         Arm_input_section::do_reset_address_and_file_offset): New method
8714         definitions.
8715
8716 2009-10-21  Doug Kwan  <dougkwan@google.com>
8717
8718         * arm.cc (Stub_table, Arm_input_section): New forward class
8719         declarations.
8720         (Stub_table): New class defintion.
8721         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8722         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8723         New method definition.
8724
8725 2009-10-21  Doug Kwan  <dougkwan@google.com>
8726
8727         * arm.cc: Update copyright comments.
8728         (Target_arm): New forward class template declaration.
8729         (Arm_address): New type.
8730         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8731         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8732         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8733         constants.
8734         (Insn_template): Same.
8735         (DEF_STUBS): New macro.
8736         (Stub_type): New enum type.
8737         (Stub_template): New class definition.
8738         (Stub): Same.
8739         (Reloc_stub): Same.
8740         (Stub_factory): Same.
8741         (Target_arm::Target_arm): Initialize may_use_blx_ and
8742         should_force_pic_veneer_.
8743         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8744         Target_arm::should_force_pic_veneer,
8745         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8746         Target_arm::using_thumb_only, Target_arm:;default_target): New
8747         method defintions.
8748         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8749         New data member declarations.
8750         (Insn_template::size, Insn_template::alignment): New method defintions.
8751         (Stub_template::Stub_template): New method definition.
8752         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8753         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8754         (Stub_factory::Stub_factory): New method definition.
8755         * gold.h (string_hash): New template.
8756         * output.h (Input_section_specifier::hash_value): Use
8757         gold::string_hash.
8758         (Input_section_specifier::string_hash): Remove.
8759         * stringpool.cc (Stringpool_template::string_hash): Use
8760         gold::string_hash.
8761
8762 2009-10-20  Doug Kwan  <dougkwan@google.com>
8763
8764         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8765         symbols of relaxed input sections.
8766         * output.h (Output_section::find_relaxed_input_section): Make
8767         method public.
8768
8769 2009-10-16  Doug Kwan  <dougkwan@google.com>
8770
8771         * dynobj.cc (Versions::Versions): Initialize version_script_.
8772         Only insert base version symbol definition for a shared object
8773         if version script defines any version versions.
8774         (Versions::define_base_version): New method definition.
8775         (Versions::add_def): Check that base version is not needed.
8776         (Versions::add_need): Define base version lazily.
8777         * dynobj.h (Versions::define_base_version): New method declaration.
8778         (Versions::needs_base_version_): New data member declaration.
8779         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8780         (check_DATA): Add no_version_test.stdout.
8781         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8782         New make rules.
8783         * testsuite/Makefile.in: Regenerate.
8784         * testsuite/no_version_test.c: New file.
8785         * testsuite/no_version_test.sh: Ditto.
8786
8787 2009-10-16  Doug Kwan  <dougkwan@google.com>
8788
8789         * expression.cc (class Segment_start_expression): New class definition.
8790         (Segment_start_expression::value): New method definition.
8791         (script_exp_function_segment_start): Return a new
8792         Segment_start_expression.
8793         * gold/script-c.h (script_saw_segment_start_expression): New function
8794         prototype.
8795         * script-sections.cc (Script_sections::Script_sections): Initialize
8796         SAW_SEGMENT_START_EXPRESSION_ to false.
8797         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8798         and -Tbbs options to specify section addresses if given in
8799         command line and no SEGMENT_START expression is seen in a script.
8800         * script-sections.h (Script_sections::saw_segment_start_expression,
8801         Script_sections::set_saw_segment_start_expression): New method
8802         definition.
8803         (Script_sections::saw_segment_start_expression_): New data member
8804         declaration.
8805         * script.cc (script_saw_segment_start_expression): New function.
8806         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8807         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8808         script_test_7.sh and script_test_8.sh.
8809         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8810         script_test_8.stdout.
8811         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8812         (script_test_6, script_test_6.stdout, script_test_7,
8813         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8814         * Makefile.in: Regenerate.
8815         * testsuite/script_test_6.sh: New file.
8816         * testsuite/script_test_6.t: Same.
8817         * testsuite/script_test_7.sh: Same.
8818         * testsuite/script_test_7.t: Same.
8819         * testsuite/script_test_8.sh: Same.
8820
8821 2009-10-16  Doug Kwan  <dougkwan@google.com>
8822
8823         * output.cc (Output_segment::set_section_list_address): Cast
8824         expressions to unsigned long long type to avoid format warnings.
8825
8826 2009-10-15  Ian Lance Taylor  <iant@google.com>
8827
8828         * script.cc (Script_options::add_symbol_assignment): Always add a
8829         dot assignment to script_sections_.
8830         * script-sections.cc (Script_sections::add_dot_assignment):
8831         Initialize if necessary.
8832
8833         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8834         program headers with no load segment if there is a linker script.
8835
8836         * layout.cc (Layout::set_segment_offsets): Align the file offset
8837         to the segment aligment for -N or -n with no load segment.
8838         * output.cc (Output_segment::add_output_section): Don't crash if
8839         the first section is a TLS section.
8840         (Output_segment::set_section_list_addresses): Print an error
8841         message if the address moves backward in a linker script.
8842         * script-sections.cc
8843         (Output_section_element_input::set_section_addresses): Don't
8844         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8845         (Orphan_output_section::set_section_addresses): Likewise.
8846
8847 2009-10-15  Doug Kwan  <dougkwan@google.com>
8848
8849         * layout.cc (Layout::finish_dynamic_section): Generate tags
8850         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8851         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8852         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8853
8854 2009-10-14  Ian Lance Taylor  <iant@google.com>
8855
8856         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8857         fields.
8858         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8859         data_shdr fields of relinfo.
8860         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8861         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8862         R_386_TLS_LDO_32, adjust based on section flags.
8863         (Target_i386::Relocate::fix_up_ldo): Remove.
8864
8865 2009-10-13  Ian Lance Taylor  <iant@google.com>
8866
8867         Add support for -pie.
8868         * options.h (class General_options): Add -pie and
8869         --pic-executable.
8870         (General_options::output_is_position_independent): Test -pie.
8871         (General_options::output_is_executable): Return true if not shared
8872         and not relocatable.
8873         (General_options::output_is_pie): Remove.
8874         * options.cc (General_options::finalize): Reject incompatible uses
8875         of -pie.
8876         * gold.cc (queue_middle_tasks): A -pie link is not static.
8877         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8878         * symtab.cc (Symbol::final_value_is_known): Return false if
8879         output_is_position_independent.
8880         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8881         output_is_position_independent.
8882         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8883         output_is_position_independent.
8884         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8885         output_is_position_independent.
8886         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8887         two_file_pie_test.
8888         (basic_pie_test.o, basic_pie_test): New targets.
8889         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8890         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8891         (two_file_pie_test): New target.
8892         * testsuite/Makefile.in: Rebuild.
8893         * README: Remove note saying that -pie is not supported.
8894
8895 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8896
8897         * options.h (class General_options): Add -init and -fini.
8898         * layout.cc (Layout::finish_dynamic_section): Emit
8899         given init and fini functions.
8900
8901 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8902
8903         * gc.h (gc_process_relocs): Check if icf is enabled using new
8904         function.
8905         * gold.cc (queue_initial_tasks): Likewise.
8906         (queue_middle_tasks): Likewise.
8907         * object.cc (do_layout): Likewise.
8908         * symtab.cc (is_section_folded): Likewise.
8909         * main.cc (main): Likewise.
8910         * reloc.cc (Read_relocs::run): Likewise.
8911         (Sized_relobj::do_scan_relocs): Likewise.
8912         * icf.cc (is_function_ctor_or_dtor): New function.
8913         (Icf::find_identical_sections): Check if function is ctor or dtor when
8914         safe icf is chosen.
8915         * options.h (General_options::icf): Change option to be an enum.
8916         (Icf_status): New enum.
8917         (icf_enabled): New method.
8918         (icf_safe_folding): New method.
8919         (set_icf_status): New method.
8920         (icf_status_): New variable.
8921         * (options.cc) (General_options::finalize): Set icf_status_.
8922         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8923         icf_test and icf_keep_unique_test to use the --icf enum flag.
8924         * testsuite/icf_safe_test.sh: New file.
8925         * testsuite/icf_safe_test.cc: New file.
8926
8927 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8928
8929         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8930         includes to gc.h and icf.h.
8931         * arm.cc: Include gc.h.
8932         * gold.cc: Likewise.
8933         * i386.cc: Likewise.
8934         * powerpc.cc: Likewise.
8935         * sparc.cc: Likewise.
8936         * x86_64.cc: Likewise.
8937         * gc.h: Include icf.h.
8938
8939 2009-10-11  Ian Lance Taylor  <iant@google.com>
8940
8941         * plugin.cc: Include "gold.h" before other header files.
8942
8943 2009-10-10  Chris Demetriou  <cgd@google.com>
8944
8945         * options.h (Input_file_argument::Input_file_type): New enum.
8946         (Input_file_argument::is_lib_): Replace with...
8947         (Input_file_argument::type_): New member.
8948         (Input_file_argument::Input_file_argument): Take Input_file_type
8949         'type' rather than boolean 'is_lib' as second argument.
8950         (Input_file_argument::is_lib): Use type_.
8951         (Input_file_argument::is_searched_file): New function.
8952         (Input_file_argument::may_need_search): Handle is_searched_file.
8953         * options.cc (General_options::parse_library): Support -l:filename.
8954         (General_options::parse_just_symbols): Update for Input_file_argument
8955         changes.
8956         (Command_line::process): Likewise.
8957         * archive.cc (Archive::get_file_and_offset): Likewise.
8958         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8959         * script.cc (read_script_file, script_add_file): Likewise.
8960         * fileread.cc (Input_file::Input_file): Likewise.
8961         (Input_file::will_search_for): Handle is_searched_file.
8962         (Input_file::open): Likewise.
8963         * readsyms.cc (Read_symbols::get_name): Likewise.
8964         * testsuite/Makefile.am (searched_file_test): New test.
8965         * testsuite/Makefile.in: Regenerate.
8966         * testsuite/searched_file_test.cc: New file.
8967         * testsuite/searched_file_test_lib.cc: New file.
8968
8969 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8970             Ian Lance Taylor  <iant@google.com>
8971
8972         * descriptor.cc: Include <cstdio> and "binary-io.h".
8973         (Descriptors::open): Open the files in binary mode always.
8974         * script.cc (Lex::get_token): Treat \r as whitespace.
8975
8976 2009-10-09  Ian Lance Taylor  <iant@google.com>
8977
8978         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8979
8980 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8981             Ian Lance Taylor  <iant@google.com>
8982
8983         * configure.ac: Check for readv function also.
8984         * fileread.cc (readv): Define if not HAVE_READV.
8985         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8986         does not exist.
8987         * config.in: Regenerate.
8988         * configure: Regenerate.
8989
8990 2009-10-09  Doug Kwan  <dougkwan@google.com>
8991
8992         * layout.cc (Layout::make_output_section): Call target hook to make
8993         ordinary output section.
8994         (Layout::finalize): Adjust parameter list of call the
8995         Target::may_relax().
8996         * layout.h (class Layout::section_list): New method.
8997         * merge.h (Output_merge_base::entsize): Change visibility to public.
8998         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8999         New methods.
9000         (Output_merge_string::do_is_string): New method.
9001         * object.cc (Sized_relobj::do_setup): renamed from
9002         Sized_relobj::set_up.
9003         * object.h (Sized_relobj::adjust_shndx,
9004         Sized_relobj::initializ_input_to_output_maps,
9005         Sized_relobj::free_input_to_output_maps): Change visibilities to
9006         protected.
9007         (Sized_relobj::setup): Virtualize.
9008         (Sized_relobj::do_setup): New method declaration.
9009         (Sized_relobj::invalidate_section_offset,
9010         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9011         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9012         * options.cc (parse_int): New function.
9013         * options.h (parse_int): New declaration.
9014         (DEFINE_int): New macro.
9015         (stub_group_size): New option.
9016         * output.cc (Output_section::Output_section): Initialize memebers
9017         merge_section_map_, merge_section_by_properties_map_,
9018         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9019         (Output_section::add_input_section): Handled deferred code-fill
9020         generation and remove an old comment.
9021         (Output_section::add_relaxed_input_section): New method definition.
9022         (Output_section::add_merge_input_section): Use merge section by
9023         properties map to speed to search.  Update merge section maps
9024         as appropriate.
9025         (Output_section::build_relaxation_map): New method definition.
9026         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9027         Same.
9028         (Output_section::relax_input_section): Renamed to
9029         Output_section::convert_input_sections_to_relaxed_sections and change
9030         interface to take a vector of pointers to relaxed sections.
9031         (Output_section::find_merge_section,
9032         Output_section::find_relaxed_input_section): New method definitions.
9033         (Output_section::is_input_address_mapped,
9034         Output_section::output_offset, Output_section::output_address):
9035         Use output section data maps to speed up searching.
9036         (Output_section::find_starting_output_address): Add comments.
9037         (Output_section::do_write,
9038         Output_section::write_to_postprocessing_buffer): Do code-fill
9039         generation as appropriate.
9040         (Output_section::get_input_sections): Invalidate relaxed input section
9041         map.
9042         (Output_section::restore_states): Adjust type of checkpoint .
9043         Invalidate relaxed input section map.
9044         * output.h (Output_merge_base): New class declaration.
9045         (Input_section_specifier): New class defintion.
9046         (class Output_relaxed_input_section) Change base class to
9047         Output_section_data_build.
9048         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9049         base class initializer.
9050         (Output_section::add_relaxed_input_section): New method declaration.
9051         (Output_section::Input_section): Change visibility to protected.
9052         (Output_section::Input_section::relobj,
9053         Output_section::Input_section::shndx): Handle relaxed input sections.
9054         Output_section::input_sections) Change visibility to protected.  Also
9055         define overload to return a non-const pointer.
9056         (Output_section::Merge_section_properties): New class defintion.
9057         (Output_section::Merge_section_by_properties_map,
9058         Output_section::Output_section_data_by_input_section_map,
9059         Output_section::Relaxation_map): New types.
9060         (Output_section::relax_input_section): Rename method to
9061         Output_section::convert_input_sections_to_relaxed_sections and change
9062         interface to take a vector of relaxed section pointers.
9063         (Output_section::find_merge_section,
9064         Output_section::find_relaxed_input_section,
9065         Output_section::build_relaxation_map,
9066         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9067         New method declarations.
9068         (Output_section::merge_section_map_
9069         Output_section::merge_section_by_properties_map_,
9070         Output_section::relaxed_input_section_map_,
9071         Output_section::is_relaxed_input_section_map_valid_,
9072         Output_section::generate_code_fills_at_write_): New data members.
9073         * script-sections.cc
9074         (Output_section_element_input::set_section_addresses): Call
9075         current_data_size and addralign methods of relaxed input sections.
9076         (Orphan_output_section::set_section_addresses): Call current_data_size
9077         and addralign methods of relaxed input sections.
9078         * symtab.cc (Symbol_table::compute_final_value): Extract template
9079         from the body of Symbol_table::sized_finalize_symbol.
9080         (Symbol_table::sized_finalized_symbol): Call
9081         Symbol_table::compute_final_value.
9082         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9083         (Symbol_table::compute_final_value): New templated method declaration.
9084         * target.cc (Target::do_make_output_section): New method defintion.
9085         * target.h (Target::make_output_section): New method declaration.
9086         (Target::relax): Add more parameters for input objects, symbol table
9087         and layout.  Adjust call to do_relax.
9088         (Target::do_make_output_section): New method declaration.
9089         (Target::do_relax): Add parameters for input objects, symbol table
9090         and layout.
9091
9092 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9093
9094         * pread.c: Include stdio.h.
9095
9096 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9097
9098         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9099         defined.
9100
9101 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9102
9103         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9104         Change read_shndx type to unsigned int.
9105         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9106         int.
9107         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9108         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9109         Change read_shndx type to unsigned int.
9110         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9111         int.
9112         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9113         * layout.cc (Layout::create_symtab_sections): Cast the result of
9114         local_symcount * symsize to off_t in the gold_assert.
9115
9116 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9117
9118         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9119         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9120         R_ARM_BASE_ABS.
9121         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9122         (Arm_relocate_functions::thm_abs5): New function.
9123         (Arm_relocate_functions::abs12): New function.
9124         (Arm_relocate_functions::abs16): New function.
9125         (Arm_relocate_functions::base_abs): New function.
9126         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9127         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9128         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9129         R_ARM_BASE_ABS.
9130         (Scan::global): Likewise.
9131         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9132         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9133         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9134         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9135         R_ARM_BASE_ABS.
9136
9137 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9138
9139         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9140         (Arm_relocate_functions::movt_prel): New function.
9141         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9142         (Arm_relocate_functions::thm_movt_prel): New function.
9143         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9144         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9145         (Scan::global, Relocate::relocate): Likewise.
9146         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9147
9148 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9149
9150         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9151         Incremental_checker.
9152         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9153         unsigned int.
9154         (class Incremental_inputs_header): New class.
9155         (Incremental_inputs_header_writer): Edit comment.
9156         (Incremental_inputs_entry): New class.
9157         (Incremental_inputs_entry_writer): Edit comment.
9158         (Sized_incremental_binary::do_find_incremental_inputs_section):
9159         Add *strtab_shndx parameter, fill it.
9160         (Sized_incremental_binary::do_check_inputs): New method.
9161         (Incremental_checker::can_incrementally_link_output_file): Use
9162         Sized_incremental_binary::check_inputs.
9163         (Incremental_inputs::report_command_line): Save command line in
9164         command_line_.
9165         * incremental.h:
9166         (Incremental_binary::find_incremental_inputs_section): New
9167         method.
9168         (Incremental_binary::do_find_incremental_inputs_section): Add
9169         strtab_shndx parameter.
9170         (Incremental_binary::do_check_inputs): New pure virtual method.
9171         (Sized_incremental_binary::do_check_inputs): Declare.
9172         (Incremental_checker::Incremental_checker): Add incremental_inputs
9173         parameter, use it to initialize incremental_inputs_.
9174         (Incremental_checker::incremental_inputs_): New field.
9175         (Incremental_checker::command_line): New method.
9176         (Incremental_checker::inputs): New method.
9177         (Incremental_checker::command_line_): New field.
9178
9179 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9180
9181         * incremental.cc: Include <cstdarg> and "target-select.h".
9182         (vexplain_no_incremental): New function.
9183         (explain_no_incremental): New function.
9184         (Incremental_binary::error): New method.
9185         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9186         method.
9187         (make_sized_incremental_binary): New function.
9188         (open_incremental_binary): New function.
9189         (can_incrementally_link_file): Add checks if output is ELF and has
9190         inputs section.
9191         * incremental.h: Include "elfcpp_file.h" and "output.h".
9192         (Incremental_binary): New class.
9193         (Sized_incremental_binary): New class.
9194         (open_incremental_binary): Declare.
9195         * object.cc (is_elf_object): Use
9196         elfcpp::Elf_recognizer::is_elf_file.
9197         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9198         * output.h (Output_file::filesize): New method.
9199
9200 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9201
9202         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9203         New function.
9204         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9205         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9206         function.
9207         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9208         function.
9209         (Arm_relocate_functions::movw_abs_nc): New function.
9210         (Arm_relocate_functions::movt_abs): New function.
9211         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9212         (Arm_relocate_functions::thm_movt_abs): New function.
9213         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9214         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9215         (Scan::global): Likewise.
9216         (Relocate::relocate): Likewise.
9217         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9218
9219 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9220
9221         * arm.cc (Arm_relocate_functions::got_prel) New function.
9222         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9223         (Relocate::relocate): Likewise.
9224         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9225
9226 2009-10-06  Ian Lance Taylor  <iant@google.com>
9227
9228         * options.h (class General_options): Define
9229         split_stack_adjust_size parameter.
9230         * object.h (class Object): Add uses_split_stack_ and
9231         has_no_split_stack_ fields.  Add uses_split_stack and
9232         has_no_split_stack accessor functions.  Declare
9233         handle_split_stack_section.
9234         (class Reloc_symbol_changes): Define.
9235         (class Sized_relobj): Define Function_offsets.  Declare
9236         split_stack_adjust, split_stack_adjust_reltype, and
9237         find_functions.
9238         * object.cc (Object::handle_split_stack_section): New function.
9239         (Sized_relobj::do_layout): Call handle_split_stack_section.
9240         * dynobj.cc (Sized_dynobj::do_layout): Call
9241         handle_split_stack_section.
9242         * reloc.cc (Sized_relobj::relocate_sections): Call
9243         split_stack_adjust for executable sections in split_stack
9244         objects.  Pass reloc_map to relocate_section.
9245         (Sized_relobj::split_stack_adjust): New function.
9246         (Sized_relobj::split_stack_adjust_reltype): New function.
9247         (Sized_relobj::find_functions): New function.
9248         * target-reloc.h: Include "object.h".
9249         (relocate_section): Add reloc_symbol_changes parameter.  Change
9250         all callers.
9251         * target.h (class Target): Add calls_non_split method.  Declare
9252         do_calls_non_split virtual method.  Declare match_view and
9253         set_view_to_nop.
9254         * target.cc: Include "elfcpp.h".
9255         (Target::do_calls_non_split): New function.
9256         (Target::match_view): New function.
9257         (Target::set_view_to_nop): New function.
9258         * gold.cc (queue_middle_tasks): Give an error if mixing
9259         split-stack and non-split-stack objects with -r.
9260         * i386.cc (Target_i386::relocate_section): Add
9261         reloc_symbol_changes parameter.
9262         (Target_i386::do_calls_non_split): New function.
9263         * x86_64.cc (Target_x86_64::relocate_section): Add
9264         reloc_symbol_changes parameter.
9265         (Target_x86_64::do_calls_non_split): New function.
9266         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9267         parameter.
9268         * powerpc.cc (Target_powerpc::relocate_section): Add
9269         reloc_symbol_changes parameter.
9270         * sparc.cc (Target_sparc::relocate_section): Add
9271         reloc_symbol_changes parameter.
9272         * configure.ac: Call AM_CONDITIONAL for the default target.
9273         * configure: Rebuild.
9274         * testsuite/Makefile.am (TEST_AS): New variable.
9275         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9276         (check_DATA): Add split_i386 and split_x86_64 files.
9277         (SPLIT_DEFSYMS): Define.
9278         (split_i386_[1234n].o): New targets.
9279         (split_i386_[124]): New targets.
9280         (split_i386_[1234r].stdout): New targets.
9281         (split_x86_64_[1234n].o): New targets.
9282         (split_x86_64_[124]): New targets.
9283         (split_x86_64_[1234r].stdout): New targets.
9284         (MOSTLYCLEANFILES): Add new executables.
9285         * testsuite/split_i386.sh: New file.
9286         * testsuite/split_x86_64.sh: New file.
9287         * testsuite/split_i386_1.s: New file.
9288         * testsuite/split_i386_2.s: New file.
9289         * testsuite/split_i386_3.s: New file.
9290         * testsuite/split_i386_4.s: New file.
9291         * testsuite/split_i386_n.s: New file.
9292         * testsuite/split_x86_64_1.s: New file.
9293         * testsuite/split_x86_64_2.s: New file.
9294         * testsuite/split_x86_64_3.s: New file.
9295         * testsuite/split_x86_64_4.s: New file.
9296         * testsuite/split_x86_64_n.s: New file.
9297         * testsuite/testfile.cc (Target_test): Update relocation_section
9298         function.
9299         * testsuite/Makefile.in: Rebuild.
9300
9301 2009-10-06  Ian Lance Taylor  <iant@google.com>
9302
9303         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9304         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9305         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9306         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9307         the address on ldo_addrs_.
9308         (Target_i386::Relocate::fix_up_ldo): New function.
9309
9310 2009-10-06   Rafael Espindola  <espindola@google.com>
9311
9312         * plugin.cc (add_input_library): New.
9313         (Plugin::load): Add add_input_library to tv.
9314         (Plugin_manager::add_input_file): Add the is_lib argument.
9315         (add_input_file): Update call to Plugin_manager::add_input_file.
9316         (add_input_library): New.
9317         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9318
9319 2009-09-30  Doug Kwan  <dougkwan@google.com>
9320
9321         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9322         symbol and call Symbol::may_need_copy_reloc to determine if
9323         a copy reloc is needed.
9324         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9325         nocopyreloc is given in command line.
9326         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9327         given in command line.
9328         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9329         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9330         of the removed Target_i386::may_need_copy_reloc.
9331         * options.h (copyreloc): New option with default value false.
9332         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9333         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9334         instead of the removed Target_powerpc::may_need_copy_reloc.
9335         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9336         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9337         instead of the removed Target_sparc::may_need_copy_reloc.
9338         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9339         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9340         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9341         instead of the removed Target_x86_64::may_need_copy_reloc.
9342
9343 2009-09-30  Ian Lance Taylor  <iant@google.com>
9344
9345         * object.h (class Object): Remove target_ field, and target,
9346         sized_target, and set_target methods.
9347         (Object::sized_target): Remove.
9348         (class Sized_relobj): Update declarations.  Remove sized_target.
9349         * object.cc (Sized_relobj::setup): Remove target parameter.
9350         Change all callers.
9351         (Input_objects::add_object): Don't do anything with the target.
9352         (make_elf_sized_object): Add punconfigured parameter.  Change all
9353         callers.  Set or test parameter target.
9354         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9355         Change all callers.
9356         * parameters.cc (Parameters::set_target): Change parameter type to
9357         be non-const.
9358         (Parameters::default_target): Remove.
9359         (set_parameters_target): Change parameter type to be non-const.
9360         (parameters_force_valid_target): New function.
9361         (parameters_clear_target): New function.
9362         * parameters.h (class Parameters): Update declarations.  Remove
9363         default_target method.  Add sized_target and clear_target
9364         methods.  Change target_ to be non-const.
9365         (set_parameters_target): Update declaration.
9366         (parameters_force_valid_target): Declare.
9367         (parameters_clear_target): Declare.
9368         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9369         as NULL if we aren't searching.
9370         (Add_symbols::run): Don't check for compatible target.
9371         * fileread.cc (Input_file::open_binary): Call
9372         parameters_force_valid_target.
9373         * gold.cc (queue_middle_tasks): Likewise.
9374         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9375         set_target on object.
9376         * dynobj.h (class Sized_dynobj): Update declarations.
9377         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9378         make_elf_object returns NULL.
9379         (Archive::include_member): Don't check whether object target is
9380         compatible.
9381         * output.cc (Output_section::add_input_section): Get target from
9382         parameters.
9383         (Output_section::relax_input_section): Likewise.
9384         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9385         parameters.
9386         (Sized_relobj::do_scan_relocs): Likewise.
9387         (Sized_relobj::relocate_sections): Likewise.
9388         * resolve.cc (Symbol_table::resolve): Likewise.
9389         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9390         parameter.  Change all callers.
9391         (Symbol_table::add_from_object): Get target from parameters.
9392         (Symbol_table::add_from_relobj): Don't check object target.
9393         (Symbol_table::add_from_dynobj): Likewise.
9394         (Symbol_table::define_special_symbol): Get target from
9395         parameters.
9396         * symtab.h (class Symbol_table): Update declaration.
9397         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9398         parameter.  Change all callers.  Clear parameter target.
9399         (Binary_test): Test target here.
9400         * testsuite/object_unittest.cc (gold_testsuite): Remove
9401         target_test_pointer parameter.  Change all callers.
9402         (Object_test): Test target here.
9403
9404 2009-09-26  Ian Lance Taylor  <iant@google.com>
9405
9406         * testsuite/initpri1.c: Don't try to use constructor priorities if
9407         compiling with gcc before 4.3.
9408
9409 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9410
9411         * testsuite/retain_symbols_file_test.sh (check_present): Change
9412         output file name to retain_symbols_file_test.stdout.
9413         (check_absent): Likewise.
9414
9415 2009-09-18  Craig Silverstein  <csilvers@google.com>
9416
9417         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9418         * options.cc: Include <cerrno> and <fstream>.
9419         (General_options::finalize): Parse -retain-symbols-file tag.
9420         * options.h: New flag.
9421         (General_options): New method should_retain_symbol, new
9422         variable symbols_to_retain.
9423         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9424         should_retain_symbol map.
9425         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9426         * testsuite/Makefile.in: Regenerate.
9427         * testsuite/retain_symbols_file_test.sh: New file.
9428
9429 2009-09-18  Nick Clifton  <nickc@redhat.com>
9430
9431         * po/es.po: Updated Spanish translation.
9432
9433 2009-09-17  Doug Kwan  <dougkwan@google.com>
9434
9435         * debug.h (DEBUG_RELAXATION): New constant.
9436         (DEBUG_ALL): Add DEBUG_RELAXATION.
9437         (debug_string_to_enum): Add relaxation debug option.
9438         * layout.cc
9439         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9440         Layout::Relaxation_debug_check::read_sections,
9441         Layout::Relaxation_debug_check::read_sections): New method definitions.
9442         (Layout::Layout): Initialize data members
9443         record_output_section_data_from_scrips_,
9444         script_output_section_data_list_ and relaxation_debug_check_.
9445         (Layout::save_segments, Layout::restore_segments,
9446         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9447         Layout::relaxation_loop_body): New method definitions.
9448         (Layout::finalize): Support relaxation.  Move section layout code to
9449         Layout::relaxation_loop_body.
9450         (Layout::set_asection_address_from_script): Move code for orphan
9451         section placement out.
9452         (Layout::place_orphan_sections_in_script): New method definition.
9453         * layout.h (Output_segment_headers, Output_file_header):
9454         New forward class declarations.
9455         (Layout::~Layout): Define.
9456         (Layout::new_output_section_data_from_script): New method definition.
9457         (Layout::place_orphan_sections_in_script): New method declaration.
9458         (Layout::Segment_states): New type declaration.
9459         (Layout::save_segments, Layout::restore_segments,
9460         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9461         Layout::relaxation_loop_body): New method declarations.
9462         (Layout::Output_section_data_list): New type declaration.
9463         (Layout::Relaxation_debug_check): New class definition.
9464         (Layout::record_output_section_data_from_script_,
9465         Layout::script_output_section_data_list_, Layout::segment_states_,
9466         Layout::relaxation_debug_check_): New data members.
9467         * output.cc: (Output_section_headers::do_size): New method definition.
9468         (Output_section_headers::Output_section_headers): Move size
9469         computation to Output_section_headers::do_size.
9470         (Output_segment_headers::do_size): New method definition.
9471         (Output_file_header::Output_file_header): Move size computation to
9472         Output_file_header::do_size and call it.
9473         (Output_file_header::do_size): New method definition.
9474         (Output_data_group::Output_data_group): Adjust call to
9475         Output_section_data.
9476         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9477         (Output_symtab_xindex::do_write): Add array bound check.
9478         (Output_section::Input_section::print_to_mapfile): Handle
9479         RELAXED_INPUT_SECTION_CODE.
9480         (Output_section::Output_section): Initialize data member checkpoint_.
9481         (Output_section::~Output_section): Delete checkpoint object pointed
9482         by checkpoint_.
9483         (Output_section::add_input_section): Always add an Input_section if
9484         relaxing.
9485         (Output_section::add_merge_input_section): Add assert.
9486         (Output_section::relax_input_section): New method definition.
9487         (Output_section::set_final_data_size): Set load address to zero for
9488         an unallocated section.
9489         (Output_section::do_address_and_file_offset_have_reset_values):
9490         New method definition.
9491         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9492         Handle relaxed input section.
9493         (Output_section::sort_attached_input_sections): Checkpoint input
9494         section list lazily.
9495         (Output_section::get_input_sections): Change type of input_sections to
9496         list of Simple_input_section pointers.  Checkpoint input section list
9497         lazily.  Also handle relaxed input sections.
9498         (Output_section::add_input_section_for_script): Take a reference to
9499         a Simple_input_section object instead of Relobj pointer and section
9500         index as parameter.  Handle relaxed input sections.
9501         (Output_section::save_states, Output_section::restore_states): New
9502         method definitions.
9503         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9504         (Output_data::is_data_size_fixed): New method definition.
9505         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9506         if it is fixed.
9507         (Output_data::address_and_file_offset_have_reset_values): New method
9508         definition.
9509         (Output_data::do_address_and_file_offset_have_reset_values): New method
9510         definition.
9511         (Output_data::set_data_size): Check that data size is not fixed.
9512         (Output_data::fix_data_size): New method definition.
9513         (Output_data::is_data_size_fixed_): New data member.
9514         (Output_section_headers::set_final_data_size): New method definition.
9515         (Output_section_headers::do_size): New method declaration.
9516         (Output_segment_headers::set_final_data_size): New method definition.
9517         (Output_segment_headers::do_size): New method declaration.
9518         (Output_file_header::set_final_data_size)::New method definition.
9519         (Output_file_header::do_size)::New method declaration.
9520         (Output_section_data::Output_section_data): Add new parameter
9521         is_data_size_fixed and use it to fix data size.
9522         (Output_data_const::Output_data_const): Adjust call to base class
9523         constructor and fix data size.
9524         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9525         base class constructor and fix data size.
9526         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9527         base class constructor and fix data size.
9528         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9529         class constructor and fix data size.
9530         (Output_data_group::set_final_data_size): New method definition.
9531         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9532         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9533         class constructor and fix data size.
9534         (Output_relaxed_input_section): New class definition.
9535         (Output_section::Simple_input_section): New class definition.
9536         (Output_section::get_input_sections): Adjust parameter list.
9537         (Output_section::add_input_section_for_script): Same.
9538         (Output_section::save_states, Output_section::restore_states,
9539         Output_section::do_address_and_file_offset_have_reset_values,
9540         (Output_section::Input_section::Input_section): Handle
9541         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9542         Output_relaxed_input_section.
9543         (Output_section::Input_section::is_input_section,
9544         Output_section::Input_section::set_output_section): Handle relaxed
9545         input section.
9546         (Output_section::Input_section::is_relaxed_input_section,
9547         Output_section::Input_section::output_section_data,
9548         Output_section::Input_section::relaxed_input_section): New method
9549         definitions.
9550         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9551         value.
9552         (Output_section::Input_section::u1_): Update comments.
9553         (Output_section::Input_section::u2_): Add new union member poris.
9554         (Output_section::Checkpoint_output_section): New classs definition.
9555         (Output_section::relax_input_section): New method declaration.
9556         (Output_section::checkpoint_): New data member.
9557         (Output_segment): Update comments.
9558         (Output_segment::Output_segment): Un-privatize copy constructor.
9559         (Output_segment::operator=): Un-privatize.
9560         * script-sections.cc (Output_section_element::Input_section_list):
9561         Change element type to Output_section::Simple_input_section.
9562         (Output_section_element_dot_assignment::set_section_addresses):
9563         Register output section data for relaxation clean up.
9564         (Output_data_exression::Output_data_expression): Adjust call to base
9565         constructor to fix data size.
9566         (Output_section_element_data::set_section_addresses): Register
9567         Output_data_expression object for relaxation clean up.
9568         (struct Input_section_info): Replace Relobj pointer and section index
9569         pair with Output_section::Simple_input_section and Convert struct to a
9570         class.
9571         (Input_section_sorter::operator()): Adjust access to
9572         Input_section_info data member to use accessors.
9573         (Output_section_element_input::set_section_addresses): Use layout
9574         parameter.  Adjust code to use Output_section::Simple_input_section
9575         and Input_secction_info classes.  Register filler for relaxation
9576         clean up.
9577         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9578         and section index pair with Output_section::Simple_input_section
9579         class.  Adjust code accordingly.
9580         (Phdrs_element::release_segment): New method definition.
9581         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9582         segment list.
9583         (Script_sections::release_segments): New method definition.
9584         * gold/script-sections.h (Script_sections::release_segments): New
9585         method declaration.
9586         * gold/target.h (Target::may_relax, Target::relax,
9587         Target::do_may_relax, Target::do_relax): New method definitions.
9588
9589 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9590
9591         * arm.cc (has_signed_unsigned_overflow): New function.
9592         (Arm_relocate_functions::abs8): New function.
9593         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9594         (Target_arm::Scan::global): Likewise.
9595         (Target_arm::relocate::relocate): Likewise.
9596         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9597         Likewise.
9598
9599 2009-09-16  Cary Coutant  <ccoutant@google.com>
9600
9601         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9602         * testsuite/Makefile.in: Regenerate.
9603
9604 2009-09-11  Nick Clifton  <nickc@redhat.com>
9605
9606         * po/gold.pot: Updated by the Translation project.
9607
9608 2009-09-08  Cary Coutant  <ccoutant@google.com>
9609
9610         * output.cc (Output_file::open): Add execute permission to empty file.
9611         * testsuite/Makefile.am (permission_test): New test.
9612         * testsuite/Makefile.in: Regenerate.
9613
9614 2009-09-02  Ian Lance Taylor  <iant@google.com>
9615
9616         * output.cc (Output_file::resize): Call map_no_anonymous rather
9617         than map.
9618
9619 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9620
9621         * gold.cc: Include "incremental.h".
9622         (queue_initial_tasks): Call Incremental_checker methods.
9623         * incremental.cc: Include "output.h".
9624         (Incremental_checker::can_incrementally_link_output_file): New
9625         method.
9626         * incremental.h (Incremental_checker): New class.
9627
9628         * output.cc (Output_file::open_for_modification): New method.
9629         (Output_file::map_anonymous): Changed return type to bool.  Record
9630         map in base_ field.
9631         (Output_file::map_no_anonymous): New method, broken out of map.
9632         (Output_file::map): Use map_no_anonymous and map_anonymous.
9633         * output.h (class Output_file): Update declarations.
9634
9635 2009-08-24  Cary Coutant  <ccoutant@google.com>
9636
9637         * options.h (Command_line::Pre_options): New class.
9638         (Command_line::pre_options): New member.
9639         * options.cc (gold::options::ready_to_register): New variable.
9640         (One_option::register_option): Do nothing if not registering options.
9641         Assert if same short option registered twice.
9642         (General_options::General_options): Turn off option registration when
9643         done constructing.
9644         (Command_line::Pre_options::Pre_options): New constructor.
9645
9646 2009-08-24  Cary Coutant  <ccoutant@google.com>
9647
9648         * options.h (General_options::no_keep_memory): Remove incorrect
9649         short option.
9650
9651 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9652
9653         * Makefile.am (am__skiplex, am__skipyacc): New.
9654         * Makefile.in: Regenerate.
9655
9656 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9657
9658         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9659         (INCLUDES): ... this.
9660         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9661         (AM_CPPFLAGS): Renamed from ...
9662         (INCLUDE): ... this.
9663         * Makefile.in, testsuite/Makefile.in: Regenerate.
9664
9665         * Makefile.in: Regenerate.
9666         * aclocal.m4: Likewise.
9667         * config.in: Likewise.
9668         * configure: Likewise.
9669         * testsuite/Makefile.in: Likewise.
9670
9671         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9672         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9673         * Makefile.in: Regenerate.
9674         * testsuite/Makefile.in: Regenerate.
9675
9676 2009-08-19  Cary Coutant  <ccoutant@google.com>
9677
9678         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9679         symbols in shared libraries overridden by hidden or internal symbols
9680         in the main program.
9681
9682 2009-08-19  Chris Demetriou  <cgd@google.com>
9683
9684         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9685         checking source file names in error messages.
9686
9687 2009-08-18  Doug Kwan  <dougkwan@google.com>
9688
9689         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9690         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9691         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9692         an elfcpp::Ehdr as parameter.
9693         * object.cc (Object::set_target): Remove the version that looks up
9694         a target and sets it.
9695         (Sized_relobj::setup): Take a Target object instead of
9696         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9697         (make_elf_sized_object): Find target and ask target to
9698         make an ELF object.
9699         * object.h: (Object::set_target): Remove the version that looks up
9700         a target and sets it.
9701         (Sized_relobj::setup): Take a Target object instead of
9702         an elfcpp:Ehdr as parameter.
9703         * target.cc: Include dynobj.h.
9704         (Target::do_make_elf_object_implementation): New.
9705         (Target::do_make_elf_object): New.
9706         * target.h (Target::make_elf_object): New template declaration.
9707         (Target::do_make_elf_object): New method declarations.
9708         (Target::do_make_elf_object_implementation): New template declaration.
9709
9710 2009-08-14  Ian Lance Taylor  <iant@google.com>
9711
9712         * gold.h (FUNCTION_NAME): Define.
9713         (gold_unreachable): Use FUNCTION_NAME.
9714
9715 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9716
9717         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9718         symbol in the --keep-unique list is not found.
9719
9720 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9721
9722         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9723         been maked as --keep-unique.
9724         (Icf::unfold_section): New function.
9725         * icf.h (Icf::unfold_section): New function.
9726         * options.h (General_options::keep_unique): New option.
9727         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9728         * testsuite/Makefile.in: Regenerate.
9729         * testsuite/icf_keep_unique_test.sh: New file.
9730         * testsuite/icf_keep_unique_test.cc: New file.
9731
9732 2009-08-12  Cary Coutant  <ccoutant@google.com>
9733
9734         PR 10471
9735         * resolve.cc (Symbol_table::resolve): Check for references from
9736         dynamic objects to hidden and internal symbols.
9737         * testsuite/Makefile.am (hidden_test.sh): New test.
9738         * testsuite/Makefile.in: Regenerate.
9739         * testsuite/hidden_test.sh: New script.
9740         * testsuite/hidden_test_1.c: New test source.
9741         * testsuite/hidden_test_main.c: New test source.
9742
9743 2009-08-11  Doug Kwan  <dougkwan@google.com>
9744
9745         * arm.cc: Update comments.
9746         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9747         segment to locate the .ARM.exidx section if present.
9748
9749 2009-08-09  Doug Kwan  <dougkwan@google.com>
9750
9751         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9752         patch.
9753
9754 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9755         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9756         compiler warnings.
9757
9758 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9759
9760         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9761         valid tls_segment only for non-debug-section relocations.
9762         * testsuite/Makefile.am: Add gc_tls_test.
9763         * testsuite/Makefile.in: Regenerate.
9764         * testsuite/gc_tls_test.cc: New file.
9765         * testsuite/gc_tls_test.sh: New file.
9766
9767 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9768
9769         * icf.cc: New file.
9770         * icf.h: New file.
9771         * Makefile.am (CCFILES): Add icf.cc.
9772         (HFILES): Add icf.h
9773         * Makefile.in: Regenerate.
9774         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9775         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9776         section, symbol and addend information for the relocs.
9777         * gold.cc (queue_middle_tasks): Call identical code folding.
9778         * gold.h: Add defines for multimap.
9779         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9780         to the call of finalize_local_symbols.
9781         * main.cc (main): Create object of class Icf.
9782         * object.cc (Sized_relobj::do_layout): Allow this function to be
9783         called twice during icf.
9784         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9785         to sections marked as identical by icf.
9786         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9787         when available.
9788         (Sized_relobj::do_section_entsize): New function.
9789         * object.h (Object::section_entsize): New function.
9790         (Object::do_section_entsize): New pure virtual function.
9791         (Relobj::finalize_local_symbols): Add new parameter.
9792         (Relobj::do_section_entsize): New function.
9793         * options.h (General_options::icf): New option.
9794         (General_options::icf_iterations): New option.
9795         (General_options::print_icf_sections): New option.
9796         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9797         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9798         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9799         icf.
9800         * symtab.cc (Symbol_table::is_section_folded): New function.
9801         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9802         to sections marked as identical by icf.
9803         * symtab.h (Symbol_table::set_icf): New function.
9804         (Symbol_table::icf): New function.
9805         (Symbol_table::is_section_folded): New function.
9806         (Symbol_table::icf_): New data member.
9807         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9808         * testsuite/Makefile.am: Add commands to build icf_test.
9809         * testsuite/Makefile.in: Regenerate.
9810         * testsuite/icf_test.sh: New file.
9811         * testsuite/icf_test.cc: New file.
9812
9813 2009-07-24  Chris Demetriou  <cgd@google.com>
9814
9815         * layout.cc (is_compressible_debug_section): Fix incorrect
9816         comment about compressed section names.
9817
9818 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9819
9820         PR 10419
9821         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9822
9823 2009-07-16  Ian Lance Taylor  <iant@google.com>
9824
9825         PR 10400
9826         * layout.h: #include <map>.
9827         (class Kept_section): Change from struct to class.  Add accessors
9828         and setters.  Add section size to Comdat_group mapping.  Change
9829         Comdat_group to std::map.  Add is_comdat_ field.  Add
9830         linkonce_size field in union.
9831         (class Layout): Update declaration of find_or_add_kept_section.
9832         Don't declare find_kept_object.
9833         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9834         parameter.  Add object, shndx, is_comdat, and is_group_name
9835         parameters.  Change all callers.  Adjust for new Kept_section.
9836         (Layout::find_kept_object): Remove.
9837         * object.cc (Sized_relobj::include_section_group): Update use of
9838         Kept_section.  Rename secnum to shndx.  Only record
9839         Kept_comdat_section if sections are the same size.
9840         (Sized_relobj::include_linkonce_section): Update use of
9841         Kept_section.  Only record Kept_comdat_section if sections are the
9842         same size.  Set size of linkonce section.
9843         (Sized_relobj::map_to_kept_section): Update call to
9844         get_kept_comdat_section.
9845         * object.h (class Sized_relobj): Rename fields in
9846         Kept_comdat_section to drop trailing underscores; change object
9847         field to Relobj*.  Change Kept_comdat_section_table to store
9848         struct rather than pointer.
9849         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9850         Add kept_object and kept_shndx parameters.  Change all callers.
9851         (Sized_relobj::get_kept_comdat_section): Change return type to
9852         bool.  Add kept_object and kept_shndx parameters.  Change all
9853         callers.
9854         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9855         Layout::find_or_add_kept_section.
9856
9857 2009-07-09  Ian Lance Taylor  <iant@google.com>
9858
9859         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9860         Reserve space in the hash table.
9861
9862 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9863
9864         * fileread.cc (File_read::get_mtime): New method.
9865         * fileread.h (Timespec): New structure.
9866         (File_read::get_mtime): New method.
9867         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9868         Renamed from timestamp_nsec.
9869         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9870         Elf_Xword.
9871         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9872         timestamp_nsec.
9873         (Incremental_inputs::report_archive): Save mtime; style fix.
9874         (Incremental_inputs::report_obejct): Save mtime; style fix.
9875         (Incremental_inputs::report_script): Save mtime; style fix.
9876         (Incremental_inputs::finalize_inputs): Style fix.
9877         (Incremental_inputs::finalize): Style fix.
9878         (Incremental_inputs::create_input_section_data): Store inputs
9879         mtime.
9880         * incremental.h (Incremental_inputs::report_script): Add mtime
9881         argument.
9882         (Incremental_inputs::Input_info::Input_info): Intialize only one
9883         union member.
9884         (Incremental_inputs::Input_info::archive): Move to nameless
9885         union.
9886         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9887         (Incremental_inputs::Input_info::script): Move to nameless union.
9888         (Incremental_inputs::mtime): New field.
9889         * script.cc (read_input_script): Pass file mtime to
9890         Incremental_input.
9891         * script.h (Script_info::inputs): Style fix.
9892
9893 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9894
9895         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9896         instead of 32.
9897
9898 2009-06-24  Ian Lance Taylor  <iant@google.com>
9899
9900         PR 10156
9901         * layout.cc (Layout::choose_output_section): If we find an
9902         existing section, update the flags.
9903         (Layout::create_notes): New function, broken out of
9904         Layout::finalize.
9905         (Layout::finalize): Don't create note sections.
9906         (Layout::create_note): Don't crash if linker script discards
9907         section.
9908         (Layout::create_gold_note): Likewise.
9909         (Layout::create_build_id): Likewise.  Don't set
9910         after_input_sections on the section.
9911         (Layout::create_executable_stack_info): Remove target parameter.
9912         Change caller.
9913         * layout.h (class Layout): Declare create_notes.  Update
9914         declaration of create_executable_stack_info.
9915         * gold.cc (queue_middle_tasks): Call create_notes.
9916         * output.cc (Output_section::update_flags_for_input_section): Move
9917         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9918         invalid.
9919         * output.h (Output_data::mark_address_invalid): New function.
9920         (class Output_section): Only declare, not define,
9921         update_flags_for_input_section.  Remove set_flags.
9922
9923 2009-06-24  Ian Lance Taylor  <iant@google.com>
9924
9925         * script-sections.cc (Output_section_definition::
9926         set_section_addresses): Rename shadowing local load_address to
9927         laddr.
9928
9929 2009-06-24  Ian Lance Taylor  <iant@google.com>
9930
9931         PR 10244
9932         * reloc.cc (relocate_sections): Skip empty relocation sections.
9933
9934 2009-06-23  Ian Lance Taylor  <iant@google.com>
9935
9936         PR 10156
9937         * layout.cc (Layout::create_note): Use choose_output_section
9938         rather than make_output_section.
9939
9940 2009-06-23  Ian Lance Taylor  <iant@google.com>
9941
9942         PR 10237
9943         * options.cc (General_options::parse_V): Set printed_version_.
9944         (General_options::General_options): Initialize printed_version_.
9945         * options.h (class General_options): Add printed_version_ field.
9946         * gold.cc (queue_initial_tasks): If there are no input files,
9947         don't give a fatal error if we printed the version information.
9948         (queue_middle_tasks): If using -r with a shared object, give a
9949         fatal error rather than an ordinary error.
9950
9951 2009-06-23  Ian Lance Taylor  <iant@google.com>
9952
9953         PR 10219
9954         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9955         (Layout::make_output_section): Set have_stabstr_section_ if we see
9956         a .stab*str section.
9957         (Layout::finalize): Call link_stabs_sections.
9958         (Layout::link_stabs_sections): New file.
9959         * layout.h (class Layout): Add have_stabstr_section_ field.
9960         Declare link_stabs_sections.
9961
9962 2009-06-23  Doug Kwan  <dougkwan@google.com>
9963
9964         * Makefile.am (libgold_a_LIBADD): New.
9965         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9966         * Makefile.in: Regenerate.
9967         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9968         * configure: Regenerate.
9969         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9970         * fileread.cc: Include sys/state.h
9971         * gold.h: Declare memmem and strndup if found missing.
9972         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9973
9974 2009-06-23  Ian Lance Taylor  <iant@google.com>
9975
9976         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9977         * configure: Rebuild.
9978
9979 2009-06-23  Ian Lance Taylor  <iant@google.com>
9980
9981         PR 10147
9982         * object.cc (Object::section_contents): Don't try to get a view if
9983         the section has length zero.
9984         (Object::handle_gnu_warning_section): If the section is empty, use
9985         the name of the section as the warning.
9986
9987 2009-06-23  Ian Lance Taylor  <iant@google.com>
9988
9989         PR 10133
9990         * stringpool.h (class Stringpool_template): Add optimize_ field.
9991         (Stringpool_template::set_optimize): New function.
9992         * stringpool.cc (Stringpool_template::Stringpool_template):
9993         Initialize optimize_ field.
9994         (Stringpool_template::set_string_offsets): Test local optimize
9995         fild rather than parameter.
9996         * layout.cc (Layout::Layout): Call set_optimize on the section
9997         name stringpool.
9998
9999 2009-06-22  Ian Lance Taylor  <iant@google.com>
10000
10001         PR 10030
10002         * yyscript.y: Parse TARGET.
10003         * script.cc (script_set_target): New function.
10004         * script-c.h (script_set_target): Declare.
10005         * options.cc (General_options::string_to_object_format): Rename
10006         from string_to_object_format in anonymous namespace.  Change
10007         callers.
10008         * options.h (class General_options): Declare
10009         string_to_object_format.
10010
10011 2009-06-22  Ian Lance Taylor  <iant@google.com>
10012
10013         * script-sections.cc (Script_sections::create_segments): Don't put
10014         program headers in a PT_LOAD segment if -n or -N.
10015
10016 2009-06-22  Ian Lance Taylor  <iant@google.com>
10017
10018         PR 10141
10019         * options.h (class General_options): Add -z lazy and -z now.  Sort
10020         -z options into alphabetical order.
10021         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10022
10023 2009-06-21  Ian Lance Taylor  <iant@google.com>
10024
10025         * layout.cc (Layout::make_output_section): Call
10026         Target::new_output_section.
10027         (Layout::attach_allocated_section_to_segment): Put large section
10028         sections in a separate load segment with the large segment flag
10029         set.
10030         (Layout::segment_precedes): Sort large data segments after other
10031         load segments.
10032         (align_file_offset): New static function.
10033         (Layout::set_segment_offsets): Use align_file_offset.
10034         * output.h (class Output_section): Add is_small_section_ and
10035         is_large_section_ fields.
10036         (Output_section::is_small_section): New function.
10037         (Output_section::set_is_small_section):  New function.
10038         (Output_section::is_large_section): New function.
10039         (Output_section::set_is_large_section): New function.
10040         (Output_section::is_large_data_section): New function.
10041         (class Output_segment): Add is_large_data_segment_ field.
10042         (Output_segment::is_large_data_segment): New function.
10043         (Output_segment::set_is_large_data_segment): New function.
10044         * output.cc (Output_section::Output_section): Initialize new
10045         fields.
10046         (Output_segment::Output_segment): Likewise.
10047         (Output_segment::add_output_section): Add assertion that large
10048         data sections always go in large data segments.  Force small data
10049         sections to the end of the list of data sections.  Force small BSS
10050         sections to the start of the list of BSS sections.  For large BSS
10051         sections to the end of the list of BSS sections.
10052         * symtab.h (class Symbol): Declare is_common_shndx.
10053         (Symbol::is_defined): Check Symbol::is_common_shndx.
10054         (Symbol::is_common): Likewise.
10055         (class Symbol_table): Define enum Commons_section_type.  Update
10056         declarations.  Add small_commons_ and large_commons_ fields.
10057         * symtab.cc (Symbol::is_common_shndx): New function.
10058         (Symbol_table::Symbol_table): Initialize new fields.
10059         (Symbol_table::add_from_object): Put small and large common
10060         symbols in the right list.
10061         (Symbol_table::sized_finalized_symbol): Check
10062         Symbol::is_common_shndx.
10063         (Symbol_table::sized_write_globals): Likewise.
10064         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10065         common symbol lists.  Don't call do_allocate_commons_list if the
10066         list is empty.
10067         (Symbol_table::do_allocate_commons_list): Remove is_tls
10068         parameter.  Add comons_section_type parameter.  Change all
10069         callers.  Handle small and large common symbols.
10070         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10071         Symbol::is_common_shndx.
10072         * resolve.cc (symbol_to_bits): Likewise.
10073         * target.h (Target::small_common_shndx): New function.
10074         (Target::small_common_section_flags): New function.
10075         (Target::large_common_shndx): New function.
10076         (Target::large_common_section_flags): New function.
10077         (Target::new_output_section): New function.
10078         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10079         small_common_section_flags, and large_common_section_flags
10080         fields.
10081         (Target::do_new_output_section): New virtual function.
10082         * arm.cc (Target_arm::arm_info): Initialize new fields.
10083         * i386.cc (Target_i386::i386_info): Likewise.
10084         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10085         Likewise.
10086         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10087         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10088         (Target_x86_64::do_new_output_section): New function.
10089         * configure.ac: Define conditional MCMODEL_MEDIUM.
10090         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10091         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10092         (large_LDFLAGS): Define.
10093         * testsuite/large.c: New file.
10094         * testsuite/testfile.cc (Target_test::test_target_info):
10095         Initialize new fields.
10096         * configure, testsuite/Makefile.in: Rebuild.
10097
10098 2009-06-05  Doug Kwan  <dougkwan@google.com>
10099
10100         * Makefile.am (CCFILES): Add target.cc.
10101         * Makefile.in: Regenerate.
10102         * i386.cc (class Target_i386): Define new virtual method to
10103         override do_is_local_label_name in parent.
10104         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10105         local symbols if --discard-locals or -X is given.
10106         * options.h (class General_options): Declare new options
10107         '--discard-locals' and '-X' for discarding locals.
10108         * target.h (class Target): Define new methods is_local_label_name.
10109         Declare new virtual method do_is_local_label_name.
10110         * target.cc: New file.
10111         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10112         (check_SCRIPTS): Add discard_locals_test.sh.
10113         (check_DATA): Add discard_local_tests.syms.
10114         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10115         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10116         * testsuite/Makefile.in: Regenerate.
10117         * testsuite/discard_locals_test.c: New file.
10118         * testsuite/discard_locals_test.sh: Same.
10119
10120 2009-06-05  Doug Kwan  <dougkwan@google.com>
10121
10122         * object.cc (Sized_relobj::Sized_relobj): Initialize
10123         discarded_eh_frame_shndx_ to -1U.
10124         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10125         section.
10126         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10127         a discarded .eh_frame section.
10128         (Sized_relobj::do_finalize_local_symbols): Ditto.
10129         * object.h (class Sized_relobj): Declare new member
10130         discarded_eh_frame_shndx_.
10131         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10132         (local_labels_test.o, local_labels_test): New rules.
10133         * testsuite/Makefile.in: Regenerate.
10134
10135 2009-06-04  Doug Kwan  <dougkwan@google.com>
10136
10137         * layout.cc (Layout::section_name_mapping): Add mapping for
10138         special ARM sections.
10139
10140 2009-06-03  Doug Kwan  <dougkwan@google.com>
10141
10142         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10143         (utils::has_overflow): Same.
10144
10145 2009-06-03  Ian Lance Taylor  <iant@google.com>
10146
10147         * layout.cc (Layout::section_name_mapping): New array, replacing
10148         Layout::linkonce_mapping.
10149         (Layout::section_name_mapping_count): New variable, replacing
10150         Layout::linkonce_mapping_count.
10151         (Layout::linkonce_output_name): Remove.
10152         (Layout::output_section_name): Rewrite.
10153         * layout.h (class Layout): Rename Linkonce_mapping to
10154         Section_name_mapping, linkonce_mapping to section_name_mapping,
10155         linkonce_mapping_count to section_name_mapping_count.  Don't
10156         declare linkonce_output_name.
10157
10158 2009-06-03  Doug Kwan  <dougkwan@google.com>
10159
10160         * gold/arm.cc (namespace utils): New.
10161         (Target_arm::reloc_is_non_pic): Define new method.
10162         (class Arm_relocate_functions): New.
10163         (Target_arm::Relocate::relocate): Handle relocation types used by
10164         Android.
10165
10166 2009-06-03  Ian Lance Taylor  <iant@google.com>
10167
10168         * arm.cc (Target_arm::scan::global): Use || instead of |.
10169
10170 2009-06-02  Doug Kwan  <dougkwan@google.com>
10171
10172         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10173         issued_non_pic_error_.
10174         (class Target_arm::Scan): Declare new method check_non_pic.
10175         Define new method symbol_needs_plt_entry.
10176         Declare new data member issued_non_pic_error_.
10177         (class Target_arm::Relocate): Declare new method
10178         should_apply_static_reloc.
10179         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10180         (Target_arm::Scan::check_non_pic): Define new method.
10181         (Target_arm::Scan::local): Handle a small subset of reloc types used
10182         by Android.
10183         (Target_arm::Scan::local): Same.
10184         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10185
10186 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10187
10188         * incremental.cc (Incremental_inputs::report_command_line): Filter
10189         out --incremental-* options.
10190
10191 2009-05-29  Doug Kwan  <dougkwan@google.com>
10192
10193         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10194         template class.
10195         (class Target_arm): Update comment.
10196         (Target_arm::Target_arm): Initialize new data members GOT_,
10197         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10198         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10199         and Target_arm::rel_dyn_section.
10200         Declare new_enum Target_arm::Got_type.
10201         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10202         and DYNBSS_.
10203         Update commments for member do_dynsym_value.
10204         (Target_arm::got_size, Target_arm::plt_section,
10205         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10206         new methods inside class defintion.
10207         (Target_arm::got_section): Define new method.
10208         (Target_arm::rel_dyn_section): Same.
10209         (Output_data_plt_arm): New template class.
10210         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10211         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10212         (Output_data_plt_arm::add_entry): Same.
10213         (Output_data_plt_arm::first_plt_entry): Define new
10214         static data member for PLT instruction template.
10215         (Output_data_plt_arm::plt_entry): Same.
10216         (Output_data_plt_arm::do_write): Define new method.
10217         (Target_arm::make_plt_entry): Same.
10218         (Target_arm::do_finalize_sections): Same.
10219         (Target_arm::do_dynsym_value): Same.
10220
10221 2009-05-28  Doug Kwan  <dougkwan@google.com>
10222
10223         * Makefile.am (TARGETSOURCES): Add arm.cc.
10224         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10225         * Makefile.in: Regenerate.
10226         * arm.cc: New file.
10227         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10228
10229 2009-05-26  Doug Kwan  <dougkwan@google.com>
10230
10231         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10232         (General_options::check_excluded_libs): Strip off directories in
10233         archive name before matching like GNU ld does.
10234         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10235         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10236         (exclude_libs_test_LDFLAGS): Add linker option
10237         -Wl,--exclude-libs,libexclude_libs_test_3
10238         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10239         an explicit archive without using -l.
10240         (alt/libexclude_libs_test_3.a): New make rule.
10241         * testsuite/Makefile.in: Regenerate.
10242         * testsuite/exclude_libs_test.c : Declare lib3_default().
10243         (main): Call it.
10244         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10245         * exclude_libs_test_3.c: New file.
10246
10247 2009-05-26  Nick Clifton  <nickc@redhat.com>
10248
10249         * po/id.po: New Indonesian translation.
10250         * po/gold.pot: Updated template file.
10251
10252 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10253
10254         * testsuite/Makefile.am: Add -ffunction-sections to compile
10255         gc_comdat_test files.  Add -Wl,--gc-sections to build
10256         gc_comdat_test.
10257         * testsuite/Makefile.in: Regenerate.
10258         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10259
10260 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10261
10262         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10263         kept comdat section was garbage collected.
10264         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10265         * testsuite/Makefile.in: Regenerate.
10266         * testsuite/gc_comdat_test.sh: New file.
10267         * testsuite/gc_comdat_test_1.cc: New file.
10268         * testsuite/gc_comdat_test_2.cc: New file.
10269
10270 2009-05-19  Doug Kwan  <dougkwan@google.com>
10271
10272         * archive.cc (Archive::Archive): Move constructor from archive.h
10273         to here.  Initialize no_export_.
10274         (Archive::get_elf_object_for_member): Set no_export flag of object.
10275         * archive.h (Archive::Archive): Move constructor body to
10276         archive.cc.
10277         (Archive::no_export): New method.
10278         (Archive::no_export_): New field.
10279         * object.h (Object::Object): Initialize no_export_ to false.
10280         (Object::no_export, Object::set_no_export): New methods.
10281         (Object::no_export_): New field.
10282         * options.cc (General_options::parse_exclude_libs): New method.
10283         (General_options::check_excluded_libs) Same.
10284         * options.h (exclude_libs): New option.
10285         (General_options::check_excluded_libs): New method declaration.
10286         (General_options::excluded_libs_): New field.
10287         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10288         default or protected visibility if an object has no-export flag set.
10289         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10290         (check_SCRIPTS): Add exclude_libs_test.sh.
10291         (check_DATA): Add exclude_libs_test.syms.
10292         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10293         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10294         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10295         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10296         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10297         libexclude_libs_test_2.a): New rules.
10298         * testsuite/Makefile.in: Regenerate.
10299         * testsuite/exclude_libs_test.c: New file.
10300         * testsuite/exclude_libs_test.sh: Ditto.
10301         * testsuite/exclude_libs_test_1.c: Ditto.
10302         * testsuite/exclude_libs_test_2.c: Ditto.
10303
10304 2009-05-15  Ian Lance Taylor  <iant@google.com>
10305
10306         * configure.ac: Check for declarations for cases where libiberty.h
10307         checks HAVE_DECL_xxx.
10308         * configure, config.in: Rebuild.
10309
10310 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10311
10312         * gold.h (Incremental_argument_list): Remove (invalid) forward
10313         declaration.
10314         * incremental.cc (Incremental_inputs::report_achive): New method.
10315         (Incremental_inputs::report_object): New method.
10316         (Incremental_inputs::report_script): New method.
10317         (Incremental_inputs::finalize_inputs): New method.
10318         (Incremental_inputs::finalize): Call finalize_inputs().
10319         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10320         Create inputs entries.
10321         * incremental.h (Incremental_input_type): New enum.
10322         (Incremental_inputs::Incremental_input): Initialize new fields.
10323         (Incremental_inputs::report_inputs): New method.
10324         (Incremental_inputs::report_achive): New method.
10325         (Incremental_inputs::report_object): New method.
10326         (Incremental_inputs::report_script): New method.
10327         (Incremental_inputs::finalize_inputs): New method.
10328         (Incremental_inputs::Input_info): New struct.
10329         (Incremental_inputs::Input_info_map): New typedef.
10330         (Incremental_inputs::lock_): New field.
10331         (Incremental_inputs::Inputs_): New field.
10332         (Incremental_inputs::Inputs_map): New field.
10333         * main.cc (main): Call Incremental_input::report_inputs.
10334         * options.h (Input_argument_list): Typedef moved from
10335         Input_arguments.
10336         (Input_file_group::Files): Remove, use ::Input_argument_list.
10337         (Input_file_group::Input_argument_list): Remove, use
10338         ::Input_argument_list.
10339         * plugin.cc (Plugin_manager::add_input_file): Add error in
10340         incremental build.
10341         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10342         functions.
10343         * script.cc (read_input_script): Call
10344         Incremental_input::report_script.
10345         * script.h (Script_info): New class.
10346
10347 2009-04-27  Ian Lance Taylor  <iant@google.com>
10348
10349         * x86_64.cc (do_adjust_output_section): Set entsize to
10350         plt_entry_size.
10351
10352 2009-04-23  Elliott Hughes  <enh@google.com>
10353
10354         * output.cc (Output_file::close): After short writes, continue
10355         writing from the correct offset in the buffer being written.
10356
10357 2009-04-23  Chris Demetriou  <cgd@google.com>
10358
10359         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10360         * configure: Regenerate.
10361         * config.in: Regenerate.
10362         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10363         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10364
10365 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10366
10367         * incremental.cc (Incremental_inputs_header_data): Renamed from
10368         Incremental_input_header_data.
10369         (Incremental_inputs_header_data::data_size): New field.
10370         (Incremental_inputs_header_data::put_input_file_count): Renamed
10371         from input_file_count.
10372         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10373         from command_line_offset.
10374         (Incremental_inputs_header_data::put_reserved): Renamed from
10375         put_reserved.
10376         (Incremental_inputs_entry_data): Renamed from
10377         Incremental_input_entry_data.
10378         (Incremental_inputs_entry_data::data_size): New field.
10379         (Incremental_inputs::report_command_line): New method.
10380         (Incremental_inputs::finalize): New method.
10381         (Incremental_inputs::create_incremental_inputs_data): New method.
10382         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10383         * incremental.h: New file.
10384         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10385         (Layout::finalize): Create incremental inputs section in
10386         incremental builds.
10387         (Layout::create_incremental_info_sections): New method.
10388         * layout.h (Layout::incremental_inputs): New method.
10389         (Layout::create_incremental_info_sections): New method.
10390         (Layout::incremental_inputs_): New field.
10391         * main.cc (main): Notify Incremental_input of the command line.
10392
10393 2009-04-01  Ian Lance Taylor  <iant@google.com>
10394             Mikolaj Zalewski  <mikolajz@google.com>
10395
10396         * gold.h (reserve_unordered_map): Define, three versions, one for
10397         each version of Unordered_map.
10398         * layout.cc (Layout::Layout): Remove options parameter.  Add
10399         number_of_input_files parameter.  Don't initialize options_.
10400         Initialize number_of_input_files_ and resized_signatures_.  Move
10401         sections_are_attached_.
10402         (Layout::layout_group): Reserve space for group_signatures_.
10403         (Layout::find_or_add_kept_section): Change name parameter to be a
10404         reference.  Resize signatures_ map when it gets large enough.
10405         (Layout::layout_eh_frame): Use parameters->options() instead of
10406         this->options_.
10407         (Layout::make_output_section): Likewise.
10408         (Layout::attach_allocated_section_to_segment): Likewise.
10409         (Layout::finalize, Layout::create_executable_stack): Likewise.
10410         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10411         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10412         * layout.h (class Layout): Update declarations.  Remove options_
10413         field.  Add number_of_input_files_ and resized_signatures_
10414         fields.  Move sections_are_attached_ field.
10415         * main.cc (main): Pass number of input files to Layout
10416         constructor.  Don't pass options.
10417
10418 2009-03-30  Ian Lance Taylor  <iant@google.com>
10419
10420         * ffsll.c (ffsll): Correct implementation.
10421
10422 2009-03-27  Ian Lance Taylor  <iant@google.com>
10423
10424         * ffsll.c: New file.
10425         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10426         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10427         * ftruncate.c (ftruncate): Declare before definition.
10428         * mremap.c (mremap): Likewise.
10429         * pread.c (pread): Likewise.
10430         * configure, Makefile.in, config.in: Rebuild.
10431
10432         * mremap.c: New file.
10433         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10434         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10435         (mremap): Declare if HAVE_MREMAP is not defined.
10436         * configure, Makefile.in, config.in: Rebuild.
10437
10438 2009-03-27  Cary Coutant  <ccoutant@google.com>
10439
10440         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10441         position independent.
10442         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10443         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10444
10445 2009-03-24  Cary Coutant  <ccoutant@google.com>
10446
10447         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10448         an executable.
10449         (needs_dynamic_reloc): Likewise.
10450
10451 2009-03-24  Ian Lance Taylor  <iant@google.com>
10452
10453         * yyscript.y (file_cmd): Recognize EXTERN.
10454         (extern_name_list, extern_name_list_body): New nonterminals.
10455         * script.cc (script_add_extern): Define.
10456         * script-c.h (script_add_extern): Declare.
10457
10458 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10459
10460         * object.cc (is_elf_object): Define.
10461         * object.h (is_elf_object): Declare.
10462         * archive.cc (Archive::get_elf_object_for_member): Call
10463         is_elf_object.
10464         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10465
10466 2009-03-24  Elliott Hughes  <enh@google.com>
10467
10468         * output.cc (Output_file::map_anonymous): Define.
10469         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10470         try an anonymous one.  Report the size if the mmap fails.
10471         * output.h (class Output_file): Declare map_anonymous.
10472
10473 2009-03-24  Ian Lance Taylor  <iant@google.com>
10474
10475         * target-select.cc (instantiate_target): Don't acquire the lock if
10476         the instantiated_target_ field has already been set.
10477
10478 2009-03-23  Ian Lance Taylor  <iant@google.com>
10479
10480         * gold-threads.h (class Initialize_lock): Define.
10481         * gold-threads.cc (class Initialize_lock_once): Define.
10482         (initialize_lock_control): New static variable.
10483         (initialize_lock_pointer): New static variable.
10484         (initialize_lock_once): New static function.
10485         (Initialize_lock::Initialize_lock): Define.
10486         (Initialize_lock::initialize): Define.
10487         * target-select.h: Include "gold-threads.h".
10488         (class Target_selector): Add lock_ and initialize_lock_ fields.
10489         Don't define instantiate_target, just declare it.
10490         * target-select.cc (Target_selector::Target_selector): Initialize
10491         new fields.
10492         (Target_selector::instantiate_target): Define.
10493         * descriptors.h: Include "gold-threads.h".
10494         (class Descriptors): Add initialize_lock_ field.
10495         * descriptors.cc (Descriptors::Descriptors): Initialize new
10496         field.
10497         (Descriptors::open): Use initialize_lock_ field
10498         * errors.h (class Errors): Add initialize_lock_ field.
10499         * errors.cc (Errors::Errors): Initialize new field.
10500         (Errors::initialize_lock): Use initialize_lock_ field.
10501         * powerpc.cc (class Target_selector_powerpc): Remove
10502         instantiated_target_ field.  In do_recognize call
10503         instantiate_target rather than do_instantiate_target.  In
10504         do_instantiate_target just allocate a new target.
10505         * sparc.cc (class Target_selector_sparc): Likewise.
10506
10507         * freebsd.h: New file.
10508         * i386.cc: Include "freebsd.h".
10509         (Target_i386): Derive from Target_freebsd rather than
10510         Sized_target.
10511         (Target_selector_i386): Derive from Target_selector_freebsd rather
10512         than Target_selector.
10513         * x86_64.cc: Include "freebsd.h".
10514         (Target_x86_64): Derive from Target_freebsd rather than
10515         Sized_target.
10516         (Target_selector_x86_64): Derive from Target_selector_freebsd
10517         rather than Target_selector.
10518         * target.h (class Target): Add adjust_elf_header and
10519         do_adjust_elf_header.
10520         * output.cc (Output_file_header:: do_sized_write): Call target
10521         adjust_elf_header routine.
10522         * configure.tgt: Set targ_osabi.
10523         * configure.ac: Define GOLD_DEFAULT_OSABI.
10524         * parameters.cc (Parameters::default_target): Pass
10525         GOLD_DEFAULT_OSABI to select_target.
10526         * target-select.h (class Target_selector): Make instantiate_target
10527         protected rather than private.
10528         * Makefile.am (HFILES): Add freebsd.h.
10529         * configure, Makefile.in, config.in: Rebuild.
10530
10531         * merge.cc (do_add_input_section): Correct pend value.  Change
10532         message about last entry not being null terminated from error to
10533         warning.
10534
10535 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10536
10537         * incremental.cc: New file.
10538         * Makefile.am (CCFILES): Add incremental.cc.
10539         * Makefile.in: Rebuild.
10540
10541 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10542
10543         * layout.cc (Layout::output_section_name): Preserve names
10544         of '.note.' sections.
10545
10546 2009-03-19  Ian Lance Taylor  <iant@google.com>
10547
10548         * descriptors.cc (Descriptors::open): Check that the options are
10549         valid before using them.
10550
10551 2009-03-18  Ian Lance Taylor  <iant@google.com>
10552
10553         * script-sections.h: Include <list>.
10554         (class Script_sections): Change Sections_elements from std::vector
10555         to std::list.  Typedef public Elements_iterator.  Add
10556         orphan_section_placement_, data_segment_align_start_, and
10557         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10558         field.
10559         * script-sections.cc (class Orphan_section_placement): New class.
10560         (class Sections_element): Add virtual functions is_relro and
10561         orphan_section_init.  Remove virtual function place_orphan_here.
10562         (class Output_section_definition): Add is_relro and
10563         orphan_section_init.  Remove place_orphan_here.
10564         (class Orphan_output_section): Likewise.
10565         (Script_sections::Script_sections): Update for field changes.
10566         (Script_sections::data_segment_align): Set saw_data_segment_align_
10567         and data_segment_align_start_, not data_segment_align_index.
10568         (Script_sections::data_segment_relro_end): Check
10569         saw_data_segment_align_.  Use data_segment_align_start_ rather
10570         than data_segment_align_index_.
10571         (Script_sections::place_orphan): Rewrite to use
10572         Orphan_section_placement.
10573
10574 2009-03-17  Ian Lance Taylor  <iant@google.com>
10575
10576         * archive.cc (Archive::add_symbols): Check for a version attached
10577         to the symbol name in the archive map.
10578         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10579         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10580         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10581         (ver_test_11.a): New target.
10582         * testsuite/Makefile.in: Rebuild.
10583
10584         * configure.ac: Check for chsize and posix_fallocate.  Replace
10585         ftruncate.
10586         * ftruncate.c: New file, from gnulib.
10587         * output.cc (posix_fallocate): Define dummy version if not
10588         HAVE_POSIX_FALLOCATE.
10589         (Output_file::map): Call posix_fallocate rather than lseek and
10590         write.
10591         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10592         * configure, Makefile.in, config.in: Rebuild.
10593
10594 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10595
10596         * layout.h (Layout::create_note): Add section_name parameter.
10597         * layout.cc (Layout::create_note): Likewise.
10598         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10599
10600 2009-03-17  Ian Lance Taylor  <iant@google.com>
10601
10602         * descriptors.cc: Include "options.h".
10603         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10604         (Descriptors::open): Always use O_CLOEXEC when opening a new
10605         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10606         then set FD_CLOEXEC.
10607
10608         * sparc.cc (class Target_sparc): Add has_got_section.
10609         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10610         make sure we have a GOT section.
10611
10612         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10613         (Target_sparc::Scan::local): Likewise.
10614         (Target_sparc::Scan::global): Likewise.
10615         (Target_sparc::Relocate::relocate): Likewise.
10616         (Target_sparc::Relocate::relocate_tls): Likewise.
10617
10618         * symtab.cc (Symbol_table::define_default_version): New function,
10619         broken out of add_from_object.
10620         (Symbol_table::add_from_object): Call define_default_version.
10621         (Symbol_table::define_special_symbol): Add resolve_oldsym
10622         parameter.  Change all callers.  If the version for a symbol comes
10623         from a version script, resolve it with the symbol with the same
10624         name with no version.  Also add the symbol without a version if
10625         appropriate.
10626         (do_define_in_output_data): If resolving with oldsym, don't delete
10627         sym.
10628         (do_define_in_output_segment): Likewise.
10629         (do_define_as_constant): Likewise.
10630         * symtab.h (class Symbol_table): Update declarations.
10631
10632 2009-03-13  Ian Lance Taylor  <iant@google.com>
10633
10634         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10635         (Read_symbols::requeue): New function.
10636         (Read_symbols::do_read_symbols): If make_elf_object fails because
10637         the target type is not configured, and the file was searched for,
10638         issue a warning and retry with the next directory.
10639         (Add_symbols::run): If the file has an incompatible format, and
10640         it was searched for, requeue the Read_symbols task.  On error,
10641         release the object.
10642         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10643         dirindex parameter to constructor.  Change all callers.  Declare
10644         incompatible_warning and requeue.
10645         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10646         input_argument_ and input_group_ fields.  Add them to
10647         constructor.  Change all callers.
10648         (class Read_script): Add dirindex_ field.  Add it to constructor.
10649         Change all callers.
10650         * archive.cc (Archive::setup): Remove input_objects parameter.
10651         Change all callers.
10652         (Archive::get_file_and_offset): Likewise.
10653         (Archive::read_all_symbols): Likewise.
10654         (Archive::read_symbols): Likewise.
10655         (Archive::get_elf_object_for_member): Remove input_objects
10656         parameter.  Add punconfigured parameter.  Change all callers.
10657         (Archive::add_symbols): Change return type to bool.  Check return
10658         value of include_member.
10659         (Archive::include_all_members): Likewise.
10660         (Archive::include_member): Change return type to bool.  Return
10661         false if first included object has incompatible target.  Set
10662         included_member_ field.
10663         (Add_archive_symbols::run): If add_symbols returns false, requeue
10664         Read_symbols task.
10665         * archive.h (class Archive): Add included_member_ field.
10666         Initialize it in constructor.  Add input_file and searched_for
10667         methods.  Update declarations.
10668         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10669         input_argument_ fields.  Add them to constructor.  Change all
10670         callers.
10671         * script.cc: Include "target-select.h".
10672         (class Parser_closure): Add skip_on_incompatible_target_ and
10673         found_incompatible_target_ fields.  Add
10674         skip_on_incompatible_target parameter to constructor.  Change all
10675         callers.  Add methods skip_on_incompatible_target,
10676         clear_skip_on_incompatible_target, found_incompatible_target, and
10677         set_found_incompatible_target.
10678         (read_input_script): Add dirindex parameter.  Change all callers.
10679         If parser finds an incompatible target, requeue Read_symbols
10680         task.
10681         (script_set_symbol): Clear skip_on_incompatible_target in
10682         closure.
10683         (script_add_assertion, script_parse_option): Likewise.
10684         (script_start_sections, script_add_phdr): Likewise.
10685         (script_check_output_format): New function.
10686         * script.h (read_input_script): Update declaration.
10687         * script-c.h (script_check_output_format): Declare.
10688         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10689         (ignore_cmd): Remove OUTPUT_FORMAT.
10690         * fileread.cc (Input_file::Input_file): Add explicit this.
10691         (Input_file::will_search_for): New function.
10692         (Input_file::open): Add pindex parameter.  Change all callers.
10693         * fileread.h (class Input_file): Add input_file_argument method.
10694         Declare will_search_for.  Update declarations.
10695         * object.cc (make_elf_object): Add punconfigured parameter.
10696         Change all callers.
10697         * object.h (class Object): Make input_file public.  Add
10698         searched_for method.
10699         (make_elf_object): Update declaration.
10700         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10701         restart search.
10702         * dirsearch.h (class Dirsearch): Update declaration.
10703         * options.h (class General_options): Add --warn-search-mismatch.
10704         * parameters.cc (Parameters::is_compatible_target): New function.
10705         * parameters.h (class Parameters): Declare is_compatible_target.
10706         * workqueue.cc (Workqueue::add_blocker): New function.
10707         * workqueue.h (class Workqueue): Declare add_blocker.
10708
10709         * fileread.cc (Input_file::open): Remove options parameter.
10710         Change all callers.
10711         (Input_file::open_binary): Likewise.
10712         * script.cc (read_input_script): Likewise.
10713         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10714         options parameter from constructor.  Change all callers.
10715         (class Read_script): Likewise.
10716         * fileread.h (class Input_file): Update declarations.
10717         * script.h (read_input_script): Update declaration.
10718
10719 2009-03-10  Nick Clifton  <nickc@redhat.com>
10720
10721         * po/es.po: New Spanish translation.
10722
10723 2009-03-06  Cary Coutant  <ccoutant@google.com>
10724
10725         * options.cc (parse_short_option): Keep dash_z from registering itself.
10726
10727 2009-03-03  Ian Lance Taylor  <iant@google.com>
10728
10729         PR 9918
10730         * target-reloc.h (relocate_section): Pass output_section to
10731         relocate.
10732         * i386.cc (Target_i386::should_apply_static_reloc): Add
10733         output_section parameter.  Change all callers.
10734         (Target_i386::Relocate::relocate): Add output_section parameter.
10735         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10736         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10737         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10738         * testsuite/two_file_shared.sh: New script.
10739         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10740         (check_DATA): Add two_file_shared.dbg.
10741         (two_file_shared.dbg): New target.
10742         * testsuite/Makefile.in: Rebuild.
10743
10744 2009-03-01  Ian Lance Taylor  <iant@google.com>
10745
10746         * configure.ac: Check for byteswap.h.
10747         * configure: Rebuild.
10748         * config.in: Rebuild.
10749
10750 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10751
10752         * layout.cc (Layout::find_or_add_kept_section): New function.
10753         (Layout::add_comdat): Removed.
10754         * layout.h (struct Kept_section): Move out of class Layout.
10755         Remove trailing underscores from field names.  Add group_sections
10756         field.  Rename group_ field to is_group.  Change all uses.
10757         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10758         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10759         comdat_groups_ field.
10760         (Sized_relobj::include_section_group): Use
10761         find_or_add_kept_section and Kept_section::group_sections.
10762         (Sized_relobj::include_linkonce_section): Likewise.
10763         * object.cc (class Sized_relobj): Don't define Comdat_group or
10764         Comdat_group_table.  Remove find_comdat_group and
10765         add_comdat_group.  Remove comdat_groups_ field.
10766         * plugin.cc (include_comdat_group): Use
10767         Layout::find_or_add_kept_section.
10768
10769 2009-02-28  Ian Lance Taylor  <iant@google.com>
10770
10771         * README: --gc-sections and map files are now supported.  Document
10772         some build requirements.
10773
10774         PR 6992
10775         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10776         relocatable link set the value of the section symbol to zero.
10777         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10778         relocatable link don't include the section address in the local
10779         symbol value.
10780
10781 2009-02-27  Ian Lance Taylor  <iant@google.com>
10782
10783         PR 6811
10784         * options.h (class Search_directory): Add is_system_directory.
10785         (class General_options): Declare is_in_system_directory.
10786         * options.cc (get_relative_sysroot): Make static.
10787         (get_default_sysroot): Make static.
10788         (General_optoins::is_in_system_directory): New function.
10789         * fileread.cc (Input_file::is_in_system_directory): New function.
10790         * fileread.h (class Input_file): Declare is_in_system_directory.
10791         * object.h (class Object): Add is_in_system_directory.
10792         (class Input_objects): Remove system_library_directory_ field.
10793         * object.cc (Input_objects::add_object): Don't set
10794         system_library_directory_.
10795         (input_objects::found_in_system_library_directory): Remove.
10796         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10797         parameter.  Change all callers.
10798         (Symbol_table::sized_write_globals): Likewise.
10799         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10800         Call Object::is_in_system_directory.
10801         * symtab.h (class Symbol_table): Update declarations.
10802
10803         PR 5990
10804         * descriptors.h (Open_descriptor): Add is_on_stack field.
10805         * descriptors.cc (Descriptors::open): If the descriptor is on the
10806         top of the stack, remove it.  Initialize is_on_stack field.
10807         (Descriptors::release): Only add pod to stack if it is not on the
10808         stack already.
10809         (Descriptors::close_some_descriptor): Clear stack_next and
10810         is_on_stack fields.
10811
10812         PR 7091
10813         * output.cc (Output_section::find_starting_output_address): Rename
10814         from starting_output_address; add PADDR parameter; change return
10815         type.
10816         * output.h (class Output_section): Declare
10817         find_starting_output_address instead of starting_output_address.
10818         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10819         section symbol for which we can't find a merge section.
10820
10821         PR 9836
10822         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10823         hidden or internal, force the symbol to be local.
10824         * resolve.cc (Symbol::override_visibility): Define.
10825         (Symbol::override_base): Use override_visibility.
10826         (Symbol_table::resolve): Likewise.
10827         (Symbol::override_base_with_special): Likewise.
10828         (Symbol_table::override_with_special): If the visibility is hidden
10829         or internal, force the symbol to be local.
10830         * symtab.h (class Symbol): Add set_visibility and
10831         override_visibility.
10832         * testsuite/ver_test_1.sh: New file.
10833         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10834         (check_DATA): Add ver_test_1.syms.
10835         (ver_test_1.syms): New target.
10836         * testsuite/Makefile.in: Rebuild.
10837
10838 2009-02-25  Cary Coutant  <ccoutant@google.com>
10839
10840         * layout.cc (Layout::choose_output_section): Don't rename sections
10841         when using a linker script that has a SECTIONS clause.
10842         * Makefile.in: Regenerate.
10843
10844         * testsuite/Makefile.am (script_test_5.sh): New test case.
10845         * testsuite/Makefile.in: Regenerate.
10846         * testsuite/script_test_5.cc: New file.
10847         * testsuite/script_test_5.sh: New file.
10848         * testsuite/script_test_5.t: New file.
10849
10850 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10851
10852         * archive.cc (Archive::include_member): Update calls to add_symbols.
10853         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10854         the Layout argument.
10855         * dynobj.h (do_add_symbols): Add the Layout argument.
10856         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10857         Layout argument.
10858         * object.h (Object::add_symbols): Add the Layout argument.
10859         (Object::do_add_symbols): Add the Layout argument.
10860         (Sized_relobj::do_add_symbols): Add the Layout argument.
10861         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10862         Unify the two versions.
10863         (Add_plugin_symbols): Remove.
10864         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10865         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10866         (Add_plugin_symbols): Remove.
10867         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10868         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10869         (Add_symbols::run): Make it work with Pulginobj.
10870
10871 2009-02-06  Ian Lance Taylor  <iant@google.com>
10872
10873         * object.cc (Sized_relobj::do_layout): Make info message start
10874         with lower case letter.
10875
10876 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10877
10878         * binary.cc: Fix file comment.
10879
10880         * options.h (enum Incremental_disposition): Define.
10881         (class General_options): Add new options: --incremental,
10882         --incremental_changed, --incremental_unchanged,
10883         --incremental_unknown.  Add incremental_disposition_ and
10884         implicit_incremental_ fields.
10885         (General_options::incremental_disposition): New function.
10886         (class Position_dependent_options): Add incremental_disposition
10887         option.
10888         (Position_dependent_options::copy_from_options): Set incremental
10889         dispositions.
10890         * options.cc (General_options::parse_incremental_changed): New
10891         function.
10892         (General_options::parse_incremental_unchanged): New function.
10893         (General_options::parse_incremental_unknown): New function.
10894         (General_options::General_options): Initialize new fields
10895         incremental_disposition_ and implicit_incremental_.
10896         (General_options::finalize): Check for uasge of --incremental-*
10897         without --incremental.
10898
10899 2009-02-06  Chris Demetriou  <cgd@google.com>
10900
10901         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10902         pointer and to report location as the file name associated with
10903         the symbol.
10904         (gold_undefined_symbol_at_location): New function to replace the
10905         old gold_undefined_symbol functionality.
10906         * target-reloc.h (relocate_section): Update to use
10907         gold_undefined_symbol_at_location.
10908         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10909         Call gold_undefined_symbol function rather than gold_error.
10910         * errors.h (Errors::undefined_symbol): Take location as a
10911         string, rather than calculating it from a relocation.
10912         * errors.cc (Errors::fatal): Print "fatal error:" before the
10913         formatted message.
10914         (Errors::error, Errors::error_at_location): Print "error: "
10915         before the formatted message.
10916         (Errors::undefined_symbol): Take location as a string, rather
10917         than calculating it from a relocation.
10918         (gold_undefined_symbol_at_location): New function akin to
10919         old gold_undefined_symbol, calculates location from relocation.
10920         (gold_undefined_symbol): Change to take only a Symbol pointer
10921         and to report location as the file name associated with the symbol.
10922         * testsuite/debug_msg.sh: Update for changed error messages.
10923         * testsuite/undef_symbol.sh: Likewise.
10924
10925 2009-02-04  Duncan Sands  <baldrick@free.fr>
10926
10927         PR 9812
10928         * reduced_debug_output.h
10929         (Output_reduced_debug_abbrev_section::failed): Use format for
10930         gold_warning.
10931         (Output_reduced_debug_info_section::faild): Likewise.
10932
10933 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10934
10935         * script.cc (Lazy_demangler): New class.
10936         (Version_script_info::get_symbol_version_helper): Demangle a
10937         symbol only once.
10938
10939 2009-01-29  Cary Coutant  <ccoutant@google.com>
10940
10941         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10942         to __tls_get_addr.
10943         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10944
10945 2009-01-28  Ian Lance Taylor  <iant@google.com>
10946
10947         * version.cc (version_string): Bump to 1.9.
10948
10949         * gold.h: Include <cstring> and <stdint.h>.
10950         * version.cc: Include <cstdio>.
10951         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10952         warning.
10953         * reduced_debug_output.cc (insert_into_vector): Rename from
10954         Insert_into_vector; change all callers.  Use Swap_unaligned to
10955         avoid aliasing issue; remove union since it is unnecessary.
10956
10957 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10958
10959         * Makefile.am (CCFILES): Add gc.cc.
10960         (HFILES): Add gc.h.
10961         * Makefile.in: Regenerate.
10962         * gold.cc (Gc_runner): New class.
10963         (queue_initial_tasks): Call garbage collection related tasks
10964         when corresponding options are invoked.
10965         (queue_middle_gc_tasks): New function.
10966         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10967         processed early before laying out sections during garbage collection.
10968         * gold.h (queue_middle_gc_tasks): New function.
10969         (is_prefix_of): Move from "layout.cc".
10970         * i386.cc (Target_i386::gc_process_relocs): New function.
10971         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10972         * main.cc (main): Create object of class "Garbage_collection".
10973         * object.cc (Relobj::copy_symbols_data): New function.
10974         (Relobj::is_section_name_included): New function.
10975         (Sized_relobj::do_layout): Allow this function to be called twice
10976         during garbage collection and defer layout of section during the
10977         first call.
10978         * object.h (Relobj::get_symbols_data): New function.
10979         (Relobj::is_section_name_included): New function.
10980         (Relobj::copy_symbols_data): New function.
10981         (Relobj::set_symbols_data): New function.
10982         (Relobj::get_relocs_data): New function.
10983         (Relobj::set_relocs_data): New function.
10984         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10985         (Relobj::gc_process_relocs): New function.
10986         (Relobj::do_gc_process_relocs): New pure virtual function.
10987         (Relobj::sd_): New data member.
10988         (Sized_relobj::is_output_section_offset_invalid): New function.
10989         (Sized_relobj::do_gc_process_relocs): New function.
10990         * options.h (General_options::gc_sections): Modify to not be a no-op.
10991         (General_options::print_gc_sections): New option.
10992         * plugin.cc (Plugin_finish::run): Remove function call to
10993         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10994         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10995         * reloc.cc (Read_relocs::run): Add task to process relocs and
10996         determine unreferenced sections when doing garbage collection.
10997         (Gc_process_relocs): New class.
10998         (Sized_relobj::do_gc_process_relocs): New function.
10999         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11000         sections that are garbage collected.
11001         * reloc.h (Gc_process_relocs): New class.
11002         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11003         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11004         symbols whose corresponding sections are garbage collected.
11005         (Symbol_table::Symbol_table): Add new parameter for the garbage
11006         collection object.
11007         (Symbol_table::gc_mark_undef_symbols): New function.
11008         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11009         (Symbol_table::gc_mark_dyn_syms): New function.
11010         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11011         as garbage.
11012         (Symbol_table::add_from_object): Likewise.
11013         (Symbol_table::add_from_relobj): When building shared objects, do not
11014         treat externally visible symbols as garbage.
11015         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11016         table information for static and relocatable links.
11017         * symtab.h (Symbol_table::set_gc): New function.
11018         (Symbol_table::gc): New function.
11019         (Symbol_table::gc_mark_undef_symbols): New function.
11020         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11021         (Symbol_table::gc_mark_dyn_syms): New function.
11022         (Symbol_table::gc_): New data member.
11023         * target.h (Sized_target::gc_process_relocs): New pure virtual
11024         function.
11025         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11026         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11027
11028 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11029
11030         * options.h (General_options::gc_sections): Define as a no-op for now.
11031         (General_options::no_keep_memory): Ditto.
11032         (General_options::Bshareable): Define.
11033         * options.cc (General_options::finalize): Honor -Bshareable.
11034
11035 2009-01-20  Andreas Schwab  <schwab@suse.de>
11036
11037         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11038         read the value in the contents, since we don't use it.  Use the
11039         template endianness when writing.
11040         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11041
11042 2009-01-19  Andreas Schwab  <schwab@suse.de>
11043
11044         * configure.tgt (powerpc64-*): Fix targ_obj.
11045
11046 2009-01-15  Ian Lance Taylor  <iant@google.com>
11047
11048         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11049         local symbols when stripping all symbols.
11050
11051 2009-01-14  Cary Coutant  <ccoutant@google.com>
11052
11053         * output.cc (Output_reloc): Add explicit instantiations.
11054
11055 2009-01-14  Cary Coutant  <ccoutant@google.com>
11056
11057         * archive.cc (Archive::get_elf_object_for_member): Remove call
11058         to File_read::claim_for_plugin.
11059         * descriptors.cc (Descriptors::open): Remove reference to
11060         is_claimed.
11061         (Descriptors::claim_for_plugin): Remove.
11062         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11063         (Descriptors::is_claimed): Remove.
11064         (claim_descriptor_for_plugin): Remove.
11065         * fileread.cc (File_read::claim_for_plugin): Remove.
11066         * fileread.h (File_read::claim_for_plugin): Remove.
11067         (File_read::descriptor): Reopen descriptor if necessary.
11068         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11069         (Plugin_manager::all_symbols_read): Add task parameter. Change
11070         all callers.
11071         (Plugin_manager::get_input_file): New function.
11072         (Plugin_manager::release_input_file): New function.
11073         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11074         corresponding data member.
11075         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11076         and pass to base constructor. Change all callers.
11077         (get_input_file, release_input_file): New functions.
11078         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11079         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11080         (Plugin_manager::all_symbols_read): Add task parameter.
11081         (Plugin_manager::get_input_file): New function.
11082         (Plugin_manager::release_input_file): New function.
11083         (Plugin_manager::task_): New data member.
11084         (Pluginobj::Pluginobj): Add filesize parameter.
11085         (Pluginobj::filename): New function.
11086         (Pluginobj::descriptor): New function.
11087         (Pluginobj::filesize): New function.
11088         (Pluginobj::filesize_): New data member.
11089         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11090         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11091         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11092
11093         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11094         with archive libraries.
11095         * testsuite/Makefile.in: Regenerate.
11096         * testsuite/plugin_test.c (struct sym_info): New type.
11097         (get_input_file, release_input_file): New static variables.
11098         (onload): Capture new transfer vector entries.
11099         (claim_file_hook): Stop reading at end of file according to filesize.
11100         Factor out parsing of readelf output into separate function.
11101         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11102         APIs and get the source file name from the symbol table.  Convert
11103         source file name to corresponding object file name.  Print info
11104         message when adding new input files.
11105         (parse_readelf_line): New function.
11106         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11107         * testsuite/plugin_test_2.sh: Likewise.
11108         * testsuite/plugin_test_3.sh: Likewise.
11109         * testsuite/plugin_test_4.sh: New test case.
11110
11111 2009-01-07  Ian Lance Taylor  <iant@google.com>
11112
11113         * version.cc (version_string): Bump to 1.8.
11114
11115 2008-12-23  Cary Coutant  <ccoutant@google.com>
11116
11117         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11118         * plugin.cc (Plugin_manager::finish): Rename as
11119         layout_deferred_objects.  Move cleanup to separate function.
11120         (Plugin_manager::cleanup): New function.
11121         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11122         separately.
11123         * plugin.h (Plugin_manager::finish): Rename as
11124         layout_deferred_objects.
11125         (Plugin_manager::cleanup): New function.
11126         (Plugin_manager::cleanup_done): New field.
11127
11128 2008-12-23  Cary Coutant  <ccoutant@google.com>
11129
11130         * plugin.cc (is_visible_from_outside): New function.
11131         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11132         so we don't return "IR only" status for exported symbols or -r links.
11133
11134         * testsuite/Makefile.am (plugin_test_3): New test case.
11135         * testsuite/Makefile.in: Regenerate.
11136         * testsuite/plugin_test_3.sh: New file.
11137
11138 2008-12-22  Cary Coutant  <ccoutant@google.com>
11139
11140         * object.cc (Sized_relobj::layout_section): New function.
11141         (Sized_relobj::do_layout): Defer layout of input sections until after
11142         plugin has provided replacement files.
11143         (Sized_relobj::do_layout_deferred_sections): New function.
11144         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11145         (Relobj::layout_deferred_sections): New function.
11146         (Relobj::do_layout_deferred_sections): New function.
11147         (Sized_relobj::do_layout_deferred_sections): New function.
11148         (Sized_relobj::layout_section): New function.
11149         (Sized_relobj::Deferred_layout): New structure.
11150         (Sized_relobj::deferred_layout_): New field.
11151         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11152         Change all callers.  Layout deferred sections.
11153         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11154         references.
11155         (Plugin_hook::run): Move code from do_plugin_hook inline.
11156         (Plugin_hook::do_plugin_hook): Remove.
11157         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11158         (Plugin_manager::finish): Renamed, was cleanup.
11159         (Plugin_manager::should_defer_layout): New function.
11160         (Plugin_manager::add_deferred_layout_object): New function.
11161         (Plugin_manager::Deferred_layout_list): New type.
11162         (Plugin_manager::deferred_layout_objects_): New field.
11163         (Plugin_hook::do_plugin_hook): Remove.
11164
11165 2008-12-17  Ian Lance Taylor  <iant@google.com>
11166
11167         * options.h (class General_options): Add --no case for
11168         --export-dynamic.
11169
11170 2008-12-16  Cary Coutant  <ccoutant@google.com>
11171
11172         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11173         vector.
11174         (Plugin_manager::claim_file): Create plugin object even if
11175         plugin did not call the add_symbols callback.
11176         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11177         asking for more symbols than were added.
11178         * testsuite/Makefile.am (plugin_test_1): Add test case with
11179         no global symbols.
11180         (empty.syms): New target.
11181         * testsuite/Makefile.in: Regenerate.
11182         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11183         message. Don't call add_symbols if no globals.
11184         (all_symbols_read_hook): Don't provide replacement for empty
11185         claimed file.
11186
11187 2008-12-12  Ian Lance Taylor  <iant@google.com>
11188
11189         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11190         r_type == 0 for a local symbol with r_sym == 0.
11191         (scan_relocatable_relocs): Pass r_sym to
11192         local_non_section_strategy.
11193         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11194         r_sym parameter.
11195
11196         * configure.ac: Update test for TLS descriptors: they are
11197         supported as of glibc 2.9.
11198         * configure: Rebuild.
11199
11200 2008-12-11  Ian Lance Taylor  <iant@google.com>
11201
11202         PR 7091
11203         * target-reloc.h (Default_scan_relocatable_relocs): For each
11204         function, map r_type == 0 to RELOC_DISCARD.
11205
11206 2008-12-10  Cary Coutant  <ccoutant@google.com>
11207
11208         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11209         object to override a kept COMDAT group from a plugin object.
11210
11211 2008-12-09  Ian Lance Taylor  <iant@google.com>
11212
11213         PR 7088
11214         * yyscript.y (file_cmd): Handle INPUT.
11215
11216         * testsuite/initpri1.c: Change all declarations to be full
11217         prototypes by adding void, to avoid compiler warnings.
11218
11219 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11220
11221         * options.cc (General_options::parse_plugin_opt): New.
11222         (General_options::add_plugin): The argument now is just the filename.
11223         (General_options::add_plugin_option): New.
11224         * options.h (plugin_opt): New.
11225         (add_plugin): Change argument name.
11226         (add_plugin_option): New.
11227         * plugin.cc (Plugin::load): Don't parse the plugin option.
11228         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11229         (Plugin::add_option): New.
11230         (Plugin::args_): Change type.
11231         (Plugin::filename_): New.
11232         (Plugin_manager::add_plugin_option): New.
11233         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11234         * testsuite/Makefile.in: Regenerate.
11235
11236 2008-12-05  Cary Coutant  <ccoutant@google.com>
11237
11238         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11239         Handle --strip-lto-sections option.
11240         * options.h (strip_lto_sections): New option.
11241
11242 2008-12-01  Cary Coutant  <ccoutant@google.com>
11243
11244         * plugin.cc (ld_plugin_message): Change format parameter to const.
11245         Fix mismatch between new[] and delete.
11246
11247 2008-11-14  Cary Coutant  <ccoutant@google.com>
11248
11249         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11250         instead of -1U.
11251
11252 2008-11-05  Craig Silverstein  <csilvers@google.com>
11253
11254         * options.cc (General_options::parse_dynamic_list): New function.
11255         * options.h (General_options): New flags dynamic_list,
11256         dynamic_list_data, dynamic_list_cpp_new, and
11257         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11258         (General_options::in_dynamic_list): New function.
11259         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11260         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11261         (Lex::can_continue_name): Likewise.
11262         (yylex): Likewise.
11263         (read_script_file): New parameter script_options.
11264         (read_dynamic_list): New function.
11265         (Script_options::define_dynamic_list): New function.
11266         (dynamic_list_keyword_parsecodes): New variable.
11267         (dynamic_list_keywords): New variable.
11268         * script.h (Script_options::define_dynamic_list): New function
11269         prototype.
11270         (read_dynamic_list): New function prototype.
11271         * symtab.cc (strprefix): New macro.
11272         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11273         dynamic_list_data, dynamic_list_cpp_new, and
11274         dynamic_list_cpp_typeinfo.
11275         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11276         (dynamic_list_expr): New rule.
11277         (dynamic_list_nodes): Likewise.
11278         (dynamic_list_node): Likewise.
11279         * testsuite/Makefile.am (dynamic_list): New test.
11280         * testsuite/Makefile.in: Regenerated.
11281         * testsuite/dynamic_list.t: New file.
11282         * testsuite/dynamic_list.sh: New file.
11283
11284 2008-11-05  Craig Silverstein  <csilvers@google.com>
11285
11286         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11287         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11288         (t11_last): Likewise.
11289         * testsuite/ver_test_6.c (main): Likewise.
11290
11291 2008-10-07  Cary Coutant  <ccoutant@google.com>
11292
11293         * options.c (General_options::finalize): Add check for -static and
11294         -shared.
11295         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11296         is not empty.
11297
11298 2008-10-02  Cary Coutant  <ccoutant@google.com>
11299
11300         * plugin.cc (make_sized_plugin_object): Fix conditional
11301         compilation to work when not all targets are enabled.
11302
11303 2008-09-29  Cary Coutant  <ccoutant@google.com>
11304
11305         * archive.cc (Archive::get_file_and_offset): Use filename instead
11306         of name to get library path.
11307         (Archive::include_member): Unlock external member of a thin archive.
11308
11309         * testsuite/Makefile.am (TEST_AR): New variable.
11310         (thin_archive_test_1): New test.
11311         (thin_archive_test_2): New test.
11312         * testsuite/Makefile.in: Regenerate.
11313         * testsuite/thin_archive_main.cc: New file.
11314         * testsuite/thin_archive_test_1.cc: New file.
11315         * testsuite/thin_archive_test_2.cc: New file.
11316         * testsuite/thin_archive_test_3.cc: New file.
11317         * testsuite/thin_archive_test_4.cc: New file.
11318
11319 2008-09-29  Cary Coutant  <ccoutant@google.com>
11320
11321         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11322         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11323         instead of -1U.
11324         (Sized_relobj::do_finalize_local_symbols): Likewise.
11325         (Sized_relobj::map_to_kept_section): Likewise.
11326         * object.h (Sized_relobj::invalid_address): New constant.
11327         (Sized_relobj::do_output_section_offset): Check for invalid_address
11328         and return -1ULL.
11329         * output.cc (Output_reloc::local_section_offset): Use constant
11330         invalid_address instead of -1U.
11331         (Output_reloc::get_address): Likewise.
11332         (Output_section::output_address): Change -1U to -1ULL.
11333         * output.h (Output_reloc::invalid_address): New constant.
11334         * reloc.cc (Sized_relobj::write_sections): Use constant
11335         invalid_address instead of -1U.
11336         (Sized_relobj::relocate_sections): Likewise.
11337         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11338         values for merge sections.
11339         * target-reloc.h (relocate_for_relocatable): Use constant
11340         invalid_address instead of -1U.
11341
11342 2008-09-19  Cary Coutant  <ccoutant@google.com>
11343
11344         Add plugin functionality for link-time optimization (LTO).
11345         * configure.ac (plugins): Add --enable-plugins option.
11346         * configure: Regenerate.
11347         * config.in: Regenerate.
11348         * Makefile.am (LIBDL): New variable.
11349         (CCFILES): Add plugin.cc.
11350         (HFILES): Add plugin.h.
11351         (ldadd_var): Add LIBDL.
11352         * Makefile.in: Regenerate.
11353
11354         * archive.cc: Include "plugin.h".
11355         (Archive::setup): Don't preread archive symbols when using a plugin.
11356         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11357         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11358         files.
11359         (Archive::include_member): Add symbols from plugin objects.
11360         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11361         * descriptors.cc (Descriptors::open): Check for file descriptors
11362         abandoned by plugins.
11363         (Descriptors::claim_for_plugin): New function.
11364         * descriptors.h (Descriptors::claim_for_plugin): New function.
11365         (Open_descriptor::is_claimed): New field.
11366         (claim_descriptor_for_plugin): New function.
11367         * fileread.cc (File_read::claim_for_plugin): New function.
11368         * fileread.h (File_read::claim_for_plugin): New function.
11369         (File_read::descriptor): New function.
11370         * gold.cc: Include "plugin.h".
11371         (queue_initial_tasks): Add task to call plugin hooks for generating
11372         new object files.
11373         * main.cc: Include "plugin.h".
11374         (main): Load plugin libraries.
11375         * object.h (Pluginobj): Declare.
11376         (Object::pluginobj): New function.
11377         (Object::do_pluginobj): New function.
11378         (Object::set_target): New function.
11379         * options.cc: Include "plugin.h".
11380         (General_options::parse_plugin): New function.
11381         (General_options::General_options): Initialize plugins_ field.
11382         (General_options::add_plugin): New function.
11383         * options.h (Plugin_manager): Declare.
11384         (General_options): Add --plugin option.
11385         (General_options::has_plugins): New function.
11386         (General_options::plugins): New function.
11387         (General_options::add_plugin): New function.
11388         (General_options::plugins_): New field.
11389         * plugin.cc: New file.
11390         * plugin.h: New file.
11391         * readsyms.cc: Include "plugin.h".
11392         (Read_symbols::do_read_symbols): Check for archive before checking
11393         for ELF file.  Call plugin hooks to claim files.
11394         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11395         from a real object file; force override when processing replacement
11396         files.
11397         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11398         (Symbol::init_base_object): Likewise.
11399         (Symbol::init_base_output_data): Likewise.
11400         (Symbol::init_base_output_segment): Likewise.
11401         (Symbol::init_base_constant): Likewise.
11402         (Symbol::init_base_undefined): Likewise.
11403         (Symbol::output_section): Assert that object is not a plugin.
11404         (Symbol_table::add_from_pluginobj): New function.
11405         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11406         undefined.
11407         (Symbol_table::sized_write_globals): Likewise.
11408         (Symbol_table::add_from_pluginobj): Instantiate template.
11409         * symtab.h (Sized_pluginobj): Declare.
11410         (Symbol::in_real_elf): New function.
11411         (Symbol::set_in_real_elf): New function.
11412         (Symbol::in_real_elf_): New field.
11413         (Symbol_table::add_from_pluginobj): New function.
11414
11415         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11416         (LIBDL): New variable.
11417         (LDADD): Add LIBDL.
11418         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11419         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11420         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11421         (MOSTLYCLEANFILES): Likewise.
11422         * testsuite/Makefile.in: Regenerate.
11423         * testsuite/plugin_test.c: New file.
11424         * testsuite/plugin_test_1.sh: New file.
11425         * testsuite/plugin_test_2.sh: New file.
11426
11427 2008-09-16  Ian Lance Taylor  <iant@google.com>
11428
11429         * target-reloc.h (relocate_section): Check whether a symbol is
11430         defined by the ABI before reporting an undefined symbol error.
11431         * target.h (Target::is_defined_by_abi): Make parameter const.
11432         (Target::do_is_defined_by_abi): Likewise.
11433         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11434         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11435         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11436         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11437         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11438         * testsuite/Makefile.in: Rebuild.
11439
11440         * fileread.cc (make_view): Add casts to avoid warning.
11441
11442 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11443
11444         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11445         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11446
11447 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11448
11449         * options.h (General_options::output_is_executable): New.
11450         (General_options::output_is_pie): New.
11451         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11452         for shared libraries.
11453         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11454
11455 2008-09-11  Chris Demetriou  <cgd@google.com>
11456
11457         * options.h (origin): New -z option.
11458         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11459         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11460         in DT_FLAGS_1.
11461
11462 2008-09-05  Cary Coutant  <ccoutant@google.com>
11463
11464         * fileread.cc (File_read::make_view): Add check for attempt to map
11465         beyond end of file.
11466
11467 2008-09-05  Cary Coutant  <ccoutant@google.com>
11468
11469         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11470         explicit instantiations.
11471
11472 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11473
11474         PR gold/6858
11475         * options.cc (General_options::finalize): Allow undefined symbols
11476         in shlibs if linking -shared.
11477
11478         PR gold/6859
11479         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11480         symbols as not needing a dynsym entry.
11481
11482 2008-08-20  Craig Silverstein  <csilvers@google.com>
11483
11484         * fileread.cc (File_read::open): Do not lock the file unless it
11485         was successfully opened.
11486
11487 2008-08-14  Cary Coutant  <ccoutant@google.com>
11488
11489         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11490         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11491         * testsuite/tls_test.cc (struct int128): 128-bit struct
11492         for testing TLS relocs with non-zero addend.
11493         (v12): New TLS variable.
11494         (t12): New test.
11495         (t_last): Add check for v12.
11496         * testsuite/tls_test.h (t12): New function.
11497         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11498
11499 2008-08-13  Ian Lance Taylor  <iant@google.com>
11500
11501         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11502         set tls_segment_ or relro_segment_.
11503         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11504         when appropriate.
11505         * output.h (Output_section::clear_is_relro): New function.
11506         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11507         sections specially even when output_data_ is empty.
11508         (Output_segment::maximum_alignment): When first section is relro,
11509         only force alignment for PT_LOAD segments.
11510         * script.cc (script_data_segment_align): New function.
11511         (script_data_segment_relro_end): New function.
11512         * script-c.h (script_data_segment_align): Declare.
11513         (script_data_segment_relro_end): Declare.
11514         * script-sections.h (class Script_sections): Declare
11515         data_segment_align and data_segment_relro_end.  Add fields
11516         segment_align_index_ and saw_relro_end_.
11517         * script-sections.cc (class Sections_element): Add set_is_relro
11518         virtual function.  Add new bool* parameter to place_orphan_here.
11519         Add get_output_section virtual function.
11520         (class Output_section_definition): Add set_is_relro.  Add new
11521         bool* parameter to place_orphan_here.  Add get_output_section.
11522         Add is_relro_ field.
11523         (Output_section_definition::Output_section_definition): Initialize
11524         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11525         and is_relro_ fields.
11526         (Output_section_definition::place_orphan_here): Add is_relro
11527         parameter.
11528         (Output_section_definition::set_section_addresses): Set relro for
11529         output section.
11530         (Output_section_definition::alternate_constraint): Likewise.
11531         (class Orphan_output_section): Add new bool* parameter to
11532         place_orphan_here.  Add get_output_section.
11533         (Orphan_output_section::place_orphan_here): Add is_relro
11534         parameter.
11535         (Script_sections::Script_sections): Initialize
11536         data_segment_align_index_ and saw_relro_end_.
11537         (Script_sections::data_segment_align): New function.
11538         (Script_sections::data_segment_relro_end): New function.
11539         (Script_sections::place_orphan): Set or clear is_relro.
11540         (Script_sections::set_section_addresses): Force alignment of first
11541         TLS section.
11542         * yyscript.y (exp): Call script_data_segment_align and
11543         script_data_segment_relro_end.
11544         * testsuite/relro_script_test.t: New file.
11545         * testsuite/relro_test.cc (using_script): Declare.
11546         (t1, t2): Test using_script.
11547         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11548         (relro_script_test_SOURCES): Define.
11549         (relro_script_test_DEPENDENCIES): Define.
11550         (relro_script_test_LDFLAGS): Define.
11551         (relro_script_test_LDADD): Define.
11552         (relro_script_test.so): New target.
11553         * testsuite/Makefile.in: Rebuild.
11554
11555 2008-08-06  Cary Coutant <ccoutant@google.com>
11556
11557         * archive.cc (Archive::total_archives, Archive::total_members)
11558         (Archive::total_members_loaded): New variables.
11559         (Archive::setup): Add parameter.  Add option to preread
11560         archive symbols.
11561         (Archive::read_armap): Add counter.
11562         (Archive::get_file_and_offset): New function.
11563         (Archive::get_elf_object_for_member): New function.
11564         (Archive::read_all_symbols): New function.
11565         (Archive::read_symbols): New function.
11566         (Archive::add_symbols): Add counters.
11567         (Archive::include_all_members): Use armap to find members if it's
11568         already built.
11569         (Archive::include_member): Skip reading symbols if already read.
11570         Factored code into Archive::get_file_and_offset and
11571         Archive::get_elf_object_for_member.  Changed call to
11572         Mapfile::report_include_archive_member.
11573         (Archive::print_stats): New function.
11574         * archive.h: Declare Object and Read_symbols_data classes.
11575         (Archive::Archive): Add initializers for new members.
11576         (Archive::setup): Add parameter.
11577         (Archive::print_stats): New function.
11578         (Archive::total_archives, Archive::total_members)
11579         (Archive::total_members_loaded): New variables.
11580         (Archive::get_file_and_offset): New function.
11581         (Archive::get_elf_object_for_member): New function.
11582         (Archive::read_all_symbols): New function.
11583         (Archive::read_symbols): New function.
11584         (Archive::Archive_member): New class.
11585         (Archive::members_): New member.
11586         (Archive::num_members_): New member.
11587         * main.cc: Include archive.h.
11588         (main): Call Archive::print_stats.
11589         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11590         archive parameter; member_name is now the fully-decorated name.
11591         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11592         * options.h: (General_options): Add --preread-archive-symbols option.
11593         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11594         Archive::setup.
11595
11596 2008-08-04  Ian Lance Taylor  <iant@google.com>
11597
11598         * symtab.h (Symbol::use_plt_offset): New function.
11599         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11600         * powerpc.cc (Relocate::relocate): Likewise.
11601         * sparc.cc (Relocate::relocate): Likewise.
11602         * x86_64.cc (Relocate::relocate): Likewise.
11603         * testsuite/weak_plt.sh: New test.
11604         * testsuite/weak_plt_main.cc: New test.
11605         * testsuite/weak_plt_shared.cc: New test.
11606         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11607         (check_PROGRAMS): Add weak_plt.
11608         (check_DATA): Add weak_plt_shared.so.
11609         (weak_plt_main_pic.o, weak_plt): New targets.
11610         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11611         * testsuite/Makefile.in: Rebuild.
11612
11613         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11614         gcctestdir/ld.
11615         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11616         * testsuite/Makefile.in: Rebuild.
11617
11618 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11619
11620         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11621         * Makefile.in: Regenerate.
11622         * po/POTFILES.in: Regenerate.
11623
11624 2008-07-29  Ian Lance Taylor  <iant@google.com>
11625
11626         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11627         symbols before other symbols.
11628         * testsuite/script_test_2.cc (test_addr): Declare.
11629         (test_addr_alias): Declare.
11630         (main): Check that test_addr and test_addr_alias have the right
11631         values.
11632         * testsuite/script_test_2.t: Define test_addr_alias and
11633         test_addr.
11634
11635 2008-07-24  Ian Lance Taylor  <iant@google.com>
11636
11637         PR 5990
11638         * descriptors.cc: New file.
11639         * descriptors.h: New file.
11640         * gold-threads.h (class Hold_optional_lock): New class.
11641         * fileread.cc: Include "descriptors.h".
11642         (File_read::~File_read): Release descriptor rather than closing
11643         it.
11644         (File_read::open) [file]: Call open_descriptor rather than open.
11645         Set is_descriptor_opened_.
11646         (File_read::open) [memory]: Assert that descriptor is not open.
11647         (File_read::reopen_descriptor): New function.
11648         (File_read::release): Release descriptor.
11649         (File_read::do_read): Make non-const.  Reopen descriptor.
11650         (File_read::read): Make non-const.
11651         (File_read::make_view): Reopen descriptor.
11652         (File_read::do_readv): Likewise.
11653         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11654         Update declarations.
11655         * layout.cc: Include "descriptors.h".
11656         (Layout::create_build_id): Use open_descriptor rather than open.
11657         * output.cc: Include "descriptors.h".
11658         (Output_file::open): Use open_descriptor rather than open.
11659         * archive.cc (Archive::const_iterator): Change Archive to be
11660         non-const.
11661         (Archive::begin, Archive::end): Make non-const.
11662         (Archive::count_members): Likewise.
11663         * archive.h (class Archive): Update declarations.
11664         * object.h (Object::read): Make non-const.
11665         * Makefile.am (CCFILES): Add descriptors.cc.
11666         (HFILES): Add descriptors.h.
11667         * Makefile.in: Rebuild.
11668
11669         PR 6716
11670         * gold.h: Always include <clocale>.  Add Solaris workarounds
11671         following code in binutils/sysdep.h.
11672
11673         PR 6048
11674         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11675         this->eh_frame_hdr_ is NULL before using it.
11676
11677         * dynobj.cc (Versions::Versions): Update comment.
11678
11679         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11680         the base version name.
11681
11682         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11683         array size plus one.
11684         (Stringpool_template::set_string_offsets): Subtract one from key
11685         before using it as an array index.
11686         (Stringpool_template::get_offset_with_length): Likewise.
11687         (Stringpool_template::write_to_buffer): Likewise.
11688         * stringpool.h (Stringpool_template::get_offset_from_key):
11689         Likewise.
11690
11691 2008-07-23  Ian Lance Taylor  <iant@google.com>
11692
11693         PR 6658
11694         * object.h (Merged_symbol_value::value): Do our best to handle a
11695         negative addend.
11696
11697         PR 6647
11698         * script.cc (Version_script_info::get_versions): Don't add empty
11699         version tag to return value.
11700         (Version_script_info::get_symbol_version_helper): Change return
11701         type to bool.  Add pversion parameter.  Change all callers.
11702         (script_register_vers_node): Don't require a non-NULL tag.
11703         * script.h (class Version_script_info): Update declarations.
11704         (Version_script_info::get_symbol_version): Change return type to
11705         bool.  Add version parameter.  Change all callers.
11706         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11707         handling.  Handle an empty version from a version script.
11708         (Symbol_table::define_special_symbol): Likewise.
11709         * testsuite/ver_test_10.script: New file.
11710         * testsuite/ver_test_10.sh: New file.
11711         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11712         (check_DATA): Add ver_test_10.syms.
11713         (ver_test_10.syms, ver_test_10.so): New target.
11714         * testsuite/Makefile.in: Rebuild.
11715
11716 2008-07-23  Simon Baldwin  <simonb@google.com>
11717
11718         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11719         to zero for undefined symbols from dynamic libraries.
11720
11721 2008-07-23  Ian Lance Taylor  <iant@google.com>
11722
11723         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11724         Change all callers.
11725         * symtab.h (class Symbol_table): Update declaration.
11726         * testsuite/ver_test_9.cc: New file.
11727         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11728         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11729         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11730         (ver_test_9.so, ver_test_9.o): New targets.
11731         * testsuite/Makefile.in: Rebuild.
11732
11733 2008-07-22  Ian Lance Taylor  <iant@google.com>
11734
11735         * options.h (class General_options): Define --check-sections.
11736         * layout.cc (Layout::set_segment_offsets): Handle
11737         --check-sections.
11738
11739         * options.h (class General_options): Define -n/--nmagic and
11740         -N/--omagic.
11741         * options.cc (General_options::finalize): For -n/--nmagic or
11742         -N/--omagic, set -static.
11743         * layout.cc (Layout::attach_allocated_section_to_segment): If
11744         -N/--omagic, don't put read-only and read-write sections in
11745         different segments.
11746         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11747         finding a read-only segment.
11748         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11749         don't set the minimum segment alignment to the common page size,
11750         and don't set the file offset to the address modulo the page size.
11751         * script-sections.cc (Script_sections::create_segments): If
11752         -n/--omagic, don't put read-only and read-write sections in
11753         different segments.
11754
11755         * cref.cc: New file.
11756         * cref.h: New file.
11757         * options.h (class General_options): Add --print-symbol-counts.
11758         * main.cc (main): Issue defined symbol report if requested.
11759         * archive.cc (Archive::interpret_header): Make into a const member
11760         function.
11761         (Archive::add_symbols): Call Input_objects::archive_start and
11762         archive_stop.
11763         (Archive::const_iterator): Define new class.
11764         (Archive::begin, Archive::end): New functions.
11765         (Archive::include_all_members): Rewrite to use iterator.
11766         (Archive::count_members): New function.
11767         * archive.h (class Archive): Update declarations.
11768         (Archive::filename): New function.
11769         * object.cc: Include "cref.h".
11770         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11771         (Sized_relobj::do_get_global_symbol_counts): New function.
11772         (Input_objects::add_object): Add object to cross-referencer.
11773         (Input_objects::archive_start): New function.
11774         (Input_objects::archive_stop): New function.
11775         (Input_objects::print_symbol_counts): New function.
11776         * object.h: Declare Cref and Archive.
11777         (Object::get_global_symbol_counts): New function.
11778         (Object::do_get_global_symbol_counts): New pure virtual function.
11779         (class Sized_relobj): Add defined_count_ field.  Update
11780         declarations.
11781         (class Input_objects): Add cref_ field.  Update constructor.
11782         Update declarations.
11783         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11784         defined_count_.
11785         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11786         symbol counts.
11787         (Sized_dynobj::do_get_global_symbol_counts): New function.
11788         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11789         defined_count_.  Update declarations.  Define Symbols typedef.
11790         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11791         parameter.  Change all callers.
11792         (Symbol_table::add_from_dynobj): Add sympointers and defined
11793         parameters.  Change all callers.
11794         * symtab.h (class Symbol_table): Update declarations.
11795         * Makefile.am (CCFILES): Add cref.cc.
11796         (HFILES): Add cref.h.
11797         * Makefile.in: Rebuild.
11798
11799 2008-07-22  Simon Baldwin  <simonb@google.com>
11800
11801         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11802         to zero when writing undefined symbols.
11803
11804 2008-07-22  Ian Lance Taylor  <iant@google.com>
11805
11806         * output.cc (Output_section::add_input_section): Don't try to
11807         merge empty merge sections.
11808
11809 2008-07-21  Craig Silverstein  <csilvers@google.com>
11810
11811         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11812         Include symbol version in error message.
11813
11814 2008-07-20  Chris Demetriou  <cgd@google.com>
11815
11816         * configure.ac (gold_cv_c_random_seed): New configured variable.
11817         (RANDOM_SEED_CFLAGS): New substituted variable.
11818         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11819         * configure: Rebuild.
11820         * Makefile.in: Likewise.
11821         * testsuite/Makefile.in: Likewise.
11822
11823 2008-07-18  Ian Lance Taylor  <iant@google.com>
11824
11825         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11826         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11827         * testsuite/ver_test_main.cc (main): Call t4.
11828         (t4, t4_2a): Define.
11829         * testsuite/ver_test_2.cc (t4_2): Define.
11830         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11831         * testsuite/ver_test_4.cc (t4_2a): Define.
11832         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11833         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11834
11835 2008-07-17  Ian Lance Taylor  <iant@google.com>
11836
11837         * dynobj.cc (Versions::add_def): If we give an error about a
11838         missing version, go ahead and create the version anyhow.
11839
11840 2008-07-10  Ian Lance Taylor  <iant@google.com>
11841
11842         Handle output sections with more than 0x7fffffff bytes.
11843         * object.h (class Relobj): Change map_to_output_ to
11844         output_sections_, and just keep a section pointer.  Change all
11845         uses.  Move comdat group support to Sized_relobj.
11846         (Relobj::is_section_specially_mapped): Remove.
11847         (Relobj::output_section): Remove poff parameter.  Change all
11848         callers.
11849         (Relobj::output_section_offset): New function.
11850         (Relobj::set_section_offset): Rewrite.
11851         (Relobj::map_to_output): Remove.
11852         (Relobj::output_sections): New function.
11853         (Relobj::do_output_section_offset): New pure virtual function.
11854         (Relobj::do_set_section_offset): Likewise.
11855         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11856         group support from Relobj.  Update declarations.
11857         (Sized_relobj::get_output_section_offset): New function.
11858         (Sized_relobj::do_output_section_offset): New function.
11859         (Sized_relobj::do_set_section_offset): New function.
11860         * object.cc (Relobj::output_section_address): Remove.
11861         (Sized_relobj::Sized_relobj): Initialize new fields.
11862         (Sized_relobj::include_section_group): Cast find_kept_object to
11863         Sized_relobj.
11864         (Sized_relobj::include_linkonce_section): Likewise.
11865         (Sized_relobj::do_layout): Use separate arrays for output section
11866         and output offset.
11867         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11868         output_sections.
11869         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11870         output_sections and section_offsets.
11871         (Sized_relobj::write_local_symbols): Likewise.
11872         (map_to_kept_section): Compute output address directly.
11873         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11874         output_sections and section_offsets.
11875         (Sized_relobj::write_sections): Likewise.
11876         (Sized_relobj::relocate_sections): Likewise.
11877         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11878         * output.h (class Output_reloc): Update declarations.  Change
11879         u2_.relobj to Sized_relobj*.
11880         (class Output_data_reloc): Change add functions to use
11881         Sized_relobj*.
11882         * output.cc (Output_reloc::Output_reloc): Change relobj to
11883         Sized_relobj*.
11884         (Output_reloc::local_section_offset): Change return type to
11885         Elf_Addr.  Use get_output_section_offset.
11886         (Output_reloc::get_address): Likewise.
11887         (Output_section::is_input_address_mapped): Don't call
11888         is_section_specially_mapped.
11889         (Output_section::output_offset): Likewise.
11890         (Output_section::output_address): Likewise.
11891         (Output_section::starting_output_address): Likewise.
11892         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11893         parameter to Sized_relobj*.
11894         (Copy_relocs::need_copy_reloc): Likewise.
11895         (Copy_relocs::save): Likewise.
11896         * copy-relocs.h (class Copy_relocs): Update declarations.
11897         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11898         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11899         * target-reloc.h (relocate_for_relocatable): Change
11900         offset_in_output_section type to Elf_Addr.  Change code that uses
11901         it as well.
11902         * layout.cc (Layout::layout): Always set *off.
11903         * mapfile.cc (Mapfile::print_input_section): Use
11904         output_section_offset.
11905         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11906         Sized_relobj*.
11907         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11908         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11909         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11910
11911 2008-07-03  Ian Lance Taylor  <iant@google.com>
11912
11913         * layout.cc (Layout::include_section): Do not discard unrecognized
11914         SHT_STRTAB sections.
11915
11916 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11917
11918         * script.cc (Lex::can_continue_name): Make '?' allowable in
11919         version-script names.
11920         * testsuite/version_script.map: Change glob pattern to use '?'
11921
11922 2008-06-30  Manish Singh  <yosh@gimp.org>
11923
11924         PR 6585
11925         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11926         Correct typo.
11927
11928 2008-06-30  Ian Lance Taylor  <iant@google.com>
11929
11930         PR 6660
11931         PR 6682
11932         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11933         versions]: Don't try to read the value in the contents, since we
11934         don't use it.  Use the template endianness when writing.
11935
11936 2008-06-25  Cary Coutant  <ccoutant@google.com>
11937
11938         * fileread.cc (File_read::make_view): Assert on zero-length view.
11939         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11940         symbol table when there are no symbols to read.
11941
11942 2008-06-23  Craig Silverstein  <csilvers@google.com>
11943
11944         * version.cc (version_string): Bump to 1.7
11945
11946 2008-06-18  Craig Silverstein  <csilvers@google.com>
11947
11948         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11949         constant 0xFFFF to type Valtype.
11950         (Powerpc_relocate_functions::rel16_ha): Likewise.
11951
11952 2008-06-17  Ian Lance Taylor  <iant@google.com>
11953
11954         * output.h (Output_section::Input_section): Initialize p2align_ to
11955         zero for Output_section_data constructors.
11956         (Output_section::Input_section::addralign): If not an input
11957         section, return the alignment of the Output_section_data.
11958         * testsuite/copy_test.cc: New file.
11959         * testsuite/copy_test_1.cc: New file.
11960         * testsuite/copy_test_2.cc: New file.
11961         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11962         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11963         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11964         (copy_test_1_pic.o, copy_test_1.so): New targets.
11965         (copy_test_2_pic.o, copy_test_2.so): New targets.
11966         * testsuite/Makefile.in: Rebuild.
11967
11968         * script-sections.cc (Script_sections::place_orphan): Initialize
11969         local variable exact.
11970
11971 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11972
11973         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11974
11975 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11976             David S. Miller  <davem@davemloft.net>
11977
11978         * powerpc.cc: New file.
11979         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11980         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11981         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11982         * Makefile.in: Rebuild.
11983
11984 2008-06-09  Ian Lance Taylor  <iant@google.com>
11985
11986         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11987         <exception>.
11988         (throwing, orig_terminate): New static variables.
11989         (terminate_handler): New static function.
11990         (t2): Set terminate handler.
11991
11992 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11993
11994         PR 6584
11995         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11996         alignment.
11997
11998 2008-05-30  Cary Coutant  <ccoutant@google.com>
11999
12000         * archive.cc (Archive::include_all_members) Correct to step
12001         over symbol table and extended name table in thin archives.
12002
12003 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12004
12005         PR 6407
12006         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12007         calculation.
12008
12009 2008-05-28  Caleb Howe  <cshowe@google.com>
12010
12011         * reduced_debug_output.cc: New file.
12012         * reduced_debug_output.h: New file.
12013         * options.h (class General_options): Add --strip-debug-non-line.
12014         * options.cc (General_options::finalize): Add strip_debug_non_line
12015         to the strip heirarchy.
12016         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12017         fields.
12018         * layout.cc: Include "reduced_debug_output.h".
12019         (Layout::Layout): Initialize new fields.
12020         (line_only_debug_sections): New static array.
12021         (is_lines_only_debug_sections): New static inline function.
12022         (Layout::include_section): Handle --strip-debug-non-line.
12023         (Layout::make_output_section): If --strip-debug-non-line, build
12024         new output sections for .debug_abbrev and .debug_info.
12025         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12026         gold.  Warn about possible overflow.
12027         (read_signed_LEB_128): Likewise.
12028         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12029         (read_signed_LEB_128): Declare.
12030         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12031         (HFILES): Add reduced_debug_output.h.
12032         * Makefile.in: Rebuild.
12033
12034 2008-05-21  Ian Lance Taylor  <iant@google.com>
12035
12036         * mapfile.cc: New file.
12037         * mapfile.h: New file.
12038         * options.h (class General_options): Add -M/--print-map and -Map.
12039         * options.cc (General_options::finalize): Make -M equivalent to
12040         -Map -.
12041         * main.cc: Include <cstdio> and "mapfile.h".
12042         (main): Open mapfile if requested.
12043         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12044         constructor.  Change caller.
12045         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12046         (queue_middle_tasks): Likewise.
12047         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12048         declarations.
12049         * archive.cc: Include "mapfile.h".
12050         (Archive::add_symbols): Add mapfile parameter.  Change all
12051         callers.  Pass mapfile, symbol, and reason to include_member.
12052         (Archive::include_all_members): Add mapfile parameter.  Change all
12053         callers.
12054         (Archive::include_member): Add mapfile, sym, and why parameters.
12055         Change all callers.  Report inclusion to map file.
12056         * archive.h: Include "fileread.h".
12057         (class Archive): Update declarations.
12058         (Archive::file): New const method.
12059         (class Add_archive_symbols): Add mapfile_ field.  Update
12060         constructor.  Change all callers.
12061         * readsyms.h (class Read_symbols): Likewise.
12062         (class Finish_group): Likewise.
12063         (class Read_script): Likewise.
12064         * common.cc: Include "mapfile.h".
12065         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12066         all callers.
12067         (Symbol_table::do_allocate_commons): Likewise.
12068         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12069         symbol allocation to mapfile.
12070         * common.h (class Allocate_commons_task): Add mapfile_ field.
12071         Update constructor.  Change all callers.
12072         * symtab.h (class Symbol_table): Update declarations.
12073         * layout.cc: Include "mapfile.h".
12074         (Layout_task_runner::run): Print information to mapfile.
12075         (Layout::create_gold_note): Change Output_data_fixed_space to
12076         Output_data_zero_fill.
12077         (Layout::create_build_id): Likewise.
12078         (Layout::print_to_mapfile): New function.
12079         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12080         constructor.  Change caller.
12081         (class Layout): Declare print_to_mapfile.
12082         * output.cc (Output_section::Input_section::print_to_mapfile): New
12083         function.
12084         (Output_section::add_input_section): If producing a map, always
12085         add to input_sections_ list.
12086         (Output_section::do_print_to_mapfile): New function.
12087         (Output_segment::print_sections_to_mapfile): New function.
12088         (Output_segment::print_section_list_to_mapfile): New function.
12089         * output.h: Include "mapfile.h".
12090         (Output_data::print_to_mapfile): New function.
12091         (Output_data::do_print_to_mapfile): New virtual function.
12092         (Output_segment_headers::do_print_to_mapfile): New function.
12093         (Output_file_header::do_print_to_mapfile): New function.
12094         (Output_data_const::do_print_to_mapfile): New function.
12095         (class Output_data_const_buffer): Add map_name_ field.  Update
12096         constructor.  Change all callers.  Add do_print_to_mapfile
12097         function.
12098         (class Output_data_fixed_space): Likewise.
12099         (class Output_data_space): Likewise.
12100         (class Output_data_zero_fill): New class.
12101         (Output_data_strtab::do_print_to_mapfile): New function.
12102         (Output_data_reloc_base::do_print_to_mapfile): New function.
12103         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12104         (Output_data_group::do_print_to_mapfile): New function.
12105         (Output_data_got::do_print_to_mapfile): New function.
12106         (Output_data_dynamic::do_print_to_mapfile): New function.
12107         (Output_symtab_xindex::do_print_to_mapfile): New function.
12108         (class Output_section): Declare do_print_to_mapflie.  Declare
12109         print_to_mapfile in Input_section.
12110         (class Output_segment): Declare new functions.
12111         * object.h (Sized_relobj::symbol_count): New function.
12112         * script-sections.cc
12113         (Output_section_element_dot_assignment::set_section_addresses):
12114         Change Output_data_fixed_space to Output_data_zero_fill.
12115         (Output_data_expression::do_print_to_mapfile): New function.
12116         * script.cc (read_input_script): Add mapfile parameter.  Change
12117         all callers.
12118         * script.h (read_input_script): Update declaration.
12119         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12120         (Eh_frame::do_print_to_mapfile): New function.
12121         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12122         (Output_merge_string::do_print_to_mapfile): New function.
12123         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12124         function.
12125         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12126         function.
12127         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12128         function.
12129         * Makefile.am (CCFILES): Add mapfile.cc.
12130         (HFILES): Add mapfile.h.
12131         * Makefile.in: Rebuild.
12132
12133 2008-05-19  Ian Lance Taylor  <iant@google.com>
12134
12135         * options.h (class General_options): Add -z relro.
12136         * layout.cc (Layout::Layout): Initialize relro_segment_.
12137         (Layout::add_output_section_data): Return the output section.
12138         (Layout::make_output_section): Rcognize relro sections and mark
12139         them appropriately.
12140         (Layout::attach_allocated_section_to_segment): Put relro sections
12141         in a PT_GNU_RELRO segment.
12142         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12143         section as relro.
12144         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12145         PT_TLS segments.
12146         (Layout::linkonce_mapping): Map d.rel.ro.local to
12147         .data.rel.ro.local.
12148         (Layout::output_section_name): Us .data.rel.ro.local for any
12149         section which begins with that.
12150         * layout.h (class Layout): Update add_output_section_data
12151         declaration.  Add relro_segment_ field.
12152         * output.cc (Output_section::Output_section): Initialize is_relro_
12153         and is_relro_local_ fields.
12154         (Output_segment::add_output_section): Group relro sections.
12155         (Output_segment::is_first_section_relro): New function.
12156         (Output_segment::maximum_alignment): If there is a relro section,
12157         align the segment to the common page size.
12158         (Output_segment::set_section_addresses): Track whether we are
12159         looking at relro sections.  If the last section is a relro
12160         section, align to the common page size.
12161         (Output_segment::set_section_list_addresses): Add in_relro
12162         parameter.  Change all callers.  Align to the page size when
12163         moving from relro to non-relro section.
12164         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12165         segment.
12166         * output.h (class Output_section): Add is_relro_ and
12167         is_relro_local_ fields.
12168         (Output_section::is_relro): New function.
12169         (Output_section::set_is_relro): New function.
12170         (Output_section::is_relro_local): New function.
12171         (Output_section::set_is_relro_local): New function.
12172         (class Output_segment): Update declarations.
12173         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12174         * sparc.cc (Target_sparc::got_section): Likewise.
12175         * x86_64.cc (Target_x86_64::got_section): Likewise.
12176         * testsuite/relro_test_main.cc: New file.
12177         * testsuite/relro_test.cc: New file.
12178         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12179         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12180         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12181         (relro_test.so, relro_test_pic.o): New targets.
12182         * testsuite/Makefile.in: Rebuild.
12183
12184 2008-05-16  Ian Lance Taylor  <iant@google.com>
12185
12186         * output.cc (Output_segment::add_output_section): Remove front
12187         parameter.
12188         * output.h (class Output_segment): Remove
12189         add_initial_output_section and overloaded add_output_section.
12190         Update declaration of remaining add_output_section.
12191         * layout.cc (Layout::create_interp): Call add_output_section
12192         rather than add_initial_output_section.
12193         (Layout::finish_dynamic_section): Likewise.
12194
12195         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12196         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12197         know the dynamic type.
12198         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12199         field.  Initialize it in constructor.
12200         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12201         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12202         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12203         reloc.
12204
12205         * output.cc (Output_reloc::get_address): Change return type to
12206         Elf_Addr.
12207         * output.h (class Output_reloc): Update get_address declaration.
12208         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12209         for section addresses.
12210
12211 2008-05-09  Ian Lance Taylor  <iant@google.com>
12212
12213         PR 6493
12214         * gold.cc (gold_nomem): Use return value of write.
12215
12216 2008-05-08  Ian Lance Taylor  <iant@google.com>
12217
12218         * symtab.c (Symbol::init_base_output_data): Add version
12219         parameter.  Change all callers.
12220         (Symbol::init_base_output_segment): Likewise.
12221         (Symbol::init_base_constant): Likewise.
12222         (Symbol::init_base_undefined): Likewise.
12223         (Sized_symbol::init_output_data): Likewise.
12224         (Sized_symbol::init_output_segment): Likewise.
12225         (Sized_symbol::init_constant): Likewise.
12226         (Sized_symbol::init_undefined): Likewise.
12227         (Symbol_table::do_define_in_output_data): If the new symbol has a
12228         version, mark it as the default.
12229         (Symbol_table::do_define_in_output_segment): Likewise.
12230         (Symbol_table::do_define_as_constant): Likewise.
12231         * symtab.h (class Symbol): Update declarations.
12232         (class Sized_symbol): Likewise.
12233         * resolve.cc (Symbol::override_version): New function.
12234         (Symbol::override_base): Call override_version.
12235         (Symbol::override_base_with_special): Likewise.
12236         * testsuite/ver_script_8.script: New file.
12237         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12238         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12239         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12240         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12241
12242 2008-05-06  Ian Lance Taylor  <iant@google.com>
12243
12244         PR 6049
12245         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12246         functions.
12247         (class General_options): Remove existing --undefined, and add
12248         --no-undefined instead.  Add new --undefined as synonym for -u.
12249         * archive.cc (Archive::add_symbols): Check whether symbol was
12250         named with -u.
12251         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12252         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12253         all uses.  Add IS_UNDEFINED.  Update declarations to split
12254         different versions of init_base.  Declare init_base_undefined.
12255         (Symbol::is_defined): Handle IS_UNDEFINED.
12256         (Symbol::is_undefined): Likewise.
12257         (Symbol::is_weak_undefined): Call is_undefined.
12258         (Symbol::is_absolute): Handle IS_CONSTANT.
12259         (class Sized_symbol): Update declarations to split different
12260         versions of init.  Declare init_undefined.
12261         (class Symbol_table): Declare new functions.
12262         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12263         Change all callers.
12264         (Symbol::init_base_output_data): Likewise.
12265         (Symbol::init_base_output_segment): Likewise.
12266         (Symbol::init_base_constant): Likewise.
12267         (Symbol::init_base_undefined): New function.
12268         (Sized_symbol::init_object): Rename from init.  Change all
12269         callers.
12270         (Sized_symbol::init_output_data): Likewise.
12271         (Sized_symbol::init_output_segment): Likewise.
12272         (Sized_symbol::init_constant): Likewise.
12273         (Sized_symbol::init_undefined): New function.
12274         (Symbol_table::add_undefined_symbols_from_command_line): New
12275         function.
12276         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12277         function.
12278         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12279         (Symbol::output_section): Likewise.
12280         (Symbol::set_output_section): Likewise.
12281         (Symbol_table::sized_finalize_symbol): Likewise.
12282         (Symbol_table::sized_write_globals): Likewise.
12283         * resolve.cc (Symbol_table::should_override): Likewise.
12284         (Symbol::override_base_with_special): Likewise.
12285
12286         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12287         symbol, change it to have default visibility.
12288         * testsuite/protected_1.cc: New file.
12289         * testsuite/protected_2.cc: New file.
12290         * testsuite/protected_3.cc: New file.
12291         * testsuite/protected_main_1.cc: New file.
12292         * testsuite/protected_main_2.cc: New file.
12293         * testsuite/protected_main_3.cc: New file.
12294         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12295         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12296         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12297         (protected_1.so): New target.
12298         (protected_1_pic.o, protected_2_pic.o): New targets.
12299         (protected_3_pic.o): New target.
12300         (check_PROGRAMS): Add protected_2.
12301         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12302         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12303         * testsuite/Makefile.in: Rebuild.
12304
12305         * options.h (DEFINE_var): Add set_user_set_##varname__.
12306         (DEFINE_bool_alias): New macro.
12307         (class General_options): Define -Bstatic using DEFINE_bool_alias
12308         rather than DEFINE_special.  Add --undefined as an alias for -z
12309         defs.
12310         * options.cc (General_options::parse_Bstatic): Remove.
12311
12312         * options.h (class General_options): Add --fatal-warnings.
12313         * main.cc (main): Implement --fatal-warnings.
12314         * errors.h (Errors::warning_count): New function.
12315
12316         * options.h (class General_options): Add -Bsymbolic-functions.
12317         * symtab.h (Symbol::is_preemptible): Check for
12318         -Bsymbolic-functions.
12319
12320 2008-05-05  Ian Lance Taylor  <iant@google.com>
12321
12322         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12323         as noVARNAME rather than no-VARNAME.
12324         (class General_options): Add option -z combreloc.
12325         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12326         get_address.
12327         (Output_reloc::sort_before) [SHT_REL]: New function.
12328         (Output_reloc::sort_before) [SHT_RELA]: New function.
12329         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12330         Sort_relocs_comparison.
12331         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12332         parameter.  Change all callers.
12333         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12334         sort_relocs parameter.  Change all callers.
12335         * output.cc (Output_reloc::get_address): New function, broken out
12336         of write_rel.
12337         (Output_reloc::write_rel): Call it.
12338         (Output_reloc::compare): New function.
12339         (Output_data_reloc_base::do_write): Optionally sort relocs.
12340
12341         * configure.ac: If targ_extra_obj is set, link it in.
12342         * configure.tgt: Initialize all variables.
12343         (x86_64*): Set targ_extra_obj and targ_extra_size.
12344         * configure: Rebuild.
12345
12346         * object.cc (Sized_relobj::include_section_group): Adjust section
12347         indexes read from group data.  Build vector to pass to
12348         layout_group.
12349         * layout.cc (Layout::layout_group): Add flags and shndxes
12350         parameters.  Remove contents parameter.  Change caller.  Update
12351         explicit instantiations.
12352         * layout.h (class Layout): Update layout_group declaration.
12353         * output.cc (Output_data_group::Output_data_group): Add flags and
12354         input_shndxes parameters.  Remove contents parameter.  Change
12355         caller.
12356         (Output_data_group::do_write): Change input_sections_ to
12357         input_shndxes_.
12358         * output.h (class Output_data_group): Update constructor
12359         declaration.  Rename input_sections_ to input_shndxes_.
12360         * testsuite/many_sections_test.cc: Add template.
12361
12362 2008-04-30  Cary Coutant  <ccoutant@google.com>
12363
12364         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12365
12366         * layout.cc (Layout::include_section): Refactored check for debug
12367         info section.
12368         (Layout::add_comdat): Add new parameters.  Change type
12369         of signature parameter.  Add object and shndx to signatures table.
12370         (Layout::find_kept_object): New function.
12371         * layout.h: Include <cstring>.
12372         (Layout::is_debug_info_section): New function.
12373         (Layout::add_comdat): Add new parameters.
12374         (Layout::find_kept_object): New function.
12375         (Layout::Kept_section): New struct.
12376         (Layout::Signatures): Change type of map range.
12377         * object.cc (Relobj::output_section_address): New function.
12378         (Sized_relobj::include_section_group): Add new parameters.  Change
12379         calls to Layout::add_comdat.  Change to build table of kept comdat
12380         groups and table mapping discarded sections to kept sections.
12381         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12382         (Sized_relobj::do_layout): Change calls to include_section_group and
12383         include_linkonce_section.
12384         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12385         value to zero when section is discarded.
12386         (Sized_relobj::map_to_kept_section): New function.
12387         * object.h (Relobj::output_section_address): New function.
12388         (Relobj::Comdat_group): New type.
12389         (Relobj::find_comdat_group): New function.
12390         (Relobj::Comdat_group_table): New type.
12391         (Relobj::Kept_comdat_section): New type.
12392         (Relobj::Kept_comdat_section_table): New type.
12393         (Relobj::add_comdat_group): New function.
12394         (Relobj::set_kept_comdat_section): New function.
12395         (Relobj::get_kept_comdat_section): New function.
12396         (Relobj::comdat_groups_): New field.
12397         (Relobj::kept_comdat_sections_): New field.
12398         (Symbol_value::input_value): Update comment.
12399         (Sized_relobj::map_to_kept_section) New function.
12400         (Sized_relobj::include_linkonce_section): Add new parameter.
12401         * target-reloc.h (Comdat_behavior): New type.
12402         (get_comdat_behavior): New function.
12403         (relocate_section): Add code to map a discarded section to the
12404         corresponding kept section when applying a relocation.
12405
12406 2008-04-30  Craig Silverstein  <csilvers@google.com>
12407
12408         * dwarf_reader.cc (next_generation_count): New static var.
12409         (Addr2line_cache_entry): New struct.
12410         (addr2line_cache): New static var.
12411         (Dwarf_line_info::one_addr2line): Added caching.
12412         (Dwarf_line_info::clear_addr2line_cache): New function.
12413         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12414         cache-size parameter.
12415         (Dwarf_line_info::one_addr2line_cache): New function.
12416         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12417         new cache-size argument to one_addr2line(), and clear cache.
12418
12419 2008-04-28  Cary Coutant  <ccoutant@google.com>
12420
12421         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12422         R_386_PC8 relocations.
12423
12424 2008-04-23  Ian Lance Taylor  <iant@google.com>
12425
12426         * object.cc (Sized_relobj::include_section_group): Check for
12427         invalid section group.
12428
12429         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12430         header size.
12431
12432         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12433         than read for file header.
12434         * archive.cc (Archive::include_member): Likewise.
12435
12436 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12437
12438         * aclocal.m4: Regenerate.
12439         * configure: Regenerate.
12440
12441 2008-04-19  Ian Lance Taylor  <iant@google.com>
12442
12443         * version.cc (version_string): Bump to 1.6.
12444
12445         * testsuite/Makefile.am (many_sections_r_test): New target.
12446         (many_sections_r_test_SOURCES): Remove.
12447         (many_sections_r_test_DEPENDENCIES): Remove.
12448         (many_sections_r_test_LDFLAGS): Remove.
12449         (many_sections_r_test_LDADD): Remove.
12450
12451         * object.cc (Sized_relobj::do_add_symbols): Always pass
12452         local_symbol_count_ to add_from_relobj.
12453
12454         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12455         every thousand variables.
12456         * testsuite/Makefile.in: Rebuild.
12457
12458         * object.cc (Xindex::initialize_symtab_xindex): New function.
12459         (Xindex::read_symtab_xindex): New function.
12460         (Xindex::sym_xindex_to_shndx): New function.
12461         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12462         available.
12463         (Sized_relobj::do_initialize_xindex): New function.
12464         (Sized_relobj::do_read_symbols): Adjust section links.
12465         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12466         parameter.  Change all callers.
12467         (Sized_relobj::include_section_group): Adjust section links and
12468         symbol section indexes.
12469         (Sized_relobj::do_layout): Adjust section links.
12470         (Sized_relobj::do_count_local_symbols): Adjust section links and
12471         symbol section indexes.
12472         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12473         ordinary and special symbols.
12474         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12475         dynsym_xindex parameters.  Change all callers.  Adjust section
12476         links.  Use SHN_XINDEX when needed.
12477         (Sized_relobj::get_symbol_location_info): Adjust section links.
12478         Don't get fooled by special symbols.
12479         * object.h (class Xindex): Define.
12480         (class Object): Add xindex_ parameter.  Declare virtual functoin
12481         do_initialize_xindex.
12482         (Object::adjust_sym_shndx): New function.
12483         (Object::set_xindex): New protected function.
12484         (class Symbol_value): Add is_ordinary_shndx_ field.
12485         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12486         (Symbol_value::value): Assert ordinary section.
12487         (Symbol_value::initialize_input_to_output_map): Likewise.
12488         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12489         Change all callers.
12490         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12491         all callers.
12492         (class Sized_relobj): Update declarations.
12493         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12494         parameter.  Change all callers.
12495         (Sized_relobj::adjust_shndx): New function.
12496         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12497         field.
12498         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12499         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12500         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12501         (Sized_dynobj::read_dynsym_section): Adjust section links.
12502         (Sized_dynobj::read_dynamic): Likewise.
12503         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12504         section links.
12505         (Sized_dynobj::do_initialize_xindex): New function.
12506         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12507         do_initialize_xindex.
12508         (Sized_dynobj::adjust_shndx): New function.
12509         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12510         dynsym_xindex_ fields.
12511         (Layout::finalize): Add a call to set_section_indexes before
12512         creating the symtab sections.
12513         (Layout::set_section_indexes): Don't do anything if the section
12514         already has a section index.
12515         (Layout::create_symtab_sections): Add shnum parameter.  Change
12516         caller.  Create .symtab_shndx section if needed.
12517         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12518         caller.
12519         (Layout::allocated_output_section_count): New function.
12520         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12521         needed.
12522         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12523         fields.  Update declarations.
12524         (Layout::symtab_xindex): New function.
12525         (Layout::dynsym_xindex): New function.
12526         (class Write_symbols_task): Add layout_ field.
12527         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12528         Change caller.
12529         * output.cc (Output_section_headers::Output_section_headers): Add
12530         shstrtab_section parameter.  Change all callers.
12531         (Output_section_headers::do_sized_write): Store overflow values
12532         for section count and section string table section index in
12533         section header zero.
12534         (Output_file_header::do_sized_write): Check for overflow of
12535         section count and section string table section index.
12536         (Output_symtab_xindex::do_write): New function.
12537         (Output_symtab_xindex::endian_do_write): New function.
12538         * output.h (class Output_section_headers): Add shstrtab_section_.
12539         Update declarations.
12540         (class Output_symtab_xindex): Define.
12541         (Output_section::has_out_shndx): New function.
12542         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12543         field.
12544         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12545         Change all callers.
12546         (Sized_symbol::init): Likewise.
12547         (Symbol::output_section): Check for ordinary symbol.
12548         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12549         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12550         callers.
12551         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12552         Change all callers.  Simplify handling of symbols from sections
12553         not included in the link.
12554         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12555         distinction.
12556         (Weak_alias_sorter::operator()): Assert that symbols are
12557         ordinary.
12558         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12559         distinction.
12560         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12561         parameters.  Change all callers.
12562         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12563         symbol distinction.  Use SHN_XINDEX when needed.
12564         (Symbol_table::write_section_symbol): Add symtab_xindex
12565         parameter.  Change all callers.
12566         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12567         SHN_XINDEX when needed.
12568         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12569         declarations.
12570         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12571         (Symbol::is_defined): Check is_ordinary.
12572         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12573         (Symbol::is_absolute, Symbol::is_common): Likewise.
12574         (class Sized_symbol): Update declarations.
12575         (class Symbol_table): Update declarations.
12576         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12577         parameters.  Change all callers.
12578         (Sized_symbol::override): Likewise.
12579         (Symbol_table::override): Likewise.
12580         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12581         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12582         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12583         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12584         to be in an ordinary section.
12585         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12586         object and is_ordinary parameters.  Change all callers.
12587         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12588         Change all callers.  Don't add undefined or non-ordinary symbols
12589         to reloc_map_.
12590         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12591         Change all callers.
12592         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12593         declarations.
12594         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12595         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12596         (Sized_relobj::relocate_sections): Likewise.
12597         * target-reloc.h (scan_relocs): Adjust section symbol index.
12598         (scan_relocatable_relocs): Likewise.
12599         * i386.cc (Scan::local): Check for ordinary symbols.
12600         * sparc.cc (Scan::local): Likewise.
12601         * x86_64.cc (Scan::local): Likewise.
12602         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12603         to symbol_section_and_value.
12604         * testsuite/many_sections_test.cc: New file.
12605         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12606         (check_PROGRAMS): Add many_sections_test.
12607         (many_sections_test_SOURCES): Define.
12608         (many_sections_test_DEPENDENCIES): Define.
12609         (many_sections_test_LDFLAGS): Define.
12610         (BUILT_SOURCES): Add many_sections_define.h.
12611         (many_sections_define.h): New target.
12612         (BUILT_SOURCES): Add many_sections_check.h.
12613         (many_sections_check.h): New target.
12614         (check_PROGRAMS): Add many_sections_r_test.
12615         (many_sections_r_test_SOURCES): Define.
12616         (many_sections_r_test_DEPENDENCIES): Define.
12617         (many_sections_r_test_LDFLAGS): Define.
12618         (many_sections_r_test_LDADD): Define.
12619         (many_sections_r_test.o): New target.
12620         * testsuite/Makefile.in: Rebuild.
12621
12622 2008-04-17  Cary Coutant  <ccoutant@google.com>
12623
12624         * errors.cc (Errors::info): New function.
12625         (gold_info): New function.
12626         * errors.h (Errors::info): New function.
12627         * gold.h (gold_info): New function.
12628         * object.cc (Input_objects::add_object): Print trace output.
12629         * options.cc (options::parse_set): New function.
12630         (General_options::parse_wrap): Deleted.
12631         (General_options::General_options): Deleted initializer.
12632         * options.h (options::String_set): New typedef.
12633         (options::parse_set): New function.
12634         (DEFINE_set): New macro.
12635         (General_options::wrap): Changed to use DEFINE_set. Changed
12636         callers of any_wrap_symbols and is_wrap_symbol.
12637         (General_options::trace, General_options::trace_symbol):
12638         New options.
12639         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12640         (General_options::wrap_symbols_): Deleted.
12641         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12642
12643 2008-04-17  David S. Miller  <davem@davemloft.net>
12644
12645         * options.cc (General_options::parse_V): New function.
12646         * options.h: Add entries for -V and -Qy.
12647
12648 2008-04-17  Ian Lance Taylor  <iant@google.com>
12649
12650         * common.cc (Symbol_table::allocate_commons): Remove options
12651         parameter.  Change caller.
12652         (Symbol_table::do_allocate_commons): Remove options parameter.
12653         Change caller.  Just call do_allocate_commons_list twice.
12654         (Symbol_table::do_allocate_commons_list): New function, broken out
12655         of do_allocate_commons.
12656         * common.h (class Allocate_commons_task): Remove options_ field.
12657         Update constructor.
12658         * symtab.cc (Symbol_table::Symbol_table): Initialize
12659         tls_commons_.
12660         (Symbol_table::add_from_object): Put TLS common symbols on
12661         tls_commons_ list.
12662         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12663         which are IN_OUTPUT_DATA.
12664         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12665         allocate_commons and do_allocate_commons declarations.  Declare
12666         do_allocate_commons_list.
12667         * gold.cc (queue_middle_tasks): Update creation of
12668         Allocate_commons_task to not pass options.
12669         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12670         (TLS_TEST_C_FLAGS): New variable.
12671         (tls_test_c_pic.o): New target.
12672         (tls_test_shared.so): Link in tls_test_c_pic.o.
12673         (tls_test_c_pic_ie.o): New target.
12674         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12675         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12676         (tls_test_c.o): New target.
12677         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12678         (tls_pic_test_LDADD): Likewise.
12679         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12680         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12681         (tls_test_c_gnu2.o): New target.
12682         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12683         tls_test_c_gnu2.o.
12684         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12685         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12686         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12687         * testsuite/tls_test.cc: Include "config.h".
12688         (t_last): Call t11_last.
12689         * testsuite/tls_test.h (t11, t11_last): Declare.
12690         * testsuite/tls_test_c.c: New file.
12691         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12692         * configure.ac: Check for OpenMP support.
12693         * configure, config.in, Makefile.in: Rebuild.
12694         * testsuite/Makefile.in: Rebuild.
12695
12696 2008-04-16  Cary Coutant  <ccoutant@google.com>
12697
12698         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12699         (Target_i386::tls_base_symbol_defined_): New field.
12700         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12701         (Target_i386::Scan::global): Likewise.
12702         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12703         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12704         (Target_x86_64::tls_base_symbol_defined_): New field.
12705         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12706         (Target_x86_64::Scan::global): Likewise.
12707
12708 2008-04-16  Cary Coutant  <ccoutant@google.com>
12709
12710         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12711         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12712         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12713         building shared libraries.
12714         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12715         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12716         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12717         * testsuite/Makefile.in: Rebuild.
12718         * testsuite/weak_undef.h: New file.
12719         * testsuite/weak_undef_file1.cc: Add extra test cases.
12720         * testsuite/weak_undef_file2.cc: Likewise.
12721         * testsuite/weak_undef_test.cc: Likewise.
12722
12723 2008-04-16  David S. Miller  <davem@davemloft.net>
12724
12725         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12726         Add issued_non_pic_error_ field.  Declare check_non_pic.
12727         (Target_sparc::Scan::check_non_pic): New function.
12728         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12729         (Target_sparc::Scan::global): Likewise.
12730
12731         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12732         * configure: Rebuild.
12733
12734         * options.h (DEFINE_enable): New macro.
12735         (new_dtags): New enable option.
12736         (initfirst, interpose, loadfltr, nodefaultlib,
12737         nodelete, nodlopen, nodump): New -z options.
12738         * layout.cc (Layout:finish_dynamic_section): If new
12739         dtags enabled, emit DT_RUNPATH.  Also, emit a
12740         DT_FLAGS_1 containing any specified -z flags.
12741
12742 2008-04-16  Ian Lance Taylor  <iant@google.com>
12743
12744         * copy-relocs.cc: New file.
12745         * copy-relocs.h: New file.
12746         * reloc.cc: Remove Copy_relocs code.
12747         * reloc.h: Likewise.
12748         * reloc-types.h (struct Reloc_types) [both versions]: Add
12749         get_reloc_addend_noerror.
12750         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12751         variants of add_global which take an addend which must be zero.
12752         * i386.cc: Include "copy-relocs.h".
12753         (class Target_i386): Change type of copy_relocs_ to variable,
12754         update initializer.
12755         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12756         Change all callers.
12757         (Target_i386::do_finalize_sections): Change handling of
12758         copy_relocs_.
12759         * sparc.cc: Include "copy-relocs.h".
12760         (class Target_sparc): Change type of copy_relocs_ to variable,
12761         update initializer.
12762         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12763         Change all callers.
12764         (Target_sparc::do_finalize_sections): Change handling of
12765         copy_relocs_.
12766         * x86_64.cc: Include "copy-relocs.h".
12767         (class Target_x86_64): Change type of copy_relocs_ to variable,
12768         update initializer.
12769         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12770         class.  Change all callers.
12771         (Target_x86_64::do_finalize_sections): Change handling of
12772         copy_relocs_.
12773         * Makefile.am (CCFILES): Add copy-relocs.cc.
12774         (HFILES): Add copy-relocs.h.
12775
12776         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12777
12778         * testsuite/script_test_4.sh: Permit leading zeroes.
12779
12780 2008-04-15  Ian Lance Taylor  <iant@google.com>
12781
12782         * script-sections.cc (Script_sections::create_segments): Use
12783         header_size_adjustment even when there is enough room for the
12784         headers.
12785         * testsuite/script_test_4.sh: New file.
12786         * testsuite/script_test_4.t: New file.
12787         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12788         (check_DATA): Add script_test_4.stdout.
12789         (MOSTLYCLEANFILES): Likewise.
12790         (script_test_4): New target.
12791         (script_test_4.stdout): New target.
12792         * testsuite/Makefile.in: Rebuild.
12793
12794         * sparc.cc: Add definitions for Output_data_plt_sparc class
12795         constants.
12796
12797 2008-04-14  David S. Miller  <davem@davemloft.net>
12798
12799         * sparc.cc: New file.
12800         * Makefile.am (TARGETSOURCES): Add sparc.cc
12801         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12802         * configure.tgt: Document targ_extra_size and
12803         targ_extra_big_endian.  Add entries for sparc-* and
12804         sparc64-*.
12805         * configure.ac: Handle targ_extra_size and
12806         targ_extra_big_endian.
12807         * Makefile.in: Rebuild.
12808         * configure: Likewise.
12809         * po/POTFILES.in: Likewise.
12810         * po/gold.pot: Likewise.
12811
12812 2008-04-14  Ian Lance Taylor  <iant@google.com>
12813
12814         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12815         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12816         in the name/type/flags to section mapping.  Don't call
12817         allocate_output_section.
12818         (Layout::choose_output_section): Change parameter from adjust_name
12819         to is_input_section.  Don't permit input sections after sections
12820         are attached to segments.  Don't call allocate_output_section.
12821         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12822         not write_enable_output_section.
12823         (Layout::make_output_section): Don't push to
12824         unattached_section_list_ nor call attach_to_segment.  Call
12825         attach_section_to_segment if sections are attached.
12826         (Layout::attach_sections_to_segments): New function.
12827         (Layout::attach_section_to_segment): New function.
12828         (Layout::attach_allocated_section_to_segment): Rename from
12829         attach_to_segment.  Remove flags parameter.
12830         (Layout::allocate_output_section): Remove function.
12831         (Layout::write_enable_output_section): Remove function.
12832         * layout.h (class Layout): Update for above changes.  Add new
12833         field sections_are_attached_.
12834         * output.h (Output_section::update_flags_for_input_section): New
12835         function.
12836         * output.cc (Output_section::add_input_section): Call
12837         update_flags_for_input_section.
12838         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12839
12840 2008-04-11  Cary Coutant  <ccoutant@google.com>
12841
12842         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12843         thought unnecessary.
12844         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12845
12846 2008-04-11  Ian Lance Taylor  <iant@google.com>
12847
12848         * output.h (class Output_section_data): Remove inline definition
12849         of set_addralign.
12850         * output.cc (Output_section_data::set_addralign): New function.
12851
12852 2008-04-11  Cary Coutant  <ccoutant@google.com>
12853
12854         Add support for TLS descriptors for i386 and x86_64.
12855         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12856         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12857         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12858         GOT_TYPE_TLS_DESC.
12859         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12860         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12861         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12862         relocations.
12863         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12864         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12865         Fix problem with initial-exec relocations.
12866         (Target_i386::Relocate::relocate_tls): Likewise.
12867         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12868         relaxation.
12869         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12870         support for section-plus-offset dynamic table entries.
12871         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12872         (Output_data_dynamic::Dynamic_entry): Add support for
12873         section-plus-offset dynamic table entries.
12874         (Output_data_dynamic::Classification): Likewise.
12875         (Output_data_dynamic::classification_): Renamed offset_.
12876         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12877         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12878         (Target_x86_64::make_plt_section): New function.
12879         (Target_x86_64::reserve_tlsdesc_entries): New function.
12880         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12881         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12882         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12883         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12884         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12885         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12886         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12887         add extra PLT entry for TLS descriptors.
12888         (Output_data_plt_x86_64::got_): New field.
12889         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12890         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12891         fields.
12892         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12893         descriptors.
12894         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12895         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12896         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12897         R_386_TLS_DESC_CALL relocations.
12898         (Target_x86_64::Scan::global): Likewise.
12899         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12900         for TLS descriptors.
12901         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12902         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12903         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12904         GD-to-IE relaxation.
12905         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12906         and TLS_DESCRIPTORS.
12907         * Makefile.in: Rebuild.
12908         * configure: Rebuild.
12909         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12910         (tls_test_shared2.so): New target.
12911         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12912         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12913         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12914         (tls_shared_gd_to_ie_test_LDADD): New variable.
12915         (tls_shared_gnu2_gd_to_ie_test): New target.
12916         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12917         New targets.
12918         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12919         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12920         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12921         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12922         (tls_shared_gnu2_test): New target.
12923         (tls_test_gnu2_shared.so): New target.
12924         (tls_shared_gnu2_test_SOURCES): New variable.
12925         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12926         (tls_shared_gnu2_test_LDFLAGS): New variable.
12927         (tls_shared_gnu2_test_LDADD): New variable.
12928         * testsuite/Makefile.in: Rebuild.
12929         * testsuite/Makefile.
12930
12931 2008-04-11  Ian Lance Taylor  <iant@google.com>
12932
12933         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12934         justsyms.t.
12935         * testsuite/Makefile.in: Rebuild.
12936
12937         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12938         long.
12939         * testsuite/script_test_2.cc (main): Adjust test.
12940
12941 2008-04-11  David S. Miller  <davem@davemloft.net>
12942             Ian Lance Taylor  <iant@google.com>
12943
12944         * options.h (General_options): Add entries for '-Y' and
12945         '-relax'.
12946         * options.cc (General_options:finalize): If -Y was used, add those
12947         entries to the library path instead of the default "/lib" and
12948         "/usr/lib".
12949
12950 2008-04-11  David S. Miller  <davem@davemloft.net>
12951
12952         * testsuite/justsyms.t: Start at 0x100.
12953         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12954         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12955         long.
12956         * testsuite/script_test_2.cc: Adjust string and section length
12957         checks.
12958
12959 2008-04-09  Ian Lance Taylor  <iant@google.com>
12960
12961         PR gold/5996
12962         * script-sections.cc (Sections_element::allocate_to_segment): Add
12963         orphan parameter.
12964         (Output_section_definition::allocate_to_segment): Likewise.
12965         (Orphan_output_section::allocate_to_segment): Likewise.
12966         (Script_sections::attach_sections_using_phdrs_clause): Don't
12967         propagate non-PT_LOAD segments to orphan sections.
12968         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12969         readelf rather than objdump.
12970         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12971         .interp section and PT_INTERP segment are the same size.
12972         * testsuite/Makefile.in: Rebuild.
12973
12974         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12975         aliases for symbols defined in the same object.
12976         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12977         (weak_alias_test_SOURCES): New variable.
12978         (weak_alias_test_DEPENDENCIES): New variable.
12979         (weak_alias_test_LDFLAGS): New variable.
12980         (weak_alias_test_LDADD): New variable.
12981         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12982         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12983         (weak_alias_test_3.o): New target.
12984         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12985         * testsuite/weak_alias_test_main.cc: New file.
12986         * testsuite/weak_alias_test_1.cc: New file.
12987         * testsuite/weak_alias_test_2.cc: New file.
12988         * testsuite/weak_alias_test_3.cc: New file.
12989
12990 2008-04-08  Ian Lance Taylor  <iant@google.com>
12991
12992         * options.h (class General_options): Add --noinhibit-exec option.
12993         * main.cc (main): Check --noinhibit-exec.
12994
12995         * options.h (class General_options): Define --wrap as a special
12996         option.  Add wrap_symbols_ field.
12997         (General_options::any_wrap_symbols): New function.
12998         (General_options::is_wrap_symbol): New function.
12999         * options.cc (General_options::parse_wrap): New function.
13000         (General_options::General_options): Initialize wrap_symbols_.
13001         * symtab.cc (Symbol_table::wrap_symbol): New function.
13002         (Symbol_table::add_from_object): Handle --wrap.
13003         * symtab.h (class Symbol_table): Declare wrap_symbol.
13004         * target.h (Target::wrap_char): New function.
13005         (Target::Target_info): Add wrap_char field.
13006         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13007         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13008         * testsuite/testfile.cc (Target_test::test_target_info):
13009         Likewise.
13010
13011         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13012         there is one.
13013
13014         * layout.h (class Layout): Add added_eh_frame_data_ field.
13015         * layout.cc (Layout::Layout): Initialize new field.
13016         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13017         output section until we find a section we merged successfully.
13018         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13019         that the size be non-zero.
13020
13021         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13022         qualifier.
13023
13024 2008-04-08  Craig Silverstein  <csilvers@google.com>
13025
13026         * configure.ac: Export new conditional variable HAVE_ZLIB.
13027         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13028         on HAVE_ZLIB.
13029         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13030         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13031
13032 2008-04-07  Ian Lance Taylor  <iant@google.com>
13033
13034         * version.cc (version_string): Set to "1.5".
13035
13036         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13037         Add issued_non_pic_error_ field.  Declare check_non_pic.
13038         (Target_x86_64::Scan::check_non_pic): New function.
13039         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13040         (Target_x86_64::Scan::global): Likewise.
13041
13042         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13043         addend parameter.  Change caller.  Handle merge sections.
13044         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13045         Address to Addend.  Don't add in the result of
13046         local_section_offset, pass down the addend and use the returned
13047         value.
13048         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13049         Update declarations of local_section_offset and symbol_value.
13050         * testsuite/two_file_test_1.cc (t18): New function.
13051         * testsuite/two_file_test_2.cc (f18): New function.
13052         * testsuite/two_file_test_main.cc (main): Call t18.
13053         * testsuite/two_file_test.h (t18, f18): Declare.
13054
13055         * configure.ac: Don't test for objdump, c++filt, or readelf.
13056         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13057         conditionals.
13058         (TEST_READELF): New variable.
13059         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13060         (check_PROGRAMS): Add two_file_strip_test.
13061         (two_file_strip_test): New target.
13062         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13063         (two_file_same_shared_strip_test_SOURCES): New variable.
13064         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13065         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13066         (two_file_same_shared_strip_test_LDADD): New variable.
13067         (two_file_shared_strip.so): New target.
13068         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13069         (ver_test_5.syms, ver_test_7.syms): Likewise.
13070         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13071         (strip_test_3.stdout): Use TEST_OBJDUMP.
13072         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13073
13074 2008-04-04  Cary Coutant  <ccoutant@google.com>
13075
13076         * symtab.h (Symbol::is_weak_undefined): New function.
13077         (Symbol::is_strong_undefined): New function.
13078         (Symbol::is_absolute): New function.
13079         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13080         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13081         absolute symbols.
13082         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13083         (weak_undef_test): New target.
13084         * testsuite/Makefile.in: Rebuild.
13085         * testsuite/weak_undef_file1.cc: New file.
13086         * testsuite/weak_undef_file2.cc: New file.
13087         * testsuite/weak_undef_test.cc: New file.
13088
13089 2008-04-03  Craig Silverstein  <csilvers@google.com>
13090
13091         * compressed_output.h (class Output_compressed_section): Use
13092         unsigned buffer.
13093         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13094         add zlib header.
13095         (zlib_compressed_suffix): Removed.
13096         (Output_compressed_section::set_final_data_size): Use unsigned
13097         buffers.
13098         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13099         Fix linker invocation.
13100         (flagstest_o_specialfile_and_compress_debug_sections):
13101         Likewise.
13102         * testsuite/Makefile.in: Regenerated.
13103
13104 2008-04-02  David S. Miller  <davem@davemloft.net>
13105
13106         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13107         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13108
13109 2008-04-02  Craig Silverstein  <csilvers@google.com>
13110
13111         * TODO: New file.
13112
13113 2008-04-02  Ian Lance Taylor  <iant@google.com>
13114
13115         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13116         parameters.  Update for new key type to views_.  Change all
13117         callers.
13118         (File_read::read): Adjust for byteshift in returned view.
13119         (File_read::add_view): New function, broken out of
13120         find_and_make_view.
13121         (File_read::make_view): New function, broken out of
13122         find_and_make_view.
13123         (File_read::find_or_make_view): Add offset and aligned
13124         parameters.  Rewrite accordingly.  Change all callers.
13125         (File_read::get_view): Add offset and aligned parameters.  Adjust
13126         for byteshift in return value.
13127         (File_read::get_lasting_view): Likewise.
13128         * fileread.h (class File_read): Update declarations.
13129         (class File_read::View): Add byteshift_ field.  Add byteshift to
13130         constructor.  Add byteshift method.
13131         * archive.h (Archive::clear_uncached_views): New function.
13132         (Archive::get_view): Add aligned parameter.  Change all callers.
13133         * object.h (Object::get_view): Add aligned parameter.  Change all
13134         callers.
13135         (Object::get_lasting_view): Likewise.
13136
13137         * fileread.cc (File_read::release): Don't call clear_views if
13138         there are multiple objects.
13139         * fileread.h (File_read::clear_uncached_views): New function.
13140         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13141         on the archive.
13142
13143 2008-03-31  Cary Coutant  <ccoutant@google.com>
13144
13145         Add thin archive support.
13146         * archive.cc (Archive::armagt): New const.
13147         (Archive::setup): Remove task parameter and calls to unlock.
13148         (Archive::unlock_nested_archives): New function.
13149         (Archive::read_header): Add nested_off parameter. Change
13150         all callers.
13151         (Archive::interpret_header): Likewise.
13152         (Archive::include_all_members): Change to handle thin
13153         archives.
13154         (Archive::include_member): Likewise.
13155         * archive.h (Archive::Archive): Add new parameters and
13156         initializers.
13157         (Archive::armagt): New const.
13158         (Archive::setup): Remove task parameter.
13159         (Archive::unlock_nested_archives): New function.
13160         (Archive::read_header): Add nested_off parameter.
13161         (Archive::interpret_header): Likewise.
13162         (Archive::Nested_archive_table): New typedef.
13163         (Archive::is_thin_archive_): New field.
13164         (Archive::nested_archives_): New field.
13165         (Archive::options_): New field.
13166         (Archive::dirpath_): New field.
13167         (Archive::task_): New field.
13168         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13169         for thin archives.  Pass additional parameters to
13170         Archive::Archive.  Unlock the archive file after calling
13171         Archive::setup.
13172
13173 2008-03-29  Ian Lance Taylor  <iant@google.com>
13174
13175         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13176         version symbol to be local.
13177         * testsuite/ver_test_4.sh: New file.
13178         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13179         (check_DATA): Add ver_test_4.syms.
13180         (ver_test_4.syms): New target.
13181         * testsuite/Makefile.in: Rebuild.
13182
13183         * output.cc
13184         (Output_section::Input_section_sort_entry::has_priority): New
13185         function.
13186         (Output_section::Input_section_sort_entry::match_file_name): New
13187         function.
13188         (Output_section::Input_section_sort_entry::match_section_name):
13189         Remove.
13190         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13191         Remove.
13192         (Output_section::Input_section_sort_entry::match_section_file):
13193         Remove.
13194         (Output_section::Input_section_sort_compare::operator()): Rewrite
13195         using new Input_section_sort_entry functions.  Sort crtbegin and
13196         crtend first.  Sort sections with no priority before sections with
13197         a priority.
13198         * testsuite/initpri1.c (d3): Check j != 4.
13199         (cd5): New constructor/destructor function.
13200         (main): Check j != 2.
13201
13202         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13203         new symbol when resolving, don't call set_is_default.
13204         * testsuite/ver_test_7.cc: New file.
13205         * testsuite/ver_test_7.sh: New file.
13206         * testsuite/Makefile.am (ver_test_7.so): New target.
13207         (ver_test_7.o): New target.
13208         (check_SCRIPTS): Add ver_test_7.sh.
13209         (check_DATA): Add ver_test_7.syms.
13210         (ver_test_7.syms): New target.
13211
13212 2008-03-28  Ian Lance Taylor  <iant@google.com>
13213
13214         * layout.cc (Layout::layout): If we see an input section with a
13215         name that needs sorting, set the must_sort flag for the output
13216         section.
13217         (Layout::make_output_section): If the name of the output section
13218         indicates that it might require sorting, set the may_sort flag.
13219         * output.h (Output_section::may_sort_attached_input_sections): New
13220         function.
13221         (Output_section::set_may_sort_attached_input_sections): New
13222         function.
13223         (Output_section::must_sort_attached_input_sections): New
13224         function.
13225         (Output_section::set_must_sort_attached_input_sections): New
13226         function.
13227         (class Output_section): Declare Input_section_sort_entry.  Define
13228         Input_section_sort_compare.  Declare
13229         sort_attached_input_sections.  Add new fields:
13230         may_sort_attached_input_sections_,
13231         must_sort_attached_input_sections_,
13232         attached_input_sections_are_sorted_.
13233         * output.cc (Output_section::Output_section): Initialize new
13234         fields.
13235         (Output_section::add_input_section): Add an entry to
13236         input_sections_ if may_sort or must_sort are true.
13237         (Output_section::set_final_data_size): Call
13238         sort_attached_input_sections if necessary.
13239         (Output_section::Input_section_sort_entry): Define new class.
13240         (Output_section::Input_section_sort_compare::operator()): New
13241         function.
13242         (Output_section::sort_attached_input_sections): New function.
13243         * configure.ac: Check whether the compiler supports constructor
13244         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13245         * testsuite/initpri1.c: New file.
13246         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13247         CONSTRUCTOR_PRIORITY.
13248         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13249         (initpri1_LDFLAGS): New variable.
13250         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13251
13252 2008-03-27  Ian Lance Taylor  <iant@google.com>
13253
13254         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13255         * testsuite/common_test_1.c: New file.
13256         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13257         (common_test_1_SOURCES): New variable.
13258         (common_test_1_DEPENDENCIES): New variable.
13259         (common_test_1_LDFLAGS): New variable.
13260
13261         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13262         and commons_ correctly when NAME/VERSION does not override
13263         NAME/NULL.
13264         * testsuite/ver_test_6.c: New file.
13265         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13266         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13267         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13268
13269 2008-03-26  Ian Lance Taylor  <iant@google.com>
13270
13271         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13272         of an undefined symbol from a version script.
13273         * testsuite/Makefile.am (ver_test_5.so): New target.
13274         (ver_test_5.o): New target.
13275         (check_SCRIPTS): Add ver_test_5.sh.
13276         (check_DATA): Add ver_test_5.syms.
13277         (ver_test_5.syms): New target.
13278         * testsuite/ver_test_5.cc: New file.
13279         * testsuite/ver_test_5.script: New file.
13280         * testsuite/ver_test_5.sh: New file.
13281         * Makefile.in, testsuite/Makefile.in: Rebuild.
13282
13283         PR gold/5986
13284         Fix problems building gold with gcc 4.3.0.
13285         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13286         (gold_error_at_location, gold_warning_at_location): Use it.
13287         * configure.ac: Check whether we can compile and use a template
13288         function with a printf attribute.
13289         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13290         when jumping over bytes.
13291         * object.cc: Instantiate Object::read_section_data.
13292         * debug.h: Include <cstring>
13293         * dwarf_reader.cc: Include <algorithm>
13294         * main.cc: Include <cstring>.
13295         * options.cc: Include <cstring>.
13296         * output.cc: Include <cstring>.
13297         * script.cc: Include <cstring>.
13298         * script.h: Include <string>.
13299         * symtab.cc: Include <cstring> and <algorithm>.
13300         * target-select.cc: Include <cstring>.
13301         * version.cc: Include <string>.
13302         * testsuite/testmain.cc: Include <cstdlib>.
13303         * configure, config.in: Rebuild.
13304
13305 2008-03-25  Ian Lance Taylor  <iant@google.com>
13306
13307         * options.cc: Include "../bfd/bfdver.h".
13308         (options::help): Print bug reporting address.
13309
13310         * version.cc (print_version): Adjust output for current value of
13311         BFD_VERSION_STRING.
13312
13313         * NEWS: New file.
13314
13315         * options.cc (options::help): Print list of supported targets.
13316         * target-select.h: Include <vector>.
13317         (class Target_selector): Make machine_, size_, and is_big_endian_
13318         fields const.  Add bfd_name_ and instantiated_target_ fields.
13319         (Target_selector::Target_selector): Add bfd_name parameter.
13320         (Target_selector::recognize): Make non-virtual, call
13321         do_recognize.
13322         (Target_selector::recognize_by_name): Make non-virtual, call
13323         do_recognize_by_name.
13324         (Target_selector::supported_names): New function.
13325         (Target_selector::bfd_name): New function.
13326         (Target_selector::do_instantiate_target): New pure virtual
13327         function.
13328         (Target_selector::do_recognize): New virtual function.
13329         (Target_selector::do_recognize_by_name): New virtual function.
13330         (Target_selector::instantiate_target): New private function.
13331         (supported_target_names): Declare.
13332         * target-select.cc (Target_selector::Target_selector): Update for
13333         new parameter and fields.
13334         (select_target_by_name): Check that the name matches before
13335         calling recognize_by_name.
13336         (supported_target_names): New function.
13337         * i386.cc (class Target_selector_i386): Update Target_selector
13338         constructor call.  Remove recognize and recognize_by_name.  Add
13339         do_instantiate_target.
13340         * x86_64.cc (class Target_selector_x86_64): Likewise.
13341         * testsuite/testfile.cc (class Target_selector_test): Update for
13342         changes to Target_selector.
13343
13344         * README: Rewrite, with some notes on unsupported features.
13345
13346 2008-03-24  Cary Coutant  <ccoutant@google.com>
13347
13348         * i386.cc (Target_i386::Got_type): New enum declaration.
13349         (Target_i386::Scan::local): Updated callers of Output_data_got
13350         member functions.
13351         (Target_i386::Scan::global): Likewise.
13352         (Target_i386::Relocate::relocate): Likewise.
13353         (Target_i386::Relocate::relocate_tls): Likewise.
13354         * object.h (Got_offset_list): New class.
13355         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13356         (Sized_relobj::local_got_offset): Likewise.
13357         (Sized_relobj::set_local_got_offset): Likewise.
13358         (Sized_relobj::local_has_tls_got_offset): Removed.
13359         (Sized_relobj::local_tls_got_offset): Removed.
13360         (Sized_relobj::set_local_tls_got_offset): Removed.
13361         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13362         * output.cc (Output_data_got::add_global): Added got_type parameter.
13363         (Output_data_got::add_global_with_rel): Likewise.
13364         (Output_data_got::add_global_with_rela): Likewise.
13365         (Output_data_got::add_global_pair_with_rel): New function.
13366         (Output_data_got::add_global_pair_with_rela): New function.
13367         (Output_data_got::add_local): Added got_type parameter.
13368         (Output_data_got::add_local_with_rel): Likewise.
13369         (Output_data_got::add_local_with_rela): Likewise.
13370         (Output_data_got::add_local_pair_with_rel): New function.
13371         (Output_data_got::add_local_pair_with_rela): New function.
13372         (Output_data_got::add_global_tls): Removed.
13373         (Output_data_got::add_global_tls_with_rel): Removed.
13374         (Output_data_got::add_global_tls_with_rela): Removed.
13375         (Output_data_got::add_local_tls): Removed.
13376         (Output_data_got::add_local_tls_with_rel): Removed.
13377         (Output_data_got::add_local_tls_with_rela): Removed.
13378         * output.h (Output_data_got::add_global): Added got_type parameter.
13379         (Output_data_got::add_global_with_rel): Likewise.
13380         (Output_data_got::add_global_with_rela): Likewise.
13381         (Output_data_got::add_global_pair_with_rel): New function.
13382         (Output_data_got::add_global_pair_with_rela): New function.
13383         (Output_data_got::add_local): Added got_type parameter.
13384         (Output_data_got::add_local_with_rel): Likewise.
13385         (Output_data_got::add_local_with_rela): Likewise.
13386         (Output_data_got::add_local_pair_with_rel): New function.
13387         (Output_data_got::add_local_pair_with_rela): New function.
13388         (Output_data_got::add_global_tls): Removed.
13389         (Output_data_got::add_global_tls_with_rel): Removed.
13390         (Output_data_got::add_global_tls_with_rela): Removed.
13391         (Output_data_got::add_local_tls): Removed.
13392         (Output_data_got::add_local_tls_with_rel): Removed.
13393         (Output_data_got::add_local_tls_with_rela): Removed.
13394         * resolve.cc (Symbol::override_base_with_special): Removed
13395         reference to has_got_offset_ field.
13396         * symtab.cc (Symbol::init_fields): Replaced initialization
13397         of got_offset_ with got_offsets_.  Removed initialization
13398         of has_got_offset_
13399         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13400         (Symbol::got_offset): Likewise.
13401         (Symbol::set_got_offset): Likewise.
13402         (Symbol::has_tls_got_offset): Removed.
13403         (Symbol::tls_got_offset): Removed.
13404         (Symbol::set_tls_got_offset): Removed.
13405         (Symbol::got_offset_): Removed.
13406         (Symbol::tls_mod_got_offset_): Removed.
13407         (Symbol::tls_pair_got_offset_): Removed.
13408         (Symbol::got_offsets_): New field.
13409         (Symbol::has_got_offset): Removed.
13410         (Symbol::has_tls_mod_got_offset): Removed.
13411         (Symbol::has_tls_pair_got_offset): Removed.
13412         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13413         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13414         member functions.
13415         (Target_x86_64::Scan::global): Likewise.
13416         (Target_x86_64::Relocate::relocate): Likewise.
13417         (Target_x86_64::Relocate::relocate_tls): Likewise.
13418
13419 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13420
13421         * yyscript.y: Fix spelling error in comment.
13422
13423 2008-03-24  Ian Lance Taylor  <iant@google.com>
13424
13425         * options.h (class General_options): Define build_id option.
13426         * layout.h (class Layout): Declare write_build_id, create_note,
13427         create_build_id.  Add build_id_note_ member.
13428         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13429         "libiberty.h", "md5.h", "sha1.h".
13430         (Layout::Layout): Initialize eh_frame_data_,
13431         eh_frame_hdr_section_, and build_id_note_.
13432         (Layout::finalize): Call create_build_id.
13433         (Layout::create_note): New function, broken out of
13434         Layout::create_gold_note.
13435         (Layout::create_gold_note): Call create_note.
13436         (Layout::create_build_id): New function.
13437         (Layout::write_build_id): New function.
13438         (Close_task_runner::run): Call write_build_id.
13439
13440         * x86_64.cc: Correct license to GPLv3.
13441
13442 2008-03-23  Ian Lance Taylor  <iant@google.com>
13443
13444         * options.cc: Include "demangle.h".
13445         (parse_optional_string): New function.
13446         (parse_long_option): Handle takes_optional_argument.
13447         (parse_short_option): Update dash_z initializer.  Handle
13448         takes_optional_argument.
13449         (General_options::General_options): Initialize do_demangle_.
13450         (General_options::finalize): Set do_demangle_.  Handle demangling
13451         style.
13452         * options.h (parse_optional_string): Declare.
13453         (struct One_option): Add optional_arg field.  Update constructor.
13454         Update call constructor calls.  Add takes_optional_argument
13455         function.
13456         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13457         (DEFINE_optional_string): Define.
13458         (General_options::demangle): Change from DEFINE_bool to
13459         DEFINE_optional_string.
13460         (General_options::no_demangle): New function.
13461         (General_options::do_demangle): New function.
13462         (General_options::set_do_demangle): New function.
13463         (General_options::execstack_status_): Move definition to end of
13464         class definition.
13465         (General_options::static_): Likewise.
13466         (General_options::do_demangle_): New field.
13467         * object.cc (big_endian>::get_symbol_location_info): Call
13468         Options::do_demangle, not Options::demangle.
13469         * symtab.cc (demangle): Likewise.
13470
13471 2008-03-22  Ian Lance Taylor  <iant@google.com>
13472
13473         * gold.h: Include <cstddef> and <sys/types.h>
13474         * options.h: Include <cstring>.
13475
13476 2008-03-21  Ian Lance Taylor  <iant@google.com>
13477
13478         * Added source code to GNU binutils.