2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
[platform/upstream/binutils.git] / gold / ChangeLog
1 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2
3         * plugin.cc (Plugin::load): Handle position independent executables.
4
5 2012-06-06  Cary Coutant  <ccoutant@google.com>
6
7         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
8         add .debug_macro.
9         (lines_only_debug_sections): Likewise.
10         (gdb_fast_lookup_sections): New static array.
11         (is_gdb_debug_section): Rename formal parameter.
12         (is_lines_only_debug_section): Likewise.
13         (is_gdb_fast_lookup_section): New function.
14         (Layout::include_section): Check for ".zdebug_" prefix; pass
15         section name suffix to is_gdb_debug_section, et al.; check for
16         fast-lookup sections when building .gdb_index.
17         * options.h (--strip-debug-gdb): Update GDB version number.
18
19 2012-06-06  Cary Coutant  <ccoutant@google.com>
20
21         * configure.ac: Add check for fallocate.
22         * configure: Regenerate.
23         * config.in: Regenerate.
24
25         * options.h (class General_options): Add --mmap-output-file and
26         --posix-fallocate options.
27         * output.cc: (posix_fallocate): Remove; replace with...
28         (gold_fallocate): New function.
29         (Output_file::map_no_anonymous): Call gold_fallocate.
30         (Output_file::map): Check --mmap-output-file option.
31
32 2012-06-05  Jing Yu  <jingyu@google.com>
33
34         * gold.h (textdomain): Add do {} to empty while(0).
35         (bindtextdomain): Likewise.
36
37 2012-06-04  Cary Coutant  <ccoutant@google.com>
38
39         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
40         has_dynsym_index.
41
42 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
43
44         * symtab.cc (Symbol_table::define_special_symbol):
45         Initialize *poldsym to prevent uninitialized variable errors.
46
47 2012-05-23  Cary Coutant  <ccoutant@google.com>
48
49         * layout.cc (Layout::section_name_mapping): Add rules to handle
50         exact match on .data.rel.ro.local or .data.rel.ro.
51         (Layout::output_section_name): Check for exact matches.
52
53 2012-05-23  Cary Coutant  <ccoutant@google.com>
54
55         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
56         more carefully.
57
58 2012-05-22  Cary Coutant  <ccoutant@google.com>
59
60         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
61         object before exporting symbol.
62
63 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
64
65         * testsuite/tls_test.cc: Include "config.h" first.
66         * testsuite/tls_test_c.c: Likewise.
67
68 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
69             Nick Clifton  <nickc@redhat.com>
70
71         PR 14072
72         * configure.in: Add check that sysdep.h has been included before
73         any system header files.
74         * configure: Regenerate.
75         * config.in: Regenerate.
76
77 2012-05-14  Cary Coutant  <ccoutant@google.com>
78
79         * layout.cc (Layout::make_output_section): Mark .tdata section
80         as RELRO.
81         * testsuite/relro_test.cc: Add a TLS variable.
82
83 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
84
85         PR gold/14091
86         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
87         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
88         R_X86_64_64.
89
90 2012-05-08  Cary Coutant  <ccoutant@google.com>
91
92         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
93         (lines_only_debug_sections): Likewise.
94
95 2012-05-02  Roland McGrath  <mcgrathr@google.com>
96
97         * nacl.cc: New file.
98         * nacl.h: New file.
99         * Makefile.am (CCFILES, HFILES): Add them.
100         * Makefile.in: Regenerate.
101         * i386.cc (Output_data_plt_i386_nacl): New class.
102         (Output_data_plt_i386_nacl_exec): New class.
103         (Output_data_plt_i386_nacl_dyn): New class.
104         (Target_i386_nacl): New class.
105         (Target_selector_i386_nacl): New class.
106         (target_selector_i386): Use it instead of Target_selector_i386.
107         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
108         (Target_x86_64_nacl): New class.
109         (Target_selector_x86_64_nacl): New class.
110         (target_selector_x86_64, target_selector_x32): Use it instead of
111         Target_selector_x86_64.
112         * arm.cc (Output_data_plt_arm_nacl): New class.
113         (Target_arm_nacl): New class.
114         (Target_selector_arm_nacl): New class.
115         (target_selector_arm, target_selector_armbe): Use it instead of
116         Target_selector_arm.
117
118         * target-select.cc (select_target): Take new Input_file* and off_t
119         arguments, pass them on to recognize method of selector.
120         * object.cc (make_elf_sized_object): Update caller.
121         * parameters.cc (parameters_force_valid_target): Likewise.
122         * incremental.cc (make_sized_incremental_binary): Likewise.
123         * target-select.h: Update decl.
124         (Target_selector::recognize): Take new Input_file* argument,
125         pass it on to do_recognize.
126         (Target_selector::do_recognize): Take new Input_file* argument.
127         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
128         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
129         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
130         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
131
132         * target.h (Target::Target_info): New members isolate_execinstr
133         and rosegment_gap.
134         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
135         * arm.cc (Target_arm::arm_info): Update initializer.
136         * i386.cc (Target_i386::i386_info): Likewise.
137         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
138         * sparc.cc (Target_sparc::sparc_info): Likewise.
139         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
140         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
141         * layout.cc (Layout::attach_allocated_section_to_segment):
142         Take new const Target* argument.  If target->isolate_execinstr(), act
143         like --rosegment.
144         (Layout::find_first_load_seg): Take new const Target* argument;
145         if target->isolate_execinstr(), reject PF_X segments.
146         (Layout::relaxation_loop_body): Update caller.
147         (Layout::set_segment_offsets): If target->isolate_execinstr(),
148         reset file offset to zero when we hit LOAD_SEG, and then do a second
149         loop over the segments before LOAD_SEG to reassign offsets after
150         addresses have been determined.  Handle target->rosegment_gap().
151         (Layout::attach_section_to_segment): Take new const Target* argument;
152         pass it to attach_allocated_section_to_segment.
153         (Layout::make_output_section): Update caller.
154         (Layout::attach_sections_to_segments): Take new const Target* argument;
155         pass it to attach_section_to_segment.
156         * gold.cc (queue_middle_tasks): Update caller.
157         * layout.h (Layout): Update method decls with new arguments.
158
159         * arm.cc (Target_arm::Target_arm): Take optional argument for the
160         Target_info pointer to use.
161         (Target_arm::do_make_data_plt): New virtual method.
162         (Target_arm::make_data_plt): New method that calls it.
163         (Target_arm::make_plt_entry): Use it.
164         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
165         for the section alignment.
166         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
167         method.
168         (Output_data_plt_arm::first_plt_entry_offset): Call it.
169         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
170         method.
171         (Output_data_plt_arm::get_plt_entry_size): Call it.
172         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
173         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
174         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
175         method.
176         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
177         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
178         method instead of sizeof(plt_entry).
179         (Output_data_plt_arm::add_entry): Likewise.
180         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
181         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
182         than static method.
183         (Target_arm::plt_entry_size): Likewise.
184         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
185         Move to ...
186         (Output_data_plt_arm_standard): ... here, new class.
187         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
188         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
189         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
190
191         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
192         Take additional argument for the PLT entry size.
193         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
194         Use get_plt_entry_size method rather than plt_entry_size variable.
195         (Output_data_plt_x86_64::reserve_slot): Likewise.
196         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
197         (Output_data_plt_x86_64::add_entry): Likewise.
198         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
199         (Output_data_plt_x86_64::address_for_global): Likewise.
200         (Output_data_plt_x86_64::address_for_local): Likewise.
201         (Output_data_plt_x86_64::set_final_data_size): Likewise.
202         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
203         Make method non-static.
204         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
205         method.
206         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
207         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
208         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
209         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
210         virtual method.
211         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
212         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
213         virtual method.
214         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
215         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
216         virtual method.
217         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
218         (Output_data_plt_x86_64::plt_entry_size)
219         (Output_data_plt_x86_64::first_plt_entry)
220         (Output_data_plt_x86_64::plt_entry)
221         (Output_data_plt_x86_64::tlsdesc_plt_entry)
222         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
223         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
224         (Output_data_plt_x86_64_standard): ... here, new class.
225         (Target_x86_64::Target_x86_64): Take optional argument for the
226         Target_info pointer to use.
227         (Target_x86_64::do_make_data_plt): New virtual method.
228         (Target_x86_64::make_data_plt): New method to call it.
229         (Target_x86_64::init_got_plt_for_update): Use that.
230         Call this->plt_->add_eh_frame method here.
231         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
232         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
233         rather than static method.
234         (Target_x86_64::plt_entry_size): Likewise.
235         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
236         rather than plt_entry_size variable.  Move guts of PLT filling to...
237         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
238         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
239         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
240
241         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
242         additional argument for the section alignment.
243         Don't do add_eh_frame_for_plt here.
244         (Output_data_plt_i386::first_plt_entry_offset): Make the method
245         non-static.  Use get_plt_entry_size method rather than plt_entry_size
246         variable.
247         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
248         method.
249         (Output_data_plt_i386::get_plt_entry_size): Call it.
250         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
251         (Output_data_plt_i386::add_eh_frame): New method to call it.
252         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
253         method.
254         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
255         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
256         method.
257         (Output_data_plt_i386::fill_plt_entry): New method to call it.
258         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
259         method instead of plt_entry_size.
260         (Output_data_plt_i386::plt_entry_size)
261         (Output_data_plt_i386::plt_eh_frame_fde_size)
262         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
263         (Output_data_plt_i386_standard): ... here, new class.
264         (Output_data_plt_i386_exec): New class.
265         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
266         (Output_data_plt_i386_exec::first_plt_entry): ... here.
267         (Output_data_plt_i386::exec_plt_entry): Move to ...
268         (Output_data_plt_i386_exec::plt_entry): ... here.
269         (Output_data_plt_i386_dyn): New class.
270         (Output_data_plt_i386::first_plt_entry): Move to ...
271         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
272         (Output_data_plt_i386::dyn_plt_entry): Move to ...
273         (Output_data_plt_i386_dyn::plt_entry): ... here.
274         (Target_i386::Target_i386): Take optional argument for the Target_info
275         pointer to use.
276         (Target_i386::do_make_data_plt): New virtual method.
277         (Target_i386::make_data_plt): New method to call it.
278         (Target_i386::make_plt_section): Use that.
279         Call this->plt_->add_eh_frame method here.
280         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
281         rather than plt_entry_size variable.
282         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
283         (Output_data_plt_i386::address_for_local): Likewise.
284         (Output_data_plt_i386::do_write): Likewise.
285         Move guts of PLT filling to...
286         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
287         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
288         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
289         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
290
291 2012-05-01  Cary Coutant  <ccoutant@google.com>
292
293         * dwarf_reader.cc (Dwarf_die::read_attributes)
294         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
295         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
296         * reduced_debug_output.cc
297         (Output_reduced_debug_info_section::get_die_end): Remove
298         DW_FORM_GNU_ref_index.  Add default case.
299
300 2012-04-26  Mark Wielaard  <mjw@redhat.com>
301
302         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
303         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
304         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
305         DW_AT_high_pc as offset from DW_AT_low_pc.
306
307         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
308         * testsuite/Makefile.in: Regenerate.
309         * testsuite/gdb_index_test_3.c: New test source file.
310         * testsuite/gdb_index_test_3.sh: New test source file.
311
312 2012-04-25  Ian Lance Taylor  <iant@google.com>
313
314         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
315         pointer.
316         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
317         as a class, not a struct.
318         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
319         (Target_arm::apply_cortex_a8_workaround): Likewise.
320         * gc.h: Declare Reloc_types as a struct, not a class.
321         * object.h: Declare Symbols_data as a struct.
322         * reloc.h: Declare Read_relocs_data as a struct.
323         * target.h: Declare Relocate_info as a struct.
324
325 2012-04-24  David S. Miller  <davem@davemloft.net>
326
327         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
328         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
329         and R_SPARC_WPLT30.
330
331 2012-04-24  Cary Coutant  <ccoutant@google.com>
332
333         * incremental-dump.cc (find_input_containing_global): Replace
334         magic number with symbolic constant.
335         (dump_incremental_inputs): Update version number.
336         * incremental.cc (Output_section_incremental_inputs): Update version
337         number; import symbolic constants from Incremental_inputs_reader.
338         (Incremental_inputs::create_data_sections): Align relocations
339         section correctly for 64-bit targets.
340         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
341         constants; add padding.
342         (Output_section_incremental_inputs::write_header): Add assert for
343         header_size.
344         (Output_section_incremental_inputs::write_input_files): Add assert
345         for input_entry_size.
346         (Output_section_incremental_inputs::write_info_blocks): Add padding;
347         add assert for object_info_size, input_section_entry_size,
348         global_sym_entry_size.
349         * incremental.h (Incremental_inputs_reader): Add symbolic constants
350         for data structure sizes; use them.
351         (Incremental_input_entry_reader): Import symbolic constants from
352         Incremental_inputs_reader; use them.
353
354 2012-04-23  David S. Miller  <davem@davemloft.net>
355
356         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
357         and elf_flags_set_.
358         (Target_sparc::Target_sparc): Initialize new fields.
359         (Target_sparc::do_make_elf_object): New function.
360         (Target_sparc::do_adjust_elf_header): New function.
361
362 2012-04-23  Cary Coutant  <ccoutant@google.com>
363
364         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
365         CU range table of gdb index.
366
367 2012-04-20  David S. Miller  <davem@davemloft.net>
368
369         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
370         instead of false.
371
372 2012-04-16  David S. Miller  <davem@davemloft.net>
373
374         * sparc.cc (Target_sparc::got_address): New function.
375         (Sparc_relocate_functions::gdop_hix22): New function.
376         (Sparc_relocate_functions::gdop_lox10): New function.
377         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
378         relocs.
379         (Target_sparc::Scan::local): Likewise if the global symbol is not
380         preemptible and is not IFUNC.
381         (Target_sparc::Relocate::relocate): Perform GOTDATA code
382         transformations for local and non-preemptible non-IFUNC global
383         symbols.
384
385         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
386         writing out 64-bit part of ranges.
387
388         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
389         -fpic and -fpie respectively.
390         * Makefile.in: Regenerate.
391
392         * sparc.cc (class Target_sparc): Add rela_ifunc_.
393         (Target_sparc::Target_sparc): Initialize new field.
394         (Target_sparc::do_plt_section_for_global): New function.
395         (Target_sparc::do_plt_section_for_local): New function.
396         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
397         (Target_sparc::make_plt_section): New function, broken out of
398         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
399         (Target_sparc::make_plt_entry): Call make_plt_section.
400         (Target_sparc::make_local_ifunc_plt_entry): New function.
401         (Target_sparc::rela_ifunc_section): New function.
402         (Target_sparc::plt_section): Remove const.
403         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
404         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
405         and ifunc_count_ fields.
406         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
407         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
408         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
409         (Output_data_plt_sparc::rela_ifunc): New function.
410         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
411         (Output_data_plt_sparc::has_ifunc_section): New function.
412         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
413         (Output_data_plt_sparc::address_for_global): New function.
414         (Output_data_plt_sparc::address_for_local): New function.
415         (Output_data_plt_sparc::plt_index_to_offset): New function.
416         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
417         and entry_count.
418         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
419         entry_count.
420         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
421         R_SPARC_JMP_IREL to switch.
422         (Target_sparc::Scan::check_non_pic): Likewise.
423         (Target_sparc::Scan::local): Handle IFUNC symbols.
424         (Target_sparc::Scan::local): Likewise.
425         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
426         and plt_address_for_local.
427         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
428         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
429
430         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
431         (class Output_data_reloc): Adjust calls to Output_reloc_type.
432         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
433         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
434         global relocs too.
435         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
436         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
437         calls.
438         * sparc.cc (Target_sparc::Scan::global): Likewise.
439         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
440
441 2012-04-16  Cary Coutant  <ccoutant@google.com>
442
443         * archive.cc (Library_base::should_include_member): Check for
444         --export-dynamic-symbol.
445         * options.h (class General_options): Add --export-dynamic-symbol.
446         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
447         --export-dynamic-symbol.
448         (Symbol_table::gc_mark_undef_symbols): Likewise.
449         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
450
451 2012-04-12  David S. Miller  <davem@davemloft.net>
452
453         * sparc.cc (Reloc::wdisp10): New relocation method.
454         (Reloc::h34): Likewise.
455         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
456         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
457         R_SPARC_WDISP10.
458         (Target_sparc::Scan::local): Likewise.
459         (Target_sparc::Scan::global): Likewise.
460         (Target_sparc::Relocate::relocate): Likewise.
461
462 2012-04-09  Cary Coutant  <ccoutant@google.com>
463
464         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
465         low_pc == 0.
466
467 2012-04-06  Ian Lance Taylor  <iant@google.com>
468
469         * timer.cc: #include <unistd.h>.
470
471 2012-04-06  Roland McGrath  <mcgrathr@google.com>
472
473         * configure.in (AC_CHECK_HEADERS): Add locale.h.
474         * config.in: Regenerate.
475         * configure: Regenerate.
476
477 2012-04-05  Nick Clifton  <nickc@redhat.com>
478
479         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
480         (AM_LC_MESSAGES): Add.
481         * aclocal.m4: Regenerate.
482         * config.in: Regenerate.
483         * configure: Regenerate.
484
485 2012-03-21  Cary Coutant  <ccoutant@google.com>
486
487         * Makefile.am: Add gdb-index.cc, gdb-index.h.
488         * Makefile.in: Regenerate.
489         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
490         (Sized_elf_reloc_mapper::symbol_section): New function.
491         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
492         (make_elf_reloc_mapper): New function.
493         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
494         (Dwarf_abbrev_table::do_read_abbrevs): New function.
495         (Dwarf_abbrev_table::do_get_abbrev): New function.
496         (Dwarf_ranges_table::read_ranges_table): New function.
497         (Dwarf_ranges_table::read_range_list): New function.
498         (Dwarf_pubnames_table::read_section): New function.
499         (Dwarf_pubnames_table::read_header): New function.
500         (Dwarf_pubnames_table::next_name): New function.
501         (Dwarf_die::Dwarf_die): New function.
502         (Dwarf_die::read_attributes): New function.
503         (Dwarf_die::skip_attributes): New function.
504         (Dwarf_die::set_name): New function.
505         (Dwarf_die::set_linkage_name): New function.
506         (Dwarf_die::attribute): New function.
507         (Dwarf_die::string_attribute): New function.
508         (Dwarf_die::int_attribute): New function.
509         (Dwarf_die::uint_attribute): New function.
510         (Dwarf_die::ref_attribute): New function.
511         (Dwarf_die::child_offset): New function.
512         (Dwarf_die::sibling_offset): New function.
513         (Dwarf_info_reader::check_buffer): New function.
514         (Dwarf_info_reader::parse): New function.
515         (Dwarf_info_reader::do_parse): New function.
516         (Dwarf_info_reader::do_read_string_table): New function.
517         (Dwarf_info_reader::lookup_reloc): New function.
518         (Dwarf_info_reader::get_string): New function.
519         (Dwarf_info_reader::visit_compilation_unit): New function.
520         (Dwarf_info_reader::visit_type_unit): New function.
521         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
522         Sized_elf_reloc_mapper.
523         (Sized_dwarf_line_info::symbol_section): Remove function.
524         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
525         (Sized_dwarf_line_info::read_line_mappings): Remove object
526         parameter, adjust callers.
527         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
528         * dwarf_reader.h: Include <sys/types.h>.
529         (class Track_relocs): Remove forward declaration.
530         (class Elf_reloc_mapper): New class.
531         (class Sized_elf_reloc_mapper): New class.
532         (class Dwarf_abbrev_table): New class.
533         (class Dwarf_range_list): New class.
534         (class Dwarf_ranges_table): New class.
535         (class Dwarf_pubnames_table): New class.
536         (class Dwarf_die): New class.
537         (class Dwarf_info_reader): New class.
538         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
539         (Sized_dwarf_line_info::symbol_section): Remove member function.
540         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
541         base class.
542         * gdb-index.cc: New source file.
543         * gdb-index.h: New source file.
544         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
545         and .debug_types sections, call Layout::add_to_gdb_index.
546         (Sized_relobj_incr::do_section_name): Implement.
547         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
548         return type; Implement.
549         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
550         return type.
551         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
552         parameter list and return type.
553         (Sized_incr_dynobj::do_section_contents): Likewise.
554         * layout.cc: Include gdb-index.h.
555         (Layout::Layout): Initialize gdb_index_data_.
556         (Layout::init_fixed_output_section): Check for .gdb_index section.
557         (Layout::add_to_gdb_index): New function. Instantiate.
558         * layout.h: Add forward declaration for class Gdb_index.
559         (Layout::add_to_gdb_index): New member function.
560         (Layout::gdb_index_data_): New data member.
561         * main.cc: Include gdb-index.h.
562         (main): Print statistics for gdb index.
563         * object.cc (Object::section_contents): Move code into
564         do_section_contents.
565         (need_decompressed_section): Check for sections needed when building
566         gdb index.
567         (build_compressed_section_map): Likewise.
568         (Sized_relobj_file::do_read_symbols): Need local symbols when building
569         gdb index.
570         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
571         sections; call Layout::add_to_gdb_index.
572         (Sized_relobj_file::do_decompressed_section_contents): Call
573         do_section_contents directly.
574         * object.h (Object::do_section_contents): Adjust parameter list and
575         return type.
576         (Object::do_decompressed_section_contents): Call do_section_contents
577         directly.
578         (Sized_relobj_file::do_section_contents): Adjust parameter list and
579         return type.
580         * options.h (class General_options): Add --gdb-index option.
581         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
582         list and return type.
583         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
584         * reloc.h (Track_relocs::checkpoint): New function.
585         (Track_relocs::reset): New function.
586
587         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
588         New test cases.
589         * testsuite/Makefile.in: Regenerate.
590         * testsuite/gdb_index_test.cc: New test source file.
591         * testsuite/gdb_index_test_1.sh: New test source file.
592         * testsuite/gdb_index_test_2.sh: New test source file.
593
594 2012-03-19  Doug Kwan  <dougkwan@google.com>
595
596         * arm.cc (Target_arm::do_define_standard_symbols): New method.
597         (Target_arm::do_finalize_sections): Remove code which defines
598         __exidx_start and __exidx_end.  Make symbol table parameter
599         anonymous as it is not used.
600         * gold.cc (queue_middle_tasks): Call target hook to define any
601         target-specific symbols.
602         * target.h (Target::define_standard_symbols): New method.
603         (Target::do_define_standard_symbols): Same.
604         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
605         * testsuite/Makefile.in: Regenerate.
606         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
607         and __exidx_end.
608         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
609         relocations are generated for __exidx_start and __exidx_end.
610
611 2012-03-16  Doug Kwan  <dougkwan@google.com>
612
613         * testsuite/Makefile.am: Disable test initpri3b.
614         * testsuite/Makefile.in: Regenerate.
615
616 2012-03-15  Doug Kwan  <dougkwan@google.com>
617
618         * arm.cc (Target_arm::got_section): Make .got section read-only
619         if -z now is given.
620
621 2012-03-15  Ian Lance Taylor  <iant@google.com>
622
623         PR gold/13850
624         * layout.cc (Layout::make_output_section): Correctly mark
625         SHT_INIT_ARRAY, et. al., as relro.
626
627 2012-03-14  Doug Kwan  <dougkwan@google.com>
628
629         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
630         dynamic relocations for protected symbols in shared objects.
631
632 2012-03-13  Ian Lance Taylor  <iant@google.com>
633
634         * resolve.cc (Symbol_table::resolve): When merging common symbols,
635         keep the larger alignment.
636
637 2012-03-12  Cary Coutant  <ccoutant@google.com>
638
639         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
640         handling of DW_LNE_define_file.
641
642 2012-03-12  Cary Coutant  <ccoutant@google.com>
643
644         * reduced_debug_output.cc
645         (Output_reduced_debug_info_section::get_die_end): Add new FORM
646         codes to switch.
647
648 2012-02-29  Cary Coutant  <ccoutant@google.com>
649
650         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
651
652 2012-02-29  Cary Coutant  <ccoutant@google.com>
653
654         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
655         Call Object::decompressed_section_contents.
656         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
657         New dtor.
658         (Sized_dwarf_line_info::buffer_start_): New data member.
659         * merge.cc (Output_merge_data::do_add_input_section): Call
660         Object::decompressed_section_contents.
661         (Output_merge_string::do_add_input_section): Likewise.
662         * object.cc (need_decompressed_section): New function.
663         (build_compressed_section_map): Decompress sections needed later.
664         (Sized_relobj_file::do_decompressed_section_contents): New function.
665         (Sized_relobj_file::do_discard_decompressed_sections): New function.
666         * object.h (Object::decompressed_section_contents): New function.
667         (Object::discard_decompressed_sections): New function.
668         (Object::do_decompressed_section_contents): New function.
669         (Object::do_discard_decompressed_sections): New function.
670         (Compressed_section_info): New type.
671         (Compressed_section_map): Include decompressed section contents.
672         (Sized_relobj_file::do_decompressed_section_contents): New function.
673         (Sized_relobj_file::do_discard_decompressed_sections): New function.
674
675 2012-02-16  Cary Coutant  <ccoutant@google.com>
676
677         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
678         * testsuite/Makefile.in: Regenerate.
679
680 2012-02-14  Cary Coutant  <ccoutant@google.com>
681
682         * options.cc (General_options::finalize): Disallow -pie and -static.
683
684 2012-02-03  Doug Kwan  <dougkwan@google.com>
685
686         * arm.cc (Arm_relocate_functions::abs8,
687         Arm_relocate_functions::abs16): Use
688         Bits::has_signed_unsigned_overflow32.
689         (Arm_relocate_functions::thm_abs8): Correct range of
690         overflow check.
691         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
692         in assertions.
693
694 2012-02-02  Doug Kwan  <dougkwan@google.com>
695
696         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
697         position independent outputs, not just shared objects.
698
699 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
700
701         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
702         * configure: Regenerated.
703
704 2012-01-27  Ian Lance Taylor  <iant@google.com>
705
706         * reloc.h (Bits): New class with static functions, copied from
707         namespace utils in arm.cc.
708         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
709         instead.
710
711 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
712
713         * incremental.cc (write_info_blocks): Correct relocation offset.
714
715 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
716
717         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
718         (Relocate::tls_gd_to_le): Likewise.
719
720 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
721
722         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
723
724 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
725
726         * configure.ac: Check if -mcmodel=medium works.
727         * configure: Regenerated.
728
729 2012-01-24  Cary Coutant  <ccoutant@google.com>
730
731         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
732         definition and ...
733         (read_unsigned_LEB_128_x): ... this new function.
734         (read_signed_LEB_128): Replaced with inline definition and ...
735         (read_signed_LEB_128_x): ... this new function.
736         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
737         (read_unsigned_LEB_128): Add inline definition.
738         (read_signed_LEB_128_x): New function.
739         (read_signed_LEB_128): Add inline definition.
740         * testsuite/Makefile.am (leb128_unittest): New unit test.
741         * testsuite/Makefile.in: Regenerate.
742         * testsuite/leb128_unittest.cc: New unit test.
743
744 2012-01-23  Ian Lance Taylor  <iant@google.com>
745
746         PR gold/13617
747         * i386.cc (Target_i386::do_code_fill): When using a jmp
748         instruction, pad with nop instructions.
749         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
750
751 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
752
753         * x86_64.cc (gc_process_relocs): Add typename on types used in
754         template.
755         (scan_relocs): Likewise.
756         (relocate_section): Likewise.
757         (apply_relocation): Likewise.
758
759 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
760
761         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
762         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
763         under x32.
764
765 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
766
767         * x86_64.cc: Initial support for x32.
768
769 2012-01-03  Cary Coutant  <ccoutant@google.com>
770
771         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
772         Use abstract base class for GOT.
773         * gold/output.h (class Output_data_got_base): New abstract base class.
774         (class Output_data_got): Derive from new base class, adjust ctors.
775         (Output_data_got::reserve_slot): Make virtual; rename to
776         do_reserve_slot; Adjust callers.
777         * gold/target.h (Sized_target::init_got_plt_for_update): Return
778         pointer to abstract base class.
779         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
780
781 2011-12-18  Ian Lance Taylor  <iant@google.com>
782
783         * object.h (Relobj::local_symbol_value): New function.
784         (Relobj::local_plt_offset): New function.
785         (Relobj::local_has_got_offset): New function.
786         (Relobj::local_got_offset): New function.
787         (Relobj::set_local_got_offset): New function.
788         (Relobj::do_local_symbol_value): New pure virtual function.
789         (Relobj::do_local_plt_offset): Likewise.
790         (Relobj::do_local_has_got_offset): Likewise.
791         (Relobj::do_local_got_offset): Likewise.
792         (Relobj::do_set_local_got_offset): Likewise.
793         (Sized_relobj::do_local_has_got_offset): Rename from
794         local_has_got_offset.
795         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
796         (Sized_relobj::do_set_local_got_offset): Rename from
797         set_local_got_offset.
798         (Sized_relobj_file::do_local_plt_offset): Rename from
799         local_plt_offset.
800         (Sized_relobj_file::do_local_symbol_value): New function.
801         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
802         local_plt_offset.
803         * output.cc (Output_data_got::Got_entry::write): Change object to
804         Relobj.  Use local_symbol_value.
805         (Output_data_got::add_global_with_rel): Change rel_dyn to
806         Output_data_reloc_generic*.  Use add_global_generic.
807         (Output_data_got::add_global_with_rela): Remove.  Change all
808         callers to use add_global_with_rel.
809         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
810         Output_data_reloc_generic*.  Use add_global_generic.
811         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
812         callers to use add_global_pair_with_rel.
813         (Output_data_got::add_local): Change object to Relobj*.
814         (Output_data_got::add_local_plt): Likewise.
815         (Output_data_got::add_local_with_rel): Change object to Relobj*,
816         change rel_dyn to Output_data_reloc_generic*.  Use
817         add_local_generic.
818         (Output_data_got::add_local_with_rela): Remove.  Change all
819         callers to use all_local_with_rel.
820         (Output_data_got::add_local_pair_with_rel): Change object to
821         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
822         add_output_section_generic.
823         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
824         callers to use add_local_pair_with_rel.
825         (Output_data_got::reserve_local): Change object to Relobj*.
826         * output.h: (class Output_data_reloc_generic): Add pure virtual
827         declarations for add_global_generic, add_local_generic,
828         add_output_section_generic.
829         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
830         functions for Output_data_reloc_generic.  Update declarations for
831         changes listed in output.cc.
832         (class Output_data_got): Change template parameter to got_size.
833         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
834         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
835         function.
836         (Sized_relobj_incr::do_local_plt_offset): New function.
837         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
838         add_global_generic.
839
840 2011-12-17  Cary Coutant  <ccoutant@google.com>
841
842         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
843         * resolve.cc (Symbol_table::resolve): Likewise.
844         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
845         arrays.
846         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
847
848 2011-12-16  Ian Lance Taylor  <iant@google.com>
849
850         * output.h (Output_data_reloc_generic::add): Only call
851         add_dynamic_reloc if this is a dynamic reloc section.
852
853 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
854
855         PR gold/13505
856         * target-reloc.h (apply_relocation): Replace <64, false> with
857         <size, big_endian>.
858
859 2011-11-25  Nick Clifton  <nickc@redhat.com>
860
861         * po/it.po: New Italian translation.
862
863 2011-11-17  Sterling Augustine  <saugustine@google.com>
864
865         * script.cc (script_include_directive): Implement.
866         (read_script_file): New local variables name and search_path. Update
867         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
868         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
869         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
870
871 2011-11-11  Sterling Augustine  <saugustine@google.com>
872
873         * yyscript.y (section_cmd): Add support for INCLUDE directive.
874         (file_or_sections_cmd): Likewise.
875
876 2011-11-11  Doug Kwan  <dougkwan@google.com>
877
878         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
879         if --just-symbols is given.
880
881 2011-11-10  Doug Kwan  <dougkwan@google.com>
882
883         PR gold/13362
884         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
885         when processing data relocs.
886         * reloc.h (Relocate_functions::rel_unaligned): New method.
887         (Relocate_functions::pcrel_unaligned): Ditto.
888         (Relocate_functions::rel32_unaligned): Ditto.
889         (Relocate_functions::pcrel32_unaligned): Ditto.
890
891 2011-11-09  Doug Kwan  <dougkwan@google.com>
892
893         PR gold/13362
894         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
895         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
896         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
897         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
898         (Relocate_functions::rel_unaligned): New.
899         (Relocate_functions::rel32_unaligned): New.
900         * target-reloc.h (relocate_for_relocatable): Add code to handle
901         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
902         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
903         arm_unaligned_reloc_r): New targets.
904         * testsuite/Makefile.in: Regenerate.
905         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
906         linking.
907
908 2011-11-02  Ian Lance Taylor  <iant@google.com>
909
910         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
911         NATIVE_LINKER.
912         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
913         * options.cc (General_options::finalize): Use library search path
914         from configure script if specified.  If not native and no sysroot,
915         only search TOOLLIBDIR.
916         * options.h (Search_directory::Search_directory): Change name to
917         const std::string&.
918         (General_options::add_to_library_path_with_sysroot): Change arg to
919         const std::string&.
920         * configure, Makefile.in, config.in: Rebuild.
921
922 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
923
924         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
925         we are working around the ARM1176 Erratum.
926         * options.h (General_options::fix_arm1176): Add option.
927         * testsuite/Makefile.am: Add testcases, and keep current ones
928         working.
929         * testsuite/Makefile.in: Regenerate.
930         * testsuite/arm_fix_1176.s: New file.
931         * testsuite/arm_fix_1176.sh: Likewise.
932
933 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
934
935         * arm.cc (Target_arm::Target_arm): Remove initialisation of
936         may_use_blx_.
937         (Target_arm::may_use_blx): Remove method.
938         (Target_arm::set_may_use_blx): Likewise.
939         (Target_arm::may_use_v4t_interworking): New method.
940         (Target_arm::may_use_v5t_interworking): Likewise.
941         (Target_arm::may_use_blx_): Remove member variable.
942         (Arm_relocate_functions::arm_branch_common): Check for v5T
943         interworking.
944         (Arm_relocate_functions::thumb_branch_common): Likewise.
945         (Reloc_stub::stub_type_for_reloc): Likewise.
946         (Target_arm::do_finalize_sections): Correct interworking checks.
947         * testsuite/Makefile.am: Add new tests.
948         * testsuite/Makefile.in: Regenerate.
949         * testsuite/arm_farcall_arm_arm.s: New test.
950         * testsuite/arm_farcall_arm_arm.sh: Likewise.
951         * testsuite/arm_farcall_arm_thumb.s: Likewise.
952         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
953         * testsuite/arm_farcall_thumb_arm.s: Likewise.
954         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
955         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
956         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
957
958 2011-10-31  Cary Coutant  <ccoutant@google.com>
959
960         PR gold/13023
961         * expression.cc (Expression::eval_with_dot): Add
962         is_section_dot_assignment parameter.
963         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
964         absolute and assigning to dot within a section.
965         * script-sections.cc
966         (Output_section_element_assignment::set_section_addresses): Pass
967         dot_section to set_if_absolute.
968         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
969         as is_section_dot_assignment flag to eval_with_dot.
970         (Output_section_element_dot_assignment::set_section_addresses):
971         Likewise.
972         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
973         parameter.  Also set value if relative to dot_section; set the
974         symbol's output_section.
975         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
976         parameter.  Adjust all callers.
977         (Expression::eval_maybe_dot): Likewise.
978         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
979         Adjust all callers.
980         * testsuite/script_test_2.t: Test assignment of an absolute value
981         to dot within an output section element.
982
983 2011-10-31  Cary Coutant  <ccoutant@google.com>
984
985         * options.h (class General_options): Add --[no-]gnu-unique options.
986         * symtab.cc (Symbol_table::sized_write_globals): Convert
987         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
988
989 2011-10-31  Cary Coutant  <ccoutant@google.com>
990
991         PR gold/13359
992         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
993         unnecessary assertion.
994         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
995
996 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
997
998         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
999         gc_mark_symbol.
1000         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1001         gc_mark_symbol.
1002         Change to just keep the section associated with symbol.
1003         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1004         they are externally visible and --export-dynamic is turned on.
1005         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1006
1007 2011-10-19  Ian Lance Taylor  <iant@google.com>
1008
1009         PR gold/13163
1010         * script-sections.cc
1011         (Output_section_element_dot_assignment::needs_output_section): New
1012         function.
1013
1014 2011-10-19  Ian Lance Taylor  <iant@google.com>
1015
1016         PR gold/13204
1017         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1018         --section-start option was seen.
1019         * options.h (General_options::any_section_start): New function.
1020
1021 2011-10-18  David S. Miller  <davem@davemloft.net>
1022
1023         PR binutils/13301
1024         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1025         member to track relocation locations that have moved during TLS
1026         reloc optimizations.
1027         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1028         (Target_sparc::Relocate::relocate): Adjust view down by 4
1029         bytes if it matches reloc_adjust_addr_.
1030         (Target_sparc::Relocate::relocate_tls): Always move the
1031         __tls_get_addr call delay slot instruction forward 4 bytes when
1032         performing relaxation.
1033
1034 2011-10-18  Cary Coutant  <ccoutant@google.com>
1035
1036         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1037         (Output_file::map_no_anonymous): Check for non-zero
1038         return code from posix_fallocate.
1039
1040 2011-10-17  Cary Coutant  <ccoutant@google.com>
1041
1042         PR gold/13245
1043         * plugin.cc (is_visible_from_outside): Check for symbols
1044         referenced from dynamic objects.
1045         * resolve.cc (Symbol_table::resolve): Don't count references
1046         from dynamic objects as references from real ELF files.
1047         * testsuite/plugin_test_2.sh: Adjust expected result.
1048
1049 2011-10-17  Cary Coutant  <ccoutant@google.com>
1050
1051         * gold.cc: Include timer.h.
1052         (queue_middle_tasks): Stamp time.
1053         (queue_final_tasks): Likewise.
1054         * main.cc (main): Store timer in parameters.  Print timers
1055         for each pass.
1056         * parameters.cc (Parameters::Parameters): Initialize timer_.
1057         (Parameters::set_timer): New function.
1058         (set_parameters_timer): New function.
1059         * parameters.h (Parameters::set_timer): New function.
1060         (Parameters::timer): New function.
1061         (Parameters::timer_): New data member.
1062         (set_parameters_timer): New function.
1063         * timer.cc (Timer::stamp): New function.
1064         (Timer::get_pass_time): New function.
1065         * timer.h (Timer::stamp): New function.
1066         (Timer::get_pass_time): New function.
1067         (Timer::pass_times_): New data member.
1068
1069 2011-10-17  Cary Coutant  <ccoutant@google.com>
1070
1071         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1072         task for members of lib groups.
1073
1074 2011-10-17  Cary Coutant  <ccoutant@google.com>
1075
1076         PR gold/13288
1077         * fileread.cc (File_read::find_view): Add assert.
1078         (File_read::make_view): Move bounds check (replace with assert)...
1079         (File_read::find_or_make_view): ... to here.
1080
1081 2011-10-12  Cary Coutant  <ccoutant@google.com>
1082
1083         * output.cc (Output_file::open_base_file): Handle case where
1084         ::read returns less than requested size.
1085
1086 2011-10-10  Cary Coutant  <ccoutant@google.com>
1087
1088         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1089         Initialize defined_count_.
1090         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1091         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1092         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1093         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1094         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1095         * incremental.h (Sized_relobj_incr::defined_count_): New data
1096         member.
1097         (Sized_incr_dynobj::defined_count_): New data member.
1098         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1099         Return zeroes instead of internal error.
1100
1101 2011-10-10  Cary Coutant  <ccoutant@google.com>
1102
1103         PR gold/13249
1104         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1105         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1106         * output.h (class Output_reloc): Add use_plt_offset flag.
1107         (Output_reloc::type_): Adjust size of bit field.
1108         (Output_reloc::use_plt_offset_): New bit field.
1109         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1110         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1111         flag.  Adjust all callers.
1112         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1113         creating RELATIVE relocations.
1114
1115 2011-10-10  Nick Clifton  <nickc@redhat.com>
1116
1117         * po/es.po: Updated Spanish translation.
1118         * po/fi.po: Updated Finnish translation.
1119
1120 2011-10-03   Diego Novillo  <dnovillo@google.com>
1121
1122         * options.cc (parse_uint): Fix dereference of RETVAL.
1123
1124 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1125
1126         * layout.h (section_order_map_): New member.
1127         (get_section_order_map): New member function.
1128         * output.cc (Output_section::add_input_section): Check for patterns
1129         only when --section-ordering-file is specified.
1130         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1131         output_sections have been formed.
1132         * layout.cc (Layout_Layout): Initialize section_order_map_.
1133         * plugin.cc (update_section_order): Store order in order_map. Do not
1134         update the order.
1135         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1136         * testsuite/Makefile.in: Regenerate.
1137         * testsuite/plugin_section_order.c: New file.
1138         * testsuite/plugin_final_layout.cc: New file.
1139         * testsuite/plugin_final_layout.sh: New file.
1140
1141 2011-09-29  Cary Coutant  <ccoutant@google.com>
1142
1143         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1144         Check for NULL.
1145         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1146         symbols during incremental update.
1147         (Symbol_table::add_from_dynobj): Likewise.
1148
1149 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1150             Ian Lance Taylor  <iant@google.com>
1151
1152         * symtab.cc (Symbol_table::define_special_symbol): Always
1153         canonicalize version string.
1154
1155 2011-09-26  Cary Coutant  <ccoutant@google.com>
1156
1157         * gold.cc (queue_initial_tasks): Move option checks ...
1158         * options.cc (General_options::finalize): ... to here. Disable
1159         some options; make others fatal.
1160
1161 2011-09-26  Cary Coutant  <ccoutant@google.com>
1162
1163         gcc PR lto/47247
1164         * plugin.cc (get_symbols_v2): New function.
1165         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1166         (is_referenced_from_outside): New function.
1167         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1168         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1169         (get_symbols): Pass version parameter.
1170         (get_symbols_v2): New function.
1171         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1172         parameter.
1173         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1174         (onload): Add LDPT_GET_SYMBOLS_V2.
1175         (all_symbols_read_hook): Use get_symbols_v2; check for
1176         LDPR_PREVAILING_DEF_IRONLY_EXP.
1177         * testsuite/plugin_test_3.sh: Update expected results.
1178
1179 2011-09-23  Simon Baldwin  <simonb@google.com>
1180
1181         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1182         configuration options.
1183         * configure: Regenerate.
1184         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1185         * Makefile.in: Regenerate.
1186         * testsuite/Makefile.in: Regenerate.
1187
1188 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1189
1190         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1191
1192 2011-09-19  Cary Coutant  <ccoutant@google.com>
1193
1194         * incremental.cc (can_incremental_update): Fix typo in comment.
1195         * incremental.h (can_incremental_update): Likewise.
1196
1197 2011-09-18  Cary Coutant  <ccoutant@google.com>
1198
1199         * incremental.cc (can_incremental_update): New function.
1200         * incremental.h (can_incremental_update): New function.
1201         * layout.cc (Layout::init_fixed_output_section): Call it.
1202         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1203         * object.cc (Sized_relobj_file::do_layout): Call
1204         can_incremental_update.
1205
1206 2011-09-13  Cary Coutant  <ccoutant@google.com>
1207
1208         * configure.ac: Check for glibc support for gnu_indirect_function
1209         support with static linking, setting automake conditional
1210         IFUNC_STATIC.
1211         * Makefile.in: Regenerate.
1212         * configure: Regenerate.
1213
1214         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1215         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1216         for IFUNC_STATIC.
1217         * testsuite/Makefile.in: Regenerate.
1218
1219 2011-09-13  Cary Coutant  <ccoutant@google.com>
1220
1221         * incremental.cc (Sized_relobj_incr::do_layout): Call
1222         report_comdat_group for kept comdat sections.
1223         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1224         * testsuite/Makefile.in: Regenerate.
1225         * testsuite/incr_comdat_test_1.cc: New source file.
1226         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1227         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1228         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1229
1230 2011-09-13  Ian Lance Taylor  <iant@google.com>
1231
1232         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1233         variable external_symbols_offset.
1234
1235 2011-09-12  Ian Lance Taylor  <iant@google.com>
1236
1237         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1238         triggered if object has no symbols.
1239
1240 2011-09-09  David S. Miller  <davem@davemloft.net>
1241
1242         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1243         (Output_fill_debug_line::do_write): Likewise.
1244
1245 2011-08-29  Cary Coutant  <ccoutant@google.com>
1246
1247         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1248         casts to match formatting specs.
1249         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1250
1251 2011-08-26  Cary Coutant  <ccoutant@google.com>
1252
1253         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1254         remaining hole size when allocating.
1255         (Layout::make_output_section): Set fill methods for debug sections.
1256         * layout.h (Free_list::Free_list_node): Move from private to
1257         public.
1258         (Free_list::set_min_hole_size): New function.
1259         (Free_list::begin, Free_list::end): New functions.
1260         (Free_list::min_hole_): New data member.
1261         * output.cc: Include dwarf.h.
1262         (Output_fill_debug_info::do_minimum_hole_size): New function.
1263         (Output_fill_debug_info::do_write): New function.
1264         (Output_fill_debug_line::do_minimum_hole_size): New function.
1265         (Output_fill_debug_line::do_write): New function.
1266         (Output_section::Output_section): Initialize new data member.
1267         (Output_section::set_final_data_size): Ensure patch space is larger
1268         than minimum hole size.
1269         (Output_section::do_write): Fill holes in debug sections.
1270         * output.h (Output_fill): New class.
1271         (Output_fill_debug_info): New class.
1272         (Output_fill_debug_line): New class.
1273         (Output_section::set_free_space_fill): New function.
1274         (Output_section::free_space_fill_): New data member.
1275         * testsuite/Makefile.am (incremental_test_3): Add
1276         --incremental-patch option.
1277         (incremental_test_4): Likewise.
1278         (incremental_test_5): Likewise.
1279         (incremental_test_6): Likewise.
1280         (incremental_copy_test): Likewise.
1281         (incremental_common_test_1): Likewise.
1282         * testsuite/Makefile.in: Regenerate.
1283
1284 2011-08-26  Nick Clifton  <nickc@redhat.com>
1285
1286         * po/es.po: Updated Spanish translation.
1287
1288 2011-08-01  Cary Coutant  <ccoutant@google.com>
1289
1290         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1291         * gold/testsuite/Makefile.in: Regenerate.
1292         * gold/testsuite/justsyms_exec.c: New source file.
1293         * gold/testsuite/justsyms_lib.c: New source file.
1294
1295 2011-08-01  Cary Coutant  <ccoutant@google.com>
1296
1297         * layout.cc (Layout::set_segment_offsets): Don't realign text
1298         segment if -Ttext was specified.
1299         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1300         file type.
1301         * object.h (Sized_relobj_file::e_type): New function.
1302         (Sized_relobj_file::e_type_): New data member.
1303         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1304         base address for ET_EXEC files.
1305         * target.cc (Target::do_make_elf_object_implementation): Allow
1306         ET_EXEC files with --just-symbols option.
1307
1308 2011-07-28  Cary Coutant  <ccoutant@google.com>
1309
1310         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1311         Add thread_number parameter.
1312         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1313         * workqueue-threads.cc
1314         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1315         current thread if its thread number is greater than desired thread
1316         count.
1317         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1318         Add thread_number parameter.
1319         (Workqueue::should_cancel_thread): Likewise.
1320         (Workqueue::find_runnable_or_wait): Pass thread_number to
1321         should_cancel_thread.
1322         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1323         parameter.
1324
1325 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1326
1327         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1328         only after checking if it cannot be forced local.
1329         * symtab.h (is_externally_visible): Check if the symbol is not forced
1330         local.
1331
1332 2011-07-15  Ian Lance Taylor  <iant@google.com>
1333
1334         * options.h (class General_options): Add --print-output-format.
1335         Move -EL next to -EB, for  better --help output.
1336         * target-select.cc: Include <cstdio>, "options.h", and
1337         "parameters.h".
1338         (Target_selector::do_target_bfd_name): New function.
1339         (print_output_format): New function.
1340         * target-select.h (class Target_selector): Update declarations.
1341         (Target_selector::target_bfd_name): New function.
1342         (print_output_format): Declare.
1343         * main.cc: Include "target-select.h".
1344         (main): Handle --print-output-format.
1345         * gold.cc: Include "target-select.h".
1346         (queue_initial_tasks): Handle --print-output-format when there are
1347         no input files.
1348         * parameters.cc (parameters_force_valid_target): Give a better
1349         error message if -EB/-EL does not match target.
1350         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1351         function.
1352
1353 2011-07-15  Ian Lance Taylor  <iant@google.com>
1354
1355         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1356         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1357         (Output_data_plt_i386::do_write): Write address of .dynamic
1358         section to first entry in .got.plt section.
1359         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1360         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1361         Initialize layout_.
1362         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1363         section to first entry in .got.plt section.
1364         * layout.h (Layout::dynamic_section): New function.
1365
1366 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1367
1368         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1369         to claim_file call.
1370         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1371         input_section_position_, and input_section_glob_.
1372         (read_layout_from_file): Call function section_ordering_specified.
1373         * layout.h (is_section_ordering_specified): New function.
1374         (section_ordering_specified): New function.
1375         (section_ordering_specified_): New boolean member.
1376         * main.cc(main): Call load_plugins after layout object is defined.
1377         * output.cc (Output_section::add_input_section): Use
1378         function section_ordering_specified to check if section ordering is
1379         needed.
1380         * output.cc (Output_section::add_relaxed_input_section): Use
1381         function section_ordering_specified to check if section ordering is
1382         needed.
1383         (Output_section::update_section_layout): New function.
1384         (Output_section::sort_attached_input_sections): Check if input section
1385         must be reordered.
1386         * output.h (Output_section::update_section_layout): New function.
1387         * plugin.cc (get_section_count): New function.
1388         (get_section_type): New function.
1389         (get_section_name): New function.
1390         (get_section_contents): New function.
1391         (update_section_order): New function.
1392         (allow_section_ordering): New function.
1393         (Plugin::load): Add the new interfaces to the transfer vector.
1394         (Plugin_manager::load_plugins): New parameter.
1395         (Plugin_manager::all_symbols_read): New parameter.
1396         (Plugin_manager::claim_file): New parameter. Save the elf object for
1397         unclaimed objects.
1398         (Plugin_manager::get_elf_object): New function.
1399         (Plugin_manager::get_view): Change to directly use the bool to check
1400         if get_view is called from claim_file_hook.
1401         * plugin.h (input_objects): New function
1402         (Plugin__manager::load_plugins): New parameter.
1403         (Plugin_manager::claim_file): New parameter.
1404         (Plugin_manager::get_elf_object): New function.
1405         (Plugin_manager::in_claim_file_handler): New function.
1406         (Plugin_manager::in_claim_file_handler_): New member.
1407         (layout): New function.
1408         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1409         handler with an extra parameter. Make the elf object before calling
1410         claim_file handler.
1411         * testsuite/plugin_test.c (get_section_count): New function pointer.
1412         (get_section_type): New function pointer.
1413         (get_section_name): New function pointer.
1414         (get_section_contents): New function pointer.
1415         (update_section_order): New function pointer.
1416         (allow_section_ordering): New function pointer.
1417         (onload): Check if the new interfaces exist.
1418
1419 2011-07-13  Ian Lance Taylor  <iant@google.com>
1420
1421         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1422         relro section.
1423         * x86_64.cc (Target_x86_64::got_section): Likewise.
1424         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1425         (relro_now_test_SOURCES): New variable.
1426         (relro_now_test_DEPENDENCIES): New variable.
1427         (relro_now_test_LDFLAGS): New variable.
1428         (relro_now_test_LDADD): New variable.
1429         (relro_now_test.so): New target.
1430         * testsuite/Makefile.in: Rebuild.
1431
1432 2011-07-12  Ian Lance Taylor  <iant@google.com>
1433
1434         PR gold/12980
1435         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1436         GLOB_DAT relocation rather than a RELATIVE relocation for a
1437         protected symbol when creating a shared library.
1438         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1439         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1440         * testsuite/protected_main_1.cc (main): Test that protected
1441         function has same address.
1442
1443 2011-07-11  Ian Lance Taylor  <iant@google.com>
1444
1445         PR gold/12979
1446         * options.h (class General_options): Add -Bgroup.
1447         * options.cc (General_options::finalize): If -Bgroup is set,
1448         default to --unresolved-symbols=report-all.
1449         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1450         * target-reloc.h (issue_undefined_symbol_error): Handle
1451         --unresolved-symbols=report-all.
1452
1453 2011-07-08  Ian Lance Taylor  <iant@google.com>
1454
1455         PR gold/11985
1456         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1457         if linker script discards key sections.
1458         (Layout::create_dynamic_symtab): Likewise.
1459         (Layout::assign_local_dynsym_offsets): Likewise.
1460         (Layout::sized_create_version_sections): Likewise.
1461         (Layout::create_interp): Likewise.
1462         (Layout::finish_dynamic_section): Likewise.
1463         (Layout::set_dynamic_symbol_size): Likewise.
1464
1465 2011-07-08  Ian Lance Taylor  <iant@google.com>
1466
1467         PR gold/12386
1468         * options.h (class General_options): Add --unresolved-symbols.
1469         * target-reloc.h (issue_undefined_symbol_error): Check
1470         --unresolved-symbols.  Add comments.
1471
1472 2011-07-08  Ian Lance Taylor  <iant@google.com>
1473
1474         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1475         expression more complex.
1476
1477 2011-07-08  Ian Lance Taylor  <iant@google.com>
1478
1479         PR gold/11317
1480         * target-reloc.h (issue_undefined_symbol_error): New inline
1481         function, broken out of relocate_section.
1482         (relocate_section): Call issue_undefined_symbol_error.
1483         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1484         there is no TLS segment if we are about to issue an undefined
1485         symbol error.
1486         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1487
1488 2011-07-08  Ian Lance Taylor  <iant@google.com>
1489
1490         PR gold/12279
1491         * resolve.cc (Symbol_table::should_override): Add fromtype
1492         parameter.  Change all callers.  Give error when linking together
1493         TLS and non-TLS symbol.
1494         (Symbol_table::should_override_with_special): Add fromtype
1495         parameter.  Change all callers.
1496         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1497         there is no TLS segment if we have reported some errors.
1498         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1499
1500 2011-07-08  Ian Lance Taylor  <iant@google.com>
1501
1502         PR gold/12372
1503         * target.h (Target::plt_address_for_global): New function.
1504         (Target::plt_address_for_local): New function.
1505         (Target::plt_section_for_global): Remove.
1506         (Target::plt_section_for_local): Remove.
1507         (Target::do_plt_address_for_global): New virtual function.
1508         (Target::do_plt_address_for_local): New virtual function.
1509         (Target::do_plt_section_for_global): Remove.
1510         (Target::do_plt_section_for_local): Remove.
1511         (Target::register_global_plt_entry): Add Symbol_table and Layout
1512         parameters.
1513         * output.cc (Output_data_got::Got_entry::write): Use
1514         plt_address_for_global and plt_address_for_local.
1515         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1516         address of output section.
1517         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1518         got_irelative_, and irelative_count_ fields.  Update
1519         declarations.
1520         (Output_data_plt_i386::has_irelative_section): New function.
1521         (Output_data_plt_i386::entry_count): Add irelative_count_.
1522         (Output_data_plt_i386::set_final_data_size): Likewise.
1523         (class Target_i386): Add got_irelative_ and rel_irelative_
1524         fields.  Update declarations.
1525         (Target_i386::Target_i386): Initialize new fields.
1526         (Target_i386::do_plt_address_for_global): New function replacing
1527         do_plt_section_for_global.
1528         (Target_i386::do_plt_address_for_local): New function replacing
1529         do_plt_section_for_local.
1530         (Target_i386::got_section): Create got_irelative_.
1531         (Target_i386::rel_irelative_section): New function.
1532         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1533         fields.  Don't define __rel_iplt_{start,end}.
1534         (Output_data_plt_i386::add_entry): Add symtab and layout
1535         parameters.  Change all callers.  Use different PLT and GOT for
1536         IFUNC symbols.
1537         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1538         layout parameters.  Change all callers.  Use different PLT and
1539         GOT.
1540         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1541         (Output_data_plt_i386::rel_irelative): New function.
1542         (Output_data_plt_i386::address_for_global): New function.
1543         (Output_data_plt_i386::address_for_local): New function.
1544         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1545         IRELATIVE GOT when changing IFUNC GOT entries.
1546         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1547         reloc.
1548         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1549         if we didn't create an IRELATIVE GOT.
1550         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1551         plt_address_for_local.
1552         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1553         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1554         got_irelative_, and irelative_count_ fields.  Update
1555         declarations.
1556         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1557         Initialize new fields.  Remove symtab parameter.  Change all
1558         callers.
1559         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1560         irelative_count_.
1561         (Output_data_plt_x86_64::has_irelative_section): New function.
1562         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1563         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1564         fields.  Update declarations.
1565         (Target_x86_64::Target_x86_64): Initialize new fields.
1566         (Target_x86_64::do_plt_address_for_global): New function replacing
1567         do_plt_section_for_global.
1568         (Target_x86_64::do_plt_address_for_local): New function replacing
1569         do_plt_section_for_local.
1570         (Target_x86_64::got_section): Create got_irelative_.
1571         (Target_x86_64::rela_irelative_section): New function.
1572         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1573         all callers.  Don't create __rel_iplt_{start,end}.
1574         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1575         parameters.  Change all callers.  Use different PLT and GOT for
1576         IFUNC symbols.
1577         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1578         layout parameters.  Change all callers.  Use different PLT and
1579         GOT.
1580         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1581         parameters.  Change all callers.  Use different PLT and GOT for
1582         IFUNC symbols.
1583         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1584         (Output_data_plt_x86_64::rela_irelative): New function.
1585         (Output_data_plt_x86_64::address_for_global): New function.
1586         (Output_data_plt_x86_64::address_for_local): New function.
1587         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1588         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1589         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1590         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1591         parameters.
1592         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1593         reloc.
1594         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1595         symbols if we didn't create an IRELATIVE GOT.
1596         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1597         plt_address_for_local.
1598         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1599         * testsuite/ifuncvar1.c: New test file.
1600         * testsuite/ifuncvar2.c: New test file.
1601         * testsuite/ifuncvar3.c: New test file.
1602         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1603         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1604         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1605         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1606         * testsuite/Makefile.in: Rebuild.
1607
1608 2011-07-07  Cary Coutant  <ccoutant@google.com>
1609
1610         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1611         (two_file_test_1_ndebug.o): Likewise.
1612         (two_file_test_1b_ndebug.o): Likewise.
1613         (two_file_test_2_ndebug.o): Likewise.
1614         (two_file_test_main_ndebug.o): Likewise.
1615         (incremental_test_2): Link with no-debug versions.
1616
1617 2011-07-06  Cary Coutant  <ccoutant@google.com>
1618
1619         * gold/incremental.cc
1620         (Output_section_incremental_inputs::write_info_blocks): Check for
1621         hidden and internal symbols.
1622
1623 2011-07-06  Cary Coutant  <ccoutant@google.com>
1624
1625         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1626         Check disposition for startup file.
1627         (Incremental_inputs::report_command_line): Ignore
1628         --incremental-startup-unchanged option.
1629         * options.cc (General_options::parse_incremental_startup_unchanged):
1630         New function.
1631         (General_options::General_options): Initialize new data member.
1632         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1633         (General_options): Add --incremental-startup-unchanged option.
1634         (General_options::incremental_startup_disposition): New function.
1635         (General_options::incremental_startup_disposition_): New data member.
1636
1637 2011-07-06  Cary Coutant  <ccoutant@google.com>
1638
1639         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1640         input file index to Script_info ctor.
1641         (Sized_incremental_binary::do_file_has_changed): Find the
1642         command-line argument for files named in scripts.
1643         * incremental.h (Script_info::Script_info): New ctor
1644         with input file index.
1645         (Script_info::input_file_index): New function.
1646         (Script_info::input_file_index_): New data member.
1647         (Incremental_binary::get_library): Add const.
1648         (Incremental_binary::get_script_info): Add const.
1649         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1650         * testsuite/Makefile.am (incremental_test_5): New test case.
1651         (incremental_test_6): New test case.
1652         * testsuite/Makefile.in: Regenerate.
1653
1654 2011-07-06  Cary Coutant  <ccoutant@google.com>
1655
1656         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1657         debug output when command lines differ.
1658
1659 2011-07-06  Cary Coutant  <ccoutant@google.com>
1660
1661         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1662         --incremental-patch option.
1663         * layout.cc (Free_list::allocate): Extend allocation beyond original
1664         end if enabled.
1665         (Layout::make_output_section): Mark sections that should get
1666         patch space.
1667         * options.cc (parse_percent): New function.
1668         * options.h (parse_percent): New function.
1669         (DEFINE_percent): New macro.
1670         (General_options): Add --incremental-patch option.
1671         * output.cc (Output_section::Output_section): Initialize new data
1672         members.
1673         (Output_section::add_input_section): Print section name when out
1674         of patch space.
1675         (Output_section::add_output_section_data): Likewise.
1676         (Output_section::set_final_data_size): Add patch space when
1677         doing --incremental-full.
1678         (Output_section::do_reset_address_and_file_offset): Remove patch
1679         space.
1680         (Output_segment::set_section_list_addresses): Print debug output
1681         only if --incremental-update.
1682         * output.h (Output_section::set_is_patch_space_allowed): New function.
1683         (Output_section::is_patch_space_allowed_): New data member.
1684         (Output_section::patch_space_): New data member.
1685         * parameters.cc (Parameters::incremental_full): New function.
1686         * parameters.h (Parameters::incremental_full): New function
1687         * testsuite/Makefile.am (incremental_test_2): Add test for
1688         --incremental-patch option.
1689         * testsuite/Makefile.in: Regenerate.
1690         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1691         (t18): Remove function body.
1692
1693 2011-07-05  Doug Kwan  <dougkwan@google.com>
1694
1695         PR gold/12771
1696         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1697         Arm_Address type for relocation result.
1698         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1699         overflow check.
1700         (Arm_relocate_functions::abs32): Use unaligned access.
1701         (Arm_relocate_functions::rel32): Ditto.
1702         (Arm_relocate_functions::prel31): Ditto.
1703         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1704         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1705         static data relocations.
1706         * testsuite/Makefile.in: Regnerate.
1707         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1708
1709 2011-07-05  Ian Lance Taylor  <iant@google.com>
1710
1711         PR gold/12392
1712         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1713         symbols if necessary.
1714         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1715
1716 2011-07-05  Ian Lance Taylor  <iant@google.com>
1717
1718         PR gold/12952
1719         * resolve.cc (Symbol::override_base_with_special): Simply override
1720         version with special symbol version, ignoring previous version.
1721
1722 2011-07-05  Ian Lance Taylor  <iant@google.com>
1723
1724         * object.cc (Sized_relobj_file::include_section_group): Add
1725         information to comment about signature location.
1726
1727 2011-07-02  Ian Lance Taylor  <iant@google.com>
1728
1729         PR gold/12957
1730         * options.h (class General_options): Add -f and -F.
1731         * options.cc (General_options::finalize): Fatal error if -f/-F
1732         are used without -shared.
1733         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1734
1735 2011-07-02  Ian Lance Taylor  <iant@google.com>
1736
1737         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1738
1739 2011-07-01  Ian Lance Taylor  <iant@google.com>
1740
1741         PR gold/12525
1742         PR gold/12952
1743         * resolve.cc (Symbol::override_base_with_special): Don't override
1744         the version if the overriding symbol has a different name.
1745         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1746         all callers.  If we give an error about an undefined version,
1747         define the base version if necessary.
1748         * dynobj.h (class Versions): Update declaration.
1749         * testsuite/weak_alias_test_5.cc: New file.
1750         * testsuite/weak_alias_test.script: New file.
1751         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1752         and versioned_alias have the right value, and call t2.
1753         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1754         weak_alias_test_5.so.
1755         (weak_alias_test_LDADD): Likewise.
1756         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1757         * testsuite/Makefile.in: Rebuild.
1758
1759 2011-07-01  Ian Lance Taylor  <iant@google.com>
1760
1761         PR gold/12525
1762         * options.h (class General_options): Support -z notext.
1763         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1764         -Wl,-z,notext.
1765         (two_file_shared_nonpic.so): Likewise.
1766         (two_file_shared_mixed.so): Likewise.
1767         (two_file_shared_mixed_1.so): Likewise.
1768         (weak_undef_lib_nonpic.so): Likewise.
1769         (alt/weak_undef_lib_nonpic.so): Likewise.
1770         (tls_test_shared_nonpic.so): Likewise.
1771         * testsuite/Makefile.in: Rebuild.
1772
1773 2011-07-01  Ian Lance Taylor  <iant@google.com>
1774
1775         PR gold/12525
1776         * configure.ac: Test whether static linking works, setting
1777         the automake conditional HAVE_STATIC.
1778         * testsuite/Makefile.am: Disable tests using -static if
1779         HAVE_STATIC is not true.
1780         * configure, testsuite/Makefile.in: Rebuild.
1781
1782 2011-07-01  Ian Lance Taylor  <iant@google.com>
1783
1784         PR gold/12525
1785         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1786         Assert if we see DW_EH_PE_indirect.
1787         * target.h (Target::ehframe_datarel_base): New function.
1788         (Target::do_ehframe_datarel_base): New target function.
1789         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1790         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1791         function.
1792
1793 2011-07-01  Ian Lance Taylor  <iant@google.com>
1794
1795         PR gold/12571
1796         * options.h (class General_options): Add
1797         --ld-generated-unwind-info.
1798         * ehframe.cc (Fde::write): Add address parameter.  Change all
1799         callers.  If associated with PLT, fill in address and size.
1800         (Cie::set_output_offset): Only add merge mapping if there is an
1801         object.
1802         (Cie::write): Add address parameter.  Change all callers.
1803         (Eh_frame::add_ehframe_for_plt): New function.
1804         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1805         input_offset_ fields into union u_, with new plt field.
1806         (Fde::Fde): Adjust for new union field.
1807         (Fde::Fde) [Output_data version]: New constructor.
1808         (Fde::add_mapping): Only add merge mapping if there is an object.
1809         (class Cie): Update declarations.
1810         (class Eh_frame): Declare add_ehframe_for_plt.
1811         * layout.cc (Layout::layout_eh_frame): Break out code into
1812         make_eh_frame_section, and call it.
1813         (Layout::make_eh_frame_section): New function.
1814         (Layout::add_eh_frame_for_plt): New function.
1815         * layout.h (class Layout): Update declarations.
1816         * merge.cc (Merge_map::add_mapping): Add assertion.
1817         * i386.cc: Include "dwarf.h".
1818         (class Output_data_plt_i386): Make first_plt_entry,
1819         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1820         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1821         and plt_eh_frame_fde.
1822         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1823         boundary.  Call add_eh_frame_for_plt if appropriate.
1824         * x86_64.cc: Include "dwarf.h".
1825         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1826         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1827         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1828         and plt_eh_frame_fde.
1829         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1830         appropriate.
1831
1832 2011-06-29  Ian Lance Taylor  <iant@google.com>
1833
1834         PR gold/12629
1835         * object.cc (Sized_relobj_file::layout_section): Change shdr
1836         parameter to be const.
1837         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1838         out of do_layout.
1839         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1840         appropriate.  Call layout_eh_frame_section.
1841         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1842         sections.
1843         * object.h (class Sized_relobj_file): Update declarations.
1844
1845 2011-06-29  Ian Lance Taylor  <iant@google.com>
1846
1847         PR gold/12652
1848         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1849         modifier.
1850         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1851
1852 2011-06-29  Ian Lance Taylor  <iant@google.com>
1853
1854         PR gold/12675
1855         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1856         SHT_X86_64_UNWIND.
1857         * layout.cc (Layout::layout_eh_frame): Likewise.
1858
1859 2011-06-29  Ian Lance Taylor  <iant@google.com>
1860
1861         PR gold/12695
1862         * layout.cc (Layout::symtab_section_shndx): New function.
1863         * layout.h (class Layout): Declare symtab_section_shndx.
1864         * output.cc (Output_section::write_header): Call it.
1865
1866 2011-06-29  Ian Lance Taylor  <iant@google.com>
1867
1868         PR gold/12818
1869         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1870         symbols which are not used in a relocation.
1871
1872 2011-06-28  Ian Lance Taylor  <iant@google.com>
1873
1874         PR gold/12898
1875         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1876         script create indistinguishable segments.
1877         (Layout::set_segment_offsets): Use stable_sort when sorting
1878         segments.  Pass this to Compare_segments constructor.
1879         * layout.h (class Layout): Make segment_precedes non-static.
1880         (class Compare_segments): Change from struct to class.  Add
1881         layout_ field.  Add constructor.
1882         * script-sections.cc
1883         (Script_sections::attach_sections_using_phdrs_clause): Rename
1884         local orphan to is_orphan.  Don't report failure to put empty
1885         section in segment.  On attachment failure, report name of
1886         section, and attach to first PT_LOAD segment.
1887
1888 2011-06-28  Ian Lance Taylor  <iant@google.com>
1889
1890         PR gold/12934
1891         * target-select.cc (Target_selector::Target_selector): Add
1892         emulation parameter.  Change all callers.
1893         (select_target_by_bfd_name): Rename from select_target_by_name.
1894         Change all callers.
1895         (select_target_by_emulation): New function.
1896         (supported_emulation_names): New function.
1897         * target-select.h (class Target_selector): Add emulation_ field.
1898         Update declarations.
1899         (Target_selector::recognize_by_bfd_name): Rename from
1900         recognize_by_name.  Change all callers.
1901         (Target_selector::supported_bfd_names): Rename from
1902         supported_names.  Change all callers.
1903         (Target_selector::recognize_by_emulation): New function.
1904         (Target_selector::supported_emulations): New function.
1905         (Target_selector::emulation): New function.
1906         (Target_selector::do_recognize_by_bfd_name): Rename from
1907         do_recognize_by_name.  Change all callers.
1908         (Target_selector::do_supported_bfd_names): Rename from
1909         do_supported_names.  Change all callers.
1910         (Target_selector::do_recognize_by_emulation): New function.
1911         (Target_selector::do_supported_emulations): New function.
1912         (select_target_by_bfd_name): Change name in declaration.
1913         (select_target_by_emulation): Declare.
1914         (supported_emulation_names): Declare.
1915         * parameters.cc (parameters_force_valid_target): Try to find
1916         target based on emulation from -m option.
1917         * options.h (class General_options): Change doc string for -m.
1918         * options.cc (help): Print emulations.
1919         (General_options::parse_V): Likewise.
1920         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1921         Add emulation parameter.  Change all callers.
1922
1923 2011-06-28  Ian Lance Taylor  <iant@google.com>
1924
1925         * target.h (class Target): Add osabi_ field.
1926         (Target::osabi): New function.
1927         (Target::set_osabi): New function.
1928         (Target::Target): Initialize osabi_.
1929         (Target::do_adjust_elf_header): Make pure virtual.
1930         (Sized_target::do_adjust_elf_header): Declare.
1931         * target.cc (Sized_target::do_adjust_elf_header): New function.
1932         (class Sized_target): Instantiate all versions.
1933         * freebsd.h (class Target_freebsd): Remove.
1934         (Target_selector_freebsd::do_recognize): Call set_osabi on
1935         Target.
1936         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1937         (Target_selector_freebsd::set_osabi): Remove.
1938         * i386.cc (class Target_i386): Inherit from Sized_target rather
1939         than Target_freebsd.
1940         * x86_64.cc (class Target_x86_64): Likewise.
1941
1942 2011-06-28  Ian Lance Taylor  <iant@google.com>
1943
1944         * target.h (Target::can_check_for_function_pointers): Rewrite.
1945         Make non-virtual.
1946         (Target::can_icf_inline_merge_sections): Likewise.
1947         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1948         (Target::Target_info): Add can_icf_inline_merge_sections field.
1949         (Target::do_can_check_for_function_pointers): New virtual
1950         function.
1951         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1952         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1953         from can_check_for_function_pointers, move in file.
1954         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1955         section_may_have_icf_unsafe_poineters, move in file.
1956         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1957         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1958         Rename from can_check_for_function_pointers, move in file.
1959         (Target_i386::can_icf_inline_merge_sections): Remove.
1960         (Target_i386::i386_info): Initialize
1961         can_icf_inline_merge_sections.
1962         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1963         Initialize can_icf_inline_merge_sections.
1964         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1965         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1966         Rename from can_check_for_function_pointers, move in file.
1967         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1968         (Target_x86_64::x86_64_info): Initialize
1969         can_icf_inline_merge_sections.
1970         * testsuite/testfile.cc (Target_test::test_target_info):
1971         Likewise.
1972         * icf.cc (get_section_contents): Correct formatting.
1973
1974 2011-06-27  Ian Lance Taylor  <iant@google.com>
1975
1976         * symtab.cc (Symbol::versioned_name): New function.
1977         (Symbol_table::add_to_final_symtab): Use versioned_name when
1978         appropriate.
1979         (Symbol_table::sized_write_symbol): Likewise.
1980         * symtab.h (class Symbol): Declare versioned_name.
1981         * stringpool.h (class Stringpool_template): Add variant of add
1982         which takes a std::basic_string.
1983         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1984         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1985         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1986         (ver_test_12.o): New target.
1987         * testsuite/Makefile.in: Rebuild.
1988
1989 2011-06-27  Doug Kwan  <dougkwan@google.com>
1990
1991         * arm.cc (Arm_relocate_functions::thm_jump8,
1992         Arm_relocate_functions::thm_jump11): Use a wider signed
1993         type to compute offset.
1994         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1995         arm_thm_jump8.
1996         * testsuite/Makefile.in: Regenerate.
1997         * testsuite/arm_branch_in_range.sh: Check test results of
1998         arm_thm_jump11 and arm_thm_jump8.
1999         * testsuite/arm_thm_jump11.s: New test source file.
2000         * testsuite/arm_thm_jump11.t: New linker script.
2001         * testsuite/arm_thm_jump8.s: New test source file.
2002         * testsuite/arm_thm_jump8.t: New linker script.
2003
2004 2011-06-24  Ian Lance Taylor  <iant@google.com>
2005
2006         * layout.cc: Include "object.h".
2007         (ctors_sections_in_init_array): New static variable.
2008         (Layout::is_ctors_in_init_array): New function.
2009         (Layout::layout): Add entry to ctors_sections_in_init_array if
2010         appropriate.
2011         * layout.h (class Layout): Declare is_ctors_in_init_array.
2012         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2013         is_ctors_reverse_view is set.
2014         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2015         all callers.  Set is_ctors_reverse_view field of View_size.
2016         (Sized_relobj_file::reverse_words): New function.
2017         * object.h (Sized_relobj_file::View_size): Add
2018         is_ctors_reverse_view field.
2019         (class Sized_relobj_file): Update declarations.
2020         * testsuite/initpri3.c: New test.
2021         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2022         initpri3b.
2023         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2024         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2025         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2026         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2027         * testsuite/Makefile.in: Rebuild.
2028
2029 2011-06-24  Cary Coutant  <ccoutant@google.com>
2030
2031         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2032         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2033         (debug_msg_cdebug.err): New targets.
2034         * testsuite/Makefile.in: Regenerate.
2035         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2036         Fix checks for link with shared library.
2037
2038 2011-06-24  Doug Kwan  <dougkwan@google.com>
2039
2040         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2041         skip empty text sections.
2042         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2043
2044 2011-06-22  Ian Lance Taylor  <iant@google.com>
2045
2046         PR gold/12910
2047         * options.h (class General_options): Add --ctors-in-init-array.
2048         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2049         friends as SHT_PROGBITS for merging sections.
2050         (Layout::layout): Remove special handling of .init_array and
2051         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2052         and .dtors if ctors_in_init_array.
2053         (Layout::make_output_section): Force correct section types for
2054         .init_array and friends.  Don't sort if doing relocatable link,
2055         Don't sort .ctors and .dtors if ctors_in_init_array.
2056         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2057         (Layout::output_section_name): Add relobj parameter.  Change all
2058         callers.  Handle .ctors. and .dtors. in code rather than table.
2059         Handle .ctors and .dtors if ctors_in_init_array.
2060         (Layout::match_file_name): New function, moved from output.cc.
2061         * layout.h (class Layout): Update declarations.
2062         * output.cc: Include "layout.h".
2063         (Input_section_sort_entry::get_priority): New function.
2064         (Input_section_sort_entry::match_file_name): Just call
2065         Layout::match_file_name.
2066         (Output_section::Input_section_sort_init_fini_compare::operator()):
2067         Handle .ctors and .dtors.  Sort by explicit priority rather than
2068         by name.
2069         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2070         * testsuite/initpri2.c: New test.
2071         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2072         (check_PROGRAMS): Add initpri2.
2073         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2074         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2075         * configure, testsuite/Makefile.in: Rebuild.
2076
2077 2011-06-19  Ian Lance Taylor  <iant@google.com>
2078
2079         PR gold/12880
2080         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2081         .interp section to a PT_INTERP segment even if we have seen a
2082         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2083         clause in a linker script.
2084         (Layout::finalize): Don't create a .interp section if we've
2085         already create a PT_INTERP segment.
2086         (Layout::create_interp): Always call choose_output_section (revert
2087         patch of 2011-06-17).  Don't create PT_INTERP segment.
2088         * script-sections.cc
2089         (Script_sections::create_note_and_tls_segments): Add a .interp
2090         section to a PT_INTERP segment even if we have seen a
2091         --dynamic-linker option.
2092
2093 2011-06-18  Ian Lance Taylor  <iant@google.com>
2094
2095         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2096         merely because a non-PT_LOAD segment has a dynamic reloc.
2097
2098 2011-06-18  Ian Lance Taylor  <iant@google.com>
2099
2100         * layout.cc (Layout::finish_dynamic_section): Don't create
2101         DT_FLAGS entry if not needed.
2102
2103 2011-06-18  Ian Lance Taylor  <iant@google.com>
2104
2105         PR gold/12745
2106         * layout.cc (Layout::layout_eh_frame): Correct handling of
2107         writable .eh_frame section.
2108
2109 2011-06-17  Ian Lance Taylor  <iant@google.com>
2110
2111         PR gold/12893
2112         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2113         symbol is redefined with the exact same object and value.
2114
2115 2011-06-17  Ian Lance Taylor  <iant@google.com>
2116
2117         PR gold/12880
2118         * layout.h (class Layout): Add interp_segment_ field.
2119         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2120         (Layout::attach_allocated_section_to_segment): If making shared
2121         library, put .interp section in PT_INTERP segment.
2122         (Layout::finalize): Also call create_interp if -dynamic-linker
2123         option was used.
2124         (Layout::create_interp): Assert that there is no PT_INTERP
2125         segment.  If not using a SECTIONS clause, use make_output_section.
2126         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2127         * script-sections.cc
2128         (Script_sections::create_note_and_tls_segments): If making shared
2129         library, put .interp section in PT_INTERP segment.
2130
2131 2011-06-17  Ian Lance Taylor  <iant@google.com>
2132
2133         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2134         when making a shared library.
2135
2136 2011-06-17  Ian Lance Taylor  <iant@google.com>
2137
2138         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2139         parameter.  Change all callers.  Don't issue warning about PC32
2140         against locally defined symbol.
2141
2142 2011-06-16  Ian Lance Taylor  <iant@google.com>
2143
2144         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2145         occurs in same object.
2146
2147 2011-06-14  Alan Modra  <amodra@gmail.com>
2148
2149         * po/POTFILES.in: Regenerate.
2150
2151 2011-06-09  Ian Lance Taylor  <iant@google.com>
2152
2153         * script-sections.cc
2154         (Orphan_output_section::set_section_addresses): For a relocatable
2155         link set address to 0.
2156
2157 2011-06-09  Cary Coutant  <ccoutant@google.com>
2158
2159         PR gold/12804
2160         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2161         used with --compress-debug-sections.
2162         * gold/object.cc (Sized_relobj_file::do_layout): Report
2163         uncompressed size of compressed input sections.
2164
2165 2011-06-08  Cary Coutant  <ccoutant@google.com>
2166
2167         PR gold/12804
2168         * testsuite/two_file_test_2_v1.cc: Change initialization of
2169         v2 to keep it in .data.
2170
2171 2011-06-07  Cary Coutant  <ccoutant@google.com>
2172
2173         * common.cc (Symbol_table::do_allocate_commons_list): Call
2174         gold_fallback.
2175         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2176         (Errors::fallback): New function.
2177         (gold_fallback): New function.
2178         * errors.h (Errors::fallback): New function.
2179         * gold.cc (gold_exit): Change status parameter to enum; adjust
2180         all callers.
2181         (queue_initial_tasks): Call gold_fallback.
2182         * gold.h: Include cstdlib.
2183         (Exit_status): New enum type.
2184         (gold_exit): Change status parameter to enum.
2185         (gold_fallback): New function.
2186         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2187         (Layout::create_symtab_sections): Likewise.
2188         (Layout::create_shdrs): Likewise.
2189         * main.cc (main): Adjust call to gold_exit.
2190         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2191         (Output_data_got::add_got_entry_pair): Likewise.
2192         (Output_section::add_input_section): Likewise.
2193         (Output_section::add_output_section_data): Likewise.
2194         (Output_segment::set_section_list_addresses): Likewise.
2195         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2196
2197 2011-06-07  Cary Coutant  <ccoutant@google.com>
2198
2199         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2200         for incremental links.
2201         * output.cc (Output_segment::set_section_list_addresses): Remove
2202         FIXME and test for TLS or BSS.
2203
2204 2011-06-07  Cary Coutant  <ccoutant@google.com>
2205
2206         * testsuite/Makefile.am: Add incremental_copy_test,
2207         incremental_common_test_1.
2208         * testsuite/Makefile.in: Regenerate.
2209         * testsuite/common_test_1_v1.c: New source file.
2210         * testsuite/common_test_1_v2.c: New source file.
2211         * testsuite/copy_test_v1.cc: New source file.
2212
2213 2011-06-07  Cary Coutant  <ccoutant@google.com>
2214
2215         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2216         update, allocate common from bss section's free list.
2217         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2218         linker-defined symbols.
2219         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2220         Skip GOT and PLT entries that are no longer referenced.
2221         (Output_section_incremental_inputs::write_info_blocks): Mark
2222         linker-defined symbols.
2223         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2224         * output.cc (Output_section::allocate): New function.
2225         * output.h (Output_section::allocate): New function.
2226         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2227         linker-defined symbols.
2228         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2229         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2230         (Symbol::init_base_output_data): Likewise.
2231         (Symbol::init_base_output_segment): Likewise.
2232         (Symbol::init_base_constant): Likewise.
2233         (Sized_symbol::init_output_data): Likewise.
2234         (Sized_symbol::init_output_segment): Likewise.
2235         (Sized_symbol::init_constant): Likewise.
2236         (Symbol_table::do_define_in_output_data): Likewise.
2237         (Symbol_table::do_define_in_output_segment): Likewise.
2238         (Symbol_table::do_define_as_constant): Likewise.
2239         * symtab.h (Symbol::is_predefined): New function.
2240         (Symbol::init_base_output_data): Add is_predefined parameter.
2241         (Symbol::init_base_output_segment): Likewise.
2242         (Symbol::init_base_constant): Likewise.
2243         (Symbol::is_predefined_): New data member.
2244         (Sized_symbol::init_output_data): Add is_predefined parameter.
2245         (Sized_symbol::init_output_segment): Likewise.
2246         (Sized_symbol::init_constant): Likewise.
2247         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2248
2249 2011-06-07  Cary Coutant  <ccoutant@google.com>
2250
2251         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2252         instead of emit_copy_reloc.
2253         (Copy_relocs::emit_copy_reloc): Refactor.
2254         (Copy_relocs::make_copy_reloc): New function.
2255         (Copy_relocs::add_copy_reloc): Remove.
2256         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2257         section.
2258         (Copy_relocs::make_copy_reloc): New function.
2259         (Copy_relocs::add_copy_reloc): Remove.
2260         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2261         unchanged input files.
2262         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2263         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2264         Reserve BSS space for COPY relocations.
2265         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2266         (Output_section_incremental_inputs::write_info_blocks): Record
2267         whether a symbol is copied from a shared object.
2268         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2269         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2270         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2271         (Incremental_input_entry_reader::get_output_symbol_index): Add
2272         is_copy parameter.
2273         (Incremental_binary::emit_copy_relocs): New function.
2274         (Incremental_binary::do_emit_copy_relocs): New function.
2275         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2276         new data member.
2277         (Sized_incremental_binary::add_copy_reloc): New function.
2278         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2279         (Sized_incremental_binary::Copy_reloc): New struct.
2280         (Sized_incremental_binary::Copy_relocs): New typedef.
2281         (Sized_incremental_binary::copy_relocs_): New data member.
2282         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2283         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2284         * target.h (Sized_target::emit_copy_reloc): New function.
2285         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2286
2287 2011-06-02  Cary Coutant  <ccoutant@google.com>
2288
2289         PR gold/12163
2290         * gold/archive.cc (Archive::Archive): Initialize new data member.
2291         (Archive::include_all_members): Return if archive has already been
2292         included.
2293         * gold/archive.h (Archive::include_all_members_): New data member.
2294
2295 2011-06-02  Nick Clifton  <nickc@redhat.com>
2296
2297         * dynobj.h: Fix spelling mistake in comment.
2298         * output.cc: Likewise.
2299
2300 2011-05-31  Doug Kwan  <dougkwan@google.com>
2301             Asier Llano
2302
2303         PR gold/12826
2304         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2305         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2306         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2307         redundant arm_exidx_test.so.
2308         * testsuite/Makefile.in: Regenerate.
2309         (check_SCRIPTS): Add pr12826.sh
2310         (check_DATA): Add pr12826.stdout
2311         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2312         * testsuite/pr12826.sh: New file.
2313         * testsuite/pr12826_1.s: Ditto.
2314         * testsuite/pr12826_1.s: Ditto.
2315
2316 2011-05-30  Ian Lance Taylor  <iant@google.com>
2317
2318         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2319         sections.
2320
2321 2011-05-29  Ian Lance Taylor  <iant@google.com>
2322
2323         PR gold/12804
2324         * testsuite/Makefile.am: Use different file name for two_file_test
2325         temporary file for each incremental test.
2326         * testsuite/Makefile.in: Rebuild.
2327
2328 2011-05-29  Ian Lance Taylor  <iant@google.com>
2329
2330         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2331         binary input file is empty.
2332
2333 2011-05-27  Ian Lance Taylor  <iant@google.com>
2334
2335         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2336         (ver_test_9.so): Likewise.
2337         * testsuite/Makefile.in: Rebuild.
2338
2339 2011-05-26 Cary Coutant  <ccoutant@google.com>
2340
2341         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2342         * incremental.cc (Incremental_inputs::report_input_section): Fix
2343         comment, indentation.
2344         (Incremental_inputs::report_comdat_group): New function.
2345         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2346         of data for incremental input file entry.
2347         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2348         group count, COMDAT group signatures.
2349         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2350         an unchanged input file.
2351         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2352         Initialize new data member.
2353         (Incremental_object_entry::add_comdat_group): New function.
2354         (Incremental_object_entry::get_comdat_group_count): New function.
2355         (Incremental_object_entry::get_comdat_signature_key): New function.
2356         (Incremental_object_entry::groups_): New data member.
2357         (Incremental_inputs::report_comdat_group): New function.
2358         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2359         data for incremental input file entry.
2360         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2361         (Incremental_input_entry_reader::get_input_section): Adjust size of
2362         data for incremental input file entry.
2363         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2364         (Incremental_input_entry_reader::get_comdat_group_signature): New
2365         function.
2366         * object.cc (Sized_relobj::include_section_group): Report kept
2367         COMDAT groups for incremental links.
2368
2369 2011-05-24  David Meyer  <pdox@google.com>
2370
2371         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2372         with name parameter.  Add found_name parameter.
2373         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2374         * dirsearch.h (class Dirsearch): Update declaration.
2375
2376 2011-05-24  Ian Lance Taylor  <iant@google.com>
2377
2378         * archive.cc (Library_base::should_include_member): Pull in object
2379         from archive if it defines the entry symbol.
2380         * parameters.cc (Parameters::entry): New function.
2381         * parameters.h (class Parameters): Declare entry.
2382         * output.h (class Output_file_header): Remove entry_ field.
2383         * output.cc (Output_file_header::Output_file_header): Remove entry
2384         parameter.  Change all callers.
2385         (Output_file_header::entry): Use parameters->entry.
2386         * gold.cc (queue_middle_tasks): Likewise.
2387         * plugin.cc (Plugin_hook::run): Likewise.
2388
2389 2011-05-24 Cary Coutant  <ccoutant@google.com>
2390
2391         * gold.cc (queue_initial_tasks): Pass incremental base filename
2392         to Output_file::open_base_file; don't print error message.
2393         * incremental-dump.cc (main): Adjust call to
2394         Output_file::open_for_modification.
2395         * incremental-dump.cc (main): Likewise.
2396         * incremental.cc (Incremental_inputs::report_command_line):
2397         Ignore --incremental-base option when comparing command lines.
2398         Ignore parameter when given as separate argument.
2399         * options.h (class General_options): Add --incremental-base.
2400         * output.cc (Output_file::Output_file):
2401         (Output_file::open_base_file): Add base_name and writable parameters;
2402         read base file into new file; print error message here.
2403         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2404         callers.
2405         * output.h (Output_file::open_for_modification): Rename to...
2406         (Output_file::open_base_file): ...this; add base_name and
2407         writable parameters; adjust all callers.
2408         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2409         callers.
2410         * testsuite/Makefile.am (incremental_test_4): Test
2411         --incremental-base.
2412         * testsuite/Makefile.in: Regenerate.
2413
2414 2011-05-24 Cary Coutant  <ccoutant@google.com>
2415
2416         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2417         incremental_test_4.
2418         * testsuite/Makefile.in: Regenerate.
2419         * testsuite/two_file_test_1_v1.cc: New test source file.
2420         * testsuite/two_file_test_1b_v1.cc: New test source file.
2421         * testsuite/two_file_test_2_v1.cc: New test source file.
2422
2423 2011-05-24 Cary Coutant  <ccoutant@google.com>
2424
2425         * dynobj.h (Dynobj::do_dynobj): New function.
2426         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2427         flag and soname for shared objects.
2428         * incremental.cc (Incremental_inputs::report_object): Make
2429         either Incremental_object_entry or Incremental_dynobj_entry; add
2430         soname to string table.
2431         (Incremental_inputs::report_input_section): Add assertion.
2432         (Output_section_incremental_inputs::set_final_data_size): Adjust
2433         type of input file entry for shared libraries; adjust size of
2434         shared library info entry.
2435         (Output_section_incremental_inputs::write_input_files): Write
2436         as_needed flag for shared libraries.
2437         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2438         of input file entry for shared libraries; write soname.
2439         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2440         soname from incremental info.
2441         * incremental.h (enum Incremental_input_flags): Add
2442         INCREMENTAL_INPUT_AS_NEEDED.
2443         (Incremental_input_entry::Incremental_input_entry): Initialize new
2444         data member.
2445         (Incremental_input_entry::set_as_needed): New function.
2446         (Incremental_input_entry::as_needed): New function.
2447         (Incremental_input_entry::do_dynobj_entry): New function.
2448         (Incremental_input_entry::as_needed_): New data member.
2449         (Incremental_object_entry::Incremental_object_entry): Don't check
2450         for shared library.
2451         (Incremental_object_entry::do_type): Likewise.
2452         (class Incremental_dynobj_entry): New class.
2453         (Incremental_input_entry_reader::as_needed): New function.
2454         (Incremental_input_entry_reader::get_soname): New function.
2455         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2456         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2457         size of shared library info entry.
2458         * layout.cc (Layout::finish_dynamic_section): Don't test for
2459         incremental link when adding DT_NEEDED entries.
2460         * object.h (Object::Object): Initialize new data member.
2461         (Object::dynobj): New function.
2462         (Object::set_as_needed): New function.
2463         (Object::as_needed): New function.
2464         (Object::do_dynobj): New function.
2465         (Object::as_needed_): New data member.
2466
2467 2011-05-24 Cary Coutant  <ccoutant@google.com>
2468
2469         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2470         info; adjust display of GOT entries.
2471         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2472         vector of input objects; remove file_status_.
2473         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2474         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2475         got_plt reader; call target hooks to reserve GOT entries.
2476         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2477         of input file info header and GOT info entry.
2478         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2479         relocation info.
2480         (Got_plt_view_info::got_descriptor): Remove.
2481         (Got_plt_view_info::sym_index): New data member.
2482         (Got_plt_view_info::input_index): New data member.
2483         (Local_got_offset_visitor::visit): Write input file index.
2484         (Global_got_offset_visitor::visit): Write 0 for input file index.
2485         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2486         with sym_index and input_index.
2487         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2488         incremental info GOT entry; replace got_descriptor with input_index.
2489         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2490         map from input file index to object.
2491         (Sized_relobj_incr::do_layout): Replace direct data member reference
2492         with accessor function.
2493         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2494         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2495         Adjust size of input file info header.
2496         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2497         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2498         (Incremental_input_entry_reader::get_input_section): Adjust size of
2499         input file info header.
2500         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2501         of incremental info GOT entry.
2502         (Incremental_got_plt_reader::get_got_desc): Remove.
2503         (Incremental_got_plt_reader::get_got_symndx): New function.
2504         (Incremental_got_plt_reader::get_got_input_index): New function.
2505         (Sized_incremental_binary::Sized_incremental_binary): Remove
2506         file_status_; add input_objects_.
2507         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2508         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2509         (Sized_incremental_binary::file_is_unchanged): Remove.
2510         (Sized_incremental_binary::set_input_object): New function.
2511         (Sized_incremental_binary::input_object): New function.
2512         (Sized_incremental_binary::file_status_): Remove.
2513         (Sized_incremental_binary::input_objects_): New data member.
2514         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2515         references.
2516         (Sized_relobj_incr::invalid_address): Move to base class.
2517         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2518         class.
2519         (Sized_relobj_incr::do_output_section_offset): Likewise.
2520         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2521         (Sized_relobj_incr::section_offsets_): Likewise.
2522         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2523         function.
2524         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2525         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2526         with accessor function.
2527         (Sized_relobj_file::do_layout): Likewise.
2528         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2529         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2530         (Sized_relobj_file::compute_final_local_value): Replace refs to
2531         section_offsets_ with accessor function.
2532         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2533         * object.h (Relobj::Relobj): Initialize new data members.
2534         (Relobj::add_dyn_reloc): New function.
2535         (Relobj::first_dyn_reloc): New function.
2536         (Relobj::dyn_reloc_count): New function.
2537         (Relobj::first_dyn_reloc_): New data member.
2538         (Relobj::dyn_reloc_count_): New data member.
2539         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2540         references.
2541         (Sized_relobj::Address): New typedef.
2542         (Sized_relobj::invalid_address): Move here from child class.
2543         (Sized_relobj::Sized_relobj): Initialize new data members.
2544         (Sized_relobj::sized_relobj): New function.
2545         (Sized_relobj::is_output_section_offset_invalid): Move here from
2546         child class.
2547         (Sized_relobj::get_output_section_offset): Likewise.
2548         (Sized_relobj::local_has_got_offset): Likewise.
2549         (Sized_relobj::local_got_offset): Likewise.
2550         (Sized_relobj::set_local_got_offset): Likewise.
2551         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2552         (Sized_relobj::clear_got_offsets): New function.
2553         (Sized_relobj::section_offsets): Move here from child class.
2554         (Sized_relobj::do_output_section_offset): Likewise.
2555         (Sized_relobj::do_set_section_offset): Likewise.
2556         (Sized_relobj::Local_got_offsets): Likewise.
2557         (Sized_relobj::local_got_offsets_): Likewise.
2558         (Sized_relobj::section_offsets_): Likewise.
2559         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2560         references.
2561         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2562         class.
2563         (Sized_relobj_file::sized_relobj): New function
2564         (Sized_relobj_file::local_has_got_offset): Move to base class.
2565         (Sized_relobj_file::local_got_offset): Likewise.
2566         (Sized_relobj_file::set_local_got_offset): Likewise.
2567         (Sized_relobj_file::get_output_section_offset): Likewise.
2568         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2569         (Sized_relobj_file::do_output_section_offset): Likewise.
2570         (Sized_relobj_file::do_set_section_offset): Likewise.
2571         (Sized_relobj_file::Local_got_offsets): Likewise.
2572         (Sized_relobj_file::local_got_offsets_): Likewise.
2573         (Sized_relobj_file::section_offsets_): Likewise.
2574         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2575         (all constructors).
2576         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2577         (Output_reloc::get_symbol_index): Likewise.
2578         (Output_reloc::local_section_offset): Likewise.
2579         (Output_reloc::get_address): Likewise.
2580         (Output_reloc::symbol_value): Likewise.
2581         (Output_data_got::reserve_slot): Move to class definition.
2582         (Output_data_got::reserve_local): New function.
2583         (Output_data_got::reserve_slot_for_global): Remove.
2584         (Output_data_got::reserve_global): New function.
2585         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2586         (all constructors, two instantiations).
2587         (Output_reloc::get_relobj): New function (two instantiations).
2588         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2589         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2590         (Output_data_reloc::add_global): Adjust type of relobj.
2591         (Output_data_reloc::add_global_relative): Likewise.
2592         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2593         (Output_data_reloc::add_local): Likewise.
2594         (Output_data_reloc::add_local_relative): Likewise.
2595         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2596         (Output_data_reloc::add_local_section): Likewise.
2597         (Output_data_reloc::add_output_section): Likewise.
2598         (Output_data_reloc::add_absolute): Likewise.
2599         (Output_data_reloc::add_target_specific): Likewise.
2600         (Output_data_got::reserve_slot): Move definition here.
2601         (Output_data_got::reserve_local): New function.
2602         (Output_data_got::reserve_global): New function.
2603         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2604         section_offsets_ with accessor function.
2605         (Sized_relobj_file::write_sections): Likewise.
2606         (Sized_relobj_file::do_relocate_sections): Likewise.
2607         * target.h (Sized_target::reserve_local_got_entry): New function.
2608         (Sized_target::reserve_global_got_entry): New function.
2609         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2610         (Target_x86_64::reserve_global_got_entry): New function.
2611         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2612
2613 2011-05-23 Cary Coutant  <ccoutant@google.com>
2614
2615         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2616         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2617         bit when checking got_type.
2618         * incremental.cc (Sized_incremental_binary::setup_readers):
2619         Store symbol table and string table locations; initialize bit vector
2620         of file status flags.
2621         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2622         unchanged files.
2623         (Sized_incremental_binary::do_process_got_plt): New function.
2624         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2625         (Output_section_incremental_inputs::set_final_data_size): Record
2626         file index for each input file.
2627         (Output_section_incremental_inputs::write_got_plt): Store file index
2628         instead of input entry offset for each GOT entry.
2629         * incremental.h
2630         (Incremental_input_entry::Incremental_input_entry): Initialize new
2631         data member.
2632         (Incremental_input_entry::set_offset): Store file index.
2633         (Incremental_input_entry::get_file_index): New function.
2634         (Incremental_input_entry::file_index_): New data member.
2635         (Incremental_binary::process_got_plt): New function.
2636         (Incremental_binary::do_process_got_plt): New function.
2637         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2638         data members.
2639         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2640         (Sized_incremental_binary::set_file_is_unchanged): New function.
2641         (Sized_incremental_binary::file_is_unchanged): New function.
2642         (Sized_incremental_binary::do_process_got_plt): New function.
2643         (Sized_incremental_binary::file_status_): New data member.
2644         (Sized_incremental_binary::main_symtab_loc_): New data member.
2645         (Sized_incremental_binary::main_strtab_loc_): New data member.
2646         * output.cc (Output_data_got::Got_entry::write): Add case
2647         RESERVED_CODE.
2648         (Output_data_got::add_global): Call add_got_entry.
2649         (Output_data_got::add_global_plt): Likewise.
2650         (Output_data_got::add_global_with_rel): Likewise.
2651         (Output_data_got::add_global_with_rela): Likewise.
2652         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2653         (Output_data_got::add_global_pair_with_rela): Likewise.
2654         (Output_data_got::add_local): Call add_got_entry.
2655         (Output_data_got::add_local_plt): Likewise.
2656         (Output_data_got::add_local_with_rel): Likewise.
2657         (Output_data_got::add_local_with_rela): Likewise.
2658         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2659         (Output_data_got::add_local_pair_with_rela): Likewise.
2660         (Output_data_got::reserve_slot): New function.
2661         (Output_data_got::reserve_slot_for_global): New function.
2662         (Output_data_got::add_got_entry): New function.
2663         (Output_data_got::add_got_entry_pair): New function.
2664         (Output_section::add_output_section_data): Edit FIXME.
2665         * output.h
2666         (Output_section_data_build::Output_section_data_build): New
2667         constructor with size parameter.
2668         (Output_data_space::Output_data_space): Likewise.
2669         (Output_data_got::Output_data_got): Initialize new data member; new
2670         constructor with size parameter.
2671         (Output_data_got::add_constant): Call add_got_entry.
2672         (Output_data_got::reserve_slot): New function.
2673         (Output_data_got::reserve_slot_for_global): New function.
2674         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2675         (Output_data_got::add_got_entry): New function.
2676         (Output_data_got::add_got_entry_pair): New function.
2677         (Output_data_got::free_list_): New data member.
2678         * target.h (Sized_target::init_got_plt_for_update): New function.
2679         (Sized_target::register_global_plt_entry): New function.
2680         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2681         Initialize new data member; call init; add constructor with PLT count.
2682         (Output_data_plt_x86_64::init): New function.
2683         (Output_data_plt_x86_64::add_relocation): New function.
2684         (Output_data_plt_x86_64::reserve_slot): New function.
2685         (Output_data_plt_x86_64::free_list_): New data member.
2686         (Target_x86_64::init_got_plt_for_update): New function.
2687         (Target_x86_64::register_global_plt_entry): New function.
2688         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2689         incremental updates.
2690         (Output_data_plt_x86_64::add_relocation): New function.
2691         * testsuite/object_unittest.cc (Object_test): Set default options.
2692
2693 2011-05-16  Ian Lance Taylor  <iant@google.com>
2694
2695         * options.h (class General_options): Make -i a synonym for -r.
2696
2697 2011-05-16  Ian Lance Taylor  <iant@google.com>
2698
2699         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2700
2701 2011-05-10 Cary Coutant  <ccoutant@google.com>
2702
2703         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2704         strip_all (-s).
2705
2706 2011-05-06  Ian Lance Taylor  <iant@google.com>
2707
2708         * layout.cc (Layout::layout): If the output section flags change,
2709         update the ordering.
2710
2711 2011-04-25 Cary Coutant  <ccoutant@google.com>
2712
2713         * incremental-dump.cc (dump_incremental_inputs): Print local
2714         symbol info for each input file.
2715         * incremental.cc
2716         (Output_section_incremental_inputs::set_final_data_size): Add local
2717         symbol info to input file entries in incremental info.
2718         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2719         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2720         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2721         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2722         implementation.
2723         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2724         (Sized_incr_relobj::do_relocate): Write the local symbols.
2725         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2726         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2727         Adjust size of input file header.
2728         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2729         (Incremental_inputs_reader::get_local_symbol_count): New function.
2730         (Incremental_inputs_reader::get_input_section): Adjust size of input
2731         file header.
2732         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2733         (Sized_incr_relobj::This): New typedef.
2734         (Sized_incr_relobj::sym_size): New const data member.
2735         (Sized_incr_relobj::Local_symbol): New struct.
2736         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2737         (Sized_incr_relobj::do_local_symbol_offset): New function.
2738         (Sized_incr_relobj::local_symbol_count_): New data member.
2739         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2740         (Sized_incr_relobj::local_symbol_index_): New data member.
2741         (Sized_incr_relobj::local_symbol_offset_): New data member.
2742         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2743         (Sized_incr_relobj::local_symbols_): New data member.
2744         * object.h (Relobj::output_local_symbol_count): New function.
2745         (Relobj::local_symbol_offset): New function.
2746         (Relobj::do_output_local_symbol_count): New function.
2747         (Relobj::do_local_symbol_offset): New function.
2748         (Sized_relobj::do_output_local_symbol_count): New function.
2749         (Sized_relobj::do_local_symbol_offset): New function.
2750
2751 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2752
2753         * descriptors.cc (set_close_on_exec): New function.
2754         (Descriptors::open): Use set_close_on_exec.
2755         * output.cc (S_ISLNK): Define if not defined.
2756
2757 2011-04-22 Cary Coutant  <ccoutant@google.com>
2758
2759         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2760         global symbol map.
2761         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2762         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2763         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2764         relocations.
2765         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2766         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2767         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2768         * incremental.h
2769         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2770         function.
2771         (Incremental_binary::apply_incremental_relocs): New function.
2772         (Incremental_binary::do_apply_incremental_relocs): New function.
2773         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2774         data member.
2775         (Sized_incremental_binary::add_global_symbol): New function.
2776         (Sized_incremental_binary::global_symbol): New function.
2777         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2778         (Sized_incremental_binary::symbol_map_): New data member.
2779         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2780         * target.h (Sized_target::apply_relocation): New function.
2781         * target-reloc.h (apply_relocation): New function.
2782         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2783
2784 2011-04-22  Doug Kwan  <dougkwan@google.com>
2785
2786         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2787         flag of a SHT_ARM_EXIDX section.
2788         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2789         * testsuite/Makefile.in: Regenerate.
2790         * testsuite/arm_exidx_test.s: New file.
2791         * testsuite/arm_exidx_test.sh: Same.
2792
2793 2011-04-20 Cary Coutant  <ccoutant@google.com>
2794
2795         PR gold/12689
2796         * archive.h (Incremental_archive_entry::Archive_member):
2797         Initialize arg_serial_ (second constructor).
2798
2799 2011-04-17  Ian Lance Taylor  <iant@google.com>
2800
2801         * object.cc (Relocate_info::location): Simplify location string.
2802         * errors.cc (Errors::error_at_location): Don't print program
2803         name.
2804         (Errors::warning_at_location): Likewise.
2805         (Errors::undefined_symbol): Likewise.
2806         * testsuite/debug_msg.sh: Update accordingly.
2807
2808 2011-04-14 Cary Coutant  <ccoutant@google.com>
2809
2810         * gold/layout.cc (Layout::symtab_section_offset): New function.
2811         * gold/layout.h (Layout::symtab_section_offset): New function.
2812         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2813
2814 2011-04-12  Ian Lance Taylor  <iant@google.com>
2815
2816         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2817         with MREMAP_MAYMOVE.
2818         * output.h (class Output_file): Add map_is_allocated_ field.
2819         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2820         not available, provide stubs.  If mremap is not available, #define
2821         it to gold_mremap.
2822         (MREMAP_MAYMOVE): Define if not defined.
2823         (Output_file::Output_file): Initialize map_is_allocated_.
2824         (Output_file::resize): Check map_is_allocated_.
2825         (Output_file::map_anonymous): If mmap fails, use malloc.
2826         (Output_file::unmap): Don't do anything for an anonymous map.
2827         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2828         is not available, provide stubs.
2829         (File_read::View::~View): Use free rather than delete[].
2830         (File_read::make_view): Use malloc rather than new[].  If mmap
2831         fails, use malloc.
2832         (File_read::find_or_make_view): Use malloc rather than new[].
2833         * gold.h: Remove HAVE_REMAP code.
2834         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2835         exists.  Rename mremap to gold_mremap.  If mmap is not available
2836         don't do anything.
2837         * configure, config.in: Rebuild.
2838
2839 2011-04-11  Ian Lance Taylor  <iant@google.com>
2840
2841         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2842         initialize local variable v.
2843
2844 2011-04-11  Cary Coutant  <ccoutant@google.com>
2845
2846         * archive.cc (Archive::include_member): Adjust call to
2847         report_object.
2848         (Add_archive_symbols::run): Track argument serial numbers.
2849         (Lib_group::include_member): Likewise.
2850         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2851         * archive.h (Incremental_archive_entry::Archive_member):
2852         Initialize arg_serial_.
2853         (Archive_member::arg_serial_): New data member.
2854         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2855         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2856         incremental link.
2857         (Sized_dynobj::do_for_all_local_got_entries): New function.
2858         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2859         function.
2860         * fileread.cc (get_mtime): New function.
2861         * fileread.h (get_mtime): New function.
2862         * gold.cc (queue_initial_tasks): Check for incremental update.
2863         (process_incremental_input): New function.
2864         (queue_middle_tasks): Don't force valid target for incremental
2865         update.
2866         * incremental-dump.cc (find_input_containing_global): Adjust
2867         size of symbol info entry.
2868         (dump_incremental_inputs): Dump argument serial number and
2869         in_system_directory flag; bias shndx by 1; print symbol names
2870         when dumping per-file symbol lists; use new symbol info readers.
2871         * incremental.cc
2872         (Output_section_incremental_inputs:update_data_size): New function.
2873         (Sized_incremental_binary::setup_readers): Setup input readers
2874         for each input file; build maps for files added from libraries
2875         and scripts.
2876         (Sized_incremental_binary::check_input_args): New function.
2877         (Sized_incremental_binary::do_check_inputs): Build map of argument
2878         serial numbers to input arguments.
2879         (Sized_incremental_binary::do_file_has_changed): Rename
2880         do_file_is_unchanged to this; compare file modification times.
2881         (Sized_incremental_binary::do_init_layout): New function.
2882         (Sized_incremental_binary::do_reserve_layout): New function.
2883         (Sized_incremental_binary::do_get_input_reader): Remove.
2884         (Sized_incremental_binary::get_symtab_view): New function.
2885         (Incremental_checker::can_incrementally_link_output_file): Remove.
2886         (Incremental_inputs::report_command_line): Exclude --debug options.
2887         (Incremental_inputs::report_archive_begin): Add parameter; track
2888         argument serial numbers; don't put input file entry for archive
2889         before archive members.
2890         (Incremental_inputs::report_archive_end): Put input file entry
2891         for archive after archive members.
2892         (Incremental_inputs::report_object): Add parameter; track argument
2893         serial numbers and in_system_directory flag.
2894         (Incremental_inputs::report_script): Add parameter; track argument
2895         serial numbers.
2896         (Output_section_incremental_inputs::set_final_data_size): Adjust
2897         size of symbol info entry; check for forwarding symbols.
2898         (Output_section_incremental_inputs::write_input_files): Write
2899         in_system_directory flag and argument serial number.
2900         (Output_section_incremental_inputs::write_info_blocks): Map section
2901         indices between incremental info and original input file; store
2902         input section index for each symbol.
2903         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2904         change operator() to visit().
2905         (class Global_got_offset_visitor): Likewise.
2906         (class Global_symbol_visitor_got_plt):
2907         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2908         classes.
2909         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2910         (Sized_incr_relobj::do_read_symbols): New function.
2911         (Sized_incr_relobj::do_layout): New function.
2912         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2913         (Sized_incr_relobj::do_add_symbols): New function.
2914         (Sized_incr_relobj::do_should_include_member): New function.
2915         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2916         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2917         (Sized_incr_relobj::do_section_size): New function.
2918         (Sized_incr_relobj::do_section_name): New function.
2919         (Sized_incr_relobj::do_section_contents): New function.
2920         (Sized_incr_relobj::do_section_flags): New function.
2921         (Sized_incr_relobj::do_section_entsize): New function.
2922         (Sized_incr_relobj::do_section_address): New function.
2923         (Sized_incr_relobj::do_section_type): New function.
2924         (Sized_incr_relobj::do_section_link): New function.
2925         (Sized_incr_relobj::do_section_info): New function.
2926         (Sized_incr_relobj::do_section_addralign): New function.
2927         (Sized_incr_relobj::do_initialize_xindex): New function.
2928         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2929         (Sized_incr_relobj::do_read_relocs): New function.
2930         (Sized_incr_relobj::do_gc_process_relocs): New function.
2931         (Sized_incr_relobj::do_scan_relocs): New function.
2932         (Sized_incr_relobj::do_count_local_symbols): New function.
2933         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2934         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2935         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2936         (Sized_incr_relobj::do_relocate): New function.
2937         (Sized_incr_relobj::do_set_section_offset): New function.
2938         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2939         (Sized_incr_dynobj::do_read_symbols): New function.
2940         (Sized_incr_dynobj::do_layout): New function.
2941         (Sized_incr_dynobj::do_add_symbols): New function.
2942         (Sized_incr_dynobj::do_should_include_member): New function.
2943         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2944         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2945         (Sized_incr_dynobj::do_section_size): New function.
2946         (Sized_incr_dynobj::do_section_name): New function.
2947         (Sized_incr_dynobj::do_section_contents): New function.
2948         (Sized_incr_dynobj::do_section_flags): New function.
2949         (Sized_incr_dynobj::do_section_entsize): New function.
2950         (Sized_incr_dynobj::do_section_address): New function.
2951         (Sized_incr_dynobj::do_section_type): New function.
2952         (Sized_incr_dynobj::do_section_link): New function.
2953         (Sized_incr_dynobj::do_section_info): New function.
2954         (Sized_incr_dynobj::do_section_addralign): New function.
2955         (Sized_incr_dynobj::do_initialize_xindex): New function.
2956         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2957         (make_sized_incremental_object): New function.
2958         (Incremental_library::copy_unused_symbols): New function.
2959         (Incremental_library::do_for_all_unused_symbols): New function.
2960         * incremental.h (enum Incremental_input_flags): New type.
2961         (class Incremental_checker): Remove.
2962         (Incremental_input_entry::Incremental_input_entry): Add argument
2963         serial number.
2964         (Incremental_input_entry::arg_serial): New function.
2965         (Incremental_input_entry::set_is_in_system_directory): New function.
2966         (Incremental_input_entry::is_in_system_directory): New function.
2967         (Incremental_input_entry::arg_serial_): New data member.
2968         (Incremental_input_entry::is_in_system_directory_): New data member.
2969         (class Script_info): Move here from script.h.
2970         (Script_info::Script_info): Add filename parameter.
2971         (Script_info::filename): New function.
2972         (Script_info::filename_): New data member.
2973         (Incremental_script_entry::Incremental_script_entry): Add argument
2974         serial number.
2975         (Incremental_object_entry::Incremental_object_entry): Likewise.
2976         (Incremental_object_entry::add_input_section): Build list of input
2977         sections with map to original shndx.
2978         (Incremental_object_entry::get_input_section_index): New function.
2979         (Incremental_object_entry::shndx_): New data member.
2980         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2981         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2982         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2983         serial number.
2984         (Incremental_inputs::report_archive_begin): Likewise.
2985         (Incremental_inputs::report_object): Likewise.
2986         (Incremental_inputs::report_script): Likewise.
2987         (class Incremental_global_symbol_reader): New class.
2988         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2989         and store flags and input file type.
2990         (Incremental_input_entry_reader::arg_serial): New function.
2991         (Incremental_input_entry_reader::type): Extract type from flags.
2992         (Incremental_input_entry_reader::is_in_system_directory): New function.
2993         (Incremental_input_entry_reader::get_input_section_count): Call
2994         accessor function for type.
2995         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2996         function for type; adjust size of global symbol entry.
2997         (Incremental_input_entry_reader::get_global_symbol_count): Call
2998         accessor function for type.
2999         (Incremental_input_entry_reader::get_object_count): Likewise.
3000         (Incremental_input_entry_reader::get_object_offset): Likewise.
3001         (Incremental_input_entry_reader::get_member_count): Likewise.
3002         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3003         (Incremental_input_entry_reader::get_member_offset): Likewise.
3004         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3005         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3006         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3007         (Incremental_input_entry_reader::get_global_symbol_reader): New
3008         function.
3009         (Incremental_input_entry_reader::get_output_symbol_index): New
3010         function.
3011         (Incremental_input_entry_reader::type_): Remove.
3012         (Incremental_input_entry_reader::flags_): New data member.
3013         (Incremental_inputs_reader::input_file_offset): New function.
3014         (Incremental_inputs_reader::input_file_index): New function.
3015         (Incremental_inputs_reader::input_file): Call input_file_offset.
3016         (Incremental_inputs_reader::input_file_at_offset): New function.
3017         (Incremental_relocs_reader::get_r_type): Reformat.
3018         (Incremental_relocs_reader::get_r_shndx): Reformat.
3019         (Incremental_relocs_reader::get_r_offset): Reformat.
3020         (Incremental_relocs_reader::data): New function.
3021         (Incremental_binary::Incremental_binary): Initialize new data members.
3022         (Incremental_binary::check_inputs): Add cmdline parameter.
3023         (Incremental_binary::file_is_unchanged): Remove.
3024         (Input_reader::arg_serial): New function.
3025         (Input_reader::get_unused_symbol_count): New function.
3026         (Input_reader::get_unused_symbol): New function.
3027         (Input_reader::do_arg_serial): New function.
3028         (Input_reader::do_get_unused_symbol_count): New function.
3029         (Input_reader::do_get_unused_symbol): New function.
3030         (Incremental_binary::input_file_count): New function.
3031         (Incremental_binary::get_input_reader): Change signature to use
3032         index instead of filename.
3033         (Incremental_binary::file_has_changed): New function.
3034         (Incremental_binary::get_input_argument): New function.
3035         (Incremental_binary::get_library): New function.
3036         (Incremental_binary::get_script_info): New function.
3037         (Incremental_binary::init_layout): New function.
3038         (Incremental_binary::reserve_layout): New function.
3039         (Incremental_binary::output_file): New function.
3040         (Incremental_binary::do_check_inputs): New function.
3041         (Incremental_binary::do_file_is_unchanged): Remove.
3042         (Incremental_binary::do_file_has_changed): New function.
3043         (Incremental_binary::do_init_layout): New function.
3044         (Incremental_binary::do_reserve_layout): New function.
3045         (Incremental_binary::do_input_file_count): New function.
3046         (Incremental_binary::do_get_input_reader): Change signature.
3047         (Incremental_binary::input_args_map_): New data member.
3048         (Incremental_binary::library_map_): New data member.
3049         (Incremental_binary::script_map_): New data member.
3050         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3051         new data members.
3052         (Sized_incremental_binary::output_section): New function.
3053         (Sized_incremental_binary::inputs_reader): Add const.
3054         (Sized_incremental_binary::symtab_reader): Add const.
3055         (Sized_incremental_binary::relocs_reader): Add const.
3056         (Sized_incremental_binary::got_plt_reader): Add const.
3057         (Sized_incremental_binary::get_symtab_view): New function.
3058         (Sized_incremental_binary::Inputs_reader): New typedef.
3059         (Sized_incremental_binary::Input_entry_reader): New typedef.
3060         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3061         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3062         (Sized_incremental_binary::do_file_has_changed): New function.
3063         (Sized_incremental_binary::do_init_layout): New function.
3064         (Sized_incremental_binary::do_reserve_layout): New function.
3065         (Sized_input_reader::Inputs_reader): Remove.
3066         (Sized_input_reader::Input_entry_reader): Remove.
3067         (Sized_input_reader::do_arg_serial): New function.
3068         (Sized_input_reader::do_get_unused_symbol_count): New function.
3069         (Sized_input_reader::do_get_unused_symbol): New function.
3070         (Sized_incremental_binary::do_input_file_count): New function.
3071         (Sized_incremental_binary::do_get_input_reader): Change signature;
3072         use index instead of filename.
3073         (Sized_incremental_binary::section_map_): New data member.
3074         (Sized_incremental_binary::input_entry_readers_): New data member.
3075         (class Sized_incr_relobj): New class.
3076         (class Sized_incr_dynobj): New class.
3077         (make_sized_incremental_object): New function.
3078         (class Incremental_library): New class.
3079         * layout.cc (Free_list::num_lists): New static data member.
3080         (Free_list::num_nodes): New static data member.
3081         (Free_list::num_removes): New static data member.
3082         (Free_list::num_remove_visits): New static data member.
3083         (Free_list::num_allocates): New static data member.
3084         (Free_list::num_allocate_visits): New static data member.
3085         (Free_list::init): New function.
3086         (Free_list::remove): New function.
3087         (Free_list::allocate): New function.
3088         (Free_list::dump): New function.
3089         (Free_list::print_stats): New function.
3090         (Layout_task_runner::run): Resize output file for incremental updates.
3091         (Layout::Layout): Initialize new data members.
3092         (Layout::set_incremental_base): New function.
3093         (Layout::init_fixed_output_section): New function.
3094         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3095         incremental updates.
3096         (Layout::create_gold_note): Do not create gold note section for
3097         incremental updates.
3098         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3099         for incremental updates.
3100         (Layout::set_section_offsets): For incremental updates, allocate space
3101         from free list.
3102         (Layout::create_symtab_sections): Layout with offsets relative to
3103         start of section; for incremental updates, allocate space from free
3104         list.
3105         (Layout::create_shdrs): For incremental updates, allocate space from
3106         free list.
3107         (Layout::finish_dynamic_section): For incremental updates, do not
3108         check --as-needed (fixed in subsequent patch).
3109         * layout.h (class Free_list): New class.
3110         (Layout::set_incremental_base): New function.
3111         (Layout::incremental_base): New function.
3112         (Layout::init_fixed_output_section): New function.
3113         (Layout::allocate): New function.
3114         (Layout::incremental_base_): New data member.
3115         (Layout::free_list_): New data member.
3116         * main.cc (main): Print Free_list statistics.
3117         * object.cc (Relobj::finalize_incremental_relocs): Add
3118         clear_counts parameter; clear counts only when clear_counts is set.
3119         (Sized_relobj::Sized_relobj): Initialize new base class.
3120         (Sized_relobj::do_layout): Don't report special sections.
3121         (Sized_relobj::do_for_all_local_got_entries): New function.
3122         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3123         symtab_off to all symbol table offsets.
3124         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3125         * object.h (class Got_offset_list): Move to top of file.
3126         (Object::Object): Allow case where input_file == NULL.
3127         (Object::~Object): Likewise.
3128         (Object::input_file): Assert that input_file != NULL.
3129         (Object::lock): Allow case where input_file == NULL.
3130         (Object::unlock): Likewise.
3131         (Object::is_locked): Likewise.
3132         (Object::token): Likewise.
3133         (Object::release): Likewise.
3134         (Object::is_incremental): New function.
3135         (Object::get_mtime): New function.
3136         (Object::for_all_local_got_entries): New function.
3137         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3138         (Object::set_is_in_system_directory): New function.
3139         (Object::is_in_system_directory): New function.
3140         (Object::do_is_incremental): New function.
3141         (Object::do_get_mtime): New function.
3142         (Object::do_for_all_local_got_entries): New function.
3143         (Object::is_in_system_directory_): New data member.
3144         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3145         (class Sized_relobj_base): New class.
3146         (class Sized_relobj): Derive from Sized_relobj_base.
3147         (class Sized_relobj::Symbols): Redeclare from base class.
3148         (class Sized_relobj::local_got_offset_list): Remove.
3149         (class Sized_relobj::Output_sections): Redeclare from base class.
3150         (class Sized_relobj::do_for_all_local_got_entries): New function.
3151         (class Sized_relobj::write_local_symbols): Add offset parameter.
3152         (class Sized_relobj::local_symbol_offset_): Update comment.
3153         (class Sized_relobj::local_dynsym_offset_): Update comment.
3154         * options.cc (Input_arguments::add_file): Remove const.
3155         * options.h (Input_file_argument::Input_file_argument):
3156         Initialize arg_serial_ (all constructors).
3157         (Input_file_argument::set_arg_serial): New function.
3158         (Input_file_argument::arg_serial): New function.
3159         (Input_file_argument::arg_serial_): New data member.
3160         (Input_arguments::Input_arguments): Initialize file_count_.
3161         (Input_arguments::add_file): Remove const.
3162         (Input_arguments::number_of_input_files): New function.
3163         (Input_arguments::file_count_): New data member.
3164         (Command_line::number_of_input_files): Call
3165         Input_arguments::number_of_input_files.
3166         * output.cc (Output_segment_headers::Output_segment_headers):
3167         Set current size.
3168         (Output_section::Input_section::current_data_size): New function.
3169         (Output_section::Output_section): Initialize new data members.
3170         (Output_section::add_input_section): Don't do merge sections for
3171         an incremental link; allocate space from free list for an
3172         incremental update.
3173         (Output_section::add_output_section_data): Allocate space from
3174         free list for an incremental update.
3175         (Output_section::update_data_size): New function.
3176         (Output_section::set_fixed_layout): New function.
3177         (Output_section::reserve): New function.
3178         (Output_segment::set_section_addresses): Remove const.
3179         (Output_segment::set_section_list_addresses): Remove const; allocate
3180         space from free list for an incremental update.
3181         (Output_segment::set_offset): Adjust size of RELRO segment for an
3182         incremental update.
3183         * output.h (Output_data::current_data_size): Move here from
3184         child classes.
3185         (Output_data::pre_finalize_data_size): New function.
3186         (Output_data::update_data_size): New function.
3187         (Output_section_headers::update_data_size): new function.
3188         (Output_section_data_build::current_data_size): Move to Output_data.
3189         (Output_data_strtab::update_data_size): New function.
3190         (Output_section::current_data_size): Move to Output_data.
3191         (Output_section::set_fixed_layout): New function.
3192         (Output_section::has_fixed_layout): New function.
3193         (Output_section::reserve): New function.
3194         (Output_section::update_data_size): New function.
3195         (Output_section::has_fixed_layout_): New data member.
3196         (Output_section::free_list_): New data member.
3197         (Output_segment::set_section_addresses): Remove const.
3198         (Output_segment::set_section_list_addresses): Remove const.
3199         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3200         New function.
3201         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3202         New function.
3203         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3204         parameter when calling Add_symbols constructor; store argument
3205         serial number for members of a lib group.
3206         (Add_symbols::locks): Allow case where token == NULL.
3207         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3208         (Read_member::~Read_member): New function.
3209         (Read_member::is_runnable): New function.
3210         (Read_member::locks): New function.
3211         (Read_member::run): New function.
3212         (Check_script::~Check_script): New function.
3213         (Check_script::is_runnable): New function.
3214         (Check_script::locks): New function.
3215         (Check_script::run): New function.
3216         (Check_library::~Check_library): New function.
3217         (Check_library::is_runnable): New function.
3218         (Check_library::locks): New function.
3219         (Check_library::run): New function.
3220         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3221         (Add_symbols::library_): New data member.
3222         (class Read_member): New class.
3223         (class Check_script): New class.
3224         (class Check_library): New class.
3225         * reloc.cc (Read_relocs::is_runnable): Allow case where
3226         token == NULL.
3227         (Read_relocs::locks): Likewise.
3228         (Scan_relocs::locks): Likewise.
3229         (Relocate_task::locks): Likewise.
3230         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3231         to clear counters.
3232         (Sized_relobj::incremental_relocs_scan): Fix comment.
3233         (Sized_relobj::do_relocate): Pass output file offset to
3234         write_local_symbols.
3235         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3236         from class declaration.
3237         * script.cc (read_input_script): Allocate Script_info; pass
3238         argument serial number to report_script.
3239         * script.h (class Script_info): Move to incremental.h.
3240         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3241         * symtab.h (Symbol_table::add_from_incrobj): New function.
3242         (Symbol_table::set_file_offset): New function.
3243
3244 2011-04-05  Cary Coutant  <ccoutant@google.com>
3245
3246         * incremental-dump.cc (dump_incremental_inputs): Change signature
3247         to take a Sized_incremental_binary; change caller.  Use readers
3248         in Sized_incremental_binary.
3249         * incremental.cc
3250         (Sized_incremental_binary::find_incremental_inputs_sections):
3251         Rename do_find_incremental_inputs_sections to this.
3252         (Sized_incremental_binary::setup_readers): New function.
3253         (Sized_incremental_binary::do_check_inputs): Check
3254         has_incremental_info_ flag; move setup code to setup_readers;
3255         use input readers.
3256         (Sized_incremental_binary::do_file_is_unchanged): New function.
3257         (Sized_incremental_binary::do_get_input_reader): New function.
3258         * incremental.h (class Incremental_binary): Move to end of file.
3259         (Incremental_binary::file_is_unchanged): New function.
3260         (Incremental_binary::do_file_is_unchanged): New function.
3261         (Incremental_binary::Input_reader): New class.
3262         (Incremental_binary::get_input_reader): New function.
3263         (class Sized_incremental_binary): Move to end of file.
3264         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3265         input section reader classes.
3266         (Sized_incremental_binary::has_incremental_info): New function.
3267         (Sized_incremental_binary::inputs_reader): New function.
3268         (Sized_incremental_binary::symtab_reader): New function.
3269         (Sized_incremental_binary::relocs_reader): New function.
3270         (Sized_incremental_binary::got_plt_reader): New function.
3271         (Sized_incremental_binary::do_file_is_unchanged): New function.
3272         (Sized_incremental_binary::Sized_input_reader): New class.
3273         (Sized_incremental_binary::get_input_reader): New function.
3274         (Sized_incremental_binary::find_incremental_inputs_sections):
3275         Rename do_find_incremental_inputs_sections to this.
3276         (Sized_incremental_binary::setup_readers): New function.
3277         (Sized_incremental_binary::has_incremental_info_): New data member.
3278         (Sized_incremental_binary::inputs_reader_): New data member.
3279         (Sized_incremental_binary::symtab_reader_): New data member.
3280         (Sized_incremental_binary::relocs_reader_): New data member.
3281         (Sized_incremental_binary::got_plt_reader_): New data member.
3282         (Sized_incremental_binary::current_input_file_): New data member.
3283
3284 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3285
3286         PR gold/12640
3287         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3288         violation.
3289
3290 2011-03-30  Cary Coutant  <ccoutant@google.com>
3291
3292         * archive.cc (Archive::include_member): Adjust call to report_object.
3293         (Add_archive_symbols::run): Add script_info to call to
3294         report_archive_begin.
3295         (Lib_group::include_member): Adjust call to report_object.
3296         (Add_lib_group_symbols::run): Adjust call to report_object.
3297         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3298         blocks.  Add object count for script input files.
3299         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3300         script_info parameter; change all callers.
3301         (Incremental_inputs::report_object): Add script_info parameter;
3302         change all callers.
3303         (Incremental_inputs::report_script): Store backpointer to
3304         incremental info entry.
3305         (Output_section_incremental_inputs::set_final_data_size): Record
3306         additional information for scripts.
3307         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3308         * incremental.h (Incremental_script_entry::add_object): New function.
3309         (Incremental_script_entry::get_object_count): New function.
3310         (Incremental_script_entry::get_object): New function.
3311         (Incremental_script_entry::objects_): New data member; adjust
3312         constructor.
3313         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3314         (Incremental_inputs::report_object): Add script_info parameter.
3315         (Incremental_inputs_reader::get_object_count): New function.
3316         (Incremental_inputs_reader::get_object_offset): New function.
3317         * options.cc (Input_arguments::add_file): Return reference to
3318         new input argument.
3319         * options.h (Input_argument::set_script_info): New function.
3320         (Input_argument::script_info): New function.
3321         (Input_argument::script_info_): New data member; adjust all
3322         constructors.
3323         (Input_file_group::add_file): Return reference to new input argument.
3324         (Input_file_lib::add_file): Likewise.
3325         (Input_arguments::add_file): Likewise.
3326         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3327         * script.cc (Parser_closure::Parser_closure): Add script_info
3328         parameter; adjust all callers.
3329         (Parser_closure::script_info): New function.
3330         (Parser_closure::script_info_): New data member.
3331         (read_input_script): Report scripts earlier to incremental info.
3332         (script_add_file): Set script_info in Input_argument.
3333         (script_add_library): Likewise.
3334         * script.h (Script_options::Script_info): Rewrite class.
3335
3336 2011-03-29  Cary Coutant  <ccoutant@google.com>
3337
3338         * archive.cc (Library_base::should_include_member): Move
3339         method here from class Archive.
3340         (Archive::Archive): Initialize base class.
3341         (Archive::should_include_member): Move to base class.
3342         (Archive::do_for_all_unused_symbols): New function.
3343         (Add_archive_symbols::run): Remove redundant access to
3344         incremental_inputs.
3345         (Lib_group::Lib_group): Initialize base class.
3346         (Lib_group::do_filename): New function.
3347         (Lib_group::include_member): Pass pointer to Lib_group to
3348         report_object.
3349         (Lib_group::do_for_all_unused_symbols): New function.
3350         (Add_lib_group_symbols::run): Report archive information for
3351         incremental links.
3352         * archive.h (class Library_base): New base class.
3353         (class Archive): Derive from Library_base.
3354         (Archive::filename): Move to base class.
3355         (Archive::set_incremental_info): Likewise.
3356         (Archive::incremental_info): Likewise.
3357         (Archive::Should_include): Likewise.
3358         (Archive::should_include_member): Likewise.
3359         (Archive::Armap_entry): Remove.
3360         (Archive::Unused_symbol_iterator): Remove.
3361         (Archive::unused_symbols_begin): Remove.
3362         (Archive::unused_symbols_end): Remove.
3363         (Archive::do_filename): New function.
3364         (Archive::do_get_mtime): New function.
3365         (Archive::do_for_all_unused_symbols): New function.
3366         (Archive::task_): Move to base class.
3367         (Archive::incremental_info_): Likewise.
3368         (class Lib_group): Derive from Library_base.
3369         (Lib_group::do_filename): New function.
3370         (Lib_group::do_get_mtime): New function.
3371         (Lib_group::do_for_all_unused_symbols): New function.
3372         (Lib_group::task_): Move to base class.
3373         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3374         function.
3375         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3376         function.
3377         * incremental.cc (Incremental_inputs::report_archive_begin):
3378         Use Library_base; call library's get_mtime; add incremental inputs
3379         entry before members.
3380         (class Unused_symbol_visitor): New class.
3381         (Incremental_inputs::report_archive_end): Use Library_base; use
3382         visitor class to record unused symbols; don't add incremental inputs
3383         entry after members.
3384         (Incremental_inputs::report_object): Use Library_base.
3385         * incremental.h
3386         (Incremental_archive_entry::Incremental_archive_entry): Remove
3387         unused Archive parameter.
3388         (Incremental_inputs::report_archive_begin): Use Library_base.
3389         (Incremental_inputs::report_archive_end): Likewise.
3390         (Incremental_inputs::report_object): Likewise.
3391         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3392         function.
3393         * object.h (Object::for_all_global_symbols): New function.
3394         (Object::do_for_all_global_symbols): New function.
3395         (Sized_relobj::do_for_all_global_symbols): New function.
3396         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3397         function.
3398         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3399         function.
3400
3401 2011-03-27  Ian Lance Taylor  <iant@google.com>
3402
3403         * archive.cc (Archive::interpret_header): Return -1 if something
3404         goes wrong.  Change callers accordingly.
3405
3406 2011-03-25  Cary Coutant  <ccoutant@google.com>
3407
3408         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3409         * testsuite/Makefile.in: Regenerate.
3410
3411 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3412
3413         * plugin.cc (get_view): New.
3414         (Plugin::load): Pass get_view to the plugin.
3415         (Plugin_manager::get_view): New.
3416
3417 2011-03-21  Ian Lance Taylor  <iant@google.com>
3418
3419         * testsuite/final_layout.sh: Rewrite to not use dc.
3420         * testsuite/relro_test.sh: Fail if dc is not present.
3421
3422 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3423
3424         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3425         Change == to -eq.
3426         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3427         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3428         Change == to -eq.
3429         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3430         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3431
3432 2011-03-14  Ian Lance Taylor  <iant@google.com>
3433
3434         * script-sections.cc (Sort_output_sections::script_compare):
3435         Rename from is_before, change return type.
3436         (Sort_output_sections::operator()): Adjust accordingly.
3437
3438 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3439
3440         PR gold/12572
3441         * testsuite/odr_violation2.cc: Add comment to make all error line
3442         numbers double digits.
3443         * testsuite/debug_msg.sh: Adjust expected errors.
3444
3445 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3446
3447         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3448         but mark earlier ones as non-canonical
3449         (offset_to_iterator): Update search target and example
3450         (do_addr2line): Return extra lines in a vector*
3451         (format_file_lineno): Extract from do_addr2line
3452         (one_addr2line): Add vector* out-param
3453         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3454         when a lineno entry appeared last for its instruction
3455         (Dwarf_line_info): Add vector* out-param
3456         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3457         * symtab.cc (Odr_violation_compare): Include the lineno in the
3458         comparison again.
3459         (linenos_from_loc): New. Combine the canonical line for an
3460         address with its other lines.
3461         (True_if_intersect): New. Helper functor to make
3462         std::set_intersection a query.
3463         (detect_odr_violations): Compare sets of lines instead of just
3464         one line for each function. This became less deterministic, but
3465         has fewer false positives.
3466         * symtab.h: Declarations.
3467         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3468         mix an optimized and non-optimized object in the same binary
3469         (odr_violation2.so): Same.
3470         * testsuite/Makefile.in: Regenerate from Makefile.am.
3471         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3472         * testsuite/debug_msg.sh: Update line numbers and add
3473         assertions.
3474         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3475         non-optimized context.
3476         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3477         isn't inlined, and use OdrDerived in an optimized context.
3478         * testsuite/odr_header1.h: Defines OdrDerived, where
3479         optimization will change the
3480         first-instruction-in-the-destructor's file and line number.
3481         * testsuite/odr_header2.h: Defines OdrBase.
3482
3483 2011-03-09  Ian Lance Taylor  <iant@google.com>
3484
3485         * fileread.cc (File_read::clear_views): Don't delete the whole
3486         file view.
3487
3488 2011-03-08  Ian Lance Taylor  <iant@google.com>
3489
3490         PR gold/12525
3491         * fileread.cc: #include <climits>.
3492         (GOLD_IOV_MAX): Define.
3493         (File_read::read_multiple): Limit number of entries by iov_max.
3494         * fileread.h (class File_read): Always set max_readv_entries to
3495         128.
3496
3497 2011-03-07  Ian Lance Taylor  <iant@google.com>
3498
3499         PR gold/12525
3500         * options.h (class General_options): Add -dy and -dn.
3501
3502 2011-03-02  Cary Coutant  <ccoutant@google.com>
3503
3504         * testsuite/script_test_9.t: Add TLS segment.
3505
3506 2011-03-02  Simon Baldwin  <simonb@google.com>
3507
3508         * configure.ac: Add check for gnu_indirect_function support in
3509         the toolchain building binutils.
3510         * configure: Rebuild.
3511
3512 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3513
3514         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3515         plugin only symbols.
3516         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3517         in plugin files as not needed in the symbol table.
3518
3519 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3520
3521         * output.cc (Output_section::add_input_section): Delay fill
3522         generation for section ordering.
3523
3524 2011-02-09  Ian Lance Taylor  <iant@google.com>
3525
3526         PR gold/12316
3527         * object.h (class Sized_relobj): Remove clear_local_symbols.
3528         * reloc.cc (Sized_relobj::do_relocate): Don't call
3529         clear_local_symbols.
3530
3531 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3532
3533         * plugin.cc (is_visible_from_outside): Return true for symbols
3534         in the -u option.
3535
3536 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3537
3538         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3539         filename.
3540
3541 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3542
3543         * icf.h (is_section_foldable_candidate): Change type of parameter
3544         to std::string.
3545         * icf.cc (Icf::find_identical_sections): Change type of local variable
3546         section_name to be std::string.
3547         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3548
3549 2011-01-25  Ian Lance Taylor  <iant@google.com>
3550
3551         * script.cc (script_add_extern): Rewrite to use
3552         add_symbol_reference.
3553
3554 2011-01-25  Doug Kwan  <dougkwan@google.com>
3555
3556         * icf.cc (get_section_contents): Always lock section's object.
3557
3558 2011-01-24  Ian Lance Taylor  <iant@google.com>
3559
3560         * options.h (class General_options): Accept
3561         --no-detect-odr-violations.
3562
3563 2011-01-24  Ian Lance Taylor  <iant@google.com>
3564
3565         * version.cc (version_string): Bump to 1.11.
3566
3567 2011-01-24  Ian Lance Taylor  <iant@google.com>
3568
3569         * plugin.cc (class Plugin_rescan): Define new class.
3570         (Plugin_manager::claim_file): Set any_claimed_.
3571         (Plugin_manager::save_archive): New function.
3572         (Plugin_manager::save_input_group): New function.
3573         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3574         necessary.
3575         (Plugin_manager::new_undefined_symbol): New function.
3576         (Plugin_manager::rescan): New function.
3577         (Plugin_manager::rescannable_defines): New function.
3578         (Plugin_manager::add_input_file): Set any_added_.
3579         * plugin.h (class Plugin_manager): define new fields rescannable_,
3580         undefined_symbols_, any_claimed_, and any_added_.  Declare
3581         Plugin_rescan as friend.  Declare new functions.
3582         (Plugin_manager::Rescannable): Define type.
3583         (Plugin_manager::Rescannable_list): Define type.
3584         (Plugin_manager::Undefined_symbol_list): Define type.
3585         (Plugin_manager::Plugin_manager): Initialize new fields.
3586         * archive.cc (Archive::defines_symbol): New function.
3587         (Add_archive_symbols::run): Pass archive to plugins if any.
3588         * archive.h (class Archive): Declare defines_symbol.
3589         * readsyms.cc (Input_group::~Input_group): New function.
3590         (Finish_group::run): Pass input_group to plugins if any.
3591         * readsyms.h (class Input_group): Declare destructor.
3592         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3593         any.
3594
3595 2011-01-10  Ian Lance Taylor  <iant@google.com>
3596
3597         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3598         section as relro.
3599         (Layout::set_segment_offsets): Reset increase_relro before calling
3600         set_section_addresses a second time.
3601
3602 2011-01-04  Cary Coutant  <ccoutant@google.com>
3603
3604         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3605         sections before NOBITS sections.
3606
3607 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3608
3609         * version.cc (print_version): Update copyright to 2011.
3610
3611 2010-12-23  Cary Coutant  <ccoutant@google.com>
3612
3613         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3614         of OS to this->add.  Add OD parameter to second form of the function.
3615
3616 2010-12-20  Ian Lance Taylor  <iant@google.com>
3617
3618         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3619         second of two consecutive entries with same offset.
3620
3621 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3622
3623         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3624         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3625         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3626         to avoid unneeded links against $(LDADD).
3627         * testsuite/Makefile.in: Regenerate.
3628
3629 2010-12-15  Ian Lance Taylor  <iant@google.com>
3630
3631         PR gold/12324
3632         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3633         for R_X86_64_32 and R_X86_64_PC32.
3634         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3635         ver_matching_def_pic.o.
3636         (ver_matching_def_pic.o): New target.
3637
3638 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3639
3640         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3641         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3642         Move definition before File_read::View member definitions.
3643         (File_read::View::~View): Initialize and hold lock before
3644         updating current_mapped_bytes.
3645
3646 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3647
3648         * dwarf_reader.cc: Remove outdated comment.
3649         * gold-threads.cc: Fix typo in error message.
3650         * archive.cc: Fix typos in comments.
3651         * archive.h: Likewise.
3652         * arm-reloc-property.cc: Likewise.
3653         * arm-reloc-property.h: Likewise.
3654         * arm-reloc.def: Likewise.
3655         * arm.cc: Likewise.
3656         * attributes.h: Likewise.
3657         * cref.cc: Likewise.
3658         * ehframe.cc: Likewise.
3659         * fileread.h: Likewise.
3660         * gold.h: Likewise.
3661         * i386.cc: Likewise.
3662         * icf.cc: Likewise.
3663         * incremental.h: Likewise.
3664         * int_encoding.cc: Likewise.
3665         * layout.h: Likewise.
3666         * main.cc: Likewise.
3667         * merge.h: Likewise.
3668         * object.cc: Likewise.
3669         * object.h: Likewise.
3670         * options.cc: Likewise.
3671         * readsyms.cc: Likewise.
3672         * reduced_debug_output.cc: Likewise.
3673         * reloc.cc: Likewise.
3674         * script-sections.cc: Likewise.
3675         * sparc.cc: Likewise.
3676         * symtab.h: Likewise.
3677         * target-reloc.h: Likewise.
3678         * target.cc: Likewise.
3679         * target.h: Likewise.
3680         * timer.cc: Likewise.
3681         * timer.h: Likewise.
3682         * x86_64.cc: Likewise.
3683
3684 2010-12-09  Cary Coutant  <ccoutant@google.com>
3685
3686         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3687         stack.
3688         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3689         parameter; change all callers.
3690         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3691         * options.h (warn_execstack): New option.
3692
3693 2010-12-07  Doug Kwan  <dougkwan@google.com>
3694
3695         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3696         like function call relocations.
3697
3698 2010-12-07  Ian Lance Taylor  <iant@google.com>
3699
3700         * archive.cc (Archive::get_elf_object_for_member): Permit
3701         punconfigured to be NULL.
3702         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3703         (Archive::include_member): Pass NULL to get_elf_object_for_member
3704         if we searched for the archive and this is the first included
3705         object.
3706
3707 2010-12-01  Ian Lance Taylor  <iant@google.com>
3708
3709         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3710         track_relocs_type_ field.
3711         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3712         Set track_relocs_type_.
3713         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3714         contents when using RELA relocs.
3715         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3716         reloc_map_.
3717         * reloc.cc (Track_relocs::next_addend): New function.
3718         * reloc.h (class Track_relocs): Declare next_addend.
3719
3720 2010-12-01  Ian Lance Taylor  <iant@google.com>
3721
3722         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3723         virtual destructor.
3724
3725 2010-12-01  Ian Lance Taylor  <iant@google.com>
3726
3727         * README: Update compilers known to work and fail.
3728
3729 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3730
3731         * configure.in: For --enable-gold, handle value `default' instead of
3732         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3733         not the default.
3734         * configure: Regenerate.
3735
3736 2010-11-18  Doug Kwan  <dougkwan@google.com>
3737
3738         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3739         and right_alignment to be zero.  Store result alignment only if it is
3740         greater than existing alignment.
3741
3742 2010-11-16  Cary Coutant  <ccoutant@google.com>
3743
3744         PR gold/12220
3745         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3746         Check for ".zdebug_line".
3747
3748 2010-11-16  Doug Kwan  <dougkwan@google.com>
3749             Cary Coutant  <ccoutant@google.com>
3750
3751         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3752         by reference; adjust all callers.
3753         * output.cc (Output_segment::set_section_addresses): Adjust references
3754         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3755         list is empty.
3756         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3757         end at page boundary.
3758
3759 2010-11-16  Cary Coutant  <ccoutant@google.com>
3760
3761         PR gold/12220
3762         * layout.cc (Layout::choose_output_section): Transform names of
3763         compressed sections even when using a script with a SECTIONS clause.
3764         (Layout::output_section_name): Remove code to transform
3765         compressed debug section names.
3766         * output.cc (Output_section::add_input_section): Use uncompressed
3767         section size when tracking input sections.
3768
3769 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3770
3771         * symtab.h (Symbol::NON_PIC_REF): Remove.
3772         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3773         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3774         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3775         (Symbol::use_plt_offset): Take a flags argument and pass it
3776         directly to needs_dynamic_reloc.  Restrict check for undefined
3777         weak symbols to function calls.
3778         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3779         (Target_arm::Scan::global): Use it.
3780         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3781         (Target_arm::Relocate::relocate): Likewise.
3782         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3783         parameter with an r_type parameter.  Use get_reference_flags
3784         to get the flags.
3785         (Target_arm::Relocate::relocate): Update accordingly.
3786         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3787         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3788         (Target_i386::Scan::global): Likewise.
3789         (Target_i386::Relocate::relocate): Likewise.
3790         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3791         parameter with an r_type parameter.  Use get_reference_flags
3792         to get the flags.
3793         (Target_i386::Relocate::relocate): Update accordingly.
3794         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3795         (Target_powerpc::Scan::global): Use it.
3796         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3797         (Target_powerpc::Relocate::relocate): Likewise.
3798         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3799         (Target_sparc::Scan::global): Use it.
3800         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3801         (Target_sparc::Relocate::relocate): Likewise.
3802         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3803         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3804         (Target_x86_64::Scan::global): Likewise.
3805         (Target_x86_64::Relocate::relocate): Likewise.
3806
3807 2010-11-08  Doug Kwan  <dougkwan@google.com>
3808             Cary Coutant  <ccoutant@google.com>
3809
3810         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3811         (Arm_exidx_merge_section::section_contents_): New data member.
3812         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3813         (Arm_input_section::~Arm_input_section): De-allocate memory.
3814         (Arm_input_section::original_contents_): New data member.
3815         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3816         in parameters instead of calling Object::section_contents without
3817         locking.
3818         (Arm_output_section::group_section): New parameter TASK.  Pass it
3819         to callees that need locking objects.
3820         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3821         to lock EXIDX input sections.  Fix a formatting issue.  Call
3822         Arm_exidx_merged_section::build_contents to create merged section
3823         contents.
3824         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3825         to lock object of stub table owner.
3826         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3827         TEXT_SIZE to initialize data member TEXT_SIZE_.
3828         (Arm_exidx_input_section::addralign): Fix typo in comment.
3829         (Arm_exidx_input_section::text_size): New method.
3830         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3831         that require locking objects.  Lock objects before scanning for stubs
3832         and updating local symbols.
3833         (Arm_input_section<big_endian>::init): Copy contents of original
3834         input section.
3835         (Arm_input_section<big_endian>::do_write): Use saved contents of
3836         original input section instead of calling Object::section_contents
3837         without locking.
3838         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3839         size without calling Object::section_size().
3840         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3841         for size.  Allocate a buffer for merged EXIDX entries.
3842         (Arm_exidx_merged_section::build_contents): New method.
3843         (Arm_exidx_merged_section::do_write): Move merge section contents
3844         building code to Arm_exidx_merged_section::build_contetns.  Write
3845         out contetns in buffer instead of building it on the fly.
3846         (Arm_relobj::make_exidx_input_section): Also pass text section size
3847         to Arm_exidx_input_section constructor.
3848         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3849         (Arm_dynobj::do_read_symbols): Fix memory leak.
3850         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3851         * target.h: (class Task): Add forward declaration.
3852         (Target::relax): Add new parameter TASK and pass it to
3853         Target::do_relax().
3854         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3855
3856 2010-11-05  Cary Coutant  <ccoutant@google.com>
3857
3858         PR gold/10708
3859         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3860         object when reading from the file.
3861         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3862         second layout pass.
3863         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3864         when reading section contents.
3865         (get_section_contents): Likewise.
3866         (icf::find_identical_sections): Likewise.
3867         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3868         object when reading from the file.
3869         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3870         the object when doing deferred section layout.
3871
3872 2010-11-03  Nick Clifton  <nickc@redhat.com>
3873
3874         PR gold/12001
3875         * script.h (class Symbol_assignment: name): New member.  Returns
3876         the name of the symbol.
3877         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3878         Returns true if the given symbol name is on the list of
3879         assignments wating to be processed.
3880         * archive.cc (should_incldue_member): If the symbol is undefined,
3881         check to see if it is on the list of symbols pending assignment.
3882
3883 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3884
3885         * script-sections.cc (Script_sections::find_memory_region): Check
3886         for a NULL output section pointer.
3887
3888 2010-10-29  Doug Kwan  <dougkwan@google.com>
3889
3890         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3891         Output_section::add_relaxed_input_section.
3892         * output.cc (Output_section::add_relaxed_input_section): Add new
3893         arguments LAYOUT and NAME.  Set section order index.
3894         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3895         Copy section order index.
3896         * output.h (Output_section::add_relaxed_input_section): Add new
3897         arguments LAYOUT and NAME.
3898
3899 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3900
3901         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3902         NATIVE_OR_CROSS_LINKER.
3903         * testsuite/Makefile.in: Regenerate.
3904
3905 2010-10-20  Doug Kwan  <dougkwan@google.com>
3906
3907         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3908         without SHF_LINK_ORDER flags.
3909         * layout.cc (Layout::choose_output_section): Do not filter
3910         SHF_LINK_ORDER flag in a relocatable link.
3911
3912 2010-10-17  Cary Coutant  <ccoutant@google.com>
3913
3914         * output.h (Output_segment::set_section_addresses): Change function
3915         signature.  Update all callers.
3916         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3917         sections.
3918         (Output_segment::set_section_addresses): Align after last TLS
3919         section.  Add padding before last relro section instead of after.
3920
3921 2010-10-17  Doug Kwan  <dougkwan@google.com>
3922
3923         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3924         GOT output section to be writable.
3925
3926 2010-10-14  Cary Coutant  <ccoutant@google.com>
3927
3928         * debug.h (DEBUG_INCREMENTAL): New flag.
3929         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3930         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3931         mode.
3932         * incremental.cc (report_command_line): Ignore all forms of
3933         --incremental.
3934         * layout.cc (Layout::Layout): Check parameters for incremental link
3935         mode.
3936         * options.cc (General_options::parse_incremental): New function.
3937         (General_options::parse_no_incremental): New function.
3938         (General_options::parse_incremental_full): New function.
3939         (General_options::parse_incremental_update): New function.
3940         (General_options::incremental_mode_): New data member.
3941         (General_options::finalize): Check incremental_mode_.
3942         * options.h (General_options): Update help text for --incremental.
3943         Add --no-incremental, --incremental-full, --incremental-update.
3944         (General_options::Incremental_mode): New enum type.
3945         (General_options::incremental_mode): New function.
3946         (General_options::incremental_mode_): New data member.
3947         * parameters.cc (Parameters::incremental_mode_): New data member.
3948         (Parameters::set_options): Set incremental_mode_.
3949         (Parameters::set_incremental_full): New function.
3950         (Parameters::incremental): New function.
3951         (Parameters::incremental_update): New function.
3952         (set_parameters_incremental_full): New function.
3953         * parameters.h (Parameters::set_incremental_full): New function.
3954         (Parameters::incremental): New function.
3955         (Parameters::incremental_update): New function.
3956         (Parameters::incremental_mode_): New data member.
3957         (set_parameters_incremental_full): New function.
3958         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3959         incremental link mode.
3960         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3961         (Sized_relobj::do_relocate_sections): Likewise.
3962         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3963         option.
3964         * testsuite/Makefile.in: Regenerate.
3965         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3966
3967 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3968
3969         * script-sections.h (class Script_sections): Make
3970         Sections_elements typedef public.
3971         * script-sections.cc (class Sort_output_sections): Add elements_
3972         field.  Add constructor which sets it; change all callers.
3973         (Sort_output_sections::is_before): New function.
3974         (Sort_output_sections::operator()): Call is_before.
3975         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3976         conditional.
3977         * testsuite/script_test_10.sh: New test. Test script section
3978         order.
3979         * testsuite/script_test_10.t: Likewise.
3980         * testsuite/script_test_10.s: Likewise.
3981         * testsuite/Makefile.am: Wrap the cross linker tests and the
3982         common tests into NATIVE_OR_CROSS_LINKER.
3983         (check_SCRIPTS): Add script_test_10.sh.
3984         (check_DATA): Add script_test_10.stdout.
3985         (script_test_10.o, script_test_10): New targets.
3986         (script_test_10.stdout): New target.
3987         * configure, testsuite/Makefile.in: Regenerate.
3988
3989 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3990
3991         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3992         error for the deprecated relocations.
3993         (Target_arm::Scan::global): Likewise.
3994         (Target_arm::Relocate::relocate): Likewise.
3995
3996 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3997
3998         * fileread.cc (Input_file::find_file): Initialize *found_name
3999         and *namep when using the fallback search for case 4.
4000
4001 2010-10-11  Cary Coutant  <ccoutant@google.com>
4002
4003         * options.h (class General_options): Redefine -z lazy as an alias for
4004         the negation of -z now.
4005
4006 2010-10-11  Ian Lance Taylor  <iant@google.com>
4007
4008         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4009         binding.
4010
4011 2010-10-06  Nick Clifton  <nickc@redhat.com>
4012
4013         * script-sections.cc(class Memory_region): Remove
4014         current_lma_offset_ field.  Rename current_vma_offset_ to
4015         current_offset_.  Add last_section_ field.
4016         (Memory_region::get_current_vma_address): Rename to
4017         get_current_address.
4018         (Memory_region::get_current_lma_address): Delete.
4019         (Memory_region::increment_vma_offset): Rename to
4020         increment_offset.
4021         (Memory_region::increment_lma_offset): Delete.
4022         (Memory_region::attributes_compatible): New method.  Returns
4023         true if the provided section is compatible with the region.
4024         (Memory_region::get_last_section): New method.  Returns the last
4025         section to use the region.
4026         (Memory_region::set_last_section): New method.  Stores the last
4027         section to use the region.
4028         (Script_sections::block_in_region): New method.  Returns true if
4029         a block of memory is contained within a region.
4030         (Script_sections::find_memory_region): New method.  Locates a
4031         memory region to be used to set a VMA or LMA address.
4032         (Output_section_definition::set_section_addresses): Add code to
4033         check for addresses set by memory regions.
4034         (Output_segment::set_section_addresses): Remove memory region
4035         walking code.
4036         (Script_sections::create_segment): Add a warning if a header
4037         segment is created outside of any region.
4038         * script-sections.h (class Script_sections): Add prototypes for
4039         find_memory_region and block_in_region methods.
4040         * testsuite/memory_test.s: Use .long instead of .word.
4041         * testsuite/memory_test.t: Add some more output sections.
4042         * testsuite/memory_test.sh: Update expected output.
4043
4044 2010-10-02  Doug Kwan  <dougkwan@google.com>
4045
4046         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4047         defintion to symtab.h
4048         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4049         declaration to defintion.
4050
4051 2010-10-01  Nick Clifton  <nickc@redhat.com>
4052
4053         * expression.cc (eval): Replace dummy argument with NULL.
4054         (eval_maybe_dot): Check for a NULL result section pointer.
4055         (Symbol_expression::value): Likewise.
4056         (Dot_expression::value): Likewise.
4057         (BINARY_EXPRESSION): Likewise.
4058         (Max_expression::value): Likewise.
4059         (Min_expression::value): Likewise.
4060         (Absolute_expression::value): Likewise.
4061         (Addr_expression::value_from_output_section): Likewise.
4062         (Loaddddr_expression::value_from_output_section): Likewise.
4063         (Segment_start_expression::value): Likewise.
4064         * script-sections.cc
4065         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4066         argument with NULL.
4067         (Sections_elememt_dot_assignment::set_section_addresses):
4068         Likewise.
4069         (Output_data_expression::do_write_to_buffer): Likewise.
4070         (Output_section_definition::finalize_symbols): Likewise.
4071         (Output_section_definition::set_section_addresses): Likewise.
4072
4073 2010-09-30  Doug Kwan  <dougkwan@google.com>
4074
4075         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4076
4077 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4078
4079         * target.h (Target::can_icf_inline_merge_sections): New virtual
4080         function.
4081         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4082         virtual function.
4083         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4084         virtual function.
4085         * icf.cc (get_section_contents): Inline merge sections only when
4086         target allows it.
4087
4088 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4089
4090         * configure: Regenerate.
4091
4092 2010-09-17  Ian Lance Taylor  <iant@google.com>
4093
4094         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4095         * testsuite/Makefile.am (memory_test.o): New target.
4096         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4097         memory_test.t.
4098         * testsuite/Makefile.in: Rebuild.
4099
4100 2010-09-17  Doug Kwan  <dougkwan@google.com>
4101
4102         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4103         defintion if relocation uses GOT entries of the symbol.
4104         * testsuite/icf_safe_test.sh: Fix test.
4105         * testsuite/icf_safe_so_test.sh: Fix test.
4106
4107 2010-09-16  Cary Coutant  <ccoutant@google.com>
4108
4109         * script_sections.cc (class Memory_region): Remove "NULL" from
4110         vector initializations.
4111
4112 2010-09-15  Cary Coutant  <ccoutant@google.com>
4113
4114         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4115         Resolve forwarding symbols.
4116
4117 2010-09-15  Doug Kwan  <dougkwan@google.com>
4118
4119         * gold/testsuite/script_test_3.t: Add ARM special sections.
4120         * gold/testsuite/script_test_4.t: Same.
4121         * gold/testsuite/script_test_5.t: Same.
4122         * gold/testsuite/script_test_6.t: Same.
4123         * gold/testsuite/script_test_7.t: Same.
4124         * gold/testsuite/script_test_7.t: Same.
4125         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4126
4127 2010-09-14  Cary Coutant  <ccoutant@google.com>
4128
4129         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4130         (Target_x86_64::Relocate::relocate_tls): Replace check for
4131         saw_tls_block_reloc_ with test for executable section.
4132
4133 2010-09-12  Cary Coutant  <ccoutant@google.com>
4134
4135         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4136         position-independent executables to shared libraries need dynamic
4137         relocations.
4138         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4139         position-independent executables.
4140         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4141         * testsuite/Makefile.in: Regenerate.
4142
4143 2010-09-10  Nick Clifton  <nickc@redhat.com>
4144
4145         PR gold/11997
4146         * testsuite/memory_test.t: Discard any sections that are not
4147         needed.
4148
4149 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4150
4151         PR gold/11996
4152         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4153         "This::" to work around a bug in gcc 4.2.
4154
4155         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4156
4157 2010-09-09  Rafael Espindola  <espindola@google.com>
4158
4159         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4160         sections with different PF_X flags in the same segment.
4161         (Layout::find_first_load_seg): Search all segments to find the first
4162         one.
4163         * options.h (rosegment): New.
4164
4165 2010-09-08  Rafael Espindola  <espindola@google.com>
4166
4167         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4168
4169 2010-09-08  Doug Kwan  <dougkwan@google.com>
4170
4171         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4172         (Arm_relobj::do_relocate_sections): Add new parameter for output
4173         file to match the parent.
4174         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4175         of local symbols instead of input values.  Update code to track
4176         changes in gold::relocate_section.
4177         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4178         (Sized_relobj::compute_final_local_value_internal): New methods.
4179         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4180         body into private version of Sized_relobj::compute_final_local_value.
4181         Call the inline method.
4182         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4183         merged symbol value if there is one.
4184         (Symbol_value::has_output_value): New method defintiion.
4185         (Sized_relobj::Compute_final_local_value_status): New enum type.
4186         (Sized_relobj::compute_final_local_value): New methods.
4187         (Sized_relobj::compute_final_local_value_internal): New methods.
4188         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4189         and arm_cortex_a8.sh.
4190         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4191         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4192         New tests.
4193         * Makefile.in: Regenerate.
4194         * testsuite/arm_bl_out_of_range.s: Update test.
4195         * testsuite/thumb_bl_out_of_range.s: Ditto.
4196         * testsuite/thumb_blx_out_of_range.s: Ditto.
4197         * testsuite/arm_branch_out_of_range.sh: New file.
4198         * testsuite/arm_cortex_a8.sh: Ditto.
4199         * testsuite/arm_cortex_a8_b.s: Ditto.
4200         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4201         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4202         * testsuite/arm_cortex_a8_bl.s: Ditto.
4203         * testsuite/arm_cortex_a8_blx.s: Ditto.
4204         * testsuite/arm_cortex_a8_local.s: Ditto.
4205         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4206         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4207
4208 2010-09-08  Rafael Espindola  <espindola@google.com>
4209
4210         * Makefile.am (memory_test.stdout): Run readelf with -W.
4211         * Makefile.in: Regenerate.
4212         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4213         64 bit output.
4214
4215 2010-09-08  Rafael Espindola  <espindola@google.com>
4216
4217         * script-sections.cc (Script_sections::add_memory_region): Convert
4218         field precision to int.
4219         * script.cc (script_set_section_region, script_set_section_region):
4220         Convert field precision to int.
4221
4222 2010-09-08  Rafael Espindola  <espindola@google.com>
4223
4224         * arm.cc (do_finalize_sections): Create the __exidx_start and
4225         __exdix_end symbols even when the section is missing.
4226
4227 2010-09-08  Nick Clifton  <nickc@redhat.com>
4228
4229         * README: Remove claim that MEMORY is not supported.
4230         * expression.cc (script_exp_function_origin)
4231         (script_exp_function_length): Move from here to ...
4232         * script.cc: ... here.
4233         (script_set_section_region, script_add_memory)
4234         (script_parse_memory_attr, script_include_directive): New
4235         functions.
4236         * script-sections.cc
4237         (class Memory_region): New class.
4238         (class Output_section_definition): Add set_memory_region,
4239         set_section_vma, set_section_lma and get_section_name methods.
4240         (class Script_Sections): Add add_memory_region,
4241         find_memory_region, find_memory_region_origin,
4242         find_memory_region_length and set_memory_region methods.
4243         Have set_section_addresses method walk the list of set memory
4244         regions.
4245         Extend the print methos to display memory regions.
4246         * script-sections.h: Add prototypes for new methods.
4247         Add enum for MEMORY region attributes.
4248         * yyscript.y: Add support for parsing MEMORY regions.
4249         * script-c.h: Add prototypes for new functions.
4250         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4251         * testsuite/Makefile.in: Regenerate.
4252         * testsuite/memory_test.sh: New script.
4253         * testsuite/memory_test.s: New assembler source file.
4254         * testsuite/memory_test.t: New linker script.
4255
4256 2010-08-27  Doug Kwan  <dougkwan@google.com>
4257
4258         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4259         reference override an existing dynamic weak reference.
4260         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4261         * testsuite/Makefile.in: Regenerate.
4262         * testsuite/dyn_weak_ref.sh: New file.
4263         * testsuite/dyn_weak_ref_1.c: Ditto.
4264         * testsuite/dyn_weak_ref_2.c: Ditto.
4265
4266 2010-08-27  Ian Lance Taylor  <iant@google.com>
4267
4268         * incremental.h (class Incremental_input_entry): Add virtual
4269         destructor.
4270
4271 2010-08-27  Ian Lance Taylor  <iant@google.com>
4272
4273         * testsuite/start_lib_test_3.c: Mark t3 as used.
4274
4275 2010-08-27  Nick Clifton  <nickc@redhat.com>
4276
4277         * options.cc (version_script): Fix small typo in previous
4278         whitespace tidyup.
4279
4280 2010-08-25  Nick Clifton  <nickc@redhat.com>
4281
4282         * archive.cc: Formatting fixes: Remove whitespace between
4283         typename and following asterisk.  Remove whitespace between
4284         function name and opening parenthesis.
4285         * archive.h: Likewise.
4286         * arm.cc: Likewise.
4287         * attributes.cc: Likewise.
4288         * attributes.h: Likewise.
4289         * common.cc: Likewise.
4290         * copy-relocs.cc: Likewise.
4291         * dirsearch.h: Likewise.
4292         * dynobj.cc: Likewise.
4293         * ehframe.cc: Likewise.
4294         * ehframe.h: Likewise.
4295         * expression.cc: Likewise.
4296         * fileread.cc: Likewise.
4297         * fileread.h: Likewise.
4298         * gc.h: Likewise.
4299         * gold-threads.cc: Likewise.
4300         * gold.cc: Likewise.
4301         * i386.cc: Likewise.
4302         * icf.h: Likewise.
4303         * incremental-dump.cc: Likewise.
4304         * incremental.cc: Likewise.
4305         * layout.cc: Likewise.
4306         * layout.h: Likewise.
4307         * main.cc: Likewise.
4308         * merge.cc: Likewise.
4309         * merge.h: Likewise.
4310         * object.cc: Likewise.
4311         * object.h: Likewise.
4312         * options.cc: Likewise.
4313         * options.h: Likewise.
4314         * output.cc: Likewise.
4315         * output.h: Likewise.
4316         * plugin.cc: Likewise.
4317         * plugin.h: Likewise.
4318         * powerpc.cc: Likewise.
4319         * reloc.cc: Likewise.
4320         * script-c.h: Likewise.
4321         * script-sections.cc: Likewise.
4322         * script.cc: Likewise.
4323         * stringpool.cc: Likewise.
4324         * symtab.cc: Likewise.
4325         * symtab.h: Likewise.
4326         * target.cc: Likewise.
4327         * timer.cc: Likewise.
4328         * timer.h: Likewise.
4329         * version.cc: Likewise.
4330         * x86_64.cc: Likewise.
4331
4332 2010-08-24  Nick Clifton  <nickc@redhat.com>
4333
4334         PR 11899
4335         * layout.cc (segment_precedes): Sort segments by their physical
4336         addresses, if they have been set.
4337
4338 2010-08-23  Cary Coutant  <ccoutant@google.com>
4339
4340         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4341         symbols data.
4342         (Lib_group::include_member): Unlock object after deleting its
4343         symbols data.
4344         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4345         the bug fixed here.
4346
4347 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4348             Cary Coutant  <ccoutant@google.com>
4349
4350         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4351         constructor, and set_blocker.
4352         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4353         readsyms_blocker_.
4354         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4355         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4356         * testsuite/Makefile.am (start_lib_test): New test case.
4357         * testsuite/Makefile.in: Regenerate.
4358         * testsuite/start_lib_test_main.c: New file.
4359         * testsuite/start_lib_test_1.c: New file.
4360         * testsuite/start_lib_test_2.c: New file.
4361         * testsuite/start_lib_test_3.c: New file.
4362
4363 2010-08-19  Ian Lance Taylor  <iant@google.com>
4364
4365         * Makefile.in: Rebuild with automake 1.11.1.
4366         * aclocal.m4: Likewise.
4367         * testsuite/Makefile.in: Likewise.
4368
4369 2010-08-19  Ian Lance Taylor  <iant@google.com>
4370
4371         PR 10893
4372         * i386.cc (class Output_data_plt_i386): Update declarations.
4373         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4374         local_ifuncs_ fields.
4375         (Target_i386::do_plt_section_for_global): New function.
4376         (Target_i386::do_plt_section_for_local): New function.
4377         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4378         parameter; change all callers.  Initialize global_ifuncs_ and
4379         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4380         __rel_iplt_end.
4381         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4382         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4383         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4384         symbols.
4385         (Target_i386::make_plt_section): New function, broken out of
4386         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4387         (Target_i386::make_plt_entry): Call make_plt_section.
4388         (Target_i386::make_local_ifunc_plt_entry): New function.
4389         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4390         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4391         R_386_IRELATIVE to switch.
4392         (Target_i386::Scan::global): Likewise.
4393         (Target_i386::Relocate::relocate): Likewise.
4394         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4395         switch.
4396         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4397         (Target_x86_64::do_plt_section_for_global): New function.
4398         (Target_x86_64::do_plt_section_for_local): New function.
4399         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4400         parameter; change all callers.  If doing a static link define
4401         __rela_iplt_start and __rela_iplt_end.
4402         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4403         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4404         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4405         to point to .plt.
4406         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4407         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4408         switch.
4409         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4410         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4411         R_X86_64_IRELATIVE to switch.
4412         (Target_x86_64::Scan::global): Likewise.
4413         (Target_x86_64::Relocate::relocate): Likewise.
4414         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4415         switch.
4416         * target.h (class Target): Add plt_section_for_global and
4417         plt_section_for_local functions.  Add do_plt_section_for_global
4418         and do_plt_section_for_local virtual functions.
4419         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4420         clarifying comments.
4421         (Symbol::use_plt_offset): Handle IFUNC symbol.
4422         * object.cc (Sized_relobj::Sized_relobj): Initialize
4423         local_plt_offsets_.
4424         (Sized_relobj::local_has_plt_offset): New function.
4425         (Sized_relobj::local_plt_offset): New function.
4426         (Sized_relobj::set_local_plt_offset): New function.
4427         (Sized_relobj::do_count): Handle IFUNC symbol.
4428         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4429         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4430         is_ifunc_symbol functions.
4431         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4432         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4433         local_plt_offsets_ field.
4434         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4435         * output.h (class Output_section_data): Add non-const
4436         output_section function.
4437         (class Output_data_got): Update declarations.
4438         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4439         Add use_plt_offset parameter to global and local constructors.
4440         Change all callers.  Change local_sym_index_ field to 31 bits.
4441         Change GSYM_CODE and CONSTANT_CODE accordingly.
4442         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4443         doing a static link don't set sh_link field.
4444         (Output_data_got::Got_entry::write): Use PLT offset if
4445         appropriate.
4446         (Output_data_got::add_global_plt): New function.
4447         (Output_data_got::add_local_plt): New function.
4448         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4449         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4450         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4451         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4452         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4453         IFUNC conditional.
4454         * testsuite/ifunc-sel.h: New file.
4455         * testsuite/ifuncmain1.c: New file.
4456         * testsuite/ifuncmain1vis.c: New file.
4457         * testsuite/ifuncmod1.c: New file.
4458         * testsuite/ifuncdep2.c: New file.
4459         * testsuite/ifuncmain2.c: New file.
4460         * testsuite/ifuncmain3.c: New file.
4461         * testsuite/ifuncmod3.c: New file.
4462         * testsuite/ifuncmain4.c: New file.
4463         * testsuite/ifuncmain5.c: New file.
4464         * testsuite/ifuncmod5.c: New file.
4465         * testsuite/ifuncmain6pie.c: New file.
4466         * testsuite/ifuncmod6.c: New file.
4467         * testsuite/ifuncmain7.c: New file.
4468         * configure, testsuite/Makefile.in: Rebuild.
4469
4470 2010-08-18  Ian Lance Taylor  <iant@google.com>
4471
4472         * incremental.cc
4473         (Output_section_incremental_inputs::write_input_files): Add cast
4474         to avoid signed/unsigned comparison warning.
4475         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4476
4477 2010-08-12  Cary Coutant  <ccoutant@google.com>
4478
4479         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4480
4481 2010-08-13  Ian Lance Taylor  <iant@google.com>
4482
4483         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4484
4485 2010-08-12  Cary Coutant  <ccoutant@google.com>
4486             Doug Kwan  <dougkwan@google.com>
4487
4488         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4489         defintion overrides non-weak undef, remember that the original undef
4490         is not weak.
4491         * symtab.cc (Symbol_table::sized_write_global): For undef without
4492         an original weak binding, set binding to global in output.
4493         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4494         * testsuite/Makefile.in: Regenerate.
4495         * testsuite/strong_ref_weak_def.sh: New file.
4496         * testsuite/strong_ref_weak_def_1.c: Ditto.
4497         * testsuite/strong_ref_weak_def_2.c: Ditto.
4498
4499 2010-08-12  Cary Coutant  <ccoutant@google.com>
4500
4501         * testsuite/incremental_test.sh: Rewrite.
4502         * testsuite/incremental_test_1.c: Rewrite.
4503         * testsuite/incremental_test_2.c: Rewrite.
4504
4505 2010-08-12  Cary Coutant  <ccoutant@google.com>
4506
4507         * arm.cc (Target_arm::got_size): Add const.
4508         (Target_arm::got_entry_count): New function.
4509         (Target_arm::plt_entry_count): New function.
4510         (Target_arm::first_plt_entry_offset): New function.
4511         (Target_arm::plt_entry_size): New function.
4512         (Output_data_plt_arm::entry_count): New function.
4513         (Output_data_plt_arm::first_plt_entry_offset): New function.
4514         (Output_data_plt_arm::get_plt_entry_size): New function.
4515         * i386.cc (Target_i386::got_size): Add const.
4516         (Target_i386::got_entry_count): New function.
4517         (Target_i386::plt_entry_count): New function.
4518         (Target_i386::first_plt_entry_offset): New function.
4519         (Target_i386::plt_entry_size): New function.
4520         (Output_data_plt_i386::entry_count): New function.
4521         (Output_data_plt_i386::first_plt_entry_offset): New function.
4522         (Output_data_plt_i386::get_plt_entry_size): New function.
4523         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4524         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4525         * incremental.cc: Include target.h.
4526         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4527         parameter.  Adjust all callers.  Find incremental_got_plt section.
4528         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4529         section.
4530         (Output_section_incremental_inputs::set_final_data_size): Calculate
4531         size of incremental_got_plt section.
4532         (Output_section_incremental_inputs::do_write): Write the
4533         incremental_got_plt section.
4534         (Got_plt_view_info): New struct.
4535         (Local_got_offset_visitor): New class.
4536         (Global_got_offset_visitor): New class.
4537         (Global_symbol_visitor_got_plt): New class.
4538         (Output_section_incremental_inputs::write_got_plt): New function.
4539         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4540         Add parameter.  Adjust all callers.
4541         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4542         (Incremental_inputs::got_plt_section): New function.
4543         (Incremental_inputs::got_plt_section_): New data member.
4544         (Incremental_got_plt_reader): New class.
4545         * layout.cc (Layout::create_incremental_info_sections): Add the
4546         incremental_got_plt section.
4547         * object.h (Got_offset_list::get_list): New function.
4548         (Got offset_list::for_all_got_offsets): New function.
4549         (Sized_relobj::local_got_offset_list): New function.
4550         * powerpc.cc (Target_powerpc::got_size): Add const.
4551         (Target_powerpc::got_entry_count): New function.
4552         (Target_powerpc::plt_entry_count): New function.
4553         (Target_powerpc::first_plt_entry_offset): New function.
4554         (Target_powerpc::plt_entry_size): New function.
4555         (Output_data_plt_powerpc::entry_count): New function.
4556         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4557         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4558         * sparc.cc (Target_sparc::got_size): Add const.
4559         (Target_sparc::got_entry_count): New function.
4560         (Target_sparc::plt_entry_count): New function.
4561         (Target_sparc::first_plt_entry_offset): New function.
4562         (Target_sparc::plt_entry_size): New function.
4563         (Output_data_plt_sparc::entry_count): New function.
4564         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4565         (Output_data_plt_sparc::get_plt_entry_size): New function.
4566         * symtab.h (Symbol::got_offset_list): New function.
4567         (Symbol_table::for_all_symbols): New function.
4568         * target.h (Sized_target::got_entry_count): New function.
4569         (Sized_target::plt_entry_count): New function.
4570         (Sized_target::plt_entry_size): New function.
4571         * x86_64.cc (Target_x86_64::got_size): Add const.
4572         (Target_x86_64::got_entry_count): New function.
4573         (Target_x86_64::plt_entry_count): New function.
4574         (Target_x86_64::first_plt_entry_offset): New function.
4575         (Target_x86_64::plt_entry_size): New function.
4576         (Output_data_plt_x86_64::entry_count): New function.
4577         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4578         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4579
4580 2010-08-12  Cary Coutant  <ccoutant@google.com>
4581
4582         * archive.cc: Include incremental.h.
4583         (Archive::Archive): Initialize incremental_info_.
4584         (Archive::include_member): Record archive members in incremental info.
4585         (Add_archive_symbols::run): Record begin and end of an archive in
4586         incremental info.
4587         (Lib_group::include_member): Record objects in incremental info.
4588         * archive.h (Incremental_archive_entry): Forward declaration.
4589         (Archive::set_incremental_info): New member function.
4590         (Archive::incremental_info): New member function.
4591         (Archive::Unused_symbol_iterator): New class.
4592         (Archive::unused_symbols_begin): New member function.
4593         (Archive::unused_symbols_end): New member function.
4594         (Archive::incremental_info_): New data member.
4595         * incremental-dump.cc (find_input_containing_global): New function.
4596         (dump_incremental_inputs): Dump new incremental info sections.
4597         * incremental.cc: Include symtab.h.
4598         (Output_section_incremental_inputs): New class.
4599         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4600         new incremental info sections.
4601         (Sized_incremental_binary::do_check_inputs): Likewise.
4602         (Incremental_inputs::report_archive): Remove.
4603         (Incremental_inputs::report_archive_begin): New function.
4604         (Incremental_inputs::report_archive_end): New function.
4605         (Incremental_inputs::report_object): New function.
4606         (Incremental_inputs::finalize_inputs): Remove.
4607         (Incremental_inputs::report_input_section): New function.
4608         (Incremental_inputs::report_script): Rewrite.
4609         (Incremental_inputs::finalize): Do nothing but finalize string table.
4610         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4611         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4612         (Incremental_inputs::create_data_sections): New function.
4613         (Incremental_inputs::relocs_entsize): New function.
4614         (Output_section_incremental_inputs::set_final_data_size): New function.
4615         (Output_section_incremental_inputs::do_write): New function.
4616         (Output_section_incremental_inputs::write_header): New function.
4617         (Output_section_incremental_inputs::write_input_files): New function.
4618         (Output_section_incremental_inputs::write_info_blocks): New function.
4619         (Output_section_incremental_inputs::write_symtab): New function.
4620         * incremental.h (Incremental_script_entry): Forward declaration.
4621         (Incremental_object_entry): Forward declaration.
4622         (Incremental_archive_entry): Forward declaration.
4623         (Incremental_inputs): Forward declaration.
4624         (Incremental_inputs_header_data): Remove.
4625         (Incremental_inputs_header): Remove.
4626         (Incremental_inputs_header_write): Remove.
4627         (Incremental_inputs_entry_data): Remove.
4628         (Incremental_inputs_entry): Remove.
4629         (Incremental_inputs_entry_write): Remove.
4630         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4631         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4632         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4633         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4634         Likewise.
4635         (Incremental_input_entry): New class.
4636         (Incremental_script_entry): New class.
4637         (Incremental_object_entry): New class.
4638         (Incremental_archive_entry): New class.
4639         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4640         (Incremental_inputs::report_inputs): Remove.
4641         (Incremental_inputs::report_archive): Remove.
4642         (Incremental_inputs::report_archive_begin): New function.
4643         (Incremental_inputs::report_archive_end): New function.
4644         (Incremental_inputs::report_object): Change prototype.
4645         (Incremental_inputs::report_input_section): New function.
4646         (Incremental_inputs::report_script): Change prototype.
4647         (Incremental_inputs::get_reloc_count): New function.
4648         (Incremental_inputs::set_reloc_count): New function.
4649         (Incremental_inputs::create_data_sections): New function.
4650         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4651         (Incremental_inputs::inputs_section): New function.
4652         (Incremental_inputs::symtab_section): New function.
4653         (Incremental_inputs::relocs_section): New function.
4654         (Incremental_inputs::get_stringpool): Add const.
4655         (Incremental_inputs::command_line): Add const.
4656         (Incremental_inputs::inputs): Remove.
4657         (Incremental_inputs::command_line_key): New function.
4658         (Incremental_inputs::input_file_count): New function.
4659         (Incremental_inputs::input_files): New function.
4660         (Incremental_inputs::relocs_entsize): New function.
4661         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4662         (Incremental_inputs::finalize_inputs): Remove.
4663         (Incremental_inputs::Input_info): Remove.
4664         (Incremental_inputs::lock_): Remove.
4665         (Incremental_inputs::inputs_): Change type.
4666         (Incremental_inputs::inputs_map_): Remove.
4667         (Incremental_inputs::current_object_entry_): New data member.
4668         (Incremental_inputs::inputs_section_): New data member.
4669         (Incremental_inputs::symtab_section_): New data member.
4670         (Incremental_inputs::relocs_section_): New data member.
4671         (Incremental_inputs::reloc_count_): New data member.
4672         (Incremental_inputs_reader): New class.
4673         (Incremental_symtab_reader): New class.
4674         (Incremental_relocs_reader): New class.
4675         * layout.cc (Layout::finalize): Move finalization of incremental info
4676         and creation of incremental info sections to follow finalization of
4677         symbol table.  Set offsets for postprocessing sections.
4678         (Layout::create_incremental_info_sections): Call
4679         Incremental_inputs::create_data_sections.  Add incremental symtab
4680         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4681         sections to layout after input sections.
4682         * layout.h (struct Timespec): Forward declaration.
4683         (Layout::incremental_inputs): Add const.
4684         (Layout::create_incremental_info_sections): Add parameter.
4685         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4686         * object.cc: Include incremental.h.
4687         (Relobj::finalize_incremental_relocs): New function.
4688         (Sized_relobj::do_layout): Record input sections in incremental info.
4689         * object.h (Object::output_section): New function.
4690         (Object::output_section_offset): Moved from Relobj.
4691         (Object::get_incremental_reloc_base): New function.
4692         (Object::get_incremental_reloc_count): New function.
4693         (Object::do_output_section): New function.
4694         (Object::do_output_section_offset): Moved from Relobj.
4695         (Object::do_get_incremental_reloc_base): New function.
4696         (Object::do_get_incremental_reloc_count): New function.
4697         (Object::Object): Initialize new data members.
4698         (Relobj::output_section): Renamed do_output_section and moved to
4699         protected.
4700         (Relobj::output_section_offset): Moved to Object.
4701         (Relobj::do_get_incremental_reloc_base): New function.
4702         (Relobj::do_get_incremental_reloc_count): New function.
4703         (Relobj::allocate_incremental_reloc_counts): New function.
4704         (Relobj::count_incremental_reloc): New function.
4705         (Relobj::finalize_incremental_relocs): New function.
4706         (Relobj::next_incremental_reloc_index): New function.
4707         (Relobj::reloc_counts_): New data member.
4708         (Relobj::reloc_bases_): New data member.
4709         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4710         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4711         (Sized_relobj::incremental_relocs_scan): New function.
4712         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4713         (Sized_relobj::incremental_relocs_write): New function.
4714         (Sized_relobj::incremental_relocs_write_reltype): New function.
4715         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4716         incremental link.
4717         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4718         archives and object files elsewhere.
4719         (Add_symbols::run): Report object files here.
4720         (Finish_group::run): Report end of archive at end of group.
4721         * reloc.cc: Include layout.h, incremental.h.
4722         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4723         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4724         (Sized_relobj::incremental_relocs_scan): New function.
4725         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4726         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4727         (Sized_relobj::incremental_relocs_write): New function.
4728         (Sized_relobj::incremental_relocs_write_reltype): New function.
4729         * script.cc (read_input_script): Rewrite test for incremental link.
4730         Change call to Incremental_inputs::report_script.
4731         * symtab.h (Symbol_table::first_global_index): New function.
4732         (Symbol_table::output_count): New function.
4733
4734 2010-08-12  Doug Kwan  <dougkwan@google.com>
4735
4736         * arm.cc (Target_arm::merge_object_attributes): Check command line
4737         options --no-wchar-size-warning and --no-enum-size-warning.
4738         * options.h (General_options): Add ld-compatible options
4739         --no-enum-size-warning and --no-wchar-size-warning.
4740
4741 2010-08-04  Ian Lance Taylor  <iant@google.com>
4742
4743         * x86_64.cc (Target_x86_64::Scan::local): Use
4744         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4745         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4746         (Target_x86_64::Scan::global): Likewise.
4747         (Target_x86_64::Relocate::relocate): Likewise.
4748         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4749         Likewise.
4750
4751 2010-08-03  Cary Coutant  <ccoutant@google.com>
4752
4753         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4754         to reserve space in merged_strings vector. Keep total input size
4755         for stats.
4756         (Output_merge_string::do_print_merge_stats): Print total input size.
4757         * merge.h (Output_merge_string): Add input_size_ field.
4758         * stringpool.cc (Stringpool_template::string_length): Move
4759         implementations out of Stringpool_template class and place in
4760         stringpool.h.
4761         * stringpool.h (string_length): Move out of Stringpool_template.
4762
4763 2010-08-03  Ian Lance Taylor  <iant@google.com>
4764
4765         PR 11712
4766         * layout.cc (relaxation_loop_body): If address of load segment is
4767         set, adjust address to include headers if possible.
4768
4769 2010-08-03  Ian Lance Taylor  <iant@google.com>
4770
4771         * version.cc (version_string): Bump to 1.10.
4772
4773 2010-08-03  Ian Lance Taylor  <iant@google.com>
4774
4775         PR 11805
4776         * layout.h (enum Output_section_order): Define.
4777         (class Layout): Update declarations.
4778         * layout.cc (Layout::get_output_section): Add order parameter.
4779         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4780         is_first_non_relro parameters.  Change all callers.
4781         (Layout::choose_output_section): Likewise.
4782         (Layout::add_output_section_data): Likewise.
4783         (Layout::make_output_section): Likewise.  Set order.
4784         (Layout::default_section_order): New function.
4785         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4786         * output.cc (Output_section::Output_section): Initialize order_.
4787         Don't initialize deleted fields.
4788         (Output_segment::Output_segment): Don't initialize deleted
4789         fields.
4790         (Output_segment::add_output_section_to_load): New function
4791         replacing add_output_section.  Change all callers to call this or
4792         add_output_section_to_nonload.
4793         (Output_segment::add_output_section_to_nonload): New function.
4794         (Output_segment::remove_output_section): Rewrite.
4795         (Output_segment::add_initial_output_data): Likewise.
4796         (Output_segment::has_any_data_sections): Likewise.
4797         (Output_segment::is_first_section_relro): Likewise.
4798         (Output_segment::maximum_alignment): Likewise.
4799         (Output_segment::has_dynamic_reloc): New function replacing
4800         dynamic_reloc_count.  Change all callers.
4801         (Output_segment::has_dynamic_reloc_list): New function replacing
4802         dynamic_reloc_count_list.  Change all callers.
4803         (Output_segment::set_section_addresses): Rewrite.
4804         (Output_segment::set_offset): Rewrite.
4805         (Output_segment::find_first_and_last_list): Remove.
4806         (Output_segment::set_tls_offsets): Rewrite.
4807         (Output_segment::first_section_load_address): Likewise.
4808         (Output_segment::output_section_count): Likewise.
4809         (Output_segment::section_with_lowest_load_address): Likewise.
4810         (Output_segment::write_section_headers): Likewise.
4811         (Output_segment::print_sections_to_map): Likewise.
4812         * output.h (class Output_data): Remove dynamic_reloc_count_
4813         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4814         (Output_data::add_dynamic_reloc): Rewrite.
4815         (Output_data::has_dynamic_reloc): New function.
4816         (Output_data::dynamic_reloc_count): Remove.
4817         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4818         is_last_relro_, is_first_non_relro_, is_interp_,
4819         is_dynamic_linker_section_ fields.  Add order and set_order
4820         functions.  Remove is_relro_local, set_is_relro_local,
4821         is_last_relro, set_is_last_relro, is_first_non_relro,
4822         set_is_first_non_relro functions, is_interp, set_is_interp,
4823         is_dynamic_linker_section, and set_is_dynamic_linker_section
4824         functions.
4825         (class Output_segment): Change Output_data_list from std::list to
4826         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4827         output_bss_ fields.  Update declarations.
4828
4829 2010-08-02  Ian Lance Taylor  <iant@google.com>
4830
4831         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4832         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4833         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4834
4835 2010-08-02  Ian Lance Taylor  <iant@google.com>
4836
4837         PR 11855
4838         * script.cc (Script_options::Script_options): Initialize
4839         symbol_definitions_ and symbol_references_.
4840         (Script_options::add_symbol_assignment): Update
4841         symbol_definitions_ and symbol_references_.
4842         (Script_options::add_symbol_reference): New function.
4843         (script_symbol): New function.
4844         * script.h (class Script_options): Add symbol_definitions_ and
4845         symbol_references_ fields.
4846         (Script_options::referenced_const_iterator): New type.
4847         (Script_options::referenced_begin): New function.
4848         (Script_options::referenced_end): New function.
4849         (Script_options::is_referenced): New function.
4850         (Script_options::any_unreferenced): New function.
4851         * script-c.h (script_symbol): Declare.
4852         * yyscript.y (exp): Call script_symbol.
4853         * symtab.cc: Include "script.h".
4854         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4855         Change all callers.  Check symbols referenced by scripts.
4856         (Symbol_table::add_undefined_symbols_from_command_line): Add
4857         layout parameter.  Change all callers.
4858         (Symbol_table::do_add_undefined_symbols_from_command_line):
4859         Likewise.  Break out loop body.  Check symbols referenced by
4860         scripts.
4861         (Symbol_table::add_undefined_symbol_from_command_line): New
4862         function broken out of
4863         do_add_undefined_symbols_from_command_line.
4864         * symtab.h (class Symbol_table): Update declarations.
4865         * archive.cc: Include "layout.h".
4866         (Archive::should_include_member): Add layout parameter.  Change
4867         all callers.  Check for symbol mentioned in expression.
4868         * archive.h (class Archive): Update declaration.
4869         * object.cc (Sized_relobj::do_should_include_member): Add layout
4870         parameter.
4871         * object.h (Object::should_include_member): Add layout parameter.
4872         Change all callers.
4873         (Object::do_should_include_member): Add layout parameter.
4874         (class Sized_relobj): Update declaration.
4875         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4876         parameter.
4877         * dynobj.h (class Sized_dynobj): Update declaration.
4878         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4879         layout parameter.
4880         * plugin.h (class Sized_pluginobj): Update declaration.
4881
4882 2010-08-02  Ian Lance Taylor  <iant@google.com>
4883
4884         PR 11866
4885         * output.cc (Output_segment::set_offset): Search for the first and
4886         last sections rather than assuming that the list is in order.
4887         (Output_segment::find_first_and_last_list): New function.
4888         * output.h (class Output_segment): Update declarations.
4889         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4890         (relro_strip_test_SOURCES): New variable.
4891         (relro_strip_test_DEPENDENCIES): New variable.
4892         (relro_strip_test_LDFLAGS): New variable.
4893         (relro_strip_test_LDADD): New variable.
4894         (relro_strip_test.so): New target.
4895
4896 2010-08-02  Ian Lance Taylor  <iant@google.com>
4897
4898         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4899         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4900         (Target_i386::got_tlsdesc_section): New function.
4901         (Target_i386::got_section): Create space for GOT entries for
4902         TLSDESC relocations.
4903         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4904         R_386_TLS_GOTDESC.
4905         (Target_i386::Scan::global): Likewise.
4906         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4907         using TLSDESC GOT.
4908         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4909         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4910         (Target_x86_64::got_tlsdesc_section): New function.
4911         (Target_x86_64::got_section): Create space for GOT entries for
4912         TLSDESC relocations.
4913         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4914         R_386_TLS_GOTDESC.
4915         (Target_x86_64::Scan::global): Likewise.
4916         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4917         using TLSDESC GOT.
4918
4919 2010-08-02  Ian Lance Taylor  <iant@google.com>
4920
4921         * testsuite/final_layout.sh: Use dc to convert from hex to
4922         decimal.
4923
4924 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4925
4926         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4927         paramter to the call to gold::gc_process_relocs.
4928         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4929         paramter to the call to gold::gc_process_relocs.
4930         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4931         parameter to the call to gold::gc_process_relocs.
4932         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4933         template parameter to the call to gold::gc_process_relocs.
4934         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4935         paramter to the call to gold::gc_process_relocs.
4936         * gc.h (get_embedded_addend_size): New function.
4937         (gc_process_relocs): Save the size of the reloc for use by ICF.
4938         * icf.cc (get_section_contents): Get the addend from the text section
4939         for SHT_REL relocation sections.
4940         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4941         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4942         * int_encoding.h (read_from_pointer): New overloaded function.
4943         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4944         * testsuite/icf_sht_rel_addend_test.sh: New file.
4945         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4946         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4947
4948 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4949
4950         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4951         * Makefile.in: Regenerate.
4952         * testsuite/Makefile.in: Regenerate.
4953
4954 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4955
4956         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4957         * gold/testsuite/debug_msg.cc: Likewise.
4958         * gold/testsuite/odr_violation1.cc
4959         * gold/testsuite/odr_violation2.cc
4960
4961 2010-07-21  Cary Coutant  <ccoutant@google.com>
4962
4963         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4964         string, and length fields.
4965         (Output_merge_string::Merged_strings_list): New type.
4966         (Output_merge_string::Merged_strings_lists): New typedef.
4967         (Output_merge_string): Replace merged_strings_ with
4968         merged_strings_lists_.
4969         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4970         Merged_strings_list per input object and section.  Don't store pointer
4971         to the string.  Don't store length with each merged string entry.
4972         (Output_merge_string::finalize_merged_data): Loop over list of merged
4973         strings lists.  Recompute length of each merged string.
4974
4975 2010-07-15  Cary Coutant  <ccoutant@google.com>
4976
4977         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4978         here.
4979
4980 2010-07-14  Ian Lance Taylor  <iant@google.com>
4981
4982         * descriptors.cc (Descriptors::open): Report correct name in error
4983         message.
4984
4985 2010-07-13  Doug Kwan  <dougkwan@google.com>
4986
4987         * arm.cc (Arm_input_section::Arm_input_section): For a
4988         SHT_ARM_EXIDX section, always keeps the input sections.
4989         (Arm_input_section::set_exidx_section_link): New method.
4990         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4991         has_errors_ to false.
4992         (Arm_exidx_input_section::has_errors,
4993         Arm_exidx_input_section::set_has_errors): New methods.
4994         (Arm_exidx_input_section::has_errors_): New data member.
4995         (Arm_relobj::get_exidx_shndx_list): New method.
4996         (Arm_output_section::append_text_sections_to_list): Do not skip
4997         section without SHF_EXECINSTR.
4998         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4999         errors.
5000         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5001         section header.  Make error messages more verbose.  Check for
5002         a non-executable section linked to an EXIDX section.
5003         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5004         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5005         check that there is no deferred EXIDX section if we exit early.
5006         Instead of not making an EXIDX section in case of an error, make one
5007         and set the has_errors flag of it.
5008         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5009         in a relocatable link.
5010         (Target_arm::do_relax): Look for the EXIDX output section instead of
5011         assuming that it is called .ARM.exidx.
5012         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5013         section list.  Do not check for SHF_EXECINSTR section flags but
5014         skip any input section with errors.
5015         * output.cc (Output_section::Output_section): Initialize
5016         always_keeps_input_sections_ to false.
5017         (Output_section::add_input_section): Check for
5018         always_keeps_input_sections_.
5019         *  output.h (Output_section::always_keeps_input_sections,
5020         Output_section::set_always_keeps_input_sections): New methods.
5021         (Output_section::always_keeps_input_sections): New data member.
5022
5023 2010-07-13  Rafael Espindola  <espindola@google.com>
5024
5025         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5026         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5027
5028 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5029             Ian Lance Taylor  <iant@google.com>
5030
5031         * output.h (Output_section_lookup_maps::add_merge_section):
5032         Correct check of whether value was inserted.
5033         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5034         (Output_section_lookup_maps::add_relaxed_input_section):
5035         Likewise.
5036         * arm.cc (Target_arm::got_section): Remove used local os.
5037         * i386.cc (Target_i386::got_section): Likewise.
5038         * x86_64.cc (Target_x86_64::got_section): Likewise.
5039         * sparc.cc (Target_sparc::got_section): Likewise.
5040         (Target_sparc::relocate): Remove unused local have_got_offset.
5041         * powerpc.cc (Target_powerpc::relocate): Likewise.
5042
5043 2010-07-13  Ian Lance Taylor  <iant@google.com>
5044
5045         * compressed_output.cc (zlib_decompress): Fix signature in
5046         !HAVE_ZLIB_H case.
5047
5048         * archive.cc (Archive::include_member): Unlock an external member
5049         of a thin archive.  Don't bother to delete an object we know is
5050         NULL.
5051
5052 2010-07-12  Cary Coutant  <ccoutant@google.com>
5053
5054         * compressed_output.cc (zlib_decompress): New function.
5055         (get_uncompressed_size): New function.
5056         (decompress_input_section): New function.
5057         * compressed_output.h (get_uncompressed_size): New function.
5058         (decompress_input_section): New function.
5059         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5060         Handle compressed debug sections.
5061         * layout.cc (is_compressed_debug_section): New function.
5062         (Layout::output_section_name): Map compressed section names to
5063         canonical names.
5064         * layout.h (is_compressed_debug_section): New function.
5065         (is_debug_info_section): Recognize compressed debug sections.
5066         * merge.cc: Include compressed_output.h.
5067         (Output_merge_data::do_add_input_section): Handle compressed
5068         debug sections.
5069         (Output_merge_string::do_add_input_section): Handle compressed
5070         debug sections.
5071         * object.cc: Include compressed_output.h.
5072         (Sized_relobj::Sized_relobj): Initialize new data members.
5073         (build_compressed_section_map): New function.
5074         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5075         * object.h (Object::section_is_compressed): New method.
5076         (Object::do_section_is_compressed): New method.
5077         (Sized_relobj::Compressed_section_map): New type.
5078         (Sized_relobj::do_section_is_compressed): New method.
5079         (Sized_relobj::compressed_sections_): New data member.
5080         * output.cc (Output_section::add_input_section): Handle compressed
5081         debug sections.
5082         * reloc.cc: Include compressed_output.h.
5083         (Sized_relobj::write_sections): Handle compressed debug sections.
5084
5085 2010-07-08  Cary Coutant  <ccoutant@google.com>
5086
5087         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5088         weak when resolving to a dynamic def.
5089         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5090         for weak undef/dynamic def cases. Adjust callers.
5091         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5092         undef_binding_weak_.
5093         (Symbol_table::sized_write_globals): Adjust symbol binding.
5094         (Symbol_table::sized_write_symbol): Add binding parameter.
5095         * symtab.h (Symbol::set_undef_binding): New method.
5096         (Symbol::is_undef_binding_weak): New method.
5097         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5098         (Symbol_table::should_override): Add new parameter.
5099         (Symbol_table::sized_write_symbol): Add new parameter.
5100
5101         * testsuite/weak_undef_file1.cc: Add new test case.
5102         * testsuite/weak_undef_file2.cc: Fix header comment.
5103         * testsuite/weak_undef_test.cc: Add new test case.
5104
5105 2010-06-29  Doug Kwan  <dougkwan@google.com>
5106
5107         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5108         Initialize USE_SYMBOL_.
5109         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5110         definition.
5111         (Arm_reloc_property::uses_symbol_): New data member declaration.
5112         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5113         uses symbol value and symbol is undefined but not weakly undefined.
5114
5115 2010-06-28  Rafael Espindola  <espindola@google.com>
5116
5117         * plugin.cc (Plugin::load): Use dlerror.
5118
5119 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5120
5121         * symtab.cc (detect_odr_violations): When reporting an ODR
5122         violation, report an object where the symbol is defined.
5123
5124 2010-06-25  Doug Kwan  <dougkwan@google.com>
5125
5126         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5127         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5128         definition.
5129         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5130         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5131         target hook to detect function points.
5132         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5133         * icf.h (Icf::check_section_for_function_pointers): Change type of
5134         parameter SECTION_NAME to const reference to std::string.  Use
5135         target hook to determine if section may have unsafe pointers.
5136         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5137         method definition.
5138
5139 2010-06-21  Rafael Espindola  <espindola@google.com>
5140
5141         * fileread.cc (Input_file::find_fie): New
5142         (Input_file::open): Use Input_file::find_fie.
5143         * fileread.h (Input_file::find_fie): New
5144         * plugin.cc (set_extra_library_path): New.
5145         (Plugin::load): Add set_extra_library_path to the transfer vector.
5146         (Plugin_manager::set_extra_library_path): New.
5147         (Plugin_manager::add_input_file): Use the extra search path if set.
5148         (set_extra_library_path(): New.
5149         * plugin.h (Plugin_manager): Add set_extra_library_path and
5150         extra_search_path_.
5151
5152 2010-06-19  Cary Coutant  <ccoutant@google.com>
5153
5154         * layout.cc (gdb_sections): Add .debug_types.
5155         (lines_only_debug_sections): Likewise.
5156
5157 2010-06-18  Rafael Espindola  <espindola@google.com>
5158
5159         * plugin.cc (add_input_file,add_input_library)
5160         (Plugin_manager::add_input_file): Make filename arguments const.
5161         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5162         const.
5163
5164 2010-06-16  Doug Kwan  <dougkwan@google.com>
5165
5166         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5167         .ARM.attributes section if we have not merged any input
5168         attributes sections.
5169
5170 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5171
5172         * arm.cc: Allow combining objects with no EABI version
5173         information.
5174
5175 2010-06-15  Rafael Espindola  <espindola@google.com>
5176
5177         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5178
5179 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5180
5181         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5182         (struct iovec): Correct !HAVE_READV definition.
5183
5184 2010-06-10  Cary Coutant  <ccoutant@google.com>
5185
5186         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5187         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5188         reloc sections.
5189         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5190
5191         PR 11683
5192         * symtab.h (Symbol::is_placeholder): New member function.
5193         * target-reloc.h (relocate_section): Check for placeholder symbols.
5194
5195         * testsuite/Makefile.am (plugin_test_8): New test.
5196         (plugin_test_9): New test.
5197         * testsuite/Makefile.in: Regenerate.
5198
5199 2010-06-09  Nick Clifton  <nickc@redhat.com>
5200
5201         * yyscript.y (input_list_element): Allow strings prefixed with
5202         the '-' character.  Treat these as libraries.
5203         * script.cc (script_add_library): New function.  Adds a library
5204         specified by "-l<name>" found in an input script.
5205         * script-c.h: Add prototype for script_add_library.
5206
5207 2010-06-07  Doug Kwan  <dougkwan@google.com>
5208
5209         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5210         Restrict stub-group size to be within long conditional branch
5211         range when working around cortex-A8 erratum.
5212
5213 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5214
5215         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5216         #ifdef typo.
5217
5218 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5219
5220         PR gold/11658
5221         * output.cc
5222         (Output_section::Input_section_sort_entry::compare_section_ordering):
5223         Change to return non-zero correctly.
5224         (Output_section::Input_section_sort_section_order_index_compare
5225         ::operator()): Change to fix ambiguity in comparisons.
5226
5227 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5228
5229         * gold.h (is_wildcard_string): New function.
5230         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5231         (Layout::layout_eh_frame): Ditto.
5232         (Layout::find_section_order_index): New method.
5233         (Layout::read_layout_from_file): New method.
5234         * layout.h (Layout::find_section_order_index): New method.
5235         (Layout::read_layout_from_file): New method.
5236         (Layout::input_section_position_): New private member.
5237         (Layout::input_section_glob_): New private member.
5238         * main.cc (main): Call read_layout_from_file here.
5239         * options.h (--section-ordering-file): New option.
5240         * output.cc (Output_section::input_section_order_specified_): New
5241         member.
5242         (Output_section::Output_section): Initialize new member.
5243         (Output_section::add_input_section): Add new parameter.
5244         Keep input sections when --section-ordering-file is used.
5245         (Output_section::set_final_data_size): Sort input sections when
5246         section ordering file is specified.
5247         (Output_section::Input_section_sort_entry): Add new parameter.
5248         Check sorting type.
5249         (Output_section::Input_section_sort_entry::compare_section_ordering):
5250         New method.
5251         (Output_section::Input_section_sort_compare::operator()): Change to
5252         consider section_order_index.
5253         (Output_section::Input_section_sort_init_fini_compare::operator()):
5254         Change to consider section_order_index.
5255         (Output_section::Input_section_sort_section_order_index_compare
5256         ::operator()): New method.
5257         (Output_section::sort_attached_input_sections): Change to sort
5258         according to section order when specified.
5259         (Output_section::add_input_section<32, true>): Add new parameter.
5260         (Output_section::add_input_section<64, true>): Add new parameter.
5261         (Output_section::add_input_section<32, false>): Add new parameter.
5262         (Output_section::add_input_section<64, false>): Add new parameter.
5263         * output.h (Output_section::add_input_section): Add new parameter.
5264         (Output_section::input_section_order_specified): New
5265         method.
5266         (Output_section::set_input_section_order_specified): New method.
5267         (Input_section::Input_section): Initialize section_order_index_.
5268         (Input_section::section_order_index): New method.
5269         (Input_section::set_section_order_index): New method.
5270         (Input_section::section_order_index_): New member.
5271         (Input_section::Input_section_sort_section_order_index_compare): New
5272         struct.
5273         (Output_section::input_section_order_specified_): New member.
5274         * script-sections.cc (is_wildcard_string): Delete and move modified
5275         method to gold.h.
5276         (Output_section_element_input::Output_section_element_input): Modify
5277         call to is_wildcard_string.
5278         (Output_section_element_input::Input_section_pattern
5279         ::Input_section_pattern): Ditto.
5280         (Output_section_element_input::Output_section_element_input): Ditto.
5281         * testsuite/Makefile.am (final_layout): New test case.
5282         * testsuite/Makefile.in: Regenerate.
5283         * testsuite/final_layout.cc: New file.
5284         * testsuite/final_layout.sh: New file.
5285
5286 2010-06-01  Rafael Espindola  <espindola@google.com>
5287
5288         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5289
5290 2010-06-01  Rafael Espindola  <espindola@google.com>
5291
5292         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5293         visibility of symbols.
5294
5295 2010-05-27  Doug Kwan  <dougkwan@google.com>
5296
5297         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5298         from start of output section instead of address for a local symbol
5299         in a merged or relaxed section when doing a relocatable link.
5300
5301 2010-05-26  Rafael Espindola  <espindola@google.com>
5302
5303        PR 11604
5304         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5305         adding sections the garbage collector removed.
5306         * gold/testsuite/Makefile.am: Add test.
5307         * gold/testsuite/Makefile.in: Regenerate.
5308         * gold/testsuite/plugin_test_7.sh: New.
5309         * gold/testsuite/plugin_test_7_1.c: New.
5310         * gold/testsuite/plugin_test_7_2.c: New.
5311
5312 2010-05-26  Rafael Espindola  <espindola@google.com>
5313
5314         * script-sections.cc (Output_section_definition::set_section_addresses):
5315         Check for --section-start.
5316
5317 2010-05-26  Doug Kwan  <dougkwan@google.com>
5318
5319         * arm.cc (Arm_scan_relocatable_relocs): New class.
5320         (Target_arm::relocate_special_relocatable): New method.
5321         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5322         (Arm_relocate_functions::thumb_branch_common): Same.
5323         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5324         instead of Default_scan_relocatable_relocs.
5325         * target-reloc.h (relocate_for_relocatable): Let target handle
5326         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5327         * target.h (Sized_target::relocate_special_relocatable): New method.
5328
5329 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5330
5331         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5332
5333 2010-05-23  Doug Kwan  <dougkwan@google.com>
5334
5335         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5336         instead of a cast.
5337         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5338         with a direct branch, not a conditional branch, to a stub.
5339         * merge.cc (Output_merge_base::record_input_section): New method
5340         defintion.
5341         (Output_merge_data::do_add_input_section): Record input section if
5342         keeps-input-sections flag is set.
5343         (Output_merge_string::do_add_input_section): Ditto.
5344         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5345         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5346         INPUT_SECTIONS_.
5347         (Output_merge_base::keeps_input_sections,
5348         Output_merge_base::set_keeps_input_sections,
5349         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5350         method definitions.
5351         (Output_merge_base::Input_sections): New type declaration.
5352         (Output_merge_base::input_sections_begin,
5353         Output_merge_base::input_sections_end,
5354         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5355         (Output_merge_base::bool keeps_input_sections_,
5356         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5357         Output_merge_base::input_sections_): New data members.
5358         (Output_merge_data::do_set_keeps_input_sections): New method
5359         defintion.
5360         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5361         * output.cc (Output_section::Input_section::relobj): Move method
5362         defintion from class declaration to here and handle merge sections.
5363         (Output_section::Input_section::shndx): Ditto.
5364         (Output_section::Output_section): Remove initializations of removed
5365         data members and initialize new data member LOOKUP_MAPS_.
5366         (Output_section::add_input_section): Set keeps-input-sections flag
5367         for a newly created merge output section as appropriate.  Adjust code
5368         to use Output_section_lookup_maps class.
5369         (Output_section::add_relaxed_input_section): Adjst code for lookup
5370         maps code refactoring.
5371         (Output_section::add_merge_input_section): Add a new parameter
5372         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5373         class.  If adding input section to a newly created merge output
5374         section fails, remove the new merge section.
5375         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5376         Adjust code for use of the Output_section_lookup_maps class.
5377         (Output_section::find_merge_section): Ditto.
5378         (Output_section::build_lookup_maps): New method defintion.
5379         (Output_section::find_relaxed_input_section): Adjust code to use
5380         Output_section_lookup_maps class.
5381         (Output_section::get_input_sections): Export merge sections.  Adjust
5382         code to use Output_section_lookup_maps class.
5383         (Output_section:::add_script_input_section): Adjust code to use
5384         Output_section_lookup_maps class.  Update lookup maps for merge
5385         sections also.
5386         (Output_section::discard_states): Use Output_section_lookup_maps.
5387         (Output_section::restore_states): Same.
5388         * output.h (Merge_section_properties): Move class defintion out of
5389         Output_section.
5390         (Output_section_lookup_maps): New class.
5391         (Output_section::Input_section::is_merge_section): New method
5392         defintion.
5393         (Output_section::Input_section::relobj): Move defintion out of class
5394         defintion.  Declare method only.
5395         (Output_section::Input_section::shndx): Ditto.
5396         (Output_section::Input_section::output_merge_base): New method defintion.
5397         (Output_section::Input_section::u2_.pomb): New union field.
5398         (Output_section::Merge_section_by_properties_map,
5399         Output_section::Output_section_data_by_input_section_map,
5400         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5401         Remove types.
5402         (Output_section::add_merge_input_section): Add new parameter
5403         KEEPS_INPUT_SECTIONS.
5404         (Output_section::build_lookup_maps): New method declaration.
5405         (Output_section::merge_section_map_,
5406         Output_section::merge_section_by_properties_map_,
5407         Output_section::relaxed_input_section_map_,
5408         Output_section::is_relaxed_input_section_map_valid_): Remove data
5409         members.
5410         (Output_section::lookup_maps_): New data member.
5411
5412 2010-05-21  Doug Kwan  <dougkwan@google.com>
5413
5414         PR gold/11619
5415         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5416         avoid a compilation error.
5417
5418 2010-05-19  Rafael Espindola  <espindola@google.com>
5419
5420         * script-sections.cc (Output_section_definition::allocate_to_segment):
5421         Update the phdrs_list even when the output section is NULL.
5422         * testsuite/Makefile.am: Add test.
5423         * testsuite/Makefile.in: Regenerate.
5424         * testsuite/script_test_9.cc: New.
5425         * testsuite/script_test_9.sh: New.
5426         * testsuite/script_test_9.t: New.
5427
5428 2010-05-19  Doug Kwan  <dougkwan@google.com>
5429
5430         * arm.cc (Arm_input_section::original_size): New method.
5431         (Arm_input_section::do_addralign): Add a cast.
5432         (Arm_input_section::do_output_offset): Remove static cast.
5433         (Arm_input_section::original_addralign,
5434          Arm_input_section::original_size_): Change type to uint32_t.
5435         (Arm_input_section::init): Add safe casts for section alignment
5436         and size.
5437         (Arm_input_section::set_final_data_size): Do not set address and
5438         offset of stub table.
5439         (Arm_output_section::fix_exidx_coverage): Change use of of
5440         Output_section::Simple_input_section to that of
5441         Output_section::Input_section.
5442         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5443         except for the first pass.
5444         * output.cc (Output_section::get_input_sections): Change type of
5445         input_sections to std::list<Input_section>.
5446         (Output_section::add_script_input_section): Rename from
5447         Output_section::add_simple_input_section.  Change type of SIS
5448         parameter from Simple_input_section to Input_section.
5449         * output.h (Output_section::Simple_input_section): Remove class.
5450         (Output_section::Input_section): Change class visibility to public.
5451         (Output_section::Input_section::addralign): Use stored alignments
5452         for special input sections if set.
5453         (Output_section::Input_section::set_addralign): New method.
5454         (Output_section::get_input_sections): Change parameter type from
5455         list of Simple_input_section to list of Input_section.
5456         (Output_section::add_script_input_section): Rename from
5457         Output_section::add_simple_input_section. Change first parameter's
5458         type from Simple_input_section to Input_section and remove the
5459         second and third parameters.
5460         * script-sections.cc (Input_section::Input_section_list): Change
5461         type to list of Output_section::Input_section/
5462         (Input_section_info::Input_section_info): Change parameter type of
5463         INPUT_SECTION to Output_section::Input_section.
5464         (Input_section_info::input_section): Change return type.
5465         (Input_section_info::input_section_): Change type to
5466         Output_section::Input_section.
5467         (Output_section_element_input::set_section_addresses): Adjust code
5468         to use Output_section::Input_section instead of
5469         Output_section::Simple_input_section.  Adjust code for renaming
5470         of Output_section::add_simple_input_section.
5471         (Orphan_output_section::set_section_addresses): Ditto.
5472
5473 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5474
5475         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5476         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5477
5478 2010-05-18  Rafael Espindola  <espindola@google.com>
5479
5480         * options.cc (General_options::finalize): Handle -nostdlib.
5481         * options.h (nostdlib): New option.
5482         * script.cc (script_add_search_dir): Handle -nostdlib.
5483
5484 2010-05-12  Doug Kwan  <dougkwan@google.com>
5485
5486         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5487         attributes section only if there no attributes section after merging.
5488         (Target_arm::merge_object_attributes): Move value of
5489         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5490         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5491         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5492         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5493         and arm_attr_merge_7.stdout.
5494         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5495         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5496         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5497         arm_attr_merge_7b.o): New rules.
5498         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5499         arm_attr_merge_7
5500         * testsuite/Makefile.in: Regenerate.
5501         * testsuite/arm_attr_merge.sh: New file.
5502         * testsuite/arm_attr_merge_[67][ab].s: Same.
5503
5504 2010-05-05  Nick Clifton  <nickc@redhat.com>
5505
5506         * po/es.po: Updated Spanish translation.
5507
5508 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5509
5510         * Makefile.am (install-exec-local): Properly install gold as
5511         default cross linker.
5512         * Makefile.in: Regenerated.
5513
5514 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5515             Nick Clifton  <nickc@redhat.com>
5516
5517         * configure.ac (install_as_default): Define and set to false
5518         unless --enable-gold or --enable-gold=both/gold has been
5519         specified.
5520         * configure: Regenerate.
5521
5522         * Makefile.am (install-exec-local): Install the executable as
5523         'ld.gold'.  If install_as_default is true then also install it as
5524         'ld'.
5525         * Makefile.in: Regenerated.
5526
5527 2010-04-24  Ian Lance Taylor  <iant@google.com>
5528
5529         * layout.cc (Layout::layout_reloc): In relocatable link don't
5530         combine reloc sections for grouped sections.
5531
5532 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5533
5534         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5535         sections that are not ordinary to icf.
5536         * icf.cc (get_section_contents): Handle relocation pointing to section
5537         with no object or shndx information.
5538         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5539         * testsuite/Makefile.in: Regenerate.
5540         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5541         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5542
5543 2010-04-22  Ian Lance Taylor  <iant@google.com>
5544
5545         * expression.cc (Expression::Expression_eval_info): Add
5546         result_alignment_pointer field.
5547         (Expression::eval_with_dot): Add result_alignment_pointer
5548         parameter.  Change all callers.
5549         (Expression::eval_maybe_dot): Likewise.
5550         (class Binary_expression): Add alignment_pointer parameter to
5551         left_value and right_value.  Change all callers.
5552         (BINARY_EXPRESSION): Set result alignment.
5553         (class Trinary_expression): Add alignment_pointer parameter to
5554         arg2_value and arg3_value.  Change all callers.
5555         (Trinary_cond::value): Set result alignment.
5556         (Max_expression::value, Min_expression::value): Likewise.
5557         (Align_expression::value): Likewise.
5558         * script-sections.cc (class Sections_element): Add dot_alignment
5559         parameter to set_section_addresses virtual function.  Update
5560         instantiations.
5561         (class Output_section_element): Likewise.
5562         (Script_sections::create_segments): Add dot_alignment parameter.
5563         Change all callers.
5564         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5565         (Script_sections::set_phdrs_clause_addresses): Likewise.
5566         * script-sections.h: Update declarations.
5567         * script.h: Update declarations.
5568         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5569         min_p_align.
5570         * testsuite/script_test_3.t: Set large alignment.
5571         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5572         segment has expected alignment.
5573
5574 2010-04-22  Nick Clifton  <nickc@redhat.com>
5575
5576         * po/gold.pot: Updated by the Translation project.
5577         * po/vi.po: Updated Vietnamese translation.
5578
5579 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5580
5581         * testsuite/Makefile.am (check_PROGRAMS): Add
5582         icf_virtual_function_folding_test.
5583         * testsuite/Makefile.in: Regenerated.
5584
5585 2010-04-15  Andrew Haley  <aph@redhat.com>
5586
5587         * options.h (merge_exidx_entries): New option.
5588         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5589         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5590         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5591         (Target_arm::merge_exidx_entries): New function.
5592         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5593         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5594         to Arm_exidx_fixup constructor.
5595         Add new arg, merge_exidx_entries.
5596         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5597         Arm_output_section::fix_exidx_coverage.
5598
5599 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5600
5601         * icf.cc (get_section_contents): Check for preemptible functions.
5602         Ignore addend when appropriate.
5603         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5604         section folded.
5605         (add_from_relobj): Check for section folded.
5606         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5607         * symtab.h (should_add_dynsym_entry): Add new parameter.
5608         * target-reloc.h (scan_relocs): Check for section folded.
5609         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5610         Check reloc types for function pointers in shared objects.
5611         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5612         case.
5613         (icf_preemptible_functions_test): New test case.
5614         (icf_string_merge_test): New test case.
5615         * testsuite.Makefile.in: Regenerate.
5616         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5617         bar_glob.  Refactor code.
5618         * testsuite/icf_preemptible_functions_test.cc: New file.
5619         * testsuite/icf_preemptible_functions_test.sh: New file.
5620         * testsuite/icf_string_merge_test.cc: New file.
5621         * testsuite/icf_string_merge_test.sh: New file.
5622         * testsuite/icf_virtual_function_folding_test.cc: New file.
5623         * testsuite/icf_virtual_function_folding_test.sh: New file.
5624
5625 2010-04-14  Doug Kwan  <dougkwan@google.com>
5626
5627         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5628         for local symbol recounting if we remove a section due to ICF.
5629         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5630         there are no regular objects in input.
5631
5632 2010-04-13  Doug Kwan  <dougkwan@google.com>
5633
5634         * arm.cc (Arm_input_section::set_final_data_size): Compute
5635         accurate final data size instead of using current data size.
5636
5637 2010-04-09  Doug Kwan  <dougkwan@google.com>
5638
5639         * layout.cc (Layout::choose_output_section): Handle script section
5640         types.
5641         (Layout::make_output_section_for_script): Add section type parameter.
5642         Handle script section types.
5643         * layout.h (Layout::make_output_section_for_script): Add section
5644         type parameter.
5645         * output.cc (Output_section::Output_section): Initialize data member
5646         is_noload_.
5647         (Output_section::do_reset_address_and_file_offset): Do not set address
5648         to 0 if section is a NOLOAD section.
5649         * output.h (Output_section::is_noload): New method.
5650         (Output_section::set_is_noload): Ditto.
5651         (Output_section::is_noload_): New data member.
5652         * script-c.h (Script_section_type): New enum type.
5653         (struct Parser_output_section_header): Add new file section_type.
5654         * script-sections.cc (Sections_element::output_section_name): Add
5655         parameter for returning script section type.
5656         (Output_section_definition::output_section_name): Ditto.
5657         (Output_section_definition::section_type)P; New method.
5658         (Output_section_definiton::script_section_type_name): Ditto.
5659         (Output_section_definition::script_section_type_): New data member.
5660         (Output_section_definition::Output_section_definition): Initialize
5661         data member Output_section_definition::script_section_type_.
5662         (Output_section_definition::create_sections): Pass script section type
5663         to Layout::make_output_section_for_script.
5664         (Output_section_definition::output_section_name): Return script
5665         section type to caller.
5666         (Output_section_definition::set_section_address): Do not advance
5667         dot value and load address if section type is NOLOAD.  Set address
5668         of NOLOAD sections regardless of section flags.
5669         (Output_section_definition::print): Print section type if it is
5670         not SCRIPT_SECTION_TYPE_NONE.
5671         (Output_section_definition::section_type): New method.
5672         (Output_section_definition::script_section_type_name): Ditto.
5673         (Script_sections::output_section_name): Add new parameter
5674         PSECTION_TYPE for returning script section type.  Pass it to
5675         section elements.  Handle discard sections.
5676         (Sort_output_sections::operator()): Handle NOLOAD sections.
5677         * script-sections.h (Script_sections::Section_type): New enum type.
5678         (Script_sections::output_section_name): Add a new parameter for
5679         returning script section type.
5680         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5681         INFO and NOLOAD.
5682         * yyscript.y (union): Add new field SECTION_TYPE.
5683         (COPY, DSECT, INFO, NOLOAD): New tokens.
5684         (opt_address_and_section_type): Change type to output_section_header.
5685         (section_type): New non-terminal
5686         (section_header): Handle section type.
5687         (opt_address_and_section_type): Return section type value.
5688
5689 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5690
5691         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5692         * testsuite/plugin_common_test_2.c (foo): Likewise.
5693
5694 2010-04-08  Doug Kwan  <dougkwan@google.com>
5695
5696         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5697         Output_merge_data.
5698         * output.cc (Output_section::add_merge_input_section): Simplify
5699         code and return status of Output_merge_base::add_input_section.
5700         Update merge section map only if Output_merge_base::add_input_section
5701         returns true.
5702
5703 2010-04-07  Doug Kwan  <dougkwan@google.com>
5704
5705         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5706         if section is marked as containing instructions but has no mapping
5707         symbols.
5708         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5709         correct section index.
5710         (Arm_relobj::find_linked_text_section): Ditto.
5711
5712 2010-04-07  Cary Coutant  <ccoutant@google.com>
5713
5714         * archive.cc (include_member): Destroy Read_symbols_data object before
5715         releasing file.
5716         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5717         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5718         (Read_symbols_data::~Read_symbols_data) New destructor.
5719         (Section_relocs::Section_relocs) New constructor.
5720         (Section_relocs::~Section_relocs) New destructor.
5721         (Read_relocs_data::Read_relocs_data) New constructor.
5722         (Read_relocs_data::~Read_relocs_data) New destructor.
5723         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5724         pointers to NULL after deleting.
5725
5726 2010-04-07  Doug Kwan  <dougkwan@google.com>
5727
5728         * arm.cc: Replace "endianity" with "endianness" in comments.
5729         (Arm_exidx_cantunwind): Ditto.
5730         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5731         (Arm_relobj::merge_flags_and_attributes): New method.
5732         (Arm_relobj::merge_flags_and_attributes_): New data member.
5733         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5734         (Arm_relobj::scan_sections_for_stubs): Ditto.
5735         (Arm_relobj::do_read_symbols): Check to see if we really want to
5736         merge processor-specific flags and attributes.  Exit early if
5737         an object is empty except for section names and the undefined symbol.
5738         (Target_arm::do_finalize_sections): Move check for ELF format to
5739         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5740         attributes from a regular object only when we have determined that
5741         it is aapropriate.  Do not create an .ARM.attributes section in
5742         output if there is no regular input object.
5743         (Target_arm::merge_processor_specific_flags): Check
5744         --warn-mismatch before printing any error.
5745         (Target_arm::merge_object_attributes): Ditto.
5746         * gold.cc (queue_middle_tasks): Handle the case in which there is
5747         no regular object in input.
5748         * options.cc (General_options::parse_EB): New method.
5749         (General_options::parse_EL): Same.
5750         (General_options::General_options): Initialize endianness_.
5751         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5752         New options.
5753         (General_options::Endianness): New enum.
5754         (General_options::endianness): New method.
5755         (General_options::endianness_): New data member.
5756         * parameters.cc (Parameters::set_options): Check target endianness.
5757         (Parameters::set_target_once): Ditto.
5758         (Parameters::check_target_endianness): New method.
5759         (parameters_force_valid_target): If either -EL or -EB is specified,
5760         use it to define endianness of default target.
5761         * parameters.h (Parameters::check_target_endianness): New method
5762         declaration.
5763         * target.h (class Target): Change "endianity" to "endianness"
5764         in comments.
5765
5766 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5767
5768         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5769         * configure: Regenerate.
5770         * Makefile.in: Regenerate.
5771         * testsuite/Makefile.in: Regenerate.
5772
5773 2010-04-06  Cary Coutant  <ccoutant@google.com>
5774
5775         gcc PR lto/42757
5776         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5777         prevailing definitions of common symbols.
5778         * testsuite/plugin_test_6.sh: New test case.
5779         * testsuite/plugin_common_test_1.c: New test case.
5780         * testsuite/plugin_common_test_2.c: New test case.
5781         * testsuite/Makefile.am (plugin_test_6): New test case.
5782         * testsuite/Makefile.in: Regenerate.
5783
5784 2010-04-06  Nick Clifton  <nickc@redhat.com>
5785
5786         * po/vi.po: New Vietnamese translation.
5787
5788 2010-03-30  Doug Kwan  <dougkwan@google.com>
5789
5790         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5791
5792 2010-03-25  Doug Kwan  <dougkwan@google.com>
5793
5794         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5795         to avoid a conversion warning on a 32-bit host.
5796
5797 2010-03-24  Ian Lance Taylor  <iant@google.com>
5798
5799         * testsuite/script_test_3.t: Add a TLS segment.
5800         * testsuite/Makefile.am (check_PROGRAMS): Add
5801         tls_phdrs_script_test.
5802         (tls_phdrs_script_test_SOURCES): Define.
5803         (tls_phdrs_script_test_DEPENDENCIES): Define.
5804         (tls_phdrs_script_test_LDFLAGS): Define.
5805         (tls_phdrs_script_test_LDADD): Define.
5806         * testsuite/Makefile.in: Rebuild.
5807
5808 2010-03-23  Cary Coutant  <ccoutant@google.com>
5809
5810         * fileread.cc (find_or_make_view): Fix comment.
5811
5812 2010-03-23  Ian Lance Taylor  <iant@google.com>
5813
5814         * script-sections.cc (class Orphan_section_placement): Define
5815         PLACE_TLS and PLACE_TLS_BSS.
5816         (Orphan_section_placement::Orphan_section_placement): Initialize
5817         new places.
5818         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5819         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5820         (tls_script_test_SOURCES): Define.
5821         (tls_script_test_DEPENDENCIES): Define.
5822         (tls_script_test_LDFLAGS): Define.
5823         (tls_script_test_LDADD): Define.
5824         * testsuite/Makefile.in: Rebuild.
5825
5826 2010-03-22  Doug Kwan  <dougkwan@google.com>
5827
5828         * arm.cc (Arm_relocate_functions::abs8,
5829         Arm_relocate_functions::abs16): Use correct check for overflow
5830         specified in the ARM ELF specs.
5831         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5832         target of a BLX instruction specially.
5833         (Reloc_stub::stub_type_for_reloc): Ditto.
5834         (Relocate::relocate): Use symbolic names instead of numeric relocation
5835         codes to report error.
5836         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5837         workaround.
5838         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5839         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5840         thumb2_blx_out_of_range.stdout
5841         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5842         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5843         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5844         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5845         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5846         thumb2_blx_in_range, thumb2_blx_in_range.o,
5847         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5848         thumb2_blx_out_of_range.o): New rules.
5849         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5850         thumb2_blx_in_range and thumb2_blx_out_of_range.
5851         * testsuite/Makefile.in: Regenerate.
5852         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5853         * testsuite/thumb_blx_in_range.s: New file.
5854         * testsuite/thumb_blx_out_of_range.s: New file.
5855
5856 2010-03-22  Rafael Espindola  <espindola@google.com>
5857
5858         * archive.cc (Should_include): Move to archive.h.
5859         (should_include_member): Make it a member of Archive.
5860         (Lib_group): New.
5861         (Add_lib_group_symbols): New.
5862         * archive.h: Include options.h.
5863         (Archive_member): Moved from Archive.
5864         (Should_include): Moved from archive.cc.
5865         (Lib_group): New.
5866         (Add_lib_group_symbols): New.
5867         * dynobj.cc (do_should_include_member): New.
5868         * dynobj.h (do_should_include_member): New.
5869         * gold.cc (queue_initial_tasks): Update call to queue.
5870         * main.cc (main): Print lib group stats.
5871         * object.cc (do_should_include_member): New.
5872         * object.h: Include archive.h.
5873         (Object::should_include_member): New.
5874         (Object::do_should_include_member): New.
5875         (Sized_relobj::do_should_include_member): New.
5876         * options.cc (General_options::parse_start_lib): New.
5877         (General_options::parse_end_lib): New.
5878         (Input_arguments::add_file): Handle lib groups.
5879         (Input_arguments::start_group): Check we are not in a lib.
5880         (Input_arguments::start_lib): New.
5881         (Input_arguments::end_lib): New.
5882         * options.h (General_options): Add start_lib and end_lib.
5883         (Input_argument::lib_): New.
5884         (Input_argument::lib): New.
5885         (Input_argument::is_lib): New.
5886         (Input_file_lib): New.
5887         (Input_arguments::in_lib_): New.
5888         (Input_arguments::in_lib): New.
5889         (Input_arguments::start_lib): New.
5890         (Input_arguments::end_lib_): New.
5891         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5892         in unused members as preempted.
5893         (Sized_pluginobj::do_should_include_member): New.
5894         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5895         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5896         return the blocker.
5897         (Read_symbols::do_whole_lib_group): New.
5898         (Read_symbols::do_lib_group): New.
5899         (Read_symbols::do_read_symbols): Handle lib groups.
5900         (Read_symbols::get_name): Handle lib groups.
5901         * readsyms.h (Read_symbols): Add an archive member pointer.
5902         (Read_symbols::do_whole_lib_group): New.
5903         (Read_symbols::do_lib_group): New.
5904         (Read_symbols::member_): New.
5905         * script.cc (read_input_script): Update call to queue_soon.
5906
5907 2010-03-19  Doug Kwan  <dougkwan@google.com>
5908
5909         * arm.cc (Stub_table::Stub_table): Initialize new data members
5910         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5911         (Stub_table::add_reloc_stub): Assign stub offset and update
5912         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5913         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5914         New data members.
5915         (Stub_table::update_data_size_and_addralign): Use
5916         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5917         instead of going over all reloc stubs.
5918         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5919         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5920         Stringpool_template::offset_ to size of Stringpool_char.
5921         (Stringpool_template::new_key_offset): Remove code to initialize
5922         Stringpool_template::offset_.
5923         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5924         Stringpool_template::offset_ to zero.
5925
5926 2010-03-15  Doug Kwan  <dougkwan@google.com>
5927
5928         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5929         offset_.
5930         (Stringpool_template::new_key_offset): New method.
5931         (Stringpool_template::add_string): Assign offsets when adding new
5932         strings.
5933         (Stringpool_template::set_string_offsets): Do not set string offsets
5934         when not optimizing.
5935         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5936         member size_.
5937         (Chunked_vector::clear): Clear size_.
5938         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5939         (Chunked_vector::size): Return size_.
5940         (Chunked_vector::push_back): Use size_ to find insert position.
5941         (Chunked_vector::size_): New data member.
5942         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5943         (Stringpool_template::new_key_offset): New method declaration.
5944         (Stringpool_template::offset_): New data member.
5945
5946 2010-03-15   Rafael Espindola  <espindola@google.com>
5947
5948         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5949         Add_symbols' constructor.
5950         * readsyms.h (Add_symbols): Remove the input_group member.
5951
5952 2010-03-10  Ian Lance Taylor  <iant@google.com>
5953
5954         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5955         target to ask whether a reference to a symbol requires a stack
5956         split.
5957         * target.h (Target::is_call_to_non_split): New function.
5958         (Target::do_is_call_to_non_split): Declare virtual function.
5959         * target.cc: Include "symtab.h".
5960         (Target::do_is_call_to_non_split): New function.
5961         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5962
5963 2010-03-10  Cary Coutant  <ccoutant@google.com>
5964
5965         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5966         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5967         (File_read::open[2]): Add whole_file_view_ to list of views.
5968         (File_read::make_view): Remove test of whole_file_view_.
5969         (File_read::find_or_make_view): Create whole_file_view_ if
5970         necessary.
5971         (File_read::clear_views): Replace bool parameter with enum;
5972         adjust all callers.  Don't delete views with permanent data;
5973         do delete cached views and views from archives if
5974         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5975         if clearing the corresponding view.
5976         * fileread.h (File_read::Clear_views_mode): New enum.
5977         (File_read::View::is_permanent_view): New method.
5978         (File_read::clear_views): Replace bool parameter
5979         with enum; adjust all callers.
5980         * options.h (General_options): Change keep_files_mapped option;
5981         add map_whole_files.
5982         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5983         releasing the file.
5984         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5985         the file.
5986
5987 2010-03-10  David S. Miller  <davem@davemloft.net>
5988
5989         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5990
5991 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5992
5993         * icf.cc (get_section_contents): Add '@' marker after processing the
5994         merge reloc.
5995
5996 2010-03-08  Doug Kwan  <dougkwan@google.com>
5997
5998         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5999         due to a conversion warning.
6000         (Arm_relobj::update_output_local_symbol_count): Check for local
6001         symbol with unset output index.
6002
6003 2010-03-05  Ian Lance Taylor  <iant@google.com>
6004
6005         * options.h (class General_options): Add --spare-dynamic-tags.
6006         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6007         --spare-dynamic-tags.
6008
6009 2010-03-05  Ian Lance Taylor  <iant@google.com>
6010
6011         * incremental.cc: Include "libiberty.h".
6012
6013 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6014
6015         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6016         function, is_info_ member.
6017         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6018         (Versions::Versions): Update caller.
6019         (Versions::define_base_version): Likewise.
6020         (Versions::add_def): Likewise.
6021
6022 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6023
6024         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6025         (Scan::possible_function_pointer_reloc): New function.
6026         (Scan::local_reloc_may_be_function_pointer): Change to call
6027         possible_function_pointer_reloc.
6028         (Scan::global_reloc_may_be_function_pointer): Ditto.
6029         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6030         relocations in ".data.rel.ro._ZTV" section.
6031         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6032         * testsuite/icf_safe_so_test.cc: Ditto.
6033         * testsuite/icf_safe_test.cc: Ditto.
6034         * testsuite/icf_safe_test.sh: Ditto.
6035
6036 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6037             Ian Lance Taylor  <iant@google.com>
6038
6039         * target-reloc.h (relocate_section): Check the symbol table index
6040         for -1U before setting the local symbol index.
6041         (scan_relocatable_relocs): If copying the relocation, record that
6042         the local symbol is required.
6043         * object.h (Symbol_value::is_output_symtab_index_set): New
6044         function.
6045         (Symbol_value::may_be_discarded_from_output_symtab): New
6046         function.
6047         (Symbol_value::has_output_symtab_entry): New function.
6048         (Symbol_value::needs_output_symtab_entry): Remove.
6049         (Symbol_value::output_symtab_index): Make sure the symbol index is
6050         set.
6051         (Symbol_value::set_output_symtab_index): Make sure the symbol
6052         index is not set.  Make sure the new index is valid.
6053         (Symbol_value::set_must_have_output_symtab_entry): New function.
6054         (Symbol_value::has_output_dynsym_entry): New function.
6055         (Symbol_value::set_output_dynsym_index): Make sure the new index
6056         is valid.
6057         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6058         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6059         local symbol if permitted.
6060         (Sized_relobj::do_finalize_local_symbols): Call
6061         is_output_symtab_index_set rather than needs_output_symtab_entry.
6062         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6063         rather than needs_output_symtab_entry.  Call
6064         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6065         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6066         is_output_symtab_index_set rather than needs_output_symtab_entry.
6067         * testsuite/discard_locals_relocatable_test.c: New file.
6068         * testsuite/discard_locals_test.sh: Test -r.
6069         * testsuite/Makefile.am (check_DATA): Add
6070         discard_locals_relocatable_test1.syms,
6071         discard_local_relocatable_test2.syms.
6072         (MOSTLYCLEANFILES): Likewise.  Also add
6073         discard_locals_relocatable_test1.lout and
6074         discard_locals_relocatable_test2.out.
6075         (discard_locals_relocatable_test1.syms): New target.
6076         (discard_locals_relocatable_test.o): New target.
6077         (discard_locals_relocatable_test1.out): New target.
6078         (discard_locals_relocatable_test2.syms): New target.
6079         (discard_locals_relocatable_test2.out): New target.
6080         (various): Add missing ../ld-new dependencies.
6081         * testsuite/Makefile.in: Rebuild.
6082
6083 2010-03-03  Nick Clifton  <nickc@redhat.com>
6084
6085         * po/fi.po: New Finnish translation.
6086
6087 2010-03-01  Doug Kwan  <dougkwan@google.com>
6088
6089         * layout.cc (Layout::Layout): Force section types of .init_array*,
6090         .preinit_array* and .fini_array* sections.
6091         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6092         Fix check of return value of std::string::find.().
6093         (Output_section::Input_section_sort_compare::operator()): Remove
6094         comment about .init_array.
6095         (Output_section::Input_section_sort_init_fini_compare::operator()):
6096         New method.
6097         (Output_section::sort_attached_input_sections): Handle .init_array
6098         and .fini_array specially.
6099         * output.h (Output_section::Inut_section_sort_compare): Update
6100         comment.
6101         (Output_section::Input_section_sort_init_fini_compare): New struct.
6102
6103 2010-02-26  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6106         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6107         * testsuite/debug_msg.sh: Avoid matching source line number for
6108         use of global variable undef_int.
6109
6110 2010-02-26  Doug Kwan  <dougkwan@google.com>
6111
6112         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6113         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6114         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6115         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6116         * options.cc (General_options::General_options): Initialize member
6117         fix_v4bx_.
6118         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6119         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6120         and rm_no_fix_v4bx.stdout
6121         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6122         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6123         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6124         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6125         and arm_no_fix_v4bx.
6126         * Makefile.in: Regenerate.
6127         * testsuite/arm_fix_v4bx.s: New file.
6128         * testsuite/arm_fix_v4bx.sh: Ditto.
6129
6130 2010-02-24  Doug Kwan  <dougkwan@google.com>
6131
6132         * arm.cc (Target_arm::got_section): Make the .got section the first
6133         non RELRO section in the data segment.
6134         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6135         suffixes of section names.
6136
6137 2010-02-24  Doug Kwan  <dougkwan@google.com>
6138
6139         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6140         flags and attributes merging if an input file is a binary file.
6141         * fileread.cc (Input_file::open): Record format of original file.
6142         * fileread.h (Input_file::Format): New enum type.
6143         (Input_file::Input_file): Initialize data member format_.
6144         (Input_file::format): New method definition.
6145         (Input_file::format_):: New data member.
6146
6147 2010-02-24  Doug Kwan  <dougkwan@google.com>
6148
6149         * arm.cc (Arm_output_data_got): New class.
6150         (ARM_TCB_SIZE): New constant
6151         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6152         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6153         If user uses a script with a SECTIONS clause, issue only a warning
6154         for a misplaced EXIDX input section.  Otherwise, issue an error.
6155         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6156         garbage collection.
6157         (Target_arm::got_mode_index_entry): Handle static linking.
6158         (Target_arm::Scan::local): Ditto.
6159         (Target_arm::Scan::global): Ditto.
6160         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6161         all incorrectly implemented relocations.
6162         (Target_arm::fix_exidx_coverage): Pass layout to
6163         Arm_output_section::fix_exidx_coverage.
6164         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6165         from ".ARM.exidx." and ".ARM.extab.".
6166
6167 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6168
6169         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6170         section if it does not already exist.
6171         * attributes.cc (Attributes_section_data::Attributes_section_data):
6172         Don't crash if size is zero.
6173
6174 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6175             Ian Lance Taylor  <iant@google.com>
6176
6177         * gold.cc (queue_middle_tasks): If no input files were opened,
6178         exit.
6179         * workqueue.h (Task_function::Task_function): Assert that there is
6180         a blocker.
6181
6182 2010-02-22  Doug Kwan  <dougkwan@google.com>
6183
6184         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6185         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6186         types to avoid warnings due to different uint64_t implementations
6187         on different hosts.
6188
6189 2010-02-21  Doug Kwan  <dougkwan@google.com>
6190
6191         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6192         handling of the maximum backward branch offset.
6193         (Arm_relocate_functions::thumb_branch_common): Ditto.
6194         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6195         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6196         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6197         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6198         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6199         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6200         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6201         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6202         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6203         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6204         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6205         thumb2_bl_out_of_range.o): New rules.
6206         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6207         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6208         thumb2_bl_out_of_range
6209         * testsuite/Makefile.in: Regenerate.
6210         * testsuite/arm_bl_in_range.s: New file.
6211         * testsuite/arm_bl_out_of_range.s: Ditto.
6212         * testsuite/arm_branch_in_range.sh: Ditto.
6213         * testsuite/arm_branch_range.t: Ditto.
6214         * testsuite/thumb2_branch_range.t: Ditto.
6215         * testsuite/thumb_bl_in_range.s: Ditto.
6216         * testsuite/thumb_bl_out_of_range.s: Ditto.
6217         * testsuite/thumb_branch_range.t: Ditto.
6218
6219 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6220
6221         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6222         Add reloc offset information.
6223         * icf.cc (get_section_contents): Change iterators to point to the new
6224         vectors. Add reloc offset information to the contents.
6225         * icf.h (Icf::Sections_reachable_info): New typedef.
6226         (Icf::Sections_reachable_list): New typedef.
6227         (Icf::Offset_info): New typedef.
6228         (Icf::Reloc_info): New struct typedef.
6229         (Icf::Reloc_info_list): New typedef.
6230         (Icf::symbol_reloc_list): Delete method.
6231         (Icf::addend_reloc_list): Delete method.
6232         (Icf::section_reloc_list): Delete method.
6233         (Icf::reloc_info_list): New method.
6234         (Icf::reloc_info_list_): New member.
6235
6236 2010-02-19  Doug Kwan  <dougkwan@google.com>
6237
6238         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6239         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6240         * arm.cc (Arm_relocation_functions): New forward declaration.
6241         (Target_arm::Target_arm): Initialize new data members
6242         got_mod_index_offset_ and tls_base_symbol_defined_.
6243         (Target_arm::Relocate::relocate_tls): New method.
6244         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6245          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6246         New methods.
6247         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6248         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6249         (Target_arm::got_mod_index_offset_,
6250         Target_arm::tls_base_symbol_defined_): New data members.
6251         (Target_arm::Scan::local, Target::Scan::global,
6252         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6253         relocations.
6254
6255 2010-02-18  Doug Kwan  <dougkwan@google.com>
6256
6257         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6258         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6259         text section as a parameter becuase some broken tools may not set
6260         the link in section header.
6261         (Target_arm::has_got_section): New method.
6262         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6263         without any mapping symbol as data only.  Remove warning.
6264         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6265         link in its section header, try to discover the link by inspecting the
6266         REL31 relocation at the beginning of the section.
6267         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6268         in error message.
6269         (Target_arm::Scan::global): Treat any reference to the symbol
6270         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6271
6272 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6273
6274         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6275         (Scan::global_reloc_may_be_function_pointer): New function.
6276         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6277         (Scan::global_reloc_may_be_function_pointer): New function.
6278         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6279         (Scan::global_reloc_may_be_function_pointer): New function.
6280         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6281         (Scan::global_reloc_may_be_function_pointer): New function.
6282         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6283         (Scan::global_reloc_may_be_function_pointer): New function.
6284         (Scan::possible_function_pointer_reloc): New function.
6285         (Target_x86_64::can_check_for_function_pointers): New function.
6286         * gc.h (gc_process_relocs): Scan relocation types to determine if
6287         function pointers were taken for targets that support it.
6288         * icf.cc (Icf::find_identical_sections): Include functions for
6289         folding in safe ICF whose pointer is not taken.
6290         * icf.h (Secn_fptr_taken_set): New typedef.
6291         (fptr_section_id_): New member.
6292         (section_has_function_pointers): New function.
6293         (set_section_has_function_pointers): New function.
6294         (check_section_for_function_pointers): New function.
6295         * options.h: Fix comment for safe ICF option.
6296         * target.h (can_check_for_function_pointers): New function.
6297         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6298         Modify icf_safe_test for X86-64.
6299         * testsuite/Makefile.in: Regenerate.
6300         * testsuite/icf_safe_so_test.cc: New file.
6301         * testsuite/icf_safe_so_test.sh: New file.
6302         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6303         (main): Change to take pointer to function kept_func_3.
6304         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6305         folding is done correctly for X86-64.
6306
6307 2010-02-12  David S. Miller  <davem@davemloft.net>
6308
6309         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6310         is_symbolless parameter.
6311         (Output_reloc<SHT_REL>::is_symbolless): New.
6312         (Output_reloc<SHT_REL>::is_symbolless_): New.
6313         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6314         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6315         (Output_reloc<SHT_RELA>::is_symbolless): New.
6316         (Output_data_reloc::add_global): Handle is_symbolless.
6317         (Output_data_reloc::add_global_relative): Likewise.
6318         (Output_data_reloc::add_local): Likewise.
6319         (Output_data_reloc::add_local_relative): Likewise.
6320         (Output_data_reloc::add_symbolless_global_addend): New.
6321         (Output_data_reloc::add_symbolless_local_addend): New.
6322         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6323         is_symbolless.
6324         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6325         instead of ->is_relative_
6326         (Output_reloc::write): Likewise.
6327         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6328         (Output_reloc::write_rel): Simplify.
6329
6330         * sparc.cc (Target_sparc::Scan::local): Use
6331         ->add_symbolless_local_addend as needed.
6332         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6333         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6334         based upon relocation offset.
6335
6336 2010-02-11  Doug Kwan  <dougkwan@google.com>
6337
6338         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6339         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6340         beginning of function.
6341         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6342         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6343         parameter is_32bit in calls to should_apply_static_reloc.
6344         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6345         (check_DATA): Add arm_abs_global.stdout.
6346         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6347         arm_abs_global.stdout): New rules.
6348         (MOSTLLYCLEANFILES): Add arm_abs_global
6349         * Makefile.in: Regenerate.
6350         * testsuite/arm_abs_global.s: New file.
6351         * testsuite/arm_abs_global.sh: Ditto.
6352         * testsuite/arm_abs_lib.s: Ditto.
6353
6354 2010-02-11  Ian Lance Taylor  <iant@google.com>
6355
6356         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6357         Read_relocs task.
6358         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6359         Allocate_commons_task first.
6360         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6361         task, rather than symtab_lock_.
6362         (Gc_process_relocs::~Gc_process_relocs): New function.
6363         (Gc_process_relocs::is_runnable): Check this_blocker_.
6364         (Gc_process_relocs::locks): Use next_blocker_ rather than
6365         blocker_.
6366         (Scan_relocs::~Scan_relocs): New function.
6367         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6368         symtab_lock_.
6369         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6370         next_blocker_.
6371         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6372         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6373         constructor accordingly.
6374         (class Gc_process_relocs): Likewise.
6375         (class Scan_relocs): Likewise.
6376         * common.h (class Allocate_commons_task): Remove symtab_lock_
6377         field, and corresponding constructor parameter.
6378         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6379         symtab_lock_.
6380         (Allocate_commons_task::locks): Likewise.
6381
6382 2010-02-11  Ian Lance Taylor  <iant@google.com>
6383
6384         * gold-threads.h (class Once): Define.
6385         (class Initialize_lock): Rewrite as child of Once.
6386         * gold-threads.cc (class Once_initialize): Define.
6387         (once_pointer_control): New static variable.
6388         (once_pointer, once_arg): New static variables.
6389         (c_run_once): New static function.
6390         (Once::Once, Once::run_once, Once::internal_run): New functions.
6391         (class Initialize_lock_once): Remove.
6392         (initialize_lock_control): Remove.
6393         (initialize_lock_pointer): Remove.
6394         (initialize_lock_once): Remove.
6395         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6396         (Initialize_lock::initialize): Rewrite.
6397         (Initialize_lock::do_run_once): New function.
6398         * archive.cc (Archive::interpret_header): Only clear name if it is
6399         not already empty.
6400         * fileread.cc: Include "gold-threads.h"
6401         (file_counts_lock): New static variable.
6402         (file_counts_initialize_lock): Likewise.
6403         (File_read::release): Only increment counts when using --stats.
6404         Use a lock around the increment.
6405         * parameters.cc (class Set_parameters_target_once): Define.
6406         (set_parameters_target_once): New static variable.
6407         (Parameters::Parameters): Move here from parameters.h.
6408         (Parameters::set_target): Rewrite.
6409         (Parameters::set_target_once): New function.
6410         (Parameters::clear_target): Move here and rewrite.
6411         * parameters.h (class Parameters): Update declarations.  Add
6412         set_parameters_target_once_ field.
6413         (Parameters::Parameters): Move to parameters.cc.
6414         (Parameters::clear_target): Likewise.
6415         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6416         task.
6417         (Start_group::~Start_group): New function.
6418         (Start_group::is_runnable): New function.
6419         (Start_group::locks, Start_group::run): New functions.
6420         (Finish_group::run): Change saw_undefined to size_t.
6421         * readsyms.h (class Start_group): Define.
6422         (class Finish_group): Change saw_undefined_ field to size_t.
6423         (Finish_group::Finish_group): Remove saw_undefined and
6424         this_blocker parameters.  Change all callers.
6425         (Finish_group::set_saw_undefined): New function.
6426         (Finish_group::set_blocker): New function.
6427         * symtab.h (class Symbol_table): Change saw_undefined to return
6428         size_t.  Change saw_undefined_ field to size_t.
6429         * target-select.cc (Set_target_once::do_run_once): New function.
6430         (Target_selector::Target_selector): Initialize set_target_once_
6431         field.  Don't initialize lock_ and initialize_lock_ fields.
6432         (Target_selector::instantiate_target): Rewrite.
6433         (Target_selector::set_target): New function.
6434         * target-select.h (class Set_target_once): Define.
6435         (class Target_selector): Update declarations.  Make
6436         Set_target_once a friend.  Remove lock_ and initialize_lock_
6437         fields.  Add set_target_once_ field.
6438
6439 2010-02-10  Ian Lance Taylor  <iant@google.com>
6440
6441         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6442         queueing any tasks.
6443         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6444         (queue_middle_tasks): Add all blockers before queueing any tasks.
6445         (queue_final_tasks): Likewise.
6446         * token.h (Task_token::add_blockers): New function.
6447         * object.h (Input_objects::number_of_relobjs): New function.
6448
6449 2010-02-10  Ian Lance Taylor  <iant@google.com>
6450
6451         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6452         shared, not if not position independent.
6453         * x86_64.cc (Relocate::relocate_tls): Likewise.
6454         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6455         (tls_pie_pic_test): New target.
6456         * testsuite/Makefile.in: Rebuild.
6457
6458         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6459         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6460         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6461         * testsuite/Makefile.in: Rebuild.
6462
6463 2010-02-09  David S. Miller  <davem@davemloft.net>
6464
6465         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6466         R_SPARC_RELATIVE using ->add_local_relative().
6467         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6468
6469         * output.h (Output_data_dynamic::add_section_size): New method
6470         that takes two Output_data objects.
6471         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6472         entry param.  Handle it in initializers.
6473         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6474         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6475         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6476         arg.
6477         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6478         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6479         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6480         for dynrel_includes_plt.
6481         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6482         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6483         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6484         before .rela.plt
6485         (Target_sparc::do_finalize_sections): Update to pass true for
6486         dynrel_includes_plt.
6487         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6488         output before .rela.plt
6489         (Target_powerpc::do_finalize_sections): Update to pass true for
6490         dynrel_includes_plt when 32-bit.
6491
6492 2010-02-08  Doug Kwan  <dougkwan@google.com>
6493
6494         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6495         method.
6496         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6497         Arm_relobj::scan_section_for_cortex_a8_stubs,
6498         Arm_relobj::do_relocation_section): Instead of calling
6499         Output_section::output_address, use faster
6500         Arm_relobj::simple_input_section_output_address.
6501
6502 2010-02-08  David S. Miller  <davem@davemloft.net>
6503
6504         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6505         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6506         relocation helper function.
6507
6508         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6509         just like R_SPARC_GOT{10,13,22}.
6510         (Target_sparc::Scan::local): Likewise.
6511         (Target_sparc::Relocate:relocate): Likewise.
6512
6513 2010-02-06  Ian Lance Taylor  <iant@google.com>
6514
6515         * configure.ac: Rewrite targetobjs duplicate removal code to use
6516         only shell constructs.
6517         * configure: Rebuild.
6518
6519 2010-02-05  Doug Kwan  <dougkwan@google.com>
6520
6521         PR 11247
6522         * arm.cc (Arm_relobj::section_is_scannable): New method.
6523         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6524         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6525
6526 2010-02-04  Doug Kwan  <dougkwan@google.com>
6527
6528         PR 11247
6529         * arm-reloc-property.cc (cstdio): Include.
6530         * configure.ac (targetobjs): Remove duplicates.
6531         * configure: Regenerate.
6532         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6533         big and little endian version for a given address size.
6534
6535 2010-02-03  Doug Kwan  <dougkwan@google.com>
6536
6537         * arm-reloc-property.cc
6538         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6539         definition.
6540         * arm-reloc-property.h
6541         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6542         New method definition.
6543         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6544         declaration.
6545         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6546         overflow to N.
6547         (GOT_PREL): Change implemented to Y.
6548         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6549         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6550         (Arm_relocate_functions::movw_abs_nc): Remove method.
6551         (Arm_relocate_functions::movt_abs): Ditto.
6552         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6553         (Arm_relocate_functions::thm_movt_abs): Ditto.
6554         (Arm_relocate_functions::movw_rel_nc): Ditto.
6555         (Arm_relocate_functions::movw_rel): Ditto.
6556         (Arm_relocate_functions::movt_rel): Ditto.
6557         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6558         (Arm_relocate_functions:thm_movw_rel): Ditto.
6559         (Arm_relocate_functions:thm_movt_rel): Ditto.
6560         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6561         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6562         New method definitions.
6563         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6564         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6565         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6566         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6567         (Target_arm::Relocate::relocate): Check for non-static or
6568         unimplemented relocation code and exit early.  Change calls to
6569         Target_arm::reloc_uses_thumb_bit and
6570         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6571         instead.  Refactor code to handle similar relocations to increase
6572         code sharing.  Remove check for unsupported relocation code in switch
6573         statement.
6574         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6575         relocation property table to find out size.  Change error message to
6576         print out the name of a relocation code instead of the numeric value.
6577         (Target_arm::scan_reloc_for_stub): Use relocation property table
6578         instead of calling Target_arm::reloc_uses_thumb_bit().
6579
6580 2010-02-02  Doug Kwan  <dougkwan@google.com>
6581
6582         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6583         types of relaxed input section.
6584
6585 2010-02-02  Doug Kwan  <dougkwan@google.com>
6586
6587         * Makefile.am (HFILES): Add arm-reloc-property.h.
6588         (DEFFILES): New.
6589         (TARGETSOURCES): Add arm-reloc-property.cc
6590         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6591         (libgold_a_SOURCES): $(DEFFILES)
6592         * Makefile.in: Regenerate.
6593         * arm-reloc-property.cc: New file.
6594         * arm-reloc-property.h: New file.
6595         * arm-reloc.def: New file.
6596         * arm.cc: Update comments.
6597         (arm-reloc-property.h): New included header.
6598         (arm_reloc_property_table): New global variable.
6599         (Target_arm::do_select_as_default_target): New method definition.
6600         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6601         arm-reloc-property to targ_extra_obj.
6602         * parameters.cc (set_parameters_target): Call
6603         Target::select_as_default_target().
6604         * target.h (Target::select_as_default_target): New method definition.
6605         (Target::do_select_as_default_target): Same.
6606
6607 2010-02-01  Doug Kwan  <dougkwan@google.com>
6608
6609         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6610         first_output_text_section_.
6611         (Arm_exidx_fixup::first_output_text_section): New method definition.
6612         (Arm_exidx_fixup::first_output_text_section_): New data member.
6613         (Arm_exidx_fixup::process_exidx_section): Record the first text
6614         output section seen.
6615         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6616         and entsize in output section header.
6617
6618 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6619
6620         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6621         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6622         (Arm_relocate_functions::thm_alu11): New Method.
6623         (Arm_relocate_functions::thm_pc8): New Method.
6624         (Arm_relocate_functions::thm_pc12): New Method.
6625         (Target_arm::Scan::local): Handle the relocations.
6626         (Target_arm::Scan::global): Likewise.
6627         (Target_arm::Relocate::relocate): Likewise.
6628         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6629
6630 2010-01-29  Doug Kwan  <dougkwan@google.com>
6631
6632         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6633         of relocation types as ld.
6634
6635 2010-01-29  Doug Kwan  <dougkwan@google.com>
6636
6637         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6638         to public.
6639         (Arm_relocate_functions::thumb_branch_common): Ditto.
6640         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6641         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6642         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6643         Arm_relocate_functions::jump24): Remove.
6644         (Target_arm::Relocate::relocate): Adjust code to call
6645         Arm_relocation_functions::arm_branch_common and
6646         Arm_relocation_functions::thumb_branch_common instead of their removed
6647         wrappers.  Merge switch-cases together to reduce source code size.
6648
6649 2010-01-29  Doug Kwan  <dougkwan@google.com>
6650
6651         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6652         output_local_symbol_count_needs_update_.
6653         (Arm_relobj::output_local_symbol_count_needs_update,
6654          Arm_relobj::set_output_local_symbol_count_needs_update,
6655          Arm_relobj::update_output_local_symbol_count): New methods.
6656         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6657         member.
6658         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6659         of pointed function as in a R_ARM_PREL31 relocation.
6660         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6661         for output local symbol count updating.
6662         (Target_arm::do_relax): Update output local symbol counts in objects
6663         if necessary.
6664         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6665
6666 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6667
6668         * arm.cc: Added support for the ARM relocations:
6669         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6670         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6671         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6672         movw_prel_nc).
6673         (Arm_relocate_functions::movw_rel): New method.
6674         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6675         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6676         thm_movw_prel_nc).
6677         (Arm_relocate_functions::thm_movw_rel): New method.
6678         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6679         thm_movt_prel).
6680         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6681         relocations.
6682         (Target_arm::Scan::global): Likewise.
6683         (Target_arm::Relocate::relocate): Likewise.
6684         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6685         Likewise.
6686
6687 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6688
6689         * arm.cc: Added support for ARM group relocations.
6690         (Target_arm::reloc_needs_sym_origin): New method.
6691         (Arm_relocate_functions::calc_grp_kn): New method.
6692         (Arm_relocate_functions::calc_grp_residual): New method.
6693         (Arm_relocate_functions::calc_grp_gn): New method.
6694         (Arm_relocate_functions::arm_grp_alu): New Method.
6695         (Arm_relocate_functions::arm_grp_ldr): New Method.
6696         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6697         (Arm_relocate_functions::arm_grp_ldc): New Method.
6698         (Target_arm::Scan::local): Handle the ARM group relocations.
6699         (Target_arm::Scan::global): Likewise.
6700         (Target_arm::Relocate::relocate): Likewise.
6701         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6702         Likewise.
6703
6704 2010-01-26  Doug Kwan  <dougkwan@google.com>
6705
6706         * arm.cc (set): Include.
6707         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6708         pointer type.
6709         (Arm_output_section::Text_section_list): New type.
6710         (Arm_output_section::append_text_sections_to_list): New method.
6711         (Arm_output_section::fix_exidx_coverage): Ditto.
6712         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6713         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6714         Relobj::set_section_offset() instead of
6715         Sized_relobj::invalidate_section_offset().
6716         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6717         parameter for section headers. Ignore relocation sections for
6718         unallocated sections and EXIDX sections.
6719         (Target_arm::fix_exidx_coverage): New method.
6720         (Target_arm::output_section_address_less_than): New type.
6721         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6722         linked text section instead of the EXIDX section.
6723         (Arm_output_section::create_stub_group): Add an assertion to check
6724         that this is not an EXIDX output section.
6725         (Arm_output_section::append_text_sections_to_list): New method.
6726         (Arm_output_section::fix_exidx_coverage): Ditto.
6727         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6728         Arm_relobj::section_needs_reloc_stub_scanning.
6729         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6730         first pass.
6731         (Target_arm::fix_exidx_coverage): New method.
6732         * object.h (Relobj::set_output_section): New method.
6733         (Sized_relobj::invalidate_section_offset): Remove method.
6734         (Sized_relobj::do_invalidate_section_offset): Remove method.
6735         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6736
6737 2010-01-25  Doug Kwan  <dougkwan@google.com>
6738
6739         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6740         Fix warning due to signed and unsigned comparison on a 32-bit host.
6741
6742 2010-01-22  Doug Kwan  <dougkwan@google.com>
6743
6744         * arm.cc (Target_arm::do_relax): Record an output section for section
6745         offset adjustment it contains any stub table that has changed.
6746         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6747         offsets in an output section if necessary.
6748         * output.cc (Output_section::Output_section): Initialize
6749         section_offsets_need_adjustments_.
6750         (Output_section::add_input_section_for_script): Renamed to
6751         Output_section::add_simple_input_section.
6752         (Output_section::save_states): Add a comment.
6753         (Output_section::discard_states): New method defintion.
6754         (Output_section::adjust_section_offsets): Same.
6755         * output.h (Output_section::add_input_section_for_script): Renamed to
6756         Output_section::add_simple_input_section.
6757         (Output_section::discard_states): New method declaration.
6758         (Output_section::adjust_section_offsets): Same.
6759         (Output_section::section_offsets_need_adjustment,
6760         Output_section::set_section_offsets_need_adjustment): New method
6761         definitions.
6762         (Output_section::section_offsets_need_adjustment_): New data member.
6763         * script-sections.cc
6764         (Output_section_element_input::set_section_address): Adjust code for
6765         renaming of Output_section::add_input_section_for_script.
6766         (Orphan_output_section::set_section_address): Same.
6767
6768 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6769
6770         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6771         Fix_v4bx enum values .
6772         * gold/options.h (General_options): New option definitions.
6773         (General_options::fix_v4bx): New method.
6774         (General_options::Fix_v4bx): New enum.
6775         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6776         (General_options::parse_fix_v4bx_interworking): New method.
6777
6778 2010-01-22  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm.cc (Arm_exidx_fixup): New class.
6781
6782 2010-01-21  Doug Kwan  <dougkwan@google.com>
6783
6784         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6785         classes.
6786         (Arm_exidx_section_offset_map): New type.
6787
6788 2010-01-21  Doug Kwan  <dougkwan@google.com>
6789
6790         * arm.cc (Arm_exidx_input_section): New class.
6791         (Arm_relobj::exidx_input_section_by_link,
6792         Arm_relobj::exidx_input_section_by_shndx,
6793         Arm_relobj::make_exidx_input_section): New methods.
6794         (read_arm_attributes_section): Remove.
6795         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6796         information about them.
6797         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6798         to here.
6799
6800 2010-01-20  Doug Kwan  <dougkwan@google.com>
6801
6802         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6803         Input_section_specifier to Section_id.
6804         (Target_arm::new_arm_input_section: Adjust code for change of key
6805         type.
6806         (Target_arm::find_arm_input_section): Ditto.
6807         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6808         (Section_id): Remove.
6809         (Garbage_collection::Section_id_hash): Remove.
6810         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6811         (Section_id): Remove.
6812         (Icf::Section_id_hash): Remove.
6813         * object.h (Section_id, Const_section_id, Section_id_hash,
6814         Const_section_id_hash): New type definitions.
6815         * output.cc (Output_section::add_relaxed_input_section): Change to
6816         use Const_section_id instead of Input_section_specifier as key type.
6817         (Output_section::add_merge_input_section): Ditto.
6818         (Output_section::build_relaxation_map): Change to use Section_id
6819         instead of Input_section_specifier as key type.
6820         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6821         Ditto.
6822         (Output_section::convert_input_sections_to_relaxed_sections): Change
6823         to use Const_section_id instead of Input_section_specifier as key type.
6824         (Output_section::find_merge_section): Ditto.
6825         (Output_section::find_relaxed_input_section): Ditto.
6826         * output.h (Input_section_specifier): Remove class.
6827         (Output_section::Output_section_data_by_input_section_map): Change
6828         key type to Const_section_id.
6829         (Output_section::Output_relaxed_input_section_by_input_section_map):
6830         Ditto.
6831         (Output_section::Relaxation_map): Change key type to Section_id.
6832
6833 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6834
6835         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6836         (class Arm_v4bx_stub): New class.
6837         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6838         (Stub_factory::make_arm_v4bx_stub): New method.
6839         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6840         (Stub_table::empty): Handle v4bx stubs.
6841         (Stub_table::add_arm_v4bx_stub): New method.
6842         (Stub_table::find_arm_v4bx_stub): New method.
6843         (Arm_relocate_functions::v4bx): New method.
6844         (Target_arm::fix_v4bx): New method.
6845         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6846         (Stub_table::relocate_stubs): Likewise.
6847         (Stub_table::do_write): Likewise.
6848         (Stub_table::update_data_size_and_addralign): Likewise.
6849         (Stub_table::finalize_stubs):  Likewise.
6850         (Target_arm::Scan::local): Likewise.
6851         (Target_arm::Scan::global): Likewise.
6852         (Target_arm::do_finalize_sections): Likewise.
6853         (Target_arm::Relocate::relocate): Likewise.
6854         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6855         Likewise.
6856         (Target_arm::scan_reloc_for_stub): Likewise.
6857         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6858
6859 2010-01-19  Ian Lance Taylor  <iant@google.com>
6860
6861         * output.cc (Output_section_headers::do_sized_write): Write large
6862         segment count to sh_info field.
6863         (Output_file_header::do_sized_write): For large segment count,
6864         write PN_XNUM to e_phnum field.
6865
6866 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6867
6868         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6869         (Arm_relocate_functions::thm_jump8): New function.
6870         (Arm_relocate_functions::thm_jump11): New function.
6871         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6872         R_ARM_THM_JUMP11.
6873         (Target_arm::Scan::global): Likewise.
6874         (Target_arm::Relocate::relocate): Likewise.
6875         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6876         Likewise.
6877
6878 2010-01-14  Doug Kwan  <dougkwan@google.com>
6879
6880         * arm.cc (map, utility): Include headers.
6881         (Target_arm::apply_cortex_a8_workaround): New method.
6882         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6883         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6884         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6885         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6886         the --[no-]fix-cortex-a8 command line options.
6887         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6888         (Target_arm::relocate_stub): Use addend in instruction template.
6889         * options.h (DEFINE_bool): Set the user-set flag.
6890         (General_options): Add --[no-]-fix-cortex options.
6891         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6892         : Update fast look-up map after conversion.
6893
6894 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6895
6896         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6897         in the first pass of do_layout.
6898
6899 2010-01-13  Doug Kwan  <dougkwan@google.com>
6900
6901         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6902         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6903         apparent compiler problem of not folding static constant integral
6904         data members of elfcpp::Elf_sizes<32>.
6905
6906 2010-01-13  Doug Kwan  <dougkwan@google.com>
6907
6908         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6909         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6910         Arm_relobj::scan_section_for_cortex_a8_erratum,
6911         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6912         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6913         sections to scan for relocation stubs into a new method
6914         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6915         relocation and Cortex-A8 stub scanning.
6916         (Target_arm::do_relax): Force stubs to be after stubbed sections
6917         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6918         the beginning of a new relaxation pass.  Update a comment.
6919         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6920
6921 2010-01-12  Ian Lance Taylor  <iant@google.com>
6922
6923         * target-reloc.h (visibility_error): New inline function.
6924         (relocate_section): Call visibility_error.
6925         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6926         (MOSTLYCLEANFILES): Likewise.
6927         (protected_4_pic.o, protected_3.err): New targets.
6928         * testsuite/protected_4.cc: New file.
6929
6930 2010-01-12  Doug Kwan  <dougkwan@google.com>
6931
6932         * arm.cc (Cortex_a8_reloc): New class.
6933         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6934         and cortex_a8_relocs_info_.
6935         (Target_arm::fix_cortex_a8): New method definition.
6936         (Target_arm::Cortex_a8_relocs_info): New type.
6937         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6938         New data member declarations.
6939         (Target_arm::scan_reloc_for_stub): Record information about
6940         relocations for THUMB branches that might be exempted from the
6941         Cortex-A8 workaround.
6942         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6943         at the beginning of a relaxation pass.
6944
6945 2010-01-12  Doug Kwan  <dougkwan@google.com>
6946
6947         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6948         (Arm_relobj::Mapping_symbol_position,
6949          Arm_reloj::Mapping_symbol_position_less,
6950          Arm_relobj::Mapping_symbols_info): New types.
6951         (Target_arm::is_mapping_symbol_name): New method definition.
6952         (Arm_relobj::do_count_local_symbols): Save information about mapping
6953         symbols.
6954
6955 2010-01-11  Doug Kwan  <dougkwan@google.com>
6956
6957         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6958         Arm_relocate_functions::thumb32_branch_upper,
6959         Arm_relocate_functions::thumb32_branch_lower,
6960         Arm_relocate_functions::thumb32_cond_branch_offset,
6961         Arm_relocate_functions::thumb32_cond_branch_upper,
6962         Arm_relocate_functions::thumb32_cond_branch_lower,
6963         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6964         branch offset encoding.
6965         (Arm_relocate_functions::thumb_branch_common): Use new branch
6966         offset encoding methods to avoid code duplication.
6967         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6968         (Stub_addend_reader::operator()): Use new branch encoding method
6969         to avoid code duplication.
6970
6971 2010-01-11  Doug Kwan  <dougkwan@google.com>
6972
6973         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6974         (Target_arm::do_finalize_sections): Define special EXIDX section
6975         symbols only if referenced.
6976         * gc.h (Garbage_collection::add_reference): New method.
6977         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6978         code duplication.
6979
6980 2010-01-11  Ian Lance Taylor  <iant@google.com>
6981
6982         * script.cc (Version_script_info::build_expression_list_lookup):
6983         Change complaing about duplicate wildcard match from error to
6984         warning.
6985
6986         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6987         of 2009-12-30.
6988         (Version_script_info::Version_script_info): Initialize globs_,
6989         default_version_, default_is_global_, and exact_.  Don't
6990         initialize globals_ or locals_.
6991         (Version_script_info::build_lookup_tables): Build local symbols
6992         first.
6993         (Version_script_info::unquote): New function.
6994         (Version_script_info::add_exact_match): New function.
6995         (Version_script_info::build_expression_list_lookup): Remove lookup
6996         parameter.  Add is_global parameter.  Change all callers.  Handle
6997         wildcard pattern specially.  Unquote pattern.  Call
6998         add_exact_match.
6999         (Version_script_info::get_name_to_match): New function.
7000         (Version_script_info::get_symbol_version): New function.
7001         (Version_script_info::get_symbol_version_helper): Remove.
7002         (Version_script_info::check_unmatched_names): Call unquote.
7003         * script.h (class Version_script_info): Change get_symbol_version
7004         to be non-inline and add is_global parameter; change all callers.
7005         Rewrite symbol_is_local.  Update declarations.  Define struct
7006         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7007         Remove globals_ and locals_ members.  Add exact_, globs_,
7008         default_version_, is_global_.
7009         (Version_script_info::Glob): Remove pattern, add expression and
7010         is_global.  Update constructor.  Change all callers.
7011         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7012         default version.
7013         (Versions::symbol_section_contents): If a symbol is undefined, or
7014         defined in a dynamic object, set the version index to
7015         VER_NDX_LOCAL.
7016         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7017         symbol_is_local.
7018         (Symbol_table::add_from_pluginobj): Likewise.
7019         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7020
7021 2010-01-11  Doug Kwan  <dougkwan@google.com>
7022
7023         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7024         (incremental_dump_LDADD): Add linking option for libintl.
7025         * Makefile.in: Regenerate.
7026
7027 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7028
7029         PR gold/11144
7030         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7031         instead of -Ds.
7032         * testsuite/Makefile.in: Regenerated.
7033
7034 2010-01-10  Doug Kwan  <dougkwan@google.com>
7035
7036         * options.h (DEFINE_var): Use parentheses around argument varname__
7037         in macro body to avoid any unintended subsequent substitutions.
7038
7039 2010-01-10  Ian Lance Taylor  <iant@google.com>
7040
7041         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7042         candidates before doing symbol resolution.
7043
7044         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7045         ODR candidates if only one is weak.
7046
7047 2010-01-08  Ian Lance Taylor  <iant@google.com>
7048
7049         * script.cc (Version_script_info::build_expression_list_lookup):
7050         Don't warn about ambiguous version, just record the ambiguity.
7051         (Version_script_info::get_symbol_version_helper): Give error if
7052         version is ambiguous.
7053
7054 2010-01-08  Doug Kwan  <dougkwan@google.com>
7055
7056         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7057           prev_data_size_ and prev_addralign_.  Remove initializer for
7058           deleted data member has_been_changed_.
7059           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7060           to determine if the table is empty.
7061           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7062           Remove.
7063           (Stub_table::add_reloc_stub): Define method in class definition
7064           instead of just declaring it there.
7065           (Stub_table::add_cortex_a8_stub): New method definition.
7066           (Stub_table::update_data_size_and_addralign): Ditto.
7067           (Stub_table::finalize_stubs): Ditto.
7068           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7069           (Stub_table::do_addralign_): Return address alignment in the
7070           (Stub_table::do_reset_address_and_file_offset): Define method in
7071           class definition instead of declaring it there.  Set current data
7072           size to be the data size of the previous pass.
7073           (Stub_table::set_final_data_size): Use current data size as the
7074           final data size.
7075           (Stub_table::relocate_stub): Change parameter type of stub from
7076           Reloc_stub pointer to Stub pointer.
7077           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7078           (Stub_table::Cortex_a8_stub_list): New typedef.
7079           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7080            Stub_table::prev_addralign_): New data member.
7081           (Arm_relobj::Arm_relobj): Initialize data member
7082           section_has_cortex_a8_workaround_.
7083           (Arm_relobj::section_has_cortex_a8_workaround,
7084            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7085            definitions.
7086           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7087           declarations.
7088           (Target_arm::relocate_stub): Change parameter type of stub from
7089           Reloc_stub pointer to Stub pointer.
7090           (Insn_template::size, Insn_template::alignment): Handle
7091           THUMB16_SPECIAL_TYPE.
7092           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7093            Stub_table::update_data_size_and_addralign,
7094            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7095           definitions.
7096           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7097           (Stub_table::do_write): Ditto.
7098           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7099
7100 2010-01-08  Ian Lance Taylor  <iant@google.com>
7101
7102         PR 11108
7103         * symtab.h (class Symbol): Remove fields is_target_special_ and
7104         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7105         (Symbol::is_defined_in_discarded_section): New function.
7106         (Symbol::set_is_defined_in_discarded_section): New function.
7107         (Symbol::has_plt_offset): Rewrite.
7108         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7109         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7110         Don't initialize is_target_special_ or has_plt_offset_.
7111         Initialize is_defined_in_discarded_section_.
7112         (Symbol_table::add_from_relobj): If appropriate, set
7113         is_defined_in_discarded_section.
7114         * resolve.cc (Symbol::override_base_with_special): Don't test
7115         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7116         * target-reloc.h (relocate_section): Do special handling for
7117         symbols defined in discarded sections for global symbols as well
7118         as local symbols.
7119
7120 2010-01-08  Ian Lance Taylor  <iant@google.com>
7121
7122         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7123         the SHT_SYMTAB case.
7124
7125 2010-01-08  Ian Lance Taylor  <iant@google.com>
7126
7127         * object.cc (Sized_relobj::do_layout): Don't get confused if
7128         layout_eh_frame returns NULL.
7129
7130 2010-01-08  Ian Lance Taylor  <iant@google.com>
7131
7132         PR 11084
7133         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7134         dynamic symbol table, use the normal symbol table.
7135         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7136         symbol table.
7137
7138 2010-01-08  Ian Lance Taylor  <iant@google.com>
7139
7140         PR 11072
7141         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7142         sections.
7143
7144 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7145
7146         * version.cc (print_version): Change to "Copyright 2010".
7147
7148 2010-01-08  Ian Lance Taylor  <iant@google.com>
7149
7150         PR 10287
7151         PR 11063
7152         * i386.cc (class Target_i386): Change return type of plt_section
7153         to be non-const.
7154         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7155         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7156         tls_desc_rel_ field.
7157         (Output_data_plt_i386::rel_tls_desc): New function.
7158         (Target_i386::rel_tls_desc_section): New function.
7159         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7160         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7161         R_386_TLS_DESC reloc in rel_tls_desc_section.
7162         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7163         Define struct Tlsdesc_info.
7164         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7165         (Target_x86_64::do_reloc_symbol_index): New function.
7166         (Target_x86_64::add_tlsdesc_info): New function.
7167         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7168         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7169         tlsdesc_rel_ field.
7170         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7171         all callers.
7172         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7173         (Target_x86_64::rela_tlsdesc_section): New function.
7174         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7175         handling.
7176         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7177         (Target_x86_64::do_reloc_addend): New function.
7178         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7179         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7180         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7181         (Output_reloc::type): New function.
7182         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7183         (Output_reloc::is_target_specific): New function.
7184         (Output_reloc::target_arg): New function.
7185         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7186         absolute relocs and target specific relocs.
7187         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7188         add_target_specific.
7189         (class Output_data_reloc) [SHT_RELA]: Likewise.
7190         * output.cc (Output_reloc::Output_reloc): Add four new versions
7191         for absolute relocs and target specific relocs.
7192         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7193         (Output_reloc::get_symbol_index): Likewise.
7194         (Output_reloc::local_section_offset): Check that local_sym_index_
7195         is not TARGET_CODE or 0.
7196         (Output_reloc::symbol_value): Likewise.
7197         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7198         reloc.
7199         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7200         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7201         functions.
7202         * layout.cc (add_target_dynamic_tags): Use output section for
7203         DT_PLTRELSZ and DT_JMPREL.
7204
7205 2010-01-07  Ian Lance Taylor  <iant@google.com>
7206
7207         PR 11061
7208         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7209         function.
7210         (class Output_data_reloc_generic): Define.
7211         (class Output_data_reloc_base): Change base class to
7212         Output_data_reloc_generic.  Change add() method to call
7213         bump_relative_reloc_count for a relative reloc.  Remove
7214         sort_relocs_ field.
7215         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7216         to sort_relocs().
7217         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7218         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7219         appropriate.
7220         * layout.h (class Layout): Update declaration.
7221
7222 2010-01-07  Ian Lance Taylor  <iant@google.com>
7223
7224         * output.h (class Output_data): Add const version of
7225         output_section and do_output_section.
7226         (class Output_section_data): Add const version of
7227         do_output_section.
7228         (class Output_section): Likewise.
7229         * layout.cc (Layout::add_target_dynamic_tags): New function.
7230         * layout.h (class Layout): Update declarations.
7231         * arm.cc (Target_arm::do_finalize_sections): Use
7232         add_target_dynamic_tags.
7233         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7234         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7235         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7236         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7237
7238 2010-01-07  Ian Lance Taylor  <iant@google.com>
7239
7240         PR 11042
7241         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7242         object as needed.
7243
7244 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7245             Ian Lance Taylor  <iant@google.com>
7246
7247         PR 11019
7248         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7249         Xindex::read_symtab_xindex.
7250
7251 2010-01-07  Doug Kwan  <dougkwan@google.com>
7252
7253         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7254         (Insn_template::thumb16_bcond_insn): New method declaration.
7255         (Insn_template): Fix spelling.
7256         (Stub::thumb16_special): New method declaration.
7257         (Stub::do_write): Define virtual method which was previously pure
7258         virtual.
7259         (Stub::do_thumb16_special): New method declaration.
7260         (Stub::do_fixed_endian_write): New template member.
7261         (Reloc_stub::do_write): Remove.
7262         (Reloc_stub::do_fixed_endian_write): Remove.
7263         (Cortex_a8_stub): New class definition.
7264         (Stub_factory::make_cortex_a8_stub): New method definition.
7265         (Stub_factory::Stub_factory): Add missing static storage class
7266         qualifier for elf32_arm_stub_a8_veneer_blx.
7267
7268 2010-01-07  Ian Lance Taylor  <iant@google.com>
7269
7270         PR 10980
7271         * options.h (class General_options): Add --warn-unresolved-symbols
7272         and --error-unresolved-symbols.
7273         * errors.cc (Errors::undefined_symbol): Implement
7274         --warn-unresolved-symbols.
7275
7276         * options.h (class General_options): Add -z text and -z textoff.
7277         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7278
7279 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7280
7281         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7282         (Garbage_collection::cident_sections): New function.
7283         (Garbage_collection::add_cident_section): New function.
7284         (Garbage_collection::cident_sections_): New member.
7285         (gc_process_relocs): Add references to sections whose names are C
7286         identifiers.
7287         * gold.h (cident_section_start_prefix): New constant.
7288         (cident_section_stop_prefix): New constant.
7289         (is_cident): New function.
7290         * layout.cc (Layout::define_section_symbols): Replace string constants
7291         with the newly defined constants.
7292         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7293         C identifiers.
7294         * testsuite/Makefile.am: Add gc_orphan_section_test.
7295         * testsuite/Makefile.in: Regenerate.
7296         * testsuite/gc_orphan_section_test.cc: New file.
7297         * testsuite/gc_orphan_section_test.sh: New file.
7298
7299 2010-01-06  Ian Lance Taylor  <iant@google.com>
7300
7301         PR 10980
7302         * options.h (class General_options): Add --warn-shared-textrel.
7303         * layout.cc (Layout::finish_dynamic_section): Implement
7304         --warn-shared-textrel.
7305
7306         PR 10980
7307         * options.h (class General_options): Add --warn-multiple-gp.
7308
7309 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7310
7311         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7312         $(THREADSLIB) and $(LIBDL).
7313         * Makefile.in: Rebuild.
7314
7315 2010-01-06  Ian Lance Taylor  <iant@google.com>
7316
7317         PR 10980
7318         * options.cc (General_options::parse_section_start): New function.
7319         (General_options::section_start): New function.
7320         (General_options::General_options): Initialize all members.
7321         * options.h: Include <map>
7322         (class General_options): Add --section-start.  Add section_starts_
7323         member.
7324         * layout.cc (Layout::attach_allocated_section_to_segment): If
7325         --section-start was used, set the address of the segment.  Remove
7326         local sort_sections.
7327         (Layout::relaxation_loop_body): If the address of the load segment
7328         has been set by --section-start, don't use it.
7329         * output.h (Output_segment::update_flags_for_output_section): New
7330         function.
7331         * output.cc (Output_segment::add_output_section): Call
7332         update_flags_for_output_section.
7333
7334 2010-01-05  Ian Lance Taylor  <iant@google.com>
7335
7336         PR 10980
7337         * options.h (class General_options): Add --undefined-version.
7338         * script.cc (struct Version_expression): Add was_matched_by_symbol
7339         field.
7340         (Version_script_info::matched_symbol): New function.
7341         (Version_script_info::get_symbol_version_helper): Call
7342         matched_symbol.
7343         (Version_script_info::check_unmatched_names): New function.
7344         * script.h (class Version_script_info): Update declarations.
7345         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7346
7347         * options.h (class General_options): Use DEFINE_bool_alias for
7348         allow_multiple_definition.
7349         * resolve.cc (Symbol_table::should_override): Don't test
7350         allow_multiple_definition.
7351
7352         PR 10980
7353         * options.h (class General_options): Add --cref.
7354         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7355         until after printing cref table.
7356         * cref.cc: Include "symtab.h".
7357         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7358         (Cref_table_compare::operator()): New function.
7359         (Cref_inputs::gather_cref): New function.
7360         (filecol): New static const.
7361         (Cref_inputs::print_cref): New function.
7362         (Cref::print_cref): New function.
7363         * cref.h: Include <cstdio>.
7364         (class Cref): Update declarations.
7365         * mapfile.h (Mapfile::file): New function.
7366         * object.h (class Object): Define Symbols.  Declare virtual
7367         do_get_global_symbols.
7368         (Object::get_global_symbols): New function.
7369         * object.cc (Input_objects::add_object): Pass object to cref_ if
7370         --cref.
7371         (Input_objects::archive_start): Likewise.
7372         (Input_objects::archive_stop): Likewise.
7373         (Input_objects::print_cref): New function.
7374         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7375         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7376         --cref.
7377         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7378         function.
7379         * plugin.h (class Sized_pluginobj): Update declarations.
7380
7381 2010-01-05  Ian Lance Taylor  <iant@google.com>
7382
7383         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7384         to is_default_version.  Rename insdef to insdefault.
7385         (Symbol_table::add_from_relobj): Rename def to is_default_version
7386         and local to is_forced_local.
7387         (Symbol_table::add_from_pluginobj): Likewise.
7388         (Symbol_table::add_from_dynobj): Likewise.
7389         (Symbol_table::define_special_symbol): Rename insdef to
7390         insdefault.
7391
7392 2010-01-04  Ian Lance Taylor  <iant@google.com>
7393
7394         PR 10980
7395         * options.h (class General_options): Add
7396         --allow-multiple-definition and -z muldefs.
7397         * resolve.cc (Symbol_table::should_override): Don't warn about a
7398         multiple symbol definition if --allow-multiple-definition or -z
7399         muldefs.
7400
7401         PR 10980
7402         * options.h (class General_options): Add --add-needed and
7403         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7404         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7405         error if --copy-dt-needed-entries aka --add-needed is used and
7406         would cause a change in behaviour.
7407
7408         PR 10980
7409         * options.h (class General_options): Add -G as a short version of
7410         --shared.  Add no-op options -assert, -g, and -i.
7411
7412 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7413
7414         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7415         check for .text or .gnu.linkonce.t sections.
7416         * icf.cc (Icf::find_identical_sections): Ditto.
7417         Change the detection for mangled function name within the section
7418         name.
7419         * icf.h (is_section_foldable_candidate): New function.
7420
7421 2009-12-30  Ian Lance Taylor  <iant@google.com>
7422
7423         PR 10980
7424         * options.h (class General_options): Permit two dashes with
7425         --retain-symbols-file.
7426
7427 2009-12-30  Ian Lance Taylor  <iant@google.com>
7428
7429         PR 10979
7430         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7431         don't put the file header and segment headers in the text
7432         segment.
7433
7434         PR 10979
7435         * common.cc (Sort_commons::operator()): Stabilize sort when both
7436         entries are NULL.
7437         (Symbol_table::do_allocate_commons_list): When allocating common
7438         symbols, skip a symbol which is no longer common.
7439         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7440         an object before checking its type.
7441         * testsuite/common_test_2.c: New file.
7442         * testsuite/common_test_3.c: New file.
7443         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7444         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7445         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7446         (common_test_2_pic.o, common_test_2.so): New targets.
7447         (common_test_3_pic.o, common_test_3.so): New targets.
7448         * testsuite/Makefile.in: Rebuild.
7449
7450         PR 10979
7451         * script.cc (read_input_script): If we see a new SECTIONS clause,
7452         and we have added an input section, give an error.
7453         * layout.h (class Layout): Add have_added_input_section function.
7454         Add have_added_input_section_ field.
7455         * layout.cc (Layout::Layout): Initialize
7456         have_added_input_section_.
7457         (Layout::layout): Set have_added_input_section_.
7458         (Layout::layout_eh_frame): Likewise.
7459
7460 2009-12-30  Ian Lance Taylor  <iant@google.com>
7461
7462         PR 10931
7463         * options.h (class General_options): Add --sort-common option.
7464         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7465         * common.cc (Sort_common): Add sort_order parameter to
7466         constructor.  Add sort_order_ field.
7467         (Sort_commons::operator): Check sort_order_.
7468         (Symbol_table::allocate_commons): Determine the sort order.
7469         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7470         Change all callers.
7471         (Symbol_table::do_allocate_commons_list): Likewise.
7472
7473 2009-12-30  Ian Lance Taylor  <iant@google.com>
7474
7475         PR 10916
7476         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7477         symbols from this object, don't change the visibility of an
7478         undefined symbol.
7479         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7480
7481 2009-12-30  Ian Lance Taylor  <iant@google.com>
7482
7483         PR 10861
7484         * script.h (class Version_script_info): Define Language enum.
7485         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7486         new fields globals_, locals_, and is_finalized_.
7487         * script.cc: Various formatting fixes.
7488         (class Parser_closure): Change language_stack_ from a vector of
7489         std::string to one of Version_script_info::Language.  Adjust all
7490         uses accordingly.
7491         (class Lazy_demangler): Remove.
7492         (struct Version_expression): Change language from std::string to
7493         Version_script_info::Language.
7494         (Version_script_info::Version_script_info): New function.
7495         (Version_script_info::~Version_script_info): Don't call clear.
7496         (Version_script_info::finalize): New function.
7497         (Version_script_info::build_lookup_tables): New function.
7498         (Version_script_info::build_expression_list_lookup): New
7499         function.
7500         (Version_script_info::get_symbol_version_helper): Rewrite to use
7501         lookup tables.
7502         (Version_script_info::print_expression_list): Adjust to use
7503         Version_script_info::Language.
7504         (script_push_lex_into_version_mode): Check that the version script
7505         has not been finalized.
7506         (version_script_push_lang): Change language string to
7507         Version_script_info::Language.
7508         * options.cc (Command_line::version_script): New function.
7509         * options.h (class General_options): Add finalize_dynamic_list
7510         function.  Change version_script from declaration to definition.
7511         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7512         * testsuite/version_script.map: Remove duplicate def of foo.
7513         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7514         version_script.map.
7515         * testsuite/Makefile.in: Rebuild.
7516
7517 2009-12-30  Ian Lance Taylor  <iant@google.com>
7518
7519         PR 10843
7520         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7521         if the input symbol index is 0, make the output symbol index 0.
7522
7523 2009-12-30  Ian Lance Taylor  <iant@google.com>
7524
7525         PR 10670
7526         * options.h (class General_options): Add -x/--discard-all.
7527         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7528         --discard-all.  If the local symbol needs a dynamic entry, check
7529         that before handling --discard-locals.
7530
7531 2009-12-30  Ian Lance Taylor  <iant@google.com>
7532
7533         PR 10450
7534         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7535         flags to PF_R.
7536         (Output_segment::add_output_section): Don't change the flags if
7537         the type is PT_TLS.
7538
7539         PR 10450
7540         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7541         GNU hash table if they need a dynamic value.  Otherwise, don't add
7542         them if they are defined in a dynamic object or are forced local.
7543
7544 2009-12-29  Ian Lance Taylor  <iant@google.com>
7545
7546         PR 10450
7547         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7548         .gnu.hash table for a 32-bit target.
7549
7550         PR 10450
7551         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7552         regular and a dynamic object only needs a dynamic symbol table
7553         entry if it is externally visible.
7554
7555         PR 10450
7556         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7557         constructor.  Add global_offset_table_ field.
7558         (Target_i386::got_section): Set global_offset_table_.
7559         (Target_i386::do_finalize_sections): Set global_offset_table_
7560         size.
7561         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7562         in constructor.  Add global_offset_table_ field.
7563         (Target_x86_64::got_section): Set global_offset_table_.
7564         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7565         size.
7566
7567         * layout.cc (Layout::Layout): Initialize increase_relro_.
7568         (Layout::get_output_section): Add is_relro, is_last_relro, and
7569         is_first_non_relro parameters.  Change all callers.
7570         (Layout::choose_output_section): Likewise.
7571         (Layout::add_output_section_data): Likewise.
7572         (Layout::make_output_section): Likewise.
7573         (Layout::set_segment_offsets): Clear increase_relro when using a
7574         linker script.
7575         * layout.h (class Layout): Add increase_relro method.  Add
7576         increase_relro_ field.  Update declarations.
7577         * output.cc (Output_section::Output_section): Initialize
7578         is_last_relro_ and is_first_non_relro_.
7579         (Output_segment::add_output_section): Group relro sections is
7580         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7581         (Output_segment::maximum_alignment): Remove relro handling.
7582         (Output_segment::set_section_addresses): Add increase_relro
7583         parameter.  Change all callers.  Add initial alignment to align
7584         relro sections on separate page.  Remove old relro handling.
7585         (Output_segment::set_section_list_addresses): Remove in_relro
7586         parameter.  Change all callers.
7587         (Output_segment::set_offset): Add increase parameter.  Change all
7588         callers.  Remove old relro handling.
7589         * output.h (class Output_section): Add new methods: is_last_relro,
7590         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7591         Add is_last_relro_ and is_first_non_relro_ fields.
7592         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7593         Create separate .got.plt section.  Call increase_relro.
7594         * x86_64.cc (Target_x86_64::got_section): Likewise.
7595         * testsuite/relro_script_test.t: Add .got.plt.
7596
7597         PR 10450
7598         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7599         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7600         (Layout::finalize): Call set_dynamic_symbol_size.
7601         (Layout::set_dynamic_symbol_size): New function.
7602         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7603         set_dynamic_symbol_size.
7604
7605         PR 10450
7606         * output.h (class Output_section): Add is_entsize_zero_ field.
7607         * output.cc (Output_section::Output_section): Initialize
7608         is_entsize_zero_.
7609         (Output_section::set_entsize): If two different entsizes are
7610         requested, force it to zero.
7611         (Output_section::add_input_section): Set flags for .debug_str
7612         before updating section flags.  Set entsize.
7613         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7614         and SHF_STRING if all input sections have those flags.
7615
7616 2009-12-29   Rafael Espindola  <espindola@google.com>
7617
7618         * main.cc (main): Fix the sys time reporting.
7619         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7620         reporting.
7621
7622 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7623
7624         * options.cc (General_options::parse_version): Allow -v to exit
7625         without an error if there is nothing to link.
7626
7627 2009-12-29  Ian Lance Taylor  <iant@google.com>
7628
7629         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7630         using a version of gcc before 4.1.
7631         * configure: Rebuild.
7632
7633 2009-12-28  Chris Demetriou  <cgd@google.com>
7634
7635         * attributes.cc (Output_attributes_section_data::do_write): Use
7636         std::vector::front rather than std::vector::data.
7637
7638 2009-12-28  Ian Lance Taylor  <iant@google.com>
7639
7640         * symtab.h (class Symbol_table): Add enum Defined.
7641         * resolve.cc (Symbol_table::should_override): Add defined
7642         parameter.  Change all callers.  Test whether object is NULL
7643         before calling a method on it.
7644         (Symbol_table::report_resolve_problem): Add defined parameter.
7645         Change all callers.
7646         (Symbol_table::should_override_with_special): Likewise.
7647         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7648         parameter.  Change all callers.
7649         (Symbol_table::do_define_in_output_data): Likewise.
7650         (Symbol_table::define_in_output_segment): Likewise.
7651         (Symbol_table::do_define_in_output_segment): Likewise.
7652         (Symbol_table::define_as_constant): Likewise.
7653         (Symbol_table::do_define_as_constant): Likewise.
7654         * script.h (class Symbol_assignment): Add is_defsym parameter to
7655         constructor; change all callers.
7656         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7657         parameter.  Change all callers.  Add is_defsym_ field.
7658         (class Parser_closure): Add parsing_defsym parameter to
7659         constructor; change all callers.  Add parsing_defsym accessor
7660         function.  Add parsing_defsym_ field.
7661
7662 2009-12-28  Ian Lance Taylor  <iant@google.com>
7663
7664         * gold.cc (queue_middle_tasks): Fix formatting.
7665         * object.cc (Relobj::is_section_name_included): Likewise.
7666
7667 2009-12-23  Ian Lance Taylor  <iant@google.com>
7668
7669         * i386.cc (Target_i386::do_calls_non_split): Recognize
7670         -fsplit-stack prologue for a function with a static chain.
7671         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7672         -fsplit-stack prologue when using %r11.
7673
7674 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7675
7676         * options.cc (General_options::parse_version): Make -v continue and do
7677         the link like GNU ld does.
7678
7679 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7680
7681         * Makefile.am (CCFILES): Add timer.cc.
7682         (HFILES): Add timer.h.
7683         * configure.ac: Check for sysconf and times.
7684         * main.cc: include timer.h.
7685         (main): Use Timer instead of get_run_time.
7686         * timer.cc: New.
7687         * timer.h: New.
7688         * workqueue.cc: include timer.h.
7689         (Workqueue::find_and_run_task):
7690         Report user, sys and wall time.
7691         * Makefile.in: Regenerate.
7692         * config.in: Regenerate.
7693         * configure: Regenerate.
7694
7695 2009-12-16  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7698         sections.
7699         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7700         relaxed input sections.
7701         * output.cc (Output_section::find_relaxed_input_section): Change
7702         return type to Output_relaxed_input_section pointer.  Adjust code
7703         for new type of relaxed_input_section_map_.
7704         * output.h (Output_section::find_relaxed_input_section): Change
7705         return type to Output_relaxed_input_section pointer.
7706         (Output_section::Output_relaxed_input_section_by_input_section_map):
7707         New type.
7708         (Output_section::relaxed_input_section_map_): Change type to
7709         Output_section::Output_relaxed_input_section_by_input_section_map.
7710         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7711         input section.
7712
7713 2009-12-15  Ian Lance Taylor  <iant@google.com>
7714
7715         * layout.cc (Layout::create_shstrtab): Only write out after input
7716         sections if we are compressing debug sections.
7717
7718 2009-12-15  Ian Lance Taylor  <iant@google.com>
7719
7720         * archive.cc (Archive::add_symbols): Only look up a symbol without
7721         a version if there is, in fact, a version.
7722
7723 2009-12-14  Ian Lance Taylor  <iant@google.com>
7724
7725         Revert -Wshadow changes, all changes from:
7726         2009-12-11  Doug Kwan  <dougkwan@google.com>
7727         2009-12-11  Nick Clifton  <nickc@redhat.com>
7728         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7729
7730 2009-12-11  Doug Kwan  <dougkwan@google.com>
7731
7732         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7733         due to -Wshadow.
7734         * attributes.cc (Object_attribute::size): Ditto.
7735         (Attributes_section_data::size): Ditto.
7736         (Attributes_section_data::Attributes_section_data): Ditto.
7737         (Output_attributes_section_data::do_write): Ditto.
7738         * attributes.h (Object_attribute::set_type): Ditto.
7739         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7740
7741 2009-12-11  Nick Clifton  <nickc@redhat.com>
7742
7743         * archive.cc: Fix shadowed variable warnings.
7744         * arm.cc: Likewise.
7745         * compressed_output.cc: Likewise.
7746         * compressed_output.h: Likewise.
7747         * configure: Likewise.
7748         * dwarf_reader.cc: Likewise.
7749         * dynobj.cc: Likewise.
7750         * dynobj.h: Likewise.
7751         * ehframe.cc: Likewise.
7752         * ehframe.h: Likewise.
7753         * errors.cc: Likewise.
7754         * expression.cc: Likewise.
7755         * fileread.cc: Likewise.
7756         * fileread.h: Likewise.
7757         * freebsd.h: Likewise.
7758         * i386.cc: Likewise.
7759         * icf.cc: Likewise.
7760         * incremental.h: Likewise.
7761         * layout.cc: Likewise.
7762         * layout.h: Likewise.
7763         * mapfile.cc: Likewise.
7764         * merge.cc: Likewise.
7765         * merge.h: Likewise.
7766         * object.cc: Likewise.
7767         * object.h: Likewise.
7768         * options.h: Likewise.
7769         * output.cc: Likewise.
7770         * output.h: Likewise.
7771         * parameters.cc: Likewise.
7772         * plugin.cc: Likewise.
7773         * powerpc.cc: Likewise.
7774         * reduced_debug_output.cc: Likewise.
7775         * reduced_debug_output.h: Likewise.
7776         * reloc.cc: Likewise.
7777         * reloc.h: Likewise.
7778         * resolve.cc: Likewise.
7779         * script-sections.cc: Likewise.
7780         * script.cc: Likewise.
7781         * script.h: Likewise.
7782         * sparc.cc: Likewise.
7783         * symtab.cc: Likewise.
7784         * symtab.h: Likewise.
7785         * target-select.cc: Likewise.
7786         * target-select.h: Likewise.
7787         * token.h: Likewise.
7788         * workqueue.cc: Likewise.
7789         * workqueue.h: Likewise.
7790         * x86_64.cc: Likewise.
7791
7792 2009-12-10  Doug Kwan  <dougkwan@google.com>
7793
7794         * arm.cc (attributes.h): New include.
7795         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7796         (Arm_relobj::~Arm_relobj): Delete object pointed by
7797         attributes_section_data_.
7798         (Arm_relobj::attributes_section_data): New method definition.
7799         (Arm_relobj::attributes_section_data_): New data member declaration.
7800         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7801         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7802         attributes_section_data_.
7803         (Arm_dynobj::attributes_section_data): New method definition.
7804         (Arm_dynobj::attributes_section_data_): New data member declaration.
7805         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7806         initialization value of may_use_blx_ to false.
7807         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7808         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7809         object attributes to compute results instead of hard-coding.
7810         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7811         Target_arm::get_secondary_compatible_arch,
7812         Target_arm::set_secondary_compatible_arch
7813         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7814         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7815         New method declarations.
7816         (Target_arm::get_aeabi_object_attribute): New method definition.
7817         (Target_arm::attributes_section_data_): New data member declaration.
7818         (read_arm_attributes_section): New template definition.
7819         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7820         (Arm_dynobj::do_read_symbols): Ditto.
7821         (Target_arm::do_finalize_sections): Merge attributes sections from
7822         input.  Check for BLX use after attributes section merging.
7823         Fix __exidx_start and __exidx_end visibility.  Create an
7824         .ARM.attributes section if necessary.
7825         (Target_arm::get_secondary_compatible_arch,
7826         Target_arm::set_secondary_compatible_arch,
7827         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7828         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7829         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7830         New method definitions.
7831
7832 2009-12-09  Ian Lance Taylor  <iant@google.com>
7833
7834         * plugin.cc (Plugin::load): Don't cast from void* to a function
7835         pointer.
7836
7837 2009-12-09  Ian Lance Taylor  <iant@google.com>
7838
7839         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7840         information fields.
7841
7842 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7843
7844         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7845         Replace two_file_shared_1.so with two_file_shared_2.so.
7846         * testsuite/Makefile.in: Regenerated.
7847
7848 2009-12-08  Doug Kwan  <dougkwan@google.com>
7849
7850         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7851         (HFILES): Add attributes.h and int_encoding.h.
7852         * Makefile.in: Regenerate.
7853         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7854         function definitions to int_encoding.cc
7855         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7856         prototypes to int_encoding.h
7857         * reduced_debug_output.cc (int_encoding.h): New include.
7858         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7859         function definitions to int_encoding.cc
7860         (insert_into_vector, read_from_pointer): Move template definitions to
7861         int_encoding.h
7862         * attributes.cc: New file.
7863         * attributes.h: New file.
7864         * int_encoding.cc: New file.
7865         * int_encoding.h: New file.
7866
7867 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7868
7869         PR gold/11055
7870         * incremental-dump.cc (dump_incremental_inputs): New.
7871         (main): Use dump_incremental_inputs.
7872
7873 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7874
7875         PR gold/10893
7876         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7877         checking elfcpp::STT_FUNC.
7878         (Target_i386::Relocate::relocate): Likewise.
7879         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7880
7881         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7882         symbols from shared libraries into normal FUNC symbols.
7883
7884         * symtab.h (Symbol): Add is_func and use it.
7885
7886 2009-12-05  Doug Kwan  <dougkwan@google.com>
7887
7888         * arm.cc (Target_arm::arm_info): Initialize new fields
7889         attributes_section and attributes_vendor.
7890         * i386.cc (Target_i386::i386_info): Same.
7891         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7892         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7893         fields attributes_section and attributes_vendor.
7894         * sparc.cc (Target_sparc::sparc_info): Same.
7895         * target.h (Target::attributes_section, Target::attributes_vendor,
7896         Target::is_attributes_section, Target::attribute_arg_type,
7897         Target::attributes_order): New method definitions.
7898         (Target::Target_info::attributes_section,
7899         Target::Target_info::attributes_vendor): New fields.
7900         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7901         virtual method definitions.
7902         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7903         attributes_section and attributes_vendor.
7904         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7905
7906 2009-12-05  Doug Kwan  <dougkwan@google.com>
7907
7908         * arm.cc: Update comments about interworking and stub generation.
7909         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7910         considered as non-PIC.
7911         (Arm_relocate_functions::base_abs): Fix formatting.
7912         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7913         of function to use GOT entry address instead of offset.
7914         (Target_arm::Scan::global): Issue an error if a symbol would need a
7915         PLT does not get one because it is untyped.  Remove code to create
7916         dynamic symbols for relative branches.
7917         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7918         takes unsigned integer instead of boolean.
7919
7920 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7921
7922         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7923         (two_file_test_LDADD): Likewise.
7924         (common_test_1_LDADD): Likewise.
7925         (exception_test_LDADD) Likewise.
7926         (weak_test_LDADD): Likewise.
7927         (many_sections_test_LDADD): Likewise.
7928         (initpri1_LDADD): Likewise.
7929         (script_test_1_LDADD): Likewise.
7930         (script_test_2_LDADD): Likewise.
7931         (justsyms_LDADD): Likewise.
7932         (binary_test_LDADD): Likewise.
7933         (large_LDADD): Likewise.
7934         * testsuite/Makefile.in: Regenerated.
7935
7936 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7937
7938         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7939         (Symbol_table::override_with_special): Likewise.
7940         (Symbol_table::add_from_object): Likewise.
7941
7942 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7943
7944         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7945         Don't set the data_offset twice.
7946
7947 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7948
7949         * testsuite/Makefile.in: Regenerate.
7950
7951 2009-12-03  Doug Kwan  <dougkwan@google.com>
7952
7953         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7954         (Target_arm::do_finalize_sections): Add parameter for symbol table
7955         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7956         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7957         parameter for symbol table pointer.
7958         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7959         an additional parameter for a pointer to symbol table.
7960         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7961         parameter for a symbol table pointer.
7962         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7963         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7964         Ditto.
7965         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7966         parameter for a symbol table pointer.
7967
7968 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7969
7970         * incremental.cc (Incremental_inputs_header)
7971         (Incremental_inputs_header_write, Incremental_inputs_entry)
7972         (Incremental_inputs_entry_write): Move ...
7973         * incremental.h (Incremental_inputs_header)
7974         (Incremental_inputs_header_write, Incremental_inputs_entry)
7975         (Incremental_inputs_entry_write): here.
7976
7977 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7978
7979         * incremental.cc (make_sized_incremental_binary): Set the target.
7980         Error if it is incompatible.
7981         * output.h (Output_file): Add filename method.
7982
7983 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7984
7985         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7986         from the get_* methods.
7987
7988 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7989
7990         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7991         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7992         Write 0 for the data_offset of scripts.
7993
7994 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7995
7996         * testsuite/Makefile.am: Add the incremental_test.sh test.
7997         * testsuite/incremental_test.sh: New.
7998         * testsuite/incremental_test_1.c: New.
7999         * testsuite/incremental_test_2.c: New.
8000
8001 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8002
8003        * incremental-dump.cc (main): Fix typos.
8004
8005 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8006
8007         PR gold/11025
8008         * incremental-dump.cc (main): Use llu to print 64 bit values.
8009
8010 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8011             H.J. Lu  <hongjiu.lu@intel.com>
8012
8013         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8014         $(LIBDL).
8015         (incremental_dump_LDADD): Likewise.
8016         * Makefile.in: Regenerated.
8017
8018 2009-11-25  Doug Kwan  <dougkwan@google.com>
8019
8020         Revert:
8021
8022         2009-11-25  Doug Kwan  <dougkwan@google.com>
8023
8024                 * arm.cc (Target_arm::Target_arm): Move method definition
8025                 outside of class definition.  Add code to handle
8026                 --target1-rel, --target1-abs and --target2= options.
8027                 (Target_arm::get_reloc_reloc_type): Change method to be
8028                 non-static and const.
8029                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8030                 New data member declaration.
8031                 (Target_arm::Scan::local, Target_arm::Scan::global,
8032                 Target_arm::Relocate::relocate,
8033                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8034                 Adjust call to Target_arm::get_real_reloc_type.
8035                 (Target_arm::get_real_reloc_type): Use command line options
8036                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8037                 * options.h (--target1-rel, --target1-abs, --target2): New
8038                 ARM-only options.
8039
8040 2009-11-25  Doug Kwan  <dougkwan@google.com>
8041
8042         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8043         class definition.  Add code to handle --target1-rel, --target1-abs
8044         and --target2= options.
8045         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8046         and const.
8047         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8048         member declaration.
8049         (Target_arm::Scan::local, Target_arm::Scan::global,
8050         Target_arm::Relocate::relocate,
8051         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8052         call to Target_arm::get_real_reloc_type.
8053         (Target_arm::get_real_reloc_type): Use command line options to
8054         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8055         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8056         options.
8057
8058 2009-11-25  Doug Kwan  <dougkwan@google.com>
8059
8060         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8061         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8062         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8063         formatting.
8064         (Arm_relocate_functions::thm_call): Replace body with a call to
8065         Arm_relocate_functions::thumb_branch_common.
8066         (Arm_relocate_functions::thm_jump24,
8067         Arm_relocate_functions::thm_xpc22): New method definitions.
8068         (Arm_relocate_functions::thumb_branch_common): New method definition.
8069         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8070         operator.
8071         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8072         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8073
8074 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8075
8076         * Makefile.am: Build incremental-dump
8077         * Makefile.in: Regenerate.
8078         * incremental-dump.cc: New.
8079         * incremental.cc (Incremental_inputs_header_data,
8080         Incremental_inputs_entry_data): Move to incremental.h
8081         * incremental.h: (Incremental_inputs_header_data,
8082         Incremental_inputs_entry_data): Move from incremental.cc
8083
8084 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8085
8086         * incremental.cc (Incremental_inputs_header,
8087         Incremental_inputs_header_write, Incremental_inputs_entry,
8088         Incremental_inputs_entry_write): Add a typedef with the data type.
8089
8090 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8091
8092         * incremental.cc (Incremental_inputs_header,
8093         Incremental_inputs_header_write, Incremental_inputs_entry,
8094         Incremental_inputs_entry_write): Update comment about which
8095         type has the filed descriptions.
8096
8097 2009-11-15  Doug Kwan  <dougkwan@google.com>
8098
8099         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8100         (Arm_relocate_functions::arm_branch_common): Change method defintion
8101         in class definition to a method declaration and update list of formal
8102         parameters.
8103         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8104         Arm_relocation_functions::jump24): Adjust call to
8105         Arm_relocate_functions::arm_branch_common.  Update list of formal
8106         parameters.
8107         (Arm_relocate_functions::xpc25): New method definition.
8108         (Arm_relocate_functions::arm_branch_common): Move method defintion
8109         out from class definition.  Use stubs for mode-switching and extending
8110         branch ranges.
8111         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8112         specially.  Change code to enable use of stubs in ARM branches.
8113
8114 2009-11-10  Doug Kwan  <dougkwan@google.com>
8115
8116         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8117         in method declaration.
8118         (Target_arm::relocate_stub): New method declaration.
8119         (Target_arm::default_target): Change to return a pointer instead of
8120         a const reference.
8121         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8122         Target_arm::default_target.
8123         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8124         method definition.
8125         (Target_arm::relocate_section): Adjust view.
8126         (Target_arm::relocate_stub): New method definition.
8127
8128 2009-11-10  Doug Kwan  <dougkwan@google.com>
8129
8130         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8131         a format warning.
8132         * incremental.cc (open_incremental_binary): Initialized local
8133         variables to avoid warnings.
8134         * object.cc (make_elf_object): Ditto.
8135         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8136         a format warning.
8137
8138 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8139
8140         PR gold/10930
8141         * testsuite/plugin_test.c: Include "config.h".
8142
8143 2009-11-09  Doug Kwan  <dougkwan@google.com>
8144
8145         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8146         (arm_symbol_value): Remove.
8147         (Arm_relocate_functions::arm_branch_common,
8148         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8149         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8150         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8151         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8152         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8153         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8154         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8155         Arm_relocate_functions::thm_mobw_abs_nc,
8156         Arm_relocate_functions::thm_mov_abs,
8157         Arm_relocate_functions::movw_prel_nc,
8158         Arm_relocate_functions::thm_movt_abs,
8159         Arm_relocate_functions::movt_prel,
8160         Arm_relocate_functions::thm_movw_prel_nc,
8161         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8162         (Target_arm::Relocate::relocate): Only decompose address into two
8163         parts if relocation type uses the thumb-bit and pass the actual
8164         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8165         calls to methods in Arm_relocate_functions for this change.
8166
8167 2009-11-08  Ian Lance Taylor  <iant@google.com>
8168
8169         PR 10925
8170         * reloc.cc: Instantiate
8171         Sized_relobj::initialize_input_to_output_maps and
8172         Sized_relobj:free_input_to_output_maps.
8173
8174 2009-11-06  Ian Lance Taylor  <iant@google.com>
8175
8176         PR 10876
8177         * defstd.cc (in_segment): Set only_if_ref true for "end".
8178
8179 2009-11-06  Doug Kwan  <dougkwan@google.com>
8180
8181         * arm.cc (class Reloc_stub): Correct a comment.
8182         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8183         (Target_arm::scan_section_for_stubs): New method declaration.
8184         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8185         Change methods from private to protected.
8186         (Target_arm::do_may_relax): New method definition.
8187         (Target_arm::do_relax, Target_arm::group_sections,
8188         Target_arm::scan_reloc_for_stub,
8189         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8190         (Target_arm::arm_input_section_map_): New data member declaration.
8191         (Target_arm::scan_reloc_for_stub,
8192         Target_arm::scan_reloc_section_for_stubs,
8193         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8194         Target_arm::do_relax): New method definitions.
8195
8196 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8197
8198         * configure.ac: Check for (struct stat)::st_mtim
8199         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8200         * config.in: Regenerate.
8201         * configure: Regenerate.
8202
8203 2009-11-05  Ian Lance Taylor  <iant@google.com>
8204
8205         PR 10910
8206         * output.cc (Output_segment::add_output_section): Add missing
8207         return statement.
8208
8209 2009-11-04  Ian Lance Taylor  <iant@google.com>
8210
8211         PR 10880
8212         * object.h (class Object): Add is_needed and set_is_needed
8213         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8214         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8215         defined in a dynamic object and referenced by a regular object,
8216         set is_needed for the dynamic object.
8217         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8218         if the file is marked with as_needed and it is not needed.
8219
8220 2009-11-04  Ian Lance Taylor  <iant@google.com>
8221
8222         PR 10887
8223         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8224         tags if data is discarded by linker script.
8225         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8226         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8227         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8228         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8229
8230 2009-11-04  Ian Lance Taylor  <iant@google.com>
8231
8232         * layout.cc (Layout::get_output_section): Add is_interp and
8233         is_dynamic_linker_section parameters.  Change all callers.
8234         (Layout::choose_output_section): Likewise.
8235         (Layout::make_output_section): Likewise.
8236         (Layout::add_output_section_data): Add is_dynamic_linker_section
8237         parameter.  Change all callers.
8238         * layout.h (class Layout): Update declarations.
8239         * output.h (class Output_section): Add is_interp, set_is_interp,
8240         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8241         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8242         generate_code_fills_at_write_ to a bitfield.
8243         * output.cc (Output_section::Output_sections): Initialize new
8244         fields.
8245         (Output_segment::add_output_section): Add do_sort parameter.
8246         Change all callers.
8247
8248 2009-11-03  Ian Lance Taylor  <iant@google.com>
8249
8250         PR 10860
8251         * options.h (class General_options): Add --warn-common.
8252         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8253         merging two common symbols.
8254         (Symbol_table::should_override): Handle --warn-common when merging
8255         a common symbol with a defined symbol.  Use report_resolve_problem
8256         for multiple definitions.
8257         (Symbol_table::report_resolve_problem): New function.
8258         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8259
8260 2009-11-03  Doug Kwan  <dougkwan@google.com>
8261
8262         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8263         stub_factory_.
8264         (Target_arm::stub_factory): New method definition.
8265         (Target_arm::new_arm_input_section,
8266         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8267         Target_arm::reloc_uses_thumb_bit): New method declarations.
8268         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8269         New type definitions.
8270         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8271         member declarations.
8272         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8273         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8274         New method definitions.
8275
8276 2009-11-03  Ian Lance Taylor  <iant@google.com>
8277
8278         * options.h (class General_options): Add --warn_constructors.
8279
8280 2009-11-03  Ian Lance Taylor  <iant@google.com>
8281
8282         PR 10893
8283         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8284         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8285
8286 2009-11-03  Ian Lance Taylor  <iant@google.com>
8287
8288         PR 10895
8289         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8290         --msgid-bugs-address.
8291         (install-pdf): New target.
8292         (install-data_yes): Look up one directory to find mkinstalldirs.
8293
8294 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8295
8296         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8297         tree.
8298
8299 2009-10-30  Doug Kwan  <dougkwan@google.com>
8300
8301         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8302
8303 2009-10-30  Doug Kwan  <dougkwan@google.com>
8304
8305         * arm.cc (Stub_addend_reader): New struct template definition
8306         and partial specializations.
8307         (Stub_addend_reader::operator()): New method definition for a
8308         partially specialized template.
8309
8310 2009-10-30  Doug Kwan  <dougkwan@google.com>
8311
8312         * arm.cc (Arm_relobj::processor_specific_flags): New method
8313         definition.
8314         (Arm_relobj::do_read_symbols): New method declaration.
8315         (Arm_relobj::processor_specific_flags_): New data member declaration.
8316         (Arm_dynobj): New class definition.
8317         (Target_arm::do_finalize_sections): Add input_objects parameter.
8318         (Target_arm::do_adjust_elf_header): New method declaration.
8319         (Target_arm::are_eabi_versions_compatible,
8320         (Target_arm::merge_processor_specific_flags): New method declaration.
8321         (Target_arm::do_make_elf_object): New overloaded method definitions
8322         and declaration.
8323         (Arm_relobj::do_read_symbols): New method definition.
8324         (Arm_dynobj::do_read_symbols): Ditto.
8325         (Target_arm::do_finalize_sections): Add input_objects parameters.
8326         Merge processor-specific flags from all input objects.
8327         (Target_arm::are_eabi_versions_compatible,
8328         Target_arm::merge_processor_specific_flags,
8329         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8330         New method definitions.
8331         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8332         Input_objects pointer type parameter.
8333         * layout.cc (Layout::finalize): Pass input objects to target's.
8334         finalize_sections function.
8335         * output.cc (Output_file_header::do_sized_write): Set ELF file
8336         header's processor-specific flags.
8337         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8338         Input_objects pointer type parameter.
8339         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8340         * target.h (Input_objects): New forward class declaration.
8341         (Target::processor_specific_flags,
8342         Target::are_processor_specific_flags_sect): New method definitions.
8343         (Target::finalize_sections): Add input_objects parameter.
8344         (Target::Target): Initialize processor_specific_flags_ and
8345         are_processor_specific_flags_set_.
8346         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8347         parameter.
8348         (Target::set_processor_specific_flags): New method definition.
8349         (Target::processor_specific_flags_,
8350         Target::are_processor_specific_flags_set_): New data member
8351         declarations.
8352         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8353         Input_objects pointer type parameter.
8354
8355 2009-10-30  Doug Kwan  <dougkwan@google.com>
8356
8357         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8358
8359 2009-10-28  Ian Lance Taylor  <iant@google.com>
8360
8361         * object.h (class Relobj): Drop options parameter from
8362         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8363         do_scan_relocs, do_relocate.  Change all callers.
8364         (class Sized_relobj): Drop options parameters from
8365         do_gc_process_relocs, do_scan_relocs, do_relocate,
8366         do_relocate_sections, relocate_sections, emit_relocs_scan,
8367         emit_relocs_scan_reltype.  Change all callers.
8368         (struct Relocate_info): Remove options field and all references to
8369         it.
8370         * reloc.h (class Read_relocs): Remove options constructor
8371         parameter and options_ field.  Change all callers.
8372         (class Gc_process_relocs, class Scan_relocs): Likewise.
8373         (class Relocate_task): Likewise.
8374         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8375         all callers.
8376         (scan_relocatable_relocs): Likewise.
8377         * target.h (class Sized_target): Remove options parameter from
8378         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8379         all callers.
8380         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8381         callers.
8382         * arm.cc: Update functions to remove options parameters.
8383         * i386.cc: Likewise.
8384         * powerpc.cc: Likewise.
8385         * sparc.cc: Likewise.
8386         * x86_64.cc: Likewise.
8387         * testsuite/testfile.cc: Likewise.
8388
8389 2009-10-28  Doug Kwan  <dougkwan@google.com>
8390
8391         * arm.cc (Arm_relobj): New class definition.
8392         (Arm_relobj::scan_sections_for_stubs,
8393         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8394         New method definitions.
8395
8396 2009-10-28  Cary Coutant  <ccoutant@google.com>
8397
8398         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8399         (Plugin::cleanup_done_): New member.
8400         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8401         (Plugin_manager::cleanup_done_): Remove.
8402         (Plugin_manager::add_input_file): Edit error message.
8403         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8404         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8405
8406 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8407
8408         * fileread.cc: (File_read::View::~View): Use the new
8409         data_ownership_ filed.
8410         (File_read::~File_read): Dispose the new whole_file_view_.
8411         (File_read::open): Mmap the whole file if needed.
8412         (File_read::open): Use whole_file_view_ instead of contents_.
8413         (File_read::find_view): Use whole_file_view_ if applicable.
8414         (File_read::do_read): Use whole_file_view_ instead of contents_.
8415         (File_read::make_view): Use whole_file_view_ instead of contents_,
8416         update File_read::View::View call.
8417         (File_read::find_or_make_view): Update File_read::View::View
8418         call.
8419         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8420         remove contents_
8421         (File_read::View::Data_ownership): New enum.
8422         (File_read::View::View): Replace bool mapped_ with Data_ownership
8423         argument.
8424         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8425         (File_read::View::data_ownership_): New field.
8426         (File_read::contents_): Remove (replaced by whole_file_view_).
8427         (File_read::whole_file_view_): New field.
8428         * options.h (class General_options): Add --keep-files-mapped.
8429
8430 2009-10-27  Cary Coutant  <ccoutant@google.com>
8431
8432         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8433         * testsuite/Makefile.am (plugin_test_5): New test case.
8434         * testsuite/Makefile.in: Regenerate.
8435
8436 2009-10-25  Doug Kwan  <dougkwan@google.com>
8437
8438         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8439         from private to protected to allow access by child class.
8440         (Sized_relobj::do_relocate_sections): New method declaration.
8441         (Sized_relobj::relocate_sections): Virtualize.
8442         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8443         Sized_relobj::relocate_sections.  Instantiate template explicitly
8444         for different target sizes and endianity.
8445
8446 2009-10-24  Doug Kwan  <dougkwan@google.com>
8447
8448         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8449         (Arm_input_section::as_arm_input_section): New method.
8450         (Arm_output_section): New class definition.
8451         (Arm_output_section::create_stub_group,
8452         Arm_output_section::group_sections): New method definitions.
8453
8454 2009-10-22  Doug Kwan  <dougkwan@google.com>
8455
8456         * arm.cc (Arm_input_section): New class definition.
8457         (Arm_input_section::init, Arm_input_section:do_write,
8458         Arm_input_section::set_final_data_size,
8459         Arm_input_section::do_reset_address_and_file_offset): New method
8460         definitions.
8461
8462 2009-10-21  Doug Kwan  <dougkwan@google.com>
8463
8464         * arm.cc (Stub_table, Arm_input_section): New forward class
8465         declarations.
8466         (Stub_table): New class defintion.
8467         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8468         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8469         New method definition.
8470
8471 2009-10-21  Doug Kwan  <dougkwan@google.com>
8472
8473         * arm.cc: Update copyright comments.
8474         (Target_arm): New forward class template declaration.
8475         (Arm_address): New type.
8476         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8477         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8478         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8479         constants.
8480         (Insn_template): Same.
8481         (DEF_STUBS): New macro.
8482         (Stub_type): New enum type.
8483         (Stub_template): New class definition.
8484         (Stub): Same.
8485         (Reloc_stub): Same.
8486         (Stub_factory): Same.
8487         (Target_arm::Target_arm): Initialize may_use_blx_ and
8488         should_force_pic_veneer_.
8489         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8490         Target_arm::should_force_pic_veneer,
8491         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8492         Target_arm::using_thumb_only, Target_arm:;default_target): New
8493         method defintions.
8494         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8495         New data member declarations.
8496         (Insn_template::size, Insn_template::alignment): New method defintions.
8497         (Stub_template::Stub_template): New method definition.
8498         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8499         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8500         (Stub_factory::Stub_factory): New method definition.
8501         * gold.h (string_hash): New template.
8502         * output.h (Input_section_specifier::hash_value): Use
8503         gold::string_hash.
8504         (Input_section_specifier::string_hash): Remove.
8505         * stringpool.cc (Stringpool_template::string_hash): Use
8506         gold::string_hash.
8507
8508 2009-10-20  Doug Kwan  <dougkwan@google.com>
8509
8510         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8511         symbols of relaxed input sections.
8512         * output.h (Output_section::find_relaxed_input_section): Make
8513         method public.
8514
8515 2009-10-16  Doug Kwan  <dougkwan@google.com>
8516
8517         * dynobj.cc (Versions::Versions): Initialize version_script_.
8518         Only insert base version symbol definition for a shared object
8519         if version script defines any version versions.
8520         (Versions::define_base_version): New method definition.
8521         (Versions::add_def): Check that base version is not needed.
8522         (Versions::add_need): Define base version lazily.
8523         * dynobj.h (Versions::define_base_version): New method declaration.
8524         (Versions::needs_base_version_): New data member declaration.
8525         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8526         (check_DATA): Add no_version_test.stdout.
8527         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8528         New make rules.
8529         * testsuite/Makefile.in: Regenerate.
8530         * testsuite/no_version_test.c: New file.
8531         * testsuite/no_version_test.sh: Ditto.
8532
8533 2009-10-16  Doug Kwan  <dougkwan@google.com>
8534
8535         * expression.cc (class Segment_start_expression): New class definition.
8536         (Segment_start_expression::value): New method definition.
8537         (script_exp_function_segment_start): Return a new
8538         Segment_start_expression.
8539         * gold/script-c.h (script_saw_segment_start_expression): New function
8540         prototype.
8541         * script-sections.cc (Script_sections::Script_sections): Initialize
8542         SAW_SEGMENT_START_EXPRESSION_ to false.
8543         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8544         and -Tbbs options to specify section addresses if given in
8545         command line and no SEGMENT_START expression is seen in a script.
8546         * script-sections.h (Script_sections::saw_segment_start_expression,
8547         Script_sections::set_saw_segment_start_expression): New method
8548         definition.
8549         (Script_sections::saw_segment_start_expression_): New data member
8550         declaration.
8551         * script.cc (script_saw_segment_start_expression): New function.
8552         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8553         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8554         script_test_7.sh and script_test_8.sh.
8555         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8556         script_test_8.stdout.
8557         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8558         (script_test_6, script_test_6.stdout, script_test_7,
8559         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8560         * Makefile.in: Regenerate.
8561         * testsuite/script_test_6.sh: New file.
8562         * testsuite/script_test_6.t: Same.
8563         * testsuite/script_test_7.sh: Same.
8564         * testsuite/script_test_7.t: Same.
8565         * testsuite/script_test_8.sh: Same.
8566
8567 2009-10-16  Doug Kwan  <dougkwan@google.com>
8568
8569         * output.cc (Output_segment::set_section_list_address): Cast
8570         expressions to unsigned long long type to avoid format warnings.
8571
8572 2009-10-15  Ian Lance Taylor  <iant@google.com>
8573
8574         * script.cc (Script_options::add_symbol_assignment): Always add a
8575         dot assignment to script_sections_.
8576         * script-sections.cc (Script_sections::add_dot_assignment):
8577         Initialize if necessary.
8578
8579         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8580         program headers with no load segment if there is a linker script.
8581
8582         * layout.cc (Layout::set_segment_offsets): Align the file offset
8583         to the segment aligment for -N or -n with no load segment.
8584         * output.cc (Output_segment::add_output_section): Don't crash if
8585         the first section is a TLS section.
8586         (Output_segment::set_section_list_addresses): Print an error
8587         message if the address moves backward in a linker script.
8588         * script-sections.cc
8589         (Output_section_element_input::set_section_addresses): Don't
8590         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8591         (Orphan_output_section::set_section_addresses): Likewise.
8592
8593 2009-10-15  Doug Kwan  <dougkwan@google.com>
8594
8595         * layout.cc (Layout::finish_dynamic_section): Generate tags
8596         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8597         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8598         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8599
8600 2009-10-14  Ian Lance Taylor  <iant@google.com>
8601
8602         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8603         fields.
8604         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8605         data_shdr fields of relinfo.
8606         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8607         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8608         R_386_TLS_LDO_32, adjust based on section flags.
8609         (Target_i386::Relocate::fix_up_ldo): Remove.
8610
8611 2009-10-13  Ian Lance Taylor  <iant@google.com>
8612
8613         Add support for -pie.
8614         * options.h (class General_options): Add -pie and
8615         --pic-executable.
8616         (General_options::output_is_position_independent): Test -pie.
8617         (General_options::output_is_executable): Return true if not shared
8618         and not relocatable.
8619         (General_options::output_is_pie): Remove.
8620         * options.cc (General_options::finalize): Reject incompatible uses
8621         of -pie.
8622         * gold.cc (queue_middle_tasks): A -pie link is not static.
8623         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8624         * symtab.cc (Symbol::final_value_is_known): Return false if
8625         output_is_position_independent.
8626         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8627         output_is_position_independent.
8628         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8629         output_is_position_independent.
8630         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8631         output_is_position_independent.
8632         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8633         two_file_pie_test.
8634         (basic_pie_test.o, basic_pie_test): New targets.
8635         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8636         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8637         (two_file_pie_test): New target.
8638         * testsuite/Makefile.in: Rebuild.
8639         * README: Remove note saying that -pie is not supported.
8640
8641 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8642
8643         * options.h (class General_options): Add -init and -fini.
8644         * layout.cc (Layout::finish_dynamic_section): Emit
8645         given init and fini functions.
8646
8647 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8648
8649         * gc.h (gc_process_relocs): Check if icf is enabled using new
8650         function.
8651         * gold.cc (queue_initial_tasks): Likewise.
8652         (queue_middle_tasks): Likewise.
8653         * object.cc (do_layout): Likewise.
8654         * symtab.cc (is_section_folded): Likewise.
8655         * main.cc (main): Likewise.
8656         * reloc.cc (Read_relocs::run): Likewise.
8657         (Sized_relobj::do_scan_relocs): Likewise.
8658         * icf.cc (is_function_ctor_or_dtor): New function.
8659         (Icf::find_identical_sections): Check if function is ctor or dtor when
8660         safe icf is chosen.
8661         * options.h (General_options::icf): Change option to be an enum.
8662         (Icf_status): New enum.
8663         (icf_enabled): New method.
8664         (icf_safe_folding): New method.
8665         (set_icf_status): New method.
8666         (icf_status_): New variable.
8667         * (options.cc) (General_options::finalize): Set icf_status_.
8668         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8669         icf_test and icf_keep_unique_test to use the --icf enum flag.
8670         * testsuite/icf_safe_test.sh: New file.
8671         * testsuite/icf_safe_test.cc: New file.
8672
8673 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8674
8675         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8676         includes to gc.h and icf.h.
8677         * arm.cc: Include gc.h.
8678         * gold.cc: Likewise.
8679         * i386.cc: Likewise.
8680         * powerpc.cc: Likewise.
8681         * sparc.cc: Likewise.
8682         * x86_64.cc: Likewise.
8683         * gc.h: Include icf.h.
8684
8685 2009-10-11  Ian Lance Taylor  <iant@google.com>
8686
8687         * plugin.cc: Include "gold.h" before other header files.
8688
8689 2009-10-10  Chris Demetriou  <cgd@google.com>
8690
8691         * options.h (Input_file_argument::Input_file_type): New enum.
8692         (Input_file_argument::is_lib_): Replace with...
8693         (Input_file_argument::type_): New member.
8694         (Input_file_argument::Input_file_argument): Take Input_file_type
8695         'type' rather than boolean 'is_lib' as second argument.
8696         (Input_file_argument::is_lib): Use type_.
8697         (Input_file_argument::is_searched_file): New function.
8698         (Input_file_argument::may_need_search): Handle is_searched_file.
8699         * options.cc (General_options::parse_library): Support -l:filename.
8700         (General_options::parse_just_symbols): Update for Input_file_argument
8701         changes.
8702         (Command_line::process): Likewise.
8703         * archive.cc (Archive::get_file_and_offset): Likewise.
8704         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8705         * script.cc (read_script_file, script_add_file): Likewise.
8706         * fileread.cc (Input_file::Input_file): Likewise.
8707         (Input_file::will_search_for): Handle is_searched_file.
8708         (Input_file::open): Likewise.
8709         * readsyms.cc (Read_symbols::get_name): Likewise.
8710         * testsuite/Makefile.am (searched_file_test): New test.
8711         * testsuite/Makefile.in: Regenerate.
8712         * testsuite/searched_file_test.cc: New file.
8713         * testsuite/searched_file_test_lib.cc: New file.
8714
8715 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8716             Ian Lance Taylor  <iant@google.com>
8717
8718         * descriptor.cc: Include <cstdio> and "binary-io.h".
8719         (Descriptors::open): Open the files in binary mode always.
8720         * script.cc (Lex::get_token): Treat \r as whitespace.
8721
8722 2009-10-09  Ian Lance Taylor  <iant@google.com>
8723
8724         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8725
8726 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8727             Ian Lance Taylor  <iant@google.com>
8728
8729         * configure.ac: Check for readv function also.
8730         * fileread.cc (readv): Define if not HAVE_READV.
8731         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8732         does not exist.
8733         * config.in: Regenerate.
8734         * configure: Regenerate.
8735
8736 2009-10-09  Doug Kwan  <dougkwan@google.com>
8737
8738         * layout.cc (Layout::make_output_section): Call target hook to make
8739         ordinary output section.
8740         (Layout::finalize): Adjust parameter list of call the
8741         Target::may_relax().
8742         * layout.h (class Layout::section_list): New method.
8743         * merge.h (Output_merge_base::entsize): Change visibility to public.
8744         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8745         New methods.
8746         (Output_merge_string::do_is_string): New method.
8747         * object.cc (Sized_relobj::do_setup): renamed from
8748         Sized_relobj::set_up.
8749         * object.h (Sized_relobj::adjust_shndx,
8750         Sized_relobj::initializ_input_to_output_maps,
8751         Sized_relobj::free_input_to_output_maps): Change visibilities to
8752         protected.
8753         (Sized_relobj::setup): Virtualize.
8754         (Sized_relobj::do_setup): New method declaration.
8755         (Sized_relobj::invalidate_section_offset,
8756         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8757         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8758         * options.cc (parse_int): New function.
8759         * options.h (parse_int): New declaration.
8760         (DEFINE_int): New macro.
8761         (stub_group_size): New option.
8762         * output.cc (Output_section::Output_section): Initialize memebers
8763         merge_section_map_, merge_section_by_properties_map_,
8764         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8765         (Output_section::add_input_section): Handled deferred code-fill
8766         generation and remove an old comment.
8767         (Output_section::add_relaxed_input_section): New method definition.
8768         (Output_section::add_merge_input_section): Use merge section by
8769         properties map to speed to search.  Update merge section maps
8770         as appropriate.
8771         (Output_section::build_relaxation_map): New method definition.
8772         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8773         Same.
8774         (Output_section::relax_input_section): Renamed to
8775         Output_section::convert_input_sections_to_relaxed_sections and change
8776         interface to take a vector of pointers to relaxed sections.
8777         (Output_section::find_merge_section,
8778         Output_section::find_relaxed_input_section): New method definitions.
8779         (Output_section::is_input_address_mapped,
8780         Output_section::output_offset, Output_section::output_address):
8781         Use output section data maps to speed up searching.
8782         (Output_section::find_starting_output_address): Add comments.
8783         (Output_section::do_write,
8784         Output_section::write_to_postprocessing_buffer): Do code-fill
8785         generation as appropriate.
8786         (Output_section::get_input_sections): Invalidate relaxed input section
8787         map.
8788         (Output_section::restore_states): Adjust type of checkpoint .
8789         Invalidate relaxed input section map.
8790         * output.h (Output_merge_base): New class declaration.
8791         (Input_section_specifier): New class defintion.
8792         (class Output_relaxed_input_section) Change base class to
8793         Output_section_data_build.
8794         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8795         base class initializer.
8796         (Output_section::add_relaxed_input_section): New method declaration.
8797         (Output_section::Input_section): Change visibility to protected.
8798         (Output_section::Input_section::relobj,
8799         Output_section::Input_section::shndx): Handle relaxed input sections.
8800         Output_section::input_sections) Change visibility to protected.  Also
8801         define overload to return a non-const pointer.
8802         (Output_section::Merge_section_properties): New class defintion.
8803         (Output_section::Merge_section_by_properties_map,
8804         Output_section::Output_section_data_by_input_section_map,
8805         Output_section::Relaxation_map): New types.
8806         (Output_section::relax_input_section): Rename method to
8807         Output_section::convert_input_sections_to_relaxed_sections and change
8808         interface to take a vector of relaxed section pointers.
8809         (Output_section::find_merge_section,
8810         Output_section::find_relaxed_input_section,
8811         Output_section::build_relaxation_map,
8812         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8813         New method declarations.
8814         (Output_section::merge_section_map_
8815         Output_section::merge_section_by_properties_map_,
8816         Output_section::relaxed_input_section_map_,
8817         Output_section::is_relaxed_input_section_map_valid_,
8818         Output_section::generate_code_fills_at_write_): New data members.
8819         * script-sections.cc
8820         (Output_section_element_input::set_section_addresses): Call
8821         current_data_size and addralign methods of relaxed input sections.
8822         (Orphan_output_section::set_section_addresses): Call current_data_size
8823         and addralign methods of relaxed input sections.
8824         * symtab.cc (Symbol_table::compute_final_value): Extract template
8825         from the body of Symbol_table::sized_finalize_symbol.
8826         (Symbol_table::sized_finalized_symbol): Call
8827         Symbol_table::compute_final_value.
8828         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8829         (Symbol_table::compute_final_value): New templated method declaration.
8830         * target.cc (Target::do_make_output_section): New method defintion.
8831         * target.h (Target::make_output_section): New method declaration.
8832         (Target::relax): Add more parameters for input objects, symbol table
8833         and layout.  Adjust call to do_relax.
8834         (Target::do_make_output_section): New method declaration.
8835         (Target::do_relax): Add parameters for input objects, symbol table
8836         and layout.
8837
8838 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8839
8840         * pread.c: Include stdio.h.
8841
8842 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8843
8844         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8845         defined.
8846
8847 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8848
8849         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8850         Change read_shndx type to unsigned int.
8851         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8852         int.
8853         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8854         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8855         Change read_shndx type to unsigned int.
8856         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8857         int.
8858         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8859         * layout.cc (Layout::create_symtab_sections): Cast the result of
8860         local_symcount * symsize to off_t in the gold_assert.
8861
8862 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8863
8864         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8865         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8866         R_ARM_BASE_ABS.
8867         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8868         (Arm_relocate_functions::thm_abs5): New function.
8869         (Arm_relocate_functions::abs12): New function.
8870         (Arm_relocate_functions::abs16): New function.
8871         (Arm_relocate_functions::base_abs): New function.
8872         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8873         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8874         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8875         R_ARM_BASE_ABS.
8876         (Scan::global): Likewise.
8877         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8878         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8879         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8880         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8881         R_ARM_BASE_ABS.
8882
8883 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8884
8885         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8886         (Arm_relocate_functions::movt_prel): New function.
8887         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8888         (Arm_relocate_functions::thm_movt_prel): New function.
8889         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8890         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8891         (Scan::global, Relocate::relocate): Likewise.
8892         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8893
8894 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8895
8896         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8897         Incremental_checker.
8898         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8899         unsigned int.
8900         (class Incremental_inputs_header): New class.
8901         (Incremental_inputs_header_writer): Edit comment.
8902         (Incremental_inputs_entry): New class.
8903         (Incremental_inputs_entry_writer): Edit comment.
8904         (Sized_incremental_binary::do_find_incremental_inputs_section):
8905         Add *strtab_shndx parameter, fill it.
8906         (Sized_incremental_binary::do_check_inputs): New method.
8907         (Incremental_checker::can_incrementally_link_output_file): Use
8908         Sized_incremental_binary::check_inputs.
8909         (Incremental_inputs::report_command_line): Save command line in
8910         command_line_.
8911         * incremental.h:
8912         (Incremental_binary::find_incremental_inputs_section): New
8913         method.
8914         (Incremental_binary::do_find_incremental_inputs_section): Add
8915         strtab_shndx parameter.
8916         (Incremental_binary::do_check_inputs): New pure virtual method.
8917         (Sized_incremental_binary::do_check_inputs): Declare.
8918         (Incremental_checker::Incremental_checker): Add incremental_inputs
8919         parameter, use it to initialize incremental_inputs_.
8920         (Incremental_checker::incremental_inputs_): New field.
8921         (Incremental_checker::command_line): New method.
8922         (Incremental_checker::inputs): New method.
8923         (Incremental_checker::command_line_): New field.
8924
8925 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8926
8927         * incremental.cc: Include <cstdarg> and "target-select.h".
8928         (vexplain_no_incremental): New function.
8929         (explain_no_incremental): New function.
8930         (Incremental_binary::error): New method.
8931         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8932         method.
8933         (make_sized_incremental_binary): New function.
8934         (open_incremental_binary): New function.
8935         (can_incrementally_link_file): Add checks if output is ELF and has
8936         inputs section.
8937         * incremental.h: Include "elfcpp_file.h" and "output.h".
8938         (Incremental_binary): New class.
8939         (Sized_incremental_binary): New class.
8940         (open_incremental_binary): Declare.
8941         * object.cc (is_elf_object): Use
8942         elfcpp::Elf_recognizer::is_elf_file.
8943         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8944         * output.h (Output_file::filesize): New method.
8945
8946 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8947
8948         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8949         New function.
8950         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8951         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8952         function.
8953         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8954         function.
8955         (Arm_relocate_functions::movw_abs_nc): New function.
8956         (Arm_relocate_functions::movt_abs): New function.
8957         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8958         (Arm_relocate_functions::thm_movt_abs): New function.
8959         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8960         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8961         (Scan::global): Likewise.
8962         (Relocate::relocate): Likewise.
8963         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8964
8965 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8966
8967         * arm.cc (Arm_relocate_functions::got_prel) New function.
8968         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8969         (Relocate::relocate): Likewise.
8970         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8971
8972 2009-10-06  Ian Lance Taylor  <iant@google.com>
8973
8974         * options.h (class General_options): Define
8975         split_stack_adjust_size parameter.
8976         * object.h (class Object): Add uses_split_stack_ and
8977         has_no_split_stack_ fields.  Add uses_split_stack and
8978         has_no_split_stack accessor functions.  Declare
8979         handle_split_stack_section.
8980         (class Reloc_symbol_changes): Define.
8981         (class Sized_relobj): Define Function_offsets.  Declare
8982         split_stack_adjust, split_stack_adjust_reltype, and
8983         find_functions.
8984         * object.cc (Object::handle_split_stack_section): New function.
8985         (Sized_relobj::do_layout): Call handle_split_stack_section.
8986         * dynobj.cc (Sized_dynobj::do_layout): Call
8987         handle_split_stack_section.
8988         * reloc.cc (Sized_relobj::relocate_sections): Call
8989         split_stack_adjust for executable sections in split_stack
8990         objects.  Pass reloc_map to relocate_section.
8991         (Sized_relobj::split_stack_adjust): New function.
8992         (Sized_relobj::split_stack_adjust_reltype): New function.
8993         (Sized_relobj::find_functions): New function.
8994         * target-reloc.h: Include "object.h".
8995         (relocate_section): Add reloc_symbol_changes parameter.  Change
8996         all callers.
8997         * target.h (class Target): Add calls_non_split method.  Declare
8998         do_calls_non_split virtual method.  Declare match_view and
8999         set_view_to_nop.
9000         * target.cc: Include "elfcpp.h".
9001         (Target::do_calls_non_split): New function.
9002         (Target::match_view): New function.
9003         (Target::set_view_to_nop): New function.
9004         * gold.cc (queue_middle_tasks): Give an error if mixing
9005         split-stack and non-split-stack objects with -r.
9006         * i386.cc (Target_i386::relocate_section): Add
9007         reloc_symbol_changes parameter.
9008         (Target_i386::do_calls_non_split): New function.
9009         * x86_64.cc (Target_x86_64::relocate_section): Add
9010         reloc_symbol_changes parameter.
9011         (Target_x86_64::do_calls_non_split): New function.
9012         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9013         parameter.
9014         * powerpc.cc (Target_powerpc::relocate_section): Add
9015         reloc_symbol_changes parameter.
9016         * sparc.cc (Target_sparc::relocate_section): Add
9017         reloc_symbol_changes parameter.
9018         * configure.ac: Call AM_CONDITIONAL for the default target.
9019         * configure: Rebuild.
9020         * testsuite/Makefile.am (TEST_AS): New variable.
9021         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9022         (check_DATA): Add split_i386 and split_x86_64 files.
9023         (SPLIT_DEFSYMS): Define.
9024         (split_i386_[1234n].o): New targets.
9025         (split_i386_[124]): New targets.
9026         (split_i386_[1234r].stdout): New targets.
9027         (split_x86_64_[1234n].o): New targets.
9028         (split_x86_64_[124]): New targets.
9029         (split_x86_64_[1234r].stdout): New targets.
9030         (MOSTLYCLEANFILES): Add new executables.
9031         * testsuite/split_i386.sh: New file.
9032         * testsuite/split_x86_64.sh: New file.
9033         * testsuite/split_i386_1.s: New file.
9034         * testsuite/split_i386_2.s: New file.
9035         * testsuite/split_i386_3.s: New file.
9036         * testsuite/split_i386_4.s: New file.
9037         * testsuite/split_i386_n.s: New file.
9038         * testsuite/split_x86_64_1.s: New file.
9039         * testsuite/split_x86_64_2.s: New file.
9040         * testsuite/split_x86_64_3.s: New file.
9041         * testsuite/split_x86_64_4.s: New file.
9042         * testsuite/split_x86_64_n.s: New file.
9043         * testsuite/testfile.cc (Target_test): Update relocation_section
9044         function.
9045         * testsuite/Makefile.in: Rebuild.
9046
9047 2009-10-06  Ian Lance Taylor  <iant@google.com>
9048
9049         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9050         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9051         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9052         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9053         the address on ldo_addrs_.
9054         (Target_i386::Relocate::fix_up_ldo): New function.
9055
9056 2009-10-06   Rafael Espindola  <espindola@google.com>
9057
9058         * plugin.cc (add_input_library): New.
9059         (Plugin::load): Add add_input_library to tv.
9060         (Plugin_manager::add_input_file): Add the is_lib argument.
9061         (add_input_file): Update call to Plugin_manager::add_input_file.
9062         (add_input_library): New.
9063         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9064
9065 2009-09-30  Doug Kwan  <dougkwan@google.com>
9066
9067         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9068         symbol and call Symbol::may_need_copy_reloc to determine if
9069         a copy reloc is needed.
9070         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9071         nocopyreloc is given in command line.
9072         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9073         given in command line.
9074         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9075         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9076         of the removed Target_i386::may_need_copy_reloc.
9077         * options.h (copyreloc): New option with default value false.
9078         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9079         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9080         instead of the removed Target_powerpc::may_need_copy_reloc.
9081         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9082         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9083         instead of the removed Target_sparc::may_need_copy_reloc.
9084         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9085         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9086         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9087         instead of the removed Target_x86_64::may_need_copy_reloc.
9088
9089 2009-09-30  Ian Lance Taylor  <iant@google.com>
9090
9091         * object.h (class Object): Remove target_ field, and target,
9092         sized_target, and set_target methods.
9093         (Object::sized_target): Remove.
9094         (class Sized_relobj): Update declarations.  Remove sized_target.
9095         * object.cc (Sized_relobj::setup): Remove target parameter.
9096         Change all callers.
9097         (Input_objects::add_object): Don't do anything with the target.
9098         (make_elf_sized_object): Add punconfigured parameter.  Change all
9099         callers.  Set or test parameter target.
9100         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9101         Change all callers.
9102         * parameters.cc (Parameters::set_target): Change parameter type to
9103         be non-const.
9104         (Parameters::default_target): Remove.
9105         (set_parameters_target): Change parameter type to be non-const.
9106         (parameters_force_valid_target): New function.
9107         (parameters_clear_target): New function.
9108         * parameters.h (class Parameters): Update declarations.  Remove
9109         default_target method.  Add sized_target and clear_target
9110         methods.  Change target_ to be non-const.
9111         (set_parameters_target): Update declaration.
9112         (parameters_force_valid_target): Declare.
9113         (parameters_clear_target): Declare.
9114         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9115         as NULL if we aren't searching.
9116         (Add_symbols::run): Don't check for compatible target.
9117         * fileread.cc (Input_file::open_binary): Call
9118         parameters_force_valid_target.
9119         * gold.cc (queue_middle_tasks): Likewise.
9120         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9121         set_target on object.
9122         * dynobj.h (class Sized_dynobj): Update declarations.
9123         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9124         make_elf_object returns NULL.
9125         (Archive::include_member): Don't check whether object target is
9126         compatible.
9127         * output.cc (Output_section::add_input_section): Get target from
9128         parameters.
9129         (Output_section::relax_input_section): Likewise.
9130         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9131         parameters.
9132         (Sized_relobj::do_scan_relocs): Likewise.
9133         (Sized_relobj::relocate_sections): Likewise.
9134         * resolve.cc (Symbol_table::resolve): Likewise.
9135         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9136         parameter.  Change all callers.
9137         (Symbol_table::add_from_object): Get target from parameters.
9138         (Symbol_table::add_from_relobj): Don't check object target.
9139         (Symbol_table::add_from_dynobj): Likewise.
9140         (Symbol_table::define_special_symbol): Get target from
9141         parameters.
9142         * symtab.h (class Symbol_table): Update declaration.
9143         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9144         parameter.  Change all callers.  Clear parameter target.
9145         (Binary_test): Test target here.
9146         * testsuite/object_unittest.cc (gold_testsuite): Remove
9147         target_test_pointer parameter.  Change all callers.
9148         (Object_test): Test target here.
9149
9150 2009-09-26  Ian Lance Taylor  <iant@google.com>
9151
9152         * testsuite/initpri1.c: Don't try to use constructor priorities if
9153         compiling with gcc before 4.3.
9154
9155 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9156
9157         * testsuite/retain_symbols_file_test.sh (check_present): Change
9158         output file name to retain_symbols_file_test.stdout.
9159         (check_absent): Likewise.
9160
9161 2009-09-18  Craig Silverstein  <csilvers@google.com>
9162
9163         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9164         * options.cc: Include <cerrno> and <fstream>.
9165         (General_options::finalize): Parse -retain-symbols-file tag.
9166         * options.h: New flag.
9167         (General_options): New method should_retain_symbol, new
9168         variable symbols_to_retain.
9169         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9170         should_retain_symbol map.
9171         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9172         * testsuite/Makefile.in: Regenerate.
9173         * testsuite/retain_symbols_file_test.sh: New file.
9174
9175 2009-09-18  Nick Clifton  <nickc@redhat.com>
9176
9177         * po/es.po: Updated Spanish translation.
9178
9179 2009-09-17  Doug Kwan  <dougkwan@google.com>
9180
9181         * debug.h (DEBUG_RELAXATION): New constant.
9182         (DEBUG_ALL): Add DEBUG_RELAXATION.
9183         (debug_string_to_enum): Add relaxation debug option.
9184         * layout.cc
9185         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9186         Layout::Relaxation_debug_check::read_sections,
9187         Layout::Relaxation_debug_check::read_sections): New method definitions.
9188         (Layout::Layout): Initialize data members
9189         record_output_section_data_from_scrips_,
9190         script_output_section_data_list_ and relaxation_debug_check_.
9191         (Layout::save_segments, Layout::restore_segments,
9192         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9193         Layout::relaxation_loop_body): New method definitions.
9194         (Layout::finalize): Support relaxation.  Move section layout code to
9195         Layout::relaxation_loop_body.
9196         (Layout::set_asection_address_from_script): Move code for orphan
9197         section placement out.
9198         (Layout::place_orphan_sections_in_script): New method definition.
9199         * layout.h (Output_segment_headers, Output_file_header):
9200         New forward class declarations.
9201         (Layout::~Layout): Define.
9202         (Layout::new_output_section_data_from_script): New method definition.
9203         (Layout::place_orphan_sections_in_script): New method declaration.
9204         (Layout::Segment_states): New type declaration.
9205         (Layout::save_segments, Layout::restore_segments,
9206         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9207         Layout::relaxation_loop_body): New method declarations.
9208         (Layout::Output_section_data_list): New type declaration.
9209         (Layout::Relaxation_debug_check): New class definition.
9210         (Layout::record_output_section_data_from_script_,
9211         Layout::script_output_section_data_list_, Layout::segment_states_,
9212         Layout::relaxation_debug_check_): New data members.
9213         * output.cc: (Output_section_headers::do_size): New method definition.
9214         (Output_section_headers::Output_section_headers): Move size
9215         computation to Output_section_headers::do_size.
9216         (Output_segment_headers::do_size): New method definition.
9217         (Output_file_header::Output_file_header): Move size computation to
9218         Output_file_header::do_size and call it.
9219         (Output_file_header::do_size): New method definition.
9220         (Output_data_group::Output_data_group): Adjust call to
9221         Output_section_data.
9222         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9223         (Output_symtab_xindex::do_write): Add array bound check.
9224         (Output_section::Input_section::print_to_mapfile): Handle
9225         RELAXED_INPUT_SECTION_CODE.
9226         (Output_section::Output_section): Initialize data member checkpoint_.
9227         (Output_section::~Output_section): Delete checkpoint object pointed
9228         by checkpoint_.
9229         (Output_section::add_input_section): Always add an Input_section if
9230         relaxing.
9231         (Output_section::add_merge_input_section): Add assert.
9232         (Output_section::relax_input_section): New method definition.
9233         (Output_section::set_final_data_size): Set load address to zero for
9234         an unallocated section.
9235         (Output_section::do_address_and_file_offset_have_reset_values):
9236         New method definition.
9237         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9238         Handle relaxed input section.
9239         (Output_section::sort_attached_input_sections): Checkpoint input
9240         section list lazily.
9241         (Output_section::get_input_sections): Change type of input_sections to
9242         list of Simple_input_section pointers.  Checkpoint input section list
9243         lazily.  Also handle relaxed input sections.
9244         (Output_section::add_input_section_for_script): Take a reference to
9245         a Simple_input_section object instead of Relobj pointer and section
9246         index as parameter.  Handle relaxed input sections.
9247         (Output_section::save_states, Output_section::restore_states): New
9248         method definitions.
9249         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9250         (Output_data::is_data_size_fixed): New method definition.
9251         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9252         if it is fixed.
9253         (Output_data::address_and_file_offset_have_reset_values): New method
9254         definition.
9255         (Output_data::do_address_and_file_offset_have_reset_values): New method
9256         definition.
9257         (Output_data::set_data_size): Check that data size is not fixed.
9258         (Output_data::fix_data_size): New method definition.
9259         (Output_data::is_data_size_fixed_): New data member.
9260         (Output_section_headers::set_final_data_size): New method definition.
9261         (Output_section_headers::do_size): New method declaration.
9262         (Output_segment_headers::set_final_data_size): New method definition.
9263         (Output_segment_headers::do_size): New method declaration.
9264         (Output_file_header::set_final_data_size)::New method definition.
9265         (Output_file_header::do_size)::New method declaration.
9266         (Output_section_data::Output_section_data): Add new parameter
9267         is_data_size_fixed and use it to fix data size.
9268         (Output_data_const::Output_data_const): Adjust call to base class
9269         constructor and fix data size.
9270         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9271         base class constructor and fix data size.
9272         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9273         base class constructor and fix data size.
9274         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9275         class constructor and fix data size.
9276         (Output_data_group::set_final_data_size): New method definition.
9277         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9278         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9279         class constructor and fix data size.
9280         (Output_relaxed_input_section): New class definition.
9281         (Output_section::Simple_input_section): New class definition.
9282         (Output_section::get_input_sections): Adjust parameter list.
9283         (Output_section::add_input_section_for_script): Same.
9284         (Output_section::save_states, Output_section::restore_states,
9285         Output_section::do_address_and_file_offset_have_reset_values,
9286         (Output_section::Input_section::Input_section): Handle
9287         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9288         Output_relaxed_input_section.
9289         (Output_section::Input_section::is_input_section,
9290         Output_section::Input_section::set_output_section): Handle relaxed
9291         input section.
9292         (Output_section::Input_section::is_relaxed_input_section,
9293         Output_section::Input_section::output_section_data,
9294         Output_section::Input_section::relaxed_input_section): New method
9295         definitions.
9296         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9297         value.
9298         (Output_section::Input_section::u1_): Update comments.
9299         (Output_section::Input_section::u2_): Add new union member poris.
9300         (Output_section::Checkpoint_output_section): New classs definition.
9301         (Output_section::relax_input_section): New method declaration.
9302         (Output_section::checkpoint_): New data member.
9303         (Output_segment): Update comments.
9304         (Output_segment::Output_segment): Un-privatize copy constructor.
9305         (Output_segment::operator=): Un-privatize.
9306         * script-sections.cc (Output_section_element::Input_section_list):
9307         Change element type to Output_section::Simple_input_section.
9308         (Output_section_element_dot_assignment::set_section_addresses):
9309         Register output section data for relaxation clean up.
9310         (Output_data_exression::Output_data_expression): Adjust call to base
9311         constructor to fix data size.
9312         (Output_section_element_data::set_section_addresses): Register
9313         Output_data_expression object for relaxation clean up.
9314         (struct Input_section_info): Replace Relobj pointer and section index
9315         pair with Output_section::Simple_input_section and Convert struct to a
9316         class.
9317         (Input_section_sorter::operator()): Adjust access to
9318         Input_section_info data member to use accessors.
9319         (Output_section_element_input::set_section_addresses): Use layout
9320         parameter.  Adjust code to use Output_section::Simple_input_section
9321         and Input_secction_info classes.  Register filler for relaxation
9322         clean up.
9323         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9324         and section index pair with Output_section::Simple_input_section
9325         class.  Adjust code accordingly.
9326         (Phdrs_element::release_segment): New method definition.
9327         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9328         segment list.
9329         (Script_sections::release_segments): New method definition.
9330         * gold/script-sections.h (Script_sections::release_segments): New
9331         method declaration.
9332         * gold/target.h (Target::may_relax, Target::relax,
9333         Target::do_may_relax, Target::do_relax): New method definitions.
9334
9335 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9336
9337         * arm.cc (has_signed_unsigned_overflow): New function.
9338         (Arm_relocate_functions::abs8): New function.
9339         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9340         (Target_arm::Scan::global): Likewise.
9341         (Target_arm::relocate::relocate): Likewise.
9342         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9343         Likewise.
9344
9345 2009-09-16  Cary Coutant  <ccoutant@google.com>
9346
9347         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9348         * testsuite/Makefile.in: Regenerate.
9349
9350 2009-09-11  Nick Clifton  <nickc@redhat.com>
9351
9352         * po/gold.pot: Updated by the Translation project.
9353
9354 2009-09-08  Cary Coutant  <ccoutant@google.com>
9355
9356         * output.cc (Output_file::open): Add execute permission to empty file.
9357         * testsuite/Makefile.am (permission_test): New test.
9358         * testsuite/Makefile.in: Regenerate.
9359
9360 2009-09-02  Ian Lance Taylor  <iant@google.com>
9361
9362         * output.cc (Output_file::resize): Call map_no_anonymous rather
9363         than map.
9364
9365 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9366
9367         * gold.cc: Include "incremental.h".
9368         (queue_initial_tasks): Call Incremental_checker methods.
9369         * incremental.cc: Include "output.h".
9370         (Incremental_checker::can_incrementally_link_output_file): New
9371         method.
9372         * incremental.h (Incremental_checker): New class.
9373
9374         * output.cc (Output_file::open_for_modification): New method.
9375         (Output_file::map_anonymous): Changed return type to bool.  Record
9376         map in base_ field.
9377         (Output_file::map_no_anonymous): New method, broken out of map.
9378         (Output_file::map): Use map_no_anonymous and map_anonymous.
9379         * output.h (class Output_file): Update declarations.
9380
9381 2009-08-24  Cary Coutant  <ccoutant@google.com>
9382
9383         * options.h (Command_line::Pre_options): New class.
9384         (Command_line::pre_options): New member.
9385         * options.cc (gold::options::ready_to_register): New variable.
9386         (One_option::register_option): Do nothing if not registering options.
9387         Assert if same short option registered twice.
9388         (General_options::General_options): Turn off option registration when
9389         done constructing.
9390         (Command_line::Pre_options::Pre_options): New constructor.
9391
9392 2009-08-24  Cary Coutant  <ccoutant@google.com>
9393
9394         * options.h (General_options::no_keep_memory): Remove incorrect
9395         short option.
9396
9397 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9398
9399         * Makefile.am (am__skiplex, am__skipyacc): New.
9400         * Makefile.in: Regenerate.
9401
9402 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9403
9404         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9405         (INCLUDES): ... this.
9406         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9407         (AM_CPPFLAGS): Renamed from ...
9408         (INCLUDE): ... this.
9409         * Makefile.in, testsuite/Makefile.in: Regenerate.
9410
9411         * Makefile.in: Regenerate.
9412         * aclocal.m4: Likewise.
9413         * config.in: Likewise.
9414         * configure: Likewise.
9415         * testsuite/Makefile.in: Likewise.
9416
9417         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9418         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9419         * Makefile.in: Regenerate.
9420         * testsuite/Makefile.in: Regenerate.
9421
9422 2009-08-19  Cary Coutant  <ccoutant@google.com>
9423
9424         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9425         symbols in shared libraries overridden by hidden or internal symbols
9426         in the main program.
9427
9428 2009-08-19  Chris Demetriou  <cgd@google.com>
9429
9430         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9431         checking source file names in error messages.
9432
9433 2009-08-18  Doug Kwan  <dougkwan@google.com>
9434
9435         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9436         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9437         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9438         an elfcpp::Ehdr as parameter.
9439         * object.cc (Object::set_target): Remove the version that looks up
9440         a target and sets it.
9441         (Sized_relobj::setup): Take a Target object instead of
9442         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9443         (make_elf_sized_object): Find target and ask target to
9444         make an ELF object.
9445         * object.h: (Object::set_target): Remove the version that looks up
9446         a target and sets it.
9447         (Sized_relobj::setup): Take a Target object instead of
9448         an elfcpp:Ehdr as parameter.
9449         * target.cc: Include dynobj.h.
9450         (Target::do_make_elf_object_implementation): New.
9451         (Target::do_make_elf_object): New.
9452         * target.h (Target::make_elf_object): New template declaration.
9453         (Target::do_make_elf_object): New method declarations.
9454         (Target::do_make_elf_object_implementation): New template declaration.
9455
9456 2009-08-14  Ian Lance Taylor  <iant@google.com>
9457
9458         * gold.h (FUNCTION_NAME): Define.
9459         (gold_unreachable): Use FUNCTION_NAME.
9460
9461 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9462
9463         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9464         symbol in the --keep-unique list is not found.
9465
9466 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9467
9468         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9469         been maked as --keep-unique.
9470         (Icf::unfold_section): New function.
9471         * icf.h (Icf::unfold_section): New function.
9472         * options.h (General_options::keep_unique): New option.
9473         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9474         * testsuite/Makefile.in: Regenerate.
9475         * testsuite/icf_keep_unique_test.sh: New file.
9476         * testsuite/icf_keep_unique_test.cc: New file.
9477
9478 2009-08-12  Cary Coutant  <ccoutant@google.com>
9479
9480         PR 10471
9481         * resolve.cc (Symbol_table::resolve): Check for references from
9482         dynamic objects to hidden and internal symbols.
9483         * testsuite/Makefile.am (hidden_test.sh): New test.
9484         * testsuite/Makefile.in: Regenerate.
9485         * testsuite/hidden_test.sh: New script.
9486         * testsuite/hidden_test_1.c: New test source.
9487         * testsuite/hidden_test_main.c: New test source.
9488
9489 2009-08-11  Doug Kwan  <dougkwan@google.com>
9490
9491         * arm.cc: Update comments.
9492         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9493         segment to locate the .ARM.exidx section if present.
9494
9495 2009-08-09  Doug Kwan  <dougkwan@google.com>
9496
9497         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9498         patch.
9499
9500 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9501         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9502         compiler warnings.
9503
9504 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9505
9506         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9507         valid tls_segment only for non-debug-section relocations.
9508         * testsuite/Makefile.am: Add gc_tls_test.
9509         * testsuite/Makefile.in: Regenerate.
9510         * testsuite/gc_tls_test.cc: New file.
9511         * testsuite/gc_tls_test.sh: New file.
9512
9513 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9514
9515         * icf.cc: New file.
9516         * icf.h: New file.
9517         * Makefile.am (CCFILES): Add icf.cc.
9518         (HFILES): Add icf.h
9519         * Makefile.in: Regenerate.
9520         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9521         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9522         section, symbol and addend information for the relocs.
9523         * gold.cc (queue_middle_tasks): Call identical code folding.
9524         * gold.h: Add defines for multimap.
9525         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9526         to the call of finalize_local_symbols.
9527         * main.cc (main): Create object of class Icf.
9528         * object.cc (Sized_relobj::do_layout): Allow this function to be
9529         called twice during icf.
9530         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9531         to sections marked as identical by icf.
9532         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9533         when available.
9534         (Sized_relobj::do_section_entsize): New function.
9535         * object.h (Object::section_entsize): New function.
9536         (Object::do_section_entsize): New pure virtual function.
9537         (Relobj::finalize_local_symbols): Add new parameter.
9538         (Relobj::do_section_entsize): New function.
9539         * options.h (General_options::icf): New option.
9540         (General_options::icf_iterations): New option.
9541         (General_options::print_icf_sections): New option.
9542         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9543         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9544         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9545         icf.
9546         * symtab.cc (Symbol_table::is_section_folded): New function.
9547         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9548         to sections marked as identical by icf.
9549         * symtab.h (Symbol_table::set_icf): New function.
9550         (Symbol_table::icf): New function.
9551         (Symbol_table::is_section_folded): New function.
9552         (Symbol_table::icf_): New data member.
9553         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9554         * testsuite/Makefile.am: Add commands to build icf_test.
9555         * testsuite/Makefile.in: Regenerate.
9556         * testsuite/icf_test.sh: New file.
9557         * testsuite/icf_test.cc: New file.
9558
9559 2009-07-24  Chris Demetriou  <cgd@google.com>
9560
9561         * layout.cc (is_compressible_debug_section): Fix incorrect
9562         comment about compressed section names.
9563
9564 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9565
9566         PR 10419
9567         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9568
9569 2009-07-16  Ian Lance Taylor  <iant@google.com>
9570
9571         PR 10400
9572         * layout.h: #include <map>.
9573         (class Kept_section): Change from struct to class.  Add accessors
9574         and setters.  Add section size to Comdat_group mapping.  Change
9575         Comdat_group to std::map.  Add is_comdat_ field.  Add
9576         linkonce_size field in union.
9577         (class Layout): Update declaration of find_or_add_kept_section.
9578         Don't declare find_kept_object.
9579         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9580         parameter.  Add object, shndx, is_comdat, and is_group_name
9581         parameters.  Change all callers.  Adjust for new Kept_section.
9582         (Layout::find_kept_object): Remove.
9583         * object.cc (Sized_relobj::include_section_group): Update use of
9584         Kept_section.  Rename secnum to shndx.  Only record
9585         Kept_comdat_section if sections are the same size.
9586         (Sized_relobj::include_linkonce_section): Update use of
9587         Kept_section.  Only record Kept_comdat_section if sections are the
9588         same size.  Set size of linkonce section.
9589         (Sized_relobj::map_to_kept_section): Update call to
9590         get_kept_comdat_section.
9591         * object.h (class Sized_relobj): Rename fields in
9592         Kept_comdat_section to drop trailing underscores; change object
9593         field to Relobj*.  Change Kept_comdat_section_table to store
9594         struct rather than pointer.
9595         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9596         Add kept_object and kept_shndx parameters.  Change all callers.
9597         (Sized_relobj::get_kept_comdat_section): Change return type to
9598         bool.  Add kept_object and kept_shndx parameters.  Change all
9599         callers.
9600         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9601         Layout::find_or_add_kept_section.
9602
9603 2009-07-09  Ian Lance Taylor  <iant@google.com>
9604
9605         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9606         Reserve space in the hash table.
9607
9608 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9609
9610         * fileread.cc (File_read::get_mtime): New method.
9611         * fileread.h (Timespec): New structure.
9612         (File_read::get_mtime): New method.
9613         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9614         Renamed from timestamp_nsec.
9615         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9616         Elf_Xword.
9617         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9618         timestamp_nsec.
9619         (Incremental_inputs::report_archive): Save mtime; style fix.
9620         (Incremental_inputs::report_obejct): Save mtime; style fix.
9621         (Incremental_inputs::report_script): Save mtime; style fix.
9622         (Incremental_inputs::finalize_inputs): Style fix.
9623         (Incremental_inputs::finalize): Style fix.
9624         (Incremental_inputs::create_input_section_data): Store inputs
9625         mtime.
9626         * incremental.h (Incremental_inputs::report_script): Add mtime
9627         argument.
9628         (Incremental_inputs::Input_info::Input_info): Intialize only one
9629         union member.
9630         (Incremental_inputs::Input_info::archive): Move to nameless
9631         union.
9632         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9633         (Incremental_inputs::Input_info::script): Move to nameless union.
9634         (Incremental_inputs::mtime): New field.
9635         * script.cc (read_input_script): Pass file mtime to
9636         Incremental_input.
9637         * script.h (Script_info::inputs): Style fix.
9638
9639 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9640
9641         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9642         instead of 32.
9643
9644 2009-06-24  Ian Lance Taylor  <iant@google.com>
9645
9646         PR 10156
9647         * layout.cc (Layout::choose_output_section): If we find an
9648         existing section, update the flags.
9649         (Layout::create_notes): New function, broken out of
9650         Layout::finalize.
9651         (Layout::finalize): Don't create note sections.
9652         (Layout::create_note): Don't crash if linker script discards
9653         section.
9654         (Layout::create_gold_note): Likewise.
9655         (Layout::create_build_id): Likewise.  Don't set
9656         after_input_sections on the section.
9657         (Layout::create_executable_stack_info): Remove target parameter.
9658         Change caller.
9659         * layout.h (class Layout): Declare create_notes.  Update
9660         declaration of create_executable_stack_info.
9661         * gold.cc (queue_middle_tasks): Call create_notes.
9662         * output.cc (Output_section::update_flags_for_input_section): Move
9663         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9664         invalid.
9665         * output.h (Output_data::mark_address_invalid): New function.
9666         (class Output_section): Only declare, not define,
9667         update_flags_for_input_section.  Remove set_flags.
9668
9669 2009-06-24  Ian Lance Taylor  <iant@google.com>
9670
9671         * script-sections.cc (Output_section_definition::
9672         set_section_addresses): Rename shadowing local load_address to
9673         laddr.
9674
9675 2009-06-24  Ian Lance Taylor  <iant@google.com>
9676
9677         PR 10244
9678         * reloc.cc (relocate_sections): Skip empty relocation sections.
9679
9680 2009-06-23  Ian Lance Taylor  <iant@google.com>
9681
9682         PR 10156
9683         * layout.cc (Layout::create_note): Use choose_output_section
9684         rather than make_output_section.
9685
9686 2009-06-23  Ian Lance Taylor  <iant@google.com>
9687
9688         PR 10237
9689         * options.cc (General_options::parse_V): Set printed_version_.
9690         (General_options::General_options): Initialize printed_version_.
9691         * options.h (class General_options): Add printed_version_ field.
9692         * gold.cc (queue_initial_tasks): If there are no input files,
9693         don't give a fatal error if we printed the version information.
9694         (queue_middle_tasks): If using -r with a shared object, give a
9695         fatal error rather than an ordinary error.
9696
9697 2009-06-23  Ian Lance Taylor  <iant@google.com>
9698
9699         PR 10219
9700         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9701         (Layout::make_output_section): Set have_stabstr_section_ if we see
9702         a .stab*str section.
9703         (Layout::finalize): Call link_stabs_sections.
9704         (Layout::link_stabs_sections): New file.
9705         * layout.h (class Layout): Add have_stabstr_section_ field.
9706         Declare link_stabs_sections.
9707
9708 2009-06-23  Doug Kwan  <dougkwan@google.com>
9709
9710         * Makefile.am (libgold_a_LIBADD): New.
9711         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9712         * Makefile.in: Regenerate.
9713         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9714         * configure: Regenerate.
9715         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9716         * fileread.cc: Include sys/state.h
9717         * gold.h: Declare memmem and strndup if found missing.
9718         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9719
9720 2009-06-23  Ian Lance Taylor  <iant@google.com>
9721
9722         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9723         * configure: Rebuild.
9724
9725 2009-06-23  Ian Lance Taylor  <iant@google.com>
9726
9727         PR 10147
9728         * object.cc (Object::section_contents): Don't try to get a view if
9729         the section has length zero.
9730         (Object::handle_gnu_warning_section): If the section is empty, use
9731         the name of the section as the warning.
9732
9733 2009-06-23  Ian Lance Taylor  <iant@google.com>
9734
9735         PR 10133
9736         * stringpool.h (class Stringpool_template): Add optimize_ field.
9737         (Stringpool_template::set_optimize): New function.
9738         * stringpool.cc (Stringpool_template::Stringpool_template):
9739         Initialize optimize_ field.
9740         (Stringpool_template::set_string_offsets): Test local optimize
9741         fild rather than parameter.
9742         * layout.cc (Layout::Layout): Call set_optimize on the section
9743         name stringpool.
9744
9745 2009-06-22  Ian Lance Taylor  <iant@google.com>
9746
9747         PR 10030
9748         * yyscript.y: Parse TARGET.
9749         * script.cc (script_set_target): New function.
9750         * script-c.h (script_set_target): Declare.
9751         * options.cc (General_options::string_to_object_format): Rename
9752         from string_to_object_format in anonymous namespace.  Change
9753         callers.
9754         * options.h (class General_options): Declare
9755         string_to_object_format.
9756
9757 2009-06-22  Ian Lance Taylor  <iant@google.com>
9758
9759         * script-sections.cc (Script_sections::create_segments): Don't put
9760         program headers in a PT_LOAD segment if -n or -N.
9761
9762 2009-06-22  Ian Lance Taylor  <iant@google.com>
9763
9764         PR 10141
9765         * options.h (class General_options): Add -z lazy and -z now.  Sort
9766         -z options into alphabetical order.
9767         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9768
9769 2009-06-21  Ian Lance Taylor  <iant@google.com>
9770
9771         * layout.cc (Layout::make_output_section): Call
9772         Target::new_output_section.
9773         (Layout::attach_allocated_section_to_segment): Put large section
9774         sections in a separate load segment with the large segment flag
9775         set.
9776         (Layout::segment_precedes): Sort large data segments after other
9777         load segments.
9778         (align_file_offset): New static function.
9779         (Layout::set_segment_offsets): Use align_file_offset.
9780         * output.h (class Output_section): Add is_small_section_ and
9781         is_large_section_ fields.
9782         (Output_section::is_small_section): New function.
9783         (Output_section::set_is_small_section):  New function.
9784         (Output_section::is_large_section): New function.
9785         (Output_section::set_is_large_section): New function.
9786         (Output_section::is_large_data_section): New function.
9787         (class Output_segment): Add is_large_data_segment_ field.
9788         (Output_segment::is_large_data_segment): New function.
9789         (Output_segment::set_is_large_data_segment): New function.
9790         * output.cc (Output_section::Output_section): Initialize new
9791         fields.
9792         (Output_segment::Output_segment): Likewise.
9793         (Output_segment::add_output_section): Add assertion that large
9794         data sections always go in large data segments.  Force small data
9795         sections to the end of the list of data sections.  Force small BSS
9796         sections to the start of the list of BSS sections.  For large BSS
9797         sections to the end of the list of BSS sections.
9798         * symtab.h (class Symbol): Declare is_common_shndx.
9799         (Symbol::is_defined): Check Symbol::is_common_shndx.
9800         (Symbol::is_common): Likewise.
9801         (class Symbol_table): Define enum Commons_section_type.  Update
9802         declarations.  Add small_commons_ and large_commons_ fields.
9803         * symtab.cc (Symbol::is_common_shndx): New function.
9804         (Symbol_table::Symbol_table): Initialize new fields.
9805         (Symbol_table::add_from_object): Put small and large common
9806         symbols in the right list.
9807         (Symbol_table::sized_finalized_symbol): Check
9808         Symbol::is_common_shndx.
9809         (Symbol_table::sized_write_globals): Likewise.
9810         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9811         common symbol lists.  Don't call do_allocate_commons_list if the
9812         list is empty.
9813         (Symbol_table::do_allocate_commons_list): Remove is_tls
9814         parameter.  Add comons_section_type parameter.  Change all
9815         callers.  Handle small and large common symbols.
9816         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9817         Symbol::is_common_shndx.
9818         * resolve.cc (symbol_to_bits): Likewise.
9819         * target.h (Target::small_common_shndx): New function.
9820         (Target::small_common_section_flags): New function.
9821         (Target::large_common_shndx): New function.
9822         (Target::large_common_section_flags): New function.
9823         (Target::new_output_section): New function.
9824         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9825         small_common_section_flags, and large_common_section_flags
9826         fields.
9827         (Target::do_new_output_section): New virtual function.
9828         * arm.cc (Target_arm::arm_info): Initialize new fields.
9829         * i386.cc (Target_i386::i386_info): Likewise.
9830         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9831         Likewise.
9832         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9833         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9834         (Target_x86_64::do_new_output_section): New function.
9835         * configure.ac: Define conditional MCMODEL_MEDIUM.
9836         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9837         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9838         (large_LDFLAGS): Define.
9839         * testsuite/large.c: New file.
9840         * testsuite/testfile.cc (Target_test::test_target_info):
9841         Initialize new fields.
9842         * configure, testsuite/Makefile.in: Rebuild.
9843
9844 2009-06-05  Doug Kwan  <dougkwan@google.com>
9845
9846         * Makefile.am (CCFILES): Add target.cc.
9847         * Makefile.in: Regenerate.
9848         * i386.cc (class Target_i386): Define new virtual method to
9849         override do_is_local_label_name in parent.
9850         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9851         local symbols if --discard-locals or -X is given.
9852         * options.h (class General_options): Declare new options
9853         '--discard-locals' and '-X' for discarding locals.
9854         * target.h (class Target): Define new methods is_local_label_name.
9855         Declare new virtual method do_is_local_label_name.
9856         * target.cc: New file.
9857         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9858         (check_SCRIPTS): Add discard_locals_test.sh.
9859         (check_DATA): Add discard_local_tests.syms.
9860         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9861         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9862         * testsuite/Makefile.in: Regenerate.
9863         * testsuite/discard_locals_test.c: New file.
9864         * testsuite/discard_locals_test.sh: Same.
9865
9866 2009-06-05  Doug Kwan  <dougkwan@google.com>
9867
9868         * object.cc (Sized_relobj::Sized_relobj): Initialize
9869         discarded_eh_frame_shndx_ to -1U.
9870         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9871         section.
9872         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9873         a discarded .eh_frame section.
9874         (Sized_relobj::do_finalize_local_symbols): Ditto.
9875         * object.h (class Sized_relobj): Declare new member
9876         discarded_eh_frame_shndx_.
9877         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9878         (local_labels_test.o, local_labels_test): New rules.
9879         * testsuite/Makefile.in: Regenerate.
9880
9881 2009-06-04  Doug Kwan  <dougkwan@google.com>
9882
9883         * layout.cc (Layout::section_name_mapping): Add mapping for
9884         special ARM sections.
9885
9886 2009-06-03  Doug Kwan  <dougkwan@google.com>
9887
9888         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9889         (utils::has_overflow): Same.
9890
9891 2009-06-03  Ian Lance Taylor  <iant@google.com>
9892
9893         * layout.cc (Layout::section_name_mapping): New array, replacing
9894         Layout::linkonce_mapping.
9895         (Layout::section_name_mapping_count): New variable, replacing
9896         Layout::linkonce_mapping_count.
9897         (Layout::linkonce_output_name): Remove.
9898         (Layout::output_section_name): Rewrite.
9899         * layout.h (class Layout): Rename Linkonce_mapping to
9900         Section_name_mapping, linkonce_mapping to section_name_mapping,
9901         linkonce_mapping_count to section_name_mapping_count.  Don't
9902         declare linkonce_output_name.
9903
9904 2009-06-03  Doug Kwan  <dougkwan@google.com>
9905
9906         * gold/arm.cc (namespace utils): New.
9907         (Target_arm::reloc_is_non_pic): Define new method.
9908         (class Arm_relocate_functions): New.
9909         (Target_arm::Relocate::relocate): Handle relocation types used by
9910         Android.
9911
9912 2009-06-03  Ian Lance Taylor  <iant@google.com>
9913
9914         * arm.cc (Target_arm::scan::global): Use || instead of |.
9915
9916 2009-06-02  Doug Kwan  <dougkwan@google.com>
9917
9918         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9919         issued_non_pic_error_.
9920         (class Target_arm::Scan): Declare new method check_non_pic.
9921         Define new method symbol_needs_plt_entry.
9922         Declare new data member issued_non_pic_error_.
9923         (class Target_arm::Relocate): Declare new method
9924         should_apply_static_reloc.
9925         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9926         (Target_arm::Scan::check_non_pic): Define new method.
9927         (Target_arm::Scan::local): Handle a small subset of reloc types used
9928         by Android.
9929         (Target_arm::Scan::local): Same.
9930         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9931
9932 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9933
9934         * incremental.cc (Incremental_inputs::report_command_line): Filter
9935         out --incremental-* options.
9936
9937 2009-05-29  Doug Kwan  <dougkwan@google.com>
9938
9939         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9940         template class.
9941         (class Target_arm): Update comment.
9942         (Target_arm::Target_arm): Initialize new data members GOT_,
9943         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9944         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9945         and Target_arm::rel_dyn_section.
9946         Declare new_enum Target_arm::Got_type.
9947         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9948         and DYNBSS_.
9949         Update commments for member do_dynsym_value.
9950         (Target_arm::got_size, Target_arm::plt_section,
9951         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9952         new methods inside class defintion.
9953         (Target_arm::got_section): Define new method.
9954         (Target_arm::rel_dyn_section): Same.
9955         (Output_data_plt_arm): New template class.
9956         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9957         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9958         (Output_data_plt_arm::add_entry): Same.
9959         (Output_data_plt_arm::first_plt_entry): Define new
9960         static data member for PLT instruction template.
9961         (Output_data_plt_arm::plt_entry): Same.
9962         (Output_data_plt_arm::do_write): Define new method.
9963         (Target_arm::make_plt_entry): Same.
9964         (Target_arm::do_finalize_sections): Same.
9965         (Target_arm::do_dynsym_value): Same.
9966
9967 2009-05-28  Doug Kwan  <dougkwan@google.com>
9968
9969         * Makefile.am (TARGETSOURCES): Add arm.cc.
9970         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9971         * Makefile.in: Regenerate.
9972         * arm.cc: New file.
9973         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9974
9975 2009-05-26  Doug Kwan  <dougkwan@google.com>
9976
9977         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9978         (General_options::check_excluded_libs): Strip off directories in
9979         archive name before matching like GNU ld does.
9980         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9981         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9982         (exclude_libs_test_LDFLAGS): Add linker option
9983         -Wl,--exclude-libs,libexclude_libs_test_3
9984         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9985         an explicit archive without using -l.
9986         (alt/libexclude_libs_test_3.a): New make rule.
9987         * testsuite/Makefile.in: Regenerate.
9988         * testsuite/exclude_libs_test.c : Declare lib3_default().
9989         (main): Call it.
9990         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9991         * exclude_libs_test_3.c: New file.
9992
9993 2009-05-26  Nick Clifton  <nickc@redhat.com>
9994
9995         * po/id.po: New Indonesian translation.
9996         * po/gold.pot: Updated template file.
9997
9998 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9999
10000         * testsuite/Makefile.am: Add -ffunction-sections to compile
10001         gc_comdat_test files.  Add -Wl,--gc-sections to build
10002         gc_comdat_test.
10003         * testsuite/Makefile.in: Regenerate.
10004         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10005
10006 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10007
10008         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10009         kept comdat section was garbage collected.
10010         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10011         * testsuite/Makefile.in: Regenerate.
10012         * testsuite/gc_comdat_test.sh: New file.
10013         * testsuite/gc_comdat_test_1.cc: New file.
10014         * testsuite/gc_comdat_test_2.cc: New file.
10015
10016 2009-05-19  Doug Kwan  <dougkwan@google.com>
10017
10018         * archive.cc (Archive::Archive): Move constructor from archive.h
10019         to here.  Initialize no_export_.
10020         (Archive::get_elf_object_for_member): Set no_export flag of object.
10021         * archive.h (Archive::Archive): Move constructor body to
10022         archive.cc.
10023         (Archive::no_export): New method.
10024         (Archive::no_export_): New field.
10025         * object.h (Object::Object): Initialize no_export_ to false.
10026         (Object::no_export, Object::set_no_export): New methods.
10027         (Object::no_export_): New field.
10028         * options.cc (General_options::parse_exclude_libs): New method.
10029         (General_options::check_excluded_libs) Same.
10030         * options.h (exclude_libs): New option.
10031         (General_options::check_excluded_libs): New method declaration.
10032         (General_options::excluded_libs_): New field.
10033         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10034         default or protected visibility if an object has no-export flag set.
10035         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10036         (check_SCRIPTS): Add exclude_libs_test.sh.
10037         (check_DATA): Add exclude_libs_test.syms.
10038         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10039         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10040         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10041         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10042         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10043         libexclude_libs_test_2.a): New rules.
10044         * testsuite/Makefile.in: Regenerate.
10045         * testsuite/exclude_libs_test.c: New file.
10046         * testsuite/exclude_libs_test.sh: Ditto.
10047         * testsuite/exclude_libs_test_1.c: Ditto.
10048         * testsuite/exclude_libs_test_2.c: Ditto.
10049
10050 2009-05-15  Ian Lance Taylor  <iant@google.com>
10051
10052         * configure.ac: Check for declarations for cases where libiberty.h
10053         checks HAVE_DECL_xxx.
10054         * configure, config.in: Rebuild.
10055
10056 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10057
10058         * gold.h (Incremental_argument_list): Remove (invalid) forward
10059         declaration.
10060         * incremental.cc (Incremental_inputs::report_achive): New method.
10061         (Incremental_inputs::report_object): New method.
10062         (Incremental_inputs::report_script): New method.
10063         (Incremental_inputs::finalize_inputs): New method.
10064         (Incremental_inputs::finalize): Call finalize_inputs().
10065         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10066         Create inputs entries.
10067         * incremental.h (Incremental_input_type): New enum.
10068         (Incremental_inputs::Incremental_input): Initialize new fields.
10069         (Incremental_inputs::report_inputs): New method.
10070         (Incremental_inputs::report_achive): New method.
10071         (Incremental_inputs::report_object): New method.
10072         (Incremental_inputs::report_script): New method.
10073         (Incremental_inputs::finalize_inputs): New method.
10074         (Incremental_inputs::Input_info): New struct.
10075         (Incremental_inputs::Input_info_map): New typedef.
10076         (Incremental_inputs::lock_): New field.
10077         (Incremental_inputs::Inputs_): New field.
10078         (Incremental_inputs::Inputs_map): New field.
10079         * main.cc (main): Call Incremental_input::report_inputs.
10080         * options.h (Input_argument_list): Typedef moved from
10081         Input_arguments.
10082         (Input_file_group::Files): Remove, use ::Input_argument_list.
10083         (Input_file_group::Input_argument_list): Remove, use
10084         ::Input_argument_list.
10085         * plugin.cc (Plugin_manager::add_input_file): Add error in
10086         incremental build.
10087         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10088         functions.
10089         * script.cc (read_input_script): Call
10090         Incremental_input::report_script.
10091         * script.h (Script_info): New class.
10092
10093 2009-04-27  Ian Lance Taylor  <iant@google.com>
10094
10095         * x86_64.cc (do_adjust_output_section): Set entsize to
10096         plt_entry_size.
10097
10098 2009-04-23  Elliott Hughes  <enh@google.com>
10099
10100         * output.cc (Output_file::close): After short writes, continue
10101         writing from the correct offset in the buffer being written.
10102
10103 2009-04-23  Chris Demetriou  <cgd@google.com>
10104
10105         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10106         * configure: Regenerate.
10107         * config.in: Regenerate.
10108         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10109         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10110
10111 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10112
10113         * incremental.cc (Incremental_inputs_header_data): Renamed from
10114         Incremental_input_header_data.
10115         (Incremental_inputs_header_data::data_size): New field.
10116         (Incremental_inputs_header_data::put_input_file_count): Renamed
10117         from input_file_count.
10118         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10119         from command_line_offset.
10120         (Incremental_inputs_header_data::put_reserved): Renamed from
10121         put_reserved.
10122         (Incremental_inputs_entry_data): Renamed from
10123         Incremental_input_entry_data.
10124         (Incremental_inputs_entry_data::data_size): New field.
10125         (Incremental_inputs::report_command_line): New method.
10126         (Incremental_inputs::finalize): New method.
10127         (Incremental_inputs::create_incremental_inputs_data): New method.
10128         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10129         * incremental.h: New file.
10130         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10131        (Layout::finalize): Create incremental inputs section in
10132         incremental builds.
10133        (Layout::create_incremental_info_sections): New method.
10134         * layout.h (Layout::incremental_inputs): New method.
10135        (Layout::create_incremental_info_sections): New method.
10136        (Layout::incremental_inputs_): New field.
10137         * main.cc (main): Notify Incremental_input of the command line.
10138
10139 2009-04-01  Ian Lance Taylor  <iant@google.com>
10140             Mikolaj Zalewski  <mikolajz@google.com>
10141
10142         * gold.h (reserve_unordered_map): Define, three versions, one for
10143         each version of Unordered_map.
10144         * layout.cc (Layout::Layout): Remove options parameter.  Add
10145         number_of_input_files parameter.  Don't initialize options_.
10146         Initialize number_of_input_files_ and resized_signatures_.  Move
10147         sections_are_attached_.
10148         (Layout::layout_group): Reserve space for group_signatures_.
10149         (Layout::find_or_add_kept_section): Change name parameter to be a
10150         reference.  Resize signatures_ map when it gets large enough.
10151         (Layout::layout_eh_frame): Use parameters->options() instead of
10152         this->options_.
10153         (Layout::make_output_section): Likewise.
10154         (Layout::attach_allocated_section_to_segment): Likewise.
10155         (Layout::finalize, Layout::create_executable_stack): Likewise.
10156         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10157         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10158         * layout.h (class Layout): Update declarations.  Remove options_
10159         field.  Add number_of_input_files_ and resized_signatures_
10160         fields.  Move sections_are_attached_ field.
10161         * main.cc (main): Pass number of input files to Layout
10162         constructor.  Don't pass options.
10163
10164 2009-03-30  Ian Lance Taylor  <iant@google.com>
10165
10166         * ffsll.c (ffsll): Correct implementation.
10167
10168 2009-03-27  Ian Lance Taylor  <iant@google.com>
10169
10170         * ffsll.c: New file.
10171         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10172         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10173         * ftruncate.c (ftruncate): Declare before definition.
10174         * mremap.c (mremap): Likewise.
10175         * pread.c (pread): Likewise.
10176         * configure, Makefile.in, config.in: Rebuild.
10177
10178         * mremap.c: New file.
10179         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10180         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10181         (mremap): Declare if HAVE_MREMAP is not defined.
10182         * configure, Makefile.in, config.in: Rebuild.
10183
10184 2009-03-27  Cary Coutant  <ccoutant@google.com>
10185
10186         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10187         position independent.
10188         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10189         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10190
10191 2009-03-24  Cary Coutant  <ccoutant@google.com>
10192
10193         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10194         an executable.
10195         (needs_dynamic_reloc): Likewise.
10196
10197 2009-03-24  Ian Lance Taylor  <iant@google.com>
10198
10199         * yyscript.y (file_cmd): Recognize EXTERN.
10200         (extern_name_list, extern_name_list_body): New nonterminals.
10201         * script.cc (script_add_extern): Define.
10202         * script-c.h (script_add_extern): Declare.
10203
10204 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10205
10206         * object.cc (is_elf_object): Define.
10207         * object.h (is_elf_object): Declare.
10208         * archive.cc (Archive::get_elf_object_for_member): Call
10209         is_elf_object.
10210         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10211
10212 2009-03-24  Elliott Hughes  <enh@google.com>
10213
10214         * output.cc (Output_file::map_anonymous): Define.
10215         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10216         try an anonymous one.  Report the size if the mmap fails.
10217         * output.h (class Output_file): Declare map_anonymous.
10218
10219 2009-03-24  Ian Lance Taylor  <iant@google.com>
10220
10221         * target-select.cc (instantiate_target): Don't acquire the lock if
10222         the instantiated_target_ field has already been set.
10223
10224 2009-03-23  Ian Lance Taylor  <iant@google.com>
10225
10226         * gold-threads.h (class Initialize_lock): Define.
10227         * gold-threads.cc (class Initialize_lock_once): Define.
10228         (initialize_lock_control): New static variable.
10229         (initialize_lock_pointer): New static variable.
10230         (initialize_lock_once): New static function.
10231         (Initialize_lock::Initialize_lock): Define.
10232         (Initialize_lock::initialize): Define.
10233         * target-select.h: Include "gold-threads.h".
10234         (class Target_selector): Add lock_ and initialize_lock_ fields.
10235         Don't define instantiate_target, just declare it.
10236         * target-select.cc (Target_selector::Target_selector): Initialize
10237         new fields.
10238         (Target_selector::instantiate_target): Define.
10239         * descriptors.h: Include "gold-threads.h".
10240         (class Descriptors): Add initialize_lock_ field.
10241         * descriptors.cc (Descriptors::Descriptors): Initialize new
10242         field.
10243         (Descriptors::open): Use initialize_lock_ field
10244         * errors.h (class Errors): Add initialize_lock_ field.
10245         * errors.cc (Errors::Errors): Initialize new field.
10246         (Errors::initialize_lock): Use initialize_lock_ field.
10247         * powerpc.cc (class Target_selector_powerpc): Remove
10248         instantiated_target_ field.  In do_recognize call
10249         instantiate_target rather than do_instantiate_target.  In
10250         do_instantiate_target just allocate a new target.
10251         * sparc.cc (class Target_selector_sparc): Likewise.
10252
10253         * freebsd.h: New file.
10254         * i386.cc: Include "freebsd.h".
10255         (Target_i386): Derive from Target_freebsd rather than
10256         Sized_target.
10257         (Target_selector_i386): Derive from Target_selector_freebsd rather
10258         than Target_selector.
10259         * x86_64.cc: Include "freebsd.h".
10260         (Target_x86_64): Derive from Target_freebsd rather than
10261         Sized_target.
10262         (Target_selector_x86_64): Derive from Target_selector_freebsd
10263         rather than Target_selector.
10264         * target.h (class Target): Add adjust_elf_header and
10265         do_adjust_elf_header.
10266         * output.cc (Output_file_header:: do_sized_write): Call target
10267         adjust_elf_header routine.
10268         * configure.tgt: Set targ_osabi.
10269         * configure.ac: Define GOLD_DEFAULT_OSABI.
10270         * parameters.cc (Parameters::default_target): Pass
10271         GOLD_DEFAULT_OSABI to select_target.
10272         * target-select.h (class Target_selector): Make instantiate_target
10273         protected rather than private.
10274         * Makefile.am (HFILES): Add freebsd.h.
10275         * configure, Makefile.in, config.in: Rebuild.
10276
10277         * merge.cc (do_add_input_section): Correct pend value.  Change
10278         message about last entry not being null terminated from error to
10279         warning.
10280
10281 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10282
10283         * incremental.cc: New file.
10284         * Makefile.am (CCFILES): Add incremental.cc.
10285         * Makefile.in: Rebuild.
10286
10287 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10288
10289         * layout.cc (Layout::output_section_name): Preserve names
10290         of '.note.' sections.
10291
10292 2009-03-19  Ian Lance Taylor  <iant@google.com>
10293
10294         * descriptors.cc (Descriptors::open): Check that the options are
10295         valid before using them.
10296
10297 2009-03-18  Ian Lance Taylor  <iant@google.com>
10298
10299         * script-sections.h: Include <list>.
10300         (class Script_sections): Change Sections_elements from std::vector
10301         to std::list.  Typedef public Elements_iterator.  Add
10302         orphan_section_placement_, data_segment_align_start_, and
10303         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10304         field.
10305         * script-sections.cc (class Orphan_section_placement): New class.
10306         (class Sections_element): Add virtual functions is_relro and
10307         orphan_section_init.  Remove virtual function place_orphan_here.
10308         (class Output_section_definition): Add is_relro and
10309         orphan_section_init.  Remove place_orphan_here.
10310         (class Orphan_output_section): Likewise.
10311         (Script_sections::Script_sections): Update for field changes.
10312         (Script_sections::data_segment_align): Set saw_data_segment_align_
10313         and data_segment_align_start_, not data_segment_align_index.
10314         (Script_sections::data_segment_relro_end): Check
10315         saw_data_segment_align_.  Use data_segment_align_start_ rather
10316         than data_segment_align_index_.
10317         (Script_sections::place_orphan): Rewrite to use
10318         Orphan_section_placement.
10319
10320 2009-03-17  Ian Lance Taylor  <iant@google.com>
10321
10322         * archive.cc (Archive::add_symbols): Check for a version attached
10323         to the symbol name in the archive map.
10324         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10325         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10326         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10327         (ver_test_11.a): New target.
10328         * testsuite/Makefile.in: Rebuild.
10329
10330         * configure.ac: Check for chsize and posix_fallocate.  Replace
10331         ftruncate.
10332         * ftruncate.c: New file, from gnulib.
10333         * output.cc (posix_fallocate): Define dummy version if not
10334         HAVE_POSIX_FALLOCATE.
10335         (Output_file::map): Call posix_fallocate rather than lseek and
10336         write.
10337         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10338         * configure, Makefile.in, config.in: Rebuild.
10339
10340 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10341
10342         * layout.h (Layout::create_note): Add section_name parameter.
10343         * layout.cc (Layout::create_note): Likewise.
10344         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10345
10346 2009-03-17  Ian Lance Taylor  <iant@google.com>
10347
10348         * descriptors.cc: Include "options.h".
10349         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10350         (Descriptors::open): Always use O_CLOEXEC when opening a new
10351         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10352         then set FD_CLOEXEC.
10353
10354         * sparc.cc (class Target_sparc): Add has_got_section.
10355         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10356         make sure we have a GOT section.
10357
10358         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10359         (Target_sparc::Scan::local): Likewise.
10360         (Target_sparc::Scan::global): Likewise.
10361         (Target_sparc::Relocate::relocate): Likewise.
10362         (Target_sparc::Relocate::relocate_tls): Likewise.
10363
10364         * symtab.cc (Symbol_table::define_default_version): New function,
10365         broken out of add_from_object.
10366         (Symbol_table::add_from_object): Call define_default_version.
10367         (Symbol_table::define_special_symbol): Add resolve_oldsym
10368         parameter.  Change all callers.  If the version for a symbol comes
10369         from a version script, resolve it with the symbol with the same
10370         name with no version.  Also add the symbol without a version if
10371         appropriate.
10372         (do_define_in_output_data): If resolving with oldsym, don't delete
10373         sym.
10374         (do_define_in_output_segment): Likewise.
10375         (do_define_as_constant): Likewise.
10376         * symtab.h (class Symbol_table): Update declarations.
10377
10378 2009-03-13  Ian Lance Taylor  <iant@google.com>
10379
10380         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10381         (Read_symbols::requeue): New function.
10382         (Read_symbols::do_read_symbols): If make_elf_object fails because
10383         the target type is not configured, and the file was searched for,
10384         issue a warning and retry with the next directory.
10385         (Add_symbols::run): If the file has an incompatible format, and
10386         it was searched for, requeue the Read_symbols task.  On error,
10387         release the object.
10388         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10389         dirindex parameter to constructor.  Change all callers.  Declare
10390         incompatible_warning and requeue.
10391         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10392         input_argument_ and input_group_ fields.  Add them to
10393         constructor.  Change all callers.
10394         (class Read_script): Add dirindex_ field.  Add it to constructor.
10395         Change all callers.
10396         * archive.cc (Archive::setup): Remove input_objects parameter.
10397         Change all callers.
10398         (Archive::get_file_and_offset): Likewise.
10399         (Archive::read_all_symbols): Likewise.
10400         (Archive::read_symbols): Likewise.
10401         (Archive::get_elf_object_for_member): Remove input_objects
10402         parameter.  Add punconfigured parameter.  Change all callers.
10403         (Archive::add_symbols): Change return type to bool.  Check return
10404         value of include_member.
10405         (Archive::include_all_members): Likewise.
10406         (Archive::include_member): Change return type to bool.  Return
10407         false if first included object has incompatible target.  Set
10408         included_member_ field.
10409         (Add_archive_symbols::run): If add_symbols returns false, requeue
10410         Read_symbols task.
10411         * archive.h (class Archive): Add included_member_ field.
10412         Initialize it in constructor.  Add input_file and searched_for
10413         methods.  Update declarations.
10414         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10415         input_argument_ fields.  Add them to constructor.  Change all
10416         callers.
10417         * script.cc: Include "target-select.h".
10418         (class Parser_closure): Add skip_on_incompatible_target_ and
10419         found_incompatible_target_ fields.  Add
10420         skip_on_incompatible_target parameter to constructor.  Change all
10421         callers.  Add methods skip_on_incompatible_target,
10422         clear_skip_on_incompatible_target, found_incompatible_target, and
10423         set_found_incompatible_target.
10424         (read_input_script): Add dirindex parameter.  Change all callers.
10425         If parser finds an incompatible target, requeue Read_symbols
10426         task.
10427         (script_set_symbol): Clear skip_on_incompatible_target in
10428         closure.
10429         (script_add_assertion, script_parse_option): Likewise.
10430         (script_start_sections, script_add_phdr): Likewise.
10431         (script_check_output_format): New function.
10432         * script.h (read_input_script): Update declaration.
10433         * script-c.h (script_check_output_format): Declare.
10434         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10435         (ignore_cmd): Remove OUTPUT_FORMAT.
10436         * fileread.cc (Input_file::Input_file): Add explicit this.
10437         (Input_file::will_search_for): New function.
10438         (Input_file::open): Add pindex parameter.  Change all callers.
10439         * fileread.h (class Input_file): Add input_file_argument method.
10440         Declare will_search_for.  Update declarations.
10441         * object.cc (make_elf_object): Add punconfigured parameter.
10442         Change all callers.
10443         * object.h (class Object): Make input_file public.  Add
10444         searched_for method.
10445         (make_elf_object): Update declaration.
10446         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10447         restart search.
10448         * dirsearch.h (class Dirsearch): Update declaration.
10449         * options.h (class General_options): Add --warn-search-mismatch.
10450         * parameters.cc (Parameters::is_compatible_target): New function.
10451         * parameters.h (class Parameters): Declare is_compatible_target.
10452         * workqueue.cc (Workqueue::add_blocker): New function.
10453         * workqueue.h (class Workqueue): Declare add_blocker.
10454
10455         * fileread.cc (Input_file::open): Remove options parameter.
10456         Change all callers.
10457         (Input_file::open_binary): Likewise.
10458         * script.cc (read_input_script): Likewise.
10459         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10460         options parameter from constructor.  Change all callers.
10461         (class Read_script): Likewise.
10462         * fileread.h (class Input_file): Update declarations.
10463         * script.h (read_input_script): Update declaration.
10464
10465 2009-03-10  Nick Clifton  <nickc@redhat.com>
10466
10467         * po/es.po: New Spanish translation.
10468
10469 2009-03-06  Cary Coutant  <ccoutant@google.com>
10470
10471         * options.cc (parse_short_option): Keep dash_z from registering itself.
10472
10473 2009-03-03  Ian Lance Taylor  <iant@google.com>
10474
10475         PR 9918
10476         * target-reloc.h (relocate_section): Pass output_section to
10477         relocate.
10478         * i386.cc (Target_i386::should_apply_static_reloc): Add
10479         output_section parameter.  Change all callers.
10480         (Target_i386::Relocate::relocate): Add output_section parameter.
10481         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10482         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10483         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10484         * testsuite/two_file_shared.sh: New script.
10485         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10486         (check_DATA): Add two_file_shared.dbg.
10487         (two_file_shared.dbg): New target.
10488         * testsuite/Makefile.in: Rebuild.
10489
10490 2009-03-01  Ian Lance Taylor  <iant@google.com>
10491
10492         * configure.ac: Check for byteswap.h.
10493         * configure: Rebuild.
10494         * config.in: Rebuild.
10495
10496 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10497
10498         * layout.cc (Layout::find_or_add_kept_section): New function.
10499         (Layout::add_comdat): Removed.
10500         * layout.h (struct Kept_section): Move out of class Layout.
10501         Remove trailing underscores from field names.  Add group_sections
10502         field.  Rename group_ field to is_group.  Change all uses.
10503         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10504         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10505         comdat_groups_ field.
10506         (Sized_relobj::include_section_group): Use
10507         find_or_add_kept_section and Kept_section::group_sections.
10508         (Sized_relobj::include_linkonce_section): Likewise.
10509         * object.cc (class Sized_relobj): Don't define Comdat_group or
10510         Comdat_group_table.  Remove find_comdat_group and
10511         add_comdat_group.  Remove comdat_groups_ field.
10512         * plugin.cc (include_comdat_group): Use
10513         Layout::find_or_add_kept_section.
10514
10515 2009-02-28  Ian Lance Taylor  <iant@google.com>
10516
10517         * README: --gc-sections and map files are now supported.  Document
10518         some build requirements.
10519
10520         PR 6992
10521         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10522         relocatable link set the value of the section symbol to zero.
10523         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10524         relocatable link don't include the section address in the local
10525         symbol value.
10526
10527 2009-02-27  Ian Lance Taylor  <iant@google.com>
10528
10529         PR 6811
10530         * options.h (class Search_directory): Add is_system_directory.
10531         (class General_options): Declare is_in_system_directory.
10532         * options.cc (get_relative_sysroot): Make static.
10533         (get_default_sysroot): Make static.
10534         (General_optoins::is_in_system_directory): New function.
10535         * fileread.cc (Input_file::is_in_system_directory): New function.
10536         * fileread.h (class Input_file): Declare is_in_system_directory.
10537         * object.h (class Object): Add is_in_system_directory.
10538         (class Input_objects): Remove system_library_directory_ field.
10539         * object.cc (Input_objects::add_object): Don't set
10540         system_library_directory_.
10541         (input_objects::found_in_system_library_directory): Remove.
10542         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10543         parameter.  Change all callers.
10544         (Symbol_table::sized_write_globals): Likewise.
10545         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10546         Call Object::is_in_system_directory.
10547         * symtab.h (class Symbol_table): Update declarations.
10548
10549         PR 5990
10550         * descriptors.h (Open_descriptor): Add is_on_stack field.
10551         * descriptors.cc (Descriptors::open): If the descriptor is on the
10552         top of the stack, remove it.  Initialize is_on_stack field.
10553         (Descriptors::release): Only add pod to stack if it is not on the
10554         stack already.
10555         (Descriptors::close_some_descriptor): Clear stack_next and
10556         is_on_stack fields.
10557
10558         PR 7091
10559         * output.cc (Output_section::find_starting_output_address): Rename
10560         from starting_output_address; add PADDR parameter; change return
10561         type.
10562         * output.h (class Output_section): Declare
10563         find_starting_output_address instead of starting_output_address.
10564         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10565         section symbol for which we can't find a merge section.
10566
10567         PR 9836
10568         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10569         hidden or internal, force the symbol to be local.
10570         * resolve.cc (Symbol::override_visibility): Define.
10571         (Symbol::override_base): Use override_visibility.
10572         (Symbol_table::resolve): Likewise.
10573         (Symbol::override_base_with_special): Likewise.
10574         (Symbol_table::override_with_special): If the visibility is hidden
10575         or internal, force the symbol to be local.
10576         * symtab.h (class Symbol): Add set_visibility and
10577         override_visibility.
10578         * testsuite/ver_test_1.sh: New file.
10579         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10580         (check_DATA): Add ver_test_1.syms.
10581         (ver_test_1.syms): New target.
10582         * testsuite/Makefile.in: Rebuild.
10583
10584 2009-02-25  Cary Coutant  <ccoutant@google.com>
10585
10586         * layout.cc (Layout::choose_output_section): Don't rename sections
10587         when using a linker script that has a SECTIONS clause.
10588         * Makefile.in: Regenerate.
10589
10590         * testsuite/Makefile.am (script_test_5.sh): New test case.
10591         * testsuite/Makefile.in: Regenerate.
10592         * testsuite/script_test_5.cc: New file.
10593         * testsuite/script_test_5.sh: New file.
10594         * testsuite/script_test_5.t: New file.
10595
10596 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10597
10598         * archive.cc (Archive::include_member): Update calls to add_symbols.
10599         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10600         the Layout argument.
10601         * dynobj.h (do_add_symbols): Add the Layout argument.
10602         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10603         Layout argument.
10604         * object.h (Object::add_symbols): Add the Layout argument.
10605         (Object::do_add_symbols): Add the Layout argument.
10606         (Sized_relobj::do_add_symbols): Add the Layout argument.
10607         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10608         Unify the two versions.
10609         (Add_plugin_symbols): Remove.
10610         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10611         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10612         (Add_plugin_symbols): Remove.
10613         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10614         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10615         (Add_symbols::run): Make it work with Pulginobj.
10616
10617 2009-02-06  Ian Lance Taylor  <iant@google.com>
10618
10619         * object.cc (Sized_relobj::do_layout): Make info message start
10620         with lower case letter.
10621
10622 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10623
10624         * binary.cc: Fix file comment.
10625
10626         * options.h (enum Incremental_disposition): Define.
10627         (class General_options): Add new options: --incremental,
10628         --incremental_changed, --incremental_unchanged,
10629         --incremental_unknown.  Add incremental_disposition_ and
10630         implicit_incremental_ fields.
10631         (General_options::incremental_disposition): New function.
10632         (class Position_dependent_options): Add incremental_disposition
10633         option.
10634         (Position_dependent_options::copy_from_options): Set incremental
10635         dispositions.
10636         * options.cc (General_options::parse_incremental_changed): New
10637         function.
10638         (General_options::parse_incremental_unchanged): New function.
10639         (General_options::parse_incremental_unknown): New function.
10640         (General_options::General_options): Initialize new fields
10641         incremental_disposition_ and implicit_incremental_.
10642         (General_options::finalize): Check for uasge of --incremental-*
10643         without --incremental.
10644
10645 2009-02-06  Chris Demetriou  <cgd@google.com>
10646
10647         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10648         pointer and to report location as the file name associated with
10649         the symbol.
10650         (gold_undefined_symbol_at_location): New function to replace the
10651         old gold_undefined_symbol functionality.
10652         * target-reloc.h (relocate_section): Update to use
10653         gold_undefined_symbol_at_location.
10654         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10655         Call gold_undefined_symbol function rather than gold_error.
10656         * errors.h (Errors::undefined_symbol): Take location as a
10657         string, rather than calculating it from a relocation.
10658         * errors.cc (Errors::fatal): Print "fatal error:" before the
10659         formatted message.
10660         (Errors::error, Errors::error_at_location): Print "error: "
10661         before the formatted message.
10662         (Errors::undefined_symbol): Take location as a string, rather
10663         than calculating it from a relocation.
10664         (gold_undefined_symbol_at_location): New function akin to
10665         old gold_undefined_symbol, calculates location from relocation.
10666         (gold_undefined_symbol): Change to take only a Symbol pointer
10667         and to report location as the file name associated with the symbol.
10668         * testsuite/debug_msg.sh: Update for changed error messages.
10669         * testsuite/undef_symbol.sh: Likewise.
10670
10671 2009-02-04  Duncan Sands  <baldrick@free.fr>
10672
10673         PR 9812
10674         * reduced_debug_output.h
10675         (Output_reduced_debug_abbrev_section::failed): Use format for
10676         gold_warning.
10677         (Output_reduced_debug_info_section::faild): Likewise.
10678
10679 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10680
10681         * script.cc (Lazy_demangler): New class.
10682         (Version_script_info::get_symbol_version_helper): Demangle a
10683         symbol only once.
10684
10685 2009-01-29  Cary Coutant  <ccoutant@google.com>
10686
10687         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10688         to __tls_get_addr.
10689         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10690
10691 2009-01-28  Ian Lance Taylor  <iant@google.com>
10692
10693         * version.cc (version_string): Bump to 1.9.
10694
10695         * gold.h: Include <cstring> and <stdint.h>.
10696         * version.cc: Include <cstdio>.
10697         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10698         warning.
10699         * reduced_debug_output.cc (insert_into_vector): Rename from
10700         Insert_into_vector; change all callers.  Use Swap_unaligned to
10701         avoid aliasing issue; remove union since it is unnecessary.
10702
10703 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10704
10705         * Makefile.am (CCFILES): Add gc.cc.
10706         (HFILES): Add gc.h.
10707         * Makefile.in: Regenerate.
10708         * gold.cc (Gc_runner): New class.
10709         (queue_initial_tasks): Call garbage collection related tasks
10710         when corresponding options are invoked.
10711         (queue_middle_gc_tasks): New function.
10712         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10713         processed early before laying out sections during garbage collection.
10714         * gold.h (queue_middle_gc_tasks): New function.
10715         (is_prefix_of): Move from "layout.cc".
10716         * i386.cc (Target_i386::gc_process_relocs): New function.
10717         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10718         * main.cc (main): Create object of class "Garbage_collection".
10719         * object.cc (Relobj::copy_symbols_data): New function.
10720         (Relobj::is_section_name_included): New function.
10721         (Sized_relobj::do_layout): Allow this function to be called twice
10722         during garbage collection and defer layout of section during the
10723         first call.
10724         * object.h (Relobj::get_symbols_data): New function.
10725         (Relobj::is_section_name_included): New function.
10726         (Relobj::copy_symbols_data): New function.
10727         (Relobj::set_symbols_data): New function.
10728         (Relobj::get_relocs_data): New function.
10729         (Relobj::set_relocs_data): New function.
10730         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10731         (Relobj::gc_process_relocs): New function.
10732         (Relobj::do_gc_process_relocs): New pure virtual function.
10733         (Relobj::sd_): New data member.
10734         (Sized_relobj::is_output_section_offset_invalid): New function.
10735         (Sized_relobj::do_gc_process_relocs): New function.
10736         * options.h (General_options::gc_sections): Modify to not be a no-op.
10737         (General_options::print_gc_sections): New option.
10738         * plugin.cc (Plugin_finish::run): Remove function call to
10739         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10740         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10741         * reloc.cc (Read_relocs::run): Add task to process relocs and
10742         determine unreferenced sections when doing garbage collection.
10743         (Gc_process_relocs): New class.
10744         (Sized_relobj::do_gc_process_relocs): New function.
10745         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10746         sections that are garbage collected.
10747         * reloc.h (Gc_process_relocs): New class.
10748         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10749         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10750         symbols whose corresponding sections are garbage collected.
10751         (Symbol_table::Symbol_table): Add new parameter for the garbage
10752         collection object.
10753         (Symbol_table::gc_mark_undef_symbols): New function.
10754         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10755         (Symbol_table::gc_mark_dyn_syms): New function.
10756         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10757         as garbage.
10758         (Symbol_table::add_from_object): Likewise.
10759         (Symbol_table::add_from_relobj): When building shared objects, do not
10760         treat externally visible symbols as garbage.
10761         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10762         table information for static and relocatable links.
10763         * symtab.h (Symbol_table::set_gc): New function.
10764         (Symbol_table::gc): New function.
10765         (Symbol_table::gc_mark_undef_symbols): New function.
10766         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10767         (Symbol_table::gc_mark_dyn_syms): New function.
10768         (Symbol_table::gc_): New data member.
10769         * target.h (Sized_target::gc_process_relocs): New pure virtual
10770         function.
10771         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10772         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10773
10774 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10775
10776         * options.h (General_options::gc_sections): Define as a no-op for now.
10777         (General_options::no_keep_memory): Ditto.
10778         (General_options::Bshareable): Define.
10779         * options.cc (General_options::finalize): Honor -Bshareable.
10780
10781 2009-01-20  Andreas Schwab  <schwab@suse.de>
10782
10783         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10784         read the value in the contents, since we don't use it.  Use the
10785         template endianness when writing.
10786         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10787
10788 2009-01-19  Andreas Schwab  <schwab@suse.de>
10789
10790         * configure.tgt (powerpc64-*): Fix targ_obj.
10791
10792 2009-01-15  Ian Lance Taylor  <iant@google.com>
10793
10794         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10795         local symbols when stripping all symbols.
10796
10797 2009-01-14  Cary Coutant  <ccoutant@google.com>
10798
10799         * output.cc (Output_reloc): Add explicit instantiations.
10800
10801 2009-01-14  Cary Coutant  <ccoutant@google.com>
10802
10803         * archive.cc (Archive::get_elf_object_for_member): Remove call
10804         to File_read::claim_for_plugin.
10805         * descriptors.cc (Descriptors::open): Remove reference to
10806         is_claimed.
10807         (Descriptors::claim_for_plugin): Remove.
10808         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10809         (Descriptors::is_claimed): Remove.
10810         (claim_descriptor_for_plugin): Remove.
10811         * fileread.cc (File_read::claim_for_plugin): Remove.
10812         * fileread.h (File_read::claim_for_plugin): Remove.
10813         (File_read::descriptor): Reopen descriptor if necessary.
10814         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10815         (Plugin_manager::all_symbols_read): Add task parameter. Change
10816         all callers.
10817         (Plugin_manager::get_input_file): New function.
10818         (Plugin_manager::release_input_file): New function.
10819         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10820         corresponding data member.
10821         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10822         and pass to base constructor. Change all callers.
10823         (get_input_file, release_input_file): New functions.
10824         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10825         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10826         (Plugin_manager::all_symbols_read): Add task parameter.
10827         (Plugin_manager::get_input_file): New function.
10828         (Plugin_manager::release_input_file): New function.
10829         (Plugin_manager::task_): New data member.
10830         (Pluginobj::Pluginobj): Add filesize parameter.
10831         (Pluginobj::filename): New function.
10832         (Pluginobj::descriptor): New function.
10833         (Pluginobj::filesize): New function.
10834         (Pluginobj::filesize_): New data member.
10835         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10836         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10837         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10838
10839         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10840         with archive libraries.
10841         * testsuite/Makefile.in: Regenerate.
10842         * testsuite/plugin_test.c (struct sym_info): New type.
10843         (get_input_file, release_input_file): New static variables.
10844         (onload): Capture new transfer vector entries.
10845         (claim_file_hook): Stop reading at end of file according to filesize.
10846         Factor out parsing of readelf output into separate function.
10847         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10848         APIs and get the source file name from the symbol table.  Convert
10849         source file name to corresponding object file name.  Print info
10850         message when adding new input files.
10851         (parse_readelf_line): New function.
10852         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10853         * testsuite/plugin_test_2.sh: Likewise.
10854         * testsuite/plugin_test_3.sh: Likewise.
10855         * testsuite/plugin_test_4.sh: New test case.
10856
10857 2009-01-07  Ian Lance Taylor  <iant@google.com>
10858
10859         * version.cc (version_string): Bump to 1.8.
10860
10861 2008-12-23  Cary Coutant  <ccoutant@google.com>
10862
10863         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10864         * plugin.cc (Plugin_manager::finish): Rename as
10865         layout_deferred_objects.  Move cleanup to separate function.
10866         (Plugin_manager::cleanup): New function.
10867         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10868         separately.
10869         * plugin.h (Plugin_manager::finish): Rename as
10870         layout_deferred_objects.
10871         (Plugin_manager::cleanup): New function.
10872         (Plugin_manager::cleanup_done): New field.
10873
10874 2008-12-23  Cary Coutant  <ccoutant@google.com>
10875
10876         * plugin.cc (is_visible_from_outside): New function.
10877         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10878         so we don't return "IR only" status for exported symbols or -r links.
10879
10880         * testsuite/Makefile.am (plugin_test_3): New test case.
10881         * testsuite/Makefile.in: Regenerate.
10882         * testsuite/plugin_test_3.sh: New file.
10883
10884 2008-12-22  Cary Coutant  <ccoutant@google.com>
10885
10886         * object.cc (Sized_relobj::layout_section): New function.
10887         (Sized_relobj::do_layout): Defer layout of input sections until after
10888         plugin has provided replacement files.
10889         (Sized_relobj::do_layout_deferred_sections): New function.
10890         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10891         (Relobj::layout_deferred_sections): New function.
10892         (Relobj::do_layout_deferred_sections): New function.
10893         (Sized_relobj::do_layout_deferred_sections): New function.
10894         (Sized_relobj::layout_section): New function.
10895         (Sized_relobj::Deferred_layout): New structure.
10896         (Sized_relobj::deferred_layout_): New field.
10897         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10898         Change all callers.  Layout deferred sections.
10899         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10900         references.
10901         (Plugin_hook::run): Move code from do_plugin_hook inline.
10902         (Plugin_hook::do_plugin_hook): Remove.
10903         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10904         (Plugin_manager::finish): Renamed, was cleanup.
10905         (Plugin_manager::should_defer_layout): New function.
10906         (Plugin_manager::add_deferred_layout_object): New function.
10907         (Plugin_manager::Deferred_layout_list): New type.
10908         (Plugin_manager::deferred_layout_objects_): New field.
10909         (Plugin_hook::do_plugin_hook): Remove.
10910
10911 2008-12-17  Ian Lance Taylor  <iant@google.com>
10912
10913         * options.h (class General_options): Add --no case for
10914         --export-dynamic.
10915
10916 2008-12-16  Cary Coutant  <ccoutant@google.com>
10917
10918         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10919         vector.
10920         (Plugin_manager::claim_file): Create plugin object even if
10921         plugin did not call the add_symbols callback.
10922         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10923         asking for more symbols than were added.
10924         * testsuite/Makefile.am (plugin_test_1): Add test case with
10925         no global symbols.
10926         (empty.syms): New target.
10927         * testsuite/Makefile.in: Regenerate.
10928         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10929         message. Don't call add_symbols if no globals.
10930         (all_symbols_read_hook): Don't provide replacement for empty
10931         claimed file.
10932
10933 2008-12-12  Ian Lance Taylor  <iant@google.com>
10934
10935         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10936         r_type == 0 for a local symbol with r_sym == 0.
10937         (scan_relocatable_relocs): Pass r_sym to
10938         local_non_section_strategy.
10939         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10940         r_sym parameter.
10941
10942         * configure.ac: Update test for TLS descriptors: they are
10943         supported as of glibc 2.9.
10944         * configure: Rebuild.
10945
10946 2008-12-11  Ian Lance Taylor  <iant@google.com>
10947
10948         PR 7091
10949         * target-reloc.h (Default_scan_relocatable_relocs): For each
10950         function, map r_type == 0 to RELOC_DISCARD.
10951
10952 2008-12-10  Cary Coutant  <ccoutant@google.com>
10953
10954         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10955         object to override a kept COMDAT group from a plugin object.
10956
10957 2008-12-09  Ian Lance Taylor  <iant@google.com>
10958
10959         PR 7088
10960         * yyscript.y (file_cmd): Handle INPUT.
10961
10962         * testsuite/initpri1.c: Change all declarations to be full
10963         prototypes by adding void, to avoid compiler warnings.
10964
10965 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10966
10967         * options.cc (General_options::parse_plugin_opt): New.
10968         (General_options::add_plugin): The argument now is just the filename.
10969         (General_options::add_plugin_option): New.
10970         * options.h (plugin_opt): New.
10971         (add_plugin): Change argument name.
10972         (add_plugin_option): New.
10973         * plugin.cc (Plugin::load): Don't parse the plugin option.
10974         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10975         (Plugin::add_option): New.
10976         (Plugin::args_): Change type.
10977         (Plugin::filename_): New.
10978         (Plugin_manager::add_plugin_option): New.
10979         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10980         * testsuite/Makefile.in: Regenerate.
10981
10982 2008-12-05  Cary Coutant  <ccoutant@google.com>
10983
10984         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10985         Handle --strip-lto-sections option.
10986         * options.h (strip_lto_sections): New option.
10987
10988 2008-12-01  Cary Coutant  <ccoutant@google.com>
10989
10990         * plugin.cc (ld_plugin_message): Change format parameter to const.
10991         Fix mismatch between new[] and delete.
10992
10993 2008-11-14  Cary Coutant  <ccoutant@google.com>
10994
10995         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10996         instead of -1U.
10997
10998 2008-11-05  Craig Silverstein  <csilvers@google.com>
10999
11000         * options.cc (General_options::parse_dynamic_list): New function.
11001         * options.h (General_options): New flags dynamic_list,
11002         dynamic_list_data, dynamic_list_cpp_new, and
11003         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11004         (General_options::in_dynamic_list): New function.
11005         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11006         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11007         (Lex::can_continue_name): Likewise.
11008         (yylex): Likewise.
11009         (read_script_file): New parameter script_options.
11010         (read_dynamic_list): New function.
11011         (Script_options::define_dynamic_list): New function.
11012         (dynamic_list_keyword_parsecodes): New variable.
11013         (dynamic_list_keywords): New variable.
11014         * script.h (Script_options::define_dynamic_list): New function
11015         prototype.
11016         (read_dynamic_list): New function prototype.
11017         * symtab.cc (strprefix): New macro.
11018         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11019         dynamic_list_data, dynamic_list_cpp_new, and
11020         dynamic_list_cpp_typeinfo.
11021         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11022         (dynamic_list_expr): New rule.
11023         (dynamic_list_nodes): Likewise.
11024         (dynamic_list_node): Likewise.
11025         * testsuite/Makefile.am (dynamic_list): New test.
11026         * testsuite/Makefile.in: Regenerated.
11027         * testsuite/dynamic_list.t: New file.
11028         * testsuite/dynamic_list.sh: New file.
11029
11030 2008-11-05  Craig Silverstein  <csilvers@google.com>
11031
11032         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11033         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11034         (t11_last): Likewise.
11035         * testsuite/ver_test_6.c (main): Likewise.
11036
11037 2008-10-07  Cary Coutant  <ccoutant@google.com>
11038
11039         * options.c (General_options::finalize): Add check for -static and
11040         -shared.
11041         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11042         is not empty.
11043
11044 2008-10-02  Cary Coutant  <ccoutant@google.com>
11045
11046         * plugin.cc (make_sized_plugin_object): Fix conditional
11047         compilation to work when not all targets are enabled.
11048
11049 2008-09-29  Cary Coutant  <ccoutant@google.com>
11050
11051         * archive.cc (Archive::get_file_and_offset): Use filename instead
11052         of name to get library path.
11053         (Archive::include_member): Unlock external member of a thin archive.
11054
11055         * testsuite/Makefile.am (TEST_AR): New variable.
11056         (thin_archive_test_1): New test.
11057         (thin_archive_test_2): New test.
11058         * testsuite/Makefile.in: Regenerate.
11059         * testsuite/thin_archive_main.cc: New file.
11060         * testsuite/thin_archive_test_1.cc: New file.
11061         * testsuite/thin_archive_test_2.cc: New file.
11062         * testsuite/thin_archive_test_3.cc: New file.
11063         * testsuite/thin_archive_test_4.cc: New file.
11064
11065 2008-09-29  Cary Coutant  <ccoutant@google.com>
11066
11067         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11068         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11069         instead of -1U.
11070         (Sized_relobj::do_finalize_local_symbols): Likewise.
11071         (Sized_relobj::map_to_kept_section): Likewise.
11072         * object.h (Sized_relobj::invalid_address): New constant.
11073         (Sized_relobj::do_output_section_offset): Check for invalid_address
11074         and return -1ULL.
11075         * output.cc (Output_reloc::local_section_offset): Use constant
11076         invalid_address instead of -1U.
11077         (Output_reloc::get_address): Likewise.
11078         (Output_section::output_address): Change -1U to -1ULL.
11079         * output.h (Output_reloc::invalid_address): New constant.
11080         * reloc.cc (Sized_relobj::write_sections): Use constant
11081         invalid_address instead of -1U.
11082         (Sized_relobj::relocate_sections): Likewise.
11083         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11084         values for merge sections.
11085         * target-reloc.h (relocate_for_relocatable): Use constant
11086         invalid_address instead of -1U.
11087
11088 2008-09-19  Cary Coutant  <ccoutant@google.com>
11089
11090         Add plugin functionality for link-time optimization (LTO).
11091         * configure.ac (plugins): Add --enable-plugins option.
11092         * configure: Regenerate.
11093         * config.in: Regenerate.
11094         * Makefile.am (LIBDL): New variable.
11095         (CCFILES): Add plugin.cc.
11096         (HFILES): Add plugin.h.
11097         (ldadd_var): Add LIBDL.
11098         * Makefile.in: Regenerate.
11099
11100         * archive.cc: Include "plugin.h".
11101         (Archive::setup): Don't preread archive symbols when using a plugin.
11102         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11103         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11104         files.
11105         (Archive::include_member): Add symbols from plugin objects.
11106         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11107         * descriptors.cc (Descriptors::open): Check for file descriptors
11108         abandoned by plugins.
11109         (Descriptors::claim_for_plugin): New function.
11110         * descriptors.h (Descriptors::claim_for_plugin): New function.
11111         (Open_descriptor::is_claimed): New field.
11112         (claim_descriptor_for_plugin): New function.
11113         * fileread.cc (File_read::claim_for_plugin): New function.
11114         * fileread.h (File_read::claim_for_plugin): New function.
11115         (File_read::descriptor): New function.
11116         * gold.cc: Include "plugin.h".
11117         (queue_initial_tasks): Add task to call plugin hooks for generating
11118         new object files.
11119         * main.cc: Include "plugin.h".
11120         (main): Load plugin libraries.
11121         * object.h (Pluginobj): Declare.
11122         (Object::pluginobj): New function.
11123         (Object::do_pluginobj): New function.
11124         (Object::set_target): New function.
11125         * options.cc: Include "plugin.h".
11126         (General_options::parse_plugin): New function.
11127         (General_options::General_options): Initialize plugins_ field.
11128         (General_options::add_plugin): New function.
11129         * options.h (Plugin_manager): Declare.
11130         (General_options): Add --plugin option.
11131         (General_options::has_plugins): New function.
11132         (General_options::plugins): New function.
11133         (General_options::add_plugin): New function.
11134         (General_options::plugins_): New field.
11135         * plugin.cc: New file.
11136         * plugin.h: New file.
11137         * readsyms.cc: Include "plugin.h".
11138         (Read_symbols::do_read_symbols): Check for archive before checking
11139         for ELF file.  Call plugin hooks to claim files.
11140         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11141         from a real object file; force override when processing replacement
11142         files.
11143         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11144         (Symbol::init_base_object): Likewise.
11145         (Symbol::init_base_output_data): Likewise.
11146         (Symbol::init_base_output_segment): Likewise.
11147         (Symbol::init_base_constant): Likewise.
11148         (Symbol::init_base_undefined): Likewise.
11149         (Symbol::output_section): Assert that object is not a plugin.
11150         (Symbol_table::add_from_pluginobj): New function.
11151         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11152         undefined.
11153         (Symbol_table::sized_write_globals): Likewise.
11154         (Symbol_table::add_from_pluginobj): Instantiate template.
11155         * symtab.h (Sized_pluginobj): Declare.
11156         (Symbol::in_real_elf): New function.
11157         (Symbol::set_in_real_elf): New function.
11158         (Symbol::in_real_elf_): New field.
11159         (Symbol_table::add_from_pluginobj): New function.
11160
11161         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11162         (LIBDL): New variable.
11163         (LDADD): Add LIBDL.
11164         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11165         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11166         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11167         (MOSTLYCLEANFILES): Likewise.
11168         * testsuite/Makefile.in: Regenerate.
11169         * testsuite/plugin_test.c: New file.
11170         * testsuite/plugin_test_1.sh: New file.
11171         * testsuite/plugin_test_2.sh: New file.
11172
11173 2008-09-16  Ian Lance Taylor  <iant@google.com>
11174
11175         * target-reloc.h (relocate_section): Check whether a symbol is
11176         defined by the ABI before reporting an undefined symbol error.
11177         * target.h (Target::is_defined_by_abi): Make parameter const.
11178         (Target::do_is_defined_by_abi): Likewise.
11179         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11180         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11181         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11182         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11183         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11184         * testsuite/Makefile.in: Rebuild.
11185
11186         * fileread.cc (make_view): Add casts to avoid warning.
11187
11188 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11189
11190         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11191         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11192
11193 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11194
11195         * options.h (General_options::output_is_executable): New.
11196         (General_options::output_is_pie): New.
11197         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11198         for shared libraries.
11199         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11200
11201 2008-09-11  Chris Demetriou  <cgd@google.com>
11202
11203         * options.h (origin): New -z option.
11204         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11205         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11206         in DT_FLAGS_1.
11207
11208 2008-09-05  Cary Coutant  <ccoutant@google.com>
11209
11210         * fileread.cc (File_read::make_view): Add check for attempt to map
11211         beyond end of file.
11212
11213 2008-09-05  Cary Coutant  <ccoutant@google.com>
11214
11215         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11216         explicit instantiations.
11217
11218 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11219
11220         PR gold/6858
11221         * options.cc (General_options::finalize): Allow undefined symbols
11222         in shlibs if linking -shared.
11223
11224         PR gold/6859
11225         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11226         symbols as not needing a dynsym entry.
11227
11228 2008-08-20  Craig Silverstein  <csilvers@google.com>
11229
11230         * fileread.cc (File_read::open): Do not lock the file unless it
11231         was successfully opened.
11232
11233 2008-08-14  Cary Coutant  <ccoutant@google.com>
11234
11235         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11236         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11237         * testsuite/tls_test.cc (struct int128): 128-bit struct
11238         for testing TLS relocs with non-zero addend.
11239         (v12): New TLS variable.
11240         (t12): New test.
11241         (t_last): Add check for v12.
11242         * testsuite/tls_test.h (t12): New function.
11243         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11244
11245 2008-08-13  Ian Lance Taylor  <iant@google.com>
11246
11247         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11248         set tls_segment_ or relro_segment_.
11249         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11250         when appropriate.
11251         * output.h (Output_section::clear_is_relro): New function.
11252         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11253         sections specially even when output_data_ is empty.
11254         (Output_segment::maximum_alignment): When first section is relro,
11255         only force alignment for PT_LOAD segments.
11256         * script.cc (script_data_segment_align): New function.
11257         (script_data_segment_relro_end): New function.
11258         * script-c.h (script_data_segment_align): Declare.
11259         (script_data_segment_relro_end): Declare.
11260         * script-sections.h (class Script_sections): Declare
11261         data_segment_align and data_segment_relro_end.  Add fields
11262         segment_align_index_ and saw_relro_end_.
11263         * script-sections.cc (class Sections_element): Add set_is_relro
11264         virtual function.  Add new bool* parameter to place_orphan_here.
11265         Add get_output_section virtual function.
11266         (class Output_section_definition): Add set_is_relro.  Add new
11267         bool* parameter to place_orphan_here.  Add get_output_section.
11268         Add is_relro_ field.
11269         (Output_section_definition::Output_section_definition): Initialize
11270         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11271         and is_relro_ fields.
11272         (Output_section_definition::place_orphan_here): Add is_relro
11273         parameter.
11274         (Output_section_definition::set_section_addresses): Set relro for
11275         output section.
11276         (Output_section_definition::alternate_constraint): Likewise.
11277         (class Orphan_output_section): Add new bool* parameter to
11278         place_orphan_here.  Add get_output_section.
11279         (Orphan_output_section::place_orphan_here): Add is_relro
11280         parameter.
11281         (Script_sections::Script_sections): Initialize
11282         data_segment_align_index_ and saw_relro_end_.
11283         (Script_sections::data_segment_align): New function.
11284         (Script_sections::data_segment_relro_end): New function.
11285         (Script_sections::place_orphan): Set or clear is_relro.
11286         (Script_sections::set_section_addresses): Force alignment of first
11287         TLS section.
11288         * yyscript.y (exp): Call script_data_segment_align and
11289         script_data_segment_relro_end.
11290         * testsuite/relro_script_test.t: New file.
11291         * testsuite/relro_test.cc (using_script): Declare.
11292         (t1, t2): Test using_script.
11293         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11294         (relro_script_test_SOURCES): Define.
11295         (relro_script_test_DEPENDENCIES): Define.
11296         (relro_script_test_LDFLAGS): Define.
11297         (relro_script_test_LDADD): Define.
11298         (relro_script_test.so): New target.
11299         * testsuite/Makefile.in: Rebuild.
11300
11301 2008-08-06  Cary Coutant <ccoutant@google.com>
11302
11303         * archive.cc (Archive::total_archives, Archive::total_members)
11304         (Archive::total_members_loaded): New variables.
11305         (Archive::setup): Add parameter.  Add option to preread
11306         archive symbols.
11307         (Archive::read_armap): Add counter.
11308         (Archive::get_file_and_offset): New function.
11309         (Archive::get_elf_object_for_member): New function.
11310         (Archive::read_all_symbols): New function.
11311         (Archive::read_symbols): New function.
11312         (Archive::add_symbols): Add counters.
11313         (Archive::include_all_members): Use armap to find members if it's
11314         already built.
11315         (Archive::include_member): Skip reading symbols if already read.
11316         Factored code into Archive::get_file_and_offset and
11317         Archive::get_elf_object_for_member.  Changed call to
11318         Mapfile::report_include_archive_member.
11319         (Archive::print_stats): New function.
11320         * archive.h: Declare Object and Read_symbols_data classes.
11321         (Archive::Archive): Add initializers for new members.
11322         (Archive::setup): Add parameter.
11323         (Archive::print_stats): New function.
11324         (Archive::total_archives, Archive::total_members)
11325         (Archive::total_members_loaded): New variables.
11326         (Archive::get_file_and_offset): New function.
11327         (Archive::get_elf_object_for_member): New function.
11328         (Archive::read_all_symbols): New function.
11329         (Archive::read_symbols): New function.
11330         (Archive::Archive_member): New class.
11331         (Archive::members_): New member.
11332         (Archive::num_members_): New member.
11333         * main.cc: Include archive.h.
11334         (main): Call Archive::print_stats.
11335         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11336         archive parameter; member_name is now the fully-decorated name.
11337         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11338         * options.h: (General_options): Add --preread-archive-symbols option.
11339         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11340         Archive::setup.
11341
11342 2008-08-04  Ian Lance Taylor  <iant@google.com>
11343
11344         * symtab.h (Symbol::use_plt_offset): New function.
11345         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11346         * powerpc.cc (Relocate::relocate): Likewise.
11347         * sparc.cc (Relocate::relocate): Likewise.
11348         * x86_64.cc (Relocate::relocate): Likewise.
11349         * testsuite/weak_plt.sh: New test.
11350         * testsuite/weak_plt_main.cc: New test.
11351         * testsuite/weak_plt_shared.cc: New test.
11352         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11353         (check_PROGRAMS): Add weak_plt.
11354         (check_DATA): Add weak_plt_shared.so.
11355         (weak_plt_main_pic.o, weak_plt): New targets.
11356         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11357         * testsuite/Makefile.in: Rebuild.
11358
11359         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11360         gcctestdir/ld.
11361         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11362         * testsuite/Makefile.in: Rebuild.
11363
11364 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11365
11366         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11367         * Makefile.in: Regenerate.
11368         * po/POTFILES.in: Regenerate.
11369
11370 2008-07-29  Ian Lance Taylor  <iant@google.com>
11371
11372         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11373         symbols before other symbols.
11374         * testsuite/script_test_2.cc (test_addr): Declare.
11375         (test_addr_alias): Declare.
11376         (main): Check that test_addr and test_addr_alias have the right
11377         values.
11378         * testsuite/script_test_2.t: Define test_addr_alias and
11379         test_addr.
11380
11381 2008-07-24  Ian Lance Taylor  <iant@google.com>
11382
11383         PR 5990
11384         * descriptors.cc: New file.
11385         * descriptors.h: New file.
11386         * gold-threads.h (class Hold_optional_lock): New class.
11387         * fileread.cc: Include "descriptors.h".
11388         (File_read::~File_read): Release descriptor rather than closing
11389         it.
11390         (File_read::open) [file]: Call open_descriptor rather than open.
11391         Set is_descriptor_opened_.
11392         (File_read::open) [memory]: Assert that descriptor is not open.
11393         (File_read::reopen_descriptor): New function.
11394         (File_read::release): Release descriptor.
11395         (File_read::do_read): Make non-const.  Reopen descriptor.
11396         (File_read::read): Make non-const.
11397         (File_read::make_view): Reopen descriptor.
11398         (File_read::do_readv): Likewise.
11399         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11400         Update declarations.
11401         * layout.cc: Include "descriptors.h".
11402         (Layout::create_build_id): Use open_descriptor rather than open.
11403         * output.cc: Include "descriptors.h".
11404         (Output_file::open): Use open_descriptor rather than open.
11405         * archive.cc (Archive::const_iterator): Change Archive to be
11406         non-const.
11407         (Archive::begin, Archive::end): Make non-const.
11408         (Archive::count_members): Likewise.
11409         * archive.h (class Archive): Update declarations.
11410         * object.h (Object::read): Make non-const.
11411         * Makefile.am (CCFILES): Add descriptors.cc.
11412         (HFILES): Add descriptors.h.
11413         * Makefile.in: Rebuild.
11414
11415         PR 6716
11416         * gold.h: Always include <clocale>.  Add Solaris workarounds
11417         following code in binutils/sysdep.h.
11418
11419         PR 6048
11420         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11421         this->eh_frame_hdr_ is NULL before using it.
11422
11423         * dynobj.cc (Versions::Versions): Update comment.
11424
11425         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11426         the base version name.
11427
11428         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11429         array size plus one.
11430         (Stringpool_template::set_string_offsets): Subtract one from key
11431         before using it as an array index.
11432         (Stringpool_template::get_offset_with_length): Likewise.
11433         (Stringpool_template::write_to_buffer): Likewise.
11434         * stringpool.h (Stringpool_template::get_offset_from_key):
11435         Likewise.
11436
11437 2008-07-23  Ian Lance Taylor  <iant@google.com>
11438
11439         PR 6658
11440         * object.h (Merged_symbol_value::value): Do our best to handle a
11441         negative addend.
11442
11443         PR 6647
11444         * script.cc (Version_script_info::get_versions): Don't add empty
11445         version tag to return value.
11446         (Version_script_info::get_symbol_version_helper): Change return
11447         type to bool.  Add pversion parameter.  Change all callers.
11448         (script_register_vers_node): Don't require a non-NULL tag.
11449         * script.h (class Version_script_info): Update declarations.
11450         (Version_script_info::get_symbol_version): Change return type to
11451         bool.  Add version parameter.  Change all callers.
11452         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11453         handling.  Handle an empty version from a version script.
11454         (Symbol_table::define_special_symbol): Likewise.
11455         * testsuite/ver_test_10.script: New file.
11456         * testsuite/ver_test_10.sh: New file.
11457         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11458         (check_DATA): Add ver_test_10.syms.
11459         (ver_test_10.syms, ver_test_10.so): New target.
11460         * testsuite/Makefile.in: Rebuild.
11461
11462 2008-07-23  Simon Baldwin  <simonb@google.com>
11463
11464         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11465         to zero for undefined symbols from dynamic libraries.
11466
11467 2008-07-23  Ian Lance Taylor  <iant@google.com>
11468
11469         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11470         Change all callers.
11471         * symtab.h (class Symbol_table): Update declaration.
11472         * testsuite/ver_test_9.cc: New file.
11473         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11474         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11475         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11476         (ver_test_9.so, ver_test_9.o): New targets.
11477         * testsuite/Makefile.in: Rebuild.
11478
11479 2008-07-22  Ian Lance Taylor  <iant@google.com>
11480
11481         * options.h (class General_options): Define --check-sections.
11482         * layout.cc (Layout::set_segment_offsets): Handle
11483         --check-sections.
11484
11485         * options.h (class General_options): Define -n/--nmagic and
11486         -N/--omagic.
11487         * options.cc (General_options::finalize): For -n/--nmagic or
11488         -N/--omagic, set -static.
11489         * layout.cc (Layout::attach_allocated_section_to_segment): If
11490         -N/--omagic, don't put read-only and read-write sections in
11491         different segments.
11492         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11493         finding a read-only segment.
11494         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11495         don't set the minimum segment alignment to the common page size,
11496         and don't set the file offset to the address modulo the page size.
11497         * script-sections.cc (Script_sections::create_segments): If
11498         -n/--omagic, don't put read-only and read-write sections in
11499         different segments.
11500
11501         * cref.cc: New file.
11502         * cref.h: New file.
11503         * options.h (class General_options): Add --print-symbol-counts.
11504         * main.cc (main): Issue defined symbol report if requested.
11505         * archive.cc (Archive::interpret_header): Make into a const member
11506         function.
11507         (Archive::add_symbols): Call Input_objects::archive_start and
11508         archive_stop.
11509         (Archive::const_iterator): Define new class.
11510         (Archive::begin, Archive::end): New functions.
11511         (Archive::include_all_members): Rewrite to use iterator.
11512         (Archive::count_members): New function.
11513         * archive.h (class Archive): Update declarations.
11514         (Archive::filename): New function.
11515         * object.cc: Include "cref.h".
11516         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11517         (Sized_relobj::do_get_global_symbol_counts): New function.
11518         (Input_objects::add_object): Add object to cross-referencer.
11519         (Input_objects::archive_start): New function.
11520         (Input_objects::archive_stop): New function.
11521         (Input_objects::print_symbol_counts): New function.
11522         * object.h: Declare Cref and Archive.
11523         (Object::get_global_symbol_counts): New function.
11524         (Object::do_get_global_symbol_counts): New pure virtual function.
11525         (class Sized_relobj): Add defined_count_ field.  Update
11526         declarations.
11527         (class Input_objects): Add cref_ field.  Update constructor.
11528         Update declarations.
11529         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11530         defined_count_.
11531         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11532         symbol counts.
11533         (Sized_dynobj::do_get_global_symbol_counts): New function.
11534         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11535         defined_count_.  Update declarations.  Define Symbols typedef.
11536         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11537         parameter.  Change all callers.
11538         (Symbol_table::add_from_dynobj): Add sympointers and defined
11539         parameters.  Change all callers.
11540         * symtab.h (class Symbol_table): Update declarations.
11541         * Makefile.am (CCFILES): Add cref.cc.
11542         (HFILES): Add cref.h.
11543         * Makefile.in: Rebuild.
11544
11545 2008-07-22  Simon Baldwin  <simonb@google.com>
11546
11547         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11548         to zero when writing undefined symbols.
11549
11550 2008-07-22  Ian Lance Taylor  <iant@google.com>
11551
11552         * output.cc (Output_section::add_input_section): Don't try to
11553         merge empty merge sections.
11554
11555 2008-07-21  Craig Silverstein  <csilvers@google.com>
11556
11557         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11558         Include symbol version in error message.
11559
11560 2008-07-20  Chris Demetriou  <cgd@google.com>
11561
11562         * configure.ac (gold_cv_c_random_seed): New configured variable.
11563         (RANDOM_SEED_CFLAGS): New substituted variable.
11564         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11565         * configure: Rebuild.
11566         * Makefile.in: Likewise.
11567         * testsuite/Makefile.in: Likewise.
11568
11569 2008-07-18  Ian Lance Taylor  <iant@google.com>
11570
11571         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11572         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11573         * testsuite/ver_test_main.cc (main): Call t4.
11574         (t4, t4_2a): Define.
11575         * testsuite/ver_test_2.cc (t4_2): Define.
11576         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11577         * testsuite/ver_test_4.cc (t4_2a): Define.
11578         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11579         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11580
11581 2008-07-17  Ian Lance Taylor  <iant@google.com>
11582
11583         * dynobj.cc (Versions::add_def): If we give an error about a
11584         missing version, go ahead and create the version anyhow.
11585
11586 2008-07-10  Ian Lance Taylor  <iant@google.com>
11587
11588         Handle output sections with more than 0x7fffffff bytes.
11589         * object.h (class Relobj): Change map_to_output_ to
11590         output_sections_, and just keep a section pointer.  Change all
11591         uses.  Move comdat group support to Sized_relobj.
11592         (Relobj::is_section_specially_mapped): Remove.
11593         (Relobj::output_section): Remove poff parameter.  Change all
11594         callers.
11595         (Relobj::output_section_offset): New function.
11596         (Relobj::set_section_offset): Rewrite.
11597         (Relobj::map_to_output): Remove.
11598         (Relobj::output_sections): New function.
11599         (Relobj::do_output_section_offset): New pure virtual function.
11600         (Relobj::do_set_section_offset): Likewise.
11601         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11602         group support from Relobj.  Update declarations.
11603         (Sized_relobj::get_output_section_offset): New function.
11604         (Sized_relobj::do_output_section_offset): New function.
11605         (Sized_relobj::do_set_section_offset): New function.
11606         * object.cc (Relobj::output_section_address): Remove.
11607         (Sized_relobj::Sized_relobj): Initialize new fields.
11608         (Sized_relobj::include_section_group): Cast find_kept_object to
11609         Sized_relobj.
11610         (Sized_relobj::include_linkonce_section): Likewise.
11611         (Sized_relobj::do_layout): Use separate arrays for output section
11612         and output offset.
11613         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11614         output_sections.
11615         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11616         output_sections and section_offsets.
11617         (Sized_relobj::write_local_symbols): Likewise.
11618         (map_to_kept_section): Compute output address directly.
11619         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11620         output_sections and section_offsets.
11621         (Sized_relobj::write_sections): Likewise.
11622         (Sized_relobj::relocate_sections): Likewise.
11623         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11624         * output.h (class Output_reloc): Update declarations.  Change
11625         u2_.relobj to Sized_relobj*.
11626         (class Output_data_reloc): Change add functions to use
11627         Sized_relobj*.
11628         * output.cc (Output_reloc::Output_reloc): Change relobj to
11629         Sized_relobj*.
11630         (Output_reloc::local_section_offset): Change return type to
11631         Elf_Addr.  Use get_output_section_offset.
11632         (Output_reloc::get_address): Likewise.
11633         (Output_section::is_input_address_mapped): Don't call
11634         is_section_specially_mapped.
11635         (Output_section::output_offset): Likewise.
11636         (Output_section::output_address): Likewise.
11637         (Output_section::starting_output_address): Likewise.
11638         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11639         parameter to Sized_relobj*.
11640         (Copy_relocs::need_copy_reloc): Likewise.
11641         (Copy_relocs::save): Likewise.
11642         * copy-relocs.h (class Copy_relocs): Update declarations.
11643         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11644         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11645         * target-reloc.h (relocate_for_relocatable): Change
11646         offset_in_output_section type to Elf_Addr.  Change code that uses
11647         it as well.
11648         * layout.cc (Layout::layout): Always set *off.
11649         * mapfile.cc (Mapfile::print_input_section): Use
11650         output_section_offset.
11651         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11652         Sized_relobj*.
11653         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11654         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11655         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11656
11657 2008-07-03  Ian Lance Taylor  <iant@google.com>
11658
11659         * layout.cc (Layout::include_section): Do not discard unrecognized
11660         SHT_STRTAB sections.
11661
11662 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11663
11664         * script.cc (Lex::can_continue_name): Make '?' allowable in
11665         version-script names.
11666         * testsuite/version_script.map: Change glob pattern to use '?'
11667
11668 2008-06-30  Manish Singh  <yosh@gimp.org>
11669
11670         PR 6585
11671         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11672         Correct typo.
11673
11674 2008-06-30  Ian Lance Taylor  <iant@google.com>
11675
11676         PR 6660
11677         PR 6682
11678         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11679         versions]: Don't try to read the value in the contents, since we
11680         don't use it.  Use the template endianness when writing.
11681
11682 2008-06-25  Cary Coutant  <ccoutant@google.com>
11683
11684         * fileread.cc (File_read::make_view): Assert on zero-length view.
11685         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11686         symbol table when there are no symbols to read.
11687
11688 2008-06-23  Craig Silverstein  <csilvers@google.com>
11689
11690         * version.cc (version_string): Bump to 1.7
11691
11692 2008-06-18  Craig Silverstein  <csilvers@google.com>
11693
11694         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11695         constant 0xFFFF to type Valtype.
11696         (Powerpc_relocate_functions::rel16_ha): Likewise.
11697
11698 2008-06-17  Ian Lance Taylor  <iant@google.com>
11699
11700         * output.h (Output_section::Input_section): Initialize p2align_ to
11701         zero for Output_section_data constructors.
11702         (Output_section::Input_section::addralign): If not an input
11703         section, return the alignment of the Output_section_data.
11704         * testsuite/copy_test.cc: New file.
11705         * testsuite/copy_test_1.cc: New file.
11706         * testsuite/copy_test_2.cc: New file.
11707         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11708         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11709         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11710         (copy_test_1_pic.o, copy_test_1.so): New targets.
11711         (copy_test_2_pic.o, copy_test_2.so): New targets.
11712         * testsuite/Makefile.in: Rebuild.
11713
11714         * script-sections.cc (Script_sections::place_orphan): Initialize
11715         local variable exact.
11716
11717 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11718
11719         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11720
11721 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11722             David S. Miller  <davem@davemloft.net>
11723
11724         * powerpc.cc: New file.
11725         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11726         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11727         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11728         * Makefile.in: Rebuild.
11729
11730 2008-06-09  Ian Lance Taylor  <iant@google.com>
11731
11732         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11733         <exception>.
11734         (throwing, orig_terminate): New static variables.
11735         (terminate_handler): New static function.
11736         (t2): Set terminate handler.
11737
11738 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11739
11740         PR 6584
11741         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11742         alignment.
11743
11744 2008-05-30  Cary Coutant  <ccoutant@google.com>
11745
11746         * archive.cc (Archive::include_all_members) Correct to step
11747         over symbol table and extended name table in thin archives.
11748
11749 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11750
11751         PR 6407
11752         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11753         calculation.
11754
11755 2008-05-28  Caleb Howe  <cshowe@google.com>
11756
11757         * reduced_debug_output.cc: New file.
11758         * reduced_debug_output.h: New file.
11759         * options.h (class General_options): Add --strip-debug-non-line.
11760         * options.cc (General_options::finalize): Add strip_debug_non_line
11761         to the strip heirarchy.
11762         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11763         fields.
11764         * layout.cc: Include "reduced_debug_output.h".
11765         (Layout::Layout): Initialize new fields.
11766         (line_only_debug_sections): New static array.
11767         (is_lines_only_debug_sections): New static inline function.
11768         (Layout::include_section): Handle --strip-debug-non-line.
11769         (Layout::make_output_section): If --strip-debug-non-line, build
11770         new output sections for .debug_abbrev and .debug_info.
11771         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11772         gold.  Warn about possible overflow.
11773         (read_signed_LEB_128): Likewise.
11774         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11775         (read_signed_LEB_128): Declare.
11776         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11777         (HFILES): Add reduced_debug_output.h.
11778         * Makefile.in: Rebuild.
11779
11780 2008-05-21  Ian Lance Taylor  <iant@google.com>
11781
11782         * mapfile.cc: New file.
11783         * mapfile.h: New file.
11784         * options.h (class General_options): Add -M/--print-map and -Map.
11785         * options.cc (General_options::finalize): Make -M equivalent to
11786         -Map -.
11787         * main.cc: Include <cstdio> and "mapfile.h".
11788         (main): Open mapfile if requested.
11789         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11790         constructor.  Change caller.
11791         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11792         (queue_middle_tasks): Likewise.
11793         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11794         declarations.
11795         * archive.cc: Include "mapfile.h".
11796         (Archive::add_symbols): Add mapfile parameter.  Change all
11797         callers.  Pass mapfile, symbol, and reason to include_member.
11798         (Archive::include_all_members): Add mapfile parameter.  Change all
11799         callers.
11800         (Archive::include_member): Add mapfile, sym, and why parameters.
11801         Change all callers.  Report inclusion to map file.
11802         * archive.h: Include "fileread.h".
11803         (class Archive): Update declarations.
11804         (Archive::file): New const method.
11805         (class Add_archive_symbols): Add mapfile_ field.  Update
11806         constructor.  Change all callers.
11807         * readsyms.h (class Read_symbols): Likewise.
11808         (class Finish_group): Likewise.
11809         (class Read_script): Likewise.
11810         * common.cc: Include "mapfile.h".
11811         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11812         all callers.
11813         (Symbol_table::do_allocate_commons): Likewise.
11814         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11815         symbol allocation to mapfile.
11816         * common.h (class Allocate_commons_task): Add mapfile_ field.
11817         Update constructor.  Change all callers.
11818         * symtab.h (class Symbol_table): Update declarations.
11819         * layout.cc: Include "mapfile.h".
11820         (Layout_task_runner::run): Print information to mapfile.
11821         (Layout::create_gold_note): Change Output_data_fixed_space to
11822         Output_data_zero_fill.
11823         (Layout::create_build_id): Likewise.
11824         (Layout::print_to_mapfile): New function.
11825         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11826         constructor.  Change caller.
11827         (class Layout): Declare print_to_mapfile.
11828         * output.cc (Output_section::Input_section::print_to_mapfile): New
11829         function.
11830         (Output_section::add_input_section): If producing a map, always
11831         add to input_sections_ list.
11832         (Output_section::do_print_to_mapfile): New function.
11833         (Output_segment::print_sections_to_mapfile): New function.
11834         (Output_segment::print_section_list_to_mapfile): New function.
11835         * output.h: Include "mapfile.h".
11836         (Output_data::print_to_mapfile): New function.
11837         (Output_data::do_print_to_mapfile): New virtual function.
11838         (Output_segment_headers::do_print_to_mapfile): New function.
11839         (Output_file_header::do_print_to_mapfile): New function.
11840         (Output_data_const::do_print_to_mapfile): New function.
11841         (class Output_data_const_buffer): Add map_name_ field.  Update
11842         constructor.  Change all callers.  Add do_print_to_mapfile
11843         function.
11844         (class Output_data_fixed_space): Likewise.
11845         (class Output_data_space): Likewise.
11846         (class Output_data_zero_fill): New class.
11847         (Output_data_strtab::do_print_to_mapfile): New function.
11848         (Output_data_reloc_base::do_print_to_mapfile): New function.
11849         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11850         (Output_data_group::do_print_to_mapfile): New function.
11851         (Output_data_got::do_print_to_mapfile): New function.
11852         (Output_data_dynamic::do_print_to_mapfile): New function.
11853         (Output_symtab_xindex::do_print_to_mapfile): New function.
11854         (class Output_section): Declare do_print_to_mapflie.  Declare
11855         print_to_mapfile in Input_section.
11856         (class Output_segment): Declare new functions.
11857         * object.h (Sized_relobj::symbol_count): New function.
11858         * script-sections.cc
11859         (Output_section_element_dot_assignment::set_section_addresses):
11860         Change Output_data_fixed_space to Output_data_zero_fill.
11861         (Output_data_expression::do_print_to_mapfile): New function.
11862         * script.cc (read_input_script): Add mapfile parameter.  Change
11863         all callers.
11864         * script.h (read_input_script): Update declaration.
11865         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11866         (Eh_frame::do_print_to_mapfile): New function.
11867         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11868         (Output_merge_string::do_print_to_mapfile): New function.
11869         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11870         function.
11871         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11872         function.
11873         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11874         function.
11875         * Makefile.am (CCFILES): Add mapfile.cc.
11876         (HFILES): Add mapfile.h.
11877         * Makefile.in: Rebuild.
11878
11879 2008-05-19  Ian Lance Taylor  <iant@google.com>
11880
11881         * options.h (class General_options): Add -z relro.
11882         * layout.cc (Layout::Layout): Initialize relro_segment_.
11883         (Layout::add_output_section_data): Return the output section.
11884         (Layout::make_output_section): Rcognize relro sections and mark
11885         them appropriately.
11886         (Layout::attach_allocated_section_to_segment): Put relro sections
11887         in a PT_GNU_RELRO segment.
11888         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11889         section as relro.
11890         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11891         PT_TLS segments.
11892         (Layout::linkonce_mapping): Map d.rel.ro.local to
11893         .data.rel.ro.local.
11894         (Layout::output_section_name): Us .data.rel.ro.local for any
11895         section which begins with that.
11896         * layout.h (class Layout): Update add_output_section_data
11897         declaration.  Add relro_segment_ field.
11898         * output.cc (Output_section::Output_section): Initialize is_relro_
11899         and is_relro_local_ fields.
11900         (Output_segment::add_output_section): Group relro sections.
11901         (Output_segment::is_first_section_relro): New function.
11902         (Output_segment::maximum_alignment): If there is a relro section,
11903         align the segment to the common page size.
11904         (Output_segment::set_section_addresses): Track whether we are
11905         looking at relro sections.  If the last section is a relro
11906         section, align to the common page size.
11907         (Output_segment::set_section_list_addresses): Add in_relro
11908         parameter.  Change all callers.  Align to the page size when
11909         moving from relro to non-relro section.
11910         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11911         segment.
11912         * output.h (class Output_section): Add is_relro_ and
11913         is_relro_local_ fields.
11914         (Output_section::is_relro): New function.
11915         (Output_section::set_is_relro): New function.
11916         (Output_section::is_relro_local): New function.
11917         (Output_section::set_is_relro_local): New function.
11918         (class Output_segment): Update declarations.
11919         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11920         * sparc.cc (Target_sparc::got_section): Likewise.
11921         * x86_64.cc (Target_x86_64::got_section): Likewise.
11922         * testsuite/relro_test_main.cc: New file.
11923         * testsuite/relro_test.cc: New file.
11924         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11925         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11926         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11927         (relro_test.so, relro_test_pic.o): New targets.
11928         * testsuite/Makefile.in: Rebuild.
11929
11930 2008-05-16  Ian Lance Taylor  <iant@google.com>
11931
11932         * output.cc (Output_segment::add_output_section): Remove front
11933         parameter.
11934         * output.h (class Output_segment): Remove
11935         add_initial_output_section and overloaded add_output_section.
11936         Update declaration of remaining add_output_section.
11937         * layout.cc (Layout::create_interp): Call add_output_section
11938         rather than add_initial_output_section.
11939         (Layout::finish_dynamic_section): Likewise.
11940
11941         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11942         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11943         know the dynamic type.
11944         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11945         field.  Initialize it in constructor.
11946         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11947         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11948         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11949         reloc.
11950
11951         * output.cc (Output_reloc::get_address): Change return type to
11952         Elf_Addr.
11953         * output.h (class Output_reloc): Update get_address declaration.
11954         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11955         for section addresses.
11956
11957 2008-05-09  Ian Lance Taylor  <iant@google.com>
11958
11959         PR 6493
11960         * gold.cc (gold_nomem): Use return value of write.
11961
11962 2008-05-08  Ian Lance Taylor  <iant@google.com>
11963
11964         * symtab.c (Symbol::init_base_output_data): Add version
11965         parameter.  Change all callers.
11966         (Symbol::init_base_output_segment): Likewise.
11967         (Symbol::init_base_constant): Likewise.
11968         (Symbol::init_base_undefined): Likewise.
11969         (Sized_symbol::init_output_data): Likewise.
11970         (Sized_symbol::init_output_segment): Likewise.
11971         (Sized_symbol::init_constant): Likewise.
11972         (Sized_symbol::init_undefined): Likewise.
11973         (Symbol_table::do_define_in_output_data): If the new symbol has a
11974         version, mark it as the default.
11975         (Symbol_table::do_define_in_output_segment): Likewise.
11976         (Symbol_table::do_define_as_constant): Likewise.
11977         * symtab.h (class Symbol): Update declarations.
11978         (class Sized_symbol): Likewise.
11979         * resolve.cc (Symbol::override_version): New function.
11980         (Symbol::override_base): Call override_version.
11981         (Symbol::override_base_with_special): Likewise.
11982         * testsuite/ver_script_8.script: New file.
11983         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11984         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11985         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11986         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11987
11988 2008-05-06  Ian Lance Taylor  <iant@google.com>
11989
11990         PR 6049
11991         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11992         functions.
11993         (class General_options): Remove existing --undefined, and add
11994         --no-undefined instead.  Add new --undefined as synonym for -u.
11995         * archive.cc (Archive::add_symbols): Check whether symbol was
11996         named with -u.
11997         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11998         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11999         all uses.  Add IS_UNDEFINED.  Update declarations to split
12000         different versions of init_base.  Declare init_base_undefined.
12001         (Symbol::is_defined): Handle IS_UNDEFINED.
12002         (Symbol::is_undefined): Likewise.
12003         (Symbol::is_weak_undefined): Call is_undefined.
12004         (Symbol::is_absolute): Handle IS_CONSTANT.
12005         (class Sized_symbol): Update declarations to split different
12006         versions of init.  Declare init_undefined.
12007         (class Symbol_table): Declare new functions.
12008         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12009         Change all callers.
12010         (Symbol::init_base_output_data): Likewise.
12011         (Symbol::init_base_output_segment): Likewise.
12012         (Symbol::init_base_constant): Likewise.
12013         (Symbol::init_base_undefined): New function.
12014         (Sized_symbol::init_object): Rename from init.  Change all
12015         callers.
12016         (Sized_symbol::init_output_data): Likewise.
12017         (Sized_symbol::init_output_segment): Likewise.
12018         (Sized_symbol::init_constant): Likewise.
12019         (Sized_symbol::init_undefined): New function.
12020         (Symbol_table::add_undefined_symbols_from_command_line): New
12021         function.
12022         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12023         function.
12024         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12025         (Symbol::output_section): Likewise.
12026         (Symbol::set_output_section): Likewise.
12027         (Symbol_table::sized_finalize_symbol): Likewise.
12028         (Symbol_table::sized_write_globals): Likewise.
12029         * resolve.cc (Symbol_table::should_override): Likewise.
12030         (Symbol::override_base_with_special): Likewise.
12031
12032         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12033         symbol, change it to have default visibility.
12034         * testsuite/protected_1.cc: New file.
12035         * testsuite/protected_2.cc: New file.
12036         * testsuite/protected_3.cc: New file.
12037         * testsuite/protected_main_1.cc: New file.
12038         * testsuite/protected_main_2.cc: New file.
12039         * testsuite/protected_main_3.cc: New file.
12040         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12041         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12042         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12043         (protected_1.so): New target.
12044         (protected_1_pic.o, protected_2_pic.o): New targets.
12045         (protected_3_pic.o): New target.
12046         (check_PROGRAMS): Add protected_2.
12047         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12048         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12049         * testsuite/Makefile.in: Rebuild.
12050
12051         * options.h (DEFINE_var): Add set_user_set_##varname__.
12052         (DEFINE_bool_alias): New macro.
12053         (class General_options): Define -Bstatic using DEFINE_bool_alias
12054         rather than DEFINE_special.  Add --undefined as an alias for -z
12055         defs.
12056         * options.cc (General_options::parse_Bstatic): Remove.
12057
12058         * options.h (class General_options): Add --fatal-warnings.
12059         * main.cc (main): Implement --fatal-warnings.
12060         * errors.h (Errors::warning_count): New function.
12061
12062         * options.h (class General_options): Add -Bsymbolic-functions.
12063         * symtab.h (Symbol::is_preemptible): Check for
12064         -Bsymbolic-functions.
12065
12066 2008-05-05  Ian Lance Taylor  <iant@google.com>
12067
12068         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12069         as noVARNAME rather than no-VARNAME.
12070         (class General_options): Add option -z combreloc.
12071         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12072         get_address.
12073         (Output_reloc::sort_before) [SHT_REL]: New function.
12074         (Output_reloc::sort_before) [SHT_RELA]: New function.
12075         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12076         Sort_relocs_comparison.
12077         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12078         parameter.  Change all callers.
12079         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12080         sort_relocs parameter.  Change all callers.
12081         * output.cc (Output_reloc::get_address): New function, broken out
12082         of write_rel.
12083         (Output_reloc::write_rel): Call it.
12084         (Output_reloc::compare): New function.
12085         (Output_data_reloc_base::do_write): Optionally sort relocs.
12086
12087         * configure.ac: If targ_extra_obj is set, link it in.
12088         * configure.tgt: Initialize all variables.
12089         (x86_64*): Set targ_extra_obj and targ_extra_size.
12090         * configure: Rebuild.
12091
12092         * object.cc (Sized_relobj::include_section_group): Adjust section
12093         indexes read from group data.  Build vector to pass to
12094         layout_group.
12095         * layout.cc (Layout::layout_group): Add flags and shndxes
12096         parameters.  Remove contents parameter.  Change caller.  Update
12097         explicit instantiations.
12098         * layout.h (class Layout): Update layout_group declaration.
12099         * output.cc (Output_data_group::Output_data_group): Add flags and
12100         input_shndxes parameters.  Remove contents parameter.  Change
12101         caller.
12102         (Output_data_group::do_write): Change input_sections_ to
12103         input_shndxes_.
12104         * output.h (class Output_data_group): Update constructor
12105         declaration.  Rename input_sections_ to input_shndxes_.
12106         * testsuite/many_sections_test.cc: Add template.
12107
12108 2008-04-30  Cary Coutant  <ccoutant@google.com>
12109
12110         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12111
12112         * layout.cc (Layout::include_section): Refactored check for debug
12113         info section.
12114         (Layout::add_comdat): Add new parameters.  Change type
12115         of signature parameter.  Add object and shndx to signatures table.
12116         (Layout::find_kept_object): New function.
12117         * layout.h: Include <cstring>.
12118         (Layout::is_debug_info_section): New function.
12119         (Layout::add_comdat): Add new parameters.
12120         (Layout::find_kept_object): New function.
12121         (Layout::Kept_section): New struct.
12122         (Layout::Signatures): Change type of map range.
12123         * object.cc (Relobj::output_section_address): New function.
12124         (Sized_relobj::include_section_group): Add new parameters.  Change
12125         calls to Layout::add_comdat.  Change to build table of kept comdat
12126         groups and table mapping discarded sections to kept sections.
12127         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12128         (Sized_relobj::do_layout): Change calls to include_section_group and
12129         include_linkonce_section.
12130         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12131         value to zero when section is discarded.
12132         (Sized_relobj::map_to_kept_section): New function.
12133         * object.h (Relobj::output_section_address): New function.
12134         (Relobj::Comdat_group): New type.
12135         (Relobj::find_comdat_group): New function.
12136         (Relobj::Comdat_group_table): New type.
12137         (Relobj::Kept_comdat_section): New type.
12138         (Relobj::Kept_comdat_section_table): New type.
12139         (Relobj::add_comdat_group): New function.
12140         (Relobj::set_kept_comdat_section): New function.
12141         (Relobj::get_kept_comdat_section): New function.
12142         (Relobj::comdat_groups_): New field.
12143         (Relobj::kept_comdat_sections_): New field.
12144         (Symbol_value::input_value): Update comment.
12145         (Sized_relobj::map_to_kept_section) New function.
12146         (Sized_relobj::include_linkonce_section): Add new parameter.
12147         * target-reloc.h (Comdat_behavior): New type.
12148         (get_comdat_behavior): New function.
12149         (relocate_section): Add code to map a discarded section to the
12150         corresponding kept section when applying a relocation.
12151
12152 2008-04-30  Craig Silverstein  <csilvers@google.com>
12153
12154         * dwarf_reader.cc (next_generation_count): New static var.
12155         (Addr2line_cache_entry): New struct.
12156         (addr2line_cache): New static var.
12157         (Dwarf_line_info::one_addr2line): Added caching.
12158         (Dwarf_line_info::clear_addr2line_cache): New function.
12159         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12160         cache-size parameter.
12161         (Dwarf_line_info::one_addr2line_cache): New function.
12162         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12163         new cache-size argument to one_addr2line(), and clear cache.
12164
12165 2008-04-28  Cary Coutant  <ccoutant@google.com>
12166
12167         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12168         R_386_PC8 relocations.
12169
12170 2008-04-23  Ian Lance Taylor  <iant@google.com>
12171
12172         * object.cc (Sized_relobj::include_section_group): Check for
12173         invalid section group.
12174
12175         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12176         header size.
12177
12178         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12179         than read for file header.
12180         * archive.cc (Archive::include_member): Likewise.
12181
12182 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12183
12184         * aclocal.m4: Regenerate.
12185         * configure: Regenerate.
12186
12187 2008-04-19  Ian Lance Taylor  <iant@google.com>
12188
12189         * version.cc (version_string): Bump to 1.6.
12190
12191         * testsuite/Makefile.am (many_sections_r_test): New target.
12192         (many_sections_r_test_SOURCES): Remove.
12193         (many_sections_r_test_DEPENDENCIES): Remove.
12194         (many_sections_r_test_LDFLAGS): Remove.
12195         (many_sections_r_test_LDADD): Remove.
12196
12197         * object.cc (Sized_relobj::do_add_symbols): Always pass
12198         local_symbol_count_ to add_from_relobj.
12199
12200         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12201         every thousand variables.
12202         * testsuite/Makefile.in: Rebuild.
12203
12204         * object.cc (Xindex::initialize_symtab_xindex): New function.
12205         (Xindex::read_symtab_xindex): New function.
12206         (Xindex::sym_xindex_to_shndx): New function.
12207         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12208         available.
12209         (Sized_relobj::do_initialize_xindex): New function.
12210         (Sized_relobj::do_read_symbols): Adjust section links.
12211         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12212         parameter.  Change all callers.
12213         (Sized_relobj::include_section_group): Adjust section links and
12214         symbol section indexes.
12215         (Sized_relobj::do_layout): Adjust section links.
12216         (Sized_relobj::do_count_local_symbols): Adjust section links and
12217         symbol section indexes.
12218         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12219         ordinary and special symbols.
12220         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12221         dynsym_xindex parameters.  Change all callers.  Adjust section
12222         links.  Use SHN_XINDEX when needed.
12223         (Sized_relobj::get_symbol_location_info): Adjust section links.
12224         Don't get fooled by special symbols.
12225         * object.h (class Xindex): Define.
12226         (class Object): Add xindex_ parameter.  Declare virtual functoin
12227         do_initialize_xindex.
12228         (Object::adjust_sym_shndx): New function.
12229         (Object::set_xindex): New protected function.
12230         (class Symbol_value): Add is_ordinary_shndx_ field.
12231         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12232         (Symbol_value::value): Assert ordinary section.
12233         (Symbol_value::initialize_input_to_output_map): Likewise.
12234         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12235         Change all callers.
12236         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12237         all callers.
12238         (class Sized_relobj): Update declarations.
12239         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12240         parameter.  Change all callers.
12241         (Sized_relobj::adjust_shndx): New function.
12242         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12243         field.
12244         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12245         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12246         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12247         (Sized_dynobj::read_dynsym_section): Adjust section links.
12248         (Sized_dynobj::read_dynamic): Likewise.
12249         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12250         section links.
12251         (Sized_dynobj::do_initialize_xindex): New function.
12252         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12253         do_initialize_xindex.
12254         (Sized_dynobj::adjust_shndx): New function.
12255         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12256         dynsym_xindex_ fields.
12257         (Layout::finalize): Add a call to set_section_indexes before
12258         creating the symtab sections.
12259         (Layout::set_section_indexes): Don't do anything if the section
12260         already has a section index.
12261         (Layout::create_symtab_sections): Add shnum parameter.  Change
12262         caller.  Create .symtab_shndx section if needed.
12263         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12264         caller.
12265         (Layout::allocated_output_section_count): New function.
12266         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12267         needed.
12268         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12269         fields.  Update declarations.
12270         (Layout::symtab_xindex): New function.
12271         (Layout::dynsym_xindex): New function.
12272         (class Write_symbols_task): Add layout_ field.
12273         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12274         Change caller.
12275         * output.cc (Output_section_headers::Output_section_headers): Add
12276         shstrtab_section parameter.  Change all callers.
12277         (Output_section_headers::do_sized_write): Store overflow values
12278         for section count and section string table section index in
12279         section header zero.
12280         (Output_file_header::do_sized_write): Check for overflow of
12281         section count and section string table section index.
12282         (Output_symtab_xindex::do_write): New function.
12283         (Output_symtab_xindex::endian_do_write): New function.
12284         * output.h (class Output_section_headers): Add shstrtab_section_.
12285         Update declarations.
12286         (class Output_symtab_xindex): Define.
12287         (Output_section::has_out_shndx): New function.
12288         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12289         field.
12290         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12291         Change all callers.
12292         (Sized_symbol::init): Likewise.
12293         (Symbol::output_section): Check for ordinary symbol.
12294         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12295         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12296         callers.
12297         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12298         Change all callers.  Simplify handling of symbols from sections
12299         not included in the link.
12300         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12301         distinction.
12302         (Weak_alias_sorter::operator()): Assert that symbols are
12303         ordinary.
12304         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12305         distinction.
12306         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12307         parameters.  Change all callers.
12308         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12309         symbol distinction.  Use SHN_XINDEX when needed.
12310         (Symbol_table::write_section_symbol): Add symtab_xindex
12311         parameter.  Change all callers.
12312         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12313         SHN_XINDEX when needed.
12314         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12315         declarations.
12316         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12317         (Symbol::is_defined): Check is_ordinary.
12318         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12319         (Symbol::is_absolute, Symbol::is_common): Likewise.
12320         (class Sized_symbol): Update declarations.
12321         (class Symbol_table): Update declarations.
12322         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12323         parameters.  Change all callers.
12324         (Sized_symbol::override): Likewise.
12325         (Symbol_table::override): Likewise.
12326         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12327         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12328         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12329         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12330         to be in an ordinary section.
12331         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12332         object and is_ordinary parameters.  Change all callers.
12333         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12334         Change all callers.  Don't add undefined or non-ordinary symbols
12335         to reloc_map_.
12336         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12337         Change all callers.
12338         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12339         declarations.
12340         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12341         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12342         (Sized_relobj::relocate_sections): Likewise.
12343         * target-reloc.h (scan_relocs): Adjust section symbol index.
12344         (scan_relocatable_relocs): Likewise.
12345         * i386.cc (Scan::local): Check for ordinary symbols.
12346         * sparc.cc (Scan::local): Likewise.
12347         * x86_64.cc (Scan::local): Likewise.
12348         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12349         to symbol_section_and_value.
12350         * testsuite/many_sections_test.cc: New file.
12351         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12352         (check_PROGRAMS): Add many_sections_test.
12353         (many_sections_test_SOURCES): Define.
12354         (many_sections_test_DEPENDENCIES): Define.
12355         (many_sections_test_LDFLAGS): Define.
12356         (BUILT_SOURCES): Add many_sections_define.h.
12357         (many_sections_define.h): New target.
12358         (BUILT_SOURCES): Add many_sections_check.h.
12359         (many_sections_check.h): New target.
12360         (check_PROGRAMS): Add many_sections_r_test.
12361         (many_sections_r_test_SOURCES): Define.
12362         (many_sections_r_test_DEPENDENCIES): Define.
12363         (many_sections_r_test_LDFLAGS): Define.
12364         (many_sections_r_test_LDADD): Define.
12365         (many_sections_r_test.o): New target.
12366         * testsuite/Makefile.in: Rebuild.
12367
12368 2008-04-17  Cary Coutant  <ccoutant@google.com>
12369
12370         * errors.cc (Errors::info): New function.
12371         (gold_info): New function.
12372         * errors.h (Errors::info): New function.
12373         * gold.h (gold_info): New function.
12374         * object.cc (Input_objects::add_object): Print trace output.
12375         * options.cc (options::parse_set): New function.
12376         (General_options::parse_wrap): Deleted.
12377         (General_options::General_options): Deleted initializer.
12378         * options.h (options::String_set): New typedef.
12379         (options::parse_set): New function.
12380         (DEFINE_set): New macro.
12381         (General_options::wrap): Changed to use DEFINE_set. Changed
12382         callers of any_wrap_symbols and is_wrap_symbol.
12383         (General_options::trace, General_options::trace_symbol):
12384         New options.
12385         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12386         (General_options::wrap_symbols_): Deleted.
12387         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12388
12389 2008-04-17  David S. Miller  <davem@davemloft.net>
12390
12391         * options.cc (General_options::parse_V): New function.
12392         * options.h: Add entries for -V and -Qy.
12393
12394 2008-04-17  Ian Lance Taylor  <iant@google.com>
12395
12396         * common.cc (Symbol_table::allocate_commons): Remove options
12397         parameter.  Change caller.
12398         (Symbol_table::do_allocate_commons): Remove options parameter.
12399         Change caller.  Just call do_allocate_commons_list twice.
12400         (Symbol_table::do_allocate_commons_list): New function, broken out
12401         of do_allocate_commons.
12402         * common.h (class Allocate_commons_task): Remove options_ field.
12403         Update constructor.
12404         * symtab.cc (Symbol_table::Symbol_table): Initialize
12405         tls_commons_.
12406         (Symbol_table::add_from_object): Put TLS common symbols on
12407         tls_commons_ list.
12408         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12409         which are IN_OUTPUT_DATA.
12410         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12411         allocate_commons and do_allocate_commons declarations.  Declare
12412         do_allocate_commons_list.
12413         * gold.cc (queue_middle_tasks): Update creation of
12414         Allocate_commons_task to not pass options.
12415         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12416         (TLS_TEST_C_FLAGS): New variable.
12417         (tls_test_c_pic.o): New target.
12418         (tls_test_shared.so): Link in tls_test_c_pic.o.
12419         (tls_test_c_pic_ie.o): New target.
12420         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12421         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12422         (tls_test_c.o): New target.
12423         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12424         (tls_pic_test_LDADD): Likewise.
12425         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12426         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12427         (tls_test_c_gnu2.o): New target.
12428         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12429         tls_test_c_gnu2.o.
12430         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12431         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12432         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12433         * testsuite/tls_test.cc: Include "config.h".
12434         (t_last): Call t11_last.
12435         * testsuite/tls_test.h (t11, t11_last): Declare.
12436         * testsuite/tls_test_c.c: New file.
12437         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12438         * configure.ac: Check for OpenMP support.
12439         * configure, config.in, Makefile.in: Rebuild.
12440         * testsuite/Makefile.in: Rebuild.
12441
12442 2008-04-16  Cary Coutant  <ccoutant@google.com>
12443
12444         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12445         (Target_i386::tls_base_symbol_defined_): New field.
12446         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12447         (Target_i386::Scan::global): Likewise.
12448         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12449         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12450         (Target_x86_64::tls_base_symbol_defined_): New field.
12451         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12452         (Target_x86_64::Scan::global): Likewise.
12453
12454 2008-04-16  Cary Coutant  <ccoutant@google.com>
12455
12456         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12457         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12458         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12459         building shared libraries.
12460         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12461         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12462         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12463         * testsuite/Makefile.in: Rebuild.
12464         * testsuite/weak_undef.h: New file.
12465         * testsuite/weak_undef_file1.cc: Add extra test cases.
12466         * testsuite/weak_undef_file2.cc: Likewise.
12467         * testsuite/weak_undef_test.cc: Likewise.
12468
12469 2008-04-16  David S. Miller  <davem@davemloft.net>
12470
12471         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12472         Add issued_non_pic_error_ field.  Declare check_non_pic.
12473         (Target_sparc::Scan::check_non_pic): New function.
12474         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12475         (Target_sparc::Scan::global): Likewise.
12476
12477         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12478         * configure: Rebuild.
12479
12480         * options.h (DEFINE_enable): New macro.
12481         (new_dtags): New enable option.
12482         (initfirst, interpose, loadfltr, nodefaultlib,
12483         nodelete, nodlopen, nodump): New -z options.
12484         * layout.cc (Layout:finish_dynamic_section): If new
12485         dtags enabled, emit DT_RUNPATH.  Also, emit a
12486         DT_FLAGS_1 containing any specified -z flags.
12487
12488 2008-04-16  Ian Lance Taylor  <iant@google.com>
12489
12490         * copy-relocs.cc: New file.
12491         * copy-relocs.h: New file.
12492         * reloc.cc: Remove Copy_relocs code.
12493         * reloc.h: Likewise.
12494         * reloc-types.h (struct Reloc_types) [both versions]: Add
12495         get_reloc_addend_noerror.
12496         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12497         variants of add_global which take an addend which must be zero.
12498         * i386.cc: Include "copy-relocs.h".
12499         (class Target_i386): Change type of copy_relocs_ to variable,
12500         update initializer.
12501         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12502         Change all callers.
12503         (Target_i386::do_finalize_sections): Change handling of
12504         copy_relocs_.
12505         * sparc.cc: Include "copy-relocs.h".
12506         (class Target_sparc): Change type of copy_relocs_ to variable,
12507         update initializer.
12508         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12509         Change all callers.
12510         (Target_sparc::do_finalize_sections): Change handling of
12511         copy_relocs_.
12512         * x86_64.cc: Include "copy-relocs.h".
12513         (class Target_x86_64): Change type of copy_relocs_ to variable,
12514         update initializer.
12515         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12516         class.  Change all callers.
12517         (Target_x86_64::do_finalize_sections): Change handling of
12518         copy_relocs_.
12519         * Makefile.am (CCFILES): Add copy-relocs.cc.
12520         (HFILES): Add copy-relocs.h.
12521
12522         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12523
12524         * testsuite/script_test_4.sh: Permit leading zeroes.
12525
12526 2008-04-15  Ian Lance Taylor  <iant@google.com>
12527
12528         * script-sections.cc (Script_sections::create_segments): Use
12529         header_size_adjustment even when there is enough room for the
12530         headers.
12531         * testsuite/script_test_4.sh: New file.
12532         * testsuite/script_test_4.t: New file.
12533         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12534         (check_DATA): Add script_test_4.stdout.
12535         (MOSTLYCLEANFILES): Likewise.
12536         (script_test_4): New target.
12537         (script_test_4.stdout): New target.
12538         * testsuite/Makefile.in: Rebuild.
12539
12540         * sparc.cc: Add definitions for Output_data_plt_sparc class
12541         constants.
12542
12543 2008-04-14  David S. Miller  <davem@davemloft.net>
12544
12545         * sparc.cc: New file.
12546         * Makefile.am (TARGETSOURCES): Add sparc.cc
12547         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12548         * configure.tgt: Document targ_extra_size and
12549         targ_extra_big_endian.  Add entries for sparc-* and
12550         sparc64-*.
12551         * configure.ac: Handle targ_extra_size and
12552         targ_extra_big_endian.
12553         * Makefile.in: Rebuild.
12554         * configure: Likewise.
12555         * po/POTFILES.in: Likewise.
12556         * po/gold.pot: Likewise.
12557
12558 2008-04-14  Ian Lance Taylor  <iant@google.com>
12559
12560         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12561         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12562         in the name/type/flags to section mapping.  Don't call
12563         allocate_output_section.
12564         (Layout::choose_output_section): Change parameter from adjust_name
12565         to is_input_section.  Don't permit input sections after sections
12566         are attached to segments.  Don't call allocate_output_section.
12567         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12568         not write_enable_output_section.
12569         (Layout::make_output_section): Don't push to
12570         unattached_section_list_ nor call attach_to_segment.  Call
12571         attach_section_to_segment if sections are attached.
12572         (Layout::attach_sections_to_segments): New function.
12573         (Layout::attach_section_to_segment): New function.
12574         (Layout::attach_allocated_section_to_segment): Rename from
12575         attach_to_segment.  Remove flags parameter.
12576         (Layout::allocate_output_section): Remove function.
12577         (Layout::write_enable_output_section): Remove function.
12578         * layout.h (class Layout): Update for above changes.  Add new
12579         field sections_are_attached_.
12580         * output.h (Output_section::update_flags_for_input_section): New
12581         function.
12582         * output.cc (Output_section::add_input_section): Call
12583         update_flags_for_input_section.
12584         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12585
12586 2008-04-11  Cary Coutant  <ccoutant@google.com>
12587
12588         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12589         thought unnecessary.
12590         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12591
12592 2008-04-11  Ian Lance Taylor  <iant@google.com>
12593
12594         * output.h (class Output_section_data): Remove inline definition
12595         of set_addralign.
12596         * output.cc (Output_section_data::set_addralign): New function.
12597
12598 2008-04-11  Cary Coutant  <ccoutant@google.com>
12599
12600         Add support for TLS descriptors for i386 and x86_64.
12601         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12602         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12603         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12604         GOT_TYPE_TLS_DESC.
12605         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12606         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12607         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12608         relocations.
12609         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12610         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12611         Fix problem with initial-exec relocations.
12612         (Target_i386::Relocate::relocate_tls): Likewise.
12613         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12614         relaxation.
12615         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12616         support for section-plus-offset dynamic table entries.
12617         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12618         (Output_data_dynamic::Dynamic_entry): Add support for
12619         section-plus-offset dynamic table entries.
12620         (Output_data_dynamic::Classification): Likewise.
12621         (Output_data_dynamic::classification_): Renamed offset_.
12622         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12623         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12624         (Target_x86_64::make_plt_section): New function.
12625         (Target_x86_64::reserve_tlsdesc_entries): New function.
12626         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12627         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12628         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12629         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12630         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12631         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12632         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12633         add extra PLT entry for TLS descriptors.
12634         (Output_data_plt_x86_64::got_): New field.
12635         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12636         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12637         fields.
12638         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12639         descriptors.
12640         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12641         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12642         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12643         R_386_TLS_DESC_CALL relocations.
12644         (Target_x86_64::Scan::global): Likewise.
12645         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12646         for TLS descriptors.
12647         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12648         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12649         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12650         GD-to-IE relaxation.
12651         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12652         and TLS_DESCRIPTORS.
12653         * Makefile.in: Rebuild.
12654         * configure: Rebuild.
12655         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12656         (tls_test_shared2.so): New target.
12657         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12658         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12659         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12660         (tls_shared_gd_to_ie_test_LDADD): New variable.
12661         (tls_shared_gnu2_gd_to_ie_test): New target.
12662         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12663         New targets.
12664         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12665         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12666         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12667         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12668         (tls_shared_gnu2_test): New target.
12669         (tls_test_gnu2_shared.so): New target.
12670         (tls_shared_gnu2_test_SOURCES): New variable.
12671         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12672         (tls_shared_gnu2_test_LDFLAGS): New variable.
12673         (tls_shared_gnu2_test_LDADD): New variable.
12674         * testsuite/Makefile.in: Rebuild.
12675         * testsuite/Makefile.
12676
12677 2008-04-11  Ian Lance Taylor  <iant@google.com>
12678
12679         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12680         justsyms.t.
12681         * testsuite/Makefile.in: Rebuild.
12682
12683         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12684         long.
12685         * testsuite/script_test_2.cc (main): Adjust test.
12686
12687 2008-04-11  David S. Miller  <davem@davemloft.net>
12688             Ian Lance Taylor  <iant@google.com>
12689
12690         * options.h (General_options): Add entries for '-Y' and
12691         '-relax'.
12692         * options.cc (General_options:finalize): If -Y was used, add those
12693         entries to the library path instead of the default "/lib" and
12694         "/usr/lib".
12695
12696 2008-04-11  David S. Miller  <davem@davemloft.net>
12697
12698         * testsuite/justsyms.t: Start at 0x100.
12699         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12700         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12701         long.
12702         * testsuite/script_test_2.cc: Adjust string and section length
12703         checks.
12704
12705 2008-04-09  Ian Lance Taylor  <iant@google.com>
12706
12707         PR gold/5996
12708         * script-sections.cc (Sections_element::allocate_to_segment): Add
12709         orphan parameter.
12710         (Output_section_definition::allocate_to_segment): Likewise.
12711         (Orphan_output_section::allocate_to_segment): Likewise.
12712         (Script_sections::attach_sections_using_phdrs_clause): Don't
12713         propagate non-PT_LOAD segments to orphan sections.
12714         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12715         readelf rather than objdump.
12716         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12717         .interp section and PT_INTERP segment are the same size.
12718         * testsuite/Makefile.in: Rebuild.
12719
12720         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12721         aliases for symbols defined in the same object.
12722         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12723         (weak_alias_test_SOURCES): New variable.
12724         (weak_alias_test_DEPENDENCIES): New variable.
12725         (weak_alias_test_LDFLAGS): New variable.
12726         (weak_alias_test_LDADD): New variable.
12727         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12728         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12729         (weak_alias_test_3.o): New target.
12730         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12731         * testsuite/weak_alias_test_main.cc: New file.
12732         * testsuite/weak_alias_test_1.cc: New file.
12733         * testsuite/weak_alias_test_2.cc: New file.
12734         * testsuite/weak_alias_test_3.cc: New file.
12735
12736 2008-04-08  Ian Lance Taylor  <iant@google.com>
12737
12738         * options.h (class General_options): Add --noinhibit-exec option.
12739         * main.cc (main): Check --noinhibit-exec.
12740
12741         * options.h (class General_options): Define --wrap as a special
12742         option.  Add wrap_symbols_ field.
12743         (General_options::any_wrap_symbols): New function.
12744         (General_options::is_wrap_symbol): New function.
12745         * options.cc (General_options::parse_wrap): New function.
12746         (General_options::General_options): Initialize wrap_symbols_.
12747         * symtab.cc (Symbol_table::wrap_symbol): New function.
12748         (Symbol_table::add_from_object): Handle --wrap.
12749         * symtab.h (class Symbol_table): Declare wrap_symbol.
12750         * target.h (Target::wrap_char): New function.
12751         (Target::Target_info): Add wrap_char field.
12752         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12753         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12754         * testsuite/testfile.cc (Target_test::test_target_info):
12755         Likewise.
12756
12757         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12758         there is one.
12759
12760         * layout.h (class Layout): Add added_eh_frame_data_ field.
12761         * layout.cc (Layout::Layout): Initialize new field.
12762         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12763         output section until we find a section we merged successfully.
12764         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12765         that the size be non-zero.
12766
12767         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12768         qualifier.
12769
12770 2008-04-08  Craig Silverstein  <csilvers@google.com>
12771
12772         * configure.ac: Export new conditional variable HAVE_ZLIB.
12773         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12774         on HAVE_ZLIB.
12775         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12776         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12777
12778 2008-04-07  Ian Lance Taylor  <iant@google.com>
12779
12780         * version.cc (version_string): Set to "1.5".
12781
12782         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12783         Add issued_non_pic_error_ field.  Declare check_non_pic.
12784         (Target_x86_64::Scan::check_non_pic): New function.
12785         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12786         (Target_x86_64::Scan::global): Likewise.
12787
12788         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12789         addend parameter.  Change caller.  Handle merge sections.
12790         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12791         Address to Addend.  Don't add in the result of
12792         local_section_offset, pass down the addend and use the returned
12793         value.
12794         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12795         Update declarations of local_section_offset and symbol_value.
12796         * testsuite/two_file_test_1.cc (t18): New function.
12797         * testsuite/two_file_test_2.cc (f18): New function.
12798         * testsuite/two_file_test_main.cc (main): Call t18.
12799         * testsuite/two_file_test.h (t18, f18): Declare.
12800
12801         * configure.ac: Don't test for objdump, c++filt, or readelf.
12802         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12803         conditionals.
12804         (TEST_READELF): New variable.
12805         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12806         (check_PROGRAMS): Add two_file_strip_test.
12807         (two_file_strip_test): New target.
12808         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12809         (two_file_same_shared_strip_test_SOURCES): New variable.
12810         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12811         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12812         (two_file_same_shared_strip_test_LDADD): New variable.
12813         (two_file_shared_strip.so): New target.
12814         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12815         (ver_test_5.syms, ver_test_7.syms): Likewise.
12816         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12817         (strip_test_3.stdout): Use TEST_OBJDUMP.
12818         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12819
12820 2008-04-04  Cary Coutant  <ccoutant@google.com>
12821
12822         * symtab.h (Symbol::is_weak_undefined): New function.
12823         (Symbol::is_strong_undefined): New function.
12824         (Symbol::is_absolute): New function.
12825         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12826         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12827         absolute symbols.
12828         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12829         (weak_undef_test): New target.
12830         * testsuite/Makefile.in: Rebuild.
12831         * testsuite/weak_undef_file1.cc: New file.
12832         * testsuite/weak_undef_file2.cc: New file.
12833         * testsuite/weak_undef_test.cc: New file.
12834
12835 2008-04-03  Craig Silverstein  <csilvers@google.com>
12836
12837         * compressed_output.h (class Output_compressed_section): Use
12838         unsigned buffer.
12839         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12840         add zlib header.
12841         (zlib_compressed_suffix): Removed.
12842         (Output_compressed_section::set_final_data_size): Use unsigned
12843         buffers.
12844         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12845         Fix linker invocation.
12846         (flagstest_o_specialfile_and_compress_debug_sections):
12847         Likewise.
12848         * testsuite/Makefile.in: Regenerated.
12849
12850 2008-04-02  David S. Miller  <davem@davemloft.net>
12851
12852         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12853         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12854
12855 2008-04-02  Craig Silverstein  <csilvers@google.com>
12856
12857         * TODO: New file.
12858
12859 2008-04-02  Ian Lance Taylor  <iant@google.com>
12860
12861         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12862         parameters.  Update for new key type to views_.  Change all
12863         callers.
12864         (File_read::read): Adjust for byteshift in returned view.
12865         (File_read::add_view): New function, broken out of
12866         find_and_make_view.
12867         (File_read::make_view): New function, broken out of
12868         find_and_make_view.
12869         (File_read::find_or_make_view): Add offset and aligned
12870         parameters.  Rewrite accordingly.  Change all callers.
12871         (File_read::get_view): Add offset and aligned parameters.  Adjust
12872         for byteshift in return value.
12873         (File_read::get_lasting_view): Likewise.
12874         * fileread.h (class File_read): Update declarations.
12875         (class File_read::View): Add byteshift_ field.  Add byteshift to
12876         constructor.  Add byteshift method.
12877         * archive.h (Archive::clear_uncached_views): New function.
12878         (Archive::get_view): Add aligned parameter.  Change all callers.
12879         * object.h (Object::get_view): Add aligned parameter.  Change all
12880         callers.
12881         (Object::get_lasting_view): Likewise.
12882
12883         * fileread.cc (File_read::release): Don't call clear_views if
12884         there are multiple objects.
12885         * fileread.h (File_read::clear_uncached_views): New function.
12886         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12887         on the archive.
12888
12889 2008-03-31  Cary Coutant  <ccoutant@google.com>
12890
12891         Add thin archive support.
12892         * archive.cc (Archive::armagt): New const.
12893         (Archive::setup): Remove task parameter and calls to unlock.
12894         (Archive::unlock_nested_archives): New function.
12895         (Archive::read_header): Add nested_off parameter. Change
12896         all callers.
12897         (Archive::interpret_header): Likewise.
12898         (Archive::include_all_members): Change to handle thin
12899         archives.
12900         (Archive::include_member): Likewise.
12901         * archive.h (Archive::Archive): Add new parameters and
12902         initializers.
12903         (Archive::armagt): New const.
12904         (Archive::setup): Remove task parameter.
12905         (Archive::unlock_nested_archives): New function.
12906         (Archive::read_header): Add nested_off parameter.
12907         (Archive::interpret_header): Likewise.
12908         (Archive::Nested_archive_table): New typedef.
12909         (Archive::is_thin_archive_): New field.
12910         (Archive::nested_archives_): New field.
12911         (Archive::options_): New field.
12912         (Archive::dirpath_): New field.
12913         (Archive::task_): New field.
12914         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12915         for thin archives.  Pass additional parameters to
12916         Archive::Archive.  Unlock the archive file after calling
12917         Archive::setup.
12918
12919 2008-03-29  Ian Lance Taylor  <iant@google.com>
12920
12921         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12922         version symbol to be local.
12923         * testsuite/ver_test_4.sh: New file.
12924         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12925         (check_DATA): Add ver_test_4.syms.
12926         (ver_test_4.syms): New target.
12927         * testsuite/Makefile.in: Rebuild.
12928
12929         * output.cc
12930         (Output_section::Input_section_sort_entry::has_priority): New
12931         function.
12932         (Output_section::Input_section_sort_entry::match_file_name): New
12933         function.
12934         (Output_section::Input_section_sort_entry::match_section_name):
12935         Remove.
12936         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12937         Remove.
12938         (Output_section::Input_section_sort_entry::match_section_file):
12939         Remove.
12940         (Output_section::Input_section_sort_compare::operator()): Rewrite
12941         using new Input_section_sort_entry functions.  Sort crtbegin and
12942         crtend first.  Sort sections with no priority before sections with
12943         a priority.
12944         * testsuite/initpri1.c (d3): Check j != 4.
12945         (cd5): New constructor/destructor function.
12946         (main): Check j != 2.
12947
12948         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12949         new symbol when resolving, don't call set_is_default.
12950         * testsuite/ver_test_7.cc: New file.
12951         * testsuite/ver_test_7.sh: New file.
12952         * testsuite/Makefile.am (ver_test_7.so): New target.
12953         (ver_test_7.o): New target.
12954         (check_SCRIPTS): Add ver_test_7.sh.
12955         (check_DATA): Add ver_test_7.syms.
12956         (ver_test_7.syms): New target.
12957
12958 2008-03-28  Ian Lance Taylor  <iant@google.com>
12959
12960         * layout.cc (Layout::layout): If we see an input section with a
12961         name that needs sorting, set the must_sort flag for the output
12962         section.
12963         (Layout::make_output_section): If the name of the output section
12964         indicates that it might require sorting, set the may_sort flag.
12965         * output.h (Output_section::may_sort_attached_input_sections): New
12966         function.
12967         (Output_section::set_may_sort_attached_input_sections): New
12968         function.
12969         (Output_section::must_sort_attached_input_sections): New
12970         function.
12971         (Output_section::set_must_sort_attached_input_sections): New
12972         function.
12973         (class Output_section): Declare Input_section_sort_entry.  Define
12974         Input_section_sort_compare.  Declare
12975         sort_attached_input_sections.  Add new fields:
12976         may_sort_attached_input_sections_,
12977         must_sort_attached_input_sections_,
12978         attached_input_sections_are_sorted_.
12979         * output.cc (Output_section::Output_section): Initialize new
12980         fields.
12981         (Output_section::add_input_section): Add an entry to
12982         input_sections_ if may_sort or must_sort are true.
12983         (Output_section::set_final_data_size): Call
12984         sort_attached_input_sections if necessary.
12985         (Output_section::Input_section_sort_entry): Define new class.
12986         (Output_section::Input_section_sort_compare::operator()): New
12987         function.
12988         (Output_section::sort_attached_input_sections): New function.
12989         * configure.ac: Check whether the compiler supports constructor
12990         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12991         * testsuite/initpri1.c: New file.
12992         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12993         CONSTRUCTOR_PRIORITY.
12994         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12995         (initpri1_LDFLAGS): New variable.
12996         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12997
12998 2008-03-27  Ian Lance Taylor  <iant@google.com>
12999
13000         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13001         * testsuite/common_test_1.c: New file.
13002         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13003         (common_test_1_SOURCES): New variable.
13004         (common_test_1_DEPENDENCIES): New variable.
13005         (common_test_1_LDFLAGS): New variable.
13006
13007         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13008         and commons_ correctly when NAME/VERSION does not override
13009         NAME/NULL.
13010         * testsuite/ver_test_6.c: New file.
13011         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13012         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13013         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13014
13015 2008-03-26  Ian Lance Taylor  <iant@google.com>
13016
13017         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13018         of an undefined symbol from a version script.
13019         * testsuite/Makefile.am (ver_test_5.so): New target.
13020         (ver_test_5.o): New target.
13021         (check_SCRIPTS): Add ver_test_5.sh.
13022         (check_DATA): Add ver_test_5.syms.
13023         (ver_test_5.syms): New target.
13024         * testsuite/ver_test_5.cc: New file.
13025         * testsuite/ver_test_5.script: New file.
13026         * testsuite/ver_test_5.sh: New file.
13027         * Makefile.in, testsuite/Makefile.in: Rebuild.
13028
13029         PR gold/5986
13030         Fix problems building gold with gcc 4.3.0.
13031         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13032         (gold_error_at_location, gold_warning_at_location): Use it.
13033         * configure.ac: Check whether we can compile and use a template
13034         function with a printf attribute.
13035         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13036         when jumping over bytes.
13037         * object.cc: Instantiate Object::read_section_data.
13038         * debug.h: Include <cstring>
13039         * dwarf_reader.cc: Include <algorithm>
13040         * main.cc: Include <cstring>.
13041         * options.cc: Include <cstring>.
13042         * output.cc: Include <cstring>.
13043         * script.cc: Include <cstring>.
13044         * script.h: Include <string>.
13045         * symtab.cc: Include <cstring> and <algorithm>.
13046         * target-select.cc: Include <cstring>.
13047         * version.cc: Include <string>.
13048         * testsuite/testmain.cc: Include <cstdlib>.
13049         * configure, config.in: Rebuild.
13050
13051 2008-03-25  Ian Lance Taylor  <iant@google.com>
13052
13053         * options.cc: Include "../bfd/bfdver.h".
13054         (options::help): Print bug reporting address.
13055
13056         * version.cc (print_version): Adjust output for current value of
13057         BFD_VERSION_STRING.
13058
13059         * NEWS: New file.
13060
13061         * options.cc (options::help): Print list of supported targets.
13062         * target-select.h: Include <vector>.
13063         (class Target_selector): Make machine_, size_, and is_big_endian_
13064         fields const.  Add bfd_name_ and instantiated_target_ fields.
13065         (Target_selector::Target_selector): Add bfd_name parameter.
13066         (Target_selector::recognize): Make non-virtual, call
13067         do_recognize.
13068         (Target_selector::recognize_by_name): Make non-virtual, call
13069         do_recognize_by_name.
13070         (Target_selector::supported_names): New function.
13071         (Target_selector::bfd_name): New function.
13072         (Target_selector::do_instantiate_target): New pure virtual
13073         function.
13074         (Target_selector::do_recognize): New virtual function.
13075         (Target_selector::do_recognize_by_name): New virtual function.
13076         (Target_selector::instantiate_target): New private function.
13077         (supported_target_names): Declare.
13078         * target-select.cc (Target_selector::Target_selector): Update for
13079         new parameter and fields.
13080         (select_target_by_name): Check that the name matches before
13081         calling recognize_by_name.
13082         (supported_target_names): New function.
13083         * i386.cc (class Target_selector_i386): Update Target_selector
13084         constructor call.  Remove recognize and recognize_by_name.  Add
13085         do_instantiate_target.
13086         * x86_64.cc (class Target_selector_x86_64): Likewise.
13087         * testsuite/testfile.cc (class Target_selector_test): Update for
13088         changes to Target_selector.
13089
13090         * README: Rewrite, with some notes on unsupported features.
13091
13092 2008-03-24  Cary Coutant  <ccoutant@google.com>
13093
13094         * i386.cc (Target_i386::Got_type): New enum declaration.
13095         (Target_i386::Scan::local): Updated callers of Output_data_got
13096         member functions.
13097         (Target_i386::Scan::global): Likewise.
13098         (Target_i386::Relocate::relocate): Likewise.
13099         (Target_i386::Relocate::relocate_tls): Likewise.
13100         * object.h (Got_offset_list): New class.
13101         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13102         (Sized_relobj::local_got_offset): Likewise.
13103         (Sized_relobj::set_local_got_offset): Likewise.
13104         (Sized_relobj::local_has_tls_got_offset): Removed.
13105         (Sized_relobj::local_tls_got_offset): Removed.
13106         (Sized_relobj::set_local_tls_got_offset): Removed.
13107         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13108         * output.cc (Output_data_got::add_global): Added got_type parameter.
13109         (Output_data_got::add_global_with_rel): Likewise.
13110         (Output_data_got::add_global_with_rela): Likewise.
13111         (Output_data_got::add_global_pair_with_rel): New function.
13112         (Output_data_got::add_global_pair_with_rela): New function.
13113         (Output_data_got::add_local): Added got_type parameter.
13114         (Output_data_got::add_local_with_rel): Likewise.
13115         (Output_data_got::add_local_with_rela): Likewise.
13116         (Output_data_got::add_local_pair_with_rel): New function.
13117         (Output_data_got::add_local_pair_with_rela): New function.
13118         (Output_data_got::add_global_tls): Removed.
13119         (Output_data_got::add_global_tls_with_rel): Removed.
13120         (Output_data_got::add_global_tls_with_rela): Removed.
13121         (Output_data_got::add_local_tls): Removed.
13122         (Output_data_got::add_local_tls_with_rel): Removed.
13123         (Output_data_got::add_local_tls_with_rela): Removed.
13124         * output.h (Output_data_got::add_global): Added got_type parameter.
13125         (Output_data_got::add_global_with_rel): Likewise.
13126         (Output_data_got::add_global_with_rela): Likewise.
13127         (Output_data_got::add_global_pair_with_rel): New function.
13128         (Output_data_got::add_global_pair_with_rela): New function.
13129         (Output_data_got::add_local): Added got_type parameter.
13130         (Output_data_got::add_local_with_rel): Likewise.
13131         (Output_data_got::add_local_with_rela): Likewise.
13132         (Output_data_got::add_local_pair_with_rel): New function.
13133         (Output_data_got::add_local_pair_with_rela): New function.
13134         (Output_data_got::add_global_tls): Removed.
13135         (Output_data_got::add_global_tls_with_rel): Removed.
13136         (Output_data_got::add_global_tls_with_rela): Removed.
13137         (Output_data_got::add_local_tls): Removed.
13138         (Output_data_got::add_local_tls_with_rel): Removed.
13139         (Output_data_got::add_local_tls_with_rela): Removed.
13140         * resolve.cc (Symbol::override_base_with_special): Removed
13141         reference to has_got_offset_ field.
13142         * symtab.cc (Symbol::init_fields): Replaced initialization
13143         of got_offset_ with got_offsets_.  Removed initialization
13144         of has_got_offset_
13145         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13146         (Symbol::got_offset): Likewise.
13147         (Symbol::set_got_offset): Likewise.
13148         (Symbol::has_tls_got_offset): Removed.
13149         (Symbol::tls_got_offset): Removed.
13150         (Symbol::set_tls_got_offset): Removed.
13151         (Symbol::got_offset_): Removed.
13152         (Symbol::tls_mod_got_offset_): Removed.
13153         (Symbol::tls_pair_got_offset_): Removed.
13154         (Symbol::got_offsets_): New field.
13155         (Symbol::has_got_offset): Removed.
13156         (Symbol::has_tls_mod_got_offset): Removed.
13157         (Symbol::has_tls_pair_got_offset): Removed.
13158         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13159         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13160         member functions.
13161         (Target_x86_64::Scan::global): Likewise.
13162         (Target_x86_64::Relocate::relocate): Likewise.
13163         (Target_x86_64::Relocate::relocate_tls): Likewise.
13164
13165 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13166
13167         * yyscript.y: Fix spelling error in comment.
13168
13169 2008-03-24  Ian Lance Taylor  <iant@google.com>
13170
13171         * options.h (class General_options): Define build_id option.
13172         * layout.h (class Layout): Declare write_build_id, create_note,
13173         create_build_id.  Add build_id_note_ member.
13174         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13175         "libiberty.h", "md5.h", "sha1.h".
13176         (Layout::Layout): Initialize eh_frame_data_,
13177         eh_frame_hdr_section_, and build_id_note_.
13178         (Layout::finalize): Call create_build_id.
13179         (Layout::create_note): New function, broken out of
13180         Layout::create_gold_note.
13181         (Layout::create_gold_note): Call create_note.
13182         (Layout::create_build_id): New function.
13183         (Layout::write_build_id): New function.
13184         (Close_task_runner::run): Call write_build_id.
13185
13186         * x86_64.cc: Correct license to GPLv3.
13187
13188 2008-03-23  Ian Lance Taylor  <iant@google.com>
13189
13190         * options.cc: Include "demangle.h".
13191         (parse_optional_string): New function.
13192         (parse_long_option): Handle takes_optional_argument.
13193         (parse_short_option): Update dash_z initializer.  Handle
13194         takes_optional_argument.
13195         (General_options::General_options): Initialize do_demangle_.
13196         (General_options::finalize): Set do_demangle_.  Handle demangling
13197         style.
13198         * options.h (parse_optional_string): Declare.
13199         (struct One_option): Add optional_arg field.  Update constructor.
13200         Update call constructor calls.  Add takes_optional_argument
13201         function.
13202         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13203         (DEFINE_optional_string): Define.
13204         (General_options::demangle): Change from DEFINE_bool to
13205         DEFINE_optional_string.
13206         (General_options::no_demangle): New function.
13207         (General_options::do_demangle): New function.
13208         (General_options::set_do_demangle): New function.
13209         (General_options::execstack_status_): Move definition to end of
13210         class definition.
13211         (General_options::static_): Likewise.
13212         (General_options::do_demangle_): New field.
13213         * object.cc (big_endian>::get_symbol_location_info): Call
13214         Options::do_demangle, not Options::demangle.
13215         * symtab.cc (demangle): Likewise.
13216
13217 2008-03-22  Ian Lance Taylor  <iant@google.com>
13218
13219         * gold.h: Include <cstddef> and <sys/types.h>
13220         * options.h: Include <cstring>.
13221
13222 2008-03-21  Ian Lance Taylor  <iant@google.com>
13223
13224         * Added source code to GNU binutils.