* layout.cc (Layout::add_target_dynamic_tags): If
[external/binutils.git] / gold / ChangeLog
1 2012-08-07  Ian Lance Taylor  <iant@google.com>
2
3         * layout.cc (Layout::add_target_dynamic_tags): If
4         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
5         plt_rel.
6
7 2012-07-30  Nick Clifton  <nickc@redhat.com>
8
9         * po/gold.pot: Updated template.
10         * po/es.po: Updated Spanish translation.
11
12 2012-07-18  Cary Coutant  <ccoutant@google.com>
13
14         PR gold/14344
15         * configure.ac: Add check for -gpubnames support.
16         * configure: Regenerate.
17         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
18         support; force -gno-pubnames.
19         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
20         support.
21         (gdb_index_test_4): New test.
22         * testsuite/Makefile.in: Regenerate.
23         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
24         * testsuite/gdb_index_test_2.sh: Likewise.
25         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
26         * testsuite/gdb_index_test_4.sh: New script.
27         * testsuite/gdb_index_test_comm.sh: New script with common code;
28         don't look for space after colon.
29
30 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
31
32         * gold.cc (queue_middle_tasks): Update function order only after
33         deferred objects due to plugins are processed.
34
35 2012-07-11  Ian Lance Taylor  <iant@google.com>
36
37         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
38         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
39         (Target_arm::scan_reloc_for_stub): Likewise.
40         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
41         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
42         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
43         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
44         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
45
46 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
47             Ian Lance Taylor  <iant@google.com>
48
49         PR gold/14309
50         * configure.ac: Test whether std::tr1::hash<off_t> works.
51         * gold.h: Add a specialization for std::tr1::hash<off_t> if
52         needed.
53         * output.h (class Output_fill): Add virtual destructor.
54         * configure, config.in: Rebuild.
55
56 2012-06-22  Roland McGrath  <mcgrathr@google.com>
57
58         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
59
60 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
61
62         * plugin.cc (Plugin::load): Handle position independent executables.
63
64 2012-06-06  Cary Coutant  <ccoutant@google.com>
65
66         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
67         add .debug_macro.
68         (lines_only_debug_sections): Likewise.
69         (gdb_fast_lookup_sections): New static array.
70         (is_gdb_debug_section): Rename formal parameter.
71         (is_lines_only_debug_section): Likewise.
72         (is_gdb_fast_lookup_section): New function.
73         (Layout::include_section): Check for ".zdebug_" prefix; pass
74         section name suffix to is_gdb_debug_section, et al.; check for
75         fast-lookup sections when building .gdb_index.
76         * options.h (--strip-debug-gdb): Update GDB version number.
77
78 2012-06-06  Cary Coutant  <ccoutant@google.com>
79
80         * configure.ac: Add check for fallocate.
81         * configure: Regenerate.
82         * config.in: Regenerate.
83
84         * options.h (class General_options): Add --mmap-output-file and
85         --posix-fallocate options.
86         * output.cc: (posix_fallocate): Remove; replace with...
87         (gold_fallocate): New function.
88         (Output_file::map_no_anonymous): Call gold_fallocate.
89         (Output_file::map): Check --mmap-output-file option.
90
91 2012-06-05  Jing Yu  <jingyu@google.com>
92
93         * gold.h (textdomain): Add do {} to empty while(0).
94         (bindtextdomain): Likewise.
95
96 2012-06-04  Cary Coutant  <ccoutant@google.com>
97
98         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
99         has_dynsym_index.
100
101 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
102
103         * symtab.cc (Symbol_table::define_special_symbol):
104         Initialize *poldsym to prevent uninitialized variable errors.
105
106 2012-05-23  Cary Coutant  <ccoutant@google.com>
107
108         * layout.cc (Layout::section_name_mapping): Add rules to handle
109         exact match on .data.rel.ro.local or .data.rel.ro.
110         (Layout::output_section_name): Check for exact matches.
111
112 2012-05-23  Cary Coutant  <ccoutant@google.com>
113
114         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
115         more carefully.
116
117 2012-05-22  Cary Coutant  <ccoutant@google.com>
118
119         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
120         object before exporting symbol.
121
122 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
123
124         * testsuite/tls_test.cc: Include "config.h" first.
125         * testsuite/tls_test_c.c: Likewise.
126
127 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
128             Nick Clifton  <nickc@redhat.com>
129
130         PR 14072
131         * configure.in: Add check that sysdep.h has been included before
132         any system header files.
133         * configure: Regenerate.
134         * config.in: Regenerate.
135
136 2012-05-14  Cary Coutant  <ccoutant@google.com>
137
138         * layout.cc (Layout::make_output_section): Mark .tdata section
139         as RELRO.
140         * testsuite/relro_test.cc: Add a TLS variable.
141
142 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
143
144         PR gold/14091
145         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
146         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
147         R_X86_64_64.
148
149 2012-05-08  Cary Coutant  <ccoutant@google.com>
150
151         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
152         (lines_only_debug_sections): Likewise.
153
154 2012-05-02  Roland McGrath  <mcgrathr@google.com>
155
156         * nacl.cc: New file.
157         * nacl.h: New file.
158         * Makefile.am (CCFILES, HFILES): Add them.
159         * Makefile.in: Regenerate.
160         * i386.cc (Output_data_plt_i386_nacl): New class.
161         (Output_data_plt_i386_nacl_exec): New class.
162         (Output_data_plt_i386_nacl_dyn): New class.
163         (Target_i386_nacl): New class.
164         (Target_selector_i386_nacl): New class.
165         (target_selector_i386): Use it instead of Target_selector_i386.
166         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
167         (Target_x86_64_nacl): New class.
168         (Target_selector_x86_64_nacl): New class.
169         (target_selector_x86_64, target_selector_x32): Use it instead of
170         Target_selector_x86_64.
171         * arm.cc (Output_data_plt_arm_nacl): New class.
172         (Target_arm_nacl): New class.
173         (Target_selector_arm_nacl): New class.
174         (target_selector_arm, target_selector_armbe): Use it instead of
175         Target_selector_arm.
176
177         * target-select.cc (select_target): Take new Input_file* and off_t
178         arguments, pass them on to recognize method of selector.
179         * object.cc (make_elf_sized_object): Update caller.
180         * parameters.cc (parameters_force_valid_target): Likewise.
181         * incremental.cc (make_sized_incremental_binary): Likewise.
182         * target-select.h: Update decl.
183         (Target_selector::recognize): Take new Input_file* argument,
184         pass it on to do_recognize.
185         (Target_selector::do_recognize): Take new Input_file* argument.
186         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
187         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
188         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
189         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
190
191         * target.h (Target::Target_info): New members isolate_execinstr
192         and rosegment_gap.
193         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
194         * arm.cc (Target_arm::arm_info): Update initializer.
195         * i386.cc (Target_i386::i386_info): Likewise.
196         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
197         * sparc.cc (Target_sparc::sparc_info): Likewise.
198         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
199         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
200         * layout.cc (Layout::attach_allocated_section_to_segment):
201         Take new const Target* argument.  If target->isolate_execinstr(), act
202         like --rosegment.
203         (Layout::find_first_load_seg): Take new const Target* argument;
204         if target->isolate_execinstr(), reject PF_X segments.
205         (Layout::relaxation_loop_body): Update caller.
206         (Layout::set_segment_offsets): If target->isolate_execinstr(),
207         reset file offset to zero when we hit LOAD_SEG, and then do a second
208         loop over the segments before LOAD_SEG to reassign offsets after
209         addresses have been determined.  Handle target->rosegment_gap().
210         (Layout::attach_section_to_segment): Take new const Target* argument;
211         pass it to attach_allocated_section_to_segment.
212         (Layout::make_output_section): Update caller.
213         (Layout::attach_sections_to_segments): Take new const Target* argument;
214         pass it to attach_section_to_segment.
215         * gold.cc (queue_middle_tasks): Update caller.
216         * layout.h (Layout): Update method decls with new arguments.
217
218         * arm.cc (Target_arm::Target_arm): Take optional argument for the
219         Target_info pointer to use.
220         (Target_arm::do_make_data_plt): New virtual method.
221         (Target_arm::make_data_plt): New method that calls it.
222         (Target_arm::make_plt_entry): Use it.
223         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
224         for the section alignment.
225         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
226         method.
227         (Output_data_plt_arm::first_plt_entry_offset): Call it.
228         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
229         method.
230         (Output_data_plt_arm::get_plt_entry_size): Call it.
231         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
232         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
233         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
234         method.
235         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
236         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
237         method instead of sizeof(plt_entry).
238         (Output_data_plt_arm::add_entry): Likewise.
239         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
240         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
241         than static method.
242         (Target_arm::plt_entry_size): Likewise.
243         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
244         Move to ...
245         (Output_data_plt_arm_standard): ... here, new class.
246         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
247         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
248         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
249
250         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
251         Take additional argument for the PLT entry size.
252         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
253         Use get_plt_entry_size method rather than plt_entry_size variable.
254         (Output_data_plt_x86_64::reserve_slot): Likewise.
255         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
256         (Output_data_plt_x86_64::add_entry): Likewise.
257         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
258         (Output_data_plt_x86_64::address_for_global): Likewise.
259         (Output_data_plt_x86_64::address_for_local): Likewise.
260         (Output_data_plt_x86_64::set_final_data_size): Likewise.
261         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
262         Make method non-static.
263         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
264         method.
265         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
266         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
267         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
268         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
269         virtual method.
270         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
271         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
272         virtual method.
273         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
274         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
275         virtual method.
276         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
277         (Output_data_plt_x86_64::plt_entry_size)
278         (Output_data_plt_x86_64::first_plt_entry)
279         (Output_data_plt_x86_64::plt_entry)
280         (Output_data_plt_x86_64::tlsdesc_plt_entry)
281         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
282         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
283         (Output_data_plt_x86_64_standard): ... here, new class.
284         (Target_x86_64::Target_x86_64): Take optional argument for the
285         Target_info pointer to use.
286         (Target_x86_64::do_make_data_plt): New virtual method.
287         (Target_x86_64::make_data_plt): New method to call it.
288         (Target_x86_64::init_got_plt_for_update): Use that.
289         Call this->plt_->add_eh_frame method here.
290         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
291         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
292         rather than static method.
293         (Target_x86_64::plt_entry_size): Likewise.
294         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
295         rather than plt_entry_size variable.  Move guts of PLT filling to...
296         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
297         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
298         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
299
300         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
301         additional argument for the section alignment.
302         Don't do add_eh_frame_for_plt here.
303         (Output_data_plt_i386::first_plt_entry_offset): Make the method
304         non-static.  Use get_plt_entry_size method rather than plt_entry_size
305         variable.
306         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
307         method.
308         (Output_data_plt_i386::get_plt_entry_size): Call it.
309         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
310         (Output_data_plt_i386::add_eh_frame): New method to call it.
311         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
312         method.
313         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
314         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
315         method.
316         (Output_data_plt_i386::fill_plt_entry): New method to call it.
317         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
318         method instead of plt_entry_size.
319         (Output_data_plt_i386::plt_entry_size)
320         (Output_data_plt_i386::plt_eh_frame_fde_size)
321         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
322         (Output_data_plt_i386_standard): ... here, new class.
323         (Output_data_plt_i386_exec): New class.
324         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
325         (Output_data_plt_i386_exec::first_plt_entry): ... here.
326         (Output_data_plt_i386::exec_plt_entry): Move to ...
327         (Output_data_plt_i386_exec::plt_entry): ... here.
328         (Output_data_plt_i386_dyn): New class.
329         (Output_data_plt_i386::first_plt_entry): Move to ...
330         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
331         (Output_data_plt_i386::dyn_plt_entry): Move to ...
332         (Output_data_plt_i386_dyn::plt_entry): ... here.
333         (Target_i386::Target_i386): Take optional argument for the Target_info
334         pointer to use.
335         (Target_i386::do_make_data_plt): New virtual method.
336         (Target_i386::make_data_plt): New method to call it.
337         (Target_i386::make_plt_section): Use that.
338         Call this->plt_->add_eh_frame method here.
339         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
340         rather than plt_entry_size variable.
341         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
342         (Output_data_plt_i386::address_for_local): Likewise.
343         (Output_data_plt_i386::do_write): Likewise.
344         Move guts of PLT filling to...
345         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
346         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
347         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
348         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
349
350 2012-05-01  Cary Coutant  <ccoutant@google.com>
351
352         * dwarf_reader.cc (Dwarf_die::read_attributes)
353         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
354         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
355         * reduced_debug_output.cc
356         (Output_reduced_debug_info_section::get_die_end): Remove
357         DW_FORM_GNU_ref_index.  Add default case.
358
359 2012-04-26  Mark Wielaard  <mjw@redhat.com>
360
361         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
362         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
363         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
364         DW_AT_high_pc as offset from DW_AT_low_pc.
365
366         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
367         * testsuite/Makefile.in: Regenerate.
368         * testsuite/gdb_index_test_3.c: New test source file.
369         * testsuite/gdb_index_test_3.sh: New test source file.
370
371 2012-04-25  Ian Lance Taylor  <iant@google.com>
372
373         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
374         pointer.
375         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
376         as a class, not a struct.
377         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
378         (Target_arm::apply_cortex_a8_workaround): Likewise.
379         * gc.h: Declare Reloc_types as a struct, not a class.
380         * object.h: Declare Symbols_data as a struct.
381         * reloc.h: Declare Read_relocs_data as a struct.
382         * target.h: Declare Relocate_info as a struct.
383
384 2012-04-24  David S. Miller  <davem@davemloft.net>
385
386         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
387         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
388         and R_SPARC_WPLT30.
389
390 2012-04-24  Cary Coutant  <ccoutant@google.com>
391
392         * incremental-dump.cc (find_input_containing_global): Replace
393         magic number with symbolic constant.
394         (dump_incremental_inputs): Update version number.
395         * incremental.cc (Output_section_incremental_inputs): Update version
396         number; import symbolic constants from Incremental_inputs_reader.
397         (Incremental_inputs::create_data_sections): Align relocations
398         section correctly for 64-bit targets.
399         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
400         constants; add padding.
401         (Output_section_incremental_inputs::write_header): Add assert for
402         header_size.
403         (Output_section_incremental_inputs::write_input_files): Add assert
404         for input_entry_size.
405         (Output_section_incremental_inputs::write_info_blocks): Add padding;
406         add assert for object_info_size, input_section_entry_size,
407         global_sym_entry_size.
408         * incremental.h (Incremental_inputs_reader): Add symbolic constants
409         for data structure sizes; use them.
410         (Incremental_input_entry_reader): Import symbolic constants from
411         Incremental_inputs_reader; use them.
412
413 2012-04-23  David S. Miller  <davem@davemloft.net>
414
415         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
416         and elf_flags_set_.
417         (Target_sparc::Target_sparc): Initialize new fields.
418         (Target_sparc::do_make_elf_object): New function.
419         (Target_sparc::do_adjust_elf_header): New function.
420
421 2012-04-23  Cary Coutant  <ccoutant@google.com>
422
423         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
424         CU range table of gdb index.
425
426 2012-04-20  David S. Miller  <davem@davemloft.net>
427
428         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
429         instead of false.
430
431 2012-04-16  David S. Miller  <davem@davemloft.net>
432
433         * sparc.cc (Target_sparc::got_address): New function.
434         (Sparc_relocate_functions::gdop_hix22): New function.
435         (Sparc_relocate_functions::gdop_lox10): New function.
436         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
437         relocs.
438         (Target_sparc::Scan::local): Likewise if the global symbol is not
439         preemptible and is not IFUNC.
440         (Target_sparc::Relocate::relocate): Perform GOTDATA code
441         transformations for local and non-preemptible non-IFUNC global
442         symbols.
443
444         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
445         writing out 64-bit part of ranges.
446
447         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
448         -fpic and -fpie respectively.
449         * Makefile.in: Regenerate.
450
451         * sparc.cc (class Target_sparc): Add rela_ifunc_.
452         (Target_sparc::Target_sparc): Initialize new field.
453         (Target_sparc::do_plt_section_for_global): New function.
454         (Target_sparc::do_plt_section_for_local): New function.
455         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
456         (Target_sparc::make_plt_section): New function, broken out of
457         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
458         (Target_sparc::make_plt_entry): Call make_plt_section.
459         (Target_sparc::make_local_ifunc_plt_entry): New function.
460         (Target_sparc::rela_ifunc_section): New function.
461         (Target_sparc::plt_section): Remove const.
462         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
463         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
464         and ifunc_count_ fields.
465         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
466         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
467         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
468         (Output_data_plt_sparc::rela_ifunc): New function.
469         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
470         (Output_data_plt_sparc::has_ifunc_section): New function.
471         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
472         (Output_data_plt_sparc::address_for_global): New function.
473         (Output_data_plt_sparc::address_for_local): New function.
474         (Output_data_plt_sparc::plt_index_to_offset): New function.
475         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
476         and entry_count.
477         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
478         entry_count.
479         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
480         R_SPARC_JMP_IREL to switch.
481         (Target_sparc::Scan::check_non_pic): Likewise.
482         (Target_sparc::Scan::local): Handle IFUNC symbols.
483         (Target_sparc::Scan::local): Likewise.
484         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
485         and plt_address_for_local.
486         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
487         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
488
489         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
490         (class Output_data_reloc): Adjust calls to Output_reloc_type.
491         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
492         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
493         global relocs too.
494         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
495         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
496         calls.
497         * sparc.cc (Target_sparc::Scan::global): Likewise.
498         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
499
500 2012-04-16  Cary Coutant  <ccoutant@google.com>
501
502         * archive.cc (Library_base::should_include_member): Check for
503         --export-dynamic-symbol.
504         * options.h (class General_options): Add --export-dynamic-symbol.
505         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
506         --export-dynamic-symbol.
507         (Symbol_table::gc_mark_undef_symbols): Likewise.
508         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
509
510 2012-04-12  David S. Miller  <davem@davemloft.net>
511
512         * sparc.cc (Reloc::wdisp10): New relocation method.
513         (Reloc::h34): Likewise.
514         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
515         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
516         R_SPARC_WDISP10.
517         (Target_sparc::Scan::local): Likewise.
518         (Target_sparc::Scan::global): Likewise.
519         (Target_sparc::Relocate::relocate): Likewise.
520
521 2012-04-09  Cary Coutant  <ccoutant@google.com>
522
523         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
524         low_pc == 0.
525
526 2012-04-06  Ian Lance Taylor  <iant@google.com>
527
528         * timer.cc: #include <unistd.h>.
529
530 2012-04-06  Roland McGrath  <mcgrathr@google.com>
531
532         * configure.in (AC_CHECK_HEADERS): Add locale.h.
533         * config.in: Regenerate.
534         * configure: Regenerate.
535
536 2012-04-05  Nick Clifton  <nickc@redhat.com>
537
538         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
539         (AM_LC_MESSAGES): Add.
540         * aclocal.m4: Regenerate.
541         * config.in: Regenerate.
542         * configure: Regenerate.
543
544 2012-03-21  Cary Coutant  <ccoutant@google.com>
545
546         * Makefile.am: Add gdb-index.cc, gdb-index.h.
547         * Makefile.in: Regenerate.
548         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
549         (Sized_elf_reloc_mapper::symbol_section): New function.
550         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
551         (make_elf_reloc_mapper): New function.
552         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
553         (Dwarf_abbrev_table::do_read_abbrevs): New function.
554         (Dwarf_abbrev_table::do_get_abbrev): New function.
555         (Dwarf_ranges_table::read_ranges_table): New function.
556         (Dwarf_ranges_table::read_range_list): New function.
557         (Dwarf_pubnames_table::read_section): New function.
558         (Dwarf_pubnames_table::read_header): New function.
559         (Dwarf_pubnames_table::next_name): New function.
560         (Dwarf_die::Dwarf_die): New function.
561         (Dwarf_die::read_attributes): New function.
562         (Dwarf_die::skip_attributes): New function.
563         (Dwarf_die::set_name): New function.
564         (Dwarf_die::set_linkage_name): New function.
565         (Dwarf_die::attribute): New function.
566         (Dwarf_die::string_attribute): New function.
567         (Dwarf_die::int_attribute): New function.
568         (Dwarf_die::uint_attribute): New function.
569         (Dwarf_die::ref_attribute): New function.
570         (Dwarf_die::child_offset): New function.
571         (Dwarf_die::sibling_offset): New function.
572         (Dwarf_info_reader::check_buffer): New function.
573         (Dwarf_info_reader::parse): New function.
574         (Dwarf_info_reader::do_parse): New function.
575         (Dwarf_info_reader::do_read_string_table): New function.
576         (Dwarf_info_reader::lookup_reloc): New function.
577         (Dwarf_info_reader::get_string): New function.
578         (Dwarf_info_reader::visit_compilation_unit): New function.
579         (Dwarf_info_reader::visit_type_unit): New function.
580         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
581         Sized_elf_reloc_mapper.
582         (Sized_dwarf_line_info::symbol_section): Remove function.
583         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
584         (Sized_dwarf_line_info::read_line_mappings): Remove object
585         parameter, adjust callers.
586         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
587         * dwarf_reader.h: Include <sys/types.h>.
588         (class Track_relocs): Remove forward declaration.
589         (class Elf_reloc_mapper): New class.
590         (class Sized_elf_reloc_mapper): New class.
591         (class Dwarf_abbrev_table): New class.
592         (class Dwarf_range_list): New class.
593         (class Dwarf_ranges_table): New class.
594         (class Dwarf_pubnames_table): New class.
595         (class Dwarf_die): New class.
596         (class Dwarf_info_reader): New class.
597         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
598         (Sized_dwarf_line_info::symbol_section): Remove member function.
599         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
600         base class.
601         * gdb-index.cc: New source file.
602         * gdb-index.h: New source file.
603         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
604         and .debug_types sections, call Layout::add_to_gdb_index.
605         (Sized_relobj_incr::do_section_name): Implement.
606         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
607         return type; Implement.
608         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
609         return type.
610         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
611         parameter list and return type.
612         (Sized_incr_dynobj::do_section_contents): Likewise.
613         * layout.cc: Include gdb-index.h.
614         (Layout::Layout): Initialize gdb_index_data_.
615         (Layout::init_fixed_output_section): Check for .gdb_index section.
616         (Layout::add_to_gdb_index): New function. Instantiate.
617         * layout.h: Add forward declaration for class Gdb_index.
618         (Layout::add_to_gdb_index): New member function.
619         (Layout::gdb_index_data_): New data member.
620         * main.cc: Include gdb-index.h.
621         (main): Print statistics for gdb index.
622         * object.cc (Object::section_contents): Move code into
623         do_section_contents.
624         (need_decompressed_section): Check for sections needed when building
625         gdb index.
626         (build_compressed_section_map): Likewise.
627         (Sized_relobj_file::do_read_symbols): Need local symbols when building
628         gdb index.
629         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
630         sections; call Layout::add_to_gdb_index.
631         (Sized_relobj_file::do_decompressed_section_contents): Call
632         do_section_contents directly.
633         * object.h (Object::do_section_contents): Adjust parameter list and
634         return type.
635         (Object::do_decompressed_section_contents): Call do_section_contents
636         directly.
637         (Sized_relobj_file::do_section_contents): Adjust parameter list and
638         return type.
639         * options.h (class General_options): Add --gdb-index option.
640         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
641         list and return type.
642         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
643         * reloc.h (Track_relocs::checkpoint): New function.
644         (Track_relocs::reset): New function.
645
646         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
647         New test cases.
648         * testsuite/Makefile.in: Regenerate.
649         * testsuite/gdb_index_test.cc: New test source file.
650         * testsuite/gdb_index_test_1.sh: New test source file.
651         * testsuite/gdb_index_test_2.sh: New test source file.
652
653 2012-03-19  Doug Kwan  <dougkwan@google.com>
654
655         * arm.cc (Target_arm::do_define_standard_symbols): New method.
656         (Target_arm::do_finalize_sections): Remove code which defines
657         __exidx_start and __exidx_end.  Make symbol table parameter
658         anonymous as it is not used.
659         * gold.cc (queue_middle_tasks): Call target hook to define any
660         target-specific symbols.
661         * target.h (Target::define_standard_symbols): New method.
662         (Target::do_define_standard_symbols): Same.
663         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
664         * testsuite/Makefile.in: Regenerate.
665         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
666         and __exidx_end.
667         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
668         relocations are generated for __exidx_start and __exidx_end.
669
670 2012-03-16  Doug Kwan  <dougkwan@google.com>
671
672         * testsuite/Makefile.am: Disable test initpri3b.
673         * testsuite/Makefile.in: Regenerate.
674
675 2012-03-15  Doug Kwan  <dougkwan@google.com>
676
677         * arm.cc (Target_arm::got_section): Make .got section read-only
678         if -z now is given.
679
680 2012-03-15  Ian Lance Taylor  <iant@google.com>
681
682         PR gold/13850
683         * layout.cc (Layout::make_output_section): Correctly mark
684         SHT_INIT_ARRAY, et. al., as relro.
685
686 2012-03-14  Doug Kwan  <dougkwan@google.com>
687
688         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
689         dynamic relocations for protected symbols in shared objects.
690
691 2012-03-13  Ian Lance Taylor  <iant@google.com>
692
693         * resolve.cc (Symbol_table::resolve): When merging common symbols,
694         keep the larger alignment.
695
696 2012-03-12  Cary Coutant  <ccoutant@google.com>
697
698         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
699         handling of DW_LNE_define_file.
700
701 2012-03-12  Cary Coutant  <ccoutant@google.com>
702
703         * reduced_debug_output.cc
704         (Output_reduced_debug_info_section::get_die_end): Add new FORM
705         codes to switch.
706
707 2012-02-29  Cary Coutant  <ccoutant@google.com>
708
709         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
710
711 2012-02-29  Cary Coutant  <ccoutant@google.com>
712
713         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
714         Call Object::decompressed_section_contents.
715         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
716         New dtor.
717         (Sized_dwarf_line_info::buffer_start_): New data member.
718         * merge.cc (Output_merge_data::do_add_input_section): Call
719         Object::decompressed_section_contents.
720         (Output_merge_string::do_add_input_section): Likewise.
721         * object.cc (need_decompressed_section): New function.
722         (build_compressed_section_map): Decompress sections needed later.
723         (Sized_relobj_file::do_decompressed_section_contents): New function.
724         (Sized_relobj_file::do_discard_decompressed_sections): New function.
725         * object.h (Object::decompressed_section_contents): New function.
726         (Object::discard_decompressed_sections): New function.
727         (Object::do_decompressed_section_contents): New function.
728         (Object::do_discard_decompressed_sections): New function.
729         (Compressed_section_info): New type.
730         (Compressed_section_map): Include decompressed section contents.
731         (Sized_relobj_file::do_decompressed_section_contents): New function.
732         (Sized_relobj_file::do_discard_decompressed_sections): New function.
733
734 2012-02-16  Cary Coutant  <ccoutant@google.com>
735
736         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
737         * testsuite/Makefile.in: Regenerate.
738
739 2012-02-14  Cary Coutant  <ccoutant@google.com>
740
741         * options.cc (General_options::finalize): Disallow -pie and -static.
742
743 2012-02-03  Doug Kwan  <dougkwan@google.com>
744
745         * arm.cc (Arm_relocate_functions::abs8,
746         Arm_relocate_functions::abs16): Use
747         Bits::has_signed_unsigned_overflow32.
748         (Arm_relocate_functions::thm_abs8): Correct range of
749         overflow check.
750         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
751         in assertions.
752
753 2012-02-02  Doug Kwan  <dougkwan@google.com>
754
755         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
756         position independent outputs, not just shared objects.
757
758 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
759
760         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
761         * configure: Regenerated.
762
763 2012-01-27  Ian Lance Taylor  <iant@google.com>
764
765         * reloc.h (Bits): New class with static functions, copied from
766         namespace utils in arm.cc.
767         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
768         instead.
769
770 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
771
772         * incremental.cc (write_info_blocks): Correct relocation offset.
773
774 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
775
776         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
777         (Relocate::tls_gd_to_le): Likewise.
778
779 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
780
781         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
782
783 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
784
785         * configure.ac: Check if -mcmodel=medium works.
786         * configure: Regenerated.
787
788 2012-01-24  Cary Coutant  <ccoutant@google.com>
789
790         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
791         definition and ...
792         (read_unsigned_LEB_128_x): ... this new function.
793         (read_signed_LEB_128): Replaced with inline definition and ...
794         (read_signed_LEB_128_x): ... this new function.
795         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
796         (read_unsigned_LEB_128): Add inline definition.
797         (read_signed_LEB_128_x): New function.
798         (read_signed_LEB_128): Add inline definition.
799         * testsuite/Makefile.am (leb128_unittest): New unit test.
800         * testsuite/Makefile.in: Regenerate.
801         * testsuite/leb128_unittest.cc: New unit test.
802
803 2012-01-23  Ian Lance Taylor  <iant@google.com>
804
805         PR gold/13617
806         * i386.cc (Target_i386::do_code_fill): When using a jmp
807         instruction, pad with nop instructions.
808         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
809
810 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
811
812         * x86_64.cc (gc_process_relocs): Add typename on types used in
813         template.
814         (scan_relocs): Likewise.
815         (relocate_section): Likewise.
816         (apply_relocation): Likewise.
817
818 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
819
820         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
821         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
822         under x32.
823
824 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
825
826         * x86_64.cc: Initial support for x32.
827
828 2012-01-03  Cary Coutant  <ccoutant@google.com>
829
830         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
831         Use abstract base class for GOT.
832         * gold/output.h (class Output_data_got_base): New abstract base class.
833         (class Output_data_got): Derive from new base class, adjust ctors.
834         (Output_data_got::reserve_slot): Make virtual; rename to
835         do_reserve_slot; Adjust callers.
836         * gold/target.h (Sized_target::init_got_plt_for_update): Return
837         pointer to abstract base class.
838         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
839
840 2011-12-18  Ian Lance Taylor  <iant@google.com>
841
842         * object.h (Relobj::local_symbol_value): New function.
843         (Relobj::local_plt_offset): New function.
844         (Relobj::local_has_got_offset): New function.
845         (Relobj::local_got_offset): New function.
846         (Relobj::set_local_got_offset): New function.
847         (Relobj::do_local_symbol_value): New pure virtual function.
848         (Relobj::do_local_plt_offset): Likewise.
849         (Relobj::do_local_has_got_offset): Likewise.
850         (Relobj::do_local_got_offset): Likewise.
851         (Relobj::do_set_local_got_offset): Likewise.
852         (Sized_relobj::do_local_has_got_offset): Rename from
853         local_has_got_offset.
854         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
855         (Sized_relobj::do_set_local_got_offset): Rename from
856         set_local_got_offset.
857         (Sized_relobj_file::do_local_plt_offset): Rename from
858         local_plt_offset.
859         (Sized_relobj_file::do_local_symbol_value): New function.
860         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
861         local_plt_offset.
862         * output.cc (Output_data_got::Got_entry::write): Change object to
863         Relobj.  Use local_symbol_value.
864         (Output_data_got::add_global_with_rel): Change rel_dyn to
865         Output_data_reloc_generic*.  Use add_global_generic.
866         (Output_data_got::add_global_with_rela): Remove.  Change all
867         callers to use add_global_with_rel.
868         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
869         Output_data_reloc_generic*.  Use add_global_generic.
870         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
871         callers to use add_global_pair_with_rel.
872         (Output_data_got::add_local): Change object to Relobj*.
873         (Output_data_got::add_local_plt): Likewise.
874         (Output_data_got::add_local_with_rel): Change object to Relobj*,
875         change rel_dyn to Output_data_reloc_generic*.  Use
876         add_local_generic.
877         (Output_data_got::add_local_with_rela): Remove.  Change all
878         callers to use all_local_with_rel.
879         (Output_data_got::add_local_pair_with_rel): Change object to
880         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
881         add_output_section_generic.
882         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
883         callers to use add_local_pair_with_rel.
884         (Output_data_got::reserve_local): Change object to Relobj*.
885         * output.h: (class Output_data_reloc_generic): Add pure virtual
886         declarations for add_global_generic, add_local_generic,
887         add_output_section_generic.
888         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
889         functions for Output_data_reloc_generic.  Update declarations for
890         changes listed in output.cc.
891         (class Output_data_got): Change template parameter to got_size.
892         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
893         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
894         function.
895         (Sized_relobj_incr::do_local_plt_offset): New function.
896         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
897         add_global_generic.
898
899 2011-12-17  Cary Coutant  <ccoutant@google.com>
900
901         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
902         * resolve.cc (Symbol_table::resolve): Likewise.
903         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
904         arrays.
905         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
906
907 2011-12-16  Ian Lance Taylor  <iant@google.com>
908
909         * output.h (Output_data_reloc_generic::add): Only call
910         add_dynamic_reloc if this is a dynamic reloc section.
911
912 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
913
914         PR gold/13505
915         * target-reloc.h (apply_relocation): Replace <64, false> with
916         <size, big_endian>.
917
918 2011-11-25  Nick Clifton  <nickc@redhat.com>
919
920         * po/it.po: New Italian translation.
921
922 2011-11-17  Sterling Augustine  <saugustine@google.com>
923
924         * script.cc (script_include_directive): Implement.
925         (read_script_file): New local variables name and search_path. Update
926         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
927         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
928         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
929
930 2011-11-11  Sterling Augustine  <saugustine@google.com>
931
932         * yyscript.y (section_cmd): Add support for INCLUDE directive.
933         (file_or_sections_cmd): Likewise.
934
935 2011-11-11  Doug Kwan  <dougkwan@google.com>
936
937         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
938         if --just-symbols is given.
939
940 2011-11-10  Doug Kwan  <dougkwan@google.com>
941
942         PR gold/13362
943         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
944         when processing data relocs.
945         * reloc.h (Relocate_functions::rel_unaligned): New method.
946         (Relocate_functions::pcrel_unaligned): Ditto.
947         (Relocate_functions::rel32_unaligned): Ditto.
948         (Relocate_functions::pcrel32_unaligned): Ditto.
949
950 2011-11-09  Doug Kwan  <dougkwan@google.com>
951
952         PR gold/13362
953         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
954         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
955         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
956         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
957         (Relocate_functions::rel_unaligned): New.
958         (Relocate_functions::rel32_unaligned): New.
959         * target-reloc.h (relocate_for_relocatable): Add code to handle
960         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
961         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
962         arm_unaligned_reloc_r): New targets.
963         * testsuite/Makefile.in: Regenerate.
964         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
965         linking.
966
967 2011-11-02  Ian Lance Taylor  <iant@google.com>
968
969         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
970         NATIVE_LINKER.
971         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
972         * options.cc (General_options::finalize): Use library search path
973         from configure script if specified.  If not native and no sysroot,
974         only search TOOLLIBDIR.
975         * options.h (Search_directory::Search_directory): Change name to
976         const std::string&.
977         (General_options::add_to_library_path_with_sysroot): Change arg to
978         const std::string&.
979         * configure, Makefile.in, config.in: Rebuild.
980
981 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
982
983         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
984         we are working around the ARM1176 Erratum.
985         * options.h (General_options::fix_arm1176): Add option.
986         * testsuite/Makefile.am: Add testcases, and keep current ones
987         working.
988         * testsuite/Makefile.in: Regenerate.
989         * testsuite/arm_fix_1176.s: New file.
990         * testsuite/arm_fix_1176.sh: Likewise.
991
992 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
993
994         * arm.cc (Target_arm::Target_arm): Remove initialisation of
995         may_use_blx_.
996         (Target_arm::may_use_blx): Remove method.
997         (Target_arm::set_may_use_blx): Likewise.
998         (Target_arm::may_use_v4t_interworking): New method.
999         (Target_arm::may_use_v5t_interworking): Likewise.
1000         (Target_arm::may_use_blx_): Remove member variable.
1001         (Arm_relocate_functions::arm_branch_common): Check for v5T
1002         interworking.
1003         (Arm_relocate_functions::thumb_branch_common): Likewise.
1004         (Reloc_stub::stub_type_for_reloc): Likewise.
1005         (Target_arm::do_finalize_sections): Correct interworking checks.
1006         * testsuite/Makefile.am: Add new tests.
1007         * testsuite/Makefile.in: Regenerate.
1008         * testsuite/arm_farcall_arm_arm.s: New test.
1009         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1010         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1011         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1012         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1013         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1014         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1015         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1016
1017 2011-10-31  Cary Coutant  <ccoutant@google.com>
1018
1019         PR gold/13023
1020         * expression.cc (Expression::eval_with_dot): Add
1021         is_section_dot_assignment parameter.
1022         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1023         absolute and assigning to dot within a section.
1024         * script-sections.cc
1025         (Output_section_element_assignment::set_section_addresses): Pass
1026         dot_section to set_if_absolute.
1027         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1028         as is_section_dot_assignment flag to eval_with_dot.
1029         (Output_section_element_dot_assignment::set_section_addresses):
1030         Likewise.
1031         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1032         parameter.  Also set value if relative to dot_section; set the
1033         symbol's output_section.
1034         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1035         parameter.  Adjust all callers.
1036         (Expression::eval_maybe_dot): Likewise.
1037         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1038         Adjust all callers.
1039         * testsuite/script_test_2.t: Test assignment of an absolute value
1040         to dot within an output section element.
1041
1042 2011-10-31  Cary Coutant  <ccoutant@google.com>
1043
1044         * options.h (class General_options): Add --[no-]gnu-unique options.
1045         * symtab.cc (Symbol_table::sized_write_globals): Convert
1046         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1047
1048 2011-10-31  Cary Coutant  <ccoutant@google.com>
1049
1050         PR gold/13359
1051         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1052         unnecessary assertion.
1053         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1054
1055 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1056
1057         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1058         gc_mark_symbol.
1059         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1060         gc_mark_symbol.
1061         Change to just keep the section associated with symbol.
1062         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1063         they are externally visible and --export-dynamic is turned on.
1064         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1065
1066 2011-10-19  Ian Lance Taylor  <iant@google.com>
1067
1068         PR gold/13163
1069         * script-sections.cc
1070         (Output_section_element_dot_assignment::needs_output_section): New
1071         function.
1072
1073 2011-10-19  Ian Lance Taylor  <iant@google.com>
1074
1075         PR gold/13204
1076         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1077         --section-start option was seen.
1078         * options.h (General_options::any_section_start): New function.
1079
1080 2011-10-18  David S. Miller  <davem@davemloft.net>
1081
1082         PR binutils/13301
1083         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1084         member to track relocation locations that have moved during TLS
1085         reloc optimizations.
1086         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1087         (Target_sparc::Relocate::relocate): Adjust view down by 4
1088         bytes if it matches reloc_adjust_addr_.
1089         (Target_sparc::Relocate::relocate_tls): Always move the
1090         __tls_get_addr call delay slot instruction forward 4 bytes when
1091         performing relaxation.
1092
1093 2011-10-18  Cary Coutant  <ccoutant@google.com>
1094
1095         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1096         (Output_file::map_no_anonymous): Check for non-zero
1097         return code from posix_fallocate.
1098
1099 2011-10-17  Cary Coutant  <ccoutant@google.com>
1100
1101         PR gold/13245
1102         * plugin.cc (is_visible_from_outside): Check for symbols
1103         referenced from dynamic objects.
1104         * resolve.cc (Symbol_table::resolve): Don't count references
1105         from dynamic objects as references from real ELF files.
1106         * testsuite/plugin_test_2.sh: Adjust expected result.
1107
1108 2011-10-17  Cary Coutant  <ccoutant@google.com>
1109
1110         * gold.cc: Include timer.h.
1111         (queue_middle_tasks): Stamp time.
1112         (queue_final_tasks): Likewise.
1113         * main.cc (main): Store timer in parameters.  Print timers
1114         for each pass.
1115         * parameters.cc (Parameters::Parameters): Initialize timer_.
1116         (Parameters::set_timer): New function.
1117         (set_parameters_timer): New function.
1118         * parameters.h (Parameters::set_timer): New function.
1119         (Parameters::timer): New function.
1120         (Parameters::timer_): New data member.
1121         (set_parameters_timer): New function.
1122         * timer.cc (Timer::stamp): New function.
1123         (Timer::get_pass_time): New function.
1124         * timer.h (Timer::stamp): New function.
1125         (Timer::get_pass_time): New function.
1126         (Timer::pass_times_): New data member.
1127
1128 2011-10-17  Cary Coutant  <ccoutant@google.com>
1129
1130         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1131         task for members of lib groups.
1132
1133 2011-10-17  Cary Coutant  <ccoutant@google.com>
1134
1135         PR gold/13288
1136         * fileread.cc (File_read::find_view): Add assert.
1137         (File_read::make_view): Move bounds check (replace with assert)...
1138         (File_read::find_or_make_view): ... to here.
1139
1140 2011-10-12  Cary Coutant  <ccoutant@google.com>
1141
1142         * output.cc (Output_file::open_base_file): Handle case where
1143         ::read returns less than requested size.
1144
1145 2011-10-10  Cary Coutant  <ccoutant@google.com>
1146
1147         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1148         Initialize defined_count_.
1149         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1150         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1151         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1152         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1153         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1154         * incremental.h (Sized_relobj_incr::defined_count_): New data
1155         member.
1156         (Sized_incr_dynobj::defined_count_): New data member.
1157         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1158         Return zeroes instead of internal error.
1159
1160 2011-10-10  Cary Coutant  <ccoutant@google.com>
1161
1162         PR gold/13249
1163         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1164         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1165         * output.h (class Output_reloc): Add use_plt_offset flag.
1166         (Output_reloc::type_): Adjust size of bit field.
1167         (Output_reloc::use_plt_offset_): New bit field.
1168         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1169         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1170         flag.  Adjust all callers.
1171         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1172         creating RELATIVE relocations.
1173
1174 2011-10-10  Nick Clifton  <nickc@redhat.com>
1175
1176         * po/es.po: Updated Spanish translation.
1177         * po/fi.po: Updated Finnish translation.
1178
1179 2011-10-03   Diego Novillo  <dnovillo@google.com>
1180
1181         * options.cc (parse_uint): Fix dereference of RETVAL.
1182
1183 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1184
1185         * layout.h (section_order_map_): New member.
1186         (get_section_order_map): New member function.
1187         * output.cc (Output_section::add_input_section): Check for patterns
1188         only when --section-ordering-file is specified.
1189         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1190         output_sections have been formed.
1191         * layout.cc (Layout_Layout): Initialize section_order_map_.
1192         * plugin.cc (update_section_order): Store order in order_map. Do not
1193         update the order.
1194         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1195         * testsuite/Makefile.in: Regenerate.
1196         * testsuite/plugin_section_order.c: New file.
1197         * testsuite/plugin_final_layout.cc: New file.
1198         * testsuite/plugin_final_layout.sh: New file.
1199
1200 2011-09-29  Cary Coutant  <ccoutant@google.com>
1201
1202         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1203         Check for NULL.
1204         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1205         symbols during incremental update.
1206         (Symbol_table::add_from_dynobj): Likewise.
1207
1208 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1209             Ian Lance Taylor  <iant@google.com>
1210
1211         * symtab.cc (Symbol_table::define_special_symbol): Always
1212         canonicalize version string.
1213
1214 2011-09-26  Cary Coutant  <ccoutant@google.com>
1215
1216         * gold.cc (queue_initial_tasks): Move option checks ...
1217         * options.cc (General_options::finalize): ... to here. Disable
1218         some options; make others fatal.
1219
1220 2011-09-26  Cary Coutant  <ccoutant@google.com>
1221
1222         gcc PR lto/47247
1223         * plugin.cc (get_symbols_v2): New function.
1224         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1225         (is_referenced_from_outside): New function.
1226         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1227         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1228         (get_symbols): Pass version parameter.
1229         (get_symbols_v2): New function.
1230         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1231         parameter.
1232         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1233         (onload): Add LDPT_GET_SYMBOLS_V2.
1234         (all_symbols_read_hook): Use get_symbols_v2; check for
1235         LDPR_PREVAILING_DEF_IRONLY_EXP.
1236         * testsuite/plugin_test_3.sh: Update expected results.
1237
1238 2011-09-23  Simon Baldwin  <simonb@google.com>
1239
1240         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1241         configuration options.
1242         * configure: Regenerate.
1243         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1244         * Makefile.in: Regenerate.
1245         * testsuite/Makefile.in: Regenerate.
1246
1247 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1248
1249         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1250
1251 2011-09-19  Cary Coutant  <ccoutant@google.com>
1252
1253         * incremental.cc (can_incremental_update): Fix typo in comment.
1254         * incremental.h (can_incremental_update): Likewise.
1255
1256 2011-09-18  Cary Coutant  <ccoutant@google.com>
1257
1258         * incremental.cc (can_incremental_update): New function.
1259         * incremental.h (can_incremental_update): New function.
1260         * layout.cc (Layout::init_fixed_output_section): Call it.
1261         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1262         * object.cc (Sized_relobj_file::do_layout): Call
1263         can_incremental_update.
1264
1265 2011-09-13  Cary Coutant  <ccoutant@google.com>
1266
1267         * configure.ac: Check for glibc support for gnu_indirect_function
1268         support with static linking, setting automake conditional
1269         IFUNC_STATIC.
1270         * Makefile.in: Regenerate.
1271         * configure: Regenerate.
1272
1273         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1274         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1275         for IFUNC_STATIC.
1276         * testsuite/Makefile.in: Regenerate.
1277
1278 2011-09-13  Cary Coutant  <ccoutant@google.com>
1279
1280         * incremental.cc (Sized_relobj_incr::do_layout): Call
1281         report_comdat_group for kept comdat sections.
1282         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1283         * testsuite/Makefile.in: Regenerate.
1284         * testsuite/incr_comdat_test_1.cc: New source file.
1285         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1286         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1287         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1288
1289 2011-09-13  Ian Lance Taylor  <iant@google.com>
1290
1291         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1292         variable external_symbols_offset.
1293
1294 2011-09-12  Ian Lance Taylor  <iant@google.com>
1295
1296         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1297         triggered if object has no symbols.
1298
1299 2011-09-09  David S. Miller  <davem@davemloft.net>
1300
1301         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1302         (Output_fill_debug_line::do_write): Likewise.
1303
1304 2011-08-29  Cary Coutant  <ccoutant@google.com>
1305
1306         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1307         casts to match formatting specs.
1308         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1309
1310 2011-08-26  Cary Coutant  <ccoutant@google.com>
1311
1312         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1313         remaining hole size when allocating.
1314         (Layout::make_output_section): Set fill methods for debug sections.
1315         * layout.h (Free_list::Free_list_node): Move from private to
1316         public.
1317         (Free_list::set_min_hole_size): New function.
1318         (Free_list::begin, Free_list::end): New functions.
1319         (Free_list::min_hole_): New data member.
1320         * output.cc: Include dwarf.h.
1321         (Output_fill_debug_info::do_minimum_hole_size): New function.
1322         (Output_fill_debug_info::do_write): New function.
1323         (Output_fill_debug_line::do_minimum_hole_size): New function.
1324         (Output_fill_debug_line::do_write): New function.
1325         (Output_section::Output_section): Initialize new data member.
1326         (Output_section::set_final_data_size): Ensure patch space is larger
1327         than minimum hole size.
1328         (Output_section::do_write): Fill holes in debug sections.
1329         * output.h (Output_fill): New class.
1330         (Output_fill_debug_info): New class.
1331         (Output_fill_debug_line): New class.
1332         (Output_section::set_free_space_fill): New function.
1333         (Output_section::free_space_fill_): New data member.
1334         * testsuite/Makefile.am (incremental_test_3): Add
1335         --incremental-patch option.
1336         (incremental_test_4): Likewise.
1337         (incremental_test_5): Likewise.
1338         (incremental_test_6): Likewise.
1339         (incremental_copy_test): Likewise.
1340         (incremental_common_test_1): Likewise.
1341         * testsuite/Makefile.in: Regenerate.
1342
1343 2011-08-26  Nick Clifton  <nickc@redhat.com>
1344
1345         * po/es.po: Updated Spanish translation.
1346
1347 2011-08-01  Cary Coutant  <ccoutant@google.com>
1348
1349         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1350         * gold/testsuite/Makefile.in: Regenerate.
1351         * gold/testsuite/justsyms_exec.c: New source file.
1352         * gold/testsuite/justsyms_lib.c: New source file.
1353
1354 2011-08-01  Cary Coutant  <ccoutant@google.com>
1355
1356         * layout.cc (Layout::set_segment_offsets): Don't realign text
1357         segment if -Ttext was specified.
1358         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1359         file type.
1360         * object.h (Sized_relobj_file::e_type): New function.
1361         (Sized_relobj_file::e_type_): New data member.
1362         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1363         base address for ET_EXEC files.
1364         * target.cc (Target::do_make_elf_object_implementation): Allow
1365         ET_EXEC files with --just-symbols option.
1366
1367 2011-07-28  Cary Coutant  <ccoutant@google.com>
1368
1369         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1370         Add thread_number parameter.
1371         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1372         * workqueue-threads.cc
1373         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1374         current thread if its thread number is greater than desired thread
1375         count.
1376         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1377         Add thread_number parameter.
1378         (Workqueue::should_cancel_thread): Likewise.
1379         (Workqueue::find_runnable_or_wait): Pass thread_number to
1380         should_cancel_thread.
1381         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1382         parameter.
1383
1384 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1385
1386         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1387         only after checking if it cannot be forced local.
1388         * symtab.h (is_externally_visible): Check if the symbol is not forced
1389         local.
1390
1391 2011-07-15  Ian Lance Taylor  <iant@google.com>
1392
1393         * options.h (class General_options): Add --print-output-format.
1394         Move -EL next to -EB, for  better --help output.
1395         * target-select.cc: Include <cstdio>, "options.h", and
1396         "parameters.h".
1397         (Target_selector::do_target_bfd_name): New function.
1398         (print_output_format): New function.
1399         * target-select.h (class Target_selector): Update declarations.
1400         (Target_selector::target_bfd_name): New function.
1401         (print_output_format): Declare.
1402         * main.cc: Include "target-select.h".
1403         (main): Handle --print-output-format.
1404         * gold.cc: Include "target-select.h".
1405         (queue_initial_tasks): Handle --print-output-format when there are
1406         no input files.
1407         * parameters.cc (parameters_force_valid_target): Give a better
1408         error message if -EB/-EL does not match target.
1409         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1410         function.
1411
1412 2011-07-15  Ian Lance Taylor  <iant@google.com>
1413
1414         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1415         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1416         (Output_data_plt_i386::do_write): Write address of .dynamic
1417         section to first entry in .got.plt section.
1418         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1419         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1420         Initialize layout_.
1421         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1422         section to first entry in .got.plt section.
1423         * layout.h (Layout::dynamic_section): New function.
1424
1425 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1426
1427         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1428         to claim_file call.
1429         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1430         input_section_position_, and input_section_glob_.
1431         (read_layout_from_file): Call function section_ordering_specified.
1432         * layout.h (is_section_ordering_specified): New function.
1433         (section_ordering_specified): New function.
1434         (section_ordering_specified_): New boolean member.
1435         * main.cc(main): Call load_plugins after layout object is defined.
1436         * output.cc (Output_section::add_input_section): Use
1437         function section_ordering_specified to check if section ordering is
1438         needed.
1439         * output.cc (Output_section::add_relaxed_input_section): Use
1440         function section_ordering_specified to check if section ordering is
1441         needed.
1442         (Output_section::update_section_layout): New function.
1443         (Output_section::sort_attached_input_sections): Check if input section
1444         must be reordered.
1445         * output.h (Output_section::update_section_layout): New function.
1446         * plugin.cc (get_section_count): New function.
1447         (get_section_type): New function.
1448         (get_section_name): New function.
1449         (get_section_contents): New function.
1450         (update_section_order): New function.
1451         (allow_section_ordering): New function.
1452         (Plugin::load): Add the new interfaces to the transfer vector.
1453         (Plugin_manager::load_plugins): New parameter.
1454         (Plugin_manager::all_symbols_read): New parameter.
1455         (Plugin_manager::claim_file): New parameter. Save the elf object for
1456         unclaimed objects.
1457         (Plugin_manager::get_elf_object): New function.
1458         (Plugin_manager::get_view): Change to directly use the bool to check
1459         if get_view is called from claim_file_hook.
1460         * plugin.h (input_objects): New function
1461         (Plugin__manager::load_plugins): New parameter.
1462         (Plugin_manager::claim_file): New parameter.
1463         (Plugin_manager::get_elf_object): New function.
1464         (Plugin_manager::in_claim_file_handler): New function.
1465         (Plugin_manager::in_claim_file_handler_): New member.
1466         (layout): New function.
1467         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1468         handler with an extra parameter. Make the elf object before calling
1469         claim_file handler.
1470         * testsuite/plugin_test.c (get_section_count): New function pointer.
1471         (get_section_type): New function pointer.
1472         (get_section_name): New function pointer.
1473         (get_section_contents): New function pointer.
1474         (update_section_order): New function pointer.
1475         (allow_section_ordering): New function pointer.
1476         (onload): Check if the new interfaces exist.
1477
1478 2011-07-13  Ian Lance Taylor  <iant@google.com>
1479
1480         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1481         relro section.
1482         * x86_64.cc (Target_x86_64::got_section): Likewise.
1483         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1484         (relro_now_test_SOURCES): New variable.
1485         (relro_now_test_DEPENDENCIES): New variable.
1486         (relro_now_test_LDFLAGS): New variable.
1487         (relro_now_test_LDADD): New variable.
1488         (relro_now_test.so): New target.
1489         * testsuite/Makefile.in: Rebuild.
1490
1491 2011-07-12  Ian Lance Taylor  <iant@google.com>
1492
1493         PR gold/12980
1494         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1495         GLOB_DAT relocation rather than a RELATIVE relocation for a
1496         protected symbol when creating a shared library.
1497         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1498         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1499         * testsuite/protected_main_1.cc (main): Test that protected
1500         function has same address.
1501
1502 2011-07-11  Ian Lance Taylor  <iant@google.com>
1503
1504         PR gold/12979
1505         * options.h (class General_options): Add -Bgroup.
1506         * options.cc (General_options::finalize): If -Bgroup is set,
1507         default to --unresolved-symbols=report-all.
1508         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1509         * target-reloc.h (issue_undefined_symbol_error): Handle
1510         --unresolved-symbols=report-all.
1511
1512 2011-07-08  Ian Lance Taylor  <iant@google.com>
1513
1514         PR gold/11985
1515         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1516         if linker script discards key sections.
1517         (Layout::create_dynamic_symtab): Likewise.
1518         (Layout::assign_local_dynsym_offsets): Likewise.
1519         (Layout::sized_create_version_sections): Likewise.
1520         (Layout::create_interp): Likewise.
1521         (Layout::finish_dynamic_section): Likewise.
1522         (Layout::set_dynamic_symbol_size): Likewise.
1523
1524 2011-07-08  Ian Lance Taylor  <iant@google.com>
1525
1526         PR gold/12386
1527         * options.h (class General_options): Add --unresolved-symbols.
1528         * target-reloc.h (issue_undefined_symbol_error): Check
1529         --unresolved-symbols.  Add comments.
1530
1531 2011-07-08  Ian Lance Taylor  <iant@google.com>
1532
1533         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1534         expression more complex.
1535
1536 2011-07-08  Ian Lance Taylor  <iant@google.com>
1537
1538         PR gold/11317
1539         * target-reloc.h (issue_undefined_symbol_error): New inline
1540         function, broken out of relocate_section.
1541         (relocate_section): Call issue_undefined_symbol_error.
1542         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1543         there is no TLS segment if we are about to issue an undefined
1544         symbol error.
1545         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1546
1547 2011-07-08  Ian Lance Taylor  <iant@google.com>
1548
1549         PR gold/12279
1550         * resolve.cc (Symbol_table::should_override): Add fromtype
1551         parameter.  Change all callers.  Give error when linking together
1552         TLS and non-TLS symbol.
1553         (Symbol_table::should_override_with_special): Add fromtype
1554         parameter.  Change all callers.
1555         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1556         there is no TLS segment if we have reported some errors.
1557         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1558
1559 2011-07-08  Ian Lance Taylor  <iant@google.com>
1560
1561         PR gold/12372
1562         * target.h (Target::plt_address_for_global): New function.
1563         (Target::plt_address_for_local): New function.
1564         (Target::plt_section_for_global): Remove.
1565         (Target::plt_section_for_local): Remove.
1566         (Target::do_plt_address_for_global): New virtual function.
1567         (Target::do_plt_address_for_local): New virtual function.
1568         (Target::do_plt_section_for_global): Remove.
1569         (Target::do_plt_section_for_local): Remove.
1570         (Target::register_global_plt_entry): Add Symbol_table and Layout
1571         parameters.
1572         * output.cc (Output_data_got::Got_entry::write): Use
1573         plt_address_for_global and plt_address_for_local.
1574         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1575         address of output section.
1576         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1577         got_irelative_, and irelative_count_ fields.  Update
1578         declarations.
1579         (Output_data_plt_i386::has_irelative_section): New function.
1580         (Output_data_plt_i386::entry_count): Add irelative_count_.
1581         (Output_data_plt_i386::set_final_data_size): Likewise.
1582         (class Target_i386): Add got_irelative_ and rel_irelative_
1583         fields.  Update declarations.
1584         (Target_i386::Target_i386): Initialize new fields.
1585         (Target_i386::do_plt_address_for_global): New function replacing
1586         do_plt_section_for_global.
1587         (Target_i386::do_plt_address_for_local): New function replacing
1588         do_plt_section_for_local.
1589         (Target_i386::got_section): Create got_irelative_.
1590         (Target_i386::rel_irelative_section): New function.
1591         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1592         fields.  Don't define __rel_iplt_{start,end}.
1593         (Output_data_plt_i386::add_entry): Add symtab and layout
1594         parameters.  Change all callers.  Use different PLT and GOT for
1595         IFUNC symbols.
1596         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1597         layout parameters.  Change all callers.  Use different PLT and
1598         GOT.
1599         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1600         (Output_data_plt_i386::rel_irelative): New function.
1601         (Output_data_plt_i386::address_for_global): New function.
1602         (Output_data_plt_i386::address_for_local): New function.
1603         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1604         IRELATIVE GOT when changing IFUNC GOT entries.
1605         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1606         reloc.
1607         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1608         if we didn't create an IRELATIVE GOT.
1609         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1610         plt_address_for_local.
1611         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1612         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1613         got_irelative_, and irelative_count_ fields.  Update
1614         declarations.
1615         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1616         Initialize new fields.  Remove symtab parameter.  Change all
1617         callers.
1618         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1619         irelative_count_.
1620         (Output_data_plt_x86_64::has_irelative_section): New function.
1621         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1622         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1623         fields.  Update declarations.
1624         (Target_x86_64::Target_x86_64): Initialize new fields.
1625         (Target_x86_64::do_plt_address_for_global): New function replacing
1626         do_plt_section_for_global.
1627         (Target_x86_64::do_plt_address_for_local): New function replacing
1628         do_plt_section_for_local.
1629         (Target_x86_64::got_section): Create got_irelative_.
1630         (Target_x86_64::rela_irelative_section): New function.
1631         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1632         all callers.  Don't create __rel_iplt_{start,end}.
1633         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1634         parameters.  Change all callers.  Use different PLT and GOT for
1635         IFUNC symbols.
1636         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1637         layout parameters.  Change all callers.  Use different PLT and
1638         GOT.
1639         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1640         parameters.  Change all callers.  Use different PLT and GOT for
1641         IFUNC symbols.
1642         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1643         (Output_data_plt_x86_64::rela_irelative): New function.
1644         (Output_data_plt_x86_64::address_for_global): New function.
1645         (Output_data_plt_x86_64::address_for_local): New function.
1646         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1647         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1648         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1649         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1650         parameters.
1651         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1652         reloc.
1653         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1654         symbols if we didn't create an IRELATIVE GOT.
1655         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1656         plt_address_for_local.
1657         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1658         * testsuite/ifuncvar1.c: New test file.
1659         * testsuite/ifuncvar2.c: New test file.
1660         * testsuite/ifuncvar3.c: New test file.
1661         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1662         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1663         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1664         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1665         * testsuite/Makefile.in: Rebuild.
1666
1667 2011-07-07  Cary Coutant  <ccoutant@google.com>
1668
1669         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1670         (two_file_test_1_ndebug.o): Likewise.
1671         (two_file_test_1b_ndebug.o): Likewise.
1672         (two_file_test_2_ndebug.o): Likewise.
1673         (two_file_test_main_ndebug.o): Likewise.
1674         (incremental_test_2): Link with no-debug versions.
1675
1676 2011-07-06  Cary Coutant  <ccoutant@google.com>
1677
1678         * gold/incremental.cc
1679         (Output_section_incremental_inputs::write_info_blocks): Check for
1680         hidden and internal symbols.
1681
1682 2011-07-06  Cary Coutant  <ccoutant@google.com>
1683
1684         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1685         Check disposition for startup file.
1686         (Incremental_inputs::report_command_line): Ignore
1687         --incremental-startup-unchanged option.
1688         * options.cc (General_options::parse_incremental_startup_unchanged):
1689         New function.
1690         (General_options::General_options): Initialize new data member.
1691         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1692         (General_options): Add --incremental-startup-unchanged option.
1693         (General_options::incremental_startup_disposition): New function.
1694         (General_options::incremental_startup_disposition_): New data member.
1695
1696 2011-07-06  Cary Coutant  <ccoutant@google.com>
1697
1698         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1699         input file index to Script_info ctor.
1700         (Sized_incremental_binary::do_file_has_changed): Find the
1701         command-line argument for files named in scripts.
1702         * incremental.h (Script_info::Script_info): New ctor
1703         with input file index.
1704         (Script_info::input_file_index): New function.
1705         (Script_info::input_file_index_): New data member.
1706         (Incremental_binary::get_library): Add const.
1707         (Incremental_binary::get_script_info): Add const.
1708         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1709         * testsuite/Makefile.am (incremental_test_5): New test case.
1710         (incremental_test_6): New test case.
1711         * testsuite/Makefile.in: Regenerate.
1712
1713 2011-07-06  Cary Coutant  <ccoutant@google.com>
1714
1715         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1716         debug output when command lines differ.
1717
1718 2011-07-06  Cary Coutant  <ccoutant@google.com>
1719
1720         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1721         --incremental-patch option.
1722         * layout.cc (Free_list::allocate): Extend allocation beyond original
1723         end if enabled.
1724         (Layout::make_output_section): Mark sections that should get
1725         patch space.
1726         * options.cc (parse_percent): New function.
1727         * options.h (parse_percent): New function.
1728         (DEFINE_percent): New macro.
1729         (General_options): Add --incremental-patch option.
1730         * output.cc (Output_section::Output_section): Initialize new data
1731         members.
1732         (Output_section::add_input_section): Print section name when out
1733         of patch space.
1734         (Output_section::add_output_section_data): Likewise.
1735         (Output_section::set_final_data_size): Add patch space when
1736         doing --incremental-full.
1737         (Output_section::do_reset_address_and_file_offset): Remove patch
1738         space.
1739         (Output_segment::set_section_list_addresses): Print debug output
1740         only if --incremental-update.
1741         * output.h (Output_section::set_is_patch_space_allowed): New function.
1742         (Output_section::is_patch_space_allowed_): New data member.
1743         (Output_section::patch_space_): New data member.
1744         * parameters.cc (Parameters::incremental_full): New function.
1745         * parameters.h (Parameters::incremental_full): New function
1746         * testsuite/Makefile.am (incremental_test_2): Add test for
1747         --incremental-patch option.
1748         * testsuite/Makefile.in: Regenerate.
1749         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1750         (t18): Remove function body.
1751
1752 2011-07-05  Doug Kwan  <dougkwan@google.com>
1753
1754         PR gold/12771
1755         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1756         Arm_Address type for relocation result.
1757         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1758         overflow check.
1759         (Arm_relocate_functions::abs32): Use unaligned access.
1760         (Arm_relocate_functions::rel32): Ditto.
1761         (Arm_relocate_functions::prel31): Ditto.
1762         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1763         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1764         static data relocations.
1765         * testsuite/Makefile.in: Regnerate.
1766         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1767
1768 2011-07-05  Ian Lance Taylor  <iant@google.com>
1769
1770         PR gold/12392
1771         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1772         symbols if necessary.
1773         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1774
1775 2011-07-05  Ian Lance Taylor  <iant@google.com>
1776
1777         PR gold/12952
1778         * resolve.cc (Symbol::override_base_with_special): Simply override
1779         version with special symbol version, ignoring previous version.
1780
1781 2011-07-05  Ian Lance Taylor  <iant@google.com>
1782
1783         * object.cc (Sized_relobj_file::include_section_group): Add
1784         information to comment about signature location.
1785
1786 2011-07-02  Ian Lance Taylor  <iant@google.com>
1787
1788         PR gold/12957
1789         * options.h (class General_options): Add -f and -F.
1790         * options.cc (General_options::finalize): Fatal error if -f/-F
1791         are used without -shared.
1792         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1793
1794 2011-07-02  Ian Lance Taylor  <iant@google.com>
1795
1796         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1797
1798 2011-07-01  Ian Lance Taylor  <iant@google.com>
1799
1800         PR gold/12525
1801         PR gold/12952
1802         * resolve.cc (Symbol::override_base_with_special): Don't override
1803         the version if the overriding symbol has a different name.
1804         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1805         all callers.  If we give an error about an undefined version,
1806         define the base version if necessary.
1807         * dynobj.h (class Versions): Update declaration.
1808         * testsuite/weak_alias_test_5.cc: New file.
1809         * testsuite/weak_alias_test.script: New file.
1810         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1811         and versioned_alias have the right value, and call t2.
1812         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1813         weak_alias_test_5.so.
1814         (weak_alias_test_LDADD): Likewise.
1815         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1816         * testsuite/Makefile.in: Rebuild.
1817
1818 2011-07-01  Ian Lance Taylor  <iant@google.com>
1819
1820         PR gold/12525
1821         * options.h (class General_options): Support -z notext.
1822         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1823         -Wl,-z,notext.
1824         (two_file_shared_nonpic.so): Likewise.
1825         (two_file_shared_mixed.so): Likewise.
1826         (two_file_shared_mixed_1.so): Likewise.
1827         (weak_undef_lib_nonpic.so): Likewise.
1828         (alt/weak_undef_lib_nonpic.so): Likewise.
1829         (tls_test_shared_nonpic.so): Likewise.
1830         * testsuite/Makefile.in: Rebuild.
1831
1832 2011-07-01  Ian Lance Taylor  <iant@google.com>
1833
1834         PR gold/12525
1835         * configure.ac: Test whether static linking works, setting
1836         the automake conditional HAVE_STATIC.
1837         * testsuite/Makefile.am: Disable tests using -static if
1838         HAVE_STATIC is not true.
1839         * configure, testsuite/Makefile.in: Rebuild.
1840
1841 2011-07-01  Ian Lance Taylor  <iant@google.com>
1842
1843         PR gold/12525
1844         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1845         Assert if we see DW_EH_PE_indirect.
1846         * target.h (Target::ehframe_datarel_base): New function.
1847         (Target::do_ehframe_datarel_base): New target function.
1848         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1849         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1850         function.
1851
1852 2011-07-01  Ian Lance Taylor  <iant@google.com>
1853
1854         PR gold/12571
1855         * options.h (class General_options): Add
1856         --ld-generated-unwind-info.
1857         * ehframe.cc (Fde::write): Add address parameter.  Change all
1858         callers.  If associated with PLT, fill in address and size.
1859         (Cie::set_output_offset): Only add merge mapping if there is an
1860         object.
1861         (Cie::write): Add address parameter.  Change all callers.
1862         (Eh_frame::add_ehframe_for_plt): New function.
1863         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1864         input_offset_ fields into union u_, with new plt field.
1865         (Fde::Fde): Adjust for new union field.
1866         (Fde::Fde) [Output_data version]: New constructor.
1867         (Fde::add_mapping): Only add merge mapping if there is an object.
1868         (class Cie): Update declarations.
1869         (class Eh_frame): Declare add_ehframe_for_plt.
1870         * layout.cc (Layout::layout_eh_frame): Break out code into
1871         make_eh_frame_section, and call it.
1872         (Layout::make_eh_frame_section): New function.
1873         (Layout::add_eh_frame_for_plt): New function.
1874         * layout.h (class Layout): Update declarations.
1875         * merge.cc (Merge_map::add_mapping): Add assertion.
1876         * i386.cc: Include "dwarf.h".
1877         (class Output_data_plt_i386): Make first_plt_entry,
1878         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1879         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1880         and plt_eh_frame_fde.
1881         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1882         boundary.  Call add_eh_frame_for_plt if appropriate.
1883         * x86_64.cc: Include "dwarf.h".
1884         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1885         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1886         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1887         and plt_eh_frame_fde.
1888         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1889         appropriate.
1890
1891 2011-06-29  Ian Lance Taylor  <iant@google.com>
1892
1893         PR gold/12629
1894         * object.cc (Sized_relobj_file::layout_section): Change shdr
1895         parameter to be const.
1896         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1897         out of do_layout.
1898         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1899         appropriate.  Call layout_eh_frame_section.
1900         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1901         sections.
1902         * object.h (class Sized_relobj_file): Update declarations.
1903
1904 2011-06-29  Ian Lance Taylor  <iant@google.com>
1905
1906         PR gold/12652
1907         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1908         modifier.
1909         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1910
1911 2011-06-29  Ian Lance Taylor  <iant@google.com>
1912
1913         PR gold/12675
1914         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1915         SHT_X86_64_UNWIND.
1916         * layout.cc (Layout::layout_eh_frame): Likewise.
1917
1918 2011-06-29  Ian Lance Taylor  <iant@google.com>
1919
1920         PR gold/12695
1921         * layout.cc (Layout::symtab_section_shndx): New function.
1922         * layout.h (class Layout): Declare symtab_section_shndx.
1923         * output.cc (Output_section::write_header): Call it.
1924
1925 2011-06-29  Ian Lance Taylor  <iant@google.com>
1926
1927         PR gold/12818
1928         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1929         symbols which are not used in a relocation.
1930
1931 2011-06-28  Ian Lance Taylor  <iant@google.com>
1932
1933         PR gold/12898
1934         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1935         script create indistinguishable segments.
1936         (Layout::set_segment_offsets): Use stable_sort when sorting
1937         segments.  Pass this to Compare_segments constructor.
1938         * layout.h (class Layout): Make segment_precedes non-static.
1939         (class Compare_segments): Change from struct to class.  Add
1940         layout_ field.  Add constructor.
1941         * script-sections.cc
1942         (Script_sections::attach_sections_using_phdrs_clause): Rename
1943         local orphan to is_orphan.  Don't report failure to put empty
1944         section in segment.  On attachment failure, report name of
1945         section, and attach to first PT_LOAD segment.
1946
1947 2011-06-28  Ian Lance Taylor  <iant@google.com>
1948
1949         PR gold/12934
1950         * target-select.cc (Target_selector::Target_selector): Add
1951         emulation parameter.  Change all callers.
1952         (select_target_by_bfd_name): Rename from select_target_by_name.
1953         Change all callers.
1954         (select_target_by_emulation): New function.
1955         (supported_emulation_names): New function.
1956         * target-select.h (class Target_selector): Add emulation_ field.
1957         Update declarations.
1958         (Target_selector::recognize_by_bfd_name): Rename from
1959         recognize_by_name.  Change all callers.
1960         (Target_selector::supported_bfd_names): Rename from
1961         supported_names.  Change all callers.
1962         (Target_selector::recognize_by_emulation): New function.
1963         (Target_selector::supported_emulations): New function.
1964         (Target_selector::emulation): New function.
1965         (Target_selector::do_recognize_by_bfd_name): Rename from
1966         do_recognize_by_name.  Change all callers.
1967         (Target_selector::do_supported_bfd_names): Rename from
1968         do_supported_names.  Change all callers.
1969         (Target_selector::do_recognize_by_emulation): New function.
1970         (Target_selector::do_supported_emulations): New function.
1971         (select_target_by_bfd_name): Change name in declaration.
1972         (select_target_by_emulation): Declare.
1973         (supported_emulation_names): Declare.
1974         * parameters.cc (parameters_force_valid_target): Try to find
1975         target based on emulation from -m option.
1976         * options.h (class General_options): Change doc string for -m.
1977         * options.cc (help): Print emulations.
1978         (General_options::parse_V): Likewise.
1979         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1980         Add emulation parameter.  Change all callers.
1981
1982 2011-06-28  Ian Lance Taylor  <iant@google.com>
1983
1984         * target.h (class Target): Add osabi_ field.
1985         (Target::osabi): New function.
1986         (Target::set_osabi): New function.
1987         (Target::Target): Initialize osabi_.
1988         (Target::do_adjust_elf_header): Make pure virtual.
1989         (Sized_target::do_adjust_elf_header): Declare.
1990         * target.cc (Sized_target::do_adjust_elf_header): New function.
1991         (class Sized_target): Instantiate all versions.
1992         * freebsd.h (class Target_freebsd): Remove.
1993         (Target_selector_freebsd::do_recognize): Call set_osabi on
1994         Target.
1995         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1996         (Target_selector_freebsd::set_osabi): Remove.
1997         * i386.cc (class Target_i386): Inherit from Sized_target rather
1998         than Target_freebsd.
1999         * x86_64.cc (class Target_x86_64): Likewise.
2000
2001 2011-06-28  Ian Lance Taylor  <iant@google.com>
2002
2003         * target.h (Target::can_check_for_function_pointers): Rewrite.
2004         Make non-virtual.
2005         (Target::can_icf_inline_merge_sections): Likewise.
2006         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2007         (Target::Target_info): Add can_icf_inline_merge_sections field.
2008         (Target::do_can_check_for_function_pointers): New virtual
2009         function.
2010         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2011         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2012         from can_check_for_function_pointers, move in file.
2013         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2014         section_may_have_icf_unsafe_poineters, move in file.
2015         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2016         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2017         Rename from can_check_for_function_pointers, move in file.
2018         (Target_i386::can_icf_inline_merge_sections): Remove.
2019         (Target_i386::i386_info): Initialize
2020         can_icf_inline_merge_sections.
2021         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2022         Initialize can_icf_inline_merge_sections.
2023         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2024         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2025         Rename from can_check_for_function_pointers, move in file.
2026         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2027         (Target_x86_64::x86_64_info): Initialize
2028         can_icf_inline_merge_sections.
2029         * testsuite/testfile.cc (Target_test::test_target_info):
2030         Likewise.
2031         * icf.cc (get_section_contents): Correct formatting.
2032
2033 2011-06-27  Ian Lance Taylor  <iant@google.com>
2034
2035         * symtab.cc (Symbol::versioned_name): New function.
2036         (Symbol_table::add_to_final_symtab): Use versioned_name when
2037         appropriate.
2038         (Symbol_table::sized_write_symbol): Likewise.
2039         * symtab.h (class Symbol): Declare versioned_name.
2040         * stringpool.h (class Stringpool_template): Add variant of add
2041         which takes a std::basic_string.
2042         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2043         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2044         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2045         (ver_test_12.o): New target.
2046         * testsuite/Makefile.in: Rebuild.
2047
2048 2011-06-27  Doug Kwan  <dougkwan@google.com>
2049
2050         * arm.cc (Arm_relocate_functions::thm_jump8,
2051         Arm_relocate_functions::thm_jump11): Use a wider signed
2052         type to compute offset.
2053         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2054         arm_thm_jump8.
2055         * testsuite/Makefile.in: Regenerate.
2056         * testsuite/arm_branch_in_range.sh: Check test results of
2057         arm_thm_jump11 and arm_thm_jump8.
2058         * testsuite/arm_thm_jump11.s: New test source file.
2059         * testsuite/arm_thm_jump11.t: New linker script.
2060         * testsuite/arm_thm_jump8.s: New test source file.
2061         * testsuite/arm_thm_jump8.t: New linker script.
2062
2063 2011-06-24  Ian Lance Taylor  <iant@google.com>
2064
2065         * layout.cc: Include "object.h".
2066         (ctors_sections_in_init_array): New static variable.
2067         (Layout::is_ctors_in_init_array): New function.
2068         (Layout::layout): Add entry to ctors_sections_in_init_array if
2069         appropriate.
2070         * layout.h (class Layout): Declare is_ctors_in_init_array.
2071         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2072         is_ctors_reverse_view is set.
2073         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2074         all callers.  Set is_ctors_reverse_view field of View_size.
2075         (Sized_relobj_file::reverse_words): New function.
2076         * object.h (Sized_relobj_file::View_size): Add
2077         is_ctors_reverse_view field.
2078         (class Sized_relobj_file): Update declarations.
2079         * testsuite/initpri3.c: New test.
2080         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2081         initpri3b.
2082         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2083         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2084         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2085         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2086         * testsuite/Makefile.in: Rebuild.
2087
2088 2011-06-24  Cary Coutant  <ccoutant@google.com>
2089
2090         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2091         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2092         (debug_msg_cdebug.err): New targets.
2093         * testsuite/Makefile.in: Regenerate.
2094         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2095         Fix checks for link with shared library.
2096
2097 2011-06-24  Doug Kwan  <dougkwan@google.com>
2098
2099         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2100         skip empty text sections.
2101         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2102
2103 2011-06-22  Ian Lance Taylor  <iant@google.com>
2104
2105         PR gold/12910
2106         * options.h (class General_options): Add --ctors-in-init-array.
2107         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2108         friends as SHT_PROGBITS for merging sections.
2109         (Layout::layout): Remove special handling of .init_array and
2110         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2111         and .dtors if ctors_in_init_array.
2112         (Layout::make_output_section): Force correct section types for
2113         .init_array and friends.  Don't sort if doing relocatable link,
2114         Don't sort .ctors and .dtors if ctors_in_init_array.
2115         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2116         (Layout::output_section_name): Add relobj parameter.  Change all
2117         callers.  Handle .ctors. and .dtors. in code rather than table.
2118         Handle .ctors and .dtors if ctors_in_init_array.
2119         (Layout::match_file_name): New function, moved from output.cc.
2120         * layout.h (class Layout): Update declarations.
2121         * output.cc: Include "layout.h".
2122         (Input_section_sort_entry::get_priority): New function.
2123         (Input_section_sort_entry::match_file_name): Just call
2124         Layout::match_file_name.
2125         (Output_section::Input_section_sort_init_fini_compare::operator()):
2126         Handle .ctors and .dtors.  Sort by explicit priority rather than
2127         by name.
2128         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2129         * testsuite/initpri2.c: New test.
2130         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2131         (check_PROGRAMS): Add initpri2.
2132         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2133         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2134         * configure, testsuite/Makefile.in: Rebuild.
2135
2136 2011-06-19  Ian Lance Taylor  <iant@google.com>
2137
2138         PR gold/12880
2139         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2140         .interp section to a PT_INTERP segment even if we have seen a
2141         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2142         clause in a linker script.
2143         (Layout::finalize): Don't create a .interp section if we've
2144         already create a PT_INTERP segment.
2145         (Layout::create_interp): Always call choose_output_section (revert
2146         patch of 2011-06-17).  Don't create PT_INTERP segment.
2147         * script-sections.cc
2148         (Script_sections::create_note_and_tls_segments): Add a .interp
2149         section to a PT_INTERP segment even if we have seen a
2150         --dynamic-linker option.
2151
2152 2011-06-18  Ian Lance Taylor  <iant@google.com>
2153
2154         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2155         merely because a non-PT_LOAD segment has a dynamic reloc.
2156
2157 2011-06-18  Ian Lance Taylor  <iant@google.com>
2158
2159         * layout.cc (Layout::finish_dynamic_section): Don't create
2160         DT_FLAGS entry if not needed.
2161
2162 2011-06-18  Ian Lance Taylor  <iant@google.com>
2163
2164         PR gold/12745
2165         * layout.cc (Layout::layout_eh_frame): Correct handling of
2166         writable .eh_frame section.
2167
2168 2011-06-17  Ian Lance Taylor  <iant@google.com>
2169
2170         PR gold/12893
2171         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2172         symbol is redefined with the exact same object and value.
2173
2174 2011-06-17  Ian Lance Taylor  <iant@google.com>
2175
2176         PR gold/12880
2177         * layout.h (class Layout): Add interp_segment_ field.
2178         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2179         (Layout::attach_allocated_section_to_segment): If making shared
2180         library, put .interp section in PT_INTERP segment.
2181         (Layout::finalize): Also call create_interp if -dynamic-linker
2182         option was used.
2183         (Layout::create_interp): Assert that there is no PT_INTERP
2184         segment.  If not using a SECTIONS clause, use make_output_section.
2185         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2186         * script-sections.cc
2187         (Script_sections::create_note_and_tls_segments): If making shared
2188         library, put .interp section in PT_INTERP segment.
2189
2190 2011-06-17  Ian Lance Taylor  <iant@google.com>
2191
2192         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2193         when making a shared library.
2194
2195 2011-06-17  Ian Lance Taylor  <iant@google.com>
2196
2197         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2198         parameter.  Change all callers.  Don't issue warning about PC32
2199         against locally defined symbol.
2200
2201 2011-06-16  Ian Lance Taylor  <iant@google.com>
2202
2203         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2204         occurs in same object.
2205
2206 2011-06-14  Alan Modra  <amodra@gmail.com>
2207
2208         * po/POTFILES.in: Regenerate.
2209
2210 2011-06-09  Ian Lance Taylor  <iant@google.com>
2211
2212         * script-sections.cc
2213         (Orphan_output_section::set_section_addresses): For a relocatable
2214         link set address to 0.
2215
2216 2011-06-09  Cary Coutant  <ccoutant@google.com>
2217
2218         PR gold/12804
2219         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2220         used with --compress-debug-sections.
2221         * gold/object.cc (Sized_relobj_file::do_layout): Report
2222         uncompressed size of compressed input sections.
2223
2224 2011-06-08  Cary Coutant  <ccoutant@google.com>
2225
2226         PR gold/12804
2227         * testsuite/two_file_test_2_v1.cc: Change initialization of
2228         v2 to keep it in .data.
2229
2230 2011-06-07  Cary Coutant  <ccoutant@google.com>
2231
2232         * common.cc (Symbol_table::do_allocate_commons_list): Call
2233         gold_fallback.
2234         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2235         (Errors::fallback): New function.
2236         (gold_fallback): New function.
2237         * errors.h (Errors::fallback): New function.
2238         * gold.cc (gold_exit): Change status parameter to enum; adjust
2239         all callers.
2240         (queue_initial_tasks): Call gold_fallback.
2241         * gold.h: Include cstdlib.
2242         (Exit_status): New enum type.
2243         (gold_exit): Change status parameter to enum.
2244         (gold_fallback): New function.
2245         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2246         (Layout::create_symtab_sections): Likewise.
2247         (Layout::create_shdrs): Likewise.
2248         * main.cc (main): Adjust call to gold_exit.
2249         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2250         (Output_data_got::add_got_entry_pair): Likewise.
2251         (Output_section::add_input_section): Likewise.
2252         (Output_section::add_output_section_data): Likewise.
2253         (Output_segment::set_section_list_addresses): Likewise.
2254         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2255
2256 2011-06-07  Cary Coutant  <ccoutant@google.com>
2257
2258         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2259         for incremental links.
2260         * output.cc (Output_segment::set_section_list_addresses): Remove
2261         FIXME and test for TLS or BSS.
2262
2263 2011-06-07  Cary Coutant  <ccoutant@google.com>
2264
2265         * testsuite/Makefile.am: Add incremental_copy_test,
2266         incremental_common_test_1.
2267         * testsuite/Makefile.in: Regenerate.
2268         * testsuite/common_test_1_v1.c: New source file.
2269         * testsuite/common_test_1_v2.c: New source file.
2270         * testsuite/copy_test_v1.cc: New source file.
2271
2272 2011-06-07  Cary Coutant  <ccoutant@google.com>
2273
2274         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2275         update, allocate common from bss section's free list.
2276         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2277         linker-defined symbols.
2278         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2279         Skip GOT and PLT entries that are no longer referenced.
2280         (Output_section_incremental_inputs::write_info_blocks): Mark
2281         linker-defined symbols.
2282         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2283         * output.cc (Output_section::allocate): New function.
2284         * output.h (Output_section::allocate): New function.
2285         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2286         linker-defined symbols.
2287         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2288         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2289         (Symbol::init_base_output_data): Likewise.
2290         (Symbol::init_base_output_segment): Likewise.
2291         (Symbol::init_base_constant): Likewise.
2292         (Sized_symbol::init_output_data): Likewise.
2293         (Sized_symbol::init_output_segment): Likewise.
2294         (Sized_symbol::init_constant): Likewise.
2295         (Symbol_table::do_define_in_output_data): Likewise.
2296         (Symbol_table::do_define_in_output_segment): Likewise.
2297         (Symbol_table::do_define_as_constant): Likewise.
2298         * symtab.h (Symbol::is_predefined): New function.
2299         (Symbol::init_base_output_data): Add is_predefined parameter.
2300         (Symbol::init_base_output_segment): Likewise.
2301         (Symbol::init_base_constant): Likewise.
2302         (Symbol::is_predefined_): New data member.
2303         (Sized_symbol::init_output_data): Add is_predefined parameter.
2304         (Sized_symbol::init_output_segment): Likewise.
2305         (Sized_symbol::init_constant): Likewise.
2306         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2307
2308 2011-06-07  Cary Coutant  <ccoutant@google.com>
2309
2310         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2311         instead of emit_copy_reloc.
2312         (Copy_relocs::emit_copy_reloc): Refactor.
2313         (Copy_relocs::make_copy_reloc): New function.
2314         (Copy_relocs::add_copy_reloc): Remove.
2315         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2316         section.
2317         (Copy_relocs::make_copy_reloc): New function.
2318         (Copy_relocs::add_copy_reloc): Remove.
2319         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2320         unchanged input files.
2321         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2322         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2323         Reserve BSS space for COPY relocations.
2324         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2325         (Output_section_incremental_inputs::write_info_blocks): Record
2326         whether a symbol is copied from a shared object.
2327         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2328         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2329         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2330         (Incremental_input_entry_reader::get_output_symbol_index): Add
2331         is_copy parameter.
2332         (Incremental_binary::emit_copy_relocs): New function.
2333         (Incremental_binary::do_emit_copy_relocs): New function.
2334         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2335         new data member.
2336         (Sized_incremental_binary::add_copy_reloc): New function.
2337         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2338         (Sized_incremental_binary::Copy_reloc): New struct.
2339         (Sized_incremental_binary::Copy_relocs): New typedef.
2340         (Sized_incremental_binary::copy_relocs_): New data member.
2341         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2342         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2343         * target.h (Sized_target::emit_copy_reloc): New function.
2344         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2345
2346 2011-06-02  Cary Coutant  <ccoutant@google.com>
2347
2348         PR gold/12163
2349         * gold/archive.cc (Archive::Archive): Initialize new data member.
2350         (Archive::include_all_members): Return if archive has already been
2351         included.
2352         * gold/archive.h (Archive::include_all_members_): New data member.
2353
2354 2011-06-02  Nick Clifton  <nickc@redhat.com>
2355
2356         * dynobj.h: Fix spelling mistake in comment.
2357         * output.cc: Likewise.
2358
2359 2011-05-31  Doug Kwan  <dougkwan@google.com>
2360             Asier Llano
2361
2362         PR gold/12826
2363         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2364         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2365         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2366         redundant arm_exidx_test.so.
2367         * testsuite/Makefile.in: Regenerate.
2368         (check_SCRIPTS): Add pr12826.sh
2369         (check_DATA): Add pr12826.stdout
2370         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2371         * testsuite/pr12826.sh: New file.
2372         * testsuite/pr12826_1.s: Ditto.
2373         * testsuite/pr12826_1.s: Ditto.
2374
2375 2011-05-30  Ian Lance Taylor  <iant@google.com>
2376
2377         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2378         sections.
2379
2380 2011-05-29  Ian Lance Taylor  <iant@google.com>
2381
2382         PR gold/12804
2383         * testsuite/Makefile.am: Use different file name for two_file_test
2384         temporary file for each incremental test.
2385         * testsuite/Makefile.in: Rebuild.
2386
2387 2011-05-29  Ian Lance Taylor  <iant@google.com>
2388
2389         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2390         binary input file is empty.
2391
2392 2011-05-27  Ian Lance Taylor  <iant@google.com>
2393
2394         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2395         (ver_test_9.so): Likewise.
2396         * testsuite/Makefile.in: Rebuild.
2397
2398 2011-05-26 Cary Coutant  <ccoutant@google.com>
2399
2400         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2401         * incremental.cc (Incremental_inputs::report_input_section): Fix
2402         comment, indentation.
2403         (Incremental_inputs::report_comdat_group): New function.
2404         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2405         of data for incremental input file entry.
2406         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2407         group count, COMDAT group signatures.
2408         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2409         an unchanged input file.
2410         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2411         Initialize new data member.
2412         (Incremental_object_entry::add_comdat_group): New function.
2413         (Incremental_object_entry::get_comdat_group_count): New function.
2414         (Incremental_object_entry::get_comdat_signature_key): New function.
2415         (Incremental_object_entry::groups_): New data member.
2416         (Incremental_inputs::report_comdat_group): New function.
2417         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2418         data for incremental input file entry.
2419         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2420         (Incremental_input_entry_reader::get_input_section): Adjust size of
2421         data for incremental input file entry.
2422         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2423         (Incremental_input_entry_reader::get_comdat_group_signature): New
2424         function.
2425         * object.cc (Sized_relobj::include_section_group): Report kept
2426         COMDAT groups for incremental links.
2427
2428 2011-05-24  David Meyer  <pdox@google.com>
2429
2430         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2431         with name parameter.  Add found_name parameter.
2432         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2433         * dirsearch.h (class Dirsearch): Update declaration.
2434
2435 2011-05-24  Ian Lance Taylor  <iant@google.com>
2436
2437         * archive.cc (Library_base::should_include_member): Pull in object
2438         from archive if it defines the entry symbol.
2439         * parameters.cc (Parameters::entry): New function.
2440         * parameters.h (class Parameters): Declare entry.
2441         * output.h (class Output_file_header): Remove entry_ field.
2442         * output.cc (Output_file_header::Output_file_header): Remove entry
2443         parameter.  Change all callers.
2444         (Output_file_header::entry): Use parameters->entry.
2445         * gold.cc (queue_middle_tasks): Likewise.
2446         * plugin.cc (Plugin_hook::run): Likewise.
2447
2448 2011-05-24 Cary Coutant  <ccoutant@google.com>
2449
2450         * gold.cc (queue_initial_tasks): Pass incremental base filename
2451         to Output_file::open_base_file; don't print error message.
2452         * incremental-dump.cc (main): Adjust call to
2453         Output_file::open_for_modification.
2454         * incremental-dump.cc (main): Likewise.
2455         * incremental.cc (Incremental_inputs::report_command_line):
2456         Ignore --incremental-base option when comparing command lines.
2457         Ignore parameter when given as separate argument.
2458         * options.h (class General_options): Add --incremental-base.
2459         * output.cc (Output_file::Output_file):
2460         (Output_file::open_base_file): Add base_name and writable parameters;
2461         read base file into new file; print error message here.
2462         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2463         callers.
2464         * output.h (Output_file::open_for_modification): Rename to...
2465         (Output_file::open_base_file): ...this; add base_name and
2466         writable parameters; adjust all callers.
2467         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2468         callers.
2469         * testsuite/Makefile.am (incremental_test_4): Test
2470         --incremental-base.
2471         * testsuite/Makefile.in: Regenerate.
2472
2473 2011-05-24 Cary Coutant  <ccoutant@google.com>
2474
2475         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2476         incremental_test_4.
2477         * testsuite/Makefile.in: Regenerate.
2478         * testsuite/two_file_test_1_v1.cc: New test source file.
2479         * testsuite/two_file_test_1b_v1.cc: New test source file.
2480         * testsuite/two_file_test_2_v1.cc: New test source file.
2481
2482 2011-05-24 Cary Coutant  <ccoutant@google.com>
2483
2484         * dynobj.h (Dynobj::do_dynobj): New function.
2485         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2486         flag and soname for shared objects.
2487         * incremental.cc (Incremental_inputs::report_object): Make
2488         either Incremental_object_entry or Incremental_dynobj_entry; add
2489         soname to string table.
2490         (Incremental_inputs::report_input_section): Add assertion.
2491         (Output_section_incremental_inputs::set_final_data_size): Adjust
2492         type of input file entry for shared libraries; adjust size of
2493         shared library info entry.
2494         (Output_section_incremental_inputs::write_input_files): Write
2495         as_needed flag for shared libraries.
2496         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2497         of input file entry for shared libraries; write soname.
2498         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2499         soname from incremental info.
2500         * incremental.h (enum Incremental_input_flags): Add
2501         INCREMENTAL_INPUT_AS_NEEDED.
2502         (Incremental_input_entry::Incremental_input_entry): Initialize new
2503         data member.
2504         (Incremental_input_entry::set_as_needed): New function.
2505         (Incremental_input_entry::as_needed): New function.
2506         (Incremental_input_entry::do_dynobj_entry): New function.
2507         (Incremental_input_entry::as_needed_): New data member.
2508         (Incremental_object_entry::Incremental_object_entry): Don't check
2509         for shared library.
2510         (Incremental_object_entry::do_type): Likewise.
2511         (class Incremental_dynobj_entry): New class.
2512         (Incremental_input_entry_reader::as_needed): New function.
2513         (Incremental_input_entry_reader::get_soname): New function.
2514         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2515         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2516         size of shared library info entry.
2517         * layout.cc (Layout::finish_dynamic_section): Don't test for
2518         incremental link when adding DT_NEEDED entries.
2519         * object.h (Object::Object): Initialize new data member.
2520         (Object::dynobj): New function.
2521         (Object::set_as_needed): New function.
2522         (Object::as_needed): New function.
2523         (Object::do_dynobj): New function.
2524         (Object::as_needed_): New data member.
2525
2526 2011-05-24 Cary Coutant  <ccoutant@google.com>
2527
2528         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2529         info; adjust display of GOT entries.
2530         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2531         vector of input objects; remove file_status_.
2532         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2533         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2534         got_plt reader; call target hooks to reserve GOT entries.
2535         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2536         of input file info header and GOT info entry.
2537         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2538         relocation info.
2539         (Got_plt_view_info::got_descriptor): Remove.
2540         (Got_plt_view_info::sym_index): New data member.
2541         (Got_plt_view_info::input_index): New data member.
2542         (Local_got_offset_visitor::visit): Write input file index.
2543         (Global_got_offset_visitor::visit): Write 0 for input file index.
2544         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2545         with sym_index and input_index.
2546         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2547         incremental info GOT entry; replace got_descriptor with input_index.
2548         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2549         map from input file index to object.
2550         (Sized_relobj_incr::do_layout): Replace direct data member reference
2551         with accessor function.
2552         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2553         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2554         Adjust size of input file info header.
2555         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2556         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2557         (Incremental_input_entry_reader::get_input_section): Adjust size of
2558         input file info header.
2559         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2560         of incremental info GOT entry.
2561         (Incremental_got_plt_reader::get_got_desc): Remove.
2562         (Incremental_got_plt_reader::get_got_symndx): New function.
2563         (Incremental_got_plt_reader::get_got_input_index): New function.
2564         (Sized_incremental_binary::Sized_incremental_binary): Remove
2565         file_status_; add input_objects_.
2566         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2567         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2568         (Sized_incremental_binary::file_is_unchanged): Remove.
2569         (Sized_incremental_binary::set_input_object): New function.
2570         (Sized_incremental_binary::input_object): New function.
2571         (Sized_incremental_binary::file_status_): Remove.
2572         (Sized_incremental_binary::input_objects_): New data member.
2573         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2574         references.
2575         (Sized_relobj_incr::invalid_address): Move to base class.
2576         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2577         class.
2578         (Sized_relobj_incr::do_output_section_offset): Likewise.
2579         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2580         (Sized_relobj_incr::section_offsets_): Likewise.
2581         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2582         function.
2583         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2584         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2585         with accessor function.
2586         (Sized_relobj_file::do_layout): Likewise.
2587         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2588         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2589         (Sized_relobj_file::compute_final_local_value): Replace refs to
2590         section_offsets_ with accessor function.
2591         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2592         * object.h (Relobj::Relobj): Initialize new data members.
2593         (Relobj::add_dyn_reloc): New function.
2594         (Relobj::first_dyn_reloc): New function.
2595         (Relobj::dyn_reloc_count): New function.
2596         (Relobj::first_dyn_reloc_): New data member.
2597         (Relobj::dyn_reloc_count_): New data member.
2598         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2599         references.
2600         (Sized_relobj::Address): New typedef.
2601         (Sized_relobj::invalid_address): Move here from child class.
2602         (Sized_relobj::Sized_relobj): Initialize new data members.
2603         (Sized_relobj::sized_relobj): New function.
2604         (Sized_relobj::is_output_section_offset_invalid): Move here from
2605         child class.
2606         (Sized_relobj::get_output_section_offset): Likewise.
2607         (Sized_relobj::local_has_got_offset): Likewise.
2608         (Sized_relobj::local_got_offset): Likewise.
2609         (Sized_relobj::set_local_got_offset): Likewise.
2610         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2611         (Sized_relobj::clear_got_offsets): New function.
2612         (Sized_relobj::section_offsets): Move here from child class.
2613         (Sized_relobj::do_output_section_offset): Likewise.
2614         (Sized_relobj::do_set_section_offset): Likewise.
2615         (Sized_relobj::Local_got_offsets): Likewise.
2616         (Sized_relobj::local_got_offsets_): Likewise.
2617         (Sized_relobj::section_offsets_): Likewise.
2618         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2619         references.
2620         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2621         class.
2622         (Sized_relobj_file::sized_relobj): New function
2623         (Sized_relobj_file::local_has_got_offset): Move to base class.
2624         (Sized_relobj_file::local_got_offset): Likewise.
2625         (Sized_relobj_file::set_local_got_offset): Likewise.
2626         (Sized_relobj_file::get_output_section_offset): Likewise.
2627         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2628         (Sized_relobj_file::do_output_section_offset): Likewise.
2629         (Sized_relobj_file::do_set_section_offset): Likewise.
2630         (Sized_relobj_file::Local_got_offsets): Likewise.
2631         (Sized_relobj_file::local_got_offsets_): Likewise.
2632         (Sized_relobj_file::section_offsets_): Likewise.
2633         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2634         (all constructors).
2635         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2636         (Output_reloc::get_symbol_index): Likewise.
2637         (Output_reloc::local_section_offset): Likewise.
2638         (Output_reloc::get_address): Likewise.
2639         (Output_reloc::symbol_value): Likewise.
2640         (Output_data_got::reserve_slot): Move to class definition.
2641         (Output_data_got::reserve_local): New function.
2642         (Output_data_got::reserve_slot_for_global): Remove.
2643         (Output_data_got::reserve_global): New function.
2644         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2645         (all constructors, two instantiations).
2646         (Output_reloc::get_relobj): New function (two instantiations).
2647         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2648         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2649         (Output_data_reloc::add_global): Adjust type of relobj.
2650         (Output_data_reloc::add_global_relative): Likewise.
2651         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2652         (Output_data_reloc::add_local): Likewise.
2653         (Output_data_reloc::add_local_relative): Likewise.
2654         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2655         (Output_data_reloc::add_local_section): Likewise.
2656         (Output_data_reloc::add_output_section): Likewise.
2657         (Output_data_reloc::add_absolute): Likewise.
2658         (Output_data_reloc::add_target_specific): Likewise.
2659         (Output_data_got::reserve_slot): Move definition here.
2660         (Output_data_got::reserve_local): New function.
2661         (Output_data_got::reserve_global): New function.
2662         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2663         section_offsets_ with accessor function.
2664         (Sized_relobj_file::write_sections): Likewise.
2665         (Sized_relobj_file::do_relocate_sections): Likewise.
2666         * target.h (Sized_target::reserve_local_got_entry): New function.
2667         (Sized_target::reserve_global_got_entry): New function.
2668         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2669         (Target_x86_64::reserve_global_got_entry): New function.
2670         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2671
2672 2011-05-23 Cary Coutant  <ccoutant@google.com>
2673
2674         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2675         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2676         bit when checking got_type.
2677         * incremental.cc (Sized_incremental_binary::setup_readers):
2678         Store symbol table and string table locations; initialize bit vector
2679         of file status flags.
2680         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2681         unchanged files.
2682         (Sized_incremental_binary::do_process_got_plt): New function.
2683         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2684         (Output_section_incremental_inputs::set_final_data_size): Record
2685         file index for each input file.
2686         (Output_section_incremental_inputs::write_got_plt): Store file index
2687         instead of input entry offset for each GOT entry.
2688         * incremental.h
2689         (Incremental_input_entry::Incremental_input_entry): Initialize new
2690         data member.
2691         (Incremental_input_entry::set_offset): Store file index.
2692         (Incremental_input_entry::get_file_index): New function.
2693         (Incremental_input_entry::file_index_): New data member.
2694         (Incremental_binary::process_got_plt): New function.
2695         (Incremental_binary::do_process_got_plt): New function.
2696         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2697         data members.
2698         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2699         (Sized_incremental_binary::set_file_is_unchanged): New function.
2700         (Sized_incremental_binary::file_is_unchanged): New function.
2701         (Sized_incremental_binary::do_process_got_plt): New function.
2702         (Sized_incremental_binary::file_status_): New data member.
2703         (Sized_incremental_binary::main_symtab_loc_): New data member.
2704         (Sized_incremental_binary::main_strtab_loc_): New data member.
2705         * output.cc (Output_data_got::Got_entry::write): Add case
2706         RESERVED_CODE.
2707         (Output_data_got::add_global): Call add_got_entry.
2708         (Output_data_got::add_global_plt): Likewise.
2709         (Output_data_got::add_global_with_rel): Likewise.
2710         (Output_data_got::add_global_with_rela): Likewise.
2711         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2712         (Output_data_got::add_global_pair_with_rela): Likewise.
2713         (Output_data_got::add_local): Call add_got_entry.
2714         (Output_data_got::add_local_plt): Likewise.
2715         (Output_data_got::add_local_with_rel): Likewise.
2716         (Output_data_got::add_local_with_rela): Likewise.
2717         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2718         (Output_data_got::add_local_pair_with_rela): Likewise.
2719         (Output_data_got::reserve_slot): New function.
2720         (Output_data_got::reserve_slot_for_global): New function.
2721         (Output_data_got::add_got_entry): New function.
2722         (Output_data_got::add_got_entry_pair): New function.
2723         (Output_section::add_output_section_data): Edit FIXME.
2724         * output.h
2725         (Output_section_data_build::Output_section_data_build): New
2726         constructor with size parameter.
2727         (Output_data_space::Output_data_space): Likewise.
2728         (Output_data_got::Output_data_got): Initialize new data member; new
2729         constructor with size parameter.
2730         (Output_data_got::add_constant): Call add_got_entry.
2731         (Output_data_got::reserve_slot): New function.
2732         (Output_data_got::reserve_slot_for_global): New function.
2733         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2734         (Output_data_got::add_got_entry): New function.
2735         (Output_data_got::add_got_entry_pair): New function.
2736         (Output_data_got::free_list_): New data member.
2737         * target.h (Sized_target::init_got_plt_for_update): New function.
2738         (Sized_target::register_global_plt_entry): New function.
2739         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2740         Initialize new data member; call init; add constructor with PLT count.
2741         (Output_data_plt_x86_64::init): New function.
2742         (Output_data_plt_x86_64::add_relocation): New function.
2743         (Output_data_plt_x86_64::reserve_slot): New function.
2744         (Output_data_plt_x86_64::free_list_): New data member.
2745         (Target_x86_64::init_got_plt_for_update): New function.
2746         (Target_x86_64::register_global_plt_entry): New function.
2747         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2748         incremental updates.
2749         (Output_data_plt_x86_64::add_relocation): New function.
2750         * testsuite/object_unittest.cc (Object_test): Set default options.
2751
2752 2011-05-16  Ian Lance Taylor  <iant@google.com>
2753
2754         * options.h (class General_options): Make -i a synonym for -r.
2755
2756 2011-05-16  Ian Lance Taylor  <iant@google.com>
2757
2758         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2759
2760 2011-05-10 Cary Coutant  <ccoutant@google.com>
2761
2762         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2763         strip_all (-s).
2764
2765 2011-05-06  Ian Lance Taylor  <iant@google.com>
2766
2767         * layout.cc (Layout::layout): If the output section flags change,
2768         update the ordering.
2769
2770 2011-04-25 Cary Coutant  <ccoutant@google.com>
2771
2772         * incremental-dump.cc (dump_incremental_inputs): Print local
2773         symbol info for each input file.
2774         * incremental.cc
2775         (Output_section_incremental_inputs::set_final_data_size): Add local
2776         symbol info to input file entries in incremental info.
2777         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2778         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2779         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2780         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2781         implementation.
2782         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2783         (Sized_incr_relobj::do_relocate): Write the local symbols.
2784         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2785         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2786         Adjust size of input file header.
2787         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2788         (Incremental_inputs_reader::get_local_symbol_count): New function.
2789         (Incremental_inputs_reader::get_input_section): Adjust size of input
2790         file header.
2791         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2792         (Sized_incr_relobj::This): New typedef.
2793         (Sized_incr_relobj::sym_size): New const data member.
2794         (Sized_incr_relobj::Local_symbol): New struct.
2795         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2796         (Sized_incr_relobj::do_local_symbol_offset): New function.
2797         (Sized_incr_relobj::local_symbol_count_): New data member.
2798         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2799         (Sized_incr_relobj::local_symbol_index_): New data member.
2800         (Sized_incr_relobj::local_symbol_offset_): New data member.
2801         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2802         (Sized_incr_relobj::local_symbols_): New data member.
2803         * object.h (Relobj::output_local_symbol_count): New function.
2804         (Relobj::local_symbol_offset): New function.
2805         (Relobj::do_output_local_symbol_count): New function.
2806         (Relobj::do_local_symbol_offset): New function.
2807         (Sized_relobj::do_output_local_symbol_count): New function.
2808         (Sized_relobj::do_local_symbol_offset): New function.
2809
2810 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2811
2812         * descriptors.cc (set_close_on_exec): New function.
2813         (Descriptors::open): Use set_close_on_exec.
2814         * output.cc (S_ISLNK): Define if not defined.
2815
2816 2011-04-22 Cary Coutant  <ccoutant@google.com>
2817
2818         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2819         global symbol map.
2820         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2821         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2822         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2823         relocations.
2824         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2825         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2826         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2827         * incremental.h
2828         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2829         function.
2830         (Incremental_binary::apply_incremental_relocs): New function.
2831         (Incremental_binary::do_apply_incremental_relocs): New function.
2832         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2833         data member.
2834         (Sized_incremental_binary::add_global_symbol): New function.
2835         (Sized_incremental_binary::global_symbol): New function.
2836         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2837         (Sized_incremental_binary::symbol_map_): New data member.
2838         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2839         * target.h (Sized_target::apply_relocation): New function.
2840         * target-reloc.h (apply_relocation): New function.
2841         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2842
2843 2011-04-22  Doug Kwan  <dougkwan@google.com>
2844
2845         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2846         flag of a SHT_ARM_EXIDX section.
2847         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2848         * testsuite/Makefile.in: Regenerate.
2849         * testsuite/arm_exidx_test.s: New file.
2850         * testsuite/arm_exidx_test.sh: Same.
2851
2852 2011-04-20 Cary Coutant  <ccoutant@google.com>
2853
2854         PR gold/12689
2855         * archive.h (Incremental_archive_entry::Archive_member):
2856         Initialize arg_serial_ (second constructor).
2857
2858 2011-04-17  Ian Lance Taylor  <iant@google.com>
2859
2860         * object.cc (Relocate_info::location): Simplify location string.
2861         * errors.cc (Errors::error_at_location): Don't print program
2862         name.
2863         (Errors::warning_at_location): Likewise.
2864         (Errors::undefined_symbol): Likewise.
2865         * testsuite/debug_msg.sh: Update accordingly.
2866
2867 2011-04-14 Cary Coutant  <ccoutant@google.com>
2868
2869         * gold/layout.cc (Layout::symtab_section_offset): New function.
2870         * gold/layout.h (Layout::symtab_section_offset): New function.
2871         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2872
2873 2011-04-12  Ian Lance Taylor  <iant@google.com>
2874
2875         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2876         with MREMAP_MAYMOVE.
2877         * output.h (class Output_file): Add map_is_allocated_ field.
2878         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2879         not available, provide stubs.  If mremap is not available, #define
2880         it to gold_mremap.
2881         (MREMAP_MAYMOVE): Define if not defined.
2882         (Output_file::Output_file): Initialize map_is_allocated_.
2883         (Output_file::resize): Check map_is_allocated_.
2884         (Output_file::map_anonymous): If mmap fails, use malloc.
2885         (Output_file::unmap): Don't do anything for an anonymous map.
2886         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2887         is not available, provide stubs.
2888         (File_read::View::~View): Use free rather than delete[].
2889         (File_read::make_view): Use malloc rather than new[].  If mmap
2890         fails, use malloc.
2891         (File_read::find_or_make_view): Use malloc rather than new[].
2892         * gold.h: Remove HAVE_REMAP code.
2893         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2894         exists.  Rename mremap to gold_mremap.  If mmap is not available
2895         don't do anything.
2896         * configure, config.in: Rebuild.
2897
2898 2011-04-11  Ian Lance Taylor  <iant@google.com>
2899
2900         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2901         initialize local variable v.
2902
2903 2011-04-11  Cary Coutant  <ccoutant@google.com>
2904
2905         * archive.cc (Archive::include_member): Adjust call to
2906         report_object.
2907         (Add_archive_symbols::run): Track argument serial numbers.
2908         (Lib_group::include_member): Likewise.
2909         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2910         * archive.h (Incremental_archive_entry::Archive_member):
2911         Initialize arg_serial_.
2912         (Archive_member::arg_serial_): New data member.
2913         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2914         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2915         incremental link.
2916         (Sized_dynobj::do_for_all_local_got_entries): New function.
2917         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2918         function.
2919         * fileread.cc (get_mtime): New function.
2920         * fileread.h (get_mtime): New function.
2921         * gold.cc (queue_initial_tasks): Check for incremental update.
2922         (process_incremental_input): New function.
2923         (queue_middle_tasks): Don't force valid target for incremental
2924         update.
2925         * incremental-dump.cc (find_input_containing_global): Adjust
2926         size of symbol info entry.
2927         (dump_incremental_inputs): Dump argument serial number and
2928         in_system_directory flag; bias shndx by 1; print symbol names
2929         when dumping per-file symbol lists; use new symbol info readers.
2930         * incremental.cc
2931         (Output_section_incremental_inputs:update_data_size): New function.
2932         (Sized_incremental_binary::setup_readers): Setup input readers
2933         for each input file; build maps for files added from libraries
2934         and scripts.
2935         (Sized_incremental_binary::check_input_args): New function.
2936         (Sized_incremental_binary::do_check_inputs): Build map of argument
2937         serial numbers to input arguments.
2938         (Sized_incremental_binary::do_file_has_changed): Rename
2939         do_file_is_unchanged to this; compare file modification times.
2940         (Sized_incremental_binary::do_init_layout): New function.
2941         (Sized_incremental_binary::do_reserve_layout): New function.
2942         (Sized_incremental_binary::do_get_input_reader): Remove.
2943         (Sized_incremental_binary::get_symtab_view): New function.
2944         (Incremental_checker::can_incrementally_link_output_file): Remove.
2945         (Incremental_inputs::report_command_line): Exclude --debug options.
2946         (Incremental_inputs::report_archive_begin): Add parameter; track
2947         argument serial numbers; don't put input file entry for archive
2948         before archive members.
2949         (Incremental_inputs::report_archive_end): Put input file entry
2950         for archive after archive members.
2951         (Incremental_inputs::report_object): Add parameter; track argument
2952         serial numbers and in_system_directory flag.
2953         (Incremental_inputs::report_script): Add parameter; track argument
2954         serial numbers.
2955         (Output_section_incremental_inputs::set_final_data_size): Adjust
2956         size of symbol info entry; check for forwarding symbols.
2957         (Output_section_incremental_inputs::write_input_files): Write
2958         in_system_directory flag and argument serial number.
2959         (Output_section_incremental_inputs::write_info_blocks): Map section
2960         indices between incremental info and original input file; store
2961         input section index for each symbol.
2962         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2963         change operator() to visit().
2964         (class Global_got_offset_visitor): Likewise.
2965         (class Global_symbol_visitor_got_plt):
2966         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2967         classes.
2968         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2969         (Sized_incr_relobj::do_read_symbols): New function.
2970         (Sized_incr_relobj::do_layout): New function.
2971         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2972         (Sized_incr_relobj::do_add_symbols): New function.
2973         (Sized_incr_relobj::do_should_include_member): New function.
2974         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2975         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2976         (Sized_incr_relobj::do_section_size): New function.
2977         (Sized_incr_relobj::do_section_name): New function.
2978         (Sized_incr_relobj::do_section_contents): New function.
2979         (Sized_incr_relobj::do_section_flags): New function.
2980         (Sized_incr_relobj::do_section_entsize): New function.
2981         (Sized_incr_relobj::do_section_address): New function.
2982         (Sized_incr_relobj::do_section_type): New function.
2983         (Sized_incr_relobj::do_section_link): New function.
2984         (Sized_incr_relobj::do_section_info): New function.
2985         (Sized_incr_relobj::do_section_addralign): New function.
2986         (Sized_incr_relobj::do_initialize_xindex): New function.
2987         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2988         (Sized_incr_relobj::do_read_relocs): New function.
2989         (Sized_incr_relobj::do_gc_process_relocs): New function.
2990         (Sized_incr_relobj::do_scan_relocs): New function.
2991         (Sized_incr_relobj::do_count_local_symbols): New function.
2992         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2993         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2994         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2995         (Sized_incr_relobj::do_relocate): New function.
2996         (Sized_incr_relobj::do_set_section_offset): New function.
2997         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2998         (Sized_incr_dynobj::do_read_symbols): New function.
2999         (Sized_incr_dynobj::do_layout): New function.
3000         (Sized_incr_dynobj::do_add_symbols): New function.
3001         (Sized_incr_dynobj::do_should_include_member): New function.
3002         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3003         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3004         (Sized_incr_dynobj::do_section_size): New function.
3005         (Sized_incr_dynobj::do_section_name): New function.
3006         (Sized_incr_dynobj::do_section_contents): New function.
3007         (Sized_incr_dynobj::do_section_flags): New function.
3008         (Sized_incr_dynobj::do_section_entsize): New function.
3009         (Sized_incr_dynobj::do_section_address): New function.
3010         (Sized_incr_dynobj::do_section_type): New function.
3011         (Sized_incr_dynobj::do_section_link): New function.
3012         (Sized_incr_dynobj::do_section_info): New function.
3013         (Sized_incr_dynobj::do_section_addralign): New function.
3014         (Sized_incr_dynobj::do_initialize_xindex): New function.
3015         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3016         (make_sized_incremental_object): New function.
3017         (Incremental_library::copy_unused_symbols): New function.
3018         (Incremental_library::do_for_all_unused_symbols): New function.
3019         * incremental.h (enum Incremental_input_flags): New type.
3020         (class Incremental_checker): Remove.
3021         (Incremental_input_entry::Incremental_input_entry): Add argument
3022         serial number.
3023         (Incremental_input_entry::arg_serial): New function.
3024         (Incremental_input_entry::set_is_in_system_directory): New function.
3025         (Incremental_input_entry::is_in_system_directory): New function.
3026         (Incremental_input_entry::arg_serial_): New data member.
3027         (Incremental_input_entry::is_in_system_directory_): New data member.
3028         (class Script_info): Move here from script.h.
3029         (Script_info::Script_info): Add filename parameter.
3030         (Script_info::filename): New function.
3031         (Script_info::filename_): New data member.
3032         (Incremental_script_entry::Incremental_script_entry): Add argument
3033         serial number.
3034         (Incremental_object_entry::Incremental_object_entry): Likewise.
3035         (Incremental_object_entry::add_input_section): Build list of input
3036         sections with map to original shndx.
3037         (Incremental_object_entry::get_input_section_index): New function.
3038         (Incremental_object_entry::shndx_): New data member.
3039         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3040         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3041         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3042         serial number.
3043         (Incremental_inputs::report_archive_begin): Likewise.
3044         (Incremental_inputs::report_object): Likewise.
3045         (Incremental_inputs::report_script): Likewise.
3046         (class Incremental_global_symbol_reader): New class.
3047         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3048         and store flags and input file type.
3049         (Incremental_input_entry_reader::arg_serial): New function.
3050         (Incremental_input_entry_reader::type): Extract type from flags.
3051         (Incremental_input_entry_reader::is_in_system_directory): New function.
3052         (Incremental_input_entry_reader::get_input_section_count): Call
3053         accessor function for type.
3054         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3055         function for type; adjust size of global symbol entry.
3056         (Incremental_input_entry_reader::get_global_symbol_count): Call
3057         accessor function for type.
3058         (Incremental_input_entry_reader::get_object_count): Likewise.
3059         (Incremental_input_entry_reader::get_object_offset): Likewise.
3060         (Incremental_input_entry_reader::get_member_count): Likewise.
3061         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3062         (Incremental_input_entry_reader::get_member_offset): Likewise.
3063         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3064         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3065         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3066         (Incremental_input_entry_reader::get_global_symbol_reader): New
3067         function.
3068         (Incremental_input_entry_reader::get_output_symbol_index): New
3069         function.
3070         (Incremental_input_entry_reader::type_): Remove.
3071         (Incremental_input_entry_reader::flags_): New data member.
3072         (Incremental_inputs_reader::input_file_offset): New function.
3073         (Incremental_inputs_reader::input_file_index): New function.
3074         (Incremental_inputs_reader::input_file): Call input_file_offset.
3075         (Incremental_inputs_reader::input_file_at_offset): New function.
3076         (Incremental_relocs_reader::get_r_type): Reformat.
3077         (Incremental_relocs_reader::get_r_shndx): Reformat.
3078         (Incremental_relocs_reader::get_r_offset): Reformat.
3079         (Incremental_relocs_reader::data): New function.
3080         (Incremental_binary::Incremental_binary): Initialize new data members.
3081         (Incremental_binary::check_inputs): Add cmdline parameter.
3082         (Incremental_binary::file_is_unchanged): Remove.
3083         (Input_reader::arg_serial): New function.
3084         (Input_reader::get_unused_symbol_count): New function.
3085         (Input_reader::get_unused_symbol): New function.
3086         (Input_reader::do_arg_serial): New function.
3087         (Input_reader::do_get_unused_symbol_count): New function.
3088         (Input_reader::do_get_unused_symbol): New function.
3089         (Incremental_binary::input_file_count): New function.
3090         (Incremental_binary::get_input_reader): Change signature to use
3091         index instead of filename.
3092         (Incremental_binary::file_has_changed): New function.
3093         (Incremental_binary::get_input_argument): New function.
3094         (Incremental_binary::get_library): New function.
3095         (Incremental_binary::get_script_info): New function.
3096         (Incremental_binary::init_layout): New function.
3097         (Incremental_binary::reserve_layout): New function.
3098         (Incremental_binary::output_file): New function.
3099         (Incremental_binary::do_check_inputs): New function.
3100         (Incremental_binary::do_file_is_unchanged): Remove.
3101         (Incremental_binary::do_file_has_changed): New function.
3102         (Incremental_binary::do_init_layout): New function.
3103         (Incremental_binary::do_reserve_layout): New function.
3104         (Incremental_binary::do_input_file_count): New function.
3105         (Incremental_binary::do_get_input_reader): Change signature.
3106         (Incremental_binary::input_args_map_): New data member.
3107         (Incremental_binary::library_map_): New data member.
3108         (Incremental_binary::script_map_): New data member.
3109         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3110         new data members.
3111         (Sized_incremental_binary::output_section): New function.
3112         (Sized_incremental_binary::inputs_reader): Add const.
3113         (Sized_incremental_binary::symtab_reader): Add const.
3114         (Sized_incremental_binary::relocs_reader): Add const.
3115         (Sized_incremental_binary::got_plt_reader): Add const.
3116         (Sized_incremental_binary::get_symtab_view): New function.
3117         (Sized_incremental_binary::Inputs_reader): New typedef.
3118         (Sized_incremental_binary::Input_entry_reader): New typedef.
3119         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3120         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3121         (Sized_incremental_binary::do_file_has_changed): New function.
3122         (Sized_incremental_binary::do_init_layout): New function.
3123         (Sized_incremental_binary::do_reserve_layout): New function.
3124         (Sized_input_reader::Inputs_reader): Remove.
3125         (Sized_input_reader::Input_entry_reader): Remove.
3126         (Sized_input_reader::do_arg_serial): New function.
3127         (Sized_input_reader::do_get_unused_symbol_count): New function.
3128         (Sized_input_reader::do_get_unused_symbol): New function.
3129         (Sized_incremental_binary::do_input_file_count): New function.
3130         (Sized_incremental_binary::do_get_input_reader): Change signature;
3131         use index instead of filename.
3132         (Sized_incremental_binary::section_map_): New data member.
3133         (Sized_incremental_binary::input_entry_readers_): New data member.
3134         (class Sized_incr_relobj): New class.
3135         (class Sized_incr_dynobj): New class.
3136         (make_sized_incremental_object): New function.
3137         (class Incremental_library): New class.
3138         * layout.cc (Free_list::num_lists): New static data member.
3139         (Free_list::num_nodes): New static data member.
3140         (Free_list::num_removes): New static data member.
3141         (Free_list::num_remove_visits): New static data member.
3142         (Free_list::num_allocates): New static data member.
3143         (Free_list::num_allocate_visits): New static data member.
3144         (Free_list::init): New function.
3145         (Free_list::remove): New function.
3146         (Free_list::allocate): New function.
3147         (Free_list::dump): New function.
3148         (Free_list::print_stats): New function.
3149         (Layout_task_runner::run): Resize output file for incremental updates.
3150         (Layout::Layout): Initialize new data members.
3151         (Layout::set_incremental_base): New function.
3152         (Layout::init_fixed_output_section): New function.
3153         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3154         incremental updates.
3155         (Layout::create_gold_note): Do not create gold note section for
3156         incremental updates.
3157         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3158         for incremental updates.
3159         (Layout::set_section_offsets): For incremental updates, allocate space
3160         from free list.
3161         (Layout::create_symtab_sections): Layout with offsets relative to
3162         start of section; for incremental updates, allocate space from free
3163         list.
3164         (Layout::create_shdrs): For incremental updates, allocate space from
3165         free list.
3166         (Layout::finish_dynamic_section): For incremental updates, do not
3167         check --as-needed (fixed in subsequent patch).
3168         * layout.h (class Free_list): New class.
3169         (Layout::set_incremental_base): New function.
3170         (Layout::incremental_base): New function.
3171         (Layout::init_fixed_output_section): New function.
3172         (Layout::allocate): New function.
3173         (Layout::incremental_base_): New data member.
3174         (Layout::free_list_): New data member.
3175         * main.cc (main): Print Free_list statistics.
3176         * object.cc (Relobj::finalize_incremental_relocs): Add
3177         clear_counts parameter; clear counts only when clear_counts is set.
3178         (Sized_relobj::Sized_relobj): Initialize new base class.
3179         (Sized_relobj::do_layout): Don't report special sections.
3180         (Sized_relobj::do_for_all_local_got_entries): New function.
3181         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3182         symtab_off to all symbol table offsets.
3183         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3184         * object.h (class Got_offset_list): Move to top of file.
3185         (Object::Object): Allow case where input_file == NULL.
3186         (Object::~Object): Likewise.
3187         (Object::input_file): Assert that input_file != NULL.
3188         (Object::lock): Allow case where input_file == NULL.
3189         (Object::unlock): Likewise.
3190         (Object::is_locked): Likewise.
3191         (Object::token): Likewise.
3192         (Object::release): Likewise.
3193         (Object::is_incremental): New function.
3194         (Object::get_mtime): New function.
3195         (Object::for_all_local_got_entries): New function.
3196         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3197         (Object::set_is_in_system_directory): New function.
3198         (Object::is_in_system_directory): New function.
3199         (Object::do_is_incremental): New function.
3200         (Object::do_get_mtime): New function.
3201         (Object::do_for_all_local_got_entries): New function.
3202         (Object::is_in_system_directory_): New data member.
3203         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3204         (class Sized_relobj_base): New class.
3205         (class Sized_relobj): Derive from Sized_relobj_base.
3206         (class Sized_relobj::Symbols): Redeclare from base class.
3207         (class Sized_relobj::local_got_offset_list): Remove.
3208         (class Sized_relobj::Output_sections): Redeclare from base class.
3209         (class Sized_relobj::do_for_all_local_got_entries): New function.
3210         (class Sized_relobj::write_local_symbols): Add offset parameter.
3211         (class Sized_relobj::local_symbol_offset_): Update comment.
3212         (class Sized_relobj::local_dynsym_offset_): Update comment.
3213         * options.cc (Input_arguments::add_file): Remove const.
3214         * options.h (Input_file_argument::Input_file_argument):
3215         Initialize arg_serial_ (all constructors).
3216         (Input_file_argument::set_arg_serial): New function.
3217         (Input_file_argument::arg_serial): New function.
3218         (Input_file_argument::arg_serial_): New data member.
3219         (Input_arguments::Input_arguments): Initialize file_count_.
3220         (Input_arguments::add_file): Remove const.
3221         (Input_arguments::number_of_input_files): New function.
3222         (Input_arguments::file_count_): New data member.
3223         (Command_line::number_of_input_files): Call
3224         Input_arguments::number_of_input_files.
3225         * output.cc (Output_segment_headers::Output_segment_headers):
3226         Set current size.
3227         (Output_section::Input_section::current_data_size): New function.
3228         (Output_section::Output_section): Initialize new data members.
3229         (Output_section::add_input_section): Don't do merge sections for
3230         an incremental link; allocate space from free list for an
3231         incremental update.
3232         (Output_section::add_output_section_data): Allocate space from
3233         free list for an incremental update.
3234         (Output_section::update_data_size): New function.
3235         (Output_section::set_fixed_layout): New function.
3236         (Output_section::reserve): New function.
3237         (Output_segment::set_section_addresses): Remove const.
3238         (Output_segment::set_section_list_addresses): Remove const; allocate
3239         space from free list for an incremental update.
3240         (Output_segment::set_offset): Adjust size of RELRO segment for an
3241         incremental update.
3242         * output.h (Output_data::current_data_size): Move here from
3243         child classes.
3244         (Output_data::pre_finalize_data_size): New function.
3245         (Output_data::update_data_size): New function.
3246         (Output_section_headers::update_data_size): new function.
3247         (Output_section_data_build::current_data_size): Move to Output_data.
3248         (Output_data_strtab::update_data_size): New function.
3249         (Output_section::current_data_size): Move to Output_data.
3250         (Output_section::set_fixed_layout): New function.
3251         (Output_section::has_fixed_layout): New function.
3252         (Output_section::reserve): New function.
3253         (Output_section::update_data_size): New function.
3254         (Output_section::has_fixed_layout_): New data member.
3255         (Output_section::free_list_): New data member.
3256         (Output_segment::set_section_addresses): Remove const.
3257         (Output_segment::set_section_list_addresses): Remove const.
3258         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3259         New function.
3260         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3261         New function.
3262         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3263         parameter when calling Add_symbols constructor; store argument
3264         serial number for members of a lib group.
3265         (Add_symbols::locks): Allow case where token == NULL.
3266         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3267         (Read_member::~Read_member): New function.
3268         (Read_member::is_runnable): New function.
3269         (Read_member::locks): New function.
3270         (Read_member::run): New function.
3271         (Check_script::~Check_script): New function.
3272         (Check_script::is_runnable): New function.
3273         (Check_script::locks): New function.
3274         (Check_script::run): New function.
3275         (Check_library::~Check_library): New function.
3276         (Check_library::is_runnable): New function.
3277         (Check_library::locks): New function.
3278         (Check_library::run): New function.
3279         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3280         (Add_symbols::library_): New data member.
3281         (class Read_member): New class.
3282         (class Check_script): New class.
3283         (class Check_library): New class.
3284         * reloc.cc (Read_relocs::is_runnable): Allow case where
3285         token == NULL.
3286         (Read_relocs::locks): Likewise.
3287         (Scan_relocs::locks): Likewise.
3288         (Relocate_task::locks): Likewise.
3289         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3290         to clear counters.
3291         (Sized_relobj::incremental_relocs_scan): Fix comment.
3292         (Sized_relobj::do_relocate): Pass output file offset to
3293         write_local_symbols.
3294         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3295         from class declaration.
3296         * script.cc (read_input_script): Allocate Script_info; pass
3297         argument serial number to report_script.
3298         * script.h (class Script_info): Move to incremental.h.
3299         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3300         * symtab.h (Symbol_table::add_from_incrobj): New function.
3301         (Symbol_table::set_file_offset): New function.
3302
3303 2011-04-05  Cary Coutant  <ccoutant@google.com>
3304
3305         * incremental-dump.cc (dump_incremental_inputs): Change signature
3306         to take a Sized_incremental_binary; change caller.  Use readers
3307         in Sized_incremental_binary.
3308         * incremental.cc
3309         (Sized_incremental_binary::find_incremental_inputs_sections):
3310         Rename do_find_incremental_inputs_sections to this.
3311         (Sized_incremental_binary::setup_readers): New function.
3312         (Sized_incremental_binary::do_check_inputs): Check
3313         has_incremental_info_ flag; move setup code to setup_readers;
3314         use input readers.
3315         (Sized_incremental_binary::do_file_is_unchanged): New function.
3316         (Sized_incremental_binary::do_get_input_reader): New function.
3317         * incremental.h (class Incremental_binary): Move to end of file.
3318         (Incremental_binary::file_is_unchanged): New function.
3319         (Incremental_binary::do_file_is_unchanged): New function.
3320         (Incremental_binary::Input_reader): New class.
3321         (Incremental_binary::get_input_reader): New function.
3322         (class Sized_incremental_binary): Move to end of file.
3323         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3324         input section reader classes.
3325         (Sized_incremental_binary::has_incremental_info): New function.
3326         (Sized_incremental_binary::inputs_reader): New function.
3327         (Sized_incremental_binary::symtab_reader): New function.
3328         (Sized_incremental_binary::relocs_reader): New function.
3329         (Sized_incremental_binary::got_plt_reader): New function.
3330         (Sized_incremental_binary::do_file_is_unchanged): New function.
3331         (Sized_incremental_binary::Sized_input_reader): New class.
3332         (Sized_incremental_binary::get_input_reader): New function.
3333         (Sized_incremental_binary::find_incremental_inputs_sections):
3334         Rename do_find_incremental_inputs_sections to this.
3335         (Sized_incremental_binary::setup_readers): New function.
3336         (Sized_incremental_binary::has_incremental_info_): New data member.
3337         (Sized_incremental_binary::inputs_reader_): New data member.
3338         (Sized_incremental_binary::symtab_reader_): New data member.
3339         (Sized_incremental_binary::relocs_reader_): New data member.
3340         (Sized_incremental_binary::got_plt_reader_): New data member.
3341         (Sized_incremental_binary::current_input_file_): New data member.
3342
3343 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3344
3345         PR gold/12640
3346         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3347         violation.
3348
3349 2011-03-30  Cary Coutant  <ccoutant@google.com>
3350
3351         * archive.cc (Archive::include_member): Adjust call to report_object.
3352         (Add_archive_symbols::run): Add script_info to call to
3353         report_archive_begin.
3354         (Lib_group::include_member): Adjust call to report_object.
3355         (Add_lib_group_symbols::run): Adjust call to report_object.
3356         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3357         blocks.  Add object count for script input files.
3358         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3359         script_info parameter; change all callers.
3360         (Incremental_inputs::report_object): Add script_info parameter;
3361         change all callers.
3362         (Incremental_inputs::report_script): Store backpointer to
3363         incremental info entry.
3364         (Output_section_incremental_inputs::set_final_data_size): Record
3365         additional information for scripts.
3366         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3367         * incremental.h (Incremental_script_entry::add_object): New function.
3368         (Incremental_script_entry::get_object_count): New function.
3369         (Incremental_script_entry::get_object): New function.
3370         (Incremental_script_entry::objects_): New data member; adjust
3371         constructor.
3372         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3373         (Incremental_inputs::report_object): Add script_info parameter.
3374         (Incremental_inputs_reader::get_object_count): New function.
3375         (Incremental_inputs_reader::get_object_offset): New function.
3376         * options.cc (Input_arguments::add_file): Return reference to
3377         new input argument.
3378         * options.h (Input_argument::set_script_info): New function.
3379         (Input_argument::script_info): New function.
3380         (Input_argument::script_info_): New data member; adjust all
3381         constructors.
3382         (Input_file_group::add_file): Return reference to new input argument.
3383         (Input_file_lib::add_file): Likewise.
3384         (Input_arguments::add_file): Likewise.
3385         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3386         * script.cc (Parser_closure::Parser_closure): Add script_info
3387         parameter; adjust all callers.
3388         (Parser_closure::script_info): New function.
3389         (Parser_closure::script_info_): New data member.
3390         (read_input_script): Report scripts earlier to incremental info.
3391         (script_add_file): Set script_info in Input_argument.
3392         (script_add_library): Likewise.
3393         * script.h (Script_options::Script_info): Rewrite class.
3394
3395 2011-03-29  Cary Coutant  <ccoutant@google.com>
3396
3397         * archive.cc (Library_base::should_include_member): Move
3398         method here from class Archive.
3399         (Archive::Archive): Initialize base class.
3400         (Archive::should_include_member): Move to base class.
3401         (Archive::do_for_all_unused_symbols): New function.
3402         (Add_archive_symbols::run): Remove redundant access to
3403         incremental_inputs.
3404         (Lib_group::Lib_group): Initialize base class.
3405         (Lib_group::do_filename): New function.
3406         (Lib_group::include_member): Pass pointer to Lib_group to
3407         report_object.
3408         (Lib_group::do_for_all_unused_symbols): New function.
3409         (Add_lib_group_symbols::run): Report archive information for
3410         incremental links.
3411         * archive.h (class Library_base): New base class.
3412         (class Archive): Derive from Library_base.
3413         (Archive::filename): Move to base class.
3414         (Archive::set_incremental_info): Likewise.
3415         (Archive::incremental_info): Likewise.
3416         (Archive::Should_include): Likewise.
3417         (Archive::should_include_member): Likewise.
3418         (Archive::Armap_entry): Remove.
3419         (Archive::Unused_symbol_iterator): Remove.
3420         (Archive::unused_symbols_begin): Remove.
3421         (Archive::unused_symbols_end): Remove.
3422         (Archive::do_filename): New function.
3423         (Archive::do_get_mtime): New function.
3424         (Archive::do_for_all_unused_symbols): New function.
3425         (Archive::task_): Move to base class.
3426         (Archive::incremental_info_): Likewise.
3427         (class Lib_group): Derive from Library_base.
3428         (Lib_group::do_filename): New function.
3429         (Lib_group::do_get_mtime): New function.
3430         (Lib_group::do_for_all_unused_symbols): New function.
3431         (Lib_group::task_): Move to base class.
3432         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3433         function.
3434         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3435         function.
3436         * incremental.cc (Incremental_inputs::report_archive_begin):
3437         Use Library_base; call library's get_mtime; add incremental inputs
3438         entry before members.
3439         (class Unused_symbol_visitor): New class.
3440         (Incremental_inputs::report_archive_end): Use Library_base; use
3441         visitor class to record unused symbols; don't add incremental inputs
3442         entry after members.
3443         (Incremental_inputs::report_object): Use Library_base.
3444         * incremental.h
3445         (Incremental_archive_entry::Incremental_archive_entry): Remove
3446         unused Archive parameter.
3447         (Incremental_inputs::report_archive_begin): Use Library_base.
3448         (Incremental_inputs::report_archive_end): Likewise.
3449         (Incremental_inputs::report_object): Likewise.
3450         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3451         function.
3452         * object.h (Object::for_all_global_symbols): New function.
3453         (Object::do_for_all_global_symbols): New function.
3454         (Sized_relobj::do_for_all_global_symbols): New function.
3455         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3456         function.
3457         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3458         function.
3459
3460 2011-03-27  Ian Lance Taylor  <iant@google.com>
3461
3462         * archive.cc (Archive::interpret_header): Return -1 if something
3463         goes wrong.  Change callers accordingly.
3464
3465 2011-03-25  Cary Coutant  <ccoutant@google.com>
3466
3467         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3468         * testsuite/Makefile.in: Regenerate.
3469
3470 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3471
3472         * plugin.cc (get_view): New.
3473         (Plugin::load): Pass get_view to the plugin.
3474         (Plugin_manager::get_view): New.
3475
3476 2011-03-21  Ian Lance Taylor  <iant@google.com>
3477
3478         * testsuite/final_layout.sh: Rewrite to not use dc.
3479         * testsuite/relro_test.sh: Fail if dc is not present.
3480
3481 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3482
3483         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3484         Change == to -eq.
3485         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3486         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3487         Change == to -eq.
3488         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3489         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3490
3491 2011-03-14  Ian Lance Taylor  <iant@google.com>
3492
3493         * script-sections.cc (Sort_output_sections::script_compare):
3494         Rename from is_before, change return type.
3495         (Sort_output_sections::operator()): Adjust accordingly.
3496
3497 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3498
3499         PR gold/12572
3500         * testsuite/odr_violation2.cc: Add comment to make all error line
3501         numbers double digits.
3502         * testsuite/debug_msg.sh: Adjust expected errors.
3503
3504 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3505
3506         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3507         but mark earlier ones as non-canonical
3508         (offset_to_iterator): Update search target and example
3509         (do_addr2line): Return extra lines in a vector*
3510         (format_file_lineno): Extract from do_addr2line
3511         (one_addr2line): Add vector* out-param
3512         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3513         when a lineno entry appeared last for its instruction
3514         (Dwarf_line_info): Add vector* out-param
3515         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3516         * symtab.cc (Odr_violation_compare): Include the lineno in the
3517         comparison again.
3518         (linenos_from_loc): New. Combine the canonical line for an
3519         address with its other lines.
3520         (True_if_intersect): New. Helper functor to make
3521         std::set_intersection a query.
3522         (detect_odr_violations): Compare sets of lines instead of just
3523         one line for each function. This became less deterministic, but
3524         has fewer false positives.
3525         * symtab.h: Declarations.
3526         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3527         mix an optimized and non-optimized object in the same binary
3528         (odr_violation2.so): Same.
3529         * testsuite/Makefile.in: Regenerate from Makefile.am.
3530         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3531         * testsuite/debug_msg.sh: Update line numbers and add
3532         assertions.
3533         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3534         non-optimized context.
3535         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3536         isn't inlined, and use OdrDerived in an optimized context.
3537         * testsuite/odr_header1.h: Defines OdrDerived, where
3538         optimization will change the
3539         first-instruction-in-the-destructor's file and line number.
3540         * testsuite/odr_header2.h: Defines OdrBase.
3541
3542 2011-03-09  Ian Lance Taylor  <iant@google.com>
3543
3544         * fileread.cc (File_read::clear_views): Don't delete the whole
3545         file view.
3546
3547 2011-03-08  Ian Lance Taylor  <iant@google.com>
3548
3549         PR gold/12525
3550         * fileread.cc: #include <climits>.
3551         (GOLD_IOV_MAX): Define.
3552         (File_read::read_multiple): Limit number of entries by iov_max.
3553         * fileread.h (class File_read): Always set max_readv_entries to
3554         128.
3555
3556 2011-03-07  Ian Lance Taylor  <iant@google.com>
3557
3558         PR gold/12525
3559         * options.h (class General_options): Add -dy and -dn.
3560
3561 2011-03-02  Cary Coutant  <ccoutant@google.com>
3562
3563         * testsuite/script_test_9.t: Add TLS segment.
3564
3565 2011-03-02  Simon Baldwin  <simonb@google.com>
3566
3567         * configure.ac: Add check for gnu_indirect_function support in
3568         the toolchain building binutils.
3569         * configure: Rebuild.
3570
3571 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3572
3573         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3574         plugin only symbols.
3575         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3576         in plugin files as not needed in the symbol table.
3577
3578 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3579
3580         * output.cc (Output_section::add_input_section): Delay fill
3581         generation for section ordering.
3582
3583 2011-02-09  Ian Lance Taylor  <iant@google.com>
3584
3585         PR gold/12316
3586         * object.h (class Sized_relobj): Remove clear_local_symbols.
3587         * reloc.cc (Sized_relobj::do_relocate): Don't call
3588         clear_local_symbols.
3589
3590 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3591
3592         * plugin.cc (is_visible_from_outside): Return true for symbols
3593         in the -u option.
3594
3595 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3596
3597         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3598         filename.
3599
3600 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3601
3602         * icf.h (is_section_foldable_candidate): Change type of parameter
3603         to std::string.
3604         * icf.cc (Icf::find_identical_sections): Change type of local variable
3605         section_name to be std::string.
3606         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3607
3608 2011-01-25  Ian Lance Taylor  <iant@google.com>
3609
3610         * script.cc (script_add_extern): Rewrite to use
3611         add_symbol_reference.
3612
3613 2011-01-25  Doug Kwan  <dougkwan@google.com>
3614
3615         * icf.cc (get_section_contents): Always lock section's object.
3616
3617 2011-01-24  Ian Lance Taylor  <iant@google.com>
3618
3619         * options.h (class General_options): Accept
3620         --no-detect-odr-violations.
3621
3622 2011-01-24  Ian Lance Taylor  <iant@google.com>
3623
3624         * version.cc (version_string): Bump to 1.11.
3625
3626 2011-01-24  Ian Lance Taylor  <iant@google.com>
3627
3628         * plugin.cc (class Plugin_rescan): Define new class.
3629         (Plugin_manager::claim_file): Set any_claimed_.
3630         (Plugin_manager::save_archive): New function.
3631         (Plugin_manager::save_input_group): New function.
3632         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3633         necessary.
3634         (Plugin_manager::new_undefined_symbol): New function.
3635         (Plugin_manager::rescan): New function.
3636         (Plugin_manager::rescannable_defines): New function.
3637         (Plugin_manager::add_input_file): Set any_added_.
3638         * plugin.h (class Plugin_manager): define new fields rescannable_,
3639         undefined_symbols_, any_claimed_, and any_added_.  Declare
3640         Plugin_rescan as friend.  Declare new functions.
3641         (Plugin_manager::Rescannable): Define type.
3642         (Plugin_manager::Rescannable_list): Define type.
3643         (Plugin_manager::Undefined_symbol_list): Define type.
3644         (Plugin_manager::Plugin_manager): Initialize new fields.
3645         * archive.cc (Archive::defines_symbol): New function.
3646         (Add_archive_symbols::run): Pass archive to plugins if any.
3647         * archive.h (class Archive): Declare defines_symbol.
3648         * readsyms.cc (Input_group::~Input_group): New function.
3649         (Finish_group::run): Pass input_group to plugins if any.
3650         * readsyms.h (class Input_group): Declare destructor.
3651         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3652         any.
3653
3654 2011-01-10  Ian Lance Taylor  <iant@google.com>
3655
3656         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3657         section as relro.
3658         (Layout::set_segment_offsets): Reset increase_relro before calling
3659         set_section_addresses a second time.
3660
3661 2011-01-04  Cary Coutant  <ccoutant@google.com>
3662
3663         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3664         sections before NOBITS sections.
3665
3666 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3667
3668         * version.cc (print_version): Update copyright to 2011.
3669
3670 2010-12-23  Cary Coutant  <ccoutant@google.com>
3671
3672         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3673         of OS to this->add.  Add OD parameter to second form of the function.
3674
3675 2010-12-20  Ian Lance Taylor  <iant@google.com>
3676
3677         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3678         second of two consecutive entries with same offset.
3679
3680 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3681
3682         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3683         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3684         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3685         to avoid unneeded links against $(LDADD).
3686         * testsuite/Makefile.in: Regenerate.
3687
3688 2010-12-15  Ian Lance Taylor  <iant@google.com>
3689
3690         PR gold/12324
3691         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3692         for R_X86_64_32 and R_X86_64_PC32.
3693         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3694         ver_matching_def_pic.o.
3695         (ver_matching_def_pic.o): New target.
3696
3697 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3698
3699         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3700         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3701         Move definition before File_read::View member definitions.
3702         (File_read::View::~View): Initialize and hold lock before
3703         updating current_mapped_bytes.
3704
3705 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3706
3707         * dwarf_reader.cc: Remove outdated comment.
3708         * gold-threads.cc: Fix typo in error message.
3709         * archive.cc: Fix typos in comments.
3710         * archive.h: Likewise.
3711         * arm-reloc-property.cc: Likewise.
3712         * arm-reloc-property.h: Likewise.
3713         * arm-reloc.def: Likewise.
3714         * arm.cc: Likewise.
3715         * attributes.h: Likewise.
3716         * cref.cc: Likewise.
3717         * ehframe.cc: Likewise.
3718         * fileread.h: Likewise.
3719         * gold.h: Likewise.
3720         * i386.cc: Likewise.
3721         * icf.cc: Likewise.
3722         * incremental.h: Likewise.
3723         * int_encoding.cc: Likewise.
3724         * layout.h: Likewise.
3725         * main.cc: Likewise.
3726         * merge.h: Likewise.
3727         * object.cc: Likewise.
3728         * object.h: Likewise.
3729         * options.cc: Likewise.
3730         * readsyms.cc: Likewise.
3731         * reduced_debug_output.cc: Likewise.
3732         * reloc.cc: Likewise.
3733         * script-sections.cc: Likewise.
3734         * sparc.cc: Likewise.
3735         * symtab.h: Likewise.
3736         * target-reloc.h: Likewise.
3737         * target.cc: Likewise.
3738         * target.h: Likewise.
3739         * timer.cc: Likewise.
3740         * timer.h: Likewise.
3741         * x86_64.cc: Likewise.
3742
3743 2010-12-09  Cary Coutant  <ccoutant@google.com>
3744
3745         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3746         stack.
3747         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3748         parameter; change all callers.
3749         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3750         * options.h (warn_execstack): New option.
3751
3752 2010-12-07  Doug Kwan  <dougkwan@google.com>
3753
3754         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3755         like function call relocations.
3756
3757 2010-12-07  Ian Lance Taylor  <iant@google.com>
3758
3759         * archive.cc (Archive::get_elf_object_for_member): Permit
3760         punconfigured to be NULL.
3761         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3762         (Archive::include_member): Pass NULL to get_elf_object_for_member
3763         if we searched for the archive and this is the first included
3764         object.
3765
3766 2010-12-01  Ian Lance Taylor  <iant@google.com>
3767
3768         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3769         track_relocs_type_ field.
3770         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3771         Set track_relocs_type_.
3772         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3773         contents when using RELA relocs.
3774         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3775         reloc_map_.
3776         * reloc.cc (Track_relocs::next_addend): New function.
3777         * reloc.h (class Track_relocs): Declare next_addend.
3778
3779 2010-12-01  Ian Lance Taylor  <iant@google.com>
3780
3781         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3782         virtual destructor.
3783
3784 2010-12-01  Ian Lance Taylor  <iant@google.com>
3785
3786         * README: Update compilers known to work and fail.
3787
3788 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3789
3790         * configure.in: For --enable-gold, handle value `default' instead of
3791         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3792         not the default.
3793         * configure: Regenerate.
3794
3795 2010-11-18  Doug Kwan  <dougkwan@google.com>
3796
3797         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3798         and right_alignment to be zero.  Store result alignment only if it is
3799         greater than existing alignment.
3800
3801 2010-11-16  Cary Coutant  <ccoutant@google.com>
3802
3803         PR gold/12220
3804         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3805         Check for ".zdebug_line".
3806
3807 2010-11-16  Doug Kwan  <dougkwan@google.com>
3808             Cary Coutant  <ccoutant@google.com>
3809
3810         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3811         by reference; adjust all callers.
3812         * output.cc (Output_segment::set_section_addresses): Adjust references
3813         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3814         list is empty.
3815         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3816         end at page boundary.
3817
3818 2010-11-16  Cary Coutant  <ccoutant@google.com>
3819
3820         PR gold/12220
3821         * layout.cc (Layout::choose_output_section): Transform names of
3822         compressed sections even when using a script with a SECTIONS clause.
3823         (Layout::output_section_name): Remove code to transform
3824         compressed debug section names.
3825         * output.cc (Output_section::add_input_section): Use uncompressed
3826         section size when tracking input sections.
3827
3828 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3829
3830         * symtab.h (Symbol::NON_PIC_REF): Remove.
3831         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3832         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3833         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3834         (Symbol::use_plt_offset): Take a flags argument and pass it
3835         directly to needs_dynamic_reloc.  Restrict check for undefined
3836         weak symbols to function calls.
3837         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3838         (Target_arm::Scan::global): Use it.
3839         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3840         (Target_arm::Relocate::relocate): Likewise.
3841         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3842         parameter with an r_type parameter.  Use get_reference_flags
3843         to get the flags.
3844         (Target_arm::Relocate::relocate): Update accordingly.
3845         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3846         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3847         (Target_i386::Scan::global): Likewise.
3848         (Target_i386::Relocate::relocate): Likewise.
3849         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3850         parameter with an r_type parameter.  Use get_reference_flags
3851         to get the flags.
3852         (Target_i386::Relocate::relocate): Update accordingly.
3853         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3854         (Target_powerpc::Scan::global): Use it.
3855         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3856         (Target_powerpc::Relocate::relocate): Likewise.
3857         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3858         (Target_sparc::Scan::global): Use it.
3859         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3860         (Target_sparc::Relocate::relocate): Likewise.
3861         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3862         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3863         (Target_x86_64::Scan::global): Likewise.
3864         (Target_x86_64::Relocate::relocate): Likewise.
3865
3866 2010-11-08  Doug Kwan  <dougkwan@google.com>
3867             Cary Coutant  <ccoutant@google.com>
3868
3869         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3870         (Arm_exidx_merge_section::section_contents_): New data member.
3871         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3872         (Arm_input_section::~Arm_input_section): De-allocate memory.
3873         (Arm_input_section::original_contents_): New data member.
3874         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3875         in parameters instead of calling Object::section_contents without
3876         locking.
3877         (Arm_output_section::group_section): New parameter TASK.  Pass it
3878         to callees that need locking objects.
3879         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3880         to lock EXIDX input sections.  Fix a formatting issue.  Call
3881         Arm_exidx_merged_section::build_contents to create merged section
3882         contents.
3883         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3884         to lock object of stub table owner.
3885         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3886         TEXT_SIZE to initialize data member TEXT_SIZE_.
3887         (Arm_exidx_input_section::addralign): Fix typo in comment.
3888         (Arm_exidx_input_section::text_size): New method.
3889         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3890         that require locking objects.  Lock objects before scanning for stubs
3891         and updating local symbols.
3892         (Arm_input_section<big_endian>::init): Copy contents of original
3893         input section.
3894         (Arm_input_section<big_endian>::do_write): Use saved contents of
3895         original input section instead of calling Object::section_contents
3896         without locking.
3897         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3898         size without calling Object::section_size().
3899         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3900         for size.  Allocate a buffer for merged EXIDX entries.
3901         (Arm_exidx_merged_section::build_contents): New method.
3902         (Arm_exidx_merged_section::do_write): Move merge section contents
3903         building code to Arm_exidx_merged_section::build_contetns.  Write
3904         out contetns in buffer instead of building it on the fly.
3905         (Arm_relobj::make_exidx_input_section): Also pass text section size
3906         to Arm_exidx_input_section constructor.
3907         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3908         (Arm_dynobj::do_read_symbols): Fix memory leak.
3909         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3910         * target.h: (class Task): Add forward declaration.
3911         (Target::relax): Add new parameter TASK and pass it to
3912         Target::do_relax().
3913         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3914
3915 2010-11-05  Cary Coutant  <ccoutant@google.com>
3916
3917         PR gold/10708
3918         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3919         object when reading from the file.
3920         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3921         second layout pass.
3922         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3923         when reading section contents.
3924         (get_section_contents): Likewise.
3925         (icf::find_identical_sections): Likewise.
3926         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3927         object when reading from the file.
3928         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3929         the object when doing deferred section layout.
3930
3931 2010-11-03  Nick Clifton  <nickc@redhat.com>
3932
3933         PR gold/12001
3934         * script.h (class Symbol_assignment: name): New member.  Returns
3935         the name of the symbol.
3936         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3937         Returns true if the given symbol name is on the list of
3938         assignments wating to be processed.
3939         * archive.cc (should_incldue_member): If the symbol is undefined,
3940         check to see if it is on the list of symbols pending assignment.
3941
3942 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3943
3944         * script-sections.cc (Script_sections::find_memory_region): Check
3945         for a NULL output section pointer.
3946
3947 2010-10-29  Doug Kwan  <dougkwan@google.com>
3948
3949         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3950         Output_section::add_relaxed_input_section.
3951         * output.cc (Output_section::add_relaxed_input_section): Add new
3952         arguments LAYOUT and NAME.  Set section order index.
3953         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3954         Copy section order index.
3955         * output.h (Output_section::add_relaxed_input_section): Add new
3956         arguments LAYOUT and NAME.
3957
3958 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3959
3960         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3961         NATIVE_OR_CROSS_LINKER.
3962         * testsuite/Makefile.in: Regenerate.
3963
3964 2010-10-20  Doug Kwan  <dougkwan@google.com>
3965
3966         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3967         without SHF_LINK_ORDER flags.
3968         * layout.cc (Layout::choose_output_section): Do not filter
3969         SHF_LINK_ORDER flag in a relocatable link.
3970
3971 2010-10-17  Cary Coutant  <ccoutant@google.com>
3972
3973         * output.h (Output_segment::set_section_addresses): Change function
3974         signature.  Update all callers.
3975         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3976         sections.
3977         (Output_segment::set_section_addresses): Align after last TLS
3978         section.  Add padding before last relro section instead of after.
3979
3980 2010-10-17  Doug Kwan  <dougkwan@google.com>
3981
3982         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3983         GOT output section to be writable.
3984
3985 2010-10-14  Cary Coutant  <ccoutant@google.com>
3986
3987         * debug.h (DEBUG_INCREMENTAL): New flag.
3988         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3989         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3990         mode.
3991         * incremental.cc (report_command_line): Ignore all forms of
3992         --incremental.
3993         * layout.cc (Layout::Layout): Check parameters for incremental link
3994         mode.
3995         * options.cc (General_options::parse_incremental): New function.
3996         (General_options::parse_no_incremental): New function.
3997         (General_options::parse_incremental_full): New function.
3998         (General_options::parse_incremental_update): New function.
3999         (General_options::incremental_mode_): New data member.
4000         (General_options::finalize): Check incremental_mode_.
4001         * options.h (General_options): Update help text for --incremental.
4002         Add --no-incremental, --incremental-full, --incremental-update.
4003         (General_options::Incremental_mode): New enum type.
4004         (General_options::incremental_mode): New function.
4005         (General_options::incremental_mode_): New data member.
4006         * parameters.cc (Parameters::incremental_mode_): New data member.
4007         (Parameters::set_options): Set incremental_mode_.
4008         (Parameters::set_incremental_full): New function.
4009         (Parameters::incremental): New function.
4010         (Parameters::incremental_update): New function.
4011         (set_parameters_incremental_full): New function.
4012         * parameters.h (Parameters::set_incremental_full): New function.
4013         (Parameters::incremental): New function.
4014         (Parameters::incremental_update): New function.
4015         (Parameters::incremental_mode_): New data member.
4016         (set_parameters_incremental_full): New function.
4017         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4018         incremental link mode.
4019         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4020         (Sized_relobj::do_relocate_sections): Likewise.
4021         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4022         option.
4023         * testsuite/Makefile.in: Regenerate.
4024         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4025
4026 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4027
4028         * script-sections.h (class Script_sections): Make
4029         Sections_elements typedef public.
4030         * script-sections.cc (class Sort_output_sections): Add elements_
4031         field.  Add constructor which sets it; change all callers.
4032         (Sort_output_sections::is_before): New function.
4033         (Sort_output_sections::operator()): Call is_before.
4034         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4035         conditional.
4036         * testsuite/script_test_10.sh: New test. Test script section
4037         order.
4038         * testsuite/script_test_10.t: Likewise.
4039         * testsuite/script_test_10.s: Likewise.
4040         * testsuite/Makefile.am: Wrap the cross linker tests and the
4041         common tests into NATIVE_OR_CROSS_LINKER.
4042         (check_SCRIPTS): Add script_test_10.sh.
4043         (check_DATA): Add script_test_10.stdout.
4044         (script_test_10.o, script_test_10): New targets.
4045         (script_test_10.stdout): New target.
4046         * configure, testsuite/Makefile.in: Regenerate.
4047
4048 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4049
4050         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4051         error for the deprecated relocations.
4052         (Target_arm::Scan::global): Likewise.
4053         (Target_arm::Relocate::relocate): Likewise.
4054
4055 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4056
4057         * fileread.cc (Input_file::find_file): Initialize *found_name
4058         and *namep when using the fallback search for case 4.
4059
4060 2010-10-11  Cary Coutant  <ccoutant@google.com>
4061
4062         * options.h (class General_options): Redefine -z lazy as an alias for
4063         the negation of -z now.
4064
4065 2010-10-11  Ian Lance Taylor  <iant@google.com>
4066
4067         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4068         binding.
4069
4070 2010-10-06  Nick Clifton  <nickc@redhat.com>
4071
4072         * script-sections.cc(class Memory_region): Remove
4073         current_lma_offset_ field.  Rename current_vma_offset_ to
4074         current_offset_.  Add last_section_ field.
4075         (Memory_region::get_current_vma_address): Rename to
4076         get_current_address.
4077         (Memory_region::get_current_lma_address): Delete.
4078         (Memory_region::increment_vma_offset): Rename to
4079         increment_offset.
4080         (Memory_region::increment_lma_offset): Delete.
4081         (Memory_region::attributes_compatible): New method.  Returns
4082         true if the provided section is compatible with the region.
4083         (Memory_region::get_last_section): New method.  Returns the last
4084         section to use the region.
4085         (Memory_region::set_last_section): New method.  Stores the last
4086         section to use the region.
4087         (Script_sections::block_in_region): New method.  Returns true if
4088         a block of memory is contained within a region.
4089         (Script_sections::find_memory_region): New method.  Locates a
4090         memory region to be used to set a VMA or LMA address.
4091         (Output_section_definition::set_section_addresses): Add code to
4092         check for addresses set by memory regions.
4093         (Output_segment::set_section_addresses): Remove memory region
4094         walking code.
4095         (Script_sections::create_segment): Add a warning if a header
4096         segment is created outside of any region.
4097         * script-sections.h (class Script_sections): Add prototypes for
4098         find_memory_region and block_in_region methods.
4099         * testsuite/memory_test.s: Use .long instead of .word.
4100         * testsuite/memory_test.t: Add some more output sections.
4101         * testsuite/memory_test.sh: Update expected output.
4102
4103 2010-10-02  Doug Kwan  <dougkwan@google.com>
4104
4105         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4106         defintion to symtab.h
4107         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4108         declaration to defintion.
4109
4110 2010-10-01  Nick Clifton  <nickc@redhat.com>
4111
4112         * expression.cc (eval): Replace dummy argument with NULL.
4113         (eval_maybe_dot): Check for a NULL result section pointer.
4114         (Symbol_expression::value): Likewise.
4115         (Dot_expression::value): Likewise.
4116         (BINARY_EXPRESSION): Likewise.
4117         (Max_expression::value): Likewise.
4118         (Min_expression::value): Likewise.
4119         (Absolute_expression::value): Likewise.
4120         (Addr_expression::value_from_output_section): Likewise.
4121         (Loaddddr_expression::value_from_output_section): Likewise.
4122         (Segment_start_expression::value): Likewise.
4123         * script-sections.cc
4124         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4125         argument with NULL.
4126         (Sections_elememt_dot_assignment::set_section_addresses):
4127         Likewise.
4128         (Output_data_expression::do_write_to_buffer): Likewise.
4129         (Output_section_definition::finalize_symbols): Likewise.
4130         (Output_section_definition::set_section_addresses): Likewise.
4131
4132 2010-09-30  Doug Kwan  <dougkwan@google.com>
4133
4134         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4135
4136 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4137
4138         * target.h (Target::can_icf_inline_merge_sections): New virtual
4139         function.
4140         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4141         virtual function.
4142         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4143         virtual function.
4144         * icf.cc (get_section_contents): Inline merge sections only when
4145         target allows it.
4146
4147 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4148
4149         * configure: Regenerate.
4150
4151 2010-09-17  Ian Lance Taylor  <iant@google.com>
4152
4153         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4154         * testsuite/Makefile.am (memory_test.o): New target.
4155         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4156         memory_test.t.
4157         * testsuite/Makefile.in: Rebuild.
4158
4159 2010-09-17  Doug Kwan  <dougkwan@google.com>
4160
4161         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4162         defintion if relocation uses GOT entries of the symbol.
4163         * testsuite/icf_safe_test.sh: Fix test.
4164         * testsuite/icf_safe_so_test.sh: Fix test.
4165
4166 2010-09-16  Cary Coutant  <ccoutant@google.com>
4167
4168         * script_sections.cc (class Memory_region): Remove "NULL" from
4169         vector initializations.
4170
4171 2010-09-15  Cary Coutant  <ccoutant@google.com>
4172
4173         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4174         Resolve forwarding symbols.
4175
4176 2010-09-15  Doug Kwan  <dougkwan@google.com>
4177
4178         * gold/testsuite/script_test_3.t: Add ARM special sections.
4179         * gold/testsuite/script_test_4.t: Same.
4180         * gold/testsuite/script_test_5.t: Same.
4181         * gold/testsuite/script_test_6.t: Same.
4182         * gold/testsuite/script_test_7.t: Same.
4183         * gold/testsuite/script_test_7.t: Same.
4184         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4185
4186 2010-09-14  Cary Coutant  <ccoutant@google.com>
4187
4188         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4189         (Target_x86_64::Relocate::relocate_tls): Replace check for
4190         saw_tls_block_reloc_ with test for executable section.
4191
4192 2010-09-12  Cary Coutant  <ccoutant@google.com>
4193
4194         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4195         position-independent executables to shared libraries need dynamic
4196         relocations.
4197         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4198         position-independent executables.
4199         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4200         * testsuite/Makefile.in: Regenerate.
4201
4202 2010-09-10  Nick Clifton  <nickc@redhat.com>
4203
4204         PR gold/11997
4205         * testsuite/memory_test.t: Discard any sections that are not
4206         needed.
4207
4208 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4209
4210         PR gold/11996
4211         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4212         "This::" to work around a bug in gcc 4.2.
4213
4214         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4215
4216 2010-09-09  Rafael Espindola  <espindola@google.com>
4217
4218         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4219         sections with different PF_X flags in the same segment.
4220         (Layout::find_first_load_seg): Search all segments to find the first
4221         one.
4222         * options.h (rosegment): New.
4223
4224 2010-09-08  Rafael Espindola  <espindola@google.com>
4225
4226         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4227
4228 2010-09-08  Doug Kwan  <dougkwan@google.com>
4229
4230         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4231         (Arm_relobj::do_relocate_sections): Add new parameter for output
4232         file to match the parent.
4233         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4234         of local symbols instead of input values.  Update code to track
4235         changes in gold::relocate_section.
4236         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4237         (Sized_relobj::compute_final_local_value_internal): New methods.
4238         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4239         body into private version of Sized_relobj::compute_final_local_value.
4240         Call the inline method.
4241         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4242         merged symbol value if there is one.
4243         (Symbol_value::has_output_value): New method defintiion.
4244         (Sized_relobj::Compute_final_local_value_status): New enum type.
4245         (Sized_relobj::compute_final_local_value): New methods.
4246         (Sized_relobj::compute_final_local_value_internal): New methods.
4247         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4248         and arm_cortex_a8.sh.
4249         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4250         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4251         New tests.
4252         * Makefile.in: Regenerate.
4253         * testsuite/arm_bl_out_of_range.s: Update test.
4254         * testsuite/thumb_bl_out_of_range.s: Ditto.
4255         * testsuite/thumb_blx_out_of_range.s: Ditto.
4256         * testsuite/arm_branch_out_of_range.sh: New file.
4257         * testsuite/arm_cortex_a8.sh: Ditto.
4258         * testsuite/arm_cortex_a8_b.s: Ditto.
4259         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4260         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4261         * testsuite/arm_cortex_a8_bl.s: Ditto.
4262         * testsuite/arm_cortex_a8_blx.s: Ditto.
4263         * testsuite/arm_cortex_a8_local.s: Ditto.
4264         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4265         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4266
4267 2010-09-08  Rafael Espindola  <espindola@google.com>
4268
4269         * Makefile.am (memory_test.stdout): Run readelf with -W.
4270         * Makefile.in: Regenerate.
4271         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4272         64 bit output.
4273
4274 2010-09-08  Rafael Espindola  <espindola@google.com>
4275
4276         * script-sections.cc (Script_sections::add_memory_region): Convert
4277         field precision to int.
4278         * script.cc (script_set_section_region, script_set_section_region):
4279         Convert field precision to int.
4280
4281 2010-09-08  Rafael Espindola  <espindola@google.com>
4282
4283         * arm.cc (do_finalize_sections): Create the __exidx_start and
4284         __exdix_end symbols even when the section is missing.
4285
4286 2010-09-08  Nick Clifton  <nickc@redhat.com>
4287
4288         * README: Remove claim that MEMORY is not supported.
4289         * expression.cc (script_exp_function_origin)
4290         (script_exp_function_length): Move from here to ...
4291         * script.cc: ... here.
4292         (script_set_section_region, script_add_memory)
4293         (script_parse_memory_attr, script_include_directive): New
4294         functions.
4295         * script-sections.cc
4296         (class Memory_region): New class.
4297         (class Output_section_definition): Add set_memory_region,
4298         set_section_vma, set_section_lma and get_section_name methods.
4299         (class Script_Sections): Add add_memory_region,
4300         find_memory_region, find_memory_region_origin,
4301         find_memory_region_length and set_memory_region methods.
4302         Have set_section_addresses method walk the list of set memory
4303         regions.
4304         Extend the print methos to display memory regions.
4305         * script-sections.h: Add prototypes for new methods.
4306         Add enum for MEMORY region attributes.
4307         * yyscript.y: Add support for parsing MEMORY regions.
4308         * script-c.h: Add prototypes for new functions.
4309         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4310         * testsuite/Makefile.in: Regenerate.
4311         * testsuite/memory_test.sh: New script.
4312         * testsuite/memory_test.s: New assembler source file.
4313         * testsuite/memory_test.t: New linker script.
4314
4315 2010-08-27  Doug Kwan  <dougkwan@google.com>
4316
4317         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4318         reference override an existing dynamic weak reference.
4319         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4320         * testsuite/Makefile.in: Regenerate.
4321         * testsuite/dyn_weak_ref.sh: New file.
4322         * testsuite/dyn_weak_ref_1.c: Ditto.
4323         * testsuite/dyn_weak_ref_2.c: Ditto.
4324
4325 2010-08-27  Ian Lance Taylor  <iant@google.com>
4326
4327         * incremental.h (class Incremental_input_entry): Add virtual
4328         destructor.
4329
4330 2010-08-27  Ian Lance Taylor  <iant@google.com>
4331
4332         * testsuite/start_lib_test_3.c: Mark t3 as used.
4333
4334 2010-08-27  Nick Clifton  <nickc@redhat.com>
4335
4336         * options.cc (version_script): Fix small typo in previous
4337         whitespace tidyup.
4338
4339 2010-08-25  Nick Clifton  <nickc@redhat.com>
4340
4341         * archive.cc: Formatting fixes: Remove whitespace between
4342         typename and following asterisk.  Remove whitespace between
4343         function name and opening parenthesis.
4344         * archive.h: Likewise.
4345         * arm.cc: Likewise.
4346         * attributes.cc: Likewise.
4347         * attributes.h: Likewise.
4348         * common.cc: Likewise.
4349         * copy-relocs.cc: Likewise.
4350         * dirsearch.h: Likewise.
4351         * dynobj.cc: Likewise.
4352         * ehframe.cc: Likewise.
4353         * ehframe.h: Likewise.
4354         * expression.cc: Likewise.
4355         * fileread.cc: Likewise.
4356         * fileread.h: Likewise.
4357         * gc.h: Likewise.
4358         * gold-threads.cc: Likewise.
4359         * gold.cc: Likewise.
4360         * i386.cc: Likewise.
4361         * icf.h: Likewise.
4362         * incremental-dump.cc: Likewise.
4363         * incremental.cc: Likewise.
4364         * layout.cc: Likewise.
4365         * layout.h: Likewise.
4366         * main.cc: Likewise.
4367         * merge.cc: Likewise.
4368         * merge.h: Likewise.
4369         * object.cc: Likewise.
4370         * object.h: Likewise.
4371         * options.cc: Likewise.
4372         * options.h: Likewise.
4373         * output.cc: Likewise.
4374         * output.h: Likewise.
4375         * plugin.cc: Likewise.
4376         * plugin.h: Likewise.
4377         * powerpc.cc: Likewise.
4378         * reloc.cc: Likewise.
4379         * script-c.h: Likewise.
4380         * script-sections.cc: Likewise.
4381         * script.cc: Likewise.
4382         * stringpool.cc: Likewise.
4383         * symtab.cc: Likewise.
4384         * symtab.h: Likewise.
4385         * target.cc: Likewise.
4386         * timer.cc: Likewise.
4387         * timer.h: Likewise.
4388         * version.cc: Likewise.
4389         * x86_64.cc: Likewise.
4390
4391 2010-08-24  Nick Clifton  <nickc@redhat.com>
4392
4393         PR 11899
4394         * layout.cc (segment_precedes): Sort segments by their physical
4395         addresses, if they have been set.
4396
4397 2010-08-23  Cary Coutant  <ccoutant@google.com>
4398
4399         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4400         symbols data.
4401         (Lib_group::include_member): Unlock object after deleting its
4402         symbols data.
4403         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4404         the bug fixed here.
4405
4406 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4407             Cary Coutant  <ccoutant@google.com>
4408
4409         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4410         constructor, and set_blocker.
4411         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4412         readsyms_blocker_.
4413         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4414         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4415         * testsuite/Makefile.am (start_lib_test): New test case.
4416         * testsuite/Makefile.in: Regenerate.
4417         * testsuite/start_lib_test_main.c: New file.
4418         * testsuite/start_lib_test_1.c: New file.
4419         * testsuite/start_lib_test_2.c: New file.
4420         * testsuite/start_lib_test_3.c: New file.
4421
4422 2010-08-19  Ian Lance Taylor  <iant@google.com>
4423
4424         * Makefile.in: Rebuild with automake 1.11.1.
4425         * aclocal.m4: Likewise.
4426         * testsuite/Makefile.in: Likewise.
4427
4428 2010-08-19  Ian Lance Taylor  <iant@google.com>
4429
4430         PR 10893
4431         * i386.cc (class Output_data_plt_i386): Update declarations.
4432         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4433         local_ifuncs_ fields.
4434         (Target_i386::do_plt_section_for_global): New function.
4435         (Target_i386::do_plt_section_for_local): New function.
4436         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4437         parameter; change all callers.  Initialize global_ifuncs_ and
4438         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4439         __rel_iplt_end.
4440         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4441         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4442         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4443         symbols.
4444         (Target_i386::make_plt_section): New function, broken out of
4445         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4446         (Target_i386::make_plt_entry): Call make_plt_section.
4447         (Target_i386::make_local_ifunc_plt_entry): New function.
4448         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4449         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4450         R_386_IRELATIVE to switch.
4451         (Target_i386::Scan::global): Likewise.
4452         (Target_i386::Relocate::relocate): Likewise.
4453         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4454         switch.
4455         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4456         (Target_x86_64::do_plt_section_for_global): New function.
4457         (Target_x86_64::do_plt_section_for_local): New function.
4458         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4459         parameter; change all callers.  If doing a static link define
4460         __rela_iplt_start and __rela_iplt_end.
4461         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4462         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4463         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4464         to point to .plt.
4465         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4466         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4467         switch.
4468         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4469         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4470         R_X86_64_IRELATIVE to switch.
4471         (Target_x86_64::Scan::global): Likewise.
4472         (Target_x86_64::Relocate::relocate): Likewise.
4473         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4474         switch.
4475         * target.h (class Target): Add plt_section_for_global and
4476         plt_section_for_local functions.  Add do_plt_section_for_global
4477         and do_plt_section_for_local virtual functions.
4478         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4479         clarifying comments.
4480         (Symbol::use_plt_offset): Handle IFUNC symbol.
4481         * object.cc (Sized_relobj::Sized_relobj): Initialize
4482         local_plt_offsets_.
4483         (Sized_relobj::local_has_plt_offset): New function.
4484         (Sized_relobj::local_plt_offset): New function.
4485         (Sized_relobj::set_local_plt_offset): New function.
4486         (Sized_relobj::do_count): Handle IFUNC symbol.
4487         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4488         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4489         is_ifunc_symbol functions.
4490         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4491         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4492         local_plt_offsets_ field.
4493         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4494         * output.h (class Output_section_data): Add non-const
4495         output_section function.
4496         (class Output_data_got): Update declarations.
4497         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4498         Add use_plt_offset parameter to global and local constructors.
4499         Change all callers.  Change local_sym_index_ field to 31 bits.
4500         Change GSYM_CODE and CONSTANT_CODE accordingly.
4501         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4502         doing a static link don't set sh_link field.
4503         (Output_data_got::Got_entry::write): Use PLT offset if
4504         appropriate.
4505         (Output_data_got::add_global_plt): New function.
4506         (Output_data_got::add_local_plt): New function.
4507         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4508         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4509         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4510         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4511         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4512         IFUNC conditional.
4513         * testsuite/ifunc-sel.h: New file.
4514         * testsuite/ifuncmain1.c: New file.
4515         * testsuite/ifuncmain1vis.c: New file.
4516         * testsuite/ifuncmod1.c: New file.
4517         * testsuite/ifuncdep2.c: New file.
4518         * testsuite/ifuncmain2.c: New file.
4519         * testsuite/ifuncmain3.c: New file.
4520         * testsuite/ifuncmod3.c: New file.
4521         * testsuite/ifuncmain4.c: New file.
4522         * testsuite/ifuncmain5.c: New file.
4523         * testsuite/ifuncmod5.c: New file.
4524         * testsuite/ifuncmain6pie.c: New file.
4525         * testsuite/ifuncmod6.c: New file.
4526         * testsuite/ifuncmain7.c: New file.
4527         * configure, testsuite/Makefile.in: Rebuild.
4528
4529 2010-08-18  Ian Lance Taylor  <iant@google.com>
4530
4531         * incremental.cc
4532         (Output_section_incremental_inputs::write_input_files): Add cast
4533         to avoid signed/unsigned comparison warning.
4534         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4535
4536 2010-08-12  Cary Coutant  <ccoutant@google.com>
4537
4538         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4539
4540 2010-08-13  Ian Lance Taylor  <iant@google.com>
4541
4542         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4543
4544 2010-08-12  Cary Coutant  <ccoutant@google.com>
4545             Doug Kwan  <dougkwan@google.com>
4546
4547         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4548         defintion overrides non-weak undef, remember that the original undef
4549         is not weak.
4550         * symtab.cc (Symbol_table::sized_write_global): For undef without
4551         an original weak binding, set binding to global in output.
4552         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4553         * testsuite/Makefile.in: Regenerate.
4554         * testsuite/strong_ref_weak_def.sh: New file.
4555         * testsuite/strong_ref_weak_def_1.c: Ditto.
4556         * testsuite/strong_ref_weak_def_2.c: Ditto.
4557
4558 2010-08-12  Cary Coutant  <ccoutant@google.com>
4559
4560         * testsuite/incremental_test.sh: Rewrite.
4561         * testsuite/incremental_test_1.c: Rewrite.
4562         * testsuite/incremental_test_2.c: Rewrite.
4563
4564 2010-08-12  Cary Coutant  <ccoutant@google.com>
4565
4566         * arm.cc (Target_arm::got_size): Add const.
4567         (Target_arm::got_entry_count): New function.
4568         (Target_arm::plt_entry_count): New function.
4569         (Target_arm::first_plt_entry_offset): New function.
4570         (Target_arm::plt_entry_size): New function.
4571         (Output_data_plt_arm::entry_count): New function.
4572         (Output_data_plt_arm::first_plt_entry_offset): New function.
4573         (Output_data_plt_arm::get_plt_entry_size): New function.
4574         * i386.cc (Target_i386::got_size): Add const.
4575         (Target_i386::got_entry_count): New function.
4576         (Target_i386::plt_entry_count): New function.
4577         (Target_i386::first_plt_entry_offset): New function.
4578         (Target_i386::plt_entry_size): New function.
4579         (Output_data_plt_i386::entry_count): New function.
4580         (Output_data_plt_i386::first_plt_entry_offset): New function.
4581         (Output_data_plt_i386::get_plt_entry_size): New function.
4582         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4583         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4584         * incremental.cc: Include target.h.
4585         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4586         parameter.  Adjust all callers.  Find incremental_got_plt section.
4587         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4588         section.
4589         (Output_section_incremental_inputs::set_final_data_size): Calculate
4590         size of incremental_got_plt section.
4591         (Output_section_incremental_inputs::do_write): Write the
4592         incremental_got_plt section.
4593         (Got_plt_view_info): New struct.
4594         (Local_got_offset_visitor): New class.
4595         (Global_got_offset_visitor): New class.
4596         (Global_symbol_visitor_got_plt): New class.
4597         (Output_section_incremental_inputs::write_got_plt): New function.
4598         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4599         Add parameter.  Adjust all callers.
4600         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4601         (Incremental_inputs::got_plt_section): New function.
4602         (Incremental_inputs::got_plt_section_): New data member.
4603         (Incremental_got_plt_reader): New class.
4604         * layout.cc (Layout::create_incremental_info_sections): Add the
4605         incremental_got_plt section.
4606         * object.h (Got_offset_list::get_list): New function.
4607         (Got offset_list::for_all_got_offsets): New function.
4608         (Sized_relobj::local_got_offset_list): New function.
4609         * powerpc.cc (Target_powerpc::got_size): Add const.
4610         (Target_powerpc::got_entry_count): New function.
4611         (Target_powerpc::plt_entry_count): New function.
4612         (Target_powerpc::first_plt_entry_offset): New function.
4613         (Target_powerpc::plt_entry_size): New function.
4614         (Output_data_plt_powerpc::entry_count): New function.
4615         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4616         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4617         * sparc.cc (Target_sparc::got_size): Add const.
4618         (Target_sparc::got_entry_count): New function.
4619         (Target_sparc::plt_entry_count): New function.
4620         (Target_sparc::first_plt_entry_offset): New function.
4621         (Target_sparc::plt_entry_size): New function.
4622         (Output_data_plt_sparc::entry_count): New function.
4623         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4624         (Output_data_plt_sparc::get_plt_entry_size): New function.
4625         * symtab.h (Symbol::got_offset_list): New function.
4626         (Symbol_table::for_all_symbols): New function.
4627         * target.h (Sized_target::got_entry_count): New function.
4628         (Sized_target::plt_entry_count): New function.
4629         (Sized_target::plt_entry_size): New function.
4630         * x86_64.cc (Target_x86_64::got_size): Add const.
4631         (Target_x86_64::got_entry_count): New function.
4632         (Target_x86_64::plt_entry_count): New function.
4633         (Target_x86_64::first_plt_entry_offset): New function.
4634         (Target_x86_64::plt_entry_size): New function.
4635         (Output_data_plt_x86_64::entry_count): New function.
4636         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4637         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4638
4639 2010-08-12  Cary Coutant  <ccoutant@google.com>
4640
4641         * archive.cc: Include incremental.h.
4642         (Archive::Archive): Initialize incremental_info_.
4643         (Archive::include_member): Record archive members in incremental info.
4644         (Add_archive_symbols::run): Record begin and end of an archive in
4645         incremental info.
4646         (Lib_group::include_member): Record objects in incremental info.
4647         * archive.h (Incremental_archive_entry): Forward declaration.
4648         (Archive::set_incremental_info): New member function.
4649         (Archive::incremental_info): New member function.
4650         (Archive::Unused_symbol_iterator): New class.
4651         (Archive::unused_symbols_begin): New member function.
4652         (Archive::unused_symbols_end): New member function.
4653         (Archive::incremental_info_): New data member.
4654         * incremental-dump.cc (find_input_containing_global): New function.
4655         (dump_incremental_inputs): Dump new incremental info sections.
4656         * incremental.cc: Include symtab.h.
4657         (Output_section_incremental_inputs): New class.
4658         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4659         new incremental info sections.
4660         (Sized_incremental_binary::do_check_inputs): Likewise.
4661         (Incremental_inputs::report_archive): Remove.
4662         (Incremental_inputs::report_archive_begin): New function.
4663         (Incremental_inputs::report_archive_end): New function.
4664         (Incremental_inputs::report_object): New function.
4665         (Incremental_inputs::finalize_inputs): Remove.
4666         (Incremental_inputs::report_input_section): New function.
4667         (Incremental_inputs::report_script): Rewrite.
4668         (Incremental_inputs::finalize): Do nothing but finalize string table.
4669         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4670         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4671         (Incremental_inputs::create_data_sections): New function.
4672         (Incremental_inputs::relocs_entsize): New function.
4673         (Output_section_incremental_inputs::set_final_data_size): New function.
4674         (Output_section_incremental_inputs::do_write): New function.
4675         (Output_section_incremental_inputs::write_header): New function.
4676         (Output_section_incremental_inputs::write_input_files): New function.
4677         (Output_section_incremental_inputs::write_info_blocks): New function.
4678         (Output_section_incremental_inputs::write_symtab): New function.
4679         * incremental.h (Incremental_script_entry): Forward declaration.
4680         (Incremental_object_entry): Forward declaration.
4681         (Incremental_archive_entry): Forward declaration.
4682         (Incremental_inputs): Forward declaration.
4683         (Incremental_inputs_header_data): Remove.
4684         (Incremental_inputs_header): Remove.
4685         (Incremental_inputs_header_write): Remove.
4686         (Incremental_inputs_entry_data): Remove.
4687         (Incremental_inputs_entry): Remove.
4688         (Incremental_inputs_entry_write): Remove.
4689         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4690         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4691         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4692         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4693         Likewise.
4694         (Incremental_input_entry): New class.
4695         (Incremental_script_entry): New class.
4696         (Incremental_object_entry): New class.
4697         (Incremental_archive_entry): New class.
4698         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4699         (Incremental_inputs::report_inputs): Remove.
4700         (Incremental_inputs::report_archive): Remove.
4701         (Incremental_inputs::report_archive_begin): New function.
4702         (Incremental_inputs::report_archive_end): New function.
4703         (Incremental_inputs::report_object): Change prototype.
4704         (Incremental_inputs::report_input_section): New function.
4705         (Incremental_inputs::report_script): Change prototype.
4706         (Incremental_inputs::get_reloc_count): New function.
4707         (Incremental_inputs::set_reloc_count): New function.
4708         (Incremental_inputs::create_data_sections): New function.
4709         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4710         (Incremental_inputs::inputs_section): New function.
4711         (Incremental_inputs::symtab_section): New function.
4712         (Incremental_inputs::relocs_section): New function.
4713         (Incremental_inputs::get_stringpool): Add const.
4714         (Incremental_inputs::command_line): Add const.
4715         (Incremental_inputs::inputs): Remove.
4716         (Incremental_inputs::command_line_key): New function.
4717         (Incremental_inputs::input_file_count): New function.
4718         (Incremental_inputs::input_files): New function.
4719         (Incremental_inputs::relocs_entsize): New function.
4720         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4721         (Incremental_inputs::finalize_inputs): Remove.
4722         (Incremental_inputs::Input_info): Remove.
4723         (Incremental_inputs::lock_): Remove.
4724         (Incremental_inputs::inputs_): Change type.
4725         (Incremental_inputs::inputs_map_): Remove.
4726         (Incremental_inputs::current_object_entry_): New data member.
4727         (Incremental_inputs::inputs_section_): New data member.
4728         (Incremental_inputs::symtab_section_): New data member.
4729         (Incremental_inputs::relocs_section_): New data member.
4730         (Incremental_inputs::reloc_count_): New data member.
4731         (Incremental_inputs_reader): New class.
4732         (Incremental_symtab_reader): New class.
4733         (Incremental_relocs_reader): New class.
4734         * layout.cc (Layout::finalize): Move finalization of incremental info
4735         and creation of incremental info sections to follow finalization of
4736         symbol table.  Set offsets for postprocessing sections.
4737         (Layout::create_incremental_info_sections): Call
4738         Incremental_inputs::create_data_sections.  Add incremental symtab
4739         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4740         sections to layout after input sections.
4741         * layout.h (struct Timespec): Forward declaration.
4742         (Layout::incremental_inputs): Add const.
4743         (Layout::create_incremental_info_sections): Add parameter.
4744         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4745         * object.cc: Include incremental.h.
4746         (Relobj::finalize_incremental_relocs): New function.
4747         (Sized_relobj::do_layout): Record input sections in incremental info.
4748         * object.h (Object::output_section): New function.
4749         (Object::output_section_offset): Moved from Relobj.
4750         (Object::get_incremental_reloc_base): New function.
4751         (Object::get_incremental_reloc_count): New function.
4752         (Object::do_output_section): New function.
4753         (Object::do_output_section_offset): Moved from Relobj.
4754         (Object::do_get_incremental_reloc_base): New function.
4755         (Object::do_get_incremental_reloc_count): New function.
4756         (Object::Object): Initialize new data members.
4757         (Relobj::output_section): Renamed do_output_section and moved to
4758         protected.
4759         (Relobj::output_section_offset): Moved to Object.
4760         (Relobj::do_get_incremental_reloc_base): New function.
4761         (Relobj::do_get_incremental_reloc_count): New function.
4762         (Relobj::allocate_incremental_reloc_counts): New function.
4763         (Relobj::count_incremental_reloc): New function.
4764         (Relobj::finalize_incremental_relocs): New function.
4765         (Relobj::next_incremental_reloc_index): New function.
4766         (Relobj::reloc_counts_): New data member.
4767         (Relobj::reloc_bases_): New data member.
4768         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4769         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4770         (Sized_relobj::incremental_relocs_scan): New function.
4771         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4772         (Sized_relobj::incremental_relocs_write): New function.
4773         (Sized_relobj::incremental_relocs_write_reltype): New function.
4774         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4775         incremental link.
4776         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4777         archives and object files elsewhere.
4778         (Add_symbols::run): Report object files here.
4779         (Finish_group::run): Report end of archive at end of group.
4780         * reloc.cc: Include layout.h, incremental.h.
4781         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4782         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4783         (Sized_relobj::incremental_relocs_scan): New function.
4784         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4785         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4786         (Sized_relobj::incremental_relocs_write): New function.
4787         (Sized_relobj::incremental_relocs_write_reltype): New function.
4788         * script.cc (read_input_script): Rewrite test for incremental link.
4789         Change call to Incremental_inputs::report_script.
4790         * symtab.h (Symbol_table::first_global_index): New function.
4791         (Symbol_table::output_count): New function.
4792
4793 2010-08-12  Doug Kwan  <dougkwan@google.com>
4794
4795         * arm.cc (Target_arm::merge_object_attributes): Check command line
4796         options --no-wchar-size-warning and --no-enum-size-warning.
4797         * options.h (General_options): Add ld-compatible options
4798         --no-enum-size-warning and --no-wchar-size-warning.
4799
4800 2010-08-04  Ian Lance Taylor  <iant@google.com>
4801
4802         * x86_64.cc (Target_x86_64::Scan::local): Use
4803         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4804         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4805         (Target_x86_64::Scan::global): Likewise.
4806         (Target_x86_64::Relocate::relocate): Likewise.
4807         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4808         Likewise.
4809
4810 2010-08-03  Cary Coutant  <ccoutant@google.com>
4811
4812         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4813         to reserve space in merged_strings vector. Keep total input size
4814         for stats.
4815         (Output_merge_string::do_print_merge_stats): Print total input size.
4816         * merge.h (Output_merge_string): Add input_size_ field.
4817         * stringpool.cc (Stringpool_template::string_length): Move
4818         implementations out of Stringpool_template class and place in
4819         stringpool.h.
4820         * stringpool.h (string_length): Move out of Stringpool_template.
4821
4822 2010-08-03  Ian Lance Taylor  <iant@google.com>
4823
4824         PR 11712
4825         * layout.cc (relaxation_loop_body): If address of load segment is
4826         set, adjust address to include headers if possible.
4827
4828 2010-08-03  Ian Lance Taylor  <iant@google.com>
4829
4830         * version.cc (version_string): Bump to 1.10.
4831
4832 2010-08-03  Ian Lance Taylor  <iant@google.com>
4833
4834         PR 11805
4835         * layout.h (enum Output_section_order): Define.
4836         (class Layout): Update declarations.
4837         * layout.cc (Layout::get_output_section): Add order parameter.
4838         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4839         is_first_non_relro parameters.  Change all callers.
4840         (Layout::choose_output_section): Likewise.
4841         (Layout::add_output_section_data): Likewise.
4842         (Layout::make_output_section): Likewise.  Set order.
4843         (Layout::default_section_order): New function.
4844         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4845         * output.cc (Output_section::Output_section): Initialize order_.
4846         Don't initialize deleted fields.
4847         (Output_segment::Output_segment): Don't initialize deleted
4848         fields.
4849         (Output_segment::add_output_section_to_load): New function
4850         replacing add_output_section.  Change all callers to call this or
4851         add_output_section_to_nonload.
4852         (Output_segment::add_output_section_to_nonload): New function.
4853         (Output_segment::remove_output_section): Rewrite.
4854         (Output_segment::add_initial_output_data): Likewise.
4855         (Output_segment::has_any_data_sections): Likewise.
4856         (Output_segment::is_first_section_relro): Likewise.
4857         (Output_segment::maximum_alignment): Likewise.
4858         (Output_segment::has_dynamic_reloc): New function replacing
4859         dynamic_reloc_count.  Change all callers.
4860         (Output_segment::has_dynamic_reloc_list): New function replacing
4861         dynamic_reloc_count_list.  Change all callers.
4862         (Output_segment::set_section_addresses): Rewrite.
4863         (Output_segment::set_offset): Rewrite.
4864         (Output_segment::find_first_and_last_list): Remove.
4865         (Output_segment::set_tls_offsets): Rewrite.
4866         (Output_segment::first_section_load_address): Likewise.
4867         (Output_segment::output_section_count): Likewise.
4868         (Output_segment::section_with_lowest_load_address): Likewise.
4869         (Output_segment::write_section_headers): Likewise.
4870         (Output_segment::print_sections_to_map): Likewise.
4871         * output.h (class Output_data): Remove dynamic_reloc_count_
4872         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4873         (Output_data::add_dynamic_reloc): Rewrite.
4874         (Output_data::has_dynamic_reloc): New function.
4875         (Output_data::dynamic_reloc_count): Remove.
4876         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4877         is_last_relro_, is_first_non_relro_, is_interp_,
4878         is_dynamic_linker_section_ fields.  Add order and set_order
4879         functions.  Remove is_relro_local, set_is_relro_local,
4880         is_last_relro, set_is_last_relro, is_first_non_relro,
4881         set_is_first_non_relro functions, is_interp, set_is_interp,
4882         is_dynamic_linker_section, and set_is_dynamic_linker_section
4883         functions.
4884         (class Output_segment): Change Output_data_list from std::list to
4885         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4886         output_bss_ fields.  Update declarations.
4887
4888 2010-08-02  Ian Lance Taylor  <iant@google.com>
4889
4890         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4891         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4892         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4893
4894 2010-08-02  Ian Lance Taylor  <iant@google.com>
4895
4896         PR 11855
4897         * script.cc (Script_options::Script_options): Initialize
4898         symbol_definitions_ and symbol_references_.
4899         (Script_options::add_symbol_assignment): Update
4900         symbol_definitions_ and symbol_references_.
4901         (Script_options::add_symbol_reference): New function.
4902         (script_symbol): New function.
4903         * script.h (class Script_options): Add symbol_definitions_ and
4904         symbol_references_ fields.
4905         (Script_options::referenced_const_iterator): New type.
4906         (Script_options::referenced_begin): New function.
4907         (Script_options::referenced_end): New function.
4908         (Script_options::is_referenced): New function.
4909         (Script_options::any_unreferenced): New function.
4910         * script-c.h (script_symbol): Declare.
4911         * yyscript.y (exp): Call script_symbol.
4912         * symtab.cc: Include "script.h".
4913         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4914         Change all callers.  Check symbols referenced by scripts.
4915         (Symbol_table::add_undefined_symbols_from_command_line): Add
4916         layout parameter.  Change all callers.
4917         (Symbol_table::do_add_undefined_symbols_from_command_line):
4918         Likewise.  Break out loop body.  Check symbols referenced by
4919         scripts.
4920         (Symbol_table::add_undefined_symbol_from_command_line): New
4921         function broken out of
4922         do_add_undefined_symbols_from_command_line.
4923         * symtab.h (class Symbol_table): Update declarations.
4924         * archive.cc: Include "layout.h".
4925         (Archive::should_include_member): Add layout parameter.  Change
4926         all callers.  Check for symbol mentioned in expression.
4927         * archive.h (class Archive): Update declaration.
4928         * object.cc (Sized_relobj::do_should_include_member): Add layout
4929         parameter.
4930         * object.h (Object::should_include_member): Add layout parameter.
4931         Change all callers.
4932         (Object::do_should_include_member): Add layout parameter.
4933         (class Sized_relobj): Update declaration.
4934         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4935         parameter.
4936         * dynobj.h (class Sized_dynobj): Update declaration.
4937         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4938         layout parameter.
4939         * plugin.h (class Sized_pluginobj): Update declaration.
4940
4941 2010-08-02  Ian Lance Taylor  <iant@google.com>
4942
4943         PR 11866
4944         * output.cc (Output_segment::set_offset): Search for the first and
4945         last sections rather than assuming that the list is in order.
4946         (Output_segment::find_first_and_last_list): New function.
4947         * output.h (class Output_segment): Update declarations.
4948         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4949         (relro_strip_test_SOURCES): New variable.
4950         (relro_strip_test_DEPENDENCIES): New variable.
4951         (relro_strip_test_LDFLAGS): New variable.
4952         (relro_strip_test_LDADD): New variable.
4953         (relro_strip_test.so): New target.
4954
4955 2010-08-02  Ian Lance Taylor  <iant@google.com>
4956
4957         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4958         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4959         (Target_i386::got_tlsdesc_section): New function.
4960         (Target_i386::got_section): Create space for GOT entries for
4961         TLSDESC relocations.
4962         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4963         R_386_TLS_GOTDESC.
4964         (Target_i386::Scan::global): Likewise.
4965         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4966         using TLSDESC GOT.
4967         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4968         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4969         (Target_x86_64::got_tlsdesc_section): New function.
4970         (Target_x86_64::got_section): Create space for GOT entries for
4971         TLSDESC relocations.
4972         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4973         R_386_TLS_GOTDESC.
4974         (Target_x86_64::Scan::global): Likewise.
4975         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4976         using TLSDESC GOT.
4977
4978 2010-08-02  Ian Lance Taylor  <iant@google.com>
4979
4980         * testsuite/final_layout.sh: Use dc to convert from hex to
4981         decimal.
4982
4983 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4984
4985         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4986         paramter to the call to gold::gc_process_relocs.
4987         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4988         paramter to the call to gold::gc_process_relocs.
4989         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4990         parameter to the call to gold::gc_process_relocs.
4991         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4992         template parameter to the call to gold::gc_process_relocs.
4993         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4994         paramter to the call to gold::gc_process_relocs.
4995         * gc.h (get_embedded_addend_size): New function.
4996         (gc_process_relocs): Save the size of the reloc for use by ICF.
4997         * icf.cc (get_section_contents): Get the addend from the text section
4998         for SHT_REL relocation sections.
4999         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5000         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5001         * int_encoding.h (read_from_pointer): New overloaded function.
5002         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5003         * testsuite/icf_sht_rel_addend_test.sh: New file.
5004         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5005         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5006
5007 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5008
5009         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5010         * Makefile.in: Regenerate.
5011         * testsuite/Makefile.in: Regenerate.
5012
5013 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5014
5015         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5016         * gold/testsuite/debug_msg.cc: Likewise.
5017         * gold/testsuite/odr_violation1.cc
5018         * gold/testsuite/odr_violation2.cc
5019
5020 2010-07-21  Cary Coutant  <ccoutant@google.com>
5021
5022         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5023         string, and length fields.
5024         (Output_merge_string::Merged_strings_list): New type.
5025         (Output_merge_string::Merged_strings_lists): New typedef.
5026         (Output_merge_string): Replace merged_strings_ with
5027         merged_strings_lists_.
5028         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5029         Merged_strings_list per input object and section.  Don't store pointer
5030         to the string.  Don't store length with each merged string entry.
5031         (Output_merge_string::finalize_merged_data): Loop over list of merged
5032         strings lists.  Recompute length of each merged string.
5033
5034 2010-07-15  Cary Coutant  <ccoutant@google.com>
5035
5036         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5037         here.
5038
5039 2010-07-14  Ian Lance Taylor  <iant@google.com>
5040
5041         * descriptors.cc (Descriptors::open): Report correct name in error
5042         message.
5043
5044 2010-07-13  Doug Kwan  <dougkwan@google.com>
5045
5046         * arm.cc (Arm_input_section::Arm_input_section): For a
5047         SHT_ARM_EXIDX section, always keeps the input sections.
5048         (Arm_input_section::set_exidx_section_link): New method.
5049         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5050         has_errors_ to false.
5051         (Arm_exidx_input_section::has_errors,
5052         Arm_exidx_input_section::set_has_errors): New methods.
5053         (Arm_exidx_input_section::has_errors_): New data member.
5054         (Arm_relobj::get_exidx_shndx_list): New method.
5055         (Arm_output_section::append_text_sections_to_list): Do not skip
5056         section without SHF_EXECINSTR.
5057         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5058         errors.
5059         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5060         section header.  Make error messages more verbose.  Check for
5061         a non-executable section linked to an EXIDX section.
5062         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5063         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5064         check that there is no deferred EXIDX section if we exit early.
5065         Instead of not making an EXIDX section in case of an error, make one
5066         and set the has_errors flag of it.
5067         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5068         in a relocatable link.
5069         (Target_arm::do_relax): Look for the EXIDX output section instead of
5070         assuming that it is called .ARM.exidx.
5071         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5072         section list.  Do not check for SHF_EXECINSTR section flags but
5073         skip any input section with errors.
5074         * output.cc (Output_section::Output_section): Initialize
5075         always_keeps_input_sections_ to false.
5076         (Output_section::add_input_section): Check for
5077         always_keeps_input_sections_.
5078         *  output.h (Output_section::always_keeps_input_sections,
5079         Output_section::set_always_keeps_input_sections): New methods.
5080         (Output_section::always_keeps_input_sections): New data member.
5081
5082 2010-07-13  Rafael Espindola  <espindola@google.com>
5083
5084         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5085         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5086
5087 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5088             Ian Lance Taylor  <iant@google.com>
5089
5090         * output.h (Output_section_lookup_maps::add_merge_section):
5091         Correct check of whether value was inserted.
5092         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5093         (Output_section_lookup_maps::add_relaxed_input_section):
5094         Likewise.
5095         * arm.cc (Target_arm::got_section): Remove used local os.
5096         * i386.cc (Target_i386::got_section): Likewise.
5097         * x86_64.cc (Target_x86_64::got_section): Likewise.
5098         * sparc.cc (Target_sparc::got_section): Likewise.
5099         (Target_sparc::relocate): Remove unused local have_got_offset.
5100         * powerpc.cc (Target_powerpc::relocate): Likewise.
5101
5102 2010-07-13  Ian Lance Taylor  <iant@google.com>
5103
5104         * compressed_output.cc (zlib_decompress): Fix signature in
5105         !HAVE_ZLIB_H case.
5106
5107         * archive.cc (Archive::include_member): Unlock an external member
5108         of a thin archive.  Don't bother to delete an object we know is
5109         NULL.
5110
5111 2010-07-12  Cary Coutant  <ccoutant@google.com>
5112
5113         * compressed_output.cc (zlib_decompress): New function.
5114         (get_uncompressed_size): New function.
5115         (decompress_input_section): New function.
5116         * compressed_output.h (get_uncompressed_size): New function.
5117         (decompress_input_section): New function.
5118         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5119         Handle compressed debug sections.
5120         * layout.cc (is_compressed_debug_section): New function.
5121         (Layout::output_section_name): Map compressed section names to
5122         canonical names.
5123         * layout.h (is_compressed_debug_section): New function.
5124         (is_debug_info_section): Recognize compressed debug sections.
5125         * merge.cc: Include compressed_output.h.
5126         (Output_merge_data::do_add_input_section): Handle compressed
5127         debug sections.
5128         (Output_merge_string::do_add_input_section): Handle compressed
5129         debug sections.
5130         * object.cc: Include compressed_output.h.
5131         (Sized_relobj::Sized_relobj): Initialize new data members.
5132         (build_compressed_section_map): New function.
5133         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5134         * object.h (Object::section_is_compressed): New method.
5135         (Object::do_section_is_compressed): New method.
5136         (Sized_relobj::Compressed_section_map): New type.
5137         (Sized_relobj::do_section_is_compressed): New method.
5138         (Sized_relobj::compressed_sections_): New data member.
5139         * output.cc (Output_section::add_input_section): Handle compressed
5140         debug sections.
5141         * reloc.cc: Include compressed_output.h.
5142         (Sized_relobj::write_sections): Handle compressed debug sections.
5143
5144 2010-07-08  Cary Coutant  <ccoutant@google.com>
5145
5146         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5147         weak when resolving to a dynamic def.
5148         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5149         for weak undef/dynamic def cases. Adjust callers.
5150         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5151         undef_binding_weak_.
5152         (Symbol_table::sized_write_globals): Adjust symbol binding.
5153         (Symbol_table::sized_write_symbol): Add binding parameter.
5154         * symtab.h (Symbol::set_undef_binding): New method.
5155         (Symbol::is_undef_binding_weak): New method.
5156         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5157         (Symbol_table::should_override): Add new parameter.
5158         (Symbol_table::sized_write_symbol): Add new parameter.
5159
5160         * testsuite/weak_undef_file1.cc: Add new test case.
5161         * testsuite/weak_undef_file2.cc: Fix header comment.
5162         * testsuite/weak_undef_test.cc: Add new test case.
5163
5164 2010-06-29  Doug Kwan  <dougkwan@google.com>
5165
5166         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5167         Initialize USE_SYMBOL_.
5168         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5169         definition.
5170         (Arm_reloc_property::uses_symbol_): New data member declaration.
5171         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5172         uses symbol value and symbol is undefined but not weakly undefined.
5173
5174 2010-06-28  Rafael Espindola  <espindola@google.com>
5175
5176         * plugin.cc (Plugin::load): Use dlerror.
5177
5178 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5179
5180         * symtab.cc (detect_odr_violations): When reporting an ODR
5181         violation, report an object where the symbol is defined.
5182
5183 2010-06-25  Doug Kwan  <dougkwan@google.com>
5184
5185         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5186         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5187         definition.
5188         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5189         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5190         target hook to detect function points.
5191         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5192         * icf.h (Icf::check_section_for_function_pointers): Change type of
5193         parameter SECTION_NAME to const reference to std::string.  Use
5194         target hook to determine if section may have unsafe pointers.
5195         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5196         method definition.
5197
5198 2010-06-21  Rafael Espindola  <espindola@google.com>
5199
5200         * fileread.cc (Input_file::find_fie): New
5201         (Input_file::open): Use Input_file::find_fie.
5202         * fileread.h (Input_file::find_fie): New
5203         * plugin.cc (set_extra_library_path): New.
5204         (Plugin::load): Add set_extra_library_path to the transfer vector.
5205         (Plugin_manager::set_extra_library_path): New.
5206         (Plugin_manager::add_input_file): Use the extra search path if set.
5207         (set_extra_library_path(): New.
5208         * plugin.h (Plugin_manager): Add set_extra_library_path and
5209         extra_search_path_.
5210
5211 2010-06-19  Cary Coutant  <ccoutant@google.com>
5212
5213         * layout.cc (gdb_sections): Add .debug_types.
5214         (lines_only_debug_sections): Likewise.
5215
5216 2010-06-18  Rafael Espindola  <espindola@google.com>
5217
5218         * plugin.cc (add_input_file,add_input_library)
5219         (Plugin_manager::add_input_file): Make filename arguments const.
5220         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5221         const.
5222
5223 2010-06-16  Doug Kwan  <dougkwan@google.com>
5224
5225         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5226         .ARM.attributes section if we have not merged any input
5227         attributes sections.
5228
5229 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5230
5231         * arm.cc: Allow combining objects with no EABI version
5232         information.
5233
5234 2010-06-15  Rafael Espindola  <espindola@google.com>
5235
5236         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5237
5238 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5239
5240         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5241         (struct iovec): Correct !HAVE_READV definition.
5242
5243 2010-06-10  Cary Coutant  <ccoutant@google.com>
5244
5245         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5246         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5247         reloc sections.
5248         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5249
5250         PR 11683
5251         * symtab.h (Symbol::is_placeholder): New member function.
5252         * target-reloc.h (relocate_section): Check for placeholder symbols.
5253
5254         * testsuite/Makefile.am (plugin_test_8): New test.
5255         (plugin_test_9): New test.
5256         * testsuite/Makefile.in: Regenerate.
5257
5258 2010-06-09  Nick Clifton  <nickc@redhat.com>
5259
5260         * yyscript.y (input_list_element): Allow strings prefixed with
5261         the '-' character.  Treat these as libraries.
5262         * script.cc (script_add_library): New function.  Adds a library
5263         specified by "-l<name>" found in an input script.
5264         * script-c.h: Add prototype for script_add_library.
5265
5266 2010-06-07  Doug Kwan  <dougkwan@google.com>
5267
5268         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5269         Restrict stub-group size to be within long conditional branch
5270         range when working around cortex-A8 erratum.
5271
5272 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5273
5274         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5275         #ifdef typo.
5276
5277 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5278
5279         PR gold/11658
5280         * output.cc
5281         (Output_section::Input_section_sort_entry::compare_section_ordering):
5282         Change to return non-zero correctly.
5283         (Output_section::Input_section_sort_section_order_index_compare
5284         ::operator()): Change to fix ambiguity in comparisons.
5285
5286 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5287
5288         * gold.h (is_wildcard_string): New function.
5289         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5290         (Layout::layout_eh_frame): Ditto.
5291         (Layout::find_section_order_index): New method.
5292         (Layout::read_layout_from_file): New method.
5293         * layout.h (Layout::find_section_order_index): New method.
5294         (Layout::read_layout_from_file): New method.
5295         (Layout::input_section_position_): New private member.
5296         (Layout::input_section_glob_): New private member.
5297         * main.cc (main): Call read_layout_from_file here.
5298         * options.h (--section-ordering-file): New option.
5299         * output.cc (Output_section::input_section_order_specified_): New
5300         member.
5301         (Output_section::Output_section): Initialize new member.
5302         (Output_section::add_input_section): Add new parameter.
5303         Keep input sections when --section-ordering-file is used.
5304         (Output_section::set_final_data_size): Sort input sections when
5305         section ordering file is specified.
5306         (Output_section::Input_section_sort_entry): Add new parameter.
5307         Check sorting type.
5308         (Output_section::Input_section_sort_entry::compare_section_ordering):
5309         New method.
5310         (Output_section::Input_section_sort_compare::operator()): Change to
5311         consider section_order_index.
5312         (Output_section::Input_section_sort_init_fini_compare::operator()):
5313         Change to consider section_order_index.
5314         (Output_section::Input_section_sort_section_order_index_compare
5315         ::operator()): New method.
5316         (Output_section::sort_attached_input_sections): Change to sort
5317         according to section order when specified.
5318         (Output_section::add_input_section<32, true>): Add new parameter.
5319         (Output_section::add_input_section<64, true>): Add new parameter.
5320         (Output_section::add_input_section<32, false>): Add new parameter.
5321         (Output_section::add_input_section<64, false>): Add new parameter.
5322         * output.h (Output_section::add_input_section): Add new parameter.
5323         (Output_section::input_section_order_specified): New
5324         method.
5325         (Output_section::set_input_section_order_specified): New method.
5326         (Input_section::Input_section): Initialize section_order_index_.
5327         (Input_section::section_order_index): New method.
5328         (Input_section::set_section_order_index): New method.
5329         (Input_section::section_order_index_): New member.
5330         (Input_section::Input_section_sort_section_order_index_compare): New
5331         struct.
5332         (Output_section::input_section_order_specified_): New member.
5333         * script-sections.cc (is_wildcard_string): Delete and move modified
5334         method to gold.h.
5335         (Output_section_element_input::Output_section_element_input): Modify
5336         call to is_wildcard_string.
5337         (Output_section_element_input::Input_section_pattern
5338         ::Input_section_pattern): Ditto.
5339         (Output_section_element_input::Output_section_element_input): Ditto.
5340         * testsuite/Makefile.am (final_layout): New test case.
5341         * testsuite/Makefile.in: Regenerate.
5342         * testsuite/final_layout.cc: New file.
5343         * testsuite/final_layout.sh: New file.
5344
5345 2010-06-01  Rafael Espindola  <espindola@google.com>
5346
5347         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5348
5349 2010-06-01  Rafael Espindola  <espindola@google.com>
5350
5351         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5352         visibility of symbols.
5353
5354 2010-05-27  Doug Kwan  <dougkwan@google.com>
5355
5356         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5357         from start of output section instead of address for a local symbol
5358         in a merged or relaxed section when doing a relocatable link.
5359
5360 2010-05-26  Rafael Espindola  <espindola@google.com>
5361
5362        PR 11604
5363         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5364         adding sections the garbage collector removed.
5365         * gold/testsuite/Makefile.am: Add test.
5366         * gold/testsuite/Makefile.in: Regenerate.
5367         * gold/testsuite/plugin_test_7.sh: New.
5368         * gold/testsuite/plugin_test_7_1.c: New.
5369         * gold/testsuite/plugin_test_7_2.c: New.
5370
5371 2010-05-26  Rafael Espindola  <espindola@google.com>
5372
5373         * script-sections.cc (Output_section_definition::set_section_addresses):
5374         Check for --section-start.
5375
5376 2010-05-26  Doug Kwan  <dougkwan@google.com>
5377
5378         * arm.cc (Arm_scan_relocatable_relocs): New class.
5379         (Target_arm::relocate_special_relocatable): New method.
5380         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5381         (Arm_relocate_functions::thumb_branch_common): Same.
5382         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5383         instead of Default_scan_relocatable_relocs.
5384         * target-reloc.h (relocate_for_relocatable): Let target handle
5385         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5386         * target.h (Sized_target::relocate_special_relocatable): New method.
5387
5388 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5389
5390         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5391
5392 2010-05-23  Doug Kwan  <dougkwan@google.com>
5393
5394         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5395         instead of a cast.
5396         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5397         with a direct branch, not a conditional branch, to a stub.
5398         * merge.cc (Output_merge_base::record_input_section): New method
5399         defintion.
5400         (Output_merge_data::do_add_input_section): Record input section if
5401         keeps-input-sections flag is set.
5402         (Output_merge_string::do_add_input_section): Ditto.
5403         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5404         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5405         INPUT_SECTIONS_.
5406         (Output_merge_base::keeps_input_sections,
5407         Output_merge_base::set_keeps_input_sections,
5408         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5409         method definitions.
5410         (Output_merge_base::Input_sections): New type declaration.
5411         (Output_merge_base::input_sections_begin,
5412         Output_merge_base::input_sections_end,
5413         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5414         (Output_merge_base::bool keeps_input_sections_,
5415         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5416         Output_merge_base::input_sections_): New data members.
5417         (Output_merge_data::do_set_keeps_input_sections): New method
5418         defintion.
5419         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5420         * output.cc (Output_section::Input_section::relobj): Move method
5421         defintion from class declaration to here and handle merge sections.
5422         (Output_section::Input_section::shndx): Ditto.
5423         (Output_section::Output_section): Remove initializations of removed
5424         data members and initialize new data member LOOKUP_MAPS_.
5425         (Output_section::add_input_section): Set keeps-input-sections flag
5426         for a newly created merge output section as appropriate.  Adjust code
5427         to use Output_section_lookup_maps class.
5428         (Output_section::add_relaxed_input_section): Adjst code for lookup
5429         maps code refactoring.
5430         (Output_section::add_merge_input_section): Add a new parameter
5431         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5432         class.  If adding input section to a newly created merge output
5433         section fails, remove the new merge section.
5434         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5435         Adjust code for use of the Output_section_lookup_maps class.
5436         (Output_section::find_merge_section): Ditto.
5437         (Output_section::build_lookup_maps): New method defintion.
5438         (Output_section::find_relaxed_input_section): Adjust code to use
5439         Output_section_lookup_maps class.
5440         (Output_section::get_input_sections): Export merge sections.  Adjust
5441         code to use Output_section_lookup_maps class.
5442         (Output_section:::add_script_input_section): Adjust code to use
5443         Output_section_lookup_maps class.  Update lookup maps for merge
5444         sections also.
5445         (Output_section::discard_states): Use Output_section_lookup_maps.
5446         (Output_section::restore_states): Same.
5447         * output.h (Merge_section_properties): Move class defintion out of
5448         Output_section.
5449         (Output_section_lookup_maps): New class.
5450         (Output_section::Input_section::is_merge_section): New method
5451         defintion.
5452         (Output_section::Input_section::relobj): Move defintion out of class
5453         defintion.  Declare method only.
5454         (Output_section::Input_section::shndx): Ditto.
5455         (Output_section::Input_section::output_merge_base): New method defintion.
5456         (Output_section::Input_section::u2_.pomb): New union field.
5457         (Output_section::Merge_section_by_properties_map,
5458         Output_section::Output_section_data_by_input_section_map,
5459         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5460         Remove types.
5461         (Output_section::add_merge_input_section): Add new parameter
5462         KEEPS_INPUT_SECTIONS.
5463         (Output_section::build_lookup_maps): New method declaration.
5464         (Output_section::merge_section_map_,
5465         Output_section::merge_section_by_properties_map_,
5466         Output_section::relaxed_input_section_map_,
5467         Output_section::is_relaxed_input_section_map_valid_): Remove data
5468         members.
5469         (Output_section::lookup_maps_): New data member.
5470
5471 2010-05-21  Doug Kwan  <dougkwan@google.com>
5472
5473         PR gold/11619
5474         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5475         avoid a compilation error.
5476
5477 2010-05-19  Rafael Espindola  <espindola@google.com>
5478
5479         * script-sections.cc (Output_section_definition::allocate_to_segment):
5480         Update the phdrs_list even when the output section is NULL.
5481         * testsuite/Makefile.am: Add test.
5482         * testsuite/Makefile.in: Regenerate.
5483         * testsuite/script_test_9.cc: New.
5484         * testsuite/script_test_9.sh: New.
5485         * testsuite/script_test_9.t: New.
5486
5487 2010-05-19  Doug Kwan  <dougkwan@google.com>
5488
5489         * arm.cc (Arm_input_section::original_size): New method.
5490         (Arm_input_section::do_addralign): Add a cast.
5491         (Arm_input_section::do_output_offset): Remove static cast.
5492         (Arm_input_section::original_addralign,
5493          Arm_input_section::original_size_): Change type to uint32_t.
5494         (Arm_input_section::init): Add safe casts for section alignment
5495         and size.
5496         (Arm_input_section::set_final_data_size): Do not set address and
5497         offset of stub table.
5498         (Arm_output_section::fix_exidx_coverage): Change use of of
5499         Output_section::Simple_input_section to that of
5500         Output_section::Input_section.
5501         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5502         except for the first pass.
5503         * output.cc (Output_section::get_input_sections): Change type of
5504         input_sections to std::list<Input_section>.
5505         (Output_section::add_script_input_section): Rename from
5506         Output_section::add_simple_input_section.  Change type of SIS
5507         parameter from Simple_input_section to Input_section.
5508         * output.h (Output_section::Simple_input_section): Remove class.
5509         (Output_section::Input_section): Change class visibility to public.
5510         (Output_section::Input_section::addralign): Use stored alignments
5511         for special input sections if set.
5512         (Output_section::Input_section::set_addralign): New method.
5513         (Output_section::get_input_sections): Change parameter type from
5514         list of Simple_input_section to list of Input_section.
5515         (Output_section::add_script_input_section): Rename from
5516         Output_section::add_simple_input_section. Change first parameter's
5517         type from Simple_input_section to Input_section and remove the
5518         second and third parameters.
5519         * script-sections.cc (Input_section::Input_section_list): Change
5520         type to list of Output_section::Input_section/
5521         (Input_section_info::Input_section_info): Change parameter type of
5522         INPUT_SECTION to Output_section::Input_section.
5523         (Input_section_info::input_section): Change return type.
5524         (Input_section_info::input_section_): Change type to
5525         Output_section::Input_section.
5526         (Output_section_element_input::set_section_addresses): Adjust code
5527         to use Output_section::Input_section instead of
5528         Output_section::Simple_input_section.  Adjust code for renaming
5529         of Output_section::add_simple_input_section.
5530         (Orphan_output_section::set_section_addresses): Ditto.
5531
5532 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5533
5534         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5535         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5536
5537 2010-05-18  Rafael Espindola  <espindola@google.com>
5538
5539         * options.cc (General_options::finalize): Handle -nostdlib.
5540         * options.h (nostdlib): New option.
5541         * script.cc (script_add_search_dir): Handle -nostdlib.
5542
5543 2010-05-12  Doug Kwan  <dougkwan@google.com>
5544
5545         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5546         attributes section only if there no attributes section after merging.
5547         (Target_arm::merge_object_attributes): Move value of
5548         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5549         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5550         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5551         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5552         and arm_attr_merge_7.stdout.
5553         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5554         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5555         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5556         arm_attr_merge_7b.o): New rules.
5557         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5558         arm_attr_merge_7
5559         * testsuite/Makefile.in: Regenerate.
5560         * testsuite/arm_attr_merge.sh: New file.
5561         * testsuite/arm_attr_merge_[67][ab].s: Same.
5562
5563 2010-05-05  Nick Clifton  <nickc@redhat.com>
5564
5565         * po/es.po: Updated Spanish translation.
5566
5567 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5568
5569         * Makefile.am (install-exec-local): Properly install gold as
5570         default cross linker.
5571         * Makefile.in: Regenerated.
5572
5573 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5574             Nick Clifton  <nickc@redhat.com>
5575
5576         * configure.ac (install_as_default): Define and set to false
5577         unless --enable-gold or --enable-gold=both/gold has been
5578         specified.
5579         * configure: Regenerate.
5580
5581         * Makefile.am (install-exec-local): Install the executable as
5582         'ld.gold'.  If install_as_default is true then also install it as
5583         'ld'.
5584         * Makefile.in: Regenerated.
5585
5586 2010-04-24  Ian Lance Taylor  <iant@google.com>
5587
5588         * layout.cc (Layout::layout_reloc): In relocatable link don't
5589         combine reloc sections for grouped sections.
5590
5591 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5592
5593         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5594         sections that are not ordinary to icf.
5595         * icf.cc (get_section_contents): Handle relocation pointing to section
5596         with no object or shndx information.
5597         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5598         * testsuite/Makefile.in: Regenerate.
5599         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5600         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5601
5602 2010-04-22  Ian Lance Taylor  <iant@google.com>
5603
5604         * expression.cc (Expression::Expression_eval_info): Add
5605         result_alignment_pointer field.
5606         (Expression::eval_with_dot): Add result_alignment_pointer
5607         parameter.  Change all callers.
5608         (Expression::eval_maybe_dot): Likewise.
5609         (class Binary_expression): Add alignment_pointer parameter to
5610         left_value and right_value.  Change all callers.
5611         (BINARY_EXPRESSION): Set result alignment.
5612         (class Trinary_expression): Add alignment_pointer parameter to
5613         arg2_value and arg3_value.  Change all callers.
5614         (Trinary_cond::value): Set result alignment.
5615         (Max_expression::value, Min_expression::value): Likewise.
5616         (Align_expression::value): Likewise.
5617         * script-sections.cc (class Sections_element): Add dot_alignment
5618         parameter to set_section_addresses virtual function.  Update
5619         instantiations.
5620         (class Output_section_element): Likewise.
5621         (Script_sections::create_segments): Add dot_alignment parameter.
5622         Change all callers.
5623         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5624         (Script_sections::set_phdrs_clause_addresses): Likewise.
5625         * script-sections.h: Update declarations.
5626         * script.h: Update declarations.
5627         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5628         min_p_align.
5629         * testsuite/script_test_3.t: Set large alignment.
5630         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5631         segment has expected alignment.
5632
5633 2010-04-22  Nick Clifton  <nickc@redhat.com>
5634
5635         * po/gold.pot: Updated by the Translation project.
5636         * po/vi.po: Updated Vietnamese translation.
5637
5638 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5639
5640         * testsuite/Makefile.am (check_PROGRAMS): Add
5641         icf_virtual_function_folding_test.
5642         * testsuite/Makefile.in: Regenerated.
5643
5644 2010-04-15  Andrew Haley  <aph@redhat.com>
5645
5646         * options.h (merge_exidx_entries): New option.
5647         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5648         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5649         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5650         (Target_arm::merge_exidx_entries): New function.
5651         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5652         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5653         to Arm_exidx_fixup constructor.
5654         Add new arg, merge_exidx_entries.
5655         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5656         Arm_output_section::fix_exidx_coverage.
5657
5658 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5659
5660         * icf.cc (get_section_contents): Check for preemptible functions.
5661         Ignore addend when appropriate.
5662         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5663         section folded.
5664         (add_from_relobj): Check for section folded.
5665         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5666         * symtab.h (should_add_dynsym_entry): Add new parameter.
5667         * target-reloc.h (scan_relocs): Check for section folded.
5668         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5669         Check reloc types for function pointers in shared objects.
5670         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5671         case.
5672         (icf_preemptible_functions_test): New test case.
5673         (icf_string_merge_test): New test case.
5674         * testsuite.Makefile.in: Regenerate.
5675         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5676         bar_glob.  Refactor code.
5677         * testsuite/icf_preemptible_functions_test.cc: New file.
5678         * testsuite/icf_preemptible_functions_test.sh: New file.
5679         * testsuite/icf_string_merge_test.cc: New file.
5680         * testsuite/icf_string_merge_test.sh: New file.
5681         * testsuite/icf_virtual_function_folding_test.cc: New file.
5682         * testsuite/icf_virtual_function_folding_test.sh: New file.
5683
5684 2010-04-14  Doug Kwan  <dougkwan@google.com>
5685
5686         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5687         for local symbol recounting if we remove a section due to ICF.
5688         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5689         there are no regular objects in input.
5690
5691 2010-04-13  Doug Kwan  <dougkwan@google.com>
5692
5693         * arm.cc (Arm_input_section::set_final_data_size): Compute
5694         accurate final data size instead of using current data size.
5695
5696 2010-04-09  Doug Kwan  <dougkwan@google.com>
5697
5698         * layout.cc (Layout::choose_output_section): Handle script section
5699         types.
5700         (Layout::make_output_section_for_script): Add section type parameter.
5701         Handle script section types.
5702         * layout.h (Layout::make_output_section_for_script): Add section
5703         type parameter.
5704         * output.cc (Output_section::Output_section): Initialize data member
5705         is_noload_.
5706         (Output_section::do_reset_address_and_file_offset): Do not set address
5707         to 0 if section is a NOLOAD section.
5708         * output.h (Output_section::is_noload): New method.
5709         (Output_section::set_is_noload): Ditto.
5710         (Output_section::is_noload_): New data member.
5711         * script-c.h (Script_section_type): New enum type.
5712         (struct Parser_output_section_header): Add new file section_type.
5713         * script-sections.cc (Sections_element::output_section_name): Add
5714         parameter for returning script section type.
5715         (Output_section_definition::output_section_name): Ditto.
5716         (Output_section_definition::section_type)P; New method.
5717         (Output_section_definiton::script_section_type_name): Ditto.
5718         (Output_section_definition::script_section_type_): New data member.
5719         (Output_section_definition::Output_section_definition): Initialize
5720         data member Output_section_definition::script_section_type_.
5721         (Output_section_definition::create_sections): Pass script section type
5722         to Layout::make_output_section_for_script.
5723         (Output_section_definition::output_section_name): Return script
5724         section type to caller.
5725         (Output_section_definition::set_section_address): Do not advance
5726         dot value and load address if section type is NOLOAD.  Set address
5727         of NOLOAD sections regardless of section flags.
5728         (Output_section_definition::print): Print section type if it is
5729         not SCRIPT_SECTION_TYPE_NONE.
5730         (Output_section_definition::section_type): New method.
5731         (Output_section_definition::script_section_type_name): Ditto.
5732         (Script_sections::output_section_name): Add new parameter
5733         PSECTION_TYPE for returning script section type.  Pass it to
5734         section elements.  Handle discard sections.
5735         (Sort_output_sections::operator()): Handle NOLOAD sections.
5736         * script-sections.h (Script_sections::Section_type): New enum type.
5737         (Script_sections::output_section_name): Add a new parameter for
5738         returning script section type.
5739         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5740         INFO and NOLOAD.
5741         * yyscript.y (union): Add new field SECTION_TYPE.
5742         (COPY, DSECT, INFO, NOLOAD): New tokens.
5743         (opt_address_and_section_type): Change type to output_section_header.
5744         (section_type): New non-terminal
5745         (section_header): Handle section type.
5746         (opt_address_and_section_type): Return section type value.
5747
5748 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5749
5750         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5751         * testsuite/plugin_common_test_2.c (foo): Likewise.
5752
5753 2010-04-08  Doug Kwan  <dougkwan@google.com>
5754
5755         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5756         Output_merge_data.
5757         * output.cc (Output_section::add_merge_input_section): Simplify
5758         code and return status of Output_merge_base::add_input_section.
5759         Update merge section map only if Output_merge_base::add_input_section
5760         returns true.
5761
5762 2010-04-07  Doug Kwan  <dougkwan@google.com>
5763
5764         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5765         if section is marked as containing instructions but has no mapping
5766         symbols.
5767         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5768         correct section index.
5769         (Arm_relobj::find_linked_text_section): Ditto.
5770
5771 2010-04-07  Cary Coutant  <ccoutant@google.com>
5772
5773         * archive.cc (include_member): Destroy Read_symbols_data object before
5774         releasing file.
5775         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5776         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5777         (Read_symbols_data::~Read_symbols_data) New destructor.
5778         (Section_relocs::Section_relocs) New constructor.
5779         (Section_relocs::~Section_relocs) New destructor.
5780         (Read_relocs_data::Read_relocs_data) New constructor.
5781         (Read_relocs_data::~Read_relocs_data) New destructor.
5782         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5783         pointers to NULL after deleting.
5784
5785 2010-04-07  Doug Kwan  <dougkwan@google.com>
5786
5787         * arm.cc: Replace "endianity" with "endianness" in comments.
5788         (Arm_exidx_cantunwind): Ditto.
5789         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5790         (Arm_relobj::merge_flags_and_attributes): New method.
5791         (Arm_relobj::merge_flags_and_attributes_): New data member.
5792         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5793         (Arm_relobj::scan_sections_for_stubs): Ditto.
5794         (Arm_relobj::do_read_symbols): Check to see if we really want to
5795         merge processor-specific flags and attributes.  Exit early if
5796         an object is empty except for section names and the undefined symbol.
5797         (Target_arm::do_finalize_sections): Move check for ELF format to
5798         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5799         attributes from a regular object only when we have determined that
5800         it is aapropriate.  Do not create an .ARM.attributes section in
5801         output if there is no regular input object.
5802         (Target_arm::merge_processor_specific_flags): Check
5803         --warn-mismatch before printing any error.
5804         (Target_arm::merge_object_attributes): Ditto.
5805         * gold.cc (queue_middle_tasks): Handle the case in which there is
5806         no regular object in input.
5807         * options.cc (General_options::parse_EB): New method.
5808         (General_options::parse_EL): Same.
5809         (General_options::General_options): Initialize endianness_.
5810         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5811         New options.
5812         (General_options::Endianness): New enum.
5813         (General_options::endianness): New method.
5814         (General_options::endianness_): New data member.
5815         * parameters.cc (Parameters::set_options): Check target endianness.
5816         (Parameters::set_target_once): Ditto.
5817         (Parameters::check_target_endianness): New method.
5818         (parameters_force_valid_target): If either -EL or -EB is specified,
5819         use it to define endianness of default target.
5820         * parameters.h (Parameters::check_target_endianness): New method
5821         declaration.
5822         * target.h (class Target): Change "endianity" to "endianness"
5823         in comments.
5824
5825 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5826
5827         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5828         * configure: Regenerate.
5829         * Makefile.in: Regenerate.
5830         * testsuite/Makefile.in: Regenerate.
5831
5832 2010-04-06  Cary Coutant  <ccoutant@google.com>
5833
5834         gcc PR lto/42757
5835         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5836         prevailing definitions of common symbols.
5837         * testsuite/plugin_test_6.sh: New test case.
5838         * testsuite/plugin_common_test_1.c: New test case.
5839         * testsuite/plugin_common_test_2.c: New test case.
5840         * testsuite/Makefile.am (plugin_test_6): New test case.
5841         * testsuite/Makefile.in: Regenerate.
5842
5843 2010-04-06  Nick Clifton  <nickc@redhat.com>
5844
5845         * po/vi.po: New Vietnamese translation.
5846
5847 2010-03-30  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5850
5851 2010-03-25  Doug Kwan  <dougkwan@google.com>
5852
5853         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5854         to avoid a conversion warning on a 32-bit host.
5855
5856 2010-03-24  Ian Lance Taylor  <iant@google.com>
5857
5858         * testsuite/script_test_3.t: Add a TLS segment.
5859         * testsuite/Makefile.am (check_PROGRAMS): Add
5860         tls_phdrs_script_test.
5861         (tls_phdrs_script_test_SOURCES): Define.
5862         (tls_phdrs_script_test_DEPENDENCIES): Define.
5863         (tls_phdrs_script_test_LDFLAGS): Define.
5864         (tls_phdrs_script_test_LDADD): Define.
5865         * testsuite/Makefile.in: Rebuild.
5866
5867 2010-03-23  Cary Coutant  <ccoutant@google.com>
5868
5869         * fileread.cc (find_or_make_view): Fix comment.
5870
5871 2010-03-23  Ian Lance Taylor  <iant@google.com>
5872
5873         * script-sections.cc (class Orphan_section_placement): Define
5874         PLACE_TLS and PLACE_TLS_BSS.
5875         (Orphan_section_placement::Orphan_section_placement): Initialize
5876         new places.
5877         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5878         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5879         (tls_script_test_SOURCES): Define.
5880         (tls_script_test_DEPENDENCIES): Define.
5881         (tls_script_test_LDFLAGS): Define.
5882         (tls_script_test_LDADD): Define.
5883         * testsuite/Makefile.in: Rebuild.
5884
5885 2010-03-22  Doug Kwan  <dougkwan@google.com>
5886
5887         * arm.cc (Arm_relocate_functions::abs8,
5888         Arm_relocate_functions::abs16): Use correct check for overflow
5889         specified in the ARM ELF specs.
5890         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5891         target of a BLX instruction specially.
5892         (Reloc_stub::stub_type_for_reloc): Ditto.
5893         (Relocate::relocate): Use symbolic names instead of numeric relocation
5894         codes to report error.
5895         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5896         workaround.
5897         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5898         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5899         thumb2_blx_out_of_range.stdout
5900         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5901         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5902         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5903         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5904         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5905         thumb2_blx_in_range, thumb2_blx_in_range.o,
5906         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5907         thumb2_blx_out_of_range.o): New rules.
5908         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5909         thumb2_blx_in_range and thumb2_blx_out_of_range.
5910         * testsuite/Makefile.in: Regenerate.
5911         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5912         * testsuite/thumb_blx_in_range.s: New file.
5913         * testsuite/thumb_blx_out_of_range.s: New file.
5914
5915 2010-03-22  Rafael Espindola  <espindola@google.com>
5916
5917         * archive.cc (Should_include): Move to archive.h.
5918         (should_include_member): Make it a member of Archive.
5919         (Lib_group): New.
5920         (Add_lib_group_symbols): New.
5921         * archive.h: Include options.h.
5922         (Archive_member): Moved from Archive.
5923         (Should_include): Moved from archive.cc.
5924         (Lib_group): New.
5925         (Add_lib_group_symbols): New.
5926         * dynobj.cc (do_should_include_member): New.
5927         * dynobj.h (do_should_include_member): New.
5928         * gold.cc (queue_initial_tasks): Update call to queue.
5929         * main.cc (main): Print lib group stats.
5930         * object.cc (do_should_include_member): New.
5931         * object.h: Include archive.h.
5932         (Object::should_include_member): New.
5933         (Object::do_should_include_member): New.
5934         (Sized_relobj::do_should_include_member): New.
5935         * options.cc (General_options::parse_start_lib): New.
5936         (General_options::parse_end_lib): New.
5937         (Input_arguments::add_file): Handle lib groups.
5938         (Input_arguments::start_group): Check we are not in a lib.
5939         (Input_arguments::start_lib): New.
5940         (Input_arguments::end_lib): New.
5941         * options.h (General_options): Add start_lib and end_lib.
5942         (Input_argument::lib_): New.
5943         (Input_argument::lib): New.
5944         (Input_argument::is_lib): New.
5945         (Input_file_lib): New.
5946         (Input_arguments::in_lib_): New.
5947         (Input_arguments::in_lib): New.
5948         (Input_arguments::start_lib): New.
5949         (Input_arguments::end_lib_): New.
5950         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5951         in unused members as preempted.
5952         (Sized_pluginobj::do_should_include_member): New.
5953         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5954         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5955         return the blocker.
5956         (Read_symbols::do_whole_lib_group): New.
5957         (Read_symbols::do_lib_group): New.
5958         (Read_symbols::do_read_symbols): Handle lib groups.
5959         (Read_symbols::get_name): Handle lib groups.
5960         * readsyms.h (Read_symbols): Add an archive member pointer.
5961         (Read_symbols::do_whole_lib_group): New.
5962         (Read_symbols::do_lib_group): New.
5963         (Read_symbols::member_): New.
5964         * script.cc (read_input_script): Update call to queue_soon.
5965
5966 2010-03-19  Doug Kwan  <dougkwan@google.com>
5967
5968         * arm.cc (Stub_table::Stub_table): Initialize new data members
5969         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5970         (Stub_table::add_reloc_stub): Assign stub offset and update
5971         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5972         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5973         New data members.
5974         (Stub_table::update_data_size_and_addralign): Use
5975         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5976         instead of going over all reloc stubs.
5977         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5978         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5979         Stringpool_template::offset_ to size of Stringpool_char.
5980         (Stringpool_template::new_key_offset): Remove code to initialize
5981         Stringpool_template::offset_.
5982         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5983         Stringpool_template::offset_ to zero.
5984
5985 2010-03-15  Doug Kwan  <dougkwan@google.com>
5986
5987         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5988         offset_.
5989         (Stringpool_template::new_key_offset): New method.
5990         (Stringpool_template::add_string): Assign offsets when adding new
5991         strings.
5992         (Stringpool_template::set_string_offsets): Do not set string offsets
5993         when not optimizing.
5994         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5995         member size_.
5996         (Chunked_vector::clear): Clear size_.
5997         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5998         (Chunked_vector::size): Return size_.
5999         (Chunked_vector::push_back): Use size_ to find insert position.
6000         (Chunked_vector::size_): New data member.
6001         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6002         (Stringpool_template::new_key_offset): New method declaration.
6003         (Stringpool_template::offset_): New data member.
6004
6005 2010-03-15   Rafael Espindola  <espindola@google.com>
6006
6007         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6008         Add_symbols' constructor.
6009         * readsyms.h (Add_symbols): Remove the input_group member.
6010
6011 2010-03-10  Ian Lance Taylor  <iant@google.com>
6012
6013         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6014         target to ask whether a reference to a symbol requires a stack
6015         split.
6016         * target.h (Target::is_call_to_non_split): New function.
6017         (Target::do_is_call_to_non_split): Declare virtual function.
6018         * target.cc: Include "symtab.h".
6019         (Target::do_is_call_to_non_split): New function.
6020         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6021
6022 2010-03-10  Cary Coutant  <ccoutant@google.com>
6023
6024         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6025         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6026         (File_read::open[2]): Add whole_file_view_ to list of views.
6027         (File_read::make_view): Remove test of whole_file_view_.
6028         (File_read::find_or_make_view): Create whole_file_view_ if
6029         necessary.
6030         (File_read::clear_views): Replace bool parameter with enum;
6031         adjust all callers.  Don't delete views with permanent data;
6032         do delete cached views and views from archives if
6033         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6034         if clearing the corresponding view.
6035         * fileread.h (File_read::Clear_views_mode): New enum.
6036         (File_read::View::is_permanent_view): New method.
6037         (File_read::clear_views): Replace bool parameter
6038         with enum; adjust all callers.
6039         * options.h (General_options): Change keep_files_mapped option;
6040         add map_whole_files.
6041         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6042         releasing the file.
6043         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6044         the file.
6045
6046 2010-03-10  David S. Miller  <davem@davemloft.net>
6047
6048         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6049
6050 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6051
6052         * icf.cc (get_section_contents): Add '@' marker after processing the
6053         merge reloc.
6054
6055 2010-03-08  Doug Kwan  <dougkwan@google.com>
6056
6057         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6058         due to a conversion warning.
6059         (Arm_relobj::update_output_local_symbol_count): Check for local
6060         symbol with unset output index.
6061
6062 2010-03-05  Ian Lance Taylor  <iant@google.com>
6063
6064         * options.h (class General_options): Add --spare-dynamic-tags.
6065         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6066         --spare-dynamic-tags.
6067
6068 2010-03-05  Ian Lance Taylor  <iant@google.com>
6069
6070         * incremental.cc: Include "libiberty.h".
6071
6072 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6073
6074         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6075         function, is_info_ member.
6076         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6077         (Versions::Versions): Update caller.
6078         (Versions::define_base_version): Likewise.
6079         (Versions::add_def): Likewise.
6080
6081 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6082
6083         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6084         (Scan::possible_function_pointer_reloc): New function.
6085         (Scan::local_reloc_may_be_function_pointer): Change to call
6086         possible_function_pointer_reloc.
6087         (Scan::global_reloc_may_be_function_pointer): Ditto.
6088         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6089         relocations in ".data.rel.ro._ZTV" section.
6090         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6091         * testsuite/icf_safe_so_test.cc: Ditto.
6092         * testsuite/icf_safe_test.cc: Ditto.
6093         * testsuite/icf_safe_test.sh: Ditto.
6094
6095 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6096             Ian Lance Taylor  <iant@google.com>
6097
6098         * target-reloc.h (relocate_section): Check the symbol table index
6099         for -1U before setting the local symbol index.
6100         (scan_relocatable_relocs): If copying the relocation, record that
6101         the local symbol is required.
6102         * object.h (Symbol_value::is_output_symtab_index_set): New
6103         function.
6104         (Symbol_value::may_be_discarded_from_output_symtab): New
6105         function.
6106         (Symbol_value::has_output_symtab_entry): New function.
6107         (Symbol_value::needs_output_symtab_entry): Remove.
6108         (Symbol_value::output_symtab_index): Make sure the symbol index is
6109         set.
6110         (Symbol_value::set_output_symtab_index): Make sure the symbol
6111         index is not set.  Make sure the new index is valid.
6112         (Symbol_value::set_must_have_output_symtab_entry): New function.
6113         (Symbol_value::has_output_dynsym_entry): New function.
6114         (Symbol_value::set_output_dynsym_index): Make sure the new index
6115         is valid.
6116         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6117         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6118         local symbol if permitted.
6119         (Sized_relobj::do_finalize_local_symbols): Call
6120         is_output_symtab_index_set rather than needs_output_symtab_entry.
6121         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6122         rather than needs_output_symtab_entry.  Call
6123         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6124         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6125         is_output_symtab_index_set rather than needs_output_symtab_entry.
6126         * testsuite/discard_locals_relocatable_test.c: New file.
6127         * testsuite/discard_locals_test.sh: Test -r.
6128         * testsuite/Makefile.am (check_DATA): Add
6129         discard_locals_relocatable_test1.syms,
6130         discard_local_relocatable_test2.syms.
6131         (MOSTLYCLEANFILES): Likewise.  Also add
6132         discard_locals_relocatable_test1.lout and
6133         discard_locals_relocatable_test2.out.
6134         (discard_locals_relocatable_test1.syms): New target.
6135         (discard_locals_relocatable_test.o): New target.
6136         (discard_locals_relocatable_test1.out): New target.
6137         (discard_locals_relocatable_test2.syms): New target.
6138         (discard_locals_relocatable_test2.out): New target.
6139         (various): Add missing ../ld-new dependencies.
6140         * testsuite/Makefile.in: Rebuild.
6141
6142 2010-03-03  Nick Clifton  <nickc@redhat.com>
6143
6144         * po/fi.po: New Finnish translation.
6145
6146 2010-03-01  Doug Kwan  <dougkwan@google.com>
6147
6148         * layout.cc (Layout::Layout): Force section types of .init_array*,
6149         .preinit_array* and .fini_array* sections.
6150         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6151         Fix check of return value of std::string::find.().
6152         (Output_section::Input_section_sort_compare::operator()): Remove
6153         comment about .init_array.
6154         (Output_section::Input_section_sort_init_fini_compare::operator()):
6155         New method.
6156         (Output_section::sort_attached_input_sections): Handle .init_array
6157         and .fini_array specially.
6158         * output.h (Output_section::Inut_section_sort_compare): Update
6159         comment.
6160         (Output_section::Input_section_sort_init_fini_compare): New struct.
6161
6162 2010-02-26  Doug Kwan  <dougkwan@google.com>
6163
6164         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6165         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6166         * testsuite/debug_msg.sh: Avoid matching source line number for
6167         use of global variable undef_int.
6168
6169 2010-02-26  Doug Kwan  <dougkwan@google.com>
6170
6171         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6172         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6173         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6174         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6175         * options.cc (General_options::General_options): Initialize member
6176         fix_v4bx_.
6177         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6178         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6179         and rm_no_fix_v4bx.stdout
6180         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6181         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6182         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6183         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6184         and arm_no_fix_v4bx.
6185         * Makefile.in: Regenerate.
6186         * testsuite/arm_fix_v4bx.s: New file.
6187         * testsuite/arm_fix_v4bx.sh: Ditto.
6188
6189 2010-02-24  Doug Kwan  <dougkwan@google.com>
6190
6191         * arm.cc (Target_arm::got_section): Make the .got section the first
6192         non RELRO section in the data segment.
6193         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6194         suffixes of section names.
6195
6196 2010-02-24  Doug Kwan  <dougkwan@google.com>
6197
6198         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6199         flags and attributes merging if an input file is a binary file.
6200         * fileread.cc (Input_file::open): Record format of original file.
6201         * fileread.h (Input_file::Format): New enum type.
6202         (Input_file::Input_file): Initialize data member format_.
6203         (Input_file::format): New method definition.
6204         (Input_file::format_):: New data member.
6205
6206 2010-02-24  Doug Kwan  <dougkwan@google.com>
6207
6208         * arm.cc (Arm_output_data_got): New class.
6209         (ARM_TCB_SIZE): New constant
6210         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6211         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6212         If user uses a script with a SECTIONS clause, issue only a warning
6213         for a misplaced EXIDX input section.  Otherwise, issue an error.
6214         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6215         garbage collection.
6216         (Target_arm::got_mode_index_entry): Handle static linking.
6217         (Target_arm::Scan::local): Ditto.
6218         (Target_arm::Scan::global): Ditto.
6219         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6220         all incorrectly implemented relocations.
6221         (Target_arm::fix_exidx_coverage): Pass layout to
6222         Arm_output_section::fix_exidx_coverage.
6223         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6224         from ".ARM.exidx." and ".ARM.extab.".
6225
6226 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6227
6228         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6229         section if it does not already exist.
6230         * attributes.cc (Attributes_section_data::Attributes_section_data):
6231         Don't crash if size is zero.
6232
6233 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6234             Ian Lance Taylor  <iant@google.com>
6235
6236         * gold.cc (queue_middle_tasks): If no input files were opened,
6237         exit.
6238         * workqueue.h (Task_function::Task_function): Assert that there is
6239         a blocker.
6240
6241 2010-02-22  Doug Kwan  <dougkwan@google.com>
6242
6243         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6244         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6245         types to avoid warnings due to different uint64_t implementations
6246         on different hosts.
6247
6248 2010-02-21  Doug Kwan  <dougkwan@google.com>
6249
6250         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6251         handling of the maximum backward branch offset.
6252         (Arm_relocate_functions::thumb_branch_common): Ditto.
6253         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6254         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6255         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6256         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6257         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6258         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6259         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6260         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6261         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6262         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6263         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6264         thumb2_bl_out_of_range.o): New rules.
6265         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6266         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6267         thumb2_bl_out_of_range
6268         * testsuite/Makefile.in: Regenerate.
6269         * testsuite/arm_bl_in_range.s: New file.
6270         * testsuite/arm_bl_out_of_range.s: Ditto.
6271         * testsuite/arm_branch_in_range.sh: Ditto.
6272         * testsuite/arm_branch_range.t: Ditto.
6273         * testsuite/thumb2_branch_range.t: Ditto.
6274         * testsuite/thumb_bl_in_range.s: Ditto.
6275         * testsuite/thumb_bl_out_of_range.s: Ditto.
6276         * testsuite/thumb_branch_range.t: Ditto.
6277
6278 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6279
6280         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6281         Add reloc offset information.
6282         * icf.cc (get_section_contents): Change iterators to point to the new
6283         vectors. Add reloc offset information to the contents.
6284         * icf.h (Icf::Sections_reachable_info): New typedef.
6285         (Icf::Sections_reachable_list): New typedef.
6286         (Icf::Offset_info): New typedef.
6287         (Icf::Reloc_info): New struct typedef.
6288         (Icf::Reloc_info_list): New typedef.
6289         (Icf::symbol_reloc_list): Delete method.
6290         (Icf::addend_reloc_list): Delete method.
6291         (Icf::section_reloc_list): Delete method.
6292         (Icf::reloc_info_list): New method.
6293         (Icf::reloc_info_list_): New member.
6294
6295 2010-02-19  Doug Kwan  <dougkwan@google.com>
6296
6297         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6298         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6299         * arm.cc (Arm_relocation_functions): New forward declaration.
6300         (Target_arm::Target_arm): Initialize new data members
6301         got_mod_index_offset_ and tls_base_symbol_defined_.
6302         (Target_arm::Relocate::relocate_tls): New method.
6303         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6304          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6305         New methods.
6306         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6307         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6308         (Target_arm::got_mod_index_offset_,
6309         Target_arm::tls_base_symbol_defined_): New data members.
6310         (Target_arm::Scan::local, Target::Scan::global,
6311         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6312         relocations.
6313
6314 2010-02-18  Doug Kwan  <dougkwan@google.com>
6315
6316         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6317         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6318         text section as a parameter becuase some broken tools may not set
6319         the link in section header.
6320         (Target_arm::has_got_section): New method.
6321         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6322         without any mapping symbol as data only.  Remove warning.
6323         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6324         link in its section header, try to discover the link by inspecting the
6325         REL31 relocation at the beginning of the section.
6326         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6327         in error message.
6328         (Target_arm::Scan::global): Treat any reference to the symbol
6329         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6330
6331 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6332
6333         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6334         (Scan::global_reloc_may_be_function_pointer): New function.
6335         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6336         (Scan::global_reloc_may_be_function_pointer): New function.
6337         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6338         (Scan::global_reloc_may_be_function_pointer): New function.
6339         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6340         (Scan::global_reloc_may_be_function_pointer): New function.
6341         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6342         (Scan::global_reloc_may_be_function_pointer): New function.
6343         (Scan::possible_function_pointer_reloc): New function.
6344         (Target_x86_64::can_check_for_function_pointers): New function.
6345         * gc.h (gc_process_relocs): Scan relocation types to determine if
6346         function pointers were taken for targets that support it.
6347         * icf.cc (Icf::find_identical_sections): Include functions for
6348         folding in safe ICF whose pointer is not taken.
6349         * icf.h (Secn_fptr_taken_set): New typedef.
6350         (fptr_section_id_): New member.
6351         (section_has_function_pointers): New function.
6352         (set_section_has_function_pointers): New function.
6353         (check_section_for_function_pointers): New function.
6354         * options.h: Fix comment for safe ICF option.
6355         * target.h (can_check_for_function_pointers): New function.
6356         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6357         Modify icf_safe_test for X86-64.
6358         * testsuite/Makefile.in: Regenerate.
6359         * testsuite/icf_safe_so_test.cc: New file.
6360         * testsuite/icf_safe_so_test.sh: New file.
6361         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6362         (main): Change to take pointer to function kept_func_3.
6363         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6364         folding is done correctly for X86-64.
6365
6366 2010-02-12  David S. Miller  <davem@davemloft.net>
6367
6368         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6369         is_symbolless parameter.
6370         (Output_reloc<SHT_REL>::is_symbolless): New.
6371         (Output_reloc<SHT_REL>::is_symbolless_): New.
6372         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6373         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6374         (Output_reloc<SHT_RELA>::is_symbolless): New.
6375         (Output_data_reloc::add_global): Handle is_symbolless.
6376         (Output_data_reloc::add_global_relative): Likewise.
6377         (Output_data_reloc::add_local): Likewise.
6378         (Output_data_reloc::add_local_relative): Likewise.
6379         (Output_data_reloc::add_symbolless_global_addend): New.
6380         (Output_data_reloc::add_symbolless_local_addend): New.
6381         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6382         is_symbolless.
6383         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6384         instead of ->is_relative_
6385         (Output_reloc::write): Likewise.
6386         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6387         (Output_reloc::write_rel): Simplify.
6388
6389         * sparc.cc (Target_sparc::Scan::local): Use
6390         ->add_symbolless_local_addend as needed.
6391         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6392         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6393         based upon relocation offset.
6394
6395 2010-02-11  Doug Kwan  <dougkwan@google.com>
6396
6397         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6398         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6399         beginning of function.
6400         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6401         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6402         parameter is_32bit in calls to should_apply_static_reloc.
6403         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6404         (check_DATA): Add arm_abs_global.stdout.
6405         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6406         arm_abs_global.stdout): New rules.
6407         (MOSTLLYCLEANFILES): Add arm_abs_global
6408         * Makefile.in: Regenerate.
6409         * testsuite/arm_abs_global.s: New file.
6410         * testsuite/arm_abs_global.sh: Ditto.
6411         * testsuite/arm_abs_lib.s: Ditto.
6412
6413 2010-02-11  Ian Lance Taylor  <iant@google.com>
6414
6415         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6416         Read_relocs task.
6417         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6418         Allocate_commons_task first.
6419         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6420         task, rather than symtab_lock_.
6421         (Gc_process_relocs::~Gc_process_relocs): New function.
6422         (Gc_process_relocs::is_runnable): Check this_blocker_.
6423         (Gc_process_relocs::locks): Use next_blocker_ rather than
6424         blocker_.
6425         (Scan_relocs::~Scan_relocs): New function.
6426         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6427         symtab_lock_.
6428         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6429         next_blocker_.
6430         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6431         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6432         constructor accordingly.
6433         (class Gc_process_relocs): Likewise.
6434         (class Scan_relocs): Likewise.
6435         * common.h (class Allocate_commons_task): Remove symtab_lock_
6436         field, and corresponding constructor parameter.
6437         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6438         symtab_lock_.
6439         (Allocate_commons_task::locks): Likewise.
6440
6441 2010-02-11  Ian Lance Taylor  <iant@google.com>
6442
6443         * gold-threads.h (class Once): Define.
6444         (class Initialize_lock): Rewrite as child of Once.
6445         * gold-threads.cc (class Once_initialize): Define.
6446         (once_pointer_control): New static variable.
6447         (once_pointer, once_arg): New static variables.
6448         (c_run_once): New static function.
6449         (Once::Once, Once::run_once, Once::internal_run): New functions.
6450         (class Initialize_lock_once): Remove.
6451         (initialize_lock_control): Remove.
6452         (initialize_lock_pointer): Remove.
6453         (initialize_lock_once): Remove.
6454         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6455         (Initialize_lock::initialize): Rewrite.
6456         (Initialize_lock::do_run_once): New function.
6457         * archive.cc (Archive::interpret_header): Only clear name if it is
6458         not already empty.
6459         * fileread.cc: Include "gold-threads.h"
6460         (file_counts_lock): New static variable.
6461         (file_counts_initialize_lock): Likewise.
6462         (File_read::release): Only increment counts when using --stats.
6463         Use a lock around the increment.
6464         * parameters.cc (class Set_parameters_target_once): Define.
6465         (set_parameters_target_once): New static variable.
6466         (Parameters::Parameters): Move here from parameters.h.
6467         (Parameters::set_target): Rewrite.
6468         (Parameters::set_target_once): New function.
6469         (Parameters::clear_target): Move here and rewrite.
6470         * parameters.h (class Parameters): Update declarations.  Add
6471         set_parameters_target_once_ field.
6472         (Parameters::Parameters): Move to parameters.cc.
6473         (Parameters::clear_target): Likewise.
6474         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6475         task.
6476         (Start_group::~Start_group): New function.
6477         (Start_group::is_runnable): New function.
6478         (Start_group::locks, Start_group::run): New functions.
6479         (Finish_group::run): Change saw_undefined to size_t.
6480         * readsyms.h (class Start_group): Define.
6481         (class Finish_group): Change saw_undefined_ field to size_t.
6482         (Finish_group::Finish_group): Remove saw_undefined and
6483         this_blocker parameters.  Change all callers.
6484         (Finish_group::set_saw_undefined): New function.
6485         (Finish_group::set_blocker): New function.
6486         * symtab.h (class Symbol_table): Change saw_undefined to return
6487         size_t.  Change saw_undefined_ field to size_t.
6488         * target-select.cc (Set_target_once::do_run_once): New function.
6489         (Target_selector::Target_selector): Initialize set_target_once_
6490         field.  Don't initialize lock_ and initialize_lock_ fields.
6491         (Target_selector::instantiate_target): Rewrite.
6492         (Target_selector::set_target): New function.
6493         * target-select.h (class Set_target_once): Define.
6494         (class Target_selector): Update declarations.  Make
6495         Set_target_once a friend.  Remove lock_ and initialize_lock_
6496         fields.  Add set_target_once_ field.
6497
6498 2010-02-10  Ian Lance Taylor  <iant@google.com>
6499
6500         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6501         queueing any tasks.
6502         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6503         (queue_middle_tasks): Add all blockers before queueing any tasks.
6504         (queue_final_tasks): Likewise.
6505         * token.h (Task_token::add_blockers): New function.
6506         * object.h (Input_objects::number_of_relobjs): New function.
6507
6508 2010-02-10  Ian Lance Taylor  <iant@google.com>
6509
6510         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6511         shared, not if not position independent.
6512         * x86_64.cc (Relocate::relocate_tls): Likewise.
6513         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6514         (tls_pie_pic_test): New target.
6515         * testsuite/Makefile.in: Rebuild.
6516
6517         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6518         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6519         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6520         * testsuite/Makefile.in: Rebuild.
6521
6522 2010-02-09  David S. Miller  <davem@davemloft.net>
6523
6524         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6525         R_SPARC_RELATIVE using ->add_local_relative().
6526         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6527
6528         * output.h (Output_data_dynamic::add_section_size): New method
6529         that takes two Output_data objects.
6530         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6531         entry param.  Handle it in initializers.
6532         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6533         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6534         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6535         arg.
6536         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6537         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6538         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6539         for dynrel_includes_plt.
6540         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6541         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6542         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6543         before .rela.plt
6544         (Target_sparc::do_finalize_sections): Update to pass true for
6545         dynrel_includes_plt.
6546         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6547         output before .rela.plt
6548         (Target_powerpc::do_finalize_sections): Update to pass true for
6549         dynrel_includes_plt when 32-bit.
6550
6551 2010-02-08  Doug Kwan  <dougkwan@google.com>
6552
6553         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6554         method.
6555         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6556         Arm_relobj::scan_section_for_cortex_a8_stubs,
6557         Arm_relobj::do_relocation_section): Instead of calling
6558         Output_section::output_address, use faster
6559         Arm_relobj::simple_input_section_output_address.
6560
6561 2010-02-08  David S. Miller  <davem@davemloft.net>
6562
6563         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6564         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6565         relocation helper function.
6566
6567         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6568         just like R_SPARC_GOT{10,13,22}.
6569         (Target_sparc::Scan::local): Likewise.
6570         (Target_sparc::Relocate:relocate): Likewise.
6571
6572 2010-02-06  Ian Lance Taylor  <iant@google.com>
6573
6574         * configure.ac: Rewrite targetobjs duplicate removal code to use
6575         only shell constructs.
6576         * configure: Rebuild.
6577
6578 2010-02-05  Doug Kwan  <dougkwan@google.com>
6579
6580         PR 11247
6581         * arm.cc (Arm_relobj::section_is_scannable): New method.
6582         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6583         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6584
6585 2010-02-04  Doug Kwan  <dougkwan@google.com>
6586
6587         PR 11247
6588         * arm-reloc-property.cc (cstdio): Include.
6589         * configure.ac (targetobjs): Remove duplicates.
6590         * configure: Regenerate.
6591         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6592         big and little endian version for a given address size.
6593
6594 2010-02-03  Doug Kwan  <dougkwan@google.com>
6595
6596         * arm-reloc-property.cc
6597         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6598         definition.
6599         * arm-reloc-property.h
6600         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6601         New method definition.
6602         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6603         declaration.
6604         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6605         overflow to N.
6606         (GOT_PREL): Change implemented to Y.
6607         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6608         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6609         (Arm_relocate_functions::movw_abs_nc): Remove method.
6610         (Arm_relocate_functions::movt_abs): Ditto.
6611         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6612         (Arm_relocate_functions::thm_movt_abs): Ditto.
6613         (Arm_relocate_functions::movw_rel_nc): Ditto.
6614         (Arm_relocate_functions::movw_rel): Ditto.
6615         (Arm_relocate_functions::movt_rel): Ditto.
6616         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6617         (Arm_relocate_functions:thm_movw_rel): Ditto.
6618         (Arm_relocate_functions:thm_movt_rel): Ditto.
6619         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6620         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6621         New method definitions.
6622         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6623         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6624         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6625         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6626         (Target_arm::Relocate::relocate): Check for non-static or
6627         unimplemented relocation code and exit early.  Change calls to
6628         Target_arm::reloc_uses_thumb_bit and
6629         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6630         instead.  Refactor code to handle similar relocations to increase
6631         code sharing.  Remove check for unsupported relocation code in switch
6632         statement.
6633         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6634         relocation property table to find out size.  Change error message to
6635         print out the name of a relocation code instead of the numeric value.
6636         (Target_arm::scan_reloc_for_stub): Use relocation property table
6637         instead of calling Target_arm::reloc_uses_thumb_bit().
6638
6639 2010-02-02  Doug Kwan  <dougkwan@google.com>
6640
6641         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6642         types of relaxed input section.
6643
6644 2010-02-02  Doug Kwan  <dougkwan@google.com>
6645
6646         * Makefile.am (HFILES): Add arm-reloc-property.h.
6647         (DEFFILES): New.
6648         (TARGETSOURCES): Add arm-reloc-property.cc
6649         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6650         (libgold_a_SOURCES): $(DEFFILES)
6651         * Makefile.in: Regenerate.
6652         * arm-reloc-property.cc: New file.
6653         * arm-reloc-property.h: New file.
6654         * arm-reloc.def: New file.
6655         * arm.cc: Update comments.
6656         (arm-reloc-property.h): New included header.
6657         (arm_reloc_property_table): New global variable.
6658         (Target_arm::do_select_as_default_target): New method definition.
6659         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6660         arm-reloc-property to targ_extra_obj.
6661         * parameters.cc (set_parameters_target): Call
6662         Target::select_as_default_target().
6663         * target.h (Target::select_as_default_target): New method definition.
6664         (Target::do_select_as_default_target): Same.
6665
6666 2010-02-01  Doug Kwan  <dougkwan@google.com>
6667
6668         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6669         first_output_text_section_.
6670         (Arm_exidx_fixup::first_output_text_section): New method definition.
6671         (Arm_exidx_fixup::first_output_text_section_): New data member.
6672         (Arm_exidx_fixup::process_exidx_section): Record the first text
6673         output section seen.
6674         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6675         and entsize in output section header.
6676
6677 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6678
6679         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6680         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6681         (Arm_relocate_functions::thm_alu11): New Method.
6682         (Arm_relocate_functions::thm_pc8): New Method.
6683         (Arm_relocate_functions::thm_pc12): New Method.
6684         (Target_arm::Scan::local): Handle the relocations.
6685         (Target_arm::Scan::global): Likewise.
6686         (Target_arm::Relocate::relocate): Likewise.
6687         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6688
6689 2010-01-29  Doug Kwan  <dougkwan@google.com>
6690
6691         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6692         of relocation types as ld.
6693
6694 2010-01-29  Doug Kwan  <dougkwan@google.com>
6695
6696         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6697         to public.
6698         (Arm_relocate_functions::thumb_branch_common): Ditto.
6699         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6700         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6701         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6702         Arm_relocate_functions::jump24): Remove.
6703         (Target_arm::Relocate::relocate): Adjust code to call
6704         Arm_relocation_functions::arm_branch_common and
6705         Arm_relocation_functions::thumb_branch_common instead of their removed
6706         wrappers.  Merge switch-cases together to reduce source code size.
6707
6708 2010-01-29  Doug Kwan  <dougkwan@google.com>
6709
6710         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6711         output_local_symbol_count_needs_update_.
6712         (Arm_relobj::output_local_symbol_count_needs_update,
6713          Arm_relobj::set_output_local_symbol_count_needs_update,
6714          Arm_relobj::update_output_local_symbol_count): New methods.
6715         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6716         member.
6717         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6718         of pointed function as in a R_ARM_PREL31 relocation.
6719         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6720         for output local symbol count updating.
6721         (Target_arm::do_relax): Update output local symbol counts in objects
6722         if necessary.
6723         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6724
6725 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6726
6727         * arm.cc: Added support for the ARM relocations:
6728         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6729         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6730         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6731         movw_prel_nc).
6732         (Arm_relocate_functions::movw_rel): New method.
6733         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6734         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6735         thm_movw_prel_nc).
6736         (Arm_relocate_functions::thm_movw_rel): New method.
6737         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6738         thm_movt_prel).
6739         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6740         relocations.
6741         (Target_arm::Scan::global): Likewise.
6742         (Target_arm::Relocate::relocate): Likewise.
6743         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6744         Likewise.
6745
6746 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6747
6748         * arm.cc: Added support for ARM group relocations.
6749         (Target_arm::reloc_needs_sym_origin): New method.
6750         (Arm_relocate_functions::calc_grp_kn): New method.
6751         (Arm_relocate_functions::calc_grp_residual): New method.
6752         (Arm_relocate_functions::calc_grp_gn): New method.
6753         (Arm_relocate_functions::arm_grp_alu): New Method.
6754         (Arm_relocate_functions::arm_grp_ldr): New Method.
6755         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6756         (Arm_relocate_functions::arm_grp_ldc): New Method.
6757         (Target_arm::Scan::local): Handle the ARM group relocations.
6758         (Target_arm::Scan::global): Likewise.
6759         (Target_arm::Relocate::relocate): Likewise.
6760         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6761         Likewise.
6762
6763 2010-01-26  Doug Kwan  <dougkwan@google.com>
6764
6765         * arm.cc (set): Include.
6766         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6767         pointer type.
6768         (Arm_output_section::Text_section_list): New type.
6769         (Arm_output_section::append_text_sections_to_list): New method.
6770         (Arm_output_section::fix_exidx_coverage): Ditto.
6771         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6772         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6773         Relobj::set_section_offset() instead of
6774         Sized_relobj::invalidate_section_offset().
6775         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6776         parameter for section headers. Ignore relocation sections for
6777         unallocated sections and EXIDX sections.
6778         (Target_arm::fix_exidx_coverage): New method.
6779         (Target_arm::output_section_address_less_than): New type.
6780         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6781         linked text section instead of the EXIDX section.
6782         (Arm_output_section::create_stub_group): Add an assertion to check
6783         that this is not an EXIDX output section.
6784         (Arm_output_section::append_text_sections_to_list): New method.
6785         (Arm_output_section::fix_exidx_coverage): Ditto.
6786         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6787         Arm_relobj::section_needs_reloc_stub_scanning.
6788         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6789         first pass.
6790         (Target_arm::fix_exidx_coverage): New method.
6791         * object.h (Relobj::set_output_section): New method.
6792         (Sized_relobj::invalidate_section_offset): Remove method.
6793         (Sized_relobj::do_invalidate_section_offset): Remove method.
6794         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6795
6796 2010-01-25  Doug Kwan  <dougkwan@google.com>
6797
6798         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6799         Fix warning due to signed and unsigned comparison on a 32-bit host.
6800
6801 2010-01-22  Doug Kwan  <dougkwan@google.com>
6802
6803         * arm.cc (Target_arm::do_relax): Record an output section for section
6804         offset adjustment it contains any stub table that has changed.
6805         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6806         offsets in an output section if necessary.
6807         * output.cc (Output_section::Output_section): Initialize
6808         section_offsets_need_adjustments_.
6809         (Output_section::add_input_section_for_script): Renamed to
6810         Output_section::add_simple_input_section.
6811         (Output_section::save_states): Add a comment.
6812         (Output_section::discard_states): New method defintion.
6813         (Output_section::adjust_section_offsets): Same.
6814         * output.h (Output_section::add_input_section_for_script): Renamed to
6815         Output_section::add_simple_input_section.
6816         (Output_section::discard_states): New method declaration.
6817         (Output_section::adjust_section_offsets): Same.
6818         (Output_section::section_offsets_need_adjustment,
6819         Output_section::set_section_offsets_need_adjustment): New method
6820         definitions.
6821         (Output_section::section_offsets_need_adjustment_): New data member.
6822         * script-sections.cc
6823         (Output_section_element_input::set_section_address): Adjust code for
6824         renaming of Output_section::add_input_section_for_script.
6825         (Orphan_output_section::set_section_address): Same.
6826
6827 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6828
6829         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6830         Fix_v4bx enum values .
6831         * gold/options.h (General_options): New option definitions.
6832         (General_options::fix_v4bx): New method.
6833         (General_options::Fix_v4bx): New enum.
6834         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6835         (General_options::parse_fix_v4bx_interworking): New method.
6836
6837 2010-01-22  Doug Kwan  <dougkwan@google.com>
6838
6839         * arm.cc (Arm_exidx_fixup): New class.
6840
6841 2010-01-21  Doug Kwan  <dougkwan@google.com>
6842
6843         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6844         classes.
6845         (Arm_exidx_section_offset_map): New type.
6846
6847 2010-01-21  Doug Kwan  <dougkwan@google.com>
6848
6849         * arm.cc (Arm_exidx_input_section): New class.
6850         (Arm_relobj::exidx_input_section_by_link,
6851         Arm_relobj::exidx_input_section_by_shndx,
6852         Arm_relobj::make_exidx_input_section): New methods.
6853         (read_arm_attributes_section): Remove.
6854         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6855         information about them.
6856         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6857         to here.
6858
6859 2010-01-20  Doug Kwan  <dougkwan@google.com>
6860
6861         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6862         Input_section_specifier to Section_id.
6863         (Target_arm::new_arm_input_section: Adjust code for change of key
6864         type.
6865         (Target_arm::find_arm_input_section): Ditto.
6866         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6867         (Section_id): Remove.
6868         (Garbage_collection::Section_id_hash): Remove.
6869         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6870         (Section_id): Remove.
6871         (Icf::Section_id_hash): Remove.
6872         * object.h (Section_id, Const_section_id, Section_id_hash,
6873         Const_section_id_hash): New type definitions.
6874         * output.cc (Output_section::add_relaxed_input_section): Change to
6875         use Const_section_id instead of Input_section_specifier as key type.
6876         (Output_section::add_merge_input_section): Ditto.
6877         (Output_section::build_relaxation_map): Change to use Section_id
6878         instead of Input_section_specifier as key type.
6879         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6880         Ditto.
6881         (Output_section::convert_input_sections_to_relaxed_sections): Change
6882         to use Const_section_id instead of Input_section_specifier as key type.
6883         (Output_section::find_merge_section): Ditto.
6884         (Output_section::find_relaxed_input_section): Ditto.
6885         * output.h (Input_section_specifier): Remove class.
6886         (Output_section::Output_section_data_by_input_section_map): Change
6887         key type to Const_section_id.
6888         (Output_section::Output_relaxed_input_section_by_input_section_map):
6889         Ditto.
6890         (Output_section::Relaxation_map): Change key type to Section_id.
6891
6892 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6893
6894         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6895         (class Arm_v4bx_stub): New class.
6896         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6897         (Stub_factory::make_arm_v4bx_stub): New method.
6898         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6899         (Stub_table::empty): Handle v4bx stubs.
6900         (Stub_table::add_arm_v4bx_stub): New method.
6901         (Stub_table::find_arm_v4bx_stub): New method.
6902         (Arm_relocate_functions::v4bx): New method.
6903         (Target_arm::fix_v4bx): New method.
6904         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6905         (Stub_table::relocate_stubs): Likewise.
6906         (Stub_table::do_write): Likewise.
6907         (Stub_table::update_data_size_and_addralign): Likewise.
6908         (Stub_table::finalize_stubs):  Likewise.
6909         (Target_arm::Scan::local): Likewise.
6910         (Target_arm::Scan::global): Likewise.
6911         (Target_arm::do_finalize_sections): Likewise.
6912         (Target_arm::Relocate::relocate): Likewise.
6913         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6914         Likewise.
6915         (Target_arm::scan_reloc_for_stub): Likewise.
6916         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6917
6918 2010-01-19  Ian Lance Taylor  <iant@google.com>
6919
6920         * output.cc (Output_section_headers::do_sized_write): Write large
6921         segment count to sh_info field.
6922         (Output_file_header::do_sized_write): For large segment count,
6923         write PN_XNUM to e_phnum field.
6924
6925 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6926
6927         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6928         (Arm_relocate_functions::thm_jump8): New function.
6929         (Arm_relocate_functions::thm_jump11): New function.
6930         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6931         R_ARM_THM_JUMP11.
6932         (Target_arm::Scan::global): Likewise.
6933         (Target_arm::Relocate::relocate): Likewise.
6934         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6935         Likewise.
6936
6937 2010-01-14  Doug Kwan  <dougkwan@google.com>
6938
6939         * arm.cc (map, utility): Include headers.
6940         (Target_arm::apply_cortex_a8_workaround): New method.
6941         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6942         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6943         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6944         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6945         the --[no-]fix-cortex-a8 command line options.
6946         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6947         (Target_arm::relocate_stub): Use addend in instruction template.
6948         * options.h (DEFINE_bool): Set the user-set flag.
6949         (General_options): Add --[no-]-fix-cortex options.
6950         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6951         : Update fast look-up map after conversion.
6952
6953 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6954
6955         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6956         in the first pass of do_layout.
6957
6958 2010-01-13  Doug Kwan  <dougkwan@google.com>
6959
6960         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6961         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6962         apparent compiler problem of not folding static constant integral
6963         data members of elfcpp::Elf_sizes<32>.
6964
6965 2010-01-13  Doug Kwan  <dougkwan@google.com>
6966
6967         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6968         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6969         Arm_relobj::scan_section_for_cortex_a8_erratum,
6970         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6971         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6972         sections to scan for relocation stubs into a new method
6973         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6974         relocation and Cortex-A8 stub scanning.
6975         (Target_arm::do_relax): Force stubs to be after stubbed sections
6976         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6977         the beginning of a new relaxation pass.  Update a comment.
6978         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6979
6980 2010-01-12  Ian Lance Taylor  <iant@google.com>
6981
6982         * target-reloc.h (visibility_error): New inline function.
6983         (relocate_section): Call visibility_error.
6984         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6985         (MOSTLYCLEANFILES): Likewise.
6986         (protected_4_pic.o, protected_3.err): New targets.
6987         * testsuite/protected_4.cc: New file.
6988
6989 2010-01-12  Doug Kwan  <dougkwan@google.com>
6990
6991         * arm.cc (Cortex_a8_reloc): New class.
6992         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6993         and cortex_a8_relocs_info_.
6994         (Target_arm::fix_cortex_a8): New method definition.
6995         (Target_arm::Cortex_a8_relocs_info): New type.
6996         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6997         New data member declarations.
6998         (Target_arm::scan_reloc_for_stub): Record information about
6999         relocations for THUMB branches that might be exempted from the
7000         Cortex-A8 workaround.
7001         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7002         at the beginning of a relaxation pass.
7003
7004 2010-01-12  Doug Kwan  <dougkwan@google.com>
7005
7006         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7007         (Arm_relobj::Mapping_symbol_position,
7008          Arm_reloj::Mapping_symbol_position_less,
7009          Arm_relobj::Mapping_symbols_info): New types.
7010         (Target_arm::is_mapping_symbol_name): New method definition.
7011         (Arm_relobj::do_count_local_symbols): Save information about mapping
7012         symbols.
7013
7014 2010-01-11  Doug Kwan  <dougkwan@google.com>
7015
7016         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7017         Arm_relocate_functions::thumb32_branch_upper,
7018         Arm_relocate_functions::thumb32_branch_lower,
7019         Arm_relocate_functions::thumb32_cond_branch_offset,
7020         Arm_relocate_functions::thumb32_cond_branch_upper,
7021         Arm_relocate_functions::thumb32_cond_branch_lower,
7022         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7023         branch offset encoding.
7024         (Arm_relocate_functions::thumb_branch_common): Use new branch
7025         offset encoding methods to avoid code duplication.
7026         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7027         (Stub_addend_reader::operator()): Use new branch encoding method
7028         to avoid code duplication.
7029
7030 2010-01-11  Doug Kwan  <dougkwan@google.com>
7031
7032         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7033         (Target_arm::do_finalize_sections): Define special EXIDX section
7034         symbols only if referenced.
7035         * gc.h (Garbage_collection::add_reference): New method.
7036         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7037         code duplication.
7038
7039 2010-01-11  Ian Lance Taylor  <iant@google.com>
7040
7041         * script.cc (Version_script_info::build_expression_list_lookup):
7042         Change complaing about duplicate wildcard match from error to
7043         warning.
7044
7045         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7046         of 2009-12-30.
7047         (Version_script_info::Version_script_info): Initialize globs_,
7048         default_version_, default_is_global_, and exact_.  Don't
7049         initialize globals_ or locals_.
7050         (Version_script_info::build_lookup_tables): Build local symbols
7051         first.
7052         (Version_script_info::unquote): New function.
7053         (Version_script_info::add_exact_match): New function.
7054         (Version_script_info::build_expression_list_lookup): Remove lookup
7055         parameter.  Add is_global parameter.  Change all callers.  Handle
7056         wildcard pattern specially.  Unquote pattern.  Call
7057         add_exact_match.
7058         (Version_script_info::get_name_to_match): New function.
7059         (Version_script_info::get_symbol_version): New function.
7060         (Version_script_info::get_symbol_version_helper): Remove.
7061         (Version_script_info::check_unmatched_names): Call unquote.
7062         * script.h (class Version_script_info): Change get_symbol_version
7063         to be non-inline and add is_global parameter; change all callers.
7064         Rewrite symbol_is_local.  Update declarations.  Define struct
7065         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7066         Remove globals_ and locals_ members.  Add exact_, globs_,
7067         default_version_, is_global_.
7068         (Version_script_info::Glob): Remove pattern, add expression and
7069         is_global.  Update constructor.  Change all callers.
7070         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7071         default version.
7072         (Versions::symbol_section_contents): If a symbol is undefined, or
7073         defined in a dynamic object, set the version index to
7074         VER_NDX_LOCAL.
7075         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7076         symbol_is_local.
7077         (Symbol_table::add_from_pluginobj): Likewise.
7078         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7079
7080 2010-01-11  Doug Kwan  <dougkwan@google.com>
7081
7082         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7083         (incremental_dump_LDADD): Add linking option for libintl.
7084         * Makefile.in: Regenerate.
7085
7086 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7087
7088         PR gold/11144
7089         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7090         instead of -Ds.
7091         * testsuite/Makefile.in: Regenerated.
7092
7093 2010-01-10  Doug Kwan  <dougkwan@google.com>
7094
7095         * options.h (DEFINE_var): Use parentheses around argument varname__
7096         in macro body to avoid any unintended subsequent substitutions.
7097
7098 2010-01-10  Ian Lance Taylor  <iant@google.com>
7099
7100         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7101         candidates before doing symbol resolution.
7102
7103         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7104         ODR candidates if only one is weak.
7105
7106 2010-01-08  Ian Lance Taylor  <iant@google.com>
7107
7108         * script.cc (Version_script_info::build_expression_list_lookup):
7109         Don't warn about ambiguous version, just record the ambiguity.
7110         (Version_script_info::get_symbol_version_helper): Give error if
7111         version is ambiguous.
7112
7113 2010-01-08  Doug Kwan  <dougkwan@google.com>
7114
7115         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7116           prev_data_size_ and prev_addralign_.  Remove initializer for
7117           deleted data member has_been_changed_.
7118           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7119           to determine if the table is empty.
7120           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7121           Remove.
7122           (Stub_table::add_reloc_stub): Define method in class definition
7123           instead of just declaring it there.
7124           (Stub_table::add_cortex_a8_stub): New method definition.
7125           (Stub_table::update_data_size_and_addralign): Ditto.
7126           (Stub_table::finalize_stubs): Ditto.
7127           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7128           (Stub_table::do_addralign_): Return address alignment in the
7129           (Stub_table::do_reset_address_and_file_offset): Define method in
7130           class definition instead of declaring it there.  Set current data
7131           size to be the data size of the previous pass.
7132           (Stub_table::set_final_data_size): Use current data size as the
7133           final data size.
7134           (Stub_table::relocate_stub): Change parameter type of stub from
7135           Reloc_stub pointer to Stub pointer.
7136           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7137           (Stub_table::Cortex_a8_stub_list): New typedef.
7138           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7139            Stub_table::prev_addralign_): New data member.
7140           (Arm_relobj::Arm_relobj): Initialize data member
7141           section_has_cortex_a8_workaround_.
7142           (Arm_relobj::section_has_cortex_a8_workaround,
7143            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7144            definitions.
7145           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7146           declarations.
7147           (Target_arm::relocate_stub): Change parameter type of stub from
7148           Reloc_stub pointer to Stub pointer.
7149           (Insn_template::size, Insn_template::alignment): Handle
7150           THUMB16_SPECIAL_TYPE.
7151           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7152            Stub_table::update_data_size_and_addralign,
7153            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7154           definitions.
7155           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7156           (Stub_table::do_write): Ditto.
7157           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7158
7159 2010-01-08  Ian Lance Taylor  <iant@google.com>
7160
7161         PR 11108
7162         * symtab.h (class Symbol): Remove fields is_target_special_ and
7163         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7164         (Symbol::is_defined_in_discarded_section): New function.
7165         (Symbol::set_is_defined_in_discarded_section): New function.
7166         (Symbol::has_plt_offset): Rewrite.
7167         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7168         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7169         Don't initialize is_target_special_ or has_plt_offset_.
7170         Initialize is_defined_in_discarded_section_.
7171         (Symbol_table::add_from_relobj): If appropriate, set
7172         is_defined_in_discarded_section.
7173         * resolve.cc (Symbol::override_base_with_special): Don't test
7174         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7175         * target-reloc.h (relocate_section): Do special handling for
7176         symbols defined in discarded sections for global symbols as well
7177         as local symbols.
7178
7179 2010-01-08  Ian Lance Taylor  <iant@google.com>
7180
7181         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7182         the SHT_SYMTAB case.
7183
7184 2010-01-08  Ian Lance Taylor  <iant@google.com>
7185
7186         * object.cc (Sized_relobj::do_layout): Don't get confused if
7187         layout_eh_frame returns NULL.
7188
7189 2010-01-08  Ian Lance Taylor  <iant@google.com>
7190
7191         PR 11084
7192         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7193         dynamic symbol table, use the normal symbol table.
7194         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7195         symbol table.
7196
7197 2010-01-08  Ian Lance Taylor  <iant@google.com>
7198
7199         PR 11072
7200         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7201         sections.
7202
7203 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7204
7205         * version.cc (print_version): Change to "Copyright 2010".
7206
7207 2010-01-08  Ian Lance Taylor  <iant@google.com>
7208
7209         PR 10287
7210         PR 11063
7211         * i386.cc (class Target_i386): Change return type of plt_section
7212         to be non-const.
7213         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7214         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7215         tls_desc_rel_ field.
7216         (Output_data_plt_i386::rel_tls_desc): New function.
7217         (Target_i386::rel_tls_desc_section): New function.
7218         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7219         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7220         R_386_TLS_DESC reloc in rel_tls_desc_section.
7221         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7222         Define struct Tlsdesc_info.
7223         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7224         (Target_x86_64::do_reloc_symbol_index): New function.
7225         (Target_x86_64::add_tlsdesc_info): New function.
7226         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7227         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7228         tlsdesc_rel_ field.
7229         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7230         all callers.
7231         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7232         (Target_x86_64::rela_tlsdesc_section): New function.
7233         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7234         handling.
7235         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7236         (Target_x86_64::do_reloc_addend): New function.
7237         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7238         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7239         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7240         (Output_reloc::type): New function.
7241         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7242         (Output_reloc::is_target_specific): New function.
7243         (Output_reloc::target_arg): New function.
7244         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7245         absolute relocs and target specific relocs.
7246         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7247         add_target_specific.
7248         (class Output_data_reloc) [SHT_RELA]: Likewise.
7249         * output.cc (Output_reloc::Output_reloc): Add four new versions
7250         for absolute relocs and target specific relocs.
7251         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7252         (Output_reloc::get_symbol_index): Likewise.
7253         (Output_reloc::local_section_offset): Check that local_sym_index_
7254         is not TARGET_CODE or 0.
7255         (Output_reloc::symbol_value): Likewise.
7256         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7257         reloc.
7258         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7259         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7260         functions.
7261         * layout.cc (add_target_dynamic_tags): Use output section for
7262         DT_PLTRELSZ and DT_JMPREL.
7263
7264 2010-01-07  Ian Lance Taylor  <iant@google.com>
7265
7266         PR 11061
7267         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7268         function.
7269         (class Output_data_reloc_generic): Define.
7270         (class Output_data_reloc_base): Change base class to
7271         Output_data_reloc_generic.  Change add() method to call
7272         bump_relative_reloc_count for a relative reloc.  Remove
7273         sort_relocs_ field.
7274         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7275         to sort_relocs().
7276         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7277         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7278         appropriate.
7279         * layout.h (class Layout): Update declaration.
7280
7281 2010-01-07  Ian Lance Taylor  <iant@google.com>
7282
7283         * output.h (class Output_data): Add const version of
7284         output_section and do_output_section.
7285         (class Output_section_data): Add const version of
7286         do_output_section.
7287         (class Output_section): Likewise.
7288         * layout.cc (Layout::add_target_dynamic_tags): New function.
7289         * layout.h (class Layout): Update declarations.
7290         * arm.cc (Target_arm::do_finalize_sections): Use
7291         add_target_dynamic_tags.
7292         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7293         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7294         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7295         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7296
7297 2010-01-07  Ian Lance Taylor  <iant@google.com>
7298
7299         PR 11042
7300         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7301         object as needed.
7302
7303 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7304             Ian Lance Taylor  <iant@google.com>
7305
7306         PR 11019
7307         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7308         Xindex::read_symtab_xindex.
7309
7310 2010-01-07  Doug Kwan  <dougkwan@google.com>
7311
7312         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7313         (Insn_template::thumb16_bcond_insn): New method declaration.
7314         (Insn_template): Fix spelling.
7315         (Stub::thumb16_special): New method declaration.
7316         (Stub::do_write): Define virtual method which was previously pure
7317         virtual.
7318         (Stub::do_thumb16_special): New method declaration.
7319         (Stub::do_fixed_endian_write): New template member.
7320         (Reloc_stub::do_write): Remove.
7321         (Reloc_stub::do_fixed_endian_write): Remove.
7322         (Cortex_a8_stub): New class definition.
7323         (Stub_factory::make_cortex_a8_stub): New method definition.
7324         (Stub_factory::Stub_factory): Add missing static storage class
7325         qualifier for elf32_arm_stub_a8_veneer_blx.
7326
7327 2010-01-07  Ian Lance Taylor  <iant@google.com>
7328
7329         PR 10980
7330         * options.h (class General_options): Add --warn-unresolved-symbols
7331         and --error-unresolved-symbols.
7332         * errors.cc (Errors::undefined_symbol): Implement
7333         --warn-unresolved-symbols.
7334
7335         * options.h (class General_options): Add -z text and -z textoff.
7336         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7337
7338 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7339
7340         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7341         (Garbage_collection::cident_sections): New function.
7342         (Garbage_collection::add_cident_section): New function.
7343         (Garbage_collection::cident_sections_): New member.
7344         (gc_process_relocs): Add references to sections whose names are C
7345         identifiers.
7346         * gold.h (cident_section_start_prefix): New constant.
7347         (cident_section_stop_prefix): New constant.
7348         (is_cident): New function.
7349         * layout.cc (Layout::define_section_symbols): Replace string constants
7350         with the newly defined constants.
7351         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7352         C identifiers.
7353         * testsuite/Makefile.am: Add gc_orphan_section_test.
7354         * testsuite/Makefile.in: Regenerate.
7355         * testsuite/gc_orphan_section_test.cc: New file.
7356         * testsuite/gc_orphan_section_test.sh: New file.
7357
7358 2010-01-06  Ian Lance Taylor  <iant@google.com>
7359
7360         PR 10980
7361         * options.h (class General_options): Add --warn-shared-textrel.
7362         * layout.cc (Layout::finish_dynamic_section): Implement
7363         --warn-shared-textrel.
7364
7365         PR 10980
7366         * options.h (class General_options): Add --warn-multiple-gp.
7367
7368 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7369
7370         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7371         $(THREADSLIB) and $(LIBDL).
7372         * Makefile.in: Rebuild.
7373
7374 2010-01-06  Ian Lance Taylor  <iant@google.com>
7375
7376         PR 10980
7377         * options.cc (General_options::parse_section_start): New function.
7378         (General_options::section_start): New function.
7379         (General_options::General_options): Initialize all members.
7380         * options.h: Include <map>
7381         (class General_options): Add --section-start.  Add section_starts_
7382         member.
7383         * layout.cc (Layout::attach_allocated_section_to_segment): If
7384         --section-start was used, set the address of the segment.  Remove
7385         local sort_sections.
7386         (Layout::relaxation_loop_body): If the address of the load segment
7387         has been set by --section-start, don't use it.
7388         * output.h (Output_segment::update_flags_for_output_section): New
7389         function.
7390         * output.cc (Output_segment::add_output_section): Call
7391         update_flags_for_output_section.
7392
7393 2010-01-05  Ian Lance Taylor  <iant@google.com>
7394
7395         PR 10980
7396         * options.h (class General_options): Add --undefined-version.
7397         * script.cc (struct Version_expression): Add was_matched_by_symbol
7398         field.
7399         (Version_script_info::matched_symbol): New function.
7400         (Version_script_info::get_symbol_version_helper): Call
7401         matched_symbol.
7402         (Version_script_info::check_unmatched_names): New function.
7403         * script.h (class Version_script_info): Update declarations.
7404         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7405
7406         * options.h (class General_options): Use DEFINE_bool_alias for
7407         allow_multiple_definition.
7408         * resolve.cc (Symbol_table::should_override): Don't test
7409         allow_multiple_definition.
7410
7411         PR 10980
7412         * options.h (class General_options): Add --cref.
7413         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7414         until after printing cref table.
7415         * cref.cc: Include "symtab.h".
7416         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7417         (Cref_table_compare::operator()): New function.
7418         (Cref_inputs::gather_cref): New function.
7419         (filecol): New static const.
7420         (Cref_inputs::print_cref): New function.
7421         (Cref::print_cref): New function.
7422         * cref.h: Include <cstdio>.
7423         (class Cref): Update declarations.
7424         * mapfile.h (Mapfile::file): New function.
7425         * object.h (class Object): Define Symbols.  Declare virtual
7426         do_get_global_symbols.
7427         (Object::get_global_symbols): New function.
7428         * object.cc (Input_objects::add_object): Pass object to cref_ if
7429         --cref.
7430         (Input_objects::archive_start): Likewise.
7431         (Input_objects::archive_stop): Likewise.
7432         (Input_objects::print_cref): New function.
7433         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7434         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7435         --cref.
7436         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7437         function.
7438         * plugin.h (class Sized_pluginobj): Update declarations.
7439
7440 2010-01-05  Ian Lance Taylor  <iant@google.com>
7441
7442         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7443         to is_default_version.  Rename insdef to insdefault.
7444         (Symbol_table::add_from_relobj): Rename def to is_default_version
7445         and local to is_forced_local.
7446         (Symbol_table::add_from_pluginobj): Likewise.
7447         (Symbol_table::add_from_dynobj): Likewise.
7448         (Symbol_table::define_special_symbol): Rename insdef to
7449         insdefault.
7450
7451 2010-01-04  Ian Lance Taylor  <iant@google.com>
7452
7453         PR 10980
7454         * options.h (class General_options): Add
7455         --allow-multiple-definition and -z muldefs.
7456         * resolve.cc (Symbol_table::should_override): Don't warn about a
7457         multiple symbol definition if --allow-multiple-definition or -z
7458         muldefs.
7459
7460         PR 10980
7461         * options.h (class General_options): Add --add-needed and
7462         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7463         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7464         error if --copy-dt-needed-entries aka --add-needed is used and
7465         would cause a change in behaviour.
7466
7467         PR 10980
7468         * options.h (class General_options): Add -G as a short version of
7469         --shared.  Add no-op options -assert, -g, and -i.
7470
7471 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7472
7473         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7474         check for .text or .gnu.linkonce.t sections.
7475         * icf.cc (Icf::find_identical_sections): Ditto.
7476         Change the detection for mangled function name within the section
7477         name.
7478         * icf.h (is_section_foldable_candidate): New function.
7479
7480 2009-12-30  Ian Lance Taylor  <iant@google.com>
7481
7482         PR 10980
7483         * options.h (class General_options): Permit two dashes with
7484         --retain-symbols-file.
7485
7486 2009-12-30  Ian Lance Taylor  <iant@google.com>
7487
7488         PR 10979
7489         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7490         don't put the file header and segment headers in the text
7491         segment.
7492
7493         PR 10979
7494         * common.cc (Sort_commons::operator()): Stabilize sort when both
7495         entries are NULL.
7496         (Symbol_table::do_allocate_commons_list): When allocating common
7497         symbols, skip a symbol which is no longer common.
7498         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7499         an object before checking its type.
7500         * testsuite/common_test_2.c: New file.
7501         * testsuite/common_test_3.c: New file.
7502         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7503         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7504         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7505         (common_test_2_pic.o, common_test_2.so): New targets.
7506         (common_test_3_pic.o, common_test_3.so): New targets.
7507         * testsuite/Makefile.in: Rebuild.
7508
7509         PR 10979
7510         * script.cc (read_input_script): If we see a new SECTIONS clause,
7511         and we have added an input section, give an error.
7512         * layout.h (class Layout): Add have_added_input_section function.
7513         Add have_added_input_section_ field.
7514         * layout.cc (Layout::Layout): Initialize
7515         have_added_input_section_.
7516         (Layout::layout): Set have_added_input_section_.
7517         (Layout::layout_eh_frame): Likewise.
7518
7519 2009-12-30  Ian Lance Taylor  <iant@google.com>
7520
7521         PR 10931
7522         * options.h (class General_options): Add --sort-common option.
7523         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7524         * common.cc (Sort_common): Add sort_order parameter to
7525         constructor.  Add sort_order_ field.
7526         (Sort_commons::operator): Check sort_order_.
7527         (Symbol_table::allocate_commons): Determine the sort order.
7528         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7529         Change all callers.
7530         (Symbol_table::do_allocate_commons_list): Likewise.
7531
7532 2009-12-30  Ian Lance Taylor  <iant@google.com>
7533
7534         PR 10916
7535         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7536         symbols from this object, don't change the visibility of an
7537         undefined symbol.
7538         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7539
7540 2009-12-30  Ian Lance Taylor  <iant@google.com>
7541
7542         PR 10861
7543         * script.h (class Version_script_info): Define Language enum.
7544         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7545         new fields globals_, locals_, and is_finalized_.
7546         * script.cc: Various formatting fixes.
7547         (class Parser_closure): Change language_stack_ from a vector of
7548         std::string to one of Version_script_info::Language.  Adjust all
7549         uses accordingly.
7550         (class Lazy_demangler): Remove.
7551         (struct Version_expression): Change language from std::string to
7552         Version_script_info::Language.
7553         (Version_script_info::Version_script_info): New function.
7554         (Version_script_info::~Version_script_info): Don't call clear.
7555         (Version_script_info::finalize): New function.
7556         (Version_script_info::build_lookup_tables): New function.
7557         (Version_script_info::build_expression_list_lookup): New
7558         function.
7559         (Version_script_info::get_symbol_version_helper): Rewrite to use
7560         lookup tables.
7561         (Version_script_info::print_expression_list): Adjust to use
7562         Version_script_info::Language.
7563         (script_push_lex_into_version_mode): Check that the version script
7564         has not been finalized.
7565         (version_script_push_lang): Change language string to
7566         Version_script_info::Language.
7567         * options.cc (Command_line::version_script): New function.
7568         * options.h (class General_options): Add finalize_dynamic_list
7569         function.  Change version_script from declaration to definition.
7570         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7571         * testsuite/version_script.map: Remove duplicate def of foo.
7572         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7573         version_script.map.
7574         * testsuite/Makefile.in: Rebuild.
7575
7576 2009-12-30  Ian Lance Taylor  <iant@google.com>
7577
7578         PR 10843
7579         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7580         if the input symbol index is 0, make the output symbol index 0.
7581
7582 2009-12-30  Ian Lance Taylor  <iant@google.com>
7583
7584         PR 10670
7585         * options.h (class General_options): Add -x/--discard-all.
7586         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7587         --discard-all.  If the local symbol needs a dynamic entry, check
7588         that before handling --discard-locals.
7589
7590 2009-12-30  Ian Lance Taylor  <iant@google.com>
7591
7592         PR 10450
7593         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7594         flags to PF_R.
7595         (Output_segment::add_output_section): Don't change the flags if
7596         the type is PT_TLS.
7597
7598         PR 10450
7599         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7600         GNU hash table if they need a dynamic value.  Otherwise, don't add
7601         them if they are defined in a dynamic object or are forced local.
7602
7603 2009-12-29  Ian Lance Taylor  <iant@google.com>
7604
7605         PR 10450
7606         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7607         .gnu.hash table for a 32-bit target.
7608
7609         PR 10450
7610         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7611         regular and a dynamic object only needs a dynamic symbol table
7612         entry if it is externally visible.
7613
7614         PR 10450
7615         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7616         constructor.  Add global_offset_table_ field.
7617         (Target_i386::got_section): Set global_offset_table_.
7618         (Target_i386::do_finalize_sections): Set global_offset_table_
7619         size.
7620         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7621         in constructor.  Add global_offset_table_ field.
7622         (Target_x86_64::got_section): Set global_offset_table_.
7623         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7624         size.
7625
7626         * layout.cc (Layout::Layout): Initialize increase_relro_.
7627         (Layout::get_output_section): Add is_relro, is_last_relro, and
7628         is_first_non_relro parameters.  Change all callers.
7629         (Layout::choose_output_section): Likewise.
7630         (Layout::add_output_section_data): Likewise.
7631         (Layout::make_output_section): Likewise.
7632         (Layout::set_segment_offsets): Clear increase_relro when using a
7633         linker script.
7634         * layout.h (class Layout): Add increase_relro method.  Add
7635         increase_relro_ field.  Update declarations.
7636         * output.cc (Output_section::Output_section): Initialize
7637         is_last_relro_ and is_first_non_relro_.
7638         (Output_segment::add_output_section): Group relro sections is
7639         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7640         (Output_segment::maximum_alignment): Remove relro handling.
7641         (Output_segment::set_section_addresses): Add increase_relro
7642         parameter.  Change all callers.  Add initial alignment to align
7643         relro sections on separate page.  Remove old relro handling.
7644         (Output_segment::set_section_list_addresses): Remove in_relro
7645         parameter.  Change all callers.
7646         (Output_segment::set_offset): Add increase parameter.  Change all
7647         callers.  Remove old relro handling.
7648         * output.h (class Output_section): Add new methods: is_last_relro,
7649         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7650         Add is_last_relro_ and is_first_non_relro_ fields.
7651         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7652         Create separate .got.plt section.  Call increase_relro.
7653         * x86_64.cc (Target_x86_64::got_section): Likewise.
7654         * testsuite/relro_script_test.t: Add .got.plt.
7655
7656         PR 10450
7657         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7658         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7659         (Layout::finalize): Call set_dynamic_symbol_size.
7660         (Layout::set_dynamic_symbol_size): New function.
7661         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7662         set_dynamic_symbol_size.
7663
7664         PR 10450
7665         * output.h (class Output_section): Add is_entsize_zero_ field.
7666         * output.cc (Output_section::Output_section): Initialize
7667         is_entsize_zero_.
7668         (Output_section::set_entsize): If two different entsizes are
7669         requested, force it to zero.
7670         (Output_section::add_input_section): Set flags for .debug_str
7671         before updating section flags.  Set entsize.
7672         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7673         and SHF_STRING if all input sections have those flags.
7674
7675 2009-12-29   Rafael Espindola  <espindola@google.com>
7676
7677         * main.cc (main): Fix the sys time reporting.
7678         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7679         reporting.
7680
7681 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7682
7683         * options.cc (General_options::parse_version): Allow -v to exit
7684         without an error if there is nothing to link.
7685
7686 2009-12-29  Ian Lance Taylor  <iant@google.com>
7687
7688         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7689         using a version of gcc before 4.1.
7690         * configure: Rebuild.
7691
7692 2009-12-28  Chris Demetriou  <cgd@google.com>
7693
7694         * attributes.cc (Output_attributes_section_data::do_write): Use
7695         std::vector::front rather than std::vector::data.
7696
7697 2009-12-28  Ian Lance Taylor  <iant@google.com>
7698
7699         * symtab.h (class Symbol_table): Add enum Defined.
7700         * resolve.cc (Symbol_table::should_override): Add defined
7701         parameter.  Change all callers.  Test whether object is NULL
7702         before calling a method on it.
7703         (Symbol_table::report_resolve_problem): Add defined parameter.
7704         Change all callers.
7705         (Symbol_table::should_override_with_special): Likewise.
7706         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7707         parameter.  Change all callers.
7708         (Symbol_table::do_define_in_output_data): Likewise.
7709         (Symbol_table::define_in_output_segment): Likewise.
7710         (Symbol_table::do_define_in_output_segment): Likewise.
7711         (Symbol_table::define_as_constant): Likewise.
7712         (Symbol_table::do_define_as_constant): Likewise.
7713         * script.h (class Symbol_assignment): Add is_defsym parameter to
7714         constructor; change all callers.
7715         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7716         parameter.  Change all callers.  Add is_defsym_ field.
7717         (class Parser_closure): Add parsing_defsym parameter to
7718         constructor; change all callers.  Add parsing_defsym accessor
7719         function.  Add parsing_defsym_ field.
7720
7721 2009-12-28  Ian Lance Taylor  <iant@google.com>
7722
7723         * gold.cc (queue_middle_tasks): Fix formatting.
7724         * object.cc (Relobj::is_section_name_included): Likewise.
7725
7726 2009-12-23  Ian Lance Taylor  <iant@google.com>
7727
7728         * i386.cc (Target_i386::do_calls_non_split): Recognize
7729         -fsplit-stack prologue for a function with a static chain.
7730         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7731         -fsplit-stack prologue when using %r11.
7732
7733 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7734
7735         * options.cc (General_options::parse_version): Make -v continue and do
7736         the link like GNU ld does.
7737
7738 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7739
7740         * Makefile.am (CCFILES): Add timer.cc.
7741         (HFILES): Add timer.h.
7742         * configure.ac: Check for sysconf and times.
7743         * main.cc: include timer.h.
7744         (main): Use Timer instead of get_run_time.
7745         * timer.cc: New.
7746         * timer.h: New.
7747         * workqueue.cc: include timer.h.
7748         (Workqueue::find_and_run_task):
7749         Report user, sys and wall time.
7750         * Makefile.in: Regenerate.
7751         * config.in: Regenerate.
7752         * configure: Regenerate.
7753
7754 2009-12-16  Doug Kwan  <dougkwan@google.com>
7755
7756         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7757         sections.
7758         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7759         relaxed input sections.
7760         * output.cc (Output_section::find_relaxed_input_section): Change
7761         return type to Output_relaxed_input_section pointer.  Adjust code
7762         for new type of relaxed_input_section_map_.
7763         * output.h (Output_section::find_relaxed_input_section): Change
7764         return type to Output_relaxed_input_section pointer.
7765         (Output_section::Output_relaxed_input_section_by_input_section_map):
7766         New type.
7767         (Output_section::relaxed_input_section_map_): Change type to
7768         Output_section::Output_relaxed_input_section_by_input_section_map.
7769         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7770         input section.
7771
7772 2009-12-15  Ian Lance Taylor  <iant@google.com>
7773
7774         * layout.cc (Layout::create_shstrtab): Only write out after input
7775         sections if we are compressing debug sections.
7776
7777 2009-12-15  Ian Lance Taylor  <iant@google.com>
7778
7779         * archive.cc (Archive::add_symbols): Only look up a symbol without
7780         a version if there is, in fact, a version.
7781
7782 2009-12-14  Ian Lance Taylor  <iant@google.com>
7783
7784         Revert -Wshadow changes, all changes from:
7785         2009-12-11  Doug Kwan  <dougkwan@google.com>
7786         2009-12-11  Nick Clifton  <nickc@redhat.com>
7787         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7788
7789 2009-12-11  Doug Kwan  <dougkwan@google.com>
7790
7791         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7792         due to -Wshadow.
7793         * attributes.cc (Object_attribute::size): Ditto.
7794         (Attributes_section_data::size): Ditto.
7795         (Attributes_section_data::Attributes_section_data): Ditto.
7796         (Output_attributes_section_data::do_write): Ditto.
7797         * attributes.h (Object_attribute::set_type): Ditto.
7798         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7799
7800 2009-12-11  Nick Clifton  <nickc@redhat.com>
7801
7802         * archive.cc: Fix shadowed variable warnings.
7803         * arm.cc: Likewise.
7804         * compressed_output.cc: Likewise.
7805         * compressed_output.h: Likewise.
7806         * configure: Likewise.
7807         * dwarf_reader.cc: Likewise.
7808         * dynobj.cc: Likewise.
7809         * dynobj.h: Likewise.
7810         * ehframe.cc: Likewise.
7811         * ehframe.h: Likewise.
7812         * errors.cc: Likewise.
7813         * expression.cc: Likewise.
7814         * fileread.cc: Likewise.
7815         * fileread.h: Likewise.
7816         * freebsd.h: Likewise.
7817         * i386.cc: Likewise.
7818         * icf.cc: Likewise.
7819         * incremental.h: Likewise.
7820         * layout.cc: Likewise.
7821         * layout.h: Likewise.
7822         * mapfile.cc: Likewise.
7823         * merge.cc: Likewise.
7824         * merge.h: Likewise.
7825         * object.cc: Likewise.
7826         * object.h: Likewise.
7827         * options.h: Likewise.
7828         * output.cc: Likewise.
7829         * output.h: Likewise.
7830         * parameters.cc: Likewise.
7831         * plugin.cc: Likewise.
7832         * powerpc.cc: Likewise.
7833         * reduced_debug_output.cc: Likewise.
7834         * reduced_debug_output.h: Likewise.
7835         * reloc.cc: Likewise.
7836         * reloc.h: Likewise.
7837         * resolve.cc: Likewise.
7838         * script-sections.cc: Likewise.
7839         * script.cc: Likewise.
7840         * script.h: Likewise.
7841         * sparc.cc: Likewise.
7842         * symtab.cc: Likewise.
7843         * symtab.h: Likewise.
7844         * target-select.cc: Likewise.
7845         * target-select.h: Likewise.
7846         * token.h: Likewise.
7847         * workqueue.cc: Likewise.
7848         * workqueue.h: Likewise.
7849         * x86_64.cc: Likewise.
7850
7851 2009-12-10  Doug Kwan  <dougkwan@google.com>
7852
7853         * arm.cc (attributes.h): New include.
7854         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7855         (Arm_relobj::~Arm_relobj): Delete object pointed by
7856         attributes_section_data_.
7857         (Arm_relobj::attributes_section_data): New method definition.
7858         (Arm_relobj::attributes_section_data_): New data member declaration.
7859         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7860         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7861         attributes_section_data_.
7862         (Arm_dynobj::attributes_section_data): New method definition.
7863         (Arm_dynobj::attributes_section_data_): New data member declaration.
7864         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7865         initialization value of may_use_blx_ to false.
7866         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7867         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7868         object attributes to compute results instead of hard-coding.
7869         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7870         Target_arm::get_secondary_compatible_arch,
7871         Target_arm::set_secondary_compatible_arch
7872         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7873         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7874         New method declarations.
7875         (Target_arm::get_aeabi_object_attribute): New method definition.
7876         (Target_arm::attributes_section_data_): New data member declaration.
7877         (read_arm_attributes_section): New template definition.
7878         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7879         (Arm_dynobj::do_read_symbols): Ditto.
7880         (Target_arm::do_finalize_sections): Merge attributes sections from
7881         input.  Check for BLX use after attributes section merging.
7882         Fix __exidx_start and __exidx_end visibility.  Create an
7883         .ARM.attributes section if necessary.
7884         (Target_arm::get_secondary_compatible_arch,
7885         Target_arm::set_secondary_compatible_arch,
7886         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7887         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7888         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7889         New method definitions.
7890
7891 2009-12-09  Ian Lance Taylor  <iant@google.com>
7892
7893         * plugin.cc (Plugin::load): Don't cast from void* to a function
7894         pointer.
7895
7896 2009-12-09  Ian Lance Taylor  <iant@google.com>
7897
7898         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7899         information fields.
7900
7901 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7902
7903         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7904         Replace two_file_shared_1.so with two_file_shared_2.so.
7905         * testsuite/Makefile.in: Regenerated.
7906
7907 2009-12-08  Doug Kwan  <dougkwan@google.com>
7908
7909         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7910         (HFILES): Add attributes.h and int_encoding.h.
7911         * Makefile.in: Regenerate.
7912         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7913         function definitions to int_encoding.cc
7914         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7915         prototypes to int_encoding.h
7916         * reduced_debug_output.cc (int_encoding.h): New include.
7917         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7918         function definitions to int_encoding.cc
7919         (insert_into_vector, read_from_pointer): Move template definitions to
7920         int_encoding.h
7921         * attributes.cc: New file.
7922         * attributes.h: New file.
7923         * int_encoding.cc: New file.
7924         * int_encoding.h: New file.
7925
7926 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7927
7928         PR gold/11055
7929         * incremental-dump.cc (dump_incremental_inputs): New.
7930         (main): Use dump_incremental_inputs.
7931
7932 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7933
7934         PR gold/10893
7935         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7936         checking elfcpp::STT_FUNC.
7937         (Target_i386::Relocate::relocate): Likewise.
7938         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7939
7940         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7941         symbols from shared libraries into normal FUNC symbols.
7942
7943         * symtab.h (Symbol): Add is_func and use it.
7944
7945 2009-12-05  Doug Kwan  <dougkwan@google.com>
7946
7947         * arm.cc (Target_arm::arm_info): Initialize new fields
7948         attributes_section and attributes_vendor.
7949         * i386.cc (Target_i386::i386_info): Same.
7950         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7951         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7952         fields attributes_section and attributes_vendor.
7953         * sparc.cc (Target_sparc::sparc_info): Same.
7954         * target.h (Target::attributes_section, Target::attributes_vendor,
7955         Target::is_attributes_section, Target::attribute_arg_type,
7956         Target::attributes_order): New method definitions.
7957         (Target::Target_info::attributes_section,
7958         Target::Target_info::attributes_vendor): New fields.
7959         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7960         virtual method definitions.
7961         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7962         attributes_section and attributes_vendor.
7963         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7964
7965 2009-12-05  Doug Kwan  <dougkwan@google.com>
7966
7967         * arm.cc: Update comments about interworking and stub generation.
7968         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7969         considered as non-PIC.
7970         (Arm_relocate_functions::base_abs): Fix formatting.
7971         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7972         of function to use GOT entry address instead of offset.
7973         (Target_arm::Scan::global): Issue an error if a symbol would need a
7974         PLT does not get one because it is untyped.  Remove code to create
7975         dynamic symbols for relative branches.
7976         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7977         takes unsigned integer instead of boolean.
7978
7979 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7980
7981         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7982         (two_file_test_LDADD): Likewise.
7983         (common_test_1_LDADD): Likewise.
7984         (exception_test_LDADD) Likewise.
7985         (weak_test_LDADD): Likewise.
7986         (many_sections_test_LDADD): Likewise.
7987         (initpri1_LDADD): Likewise.
7988         (script_test_1_LDADD): Likewise.
7989         (script_test_2_LDADD): Likewise.
7990         (justsyms_LDADD): Likewise.
7991         (binary_test_LDADD): Likewise.
7992         (large_LDADD): Likewise.
7993         * testsuite/Makefile.in: Regenerated.
7994
7995 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7996
7997         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7998         (Symbol_table::override_with_special): Likewise.
7999         (Symbol_table::add_from_object): Likewise.
8000
8001 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8002
8003         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8004         Don't set the data_offset twice.
8005
8006 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8007
8008         * testsuite/Makefile.in: Regenerate.
8009
8010 2009-12-03  Doug Kwan  <dougkwan@google.com>
8011
8012         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8013         (Target_arm::do_finalize_sections): Add parameter for symbol table
8014         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8015         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8016         parameter for symbol table pointer.
8017         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8018         an additional parameter for a pointer to symbol table.
8019         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8020         parameter for a symbol table pointer.
8021         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8022         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8023         Ditto.
8024         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8025         parameter for a symbol table pointer.
8026
8027 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8028
8029         * incremental.cc (Incremental_inputs_header)
8030         (Incremental_inputs_header_write, Incremental_inputs_entry)
8031         (Incremental_inputs_entry_write): Move ...
8032         * incremental.h (Incremental_inputs_header)
8033         (Incremental_inputs_header_write, Incremental_inputs_entry)
8034         (Incremental_inputs_entry_write): here.
8035
8036 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8037
8038         * incremental.cc (make_sized_incremental_binary): Set the target.
8039         Error if it is incompatible.
8040         * output.h (Output_file): Add filename method.
8041
8042 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8043
8044         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8045         from the get_* methods.
8046
8047 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8048
8049         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8050         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8051         Write 0 for the data_offset of scripts.
8052
8053 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8054
8055         * testsuite/Makefile.am: Add the incremental_test.sh test.
8056         * testsuite/incremental_test.sh: New.
8057         * testsuite/incremental_test_1.c: New.
8058         * testsuite/incremental_test_2.c: New.
8059
8060 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8061
8062        * incremental-dump.cc (main): Fix typos.
8063
8064 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8065
8066         PR gold/11025
8067         * incremental-dump.cc (main): Use llu to print 64 bit values.
8068
8069 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8070             H.J. Lu  <hongjiu.lu@intel.com>
8071
8072         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8073         $(LIBDL).
8074         (incremental_dump_LDADD): Likewise.
8075         * Makefile.in: Regenerated.
8076
8077 2009-11-25  Doug Kwan  <dougkwan@google.com>
8078
8079         Revert:
8080
8081         2009-11-25  Doug Kwan  <dougkwan@google.com>
8082
8083                 * arm.cc (Target_arm::Target_arm): Move method definition
8084                 outside of class definition.  Add code to handle
8085                 --target1-rel, --target1-abs and --target2= options.
8086                 (Target_arm::get_reloc_reloc_type): Change method to be
8087                 non-static and const.
8088                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8089                 New data member declaration.
8090                 (Target_arm::Scan::local, Target_arm::Scan::global,
8091                 Target_arm::Relocate::relocate,
8092                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8093                 Adjust call to Target_arm::get_real_reloc_type.
8094                 (Target_arm::get_real_reloc_type): Use command line options
8095                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8096                 * options.h (--target1-rel, --target1-abs, --target2): New
8097                 ARM-only options.
8098
8099 2009-11-25  Doug Kwan  <dougkwan@google.com>
8100
8101         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8102         class definition.  Add code to handle --target1-rel, --target1-abs
8103         and --target2= options.
8104         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8105         and const.
8106         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8107         member declaration.
8108         (Target_arm::Scan::local, Target_arm::Scan::global,
8109         Target_arm::Relocate::relocate,
8110         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8111         call to Target_arm::get_real_reloc_type.
8112         (Target_arm::get_real_reloc_type): Use command line options to
8113         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8114         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8115         options.
8116
8117 2009-11-25  Doug Kwan  <dougkwan@google.com>
8118
8119         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8120         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8121         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8122         formatting.
8123         (Arm_relocate_functions::thm_call): Replace body with a call to
8124         Arm_relocate_functions::thumb_branch_common.
8125         (Arm_relocate_functions::thm_jump24,
8126         Arm_relocate_functions::thm_xpc22): New method definitions.
8127         (Arm_relocate_functions::thumb_branch_common): New method definition.
8128         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8129         operator.
8130         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8131         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8132
8133 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8134
8135         * Makefile.am: Build incremental-dump
8136         * Makefile.in: Regenerate.
8137         * incremental-dump.cc: New.
8138         * incremental.cc (Incremental_inputs_header_data,
8139         Incremental_inputs_entry_data): Move to incremental.h
8140         * incremental.h: (Incremental_inputs_header_data,
8141         Incremental_inputs_entry_data): Move from incremental.cc
8142
8143 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8144
8145         * incremental.cc (Incremental_inputs_header,
8146         Incremental_inputs_header_write, Incremental_inputs_entry,
8147         Incremental_inputs_entry_write): Add a typedef with the data type.
8148
8149 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8150
8151         * incremental.cc (Incremental_inputs_header,
8152         Incremental_inputs_header_write, Incremental_inputs_entry,
8153         Incremental_inputs_entry_write): Update comment about which
8154         type has the filed descriptions.
8155
8156 2009-11-15  Doug Kwan  <dougkwan@google.com>
8157
8158         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8159         (Arm_relocate_functions::arm_branch_common): Change method defintion
8160         in class definition to a method declaration and update list of formal
8161         parameters.
8162         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8163         Arm_relocation_functions::jump24): Adjust call to
8164         Arm_relocate_functions::arm_branch_common.  Update list of formal
8165         parameters.
8166         (Arm_relocate_functions::xpc25): New method definition.
8167         (Arm_relocate_functions::arm_branch_common): Move method defintion
8168         out from class definition.  Use stubs for mode-switching and extending
8169         branch ranges.
8170         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8171         specially.  Change code to enable use of stubs in ARM branches.
8172
8173 2009-11-10  Doug Kwan  <dougkwan@google.com>
8174
8175         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8176         in method declaration.
8177         (Target_arm::relocate_stub): New method declaration.
8178         (Target_arm::default_target): Change to return a pointer instead of
8179         a const reference.
8180         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8181         Target_arm::default_target.
8182         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8183         method definition.
8184         (Target_arm::relocate_section): Adjust view.
8185         (Target_arm::relocate_stub): New method definition.
8186
8187 2009-11-10  Doug Kwan  <dougkwan@google.com>
8188
8189         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8190         a format warning.
8191         * incremental.cc (open_incremental_binary): Initialized local
8192         variables to avoid warnings.
8193         * object.cc (make_elf_object): Ditto.
8194         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8195         a format warning.
8196
8197 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8198
8199         PR gold/10930
8200         * testsuite/plugin_test.c: Include "config.h".
8201
8202 2009-11-09  Doug Kwan  <dougkwan@google.com>
8203
8204         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8205         (arm_symbol_value): Remove.
8206         (Arm_relocate_functions::arm_branch_common,
8207         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8208         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8209         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8210         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8211         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8212         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8213         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8214         Arm_relocate_functions::thm_mobw_abs_nc,
8215         Arm_relocate_functions::thm_mov_abs,
8216         Arm_relocate_functions::movw_prel_nc,
8217         Arm_relocate_functions::thm_movt_abs,
8218         Arm_relocate_functions::movt_prel,
8219         Arm_relocate_functions::thm_movw_prel_nc,
8220         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8221         (Target_arm::Relocate::relocate): Only decompose address into two
8222         parts if relocation type uses the thumb-bit and pass the actual
8223         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8224         calls to methods in Arm_relocate_functions for this change.
8225
8226 2009-11-08  Ian Lance Taylor  <iant@google.com>
8227
8228         PR 10925
8229         * reloc.cc: Instantiate
8230         Sized_relobj::initialize_input_to_output_maps and
8231         Sized_relobj:free_input_to_output_maps.
8232
8233 2009-11-06  Ian Lance Taylor  <iant@google.com>
8234
8235         PR 10876
8236         * defstd.cc (in_segment): Set only_if_ref true for "end".
8237
8238 2009-11-06  Doug Kwan  <dougkwan@google.com>
8239
8240         * arm.cc (class Reloc_stub): Correct a comment.
8241         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8242         (Target_arm::scan_section_for_stubs): New method declaration.
8243         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8244         Change methods from private to protected.
8245         (Target_arm::do_may_relax): New method definition.
8246         (Target_arm::do_relax, Target_arm::group_sections,
8247         Target_arm::scan_reloc_for_stub,
8248         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8249         (Target_arm::arm_input_section_map_): New data member declaration.
8250         (Target_arm::scan_reloc_for_stub,
8251         Target_arm::scan_reloc_section_for_stubs,
8252         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8253         Target_arm::do_relax): New method definitions.
8254
8255 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8256
8257         * configure.ac: Check for (struct stat)::st_mtim
8258         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8259         * config.in: Regenerate.
8260         * configure: Regenerate.
8261
8262 2009-11-05  Ian Lance Taylor  <iant@google.com>
8263
8264         PR 10910
8265         * output.cc (Output_segment::add_output_section): Add missing
8266         return statement.
8267
8268 2009-11-04  Ian Lance Taylor  <iant@google.com>
8269
8270         PR 10880
8271         * object.h (class Object): Add is_needed and set_is_needed
8272         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8273         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8274         defined in a dynamic object and referenced by a regular object,
8275         set is_needed for the dynamic object.
8276         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8277         if the file is marked with as_needed and it is not needed.
8278
8279 2009-11-04  Ian Lance Taylor  <iant@google.com>
8280
8281         PR 10887
8282         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8283         tags if data is discarded by linker script.
8284         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8285         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8286         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8287         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8288
8289 2009-11-04  Ian Lance Taylor  <iant@google.com>
8290
8291         * layout.cc (Layout::get_output_section): Add is_interp and
8292         is_dynamic_linker_section parameters.  Change all callers.
8293         (Layout::choose_output_section): Likewise.
8294         (Layout::make_output_section): Likewise.
8295         (Layout::add_output_section_data): Add is_dynamic_linker_section
8296         parameter.  Change all callers.
8297         * layout.h (class Layout): Update declarations.
8298         * output.h (class Output_section): Add is_interp, set_is_interp,
8299         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8300         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8301         generate_code_fills_at_write_ to a bitfield.
8302         * output.cc (Output_section::Output_sections): Initialize new
8303         fields.
8304         (Output_segment::add_output_section): Add do_sort parameter.
8305         Change all callers.
8306
8307 2009-11-03  Ian Lance Taylor  <iant@google.com>
8308
8309         PR 10860
8310         * options.h (class General_options): Add --warn-common.
8311         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8312         merging two common symbols.
8313         (Symbol_table::should_override): Handle --warn-common when merging
8314         a common symbol with a defined symbol.  Use report_resolve_problem
8315         for multiple definitions.
8316         (Symbol_table::report_resolve_problem): New function.
8317         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8318
8319 2009-11-03  Doug Kwan  <dougkwan@google.com>
8320
8321         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8322         stub_factory_.
8323         (Target_arm::stub_factory): New method definition.
8324         (Target_arm::new_arm_input_section,
8325         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8326         Target_arm::reloc_uses_thumb_bit): New method declarations.
8327         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8328         New type definitions.
8329         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8330         member declarations.
8331         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8332         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8333         New method definitions.
8334
8335 2009-11-03  Ian Lance Taylor  <iant@google.com>
8336
8337         * options.h (class General_options): Add --warn_constructors.
8338
8339 2009-11-03  Ian Lance Taylor  <iant@google.com>
8340
8341         PR 10893
8342         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8343         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8344
8345 2009-11-03  Ian Lance Taylor  <iant@google.com>
8346
8347         PR 10895
8348         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8349         --msgid-bugs-address.
8350         (install-pdf): New target.
8351         (install-data_yes): Look up one directory to find mkinstalldirs.
8352
8353 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8354
8355         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8356         tree.
8357
8358 2009-10-30  Doug Kwan  <dougkwan@google.com>
8359
8360         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8361
8362 2009-10-30  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Stub_addend_reader): New struct template definition
8365         and partial specializations.
8366         (Stub_addend_reader::operator()): New method definition for a
8367         partially specialized template.
8368
8369 2009-10-30  Doug Kwan  <dougkwan@google.com>
8370
8371         * arm.cc (Arm_relobj::processor_specific_flags): New method
8372         definition.
8373         (Arm_relobj::do_read_symbols): New method declaration.
8374         (Arm_relobj::processor_specific_flags_): New data member declaration.
8375         (Arm_dynobj): New class definition.
8376         (Target_arm::do_finalize_sections): Add input_objects parameter.
8377         (Target_arm::do_adjust_elf_header): New method declaration.
8378         (Target_arm::are_eabi_versions_compatible,
8379         (Target_arm::merge_processor_specific_flags): New method declaration.
8380         (Target_arm::do_make_elf_object): New overloaded method definitions
8381         and declaration.
8382         (Arm_relobj::do_read_symbols): New method definition.
8383         (Arm_dynobj::do_read_symbols): Ditto.
8384         (Target_arm::do_finalize_sections): Add input_objects parameters.
8385         Merge processor-specific flags from all input objects.
8386         (Target_arm::are_eabi_versions_compatible,
8387         Target_arm::merge_processor_specific_flags,
8388         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8389         New method definitions.
8390         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8391         Input_objects pointer type parameter.
8392         * layout.cc (Layout::finalize): Pass input objects to target's.
8393         finalize_sections function.
8394         * output.cc (Output_file_header::do_sized_write): Set ELF file
8395         header's processor-specific flags.
8396         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8397         Input_objects pointer type parameter.
8398         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8399         * target.h (Input_objects): New forward class declaration.
8400         (Target::processor_specific_flags,
8401         Target::are_processor_specific_flags_sect): New method definitions.
8402         (Target::finalize_sections): Add input_objects parameter.
8403         (Target::Target): Initialize processor_specific_flags_ and
8404         are_processor_specific_flags_set_.
8405         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8406         parameter.
8407         (Target::set_processor_specific_flags): New method definition.
8408         (Target::processor_specific_flags_,
8409         Target::are_processor_specific_flags_set_): New data member
8410         declarations.
8411         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8412         Input_objects pointer type parameter.
8413
8414 2009-10-30  Doug Kwan  <dougkwan@google.com>
8415
8416         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8417
8418 2009-10-28  Ian Lance Taylor  <iant@google.com>
8419
8420         * object.h (class Relobj): Drop options parameter from
8421         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8422         do_scan_relocs, do_relocate.  Change all callers.
8423         (class Sized_relobj): Drop options parameters from
8424         do_gc_process_relocs, do_scan_relocs, do_relocate,
8425         do_relocate_sections, relocate_sections, emit_relocs_scan,
8426         emit_relocs_scan_reltype.  Change all callers.
8427         (struct Relocate_info): Remove options field and all references to
8428         it.
8429         * reloc.h (class Read_relocs): Remove options constructor
8430         parameter and options_ field.  Change all callers.
8431         (class Gc_process_relocs, class Scan_relocs): Likewise.
8432         (class Relocate_task): Likewise.
8433         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8434         all callers.
8435         (scan_relocatable_relocs): Likewise.
8436         * target.h (class Sized_target): Remove options parameter from
8437         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8438         all callers.
8439         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8440         callers.
8441         * arm.cc: Update functions to remove options parameters.
8442         * i386.cc: Likewise.
8443         * powerpc.cc: Likewise.
8444         * sparc.cc: Likewise.
8445         * x86_64.cc: Likewise.
8446         * testsuite/testfile.cc: Likewise.
8447
8448 2009-10-28  Doug Kwan  <dougkwan@google.com>
8449
8450         * arm.cc (Arm_relobj): New class definition.
8451         (Arm_relobj::scan_sections_for_stubs,
8452         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8453         New method definitions.
8454
8455 2009-10-28  Cary Coutant  <ccoutant@google.com>
8456
8457         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8458         (Plugin::cleanup_done_): New member.
8459         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8460         (Plugin_manager::cleanup_done_): Remove.
8461         (Plugin_manager::add_input_file): Edit error message.
8462         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8463         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8464
8465 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8466
8467         * fileread.cc: (File_read::View::~View): Use the new
8468         data_ownership_ filed.
8469         (File_read::~File_read): Dispose the new whole_file_view_.
8470         (File_read::open): Mmap the whole file if needed.
8471         (File_read::open): Use whole_file_view_ instead of contents_.
8472         (File_read::find_view): Use whole_file_view_ if applicable.
8473         (File_read::do_read): Use whole_file_view_ instead of contents_.
8474         (File_read::make_view): Use whole_file_view_ instead of contents_,
8475         update File_read::View::View call.
8476         (File_read::find_or_make_view): Update File_read::View::View
8477         call.
8478         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8479         remove contents_
8480         (File_read::View::Data_ownership): New enum.
8481         (File_read::View::View): Replace bool mapped_ with Data_ownership
8482         argument.
8483         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8484         (File_read::View::data_ownership_): New field.
8485         (File_read::contents_): Remove (replaced by whole_file_view_).
8486         (File_read::whole_file_view_): New field.
8487         * options.h (class General_options): Add --keep-files-mapped.
8488
8489 2009-10-27  Cary Coutant  <ccoutant@google.com>
8490
8491         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8492         * testsuite/Makefile.am (plugin_test_5): New test case.
8493         * testsuite/Makefile.in: Regenerate.
8494
8495 2009-10-25  Doug Kwan  <dougkwan@google.com>
8496
8497         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8498         from private to protected to allow access by child class.
8499         (Sized_relobj::do_relocate_sections): New method declaration.
8500         (Sized_relobj::relocate_sections): Virtualize.
8501         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8502         Sized_relobj::relocate_sections.  Instantiate template explicitly
8503         for different target sizes and endianity.
8504
8505 2009-10-24  Doug Kwan  <dougkwan@google.com>
8506
8507         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8508         (Arm_input_section::as_arm_input_section): New method.
8509         (Arm_output_section): New class definition.
8510         (Arm_output_section::create_stub_group,
8511         Arm_output_section::group_sections): New method definitions.
8512
8513 2009-10-22  Doug Kwan  <dougkwan@google.com>
8514
8515         * arm.cc (Arm_input_section): New class definition.
8516         (Arm_input_section::init, Arm_input_section:do_write,
8517         Arm_input_section::set_final_data_size,
8518         Arm_input_section::do_reset_address_and_file_offset): New method
8519         definitions.
8520
8521 2009-10-21  Doug Kwan  <dougkwan@google.com>
8522
8523         * arm.cc (Stub_table, Arm_input_section): New forward class
8524         declarations.
8525         (Stub_table): New class defintion.
8526         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8527         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8528         New method definition.
8529
8530 2009-10-21  Doug Kwan  <dougkwan@google.com>
8531
8532         * arm.cc: Update copyright comments.
8533         (Target_arm): New forward class template declaration.
8534         (Arm_address): New type.
8535         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8536         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8537         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8538         constants.
8539         (Insn_template): Same.
8540         (DEF_STUBS): New macro.
8541         (Stub_type): New enum type.
8542         (Stub_template): New class definition.
8543         (Stub): Same.
8544         (Reloc_stub): Same.
8545         (Stub_factory): Same.
8546         (Target_arm::Target_arm): Initialize may_use_blx_ and
8547         should_force_pic_veneer_.
8548         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8549         Target_arm::should_force_pic_veneer,
8550         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8551         Target_arm::using_thumb_only, Target_arm:;default_target): New
8552         method defintions.
8553         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8554         New data member declarations.
8555         (Insn_template::size, Insn_template::alignment): New method defintions.
8556         (Stub_template::Stub_template): New method definition.
8557         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8558         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8559         (Stub_factory::Stub_factory): New method definition.
8560         * gold.h (string_hash): New template.
8561         * output.h (Input_section_specifier::hash_value): Use
8562         gold::string_hash.
8563         (Input_section_specifier::string_hash): Remove.
8564         * stringpool.cc (Stringpool_template::string_hash): Use
8565         gold::string_hash.
8566
8567 2009-10-20  Doug Kwan  <dougkwan@google.com>
8568
8569         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8570         symbols of relaxed input sections.
8571         * output.h (Output_section::find_relaxed_input_section): Make
8572         method public.
8573
8574 2009-10-16  Doug Kwan  <dougkwan@google.com>
8575
8576         * dynobj.cc (Versions::Versions): Initialize version_script_.
8577         Only insert base version symbol definition for a shared object
8578         if version script defines any version versions.
8579         (Versions::define_base_version): New method definition.
8580         (Versions::add_def): Check that base version is not needed.
8581         (Versions::add_need): Define base version lazily.
8582         * dynobj.h (Versions::define_base_version): New method declaration.
8583         (Versions::needs_base_version_): New data member declaration.
8584         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8585         (check_DATA): Add no_version_test.stdout.
8586         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8587         New make rules.
8588         * testsuite/Makefile.in: Regenerate.
8589         * testsuite/no_version_test.c: New file.
8590         * testsuite/no_version_test.sh: Ditto.
8591
8592 2009-10-16  Doug Kwan  <dougkwan@google.com>
8593
8594         * expression.cc (class Segment_start_expression): New class definition.
8595         (Segment_start_expression::value): New method definition.
8596         (script_exp_function_segment_start): Return a new
8597         Segment_start_expression.
8598         * gold/script-c.h (script_saw_segment_start_expression): New function
8599         prototype.
8600         * script-sections.cc (Script_sections::Script_sections): Initialize
8601         SAW_SEGMENT_START_EXPRESSION_ to false.
8602         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8603         and -Tbbs options to specify section addresses if given in
8604         command line and no SEGMENT_START expression is seen in a script.
8605         * script-sections.h (Script_sections::saw_segment_start_expression,
8606         Script_sections::set_saw_segment_start_expression): New method
8607         definition.
8608         (Script_sections::saw_segment_start_expression_): New data member
8609         declaration.
8610         * script.cc (script_saw_segment_start_expression): New function.
8611         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8612         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8613         script_test_7.sh and script_test_8.sh.
8614         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8615         script_test_8.stdout.
8616         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8617         (script_test_6, script_test_6.stdout, script_test_7,
8618         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8619         * Makefile.in: Regenerate.
8620         * testsuite/script_test_6.sh: New file.
8621         * testsuite/script_test_6.t: Same.
8622         * testsuite/script_test_7.sh: Same.
8623         * testsuite/script_test_7.t: Same.
8624         * testsuite/script_test_8.sh: Same.
8625
8626 2009-10-16  Doug Kwan  <dougkwan@google.com>
8627
8628         * output.cc (Output_segment::set_section_list_address): Cast
8629         expressions to unsigned long long type to avoid format warnings.
8630
8631 2009-10-15  Ian Lance Taylor  <iant@google.com>
8632
8633         * script.cc (Script_options::add_symbol_assignment): Always add a
8634         dot assignment to script_sections_.
8635         * script-sections.cc (Script_sections::add_dot_assignment):
8636         Initialize if necessary.
8637
8638         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8639         program headers with no load segment if there is a linker script.
8640
8641         * layout.cc (Layout::set_segment_offsets): Align the file offset
8642         to the segment aligment for -N or -n with no load segment.
8643         * output.cc (Output_segment::add_output_section): Don't crash if
8644         the first section is a TLS section.
8645         (Output_segment::set_section_list_addresses): Print an error
8646         message if the address moves backward in a linker script.
8647         * script-sections.cc
8648         (Output_section_element_input::set_section_addresses): Don't
8649         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8650         (Orphan_output_section::set_section_addresses): Likewise.
8651
8652 2009-10-15  Doug Kwan  <dougkwan@google.com>
8653
8654         * layout.cc (Layout::finish_dynamic_section): Generate tags
8655         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8656         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8657         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8658
8659 2009-10-14  Ian Lance Taylor  <iant@google.com>
8660
8661         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8662         fields.
8663         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8664         data_shdr fields of relinfo.
8665         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8666         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8667         R_386_TLS_LDO_32, adjust based on section flags.
8668         (Target_i386::Relocate::fix_up_ldo): Remove.
8669
8670 2009-10-13  Ian Lance Taylor  <iant@google.com>
8671
8672         Add support for -pie.
8673         * options.h (class General_options): Add -pie and
8674         --pic-executable.
8675         (General_options::output_is_position_independent): Test -pie.
8676         (General_options::output_is_executable): Return true if not shared
8677         and not relocatable.
8678         (General_options::output_is_pie): Remove.
8679         * options.cc (General_options::finalize): Reject incompatible uses
8680         of -pie.
8681         * gold.cc (queue_middle_tasks): A -pie link is not static.
8682         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8683         * symtab.cc (Symbol::final_value_is_known): Return false if
8684         output_is_position_independent.
8685         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8686         output_is_position_independent.
8687         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8688         output_is_position_independent.
8689         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8690         output_is_position_independent.
8691         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8692         two_file_pie_test.
8693         (basic_pie_test.o, basic_pie_test): New targets.
8694         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8695         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8696         (two_file_pie_test): New target.
8697         * testsuite/Makefile.in: Rebuild.
8698         * README: Remove note saying that -pie is not supported.
8699
8700 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8701
8702         * options.h (class General_options): Add -init and -fini.
8703         * layout.cc (Layout::finish_dynamic_section): Emit
8704         given init and fini functions.
8705
8706 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8707
8708         * gc.h (gc_process_relocs): Check if icf is enabled using new
8709         function.
8710         * gold.cc (queue_initial_tasks): Likewise.
8711         (queue_middle_tasks): Likewise.
8712         * object.cc (do_layout): Likewise.
8713         * symtab.cc (is_section_folded): Likewise.
8714         * main.cc (main): Likewise.
8715         * reloc.cc (Read_relocs::run): Likewise.
8716         (Sized_relobj::do_scan_relocs): Likewise.
8717         * icf.cc (is_function_ctor_or_dtor): New function.
8718         (Icf::find_identical_sections): Check if function is ctor or dtor when
8719         safe icf is chosen.
8720         * options.h (General_options::icf): Change option to be an enum.
8721         (Icf_status): New enum.
8722         (icf_enabled): New method.
8723         (icf_safe_folding): New method.
8724         (set_icf_status): New method.
8725         (icf_status_): New variable.
8726         * (options.cc) (General_options::finalize): Set icf_status_.
8727         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8728         icf_test and icf_keep_unique_test to use the --icf enum flag.
8729         * testsuite/icf_safe_test.sh: New file.
8730         * testsuite/icf_safe_test.cc: New file.
8731
8732 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8733
8734         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8735         includes to gc.h and icf.h.
8736         * arm.cc: Include gc.h.
8737         * gold.cc: Likewise.
8738         * i386.cc: Likewise.
8739         * powerpc.cc: Likewise.
8740         * sparc.cc: Likewise.
8741         * x86_64.cc: Likewise.
8742         * gc.h: Include icf.h.
8743
8744 2009-10-11  Ian Lance Taylor  <iant@google.com>
8745
8746         * plugin.cc: Include "gold.h" before other header files.
8747
8748 2009-10-10  Chris Demetriou  <cgd@google.com>
8749
8750         * options.h (Input_file_argument::Input_file_type): New enum.
8751         (Input_file_argument::is_lib_): Replace with...
8752         (Input_file_argument::type_): New member.
8753         (Input_file_argument::Input_file_argument): Take Input_file_type
8754         'type' rather than boolean 'is_lib' as second argument.
8755         (Input_file_argument::is_lib): Use type_.
8756         (Input_file_argument::is_searched_file): New function.
8757         (Input_file_argument::may_need_search): Handle is_searched_file.
8758         * options.cc (General_options::parse_library): Support -l:filename.
8759         (General_options::parse_just_symbols): Update for Input_file_argument
8760         changes.
8761         (Command_line::process): Likewise.
8762         * archive.cc (Archive::get_file_and_offset): Likewise.
8763         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8764         * script.cc (read_script_file, script_add_file): Likewise.
8765         * fileread.cc (Input_file::Input_file): Likewise.
8766         (Input_file::will_search_for): Handle is_searched_file.
8767         (Input_file::open): Likewise.
8768         * readsyms.cc (Read_symbols::get_name): Likewise.
8769         * testsuite/Makefile.am (searched_file_test): New test.
8770         * testsuite/Makefile.in: Regenerate.
8771         * testsuite/searched_file_test.cc: New file.
8772         * testsuite/searched_file_test_lib.cc: New file.
8773
8774 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8775             Ian Lance Taylor  <iant@google.com>
8776
8777         * descriptor.cc: Include <cstdio> and "binary-io.h".
8778         (Descriptors::open): Open the files in binary mode always.
8779         * script.cc (Lex::get_token): Treat \r as whitespace.
8780
8781 2009-10-09  Ian Lance Taylor  <iant@google.com>
8782
8783         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8784
8785 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8786             Ian Lance Taylor  <iant@google.com>
8787
8788         * configure.ac: Check for readv function also.
8789         * fileread.cc (readv): Define if not HAVE_READV.
8790         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8791         does not exist.
8792         * config.in: Regenerate.
8793         * configure: Regenerate.
8794
8795 2009-10-09  Doug Kwan  <dougkwan@google.com>
8796
8797         * layout.cc (Layout::make_output_section): Call target hook to make
8798         ordinary output section.
8799         (Layout::finalize): Adjust parameter list of call the
8800         Target::may_relax().
8801         * layout.h (class Layout::section_list): New method.
8802         * merge.h (Output_merge_base::entsize): Change visibility to public.
8803         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8804         New methods.
8805         (Output_merge_string::do_is_string): New method.
8806         * object.cc (Sized_relobj::do_setup): renamed from
8807         Sized_relobj::set_up.
8808         * object.h (Sized_relobj::adjust_shndx,
8809         Sized_relobj::initializ_input_to_output_maps,
8810         Sized_relobj::free_input_to_output_maps): Change visibilities to
8811         protected.
8812         (Sized_relobj::setup): Virtualize.
8813         (Sized_relobj::do_setup): New method declaration.
8814         (Sized_relobj::invalidate_section_offset,
8815         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8816         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8817         * options.cc (parse_int): New function.
8818         * options.h (parse_int): New declaration.
8819         (DEFINE_int): New macro.
8820         (stub_group_size): New option.
8821         * output.cc (Output_section::Output_section): Initialize memebers
8822         merge_section_map_, merge_section_by_properties_map_,
8823         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8824         (Output_section::add_input_section): Handled deferred code-fill
8825         generation and remove an old comment.
8826         (Output_section::add_relaxed_input_section): New method definition.
8827         (Output_section::add_merge_input_section): Use merge section by
8828         properties map to speed to search.  Update merge section maps
8829         as appropriate.
8830         (Output_section::build_relaxation_map): New method definition.
8831         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8832         Same.
8833         (Output_section::relax_input_section): Renamed to
8834         Output_section::convert_input_sections_to_relaxed_sections and change
8835         interface to take a vector of pointers to relaxed sections.
8836         (Output_section::find_merge_section,
8837         Output_section::find_relaxed_input_section): New method definitions.
8838         (Output_section::is_input_address_mapped,
8839         Output_section::output_offset, Output_section::output_address):
8840         Use output section data maps to speed up searching.
8841         (Output_section::find_starting_output_address): Add comments.
8842         (Output_section::do_write,
8843         Output_section::write_to_postprocessing_buffer): Do code-fill
8844         generation as appropriate.
8845         (Output_section::get_input_sections): Invalidate relaxed input section
8846         map.
8847         (Output_section::restore_states): Adjust type of checkpoint .
8848         Invalidate relaxed input section map.
8849         * output.h (Output_merge_base): New class declaration.
8850         (Input_section_specifier): New class defintion.
8851         (class Output_relaxed_input_section) Change base class to
8852         Output_section_data_build.
8853         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8854         base class initializer.
8855         (Output_section::add_relaxed_input_section): New method declaration.
8856         (Output_section::Input_section): Change visibility to protected.
8857         (Output_section::Input_section::relobj,
8858         Output_section::Input_section::shndx): Handle relaxed input sections.
8859         Output_section::input_sections) Change visibility to protected.  Also
8860         define overload to return a non-const pointer.
8861         (Output_section::Merge_section_properties): New class defintion.
8862         (Output_section::Merge_section_by_properties_map,
8863         Output_section::Output_section_data_by_input_section_map,
8864         Output_section::Relaxation_map): New types.
8865         (Output_section::relax_input_section): Rename method to
8866         Output_section::convert_input_sections_to_relaxed_sections and change
8867         interface to take a vector of relaxed section pointers.
8868         (Output_section::find_merge_section,
8869         Output_section::find_relaxed_input_section,
8870         Output_section::build_relaxation_map,
8871         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8872         New method declarations.
8873         (Output_section::merge_section_map_
8874         Output_section::merge_section_by_properties_map_,
8875         Output_section::relaxed_input_section_map_,
8876         Output_section::is_relaxed_input_section_map_valid_,
8877         Output_section::generate_code_fills_at_write_): New data members.
8878         * script-sections.cc
8879         (Output_section_element_input::set_section_addresses): Call
8880         current_data_size and addralign methods of relaxed input sections.
8881         (Orphan_output_section::set_section_addresses): Call current_data_size
8882         and addralign methods of relaxed input sections.
8883         * symtab.cc (Symbol_table::compute_final_value): Extract template
8884         from the body of Symbol_table::sized_finalize_symbol.
8885         (Symbol_table::sized_finalized_symbol): Call
8886         Symbol_table::compute_final_value.
8887         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8888         (Symbol_table::compute_final_value): New templated method declaration.
8889         * target.cc (Target::do_make_output_section): New method defintion.
8890         * target.h (Target::make_output_section): New method declaration.
8891         (Target::relax): Add more parameters for input objects, symbol table
8892         and layout.  Adjust call to do_relax.
8893         (Target::do_make_output_section): New method declaration.
8894         (Target::do_relax): Add parameters for input objects, symbol table
8895         and layout.
8896
8897 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8898
8899         * pread.c: Include stdio.h.
8900
8901 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8902
8903         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8904         defined.
8905
8906 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8907
8908         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8909         Change read_shndx type to unsigned int.
8910         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8911         int.
8912         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8913         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8914         Change read_shndx type to unsigned int.
8915         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8916         int.
8917         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8918         * layout.cc (Layout::create_symtab_sections): Cast the result of
8919         local_symcount * symsize to off_t in the gold_assert.
8920
8921 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8922
8923         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8924         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8925         R_ARM_BASE_ABS.
8926         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8927         (Arm_relocate_functions::thm_abs5): New function.
8928         (Arm_relocate_functions::abs12): New function.
8929         (Arm_relocate_functions::abs16): New function.
8930         (Arm_relocate_functions::base_abs): New function.
8931         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8932         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8933         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8934         R_ARM_BASE_ABS.
8935         (Scan::global): Likewise.
8936         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8937         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8938         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8939         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8940         R_ARM_BASE_ABS.
8941
8942 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8943
8944         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8945         (Arm_relocate_functions::movt_prel): New function.
8946         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8947         (Arm_relocate_functions::thm_movt_prel): New function.
8948         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8949         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8950         (Scan::global, Relocate::relocate): Likewise.
8951         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8952
8953 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8954
8955         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8956         Incremental_checker.
8957         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8958         unsigned int.
8959         (class Incremental_inputs_header): New class.
8960         (Incremental_inputs_header_writer): Edit comment.
8961         (Incremental_inputs_entry): New class.
8962         (Incremental_inputs_entry_writer): Edit comment.
8963         (Sized_incremental_binary::do_find_incremental_inputs_section):
8964         Add *strtab_shndx parameter, fill it.
8965         (Sized_incremental_binary::do_check_inputs): New method.
8966         (Incremental_checker::can_incrementally_link_output_file): Use
8967         Sized_incremental_binary::check_inputs.
8968         (Incremental_inputs::report_command_line): Save command line in
8969         command_line_.
8970         * incremental.h:
8971         (Incremental_binary::find_incremental_inputs_section): New
8972         method.
8973         (Incremental_binary::do_find_incremental_inputs_section): Add
8974         strtab_shndx parameter.
8975         (Incremental_binary::do_check_inputs): New pure virtual method.
8976         (Sized_incremental_binary::do_check_inputs): Declare.
8977         (Incremental_checker::Incremental_checker): Add incremental_inputs
8978         parameter, use it to initialize incremental_inputs_.
8979         (Incremental_checker::incremental_inputs_): New field.
8980         (Incremental_checker::command_line): New method.
8981         (Incremental_checker::inputs): New method.
8982         (Incremental_checker::command_line_): New field.
8983
8984 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8985
8986         * incremental.cc: Include <cstdarg> and "target-select.h".
8987         (vexplain_no_incremental): New function.
8988         (explain_no_incremental): New function.
8989         (Incremental_binary::error): New method.
8990         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8991         method.
8992         (make_sized_incremental_binary): New function.
8993         (open_incremental_binary): New function.
8994         (can_incrementally_link_file): Add checks if output is ELF and has
8995         inputs section.
8996         * incremental.h: Include "elfcpp_file.h" and "output.h".
8997         (Incremental_binary): New class.
8998         (Sized_incremental_binary): New class.
8999         (open_incremental_binary): Declare.
9000         * object.cc (is_elf_object): Use
9001         elfcpp::Elf_recognizer::is_elf_file.
9002         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9003         * output.h (Output_file::filesize): New method.
9004
9005 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9006
9007         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9008         New function.
9009         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9010         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9011         function.
9012         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9013         function.
9014         (Arm_relocate_functions::movw_abs_nc): New function.
9015         (Arm_relocate_functions::movt_abs): New function.
9016         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9017         (Arm_relocate_functions::thm_movt_abs): New function.
9018         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9019         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9020         (Scan::global): Likewise.
9021         (Relocate::relocate): Likewise.
9022         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9023
9024 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9025
9026         * arm.cc (Arm_relocate_functions::got_prel) New function.
9027         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9028         (Relocate::relocate): Likewise.
9029         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9030
9031 2009-10-06  Ian Lance Taylor  <iant@google.com>
9032
9033         * options.h (class General_options): Define
9034         split_stack_adjust_size parameter.
9035         * object.h (class Object): Add uses_split_stack_ and
9036         has_no_split_stack_ fields.  Add uses_split_stack and
9037         has_no_split_stack accessor functions.  Declare
9038         handle_split_stack_section.
9039         (class Reloc_symbol_changes): Define.
9040         (class Sized_relobj): Define Function_offsets.  Declare
9041         split_stack_adjust, split_stack_adjust_reltype, and
9042         find_functions.
9043         * object.cc (Object::handle_split_stack_section): New function.
9044         (Sized_relobj::do_layout): Call handle_split_stack_section.
9045         * dynobj.cc (Sized_dynobj::do_layout): Call
9046         handle_split_stack_section.
9047         * reloc.cc (Sized_relobj::relocate_sections): Call
9048         split_stack_adjust for executable sections in split_stack
9049         objects.  Pass reloc_map to relocate_section.
9050         (Sized_relobj::split_stack_adjust): New function.
9051         (Sized_relobj::split_stack_adjust_reltype): New function.
9052         (Sized_relobj::find_functions): New function.
9053         * target-reloc.h: Include "object.h".
9054         (relocate_section): Add reloc_symbol_changes parameter.  Change
9055         all callers.
9056         * target.h (class Target): Add calls_non_split method.  Declare
9057         do_calls_non_split virtual method.  Declare match_view and
9058         set_view_to_nop.
9059         * target.cc: Include "elfcpp.h".
9060         (Target::do_calls_non_split): New function.
9061         (Target::match_view): New function.
9062         (Target::set_view_to_nop): New function.
9063         * gold.cc (queue_middle_tasks): Give an error if mixing
9064         split-stack and non-split-stack objects with -r.
9065         * i386.cc (Target_i386::relocate_section): Add
9066         reloc_symbol_changes parameter.
9067         (Target_i386::do_calls_non_split): New function.
9068         * x86_64.cc (Target_x86_64::relocate_section): Add
9069         reloc_symbol_changes parameter.
9070         (Target_x86_64::do_calls_non_split): New function.
9071         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9072         parameter.
9073         * powerpc.cc (Target_powerpc::relocate_section): Add
9074         reloc_symbol_changes parameter.
9075         * sparc.cc (Target_sparc::relocate_section): Add
9076         reloc_symbol_changes parameter.
9077         * configure.ac: Call AM_CONDITIONAL for the default target.
9078         * configure: Rebuild.
9079         * testsuite/Makefile.am (TEST_AS): New variable.
9080         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9081         (check_DATA): Add split_i386 and split_x86_64 files.
9082         (SPLIT_DEFSYMS): Define.
9083         (split_i386_[1234n].o): New targets.
9084         (split_i386_[124]): New targets.
9085         (split_i386_[1234r].stdout): New targets.
9086         (split_x86_64_[1234n].o): New targets.
9087         (split_x86_64_[124]): New targets.
9088         (split_x86_64_[1234r].stdout): New targets.
9089         (MOSTLYCLEANFILES): Add new executables.
9090         * testsuite/split_i386.sh: New file.
9091         * testsuite/split_x86_64.sh: New file.
9092         * testsuite/split_i386_1.s: New file.
9093         * testsuite/split_i386_2.s: New file.
9094         * testsuite/split_i386_3.s: New file.
9095         * testsuite/split_i386_4.s: New file.
9096         * testsuite/split_i386_n.s: New file.
9097         * testsuite/split_x86_64_1.s: New file.
9098         * testsuite/split_x86_64_2.s: New file.
9099         * testsuite/split_x86_64_3.s: New file.
9100         * testsuite/split_x86_64_4.s: New file.
9101         * testsuite/split_x86_64_n.s: New file.
9102         * testsuite/testfile.cc (Target_test): Update relocation_section
9103         function.
9104         * testsuite/Makefile.in: Rebuild.
9105
9106 2009-10-06  Ian Lance Taylor  <iant@google.com>
9107
9108         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9109         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9110         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9111         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9112         the address on ldo_addrs_.
9113         (Target_i386::Relocate::fix_up_ldo): New function.
9114
9115 2009-10-06   Rafael Espindola  <espindola@google.com>
9116
9117         * plugin.cc (add_input_library): New.
9118         (Plugin::load): Add add_input_library to tv.
9119         (Plugin_manager::add_input_file): Add the is_lib argument.
9120         (add_input_file): Update call to Plugin_manager::add_input_file.
9121         (add_input_library): New.
9122         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9123
9124 2009-09-30  Doug Kwan  <dougkwan@google.com>
9125
9126         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9127         symbol and call Symbol::may_need_copy_reloc to determine if
9128         a copy reloc is needed.
9129         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9130         nocopyreloc is given in command line.
9131         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9132         given in command line.
9133         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9134         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9135         of the removed Target_i386::may_need_copy_reloc.
9136         * options.h (copyreloc): New option with default value false.
9137         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9138         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9139         instead of the removed Target_powerpc::may_need_copy_reloc.
9140         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9141         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9142         instead of the removed Target_sparc::may_need_copy_reloc.
9143         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9144         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9145         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9146         instead of the removed Target_x86_64::may_need_copy_reloc.
9147
9148 2009-09-30  Ian Lance Taylor  <iant@google.com>
9149
9150         * object.h (class Object): Remove target_ field, and target,
9151         sized_target, and set_target methods.
9152         (Object::sized_target): Remove.
9153         (class Sized_relobj): Update declarations.  Remove sized_target.
9154         * object.cc (Sized_relobj::setup): Remove target parameter.
9155         Change all callers.
9156         (Input_objects::add_object): Don't do anything with the target.
9157         (make_elf_sized_object): Add punconfigured parameter.  Change all
9158         callers.  Set or test parameter target.
9159         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9160         Change all callers.
9161         * parameters.cc (Parameters::set_target): Change parameter type to
9162         be non-const.
9163         (Parameters::default_target): Remove.
9164         (set_parameters_target): Change parameter type to be non-const.
9165         (parameters_force_valid_target): New function.
9166         (parameters_clear_target): New function.
9167         * parameters.h (class Parameters): Update declarations.  Remove
9168         default_target method.  Add sized_target and clear_target
9169         methods.  Change target_ to be non-const.
9170         (set_parameters_target): Update declaration.
9171         (parameters_force_valid_target): Declare.
9172         (parameters_clear_target): Declare.
9173         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9174         as NULL if we aren't searching.
9175         (Add_symbols::run): Don't check for compatible target.
9176         * fileread.cc (Input_file::open_binary): Call
9177         parameters_force_valid_target.
9178         * gold.cc (queue_middle_tasks): Likewise.
9179         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9180         set_target on object.
9181         * dynobj.h (class Sized_dynobj): Update declarations.
9182         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9183         make_elf_object returns NULL.
9184         (Archive::include_member): Don't check whether object target is
9185         compatible.
9186         * output.cc (Output_section::add_input_section): Get target from
9187         parameters.
9188         (Output_section::relax_input_section): Likewise.
9189         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9190         parameters.
9191         (Sized_relobj::do_scan_relocs): Likewise.
9192         (Sized_relobj::relocate_sections): Likewise.
9193         * resolve.cc (Symbol_table::resolve): Likewise.
9194         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9195         parameter.  Change all callers.
9196         (Symbol_table::add_from_object): Get target from parameters.
9197         (Symbol_table::add_from_relobj): Don't check object target.
9198         (Symbol_table::add_from_dynobj): Likewise.
9199         (Symbol_table::define_special_symbol): Get target from
9200         parameters.
9201         * symtab.h (class Symbol_table): Update declaration.
9202         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9203         parameter.  Change all callers.  Clear parameter target.
9204         (Binary_test): Test target here.
9205         * testsuite/object_unittest.cc (gold_testsuite): Remove
9206         target_test_pointer parameter.  Change all callers.
9207         (Object_test): Test target here.
9208
9209 2009-09-26  Ian Lance Taylor  <iant@google.com>
9210
9211         * testsuite/initpri1.c: Don't try to use constructor priorities if
9212         compiling with gcc before 4.3.
9213
9214 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9215
9216         * testsuite/retain_symbols_file_test.sh (check_present): Change
9217         output file name to retain_symbols_file_test.stdout.
9218         (check_absent): Likewise.
9219
9220 2009-09-18  Craig Silverstein  <csilvers@google.com>
9221
9222         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9223         * options.cc: Include <cerrno> and <fstream>.
9224         (General_options::finalize): Parse -retain-symbols-file tag.
9225         * options.h: New flag.
9226         (General_options): New method should_retain_symbol, new
9227         variable symbols_to_retain.
9228         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9229         should_retain_symbol map.
9230         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9231         * testsuite/Makefile.in: Regenerate.
9232         * testsuite/retain_symbols_file_test.sh: New file.
9233
9234 2009-09-18  Nick Clifton  <nickc@redhat.com>
9235
9236         * po/es.po: Updated Spanish translation.
9237
9238 2009-09-17  Doug Kwan  <dougkwan@google.com>
9239
9240         * debug.h (DEBUG_RELAXATION): New constant.
9241         (DEBUG_ALL): Add DEBUG_RELAXATION.
9242         (debug_string_to_enum): Add relaxation debug option.
9243         * layout.cc
9244         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9245         Layout::Relaxation_debug_check::read_sections,
9246         Layout::Relaxation_debug_check::read_sections): New method definitions.
9247         (Layout::Layout): Initialize data members
9248         record_output_section_data_from_scrips_,
9249         script_output_section_data_list_ and relaxation_debug_check_.
9250         (Layout::save_segments, Layout::restore_segments,
9251         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9252         Layout::relaxation_loop_body): New method definitions.
9253         (Layout::finalize): Support relaxation.  Move section layout code to
9254         Layout::relaxation_loop_body.
9255         (Layout::set_asection_address_from_script): Move code for orphan
9256         section placement out.
9257         (Layout::place_orphan_sections_in_script): New method definition.
9258         * layout.h (Output_segment_headers, Output_file_header):
9259         New forward class declarations.
9260         (Layout::~Layout): Define.
9261         (Layout::new_output_section_data_from_script): New method definition.
9262         (Layout::place_orphan_sections_in_script): New method declaration.
9263         (Layout::Segment_states): New type declaration.
9264         (Layout::save_segments, Layout::restore_segments,
9265         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9266         Layout::relaxation_loop_body): New method declarations.
9267         (Layout::Output_section_data_list): New type declaration.
9268         (Layout::Relaxation_debug_check): New class definition.
9269         (Layout::record_output_section_data_from_script_,
9270         Layout::script_output_section_data_list_, Layout::segment_states_,
9271         Layout::relaxation_debug_check_): New data members.
9272         * output.cc: (Output_section_headers::do_size): New method definition.
9273         (Output_section_headers::Output_section_headers): Move size
9274         computation to Output_section_headers::do_size.
9275         (Output_segment_headers::do_size): New method definition.
9276         (Output_file_header::Output_file_header): Move size computation to
9277         Output_file_header::do_size and call it.
9278         (Output_file_header::do_size): New method definition.
9279         (Output_data_group::Output_data_group): Adjust call to
9280         Output_section_data.
9281         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9282         (Output_symtab_xindex::do_write): Add array bound check.
9283         (Output_section::Input_section::print_to_mapfile): Handle
9284         RELAXED_INPUT_SECTION_CODE.
9285         (Output_section::Output_section): Initialize data member checkpoint_.
9286         (Output_section::~Output_section): Delete checkpoint object pointed
9287         by checkpoint_.
9288         (Output_section::add_input_section): Always add an Input_section if
9289         relaxing.
9290         (Output_section::add_merge_input_section): Add assert.
9291         (Output_section::relax_input_section): New method definition.
9292         (Output_section::set_final_data_size): Set load address to zero for
9293         an unallocated section.
9294         (Output_section::do_address_and_file_offset_have_reset_values):
9295         New method definition.
9296         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9297         Handle relaxed input section.
9298         (Output_section::sort_attached_input_sections): Checkpoint input
9299         section list lazily.
9300         (Output_section::get_input_sections): Change type of input_sections to
9301         list of Simple_input_section pointers.  Checkpoint input section list
9302         lazily.  Also handle relaxed input sections.
9303         (Output_section::add_input_section_for_script): Take a reference to
9304         a Simple_input_section object instead of Relobj pointer and section
9305         index as parameter.  Handle relaxed input sections.
9306         (Output_section::save_states, Output_section::restore_states): New
9307         method definitions.
9308         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9309         (Output_data::is_data_size_fixed): New method definition.
9310         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9311         if it is fixed.
9312         (Output_data::address_and_file_offset_have_reset_values): New method
9313         definition.
9314         (Output_data::do_address_and_file_offset_have_reset_values): New method
9315         definition.
9316         (Output_data::set_data_size): Check that data size is not fixed.
9317         (Output_data::fix_data_size): New method definition.
9318         (Output_data::is_data_size_fixed_): New data member.
9319         (Output_section_headers::set_final_data_size): New method definition.
9320         (Output_section_headers::do_size): New method declaration.
9321         (Output_segment_headers::set_final_data_size): New method definition.
9322         (Output_segment_headers::do_size): New method declaration.
9323         (Output_file_header::set_final_data_size)::New method definition.
9324         (Output_file_header::do_size)::New method declaration.
9325         (Output_section_data::Output_section_data): Add new parameter
9326         is_data_size_fixed and use it to fix data size.
9327         (Output_data_const::Output_data_const): Adjust call to base class
9328         constructor and fix data size.
9329         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9330         base class constructor and fix data size.
9331         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9332         base class constructor and fix data size.
9333         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9334         class constructor and fix data size.
9335         (Output_data_group::set_final_data_size): New method definition.
9336         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9337         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9338         class constructor and fix data size.
9339         (Output_relaxed_input_section): New class definition.
9340         (Output_section::Simple_input_section): New class definition.
9341         (Output_section::get_input_sections): Adjust parameter list.
9342         (Output_section::add_input_section_for_script): Same.
9343         (Output_section::save_states, Output_section::restore_states,
9344         Output_section::do_address_and_file_offset_have_reset_values,
9345         (Output_section::Input_section::Input_section): Handle
9346         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9347         Output_relaxed_input_section.
9348         (Output_section::Input_section::is_input_section,
9349         Output_section::Input_section::set_output_section): Handle relaxed
9350         input section.
9351         (Output_section::Input_section::is_relaxed_input_section,
9352         Output_section::Input_section::output_section_data,
9353         Output_section::Input_section::relaxed_input_section): New method
9354         definitions.
9355         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9356         value.
9357         (Output_section::Input_section::u1_): Update comments.
9358         (Output_section::Input_section::u2_): Add new union member poris.
9359         (Output_section::Checkpoint_output_section): New classs definition.
9360         (Output_section::relax_input_section): New method declaration.
9361         (Output_section::checkpoint_): New data member.
9362         (Output_segment): Update comments.
9363         (Output_segment::Output_segment): Un-privatize copy constructor.
9364         (Output_segment::operator=): Un-privatize.
9365         * script-sections.cc (Output_section_element::Input_section_list):
9366         Change element type to Output_section::Simple_input_section.
9367         (Output_section_element_dot_assignment::set_section_addresses):
9368         Register output section data for relaxation clean up.
9369         (Output_data_exression::Output_data_expression): Adjust call to base
9370         constructor to fix data size.
9371         (Output_section_element_data::set_section_addresses): Register
9372         Output_data_expression object for relaxation clean up.
9373         (struct Input_section_info): Replace Relobj pointer and section index
9374         pair with Output_section::Simple_input_section and Convert struct to a
9375         class.
9376         (Input_section_sorter::operator()): Adjust access to
9377         Input_section_info data member to use accessors.
9378         (Output_section_element_input::set_section_addresses): Use layout
9379         parameter.  Adjust code to use Output_section::Simple_input_section
9380         and Input_secction_info classes.  Register filler for relaxation
9381         clean up.
9382         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9383         and section index pair with Output_section::Simple_input_section
9384         class.  Adjust code accordingly.
9385         (Phdrs_element::release_segment): New method definition.
9386         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9387         segment list.
9388         (Script_sections::release_segments): New method definition.
9389         * gold/script-sections.h (Script_sections::release_segments): New
9390         method declaration.
9391         * gold/target.h (Target::may_relax, Target::relax,
9392         Target::do_may_relax, Target::do_relax): New method definitions.
9393
9394 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9395
9396         * arm.cc (has_signed_unsigned_overflow): New function.
9397         (Arm_relocate_functions::abs8): New function.
9398         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9399         (Target_arm::Scan::global): Likewise.
9400         (Target_arm::relocate::relocate): Likewise.
9401         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9402         Likewise.
9403
9404 2009-09-16  Cary Coutant  <ccoutant@google.com>
9405
9406         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9407         * testsuite/Makefile.in: Regenerate.
9408
9409 2009-09-11  Nick Clifton  <nickc@redhat.com>
9410
9411         * po/gold.pot: Updated by the Translation project.
9412
9413 2009-09-08  Cary Coutant  <ccoutant@google.com>
9414
9415         * output.cc (Output_file::open): Add execute permission to empty file.
9416         * testsuite/Makefile.am (permission_test): New test.
9417         * testsuite/Makefile.in: Regenerate.
9418
9419 2009-09-02  Ian Lance Taylor  <iant@google.com>
9420
9421         * output.cc (Output_file::resize): Call map_no_anonymous rather
9422         than map.
9423
9424 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9425
9426         * gold.cc: Include "incremental.h".
9427         (queue_initial_tasks): Call Incremental_checker methods.
9428         * incremental.cc: Include "output.h".
9429         (Incremental_checker::can_incrementally_link_output_file): New
9430         method.
9431         * incremental.h (Incremental_checker): New class.
9432
9433         * output.cc (Output_file::open_for_modification): New method.
9434         (Output_file::map_anonymous): Changed return type to bool.  Record
9435         map in base_ field.
9436         (Output_file::map_no_anonymous): New method, broken out of map.
9437         (Output_file::map): Use map_no_anonymous and map_anonymous.
9438         * output.h (class Output_file): Update declarations.
9439
9440 2009-08-24  Cary Coutant  <ccoutant@google.com>
9441
9442         * options.h (Command_line::Pre_options): New class.
9443         (Command_line::pre_options): New member.
9444         * options.cc (gold::options::ready_to_register): New variable.
9445         (One_option::register_option): Do nothing if not registering options.
9446         Assert if same short option registered twice.
9447         (General_options::General_options): Turn off option registration when
9448         done constructing.
9449         (Command_line::Pre_options::Pre_options): New constructor.
9450
9451 2009-08-24  Cary Coutant  <ccoutant@google.com>
9452
9453         * options.h (General_options::no_keep_memory): Remove incorrect
9454         short option.
9455
9456 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9457
9458         * Makefile.am (am__skiplex, am__skipyacc): New.
9459         * Makefile.in: Regenerate.
9460
9461 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9462
9463         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9464         (INCLUDES): ... this.
9465         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9466         (AM_CPPFLAGS): Renamed from ...
9467         (INCLUDE): ... this.
9468         * Makefile.in, testsuite/Makefile.in: Regenerate.
9469
9470         * Makefile.in: Regenerate.
9471         * aclocal.m4: Likewise.
9472         * config.in: Likewise.
9473         * configure: Likewise.
9474         * testsuite/Makefile.in: Likewise.
9475
9476         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9477         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9478         * Makefile.in: Regenerate.
9479         * testsuite/Makefile.in: Regenerate.
9480
9481 2009-08-19  Cary Coutant  <ccoutant@google.com>
9482
9483         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9484         symbols in shared libraries overridden by hidden or internal symbols
9485         in the main program.
9486
9487 2009-08-19  Chris Demetriou  <cgd@google.com>
9488
9489         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9490         checking source file names in error messages.
9491
9492 2009-08-18  Doug Kwan  <dougkwan@google.com>
9493
9494         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9495         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9496         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9497         an elfcpp::Ehdr as parameter.
9498         * object.cc (Object::set_target): Remove the version that looks up
9499         a target and sets it.
9500         (Sized_relobj::setup): Take a Target object instead of
9501         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9502         (make_elf_sized_object): Find target and ask target to
9503         make an ELF object.
9504         * object.h: (Object::set_target): Remove the version that looks up
9505         a target and sets it.
9506         (Sized_relobj::setup): Take a Target object instead of
9507         an elfcpp:Ehdr as parameter.
9508         * target.cc: Include dynobj.h.
9509         (Target::do_make_elf_object_implementation): New.
9510         (Target::do_make_elf_object): New.
9511         * target.h (Target::make_elf_object): New template declaration.
9512         (Target::do_make_elf_object): New method declarations.
9513         (Target::do_make_elf_object_implementation): New template declaration.
9514
9515 2009-08-14  Ian Lance Taylor  <iant@google.com>
9516
9517         * gold.h (FUNCTION_NAME): Define.
9518         (gold_unreachable): Use FUNCTION_NAME.
9519
9520 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9521
9522         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9523         symbol in the --keep-unique list is not found.
9524
9525 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9526
9527         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9528         been maked as --keep-unique.
9529         (Icf::unfold_section): New function.
9530         * icf.h (Icf::unfold_section): New function.
9531         * options.h (General_options::keep_unique): New option.
9532         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9533         * testsuite/Makefile.in: Regenerate.
9534         * testsuite/icf_keep_unique_test.sh: New file.
9535         * testsuite/icf_keep_unique_test.cc: New file.
9536
9537 2009-08-12  Cary Coutant  <ccoutant@google.com>
9538
9539         PR 10471
9540         * resolve.cc (Symbol_table::resolve): Check for references from
9541         dynamic objects to hidden and internal symbols.
9542         * testsuite/Makefile.am (hidden_test.sh): New test.
9543         * testsuite/Makefile.in: Regenerate.
9544         * testsuite/hidden_test.sh: New script.
9545         * testsuite/hidden_test_1.c: New test source.
9546         * testsuite/hidden_test_main.c: New test source.
9547
9548 2009-08-11  Doug Kwan  <dougkwan@google.com>
9549
9550         * arm.cc: Update comments.
9551         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9552         segment to locate the .ARM.exidx section if present.
9553
9554 2009-08-09  Doug Kwan  <dougkwan@google.com>
9555
9556         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9557         patch.
9558
9559 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9560         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9561         compiler warnings.
9562
9563 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9564
9565         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9566         valid tls_segment only for non-debug-section relocations.
9567         * testsuite/Makefile.am: Add gc_tls_test.
9568         * testsuite/Makefile.in: Regenerate.
9569         * testsuite/gc_tls_test.cc: New file.
9570         * testsuite/gc_tls_test.sh: New file.
9571
9572 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9573
9574         * icf.cc: New file.
9575         * icf.h: New file.
9576         * Makefile.am (CCFILES): Add icf.cc.
9577         (HFILES): Add icf.h
9578         * Makefile.in: Regenerate.
9579         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9580         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9581         section, symbol and addend information for the relocs.
9582         * gold.cc (queue_middle_tasks): Call identical code folding.
9583         * gold.h: Add defines for multimap.
9584         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9585         to the call of finalize_local_symbols.
9586         * main.cc (main): Create object of class Icf.
9587         * object.cc (Sized_relobj::do_layout): Allow this function to be
9588         called twice during icf.
9589         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9590         to sections marked as identical by icf.
9591         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9592         when available.
9593         (Sized_relobj::do_section_entsize): New function.
9594         * object.h (Object::section_entsize): New function.
9595         (Object::do_section_entsize): New pure virtual function.
9596         (Relobj::finalize_local_symbols): Add new parameter.
9597         (Relobj::do_section_entsize): New function.
9598         * options.h (General_options::icf): New option.
9599         (General_options::icf_iterations): New option.
9600         (General_options::print_icf_sections): New option.
9601         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9602         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9603         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9604         icf.
9605         * symtab.cc (Symbol_table::is_section_folded): New function.
9606         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9607         to sections marked as identical by icf.
9608         * symtab.h (Symbol_table::set_icf): New function.
9609         (Symbol_table::icf): New function.
9610         (Symbol_table::is_section_folded): New function.
9611         (Symbol_table::icf_): New data member.
9612         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9613         * testsuite/Makefile.am: Add commands to build icf_test.
9614         * testsuite/Makefile.in: Regenerate.
9615         * testsuite/icf_test.sh: New file.
9616         * testsuite/icf_test.cc: New file.
9617
9618 2009-07-24  Chris Demetriou  <cgd@google.com>
9619
9620         * layout.cc (is_compressible_debug_section): Fix incorrect
9621         comment about compressed section names.
9622
9623 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9624
9625         PR 10419
9626         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9627
9628 2009-07-16  Ian Lance Taylor  <iant@google.com>
9629
9630         PR 10400
9631         * layout.h: #include <map>.
9632         (class Kept_section): Change from struct to class.  Add accessors
9633         and setters.  Add section size to Comdat_group mapping.  Change
9634         Comdat_group to std::map.  Add is_comdat_ field.  Add
9635         linkonce_size field in union.
9636         (class Layout): Update declaration of find_or_add_kept_section.
9637         Don't declare find_kept_object.
9638         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9639         parameter.  Add object, shndx, is_comdat, and is_group_name
9640         parameters.  Change all callers.  Adjust for new Kept_section.
9641         (Layout::find_kept_object): Remove.
9642         * object.cc (Sized_relobj::include_section_group): Update use of
9643         Kept_section.  Rename secnum to shndx.  Only record
9644         Kept_comdat_section if sections are the same size.
9645         (Sized_relobj::include_linkonce_section): Update use of
9646         Kept_section.  Only record Kept_comdat_section if sections are the
9647         same size.  Set size of linkonce section.
9648         (Sized_relobj::map_to_kept_section): Update call to
9649         get_kept_comdat_section.
9650         * object.h (class Sized_relobj): Rename fields in
9651         Kept_comdat_section to drop trailing underscores; change object
9652         field to Relobj*.  Change Kept_comdat_section_table to store
9653         struct rather than pointer.
9654         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9655         Add kept_object and kept_shndx parameters.  Change all callers.
9656         (Sized_relobj::get_kept_comdat_section): Change return type to
9657         bool.  Add kept_object and kept_shndx parameters.  Change all
9658         callers.
9659         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9660         Layout::find_or_add_kept_section.
9661
9662 2009-07-09  Ian Lance Taylor  <iant@google.com>
9663
9664         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9665         Reserve space in the hash table.
9666
9667 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9668
9669         * fileread.cc (File_read::get_mtime): New method.
9670         * fileread.h (Timespec): New structure.
9671         (File_read::get_mtime): New method.
9672         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9673         Renamed from timestamp_nsec.
9674         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9675         Elf_Xword.
9676         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9677         timestamp_nsec.
9678         (Incremental_inputs::report_archive): Save mtime; style fix.
9679         (Incremental_inputs::report_obejct): Save mtime; style fix.
9680         (Incremental_inputs::report_script): Save mtime; style fix.
9681         (Incremental_inputs::finalize_inputs): Style fix.
9682         (Incremental_inputs::finalize): Style fix.
9683         (Incremental_inputs::create_input_section_data): Store inputs
9684         mtime.
9685         * incremental.h (Incremental_inputs::report_script): Add mtime
9686         argument.
9687         (Incremental_inputs::Input_info::Input_info): Intialize only one
9688         union member.
9689         (Incremental_inputs::Input_info::archive): Move to nameless
9690         union.
9691         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9692         (Incremental_inputs::Input_info::script): Move to nameless union.
9693         (Incremental_inputs::mtime): New field.
9694         * script.cc (read_input_script): Pass file mtime to
9695         Incremental_input.
9696         * script.h (Script_info::inputs): Style fix.
9697
9698 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9699
9700         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9701         instead of 32.
9702
9703 2009-06-24  Ian Lance Taylor  <iant@google.com>
9704
9705         PR 10156
9706         * layout.cc (Layout::choose_output_section): If we find an
9707         existing section, update the flags.
9708         (Layout::create_notes): New function, broken out of
9709         Layout::finalize.
9710         (Layout::finalize): Don't create note sections.
9711         (Layout::create_note): Don't crash if linker script discards
9712         section.
9713         (Layout::create_gold_note): Likewise.
9714         (Layout::create_build_id): Likewise.  Don't set
9715         after_input_sections on the section.
9716         (Layout::create_executable_stack_info): Remove target parameter.
9717         Change caller.
9718         * layout.h (class Layout): Declare create_notes.  Update
9719         declaration of create_executable_stack_info.
9720         * gold.cc (queue_middle_tasks): Call create_notes.
9721         * output.cc (Output_section::update_flags_for_input_section): Move
9722         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9723         invalid.
9724         * output.h (Output_data::mark_address_invalid): New function.
9725         (class Output_section): Only declare, not define,
9726         update_flags_for_input_section.  Remove set_flags.
9727
9728 2009-06-24  Ian Lance Taylor  <iant@google.com>
9729
9730         * script-sections.cc (Output_section_definition::
9731         set_section_addresses): Rename shadowing local load_address to
9732         laddr.
9733
9734 2009-06-24  Ian Lance Taylor  <iant@google.com>
9735
9736         PR 10244
9737         * reloc.cc (relocate_sections): Skip empty relocation sections.
9738
9739 2009-06-23  Ian Lance Taylor  <iant@google.com>
9740
9741         PR 10156
9742         * layout.cc (Layout::create_note): Use choose_output_section
9743         rather than make_output_section.
9744
9745 2009-06-23  Ian Lance Taylor  <iant@google.com>
9746
9747         PR 10237
9748         * options.cc (General_options::parse_V): Set printed_version_.
9749         (General_options::General_options): Initialize printed_version_.
9750         * options.h (class General_options): Add printed_version_ field.
9751         * gold.cc (queue_initial_tasks): If there are no input files,
9752         don't give a fatal error if we printed the version information.
9753         (queue_middle_tasks): If using -r with a shared object, give a
9754         fatal error rather than an ordinary error.
9755
9756 2009-06-23  Ian Lance Taylor  <iant@google.com>
9757
9758         PR 10219
9759         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9760         (Layout::make_output_section): Set have_stabstr_section_ if we see
9761         a .stab*str section.
9762         (Layout::finalize): Call link_stabs_sections.
9763         (Layout::link_stabs_sections): New file.
9764         * layout.h (class Layout): Add have_stabstr_section_ field.
9765         Declare link_stabs_sections.
9766
9767 2009-06-23  Doug Kwan  <dougkwan@google.com>
9768
9769         * Makefile.am (libgold_a_LIBADD): New.
9770         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9771         * Makefile.in: Regenerate.
9772         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9773         * configure: Regenerate.
9774         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9775         * fileread.cc: Include sys/state.h
9776         * gold.h: Declare memmem and strndup if found missing.
9777         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9778
9779 2009-06-23  Ian Lance Taylor  <iant@google.com>
9780
9781         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9782         * configure: Rebuild.
9783
9784 2009-06-23  Ian Lance Taylor  <iant@google.com>
9785
9786         PR 10147
9787         * object.cc (Object::section_contents): Don't try to get a view if
9788         the section has length zero.
9789         (Object::handle_gnu_warning_section): If the section is empty, use
9790         the name of the section as the warning.
9791
9792 2009-06-23  Ian Lance Taylor  <iant@google.com>
9793
9794         PR 10133
9795         * stringpool.h (class Stringpool_template): Add optimize_ field.
9796         (Stringpool_template::set_optimize): New function.
9797         * stringpool.cc (Stringpool_template::Stringpool_template):
9798         Initialize optimize_ field.
9799         (Stringpool_template::set_string_offsets): Test local optimize
9800         fild rather than parameter.
9801         * layout.cc (Layout::Layout): Call set_optimize on the section
9802         name stringpool.
9803
9804 2009-06-22  Ian Lance Taylor  <iant@google.com>
9805
9806         PR 10030
9807         * yyscript.y: Parse TARGET.
9808         * script.cc (script_set_target): New function.
9809         * script-c.h (script_set_target): Declare.
9810         * options.cc (General_options::string_to_object_format): Rename
9811         from string_to_object_format in anonymous namespace.  Change
9812         callers.
9813         * options.h (class General_options): Declare
9814         string_to_object_format.
9815
9816 2009-06-22  Ian Lance Taylor  <iant@google.com>
9817
9818         * script-sections.cc (Script_sections::create_segments): Don't put
9819         program headers in a PT_LOAD segment if -n or -N.
9820
9821 2009-06-22  Ian Lance Taylor  <iant@google.com>
9822
9823         PR 10141
9824         * options.h (class General_options): Add -z lazy and -z now.  Sort
9825         -z options into alphabetical order.
9826         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9827
9828 2009-06-21  Ian Lance Taylor  <iant@google.com>
9829
9830         * layout.cc (Layout::make_output_section): Call
9831         Target::new_output_section.
9832         (Layout::attach_allocated_section_to_segment): Put large section
9833         sections in a separate load segment with the large segment flag
9834         set.
9835         (Layout::segment_precedes): Sort large data segments after other
9836         load segments.
9837         (align_file_offset): New static function.
9838         (Layout::set_segment_offsets): Use align_file_offset.
9839         * output.h (class Output_section): Add is_small_section_ and
9840         is_large_section_ fields.
9841         (Output_section::is_small_section): New function.
9842         (Output_section::set_is_small_section):  New function.
9843         (Output_section::is_large_section): New function.
9844         (Output_section::set_is_large_section): New function.
9845         (Output_section::is_large_data_section): New function.
9846         (class Output_segment): Add is_large_data_segment_ field.
9847         (Output_segment::is_large_data_segment): New function.
9848         (Output_segment::set_is_large_data_segment): New function.
9849         * output.cc (Output_section::Output_section): Initialize new
9850         fields.
9851         (Output_segment::Output_segment): Likewise.
9852         (Output_segment::add_output_section): Add assertion that large
9853         data sections always go in large data segments.  Force small data
9854         sections to the end of the list of data sections.  Force small BSS
9855         sections to the start of the list of BSS sections.  For large BSS
9856         sections to the end of the list of BSS sections.
9857         * symtab.h (class Symbol): Declare is_common_shndx.
9858         (Symbol::is_defined): Check Symbol::is_common_shndx.
9859         (Symbol::is_common): Likewise.
9860         (class Symbol_table): Define enum Commons_section_type.  Update
9861         declarations.  Add small_commons_ and large_commons_ fields.
9862         * symtab.cc (Symbol::is_common_shndx): New function.
9863         (Symbol_table::Symbol_table): Initialize new fields.
9864         (Symbol_table::add_from_object): Put small and large common
9865         symbols in the right list.
9866         (Symbol_table::sized_finalized_symbol): Check
9867         Symbol::is_common_shndx.
9868         (Symbol_table::sized_write_globals): Likewise.
9869         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9870         common symbol lists.  Don't call do_allocate_commons_list if the
9871         list is empty.
9872         (Symbol_table::do_allocate_commons_list): Remove is_tls
9873         parameter.  Add comons_section_type parameter.  Change all
9874         callers.  Handle small and large common symbols.
9875         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9876         Symbol::is_common_shndx.
9877         * resolve.cc (symbol_to_bits): Likewise.
9878         * target.h (Target::small_common_shndx): New function.
9879         (Target::small_common_section_flags): New function.
9880         (Target::large_common_shndx): New function.
9881         (Target::large_common_section_flags): New function.
9882         (Target::new_output_section): New function.
9883         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9884         small_common_section_flags, and large_common_section_flags
9885         fields.
9886         (Target::do_new_output_section): New virtual function.
9887         * arm.cc (Target_arm::arm_info): Initialize new fields.
9888         * i386.cc (Target_i386::i386_info): Likewise.
9889         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9890         Likewise.
9891         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9892         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9893         (Target_x86_64::do_new_output_section): New function.
9894         * configure.ac: Define conditional MCMODEL_MEDIUM.
9895         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9896         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9897         (large_LDFLAGS): Define.
9898         * testsuite/large.c: New file.
9899         * testsuite/testfile.cc (Target_test::test_target_info):
9900         Initialize new fields.
9901         * configure, testsuite/Makefile.in: Rebuild.
9902
9903 2009-06-05  Doug Kwan  <dougkwan@google.com>
9904
9905         * Makefile.am (CCFILES): Add target.cc.
9906         * Makefile.in: Regenerate.
9907         * i386.cc (class Target_i386): Define new virtual method to
9908         override do_is_local_label_name in parent.
9909         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9910         local symbols if --discard-locals or -X is given.
9911         * options.h (class General_options): Declare new options
9912         '--discard-locals' and '-X' for discarding locals.
9913         * target.h (class Target): Define new methods is_local_label_name.
9914         Declare new virtual method do_is_local_label_name.
9915         * target.cc: New file.
9916         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9917         (check_SCRIPTS): Add discard_locals_test.sh.
9918         (check_DATA): Add discard_local_tests.syms.
9919         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9920         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9921         * testsuite/Makefile.in: Regenerate.
9922         * testsuite/discard_locals_test.c: New file.
9923         * testsuite/discard_locals_test.sh: Same.
9924
9925 2009-06-05  Doug Kwan  <dougkwan@google.com>
9926
9927         * object.cc (Sized_relobj::Sized_relobj): Initialize
9928         discarded_eh_frame_shndx_ to -1U.
9929         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9930         section.
9931         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9932         a discarded .eh_frame section.
9933         (Sized_relobj::do_finalize_local_symbols): Ditto.
9934         * object.h (class Sized_relobj): Declare new member
9935         discarded_eh_frame_shndx_.
9936         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9937         (local_labels_test.o, local_labels_test): New rules.
9938         * testsuite/Makefile.in: Regenerate.
9939
9940 2009-06-04  Doug Kwan  <dougkwan@google.com>
9941
9942         * layout.cc (Layout::section_name_mapping): Add mapping for
9943         special ARM sections.
9944
9945 2009-06-03  Doug Kwan  <dougkwan@google.com>
9946
9947         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9948         (utils::has_overflow): Same.
9949
9950 2009-06-03  Ian Lance Taylor  <iant@google.com>
9951
9952         * layout.cc (Layout::section_name_mapping): New array, replacing
9953         Layout::linkonce_mapping.
9954         (Layout::section_name_mapping_count): New variable, replacing
9955         Layout::linkonce_mapping_count.
9956         (Layout::linkonce_output_name): Remove.
9957         (Layout::output_section_name): Rewrite.
9958         * layout.h (class Layout): Rename Linkonce_mapping to
9959         Section_name_mapping, linkonce_mapping to section_name_mapping,
9960         linkonce_mapping_count to section_name_mapping_count.  Don't
9961         declare linkonce_output_name.
9962
9963 2009-06-03  Doug Kwan  <dougkwan@google.com>
9964
9965         * gold/arm.cc (namespace utils): New.
9966         (Target_arm::reloc_is_non_pic): Define new method.
9967         (class Arm_relocate_functions): New.
9968         (Target_arm::Relocate::relocate): Handle relocation types used by
9969         Android.
9970
9971 2009-06-03  Ian Lance Taylor  <iant@google.com>
9972
9973         * arm.cc (Target_arm::scan::global): Use || instead of |.
9974
9975 2009-06-02  Doug Kwan  <dougkwan@google.com>
9976
9977         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9978         issued_non_pic_error_.
9979         (class Target_arm::Scan): Declare new method check_non_pic.
9980         Define new method symbol_needs_plt_entry.
9981         Declare new data member issued_non_pic_error_.
9982         (class Target_arm::Relocate): Declare new method
9983         should_apply_static_reloc.
9984         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9985         (Target_arm::Scan::check_non_pic): Define new method.
9986         (Target_arm::Scan::local): Handle a small subset of reloc types used
9987         by Android.
9988         (Target_arm::Scan::local): Same.
9989         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9990
9991 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9992
9993         * incremental.cc (Incremental_inputs::report_command_line): Filter
9994         out --incremental-* options.
9995
9996 2009-05-29  Doug Kwan  <dougkwan@google.com>
9997
9998         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9999         template class.
10000         (class Target_arm): Update comment.
10001         (Target_arm::Target_arm): Initialize new data members GOT_,
10002         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10003         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10004         and Target_arm::rel_dyn_section.
10005         Declare new_enum Target_arm::Got_type.
10006         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10007         and DYNBSS_.
10008         Update commments for member do_dynsym_value.
10009         (Target_arm::got_size, Target_arm::plt_section,
10010         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10011         new methods inside class defintion.
10012         (Target_arm::got_section): Define new method.
10013         (Target_arm::rel_dyn_section): Same.
10014         (Output_data_plt_arm): New template class.
10015         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10016         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10017         (Output_data_plt_arm::add_entry): Same.
10018         (Output_data_plt_arm::first_plt_entry): Define new
10019         static data member for PLT instruction template.
10020         (Output_data_plt_arm::plt_entry): Same.
10021         (Output_data_plt_arm::do_write): Define new method.
10022         (Target_arm::make_plt_entry): Same.
10023         (Target_arm::do_finalize_sections): Same.
10024         (Target_arm::do_dynsym_value): Same.
10025
10026 2009-05-28  Doug Kwan  <dougkwan@google.com>
10027
10028         * Makefile.am (TARGETSOURCES): Add arm.cc.
10029         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10030         * Makefile.in: Regenerate.
10031         * arm.cc: New file.
10032         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10033
10034 2009-05-26  Doug Kwan  <dougkwan@google.com>
10035
10036         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10037         (General_options::check_excluded_libs): Strip off directories in
10038         archive name before matching like GNU ld does.
10039         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10040         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10041         (exclude_libs_test_LDFLAGS): Add linker option
10042         -Wl,--exclude-libs,libexclude_libs_test_3
10043         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10044         an explicit archive without using -l.
10045         (alt/libexclude_libs_test_3.a): New make rule.
10046         * testsuite/Makefile.in: Regenerate.
10047         * testsuite/exclude_libs_test.c : Declare lib3_default().
10048         (main): Call it.
10049         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10050         * exclude_libs_test_3.c: New file.
10051
10052 2009-05-26  Nick Clifton  <nickc@redhat.com>
10053
10054         * po/id.po: New Indonesian translation.
10055         * po/gold.pot: Updated template file.
10056
10057 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10058
10059         * testsuite/Makefile.am: Add -ffunction-sections to compile
10060         gc_comdat_test files.  Add -Wl,--gc-sections to build
10061         gc_comdat_test.
10062         * testsuite/Makefile.in: Regenerate.
10063         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10064
10065 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10066
10067         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10068         kept comdat section was garbage collected.
10069         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10070         * testsuite/Makefile.in: Regenerate.
10071         * testsuite/gc_comdat_test.sh: New file.
10072         * testsuite/gc_comdat_test_1.cc: New file.
10073         * testsuite/gc_comdat_test_2.cc: New file.
10074
10075 2009-05-19  Doug Kwan  <dougkwan@google.com>
10076
10077         * archive.cc (Archive::Archive): Move constructor from archive.h
10078         to here.  Initialize no_export_.
10079         (Archive::get_elf_object_for_member): Set no_export flag of object.
10080         * archive.h (Archive::Archive): Move constructor body to
10081         archive.cc.
10082         (Archive::no_export): New method.
10083         (Archive::no_export_): New field.
10084         * object.h (Object::Object): Initialize no_export_ to false.
10085         (Object::no_export, Object::set_no_export): New methods.
10086         (Object::no_export_): New field.
10087         * options.cc (General_options::parse_exclude_libs): New method.
10088         (General_options::check_excluded_libs) Same.
10089         * options.h (exclude_libs): New option.
10090         (General_options::check_excluded_libs): New method declaration.
10091         (General_options::excluded_libs_): New field.
10092         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10093         default or protected visibility if an object has no-export flag set.
10094         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10095         (check_SCRIPTS): Add exclude_libs_test.sh.
10096         (check_DATA): Add exclude_libs_test.syms.
10097         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10098         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10099         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10100         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10101         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10102         libexclude_libs_test_2.a): New rules.
10103         * testsuite/Makefile.in: Regenerate.
10104         * testsuite/exclude_libs_test.c: New file.
10105         * testsuite/exclude_libs_test.sh: Ditto.
10106         * testsuite/exclude_libs_test_1.c: Ditto.
10107         * testsuite/exclude_libs_test_2.c: Ditto.
10108
10109 2009-05-15  Ian Lance Taylor  <iant@google.com>
10110
10111         * configure.ac: Check for declarations for cases where libiberty.h
10112         checks HAVE_DECL_xxx.
10113         * configure, config.in: Rebuild.
10114
10115 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10116
10117         * gold.h (Incremental_argument_list): Remove (invalid) forward
10118         declaration.
10119         * incremental.cc (Incremental_inputs::report_achive): New method.
10120         (Incremental_inputs::report_object): New method.
10121         (Incremental_inputs::report_script): New method.
10122         (Incremental_inputs::finalize_inputs): New method.
10123         (Incremental_inputs::finalize): Call finalize_inputs().
10124         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10125         Create inputs entries.
10126         * incremental.h (Incremental_input_type): New enum.
10127         (Incremental_inputs::Incremental_input): Initialize new fields.
10128         (Incremental_inputs::report_inputs): New method.
10129         (Incremental_inputs::report_achive): New method.
10130         (Incremental_inputs::report_object): New method.
10131         (Incremental_inputs::report_script): New method.
10132         (Incremental_inputs::finalize_inputs): New method.
10133         (Incremental_inputs::Input_info): New struct.
10134         (Incremental_inputs::Input_info_map): New typedef.
10135         (Incremental_inputs::lock_): New field.
10136         (Incremental_inputs::Inputs_): New field.
10137         (Incremental_inputs::Inputs_map): New field.
10138         * main.cc (main): Call Incremental_input::report_inputs.
10139         * options.h (Input_argument_list): Typedef moved from
10140         Input_arguments.
10141         (Input_file_group::Files): Remove, use ::Input_argument_list.
10142         (Input_file_group::Input_argument_list): Remove, use
10143         ::Input_argument_list.
10144         * plugin.cc (Plugin_manager::add_input_file): Add error in
10145         incremental build.
10146         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10147         functions.
10148         * script.cc (read_input_script): Call
10149         Incremental_input::report_script.
10150         * script.h (Script_info): New class.
10151
10152 2009-04-27  Ian Lance Taylor  <iant@google.com>
10153
10154         * x86_64.cc (do_adjust_output_section): Set entsize to
10155         plt_entry_size.
10156
10157 2009-04-23  Elliott Hughes  <enh@google.com>
10158
10159         * output.cc (Output_file::close): After short writes, continue
10160         writing from the correct offset in the buffer being written.
10161
10162 2009-04-23  Chris Demetriou  <cgd@google.com>
10163
10164         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10165         * configure: Regenerate.
10166         * config.in: Regenerate.
10167         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10168         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10169
10170 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10171
10172         * incremental.cc (Incremental_inputs_header_data): Renamed from
10173         Incremental_input_header_data.
10174         (Incremental_inputs_header_data::data_size): New field.
10175         (Incremental_inputs_header_data::put_input_file_count): Renamed
10176         from input_file_count.
10177         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10178         from command_line_offset.
10179         (Incremental_inputs_header_data::put_reserved): Renamed from
10180         put_reserved.
10181         (Incremental_inputs_entry_data): Renamed from
10182         Incremental_input_entry_data.
10183         (Incremental_inputs_entry_data::data_size): New field.
10184         (Incremental_inputs::report_command_line): New method.
10185         (Incremental_inputs::finalize): New method.
10186         (Incremental_inputs::create_incremental_inputs_data): New method.
10187         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10188         * incremental.h: New file.
10189         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10190        (Layout::finalize): Create incremental inputs section in
10191         incremental builds.
10192        (Layout::create_incremental_info_sections): New method.
10193         * layout.h (Layout::incremental_inputs): New method.
10194        (Layout::create_incremental_info_sections): New method.
10195        (Layout::incremental_inputs_): New field.
10196         * main.cc (main): Notify Incremental_input of the command line.
10197
10198 2009-04-01  Ian Lance Taylor  <iant@google.com>
10199             Mikolaj Zalewski  <mikolajz@google.com>
10200
10201         * gold.h (reserve_unordered_map): Define, three versions, one for
10202         each version of Unordered_map.
10203         * layout.cc (Layout::Layout): Remove options parameter.  Add
10204         number_of_input_files parameter.  Don't initialize options_.
10205         Initialize number_of_input_files_ and resized_signatures_.  Move
10206         sections_are_attached_.
10207         (Layout::layout_group): Reserve space for group_signatures_.
10208         (Layout::find_or_add_kept_section): Change name parameter to be a
10209         reference.  Resize signatures_ map when it gets large enough.
10210         (Layout::layout_eh_frame): Use parameters->options() instead of
10211         this->options_.
10212         (Layout::make_output_section): Likewise.
10213         (Layout::attach_allocated_section_to_segment): Likewise.
10214         (Layout::finalize, Layout::create_executable_stack): Likewise.
10215         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10216         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10217         * layout.h (class Layout): Update declarations.  Remove options_
10218         field.  Add number_of_input_files_ and resized_signatures_
10219         fields.  Move sections_are_attached_ field.
10220         * main.cc (main): Pass number of input files to Layout
10221         constructor.  Don't pass options.
10222
10223 2009-03-30  Ian Lance Taylor  <iant@google.com>
10224
10225         * ffsll.c (ffsll): Correct implementation.
10226
10227 2009-03-27  Ian Lance Taylor  <iant@google.com>
10228
10229         * ffsll.c: New file.
10230         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10231         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10232         * ftruncate.c (ftruncate): Declare before definition.
10233         * mremap.c (mremap): Likewise.
10234         * pread.c (pread): Likewise.
10235         * configure, Makefile.in, config.in: Rebuild.
10236
10237         * mremap.c: New file.
10238         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10239         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10240         (mremap): Declare if HAVE_MREMAP is not defined.
10241         * configure, Makefile.in, config.in: Rebuild.
10242
10243 2009-03-27  Cary Coutant  <ccoutant@google.com>
10244
10245         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10246         position independent.
10247         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10248         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10249
10250 2009-03-24  Cary Coutant  <ccoutant@google.com>
10251
10252         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10253         an executable.
10254         (needs_dynamic_reloc): Likewise.
10255
10256 2009-03-24  Ian Lance Taylor  <iant@google.com>
10257
10258         * yyscript.y (file_cmd): Recognize EXTERN.
10259         (extern_name_list, extern_name_list_body): New nonterminals.
10260         * script.cc (script_add_extern): Define.
10261         * script-c.h (script_add_extern): Declare.
10262
10263 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10264
10265         * object.cc (is_elf_object): Define.
10266         * object.h (is_elf_object): Declare.
10267         * archive.cc (Archive::get_elf_object_for_member): Call
10268         is_elf_object.
10269         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10270
10271 2009-03-24  Elliott Hughes  <enh@google.com>
10272
10273         * output.cc (Output_file::map_anonymous): Define.
10274         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10275         try an anonymous one.  Report the size if the mmap fails.
10276         * output.h (class Output_file): Declare map_anonymous.
10277
10278 2009-03-24  Ian Lance Taylor  <iant@google.com>
10279
10280         * target-select.cc (instantiate_target): Don't acquire the lock if
10281         the instantiated_target_ field has already been set.
10282
10283 2009-03-23  Ian Lance Taylor  <iant@google.com>
10284
10285         * gold-threads.h (class Initialize_lock): Define.
10286         * gold-threads.cc (class Initialize_lock_once): Define.
10287         (initialize_lock_control): New static variable.
10288         (initialize_lock_pointer): New static variable.
10289         (initialize_lock_once): New static function.
10290         (Initialize_lock::Initialize_lock): Define.
10291         (Initialize_lock::initialize): Define.
10292         * target-select.h: Include "gold-threads.h".
10293         (class Target_selector): Add lock_ and initialize_lock_ fields.
10294         Don't define instantiate_target, just declare it.
10295         * target-select.cc (Target_selector::Target_selector): Initialize
10296         new fields.
10297         (Target_selector::instantiate_target): Define.
10298         * descriptors.h: Include "gold-threads.h".
10299         (class Descriptors): Add initialize_lock_ field.
10300         * descriptors.cc (Descriptors::Descriptors): Initialize new
10301         field.
10302         (Descriptors::open): Use initialize_lock_ field
10303         * errors.h (class Errors): Add initialize_lock_ field.
10304         * errors.cc (Errors::Errors): Initialize new field.
10305         (Errors::initialize_lock): Use initialize_lock_ field.
10306         * powerpc.cc (class Target_selector_powerpc): Remove
10307         instantiated_target_ field.  In do_recognize call
10308         instantiate_target rather than do_instantiate_target.  In
10309         do_instantiate_target just allocate a new target.
10310         * sparc.cc (class Target_selector_sparc): Likewise.
10311
10312         * freebsd.h: New file.
10313         * i386.cc: Include "freebsd.h".
10314         (Target_i386): Derive from Target_freebsd rather than
10315         Sized_target.
10316         (Target_selector_i386): Derive from Target_selector_freebsd rather
10317         than Target_selector.
10318         * x86_64.cc: Include "freebsd.h".
10319         (Target_x86_64): Derive from Target_freebsd rather than
10320         Sized_target.
10321         (Target_selector_x86_64): Derive from Target_selector_freebsd
10322         rather than Target_selector.
10323         * target.h (class Target): Add adjust_elf_header and
10324         do_adjust_elf_header.
10325         * output.cc (Output_file_header:: do_sized_write): Call target
10326         adjust_elf_header routine.
10327         * configure.tgt: Set targ_osabi.
10328         * configure.ac: Define GOLD_DEFAULT_OSABI.
10329         * parameters.cc (Parameters::default_target): Pass
10330         GOLD_DEFAULT_OSABI to select_target.
10331         * target-select.h (class Target_selector): Make instantiate_target
10332         protected rather than private.
10333         * Makefile.am (HFILES): Add freebsd.h.
10334         * configure, Makefile.in, config.in: Rebuild.
10335
10336         * merge.cc (do_add_input_section): Correct pend value.  Change
10337         message about last entry not being null terminated from error to
10338         warning.
10339
10340 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10341
10342         * incremental.cc: New file.
10343         * Makefile.am (CCFILES): Add incremental.cc.
10344         * Makefile.in: Rebuild.
10345
10346 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10347
10348         * layout.cc (Layout::output_section_name): Preserve names
10349         of '.note.' sections.
10350
10351 2009-03-19  Ian Lance Taylor  <iant@google.com>
10352
10353         * descriptors.cc (Descriptors::open): Check that the options are
10354         valid before using them.
10355
10356 2009-03-18  Ian Lance Taylor  <iant@google.com>
10357
10358         * script-sections.h: Include <list>.
10359         (class Script_sections): Change Sections_elements from std::vector
10360         to std::list.  Typedef public Elements_iterator.  Add
10361         orphan_section_placement_, data_segment_align_start_, and
10362         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10363         field.
10364         * script-sections.cc (class Orphan_section_placement): New class.
10365         (class Sections_element): Add virtual functions is_relro and
10366         orphan_section_init.  Remove virtual function place_orphan_here.
10367         (class Output_section_definition): Add is_relro and
10368         orphan_section_init.  Remove place_orphan_here.
10369         (class Orphan_output_section): Likewise.
10370         (Script_sections::Script_sections): Update for field changes.
10371         (Script_sections::data_segment_align): Set saw_data_segment_align_
10372         and data_segment_align_start_, not data_segment_align_index.
10373         (Script_sections::data_segment_relro_end): Check
10374         saw_data_segment_align_.  Use data_segment_align_start_ rather
10375         than data_segment_align_index_.
10376         (Script_sections::place_orphan): Rewrite to use
10377         Orphan_section_placement.
10378
10379 2009-03-17  Ian Lance Taylor  <iant@google.com>
10380
10381         * archive.cc (Archive::add_symbols): Check for a version attached
10382         to the symbol name in the archive map.
10383         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10384         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10385         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10386         (ver_test_11.a): New target.
10387         * testsuite/Makefile.in: Rebuild.
10388
10389         * configure.ac: Check for chsize and posix_fallocate.  Replace
10390         ftruncate.
10391         * ftruncate.c: New file, from gnulib.
10392         * output.cc (posix_fallocate): Define dummy version if not
10393         HAVE_POSIX_FALLOCATE.
10394         (Output_file::map): Call posix_fallocate rather than lseek and
10395         write.
10396         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10397         * configure, Makefile.in, config.in: Rebuild.
10398
10399 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10400
10401         * layout.h (Layout::create_note): Add section_name parameter.
10402         * layout.cc (Layout::create_note): Likewise.
10403         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10404
10405 2009-03-17  Ian Lance Taylor  <iant@google.com>
10406
10407         * descriptors.cc: Include "options.h".
10408         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10409         (Descriptors::open): Always use O_CLOEXEC when opening a new
10410         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10411         then set FD_CLOEXEC.
10412
10413         * sparc.cc (class Target_sparc): Add has_got_section.
10414         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10415         make sure we have a GOT section.
10416
10417         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10418         (Target_sparc::Scan::local): Likewise.
10419         (Target_sparc::Scan::global): Likewise.
10420         (Target_sparc::Relocate::relocate): Likewise.
10421         (Target_sparc::Relocate::relocate_tls): Likewise.
10422
10423         * symtab.cc (Symbol_table::define_default_version): New function,
10424         broken out of add_from_object.
10425         (Symbol_table::add_from_object): Call define_default_version.
10426         (Symbol_table::define_special_symbol): Add resolve_oldsym
10427         parameter.  Change all callers.  If the version for a symbol comes
10428         from a version script, resolve it with the symbol with the same
10429         name with no version.  Also add the symbol without a version if
10430         appropriate.
10431         (do_define_in_output_data): If resolving with oldsym, don't delete
10432         sym.
10433         (do_define_in_output_segment): Likewise.
10434         (do_define_as_constant): Likewise.
10435         * symtab.h (class Symbol_table): Update declarations.
10436
10437 2009-03-13  Ian Lance Taylor  <iant@google.com>
10438
10439         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10440         (Read_symbols::requeue): New function.
10441         (Read_symbols::do_read_symbols): If make_elf_object fails because
10442         the target type is not configured, and the file was searched for,
10443         issue a warning and retry with the next directory.
10444         (Add_symbols::run): If the file has an incompatible format, and
10445         it was searched for, requeue the Read_symbols task.  On error,
10446         release the object.
10447         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10448         dirindex parameter to constructor.  Change all callers.  Declare
10449         incompatible_warning and requeue.
10450         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10451         input_argument_ and input_group_ fields.  Add them to
10452         constructor.  Change all callers.
10453         (class Read_script): Add dirindex_ field.  Add it to constructor.
10454         Change all callers.
10455         * archive.cc (Archive::setup): Remove input_objects parameter.
10456         Change all callers.
10457         (Archive::get_file_and_offset): Likewise.
10458         (Archive::read_all_symbols): Likewise.
10459         (Archive::read_symbols): Likewise.
10460         (Archive::get_elf_object_for_member): Remove input_objects
10461         parameter.  Add punconfigured parameter.  Change all callers.
10462         (Archive::add_symbols): Change return type to bool.  Check return
10463         value of include_member.
10464         (Archive::include_all_members): Likewise.
10465         (Archive::include_member): Change return type to bool.  Return
10466         false if first included object has incompatible target.  Set
10467         included_member_ field.
10468         (Add_archive_symbols::run): If add_symbols returns false, requeue
10469         Read_symbols task.
10470         * archive.h (class Archive): Add included_member_ field.
10471         Initialize it in constructor.  Add input_file and searched_for
10472         methods.  Update declarations.
10473         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10474         input_argument_ fields.  Add them to constructor.  Change all
10475         callers.
10476         * script.cc: Include "target-select.h".
10477         (class Parser_closure): Add skip_on_incompatible_target_ and
10478         found_incompatible_target_ fields.  Add
10479         skip_on_incompatible_target parameter to constructor.  Change all
10480         callers.  Add methods skip_on_incompatible_target,
10481         clear_skip_on_incompatible_target, found_incompatible_target, and
10482         set_found_incompatible_target.
10483         (read_input_script): Add dirindex parameter.  Change all callers.
10484         If parser finds an incompatible target, requeue Read_symbols
10485         task.
10486         (script_set_symbol): Clear skip_on_incompatible_target in
10487         closure.
10488         (script_add_assertion, script_parse_option): Likewise.
10489         (script_start_sections, script_add_phdr): Likewise.
10490         (script_check_output_format): New function.
10491         * script.h (read_input_script): Update declaration.
10492         * script-c.h (script_check_output_format): Declare.
10493         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10494         (ignore_cmd): Remove OUTPUT_FORMAT.
10495         * fileread.cc (Input_file::Input_file): Add explicit this.
10496         (Input_file::will_search_for): New function.
10497         (Input_file::open): Add pindex parameter.  Change all callers.
10498         * fileread.h (class Input_file): Add input_file_argument method.
10499         Declare will_search_for.  Update declarations.
10500         * object.cc (make_elf_object): Add punconfigured parameter.
10501         Change all callers.
10502         * object.h (class Object): Make input_file public.  Add
10503         searched_for method.
10504         (make_elf_object): Update declaration.
10505         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10506         restart search.
10507         * dirsearch.h (class Dirsearch): Update declaration.
10508         * options.h (class General_options): Add --warn-search-mismatch.
10509         * parameters.cc (Parameters::is_compatible_target): New function.
10510         * parameters.h (class Parameters): Declare is_compatible_target.
10511         * workqueue.cc (Workqueue::add_blocker): New function.
10512         * workqueue.h (class Workqueue): Declare add_blocker.
10513
10514         * fileread.cc (Input_file::open): Remove options parameter.
10515         Change all callers.
10516         (Input_file::open_binary): Likewise.
10517         * script.cc (read_input_script): Likewise.
10518         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10519         options parameter from constructor.  Change all callers.
10520         (class Read_script): Likewise.
10521         * fileread.h (class Input_file): Update declarations.
10522         * script.h (read_input_script): Update declaration.
10523
10524 2009-03-10  Nick Clifton  <nickc@redhat.com>
10525
10526         * po/es.po: New Spanish translation.
10527
10528 2009-03-06  Cary Coutant  <ccoutant@google.com>
10529
10530         * options.cc (parse_short_option): Keep dash_z from registering itself.
10531
10532 2009-03-03  Ian Lance Taylor  <iant@google.com>
10533
10534         PR 9918
10535         * target-reloc.h (relocate_section): Pass output_section to
10536         relocate.
10537         * i386.cc (Target_i386::should_apply_static_reloc): Add
10538         output_section parameter.  Change all callers.
10539         (Target_i386::Relocate::relocate): Add output_section parameter.
10540         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10541         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10542         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10543         * testsuite/two_file_shared.sh: New script.
10544         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10545         (check_DATA): Add two_file_shared.dbg.
10546         (two_file_shared.dbg): New target.
10547         * testsuite/Makefile.in: Rebuild.
10548
10549 2009-03-01  Ian Lance Taylor  <iant@google.com>
10550
10551         * configure.ac: Check for byteswap.h.
10552         * configure: Rebuild.
10553         * config.in: Rebuild.
10554
10555 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10556
10557         * layout.cc (Layout::find_or_add_kept_section): New function.
10558         (Layout::add_comdat): Removed.
10559         * layout.h (struct Kept_section): Move out of class Layout.
10560         Remove trailing underscores from field names.  Add group_sections
10561         field.  Rename group_ field to is_group.  Change all uses.
10562         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10563         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10564         comdat_groups_ field.
10565         (Sized_relobj::include_section_group): Use
10566         find_or_add_kept_section and Kept_section::group_sections.
10567         (Sized_relobj::include_linkonce_section): Likewise.
10568         * object.cc (class Sized_relobj): Don't define Comdat_group or
10569         Comdat_group_table.  Remove find_comdat_group and
10570         add_comdat_group.  Remove comdat_groups_ field.
10571         * plugin.cc (include_comdat_group): Use
10572         Layout::find_or_add_kept_section.
10573
10574 2009-02-28  Ian Lance Taylor  <iant@google.com>
10575
10576         * README: --gc-sections and map files are now supported.  Document
10577         some build requirements.
10578
10579         PR 6992
10580         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10581         relocatable link set the value of the section symbol to zero.
10582         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10583         relocatable link don't include the section address in the local
10584         symbol value.
10585
10586 2009-02-27  Ian Lance Taylor  <iant@google.com>
10587
10588         PR 6811
10589         * options.h (class Search_directory): Add is_system_directory.
10590         (class General_options): Declare is_in_system_directory.
10591         * options.cc (get_relative_sysroot): Make static.
10592         (get_default_sysroot): Make static.
10593         (General_optoins::is_in_system_directory): New function.
10594         * fileread.cc (Input_file::is_in_system_directory): New function.
10595         * fileread.h (class Input_file): Declare is_in_system_directory.
10596         * object.h (class Object): Add is_in_system_directory.
10597         (class Input_objects): Remove system_library_directory_ field.
10598         * object.cc (Input_objects::add_object): Don't set
10599         system_library_directory_.
10600         (input_objects::found_in_system_library_directory): Remove.
10601         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10602         parameter.  Change all callers.
10603         (Symbol_table::sized_write_globals): Likewise.
10604         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10605         Call Object::is_in_system_directory.
10606         * symtab.h (class Symbol_table): Update declarations.
10607
10608         PR 5990
10609         * descriptors.h (Open_descriptor): Add is_on_stack field.
10610         * descriptors.cc (Descriptors::open): If the descriptor is on the
10611         top of the stack, remove it.  Initialize is_on_stack field.
10612         (Descriptors::release): Only add pod to stack if it is not on the
10613         stack already.
10614         (Descriptors::close_some_descriptor): Clear stack_next and
10615         is_on_stack fields.
10616
10617         PR 7091
10618         * output.cc (Output_section::find_starting_output_address): Rename
10619         from starting_output_address; add PADDR parameter; change return
10620         type.
10621         * output.h (class Output_section): Declare
10622         find_starting_output_address instead of starting_output_address.
10623         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10624         section symbol for which we can't find a merge section.
10625
10626         PR 9836
10627         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10628         hidden or internal, force the symbol to be local.
10629         * resolve.cc (Symbol::override_visibility): Define.
10630         (Symbol::override_base): Use override_visibility.
10631         (Symbol_table::resolve): Likewise.
10632         (Symbol::override_base_with_special): Likewise.
10633         (Symbol_table::override_with_special): If the visibility is hidden
10634         or internal, force the symbol to be local.
10635         * symtab.h (class Symbol): Add set_visibility and
10636         override_visibility.
10637         * testsuite/ver_test_1.sh: New file.
10638         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10639         (check_DATA): Add ver_test_1.syms.
10640         (ver_test_1.syms): New target.
10641         * testsuite/Makefile.in: Rebuild.
10642
10643 2009-02-25  Cary Coutant  <ccoutant@google.com>
10644
10645         * layout.cc (Layout::choose_output_section): Don't rename sections
10646         when using a linker script that has a SECTIONS clause.
10647         * Makefile.in: Regenerate.
10648
10649         * testsuite/Makefile.am (script_test_5.sh): New test case.
10650         * testsuite/Makefile.in: Regenerate.
10651         * testsuite/script_test_5.cc: New file.
10652         * testsuite/script_test_5.sh: New file.
10653         * testsuite/script_test_5.t: New file.
10654
10655 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10656
10657         * archive.cc (Archive::include_member): Update calls to add_symbols.
10658         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10659         the Layout argument.
10660         * dynobj.h (do_add_symbols): Add the Layout argument.
10661         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10662         Layout argument.
10663         * object.h (Object::add_symbols): Add the Layout argument.
10664         (Object::do_add_symbols): Add the Layout argument.
10665         (Sized_relobj::do_add_symbols): Add the Layout argument.
10666         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10667         Unify the two versions.
10668         (Add_plugin_symbols): Remove.
10669         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10670         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10671         (Add_plugin_symbols): Remove.
10672         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10673         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10674         (Add_symbols::run): Make it work with Pulginobj.
10675
10676 2009-02-06  Ian Lance Taylor  <iant@google.com>
10677
10678         * object.cc (Sized_relobj::do_layout): Make info message start
10679         with lower case letter.
10680
10681 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10682
10683         * binary.cc: Fix file comment.
10684
10685         * options.h (enum Incremental_disposition): Define.
10686         (class General_options): Add new options: --incremental,
10687         --incremental_changed, --incremental_unchanged,
10688         --incremental_unknown.  Add incremental_disposition_ and
10689         implicit_incremental_ fields.
10690         (General_options::incremental_disposition): New function.
10691         (class Position_dependent_options): Add incremental_disposition
10692         option.
10693         (Position_dependent_options::copy_from_options): Set incremental
10694         dispositions.
10695         * options.cc (General_options::parse_incremental_changed): New
10696         function.
10697         (General_options::parse_incremental_unchanged): New function.
10698         (General_options::parse_incremental_unknown): New function.
10699         (General_options::General_options): Initialize new fields
10700         incremental_disposition_ and implicit_incremental_.
10701         (General_options::finalize): Check for uasge of --incremental-*
10702         without --incremental.
10703
10704 2009-02-06  Chris Demetriou  <cgd@google.com>
10705
10706         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10707         pointer and to report location as the file name associated with
10708         the symbol.
10709         (gold_undefined_symbol_at_location): New function to replace the
10710         old gold_undefined_symbol functionality.
10711         * target-reloc.h (relocate_section): Update to use
10712         gold_undefined_symbol_at_location.
10713         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10714         Call gold_undefined_symbol function rather than gold_error.
10715         * errors.h (Errors::undefined_symbol): Take location as a
10716         string, rather than calculating it from a relocation.
10717         * errors.cc (Errors::fatal): Print "fatal error:" before the
10718         formatted message.
10719         (Errors::error, Errors::error_at_location): Print "error: "
10720         before the formatted message.
10721         (Errors::undefined_symbol): Take location as a string, rather
10722         than calculating it from a relocation.
10723         (gold_undefined_symbol_at_location): New function akin to
10724         old gold_undefined_symbol, calculates location from relocation.
10725         (gold_undefined_symbol): Change to take only a Symbol pointer
10726         and to report location as the file name associated with the symbol.
10727         * testsuite/debug_msg.sh: Update for changed error messages.
10728         * testsuite/undef_symbol.sh: Likewise.
10729
10730 2009-02-04  Duncan Sands  <baldrick@free.fr>
10731
10732         PR 9812
10733         * reduced_debug_output.h
10734         (Output_reduced_debug_abbrev_section::failed): Use format for
10735         gold_warning.
10736         (Output_reduced_debug_info_section::faild): Likewise.
10737
10738 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10739
10740         * script.cc (Lazy_demangler): New class.
10741         (Version_script_info::get_symbol_version_helper): Demangle a
10742         symbol only once.
10743
10744 2009-01-29  Cary Coutant  <ccoutant@google.com>
10745
10746         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10747         to __tls_get_addr.
10748         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10749
10750 2009-01-28  Ian Lance Taylor  <iant@google.com>
10751
10752         * version.cc (version_string): Bump to 1.9.
10753
10754         * gold.h: Include <cstring> and <stdint.h>.
10755         * version.cc: Include <cstdio>.
10756         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10757         warning.
10758         * reduced_debug_output.cc (insert_into_vector): Rename from
10759         Insert_into_vector; change all callers.  Use Swap_unaligned to
10760         avoid aliasing issue; remove union since it is unnecessary.
10761
10762 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10763
10764         * Makefile.am (CCFILES): Add gc.cc.
10765         (HFILES): Add gc.h.
10766         * Makefile.in: Regenerate.
10767         * gold.cc (Gc_runner): New class.
10768         (queue_initial_tasks): Call garbage collection related tasks
10769         when corresponding options are invoked.
10770         (queue_middle_gc_tasks): New function.
10771         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10772         processed early before laying out sections during garbage collection.
10773         * gold.h (queue_middle_gc_tasks): New function.
10774         (is_prefix_of): Move from "layout.cc".
10775         * i386.cc (Target_i386::gc_process_relocs): New function.
10776         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10777         * main.cc (main): Create object of class "Garbage_collection".
10778         * object.cc (Relobj::copy_symbols_data): New function.
10779         (Relobj::is_section_name_included): New function.
10780         (Sized_relobj::do_layout): Allow this function to be called twice
10781         during garbage collection and defer layout of section during the
10782         first call.
10783         * object.h (Relobj::get_symbols_data): New function.
10784         (Relobj::is_section_name_included): New function.
10785         (Relobj::copy_symbols_data): New function.
10786         (Relobj::set_symbols_data): New function.
10787         (Relobj::get_relocs_data): New function.
10788         (Relobj::set_relocs_data): New function.
10789         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10790         (Relobj::gc_process_relocs): New function.
10791         (Relobj::do_gc_process_relocs): New pure virtual function.
10792         (Relobj::sd_): New data member.
10793         (Sized_relobj::is_output_section_offset_invalid): New function.
10794         (Sized_relobj::do_gc_process_relocs): New function.
10795         * options.h (General_options::gc_sections): Modify to not be a no-op.
10796         (General_options::print_gc_sections): New option.
10797         * plugin.cc (Plugin_finish::run): Remove function call to
10798         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10799         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10800         * reloc.cc (Read_relocs::run): Add task to process relocs and
10801         determine unreferenced sections when doing garbage collection.
10802         (Gc_process_relocs): New class.
10803         (Sized_relobj::do_gc_process_relocs): New function.
10804         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10805         sections that are garbage collected.
10806         * reloc.h (Gc_process_relocs): New class.
10807         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10808         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10809         symbols whose corresponding sections are garbage collected.
10810         (Symbol_table::Symbol_table): Add new parameter for the garbage
10811         collection object.
10812         (Symbol_table::gc_mark_undef_symbols): New function.
10813         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10814         (Symbol_table::gc_mark_dyn_syms): New function.
10815         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10816         as garbage.
10817         (Symbol_table::add_from_object): Likewise.
10818         (Symbol_table::add_from_relobj): When building shared objects, do not
10819         treat externally visible symbols as garbage.
10820         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10821         table information for static and relocatable links.
10822         * symtab.h (Symbol_table::set_gc): New function.
10823         (Symbol_table::gc): New function.
10824         (Symbol_table::gc_mark_undef_symbols): New function.
10825         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10826         (Symbol_table::gc_mark_dyn_syms): New function.
10827         (Symbol_table::gc_): New data member.
10828         * target.h (Sized_target::gc_process_relocs): New pure virtual
10829         function.
10830         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10831         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10832
10833 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10834
10835         * options.h (General_options::gc_sections): Define as a no-op for now.
10836         (General_options::no_keep_memory): Ditto.
10837         (General_options::Bshareable): Define.
10838         * options.cc (General_options::finalize): Honor -Bshareable.
10839
10840 2009-01-20  Andreas Schwab  <schwab@suse.de>
10841
10842         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10843         read the value in the contents, since we don't use it.  Use the
10844         template endianness when writing.
10845         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10846
10847 2009-01-19  Andreas Schwab  <schwab@suse.de>
10848
10849         * configure.tgt (powerpc64-*): Fix targ_obj.
10850
10851 2009-01-15  Ian Lance Taylor  <iant@google.com>
10852
10853         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10854         local symbols when stripping all symbols.
10855
10856 2009-01-14  Cary Coutant  <ccoutant@google.com>
10857
10858         * output.cc (Output_reloc): Add explicit instantiations.
10859
10860 2009-01-14  Cary Coutant  <ccoutant@google.com>
10861
10862         * archive.cc (Archive::get_elf_object_for_member): Remove call
10863         to File_read::claim_for_plugin.
10864         * descriptors.cc (Descriptors::open): Remove reference to
10865         is_claimed.
10866         (Descriptors::claim_for_plugin): Remove.
10867         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10868         (Descriptors::is_claimed): Remove.
10869         (claim_descriptor_for_plugin): Remove.
10870         * fileread.cc (File_read::claim_for_plugin): Remove.
10871         * fileread.h (File_read::claim_for_plugin): Remove.
10872         (File_read::descriptor): Reopen descriptor if necessary.
10873         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10874         (Plugin_manager::all_symbols_read): Add task parameter. Change
10875         all callers.
10876         (Plugin_manager::get_input_file): New function.
10877         (Plugin_manager::release_input_file): New function.
10878         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10879         corresponding data member.
10880         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10881         and pass to base constructor. Change all callers.
10882         (get_input_file, release_input_file): New functions.
10883         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10884         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10885         (Plugin_manager::all_symbols_read): Add task parameter.
10886         (Plugin_manager::get_input_file): New function.
10887         (Plugin_manager::release_input_file): New function.
10888         (Plugin_manager::task_): New data member.
10889         (Pluginobj::Pluginobj): Add filesize parameter.
10890         (Pluginobj::filename): New function.
10891         (Pluginobj::descriptor): New function.
10892         (Pluginobj::filesize): New function.
10893         (Pluginobj::filesize_): New data member.
10894         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10895         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10896         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10897
10898         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10899         with archive libraries.
10900         * testsuite/Makefile.in: Regenerate.
10901         * testsuite/plugin_test.c (struct sym_info): New type.
10902         (get_input_file, release_input_file): New static variables.
10903         (onload): Capture new transfer vector entries.
10904         (claim_file_hook): Stop reading at end of file according to filesize.
10905         Factor out parsing of readelf output into separate function.
10906         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10907         APIs and get the source file name from the symbol table.  Convert
10908         source file name to corresponding object file name.  Print info
10909         message when adding new input files.
10910         (parse_readelf_line): New function.
10911         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10912         * testsuite/plugin_test_2.sh: Likewise.
10913         * testsuite/plugin_test_3.sh: Likewise.
10914         * testsuite/plugin_test_4.sh: New test case.
10915
10916 2009-01-07  Ian Lance Taylor  <iant@google.com>
10917
10918         * version.cc (version_string): Bump to 1.8.
10919
10920 2008-12-23  Cary Coutant  <ccoutant@google.com>
10921
10922         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10923         * plugin.cc (Plugin_manager::finish): Rename as
10924         layout_deferred_objects.  Move cleanup to separate function.
10925         (Plugin_manager::cleanup): New function.
10926         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10927         separately.
10928         * plugin.h (Plugin_manager::finish): Rename as
10929         layout_deferred_objects.
10930         (Plugin_manager::cleanup): New function.
10931         (Plugin_manager::cleanup_done): New field.
10932
10933 2008-12-23  Cary Coutant  <ccoutant@google.com>
10934
10935         * plugin.cc (is_visible_from_outside): New function.
10936         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10937         so we don't return "IR only" status for exported symbols or -r links.
10938
10939         * testsuite/Makefile.am (plugin_test_3): New test case.
10940         * testsuite/Makefile.in: Regenerate.
10941         * testsuite/plugin_test_3.sh: New file.
10942
10943 2008-12-22  Cary Coutant  <ccoutant@google.com>
10944
10945         * object.cc (Sized_relobj::layout_section): New function.
10946         (Sized_relobj::do_layout): Defer layout of input sections until after
10947         plugin has provided replacement files.
10948         (Sized_relobj::do_layout_deferred_sections): New function.
10949         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10950         (Relobj::layout_deferred_sections): New function.
10951         (Relobj::do_layout_deferred_sections): New function.
10952         (Sized_relobj::do_layout_deferred_sections): New function.
10953         (Sized_relobj::layout_section): New function.
10954         (Sized_relobj::Deferred_layout): New structure.
10955         (Sized_relobj::deferred_layout_): New field.
10956         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10957         Change all callers.  Layout deferred sections.
10958         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10959         references.
10960         (Plugin_hook::run): Move code from do_plugin_hook inline.
10961         (Plugin_hook::do_plugin_hook): Remove.
10962         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10963         (Plugin_manager::finish): Renamed, was cleanup.
10964         (Plugin_manager::should_defer_layout): New function.
10965         (Plugin_manager::add_deferred_layout_object): New function.
10966         (Plugin_manager::Deferred_layout_list): New type.
10967         (Plugin_manager::deferred_layout_objects_): New field.
10968         (Plugin_hook::do_plugin_hook): Remove.
10969
10970 2008-12-17  Ian Lance Taylor  <iant@google.com>
10971
10972         * options.h (class General_options): Add --no case for
10973         --export-dynamic.
10974
10975 2008-12-16  Cary Coutant  <ccoutant@google.com>
10976
10977         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10978         vector.
10979         (Plugin_manager::claim_file): Create plugin object even if
10980         plugin did not call the add_symbols callback.
10981         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10982         asking for more symbols than were added.
10983         * testsuite/Makefile.am (plugin_test_1): Add test case with
10984         no global symbols.
10985         (empty.syms): New target.
10986         * testsuite/Makefile.in: Regenerate.
10987         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10988         message. Don't call add_symbols if no globals.
10989         (all_symbols_read_hook): Don't provide replacement for empty
10990         claimed file.
10991
10992 2008-12-12  Ian Lance Taylor  <iant@google.com>
10993
10994         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10995         r_type == 0 for a local symbol with r_sym == 0.
10996         (scan_relocatable_relocs): Pass r_sym to
10997         local_non_section_strategy.
10998         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10999         r_sym parameter.
11000
11001         * configure.ac: Update test for TLS descriptors: they are
11002         supported as of glibc 2.9.
11003         * configure: Rebuild.
11004
11005 2008-12-11  Ian Lance Taylor  <iant@google.com>
11006
11007         PR 7091
11008         * target-reloc.h (Default_scan_relocatable_relocs): For each
11009         function, map r_type == 0 to RELOC_DISCARD.
11010
11011 2008-12-10  Cary Coutant  <ccoutant@google.com>
11012
11013         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11014         object to override a kept COMDAT group from a plugin object.
11015
11016 2008-12-09  Ian Lance Taylor  <iant@google.com>
11017
11018         PR 7088
11019         * yyscript.y (file_cmd): Handle INPUT.
11020
11021         * testsuite/initpri1.c: Change all declarations to be full
11022         prototypes by adding void, to avoid compiler warnings.
11023
11024 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11025
11026         * options.cc (General_options::parse_plugin_opt): New.
11027         (General_options::add_plugin): The argument now is just the filename.
11028         (General_options::add_plugin_option): New.
11029         * options.h (plugin_opt): New.
11030         (add_plugin): Change argument name.
11031         (add_plugin_option): New.
11032         * plugin.cc (Plugin::load): Don't parse the plugin option.
11033         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11034         (Plugin::add_option): New.
11035         (Plugin::args_): Change type.
11036         (Plugin::filename_): New.
11037         (Plugin_manager::add_plugin_option): New.
11038         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11039         * testsuite/Makefile.in: Regenerate.
11040
11041 2008-12-05  Cary Coutant  <ccoutant@google.com>
11042
11043         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11044         Handle --strip-lto-sections option.
11045         * options.h (strip_lto_sections): New option.
11046
11047 2008-12-01  Cary Coutant  <ccoutant@google.com>
11048
11049         * plugin.cc (ld_plugin_message): Change format parameter to const.
11050         Fix mismatch between new[] and delete.
11051
11052 2008-11-14  Cary Coutant  <ccoutant@google.com>
11053
11054         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11055         instead of -1U.
11056
11057 2008-11-05  Craig Silverstein  <csilvers@google.com>
11058
11059         * options.cc (General_options::parse_dynamic_list): New function.
11060         * options.h (General_options): New flags dynamic_list,
11061         dynamic_list_data, dynamic_list_cpp_new, and
11062         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11063         (General_options::in_dynamic_list): New function.
11064         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11065         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11066         (Lex::can_continue_name): Likewise.
11067         (yylex): Likewise.
11068         (read_script_file): New parameter script_options.
11069         (read_dynamic_list): New function.
11070         (Script_options::define_dynamic_list): New function.
11071         (dynamic_list_keyword_parsecodes): New variable.
11072         (dynamic_list_keywords): New variable.
11073         * script.h (Script_options::define_dynamic_list): New function
11074         prototype.
11075         (read_dynamic_list): New function prototype.
11076         * symtab.cc (strprefix): New macro.
11077         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11078         dynamic_list_data, dynamic_list_cpp_new, and
11079         dynamic_list_cpp_typeinfo.
11080         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11081         (dynamic_list_expr): New rule.
11082         (dynamic_list_nodes): Likewise.
11083         (dynamic_list_node): Likewise.
11084         * testsuite/Makefile.am (dynamic_list): New test.
11085         * testsuite/Makefile.in: Regenerated.
11086         * testsuite/dynamic_list.t: New file.
11087         * testsuite/dynamic_list.sh: New file.
11088
11089 2008-11-05  Craig Silverstein  <csilvers@google.com>
11090
11091         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11092         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11093         (t11_last): Likewise.
11094         * testsuite/ver_test_6.c (main): Likewise.
11095
11096 2008-10-07  Cary Coutant  <ccoutant@google.com>
11097
11098         * options.c (General_options::finalize): Add check for -static and
11099         -shared.
11100         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11101         is not empty.
11102
11103 2008-10-02  Cary Coutant  <ccoutant@google.com>
11104
11105         * plugin.cc (make_sized_plugin_object): Fix conditional
11106         compilation to work when not all targets are enabled.
11107
11108 2008-09-29  Cary Coutant  <ccoutant@google.com>
11109
11110         * archive.cc (Archive::get_file_and_offset): Use filename instead
11111         of name to get library path.
11112         (Archive::include_member): Unlock external member of a thin archive.
11113
11114         * testsuite/Makefile.am (TEST_AR): New variable.
11115         (thin_archive_test_1): New test.
11116         (thin_archive_test_2): New test.
11117         * testsuite/Makefile.in: Regenerate.
11118         * testsuite/thin_archive_main.cc: New file.
11119         * testsuite/thin_archive_test_1.cc: New file.
11120         * testsuite/thin_archive_test_2.cc: New file.
11121         * testsuite/thin_archive_test_3.cc: New file.
11122         * testsuite/thin_archive_test_4.cc: New file.
11123
11124 2008-09-29  Cary Coutant  <ccoutant@google.com>
11125
11126         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11127         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11128         instead of -1U.
11129         (Sized_relobj::do_finalize_local_symbols): Likewise.
11130         (Sized_relobj::map_to_kept_section): Likewise.
11131         * object.h (Sized_relobj::invalid_address): New constant.
11132         (Sized_relobj::do_output_section_offset): Check for invalid_address
11133         and return -1ULL.
11134         * output.cc (Output_reloc::local_section_offset): Use constant
11135         invalid_address instead of -1U.
11136         (Output_reloc::get_address): Likewise.
11137         (Output_section::output_address): Change -1U to -1ULL.
11138         * output.h (Output_reloc::invalid_address): New constant.
11139         * reloc.cc (Sized_relobj::write_sections): Use constant
11140         invalid_address instead of -1U.
11141         (Sized_relobj::relocate_sections): Likewise.
11142         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11143         values for merge sections.
11144         * target-reloc.h (relocate_for_relocatable): Use constant
11145         invalid_address instead of -1U.
11146
11147 2008-09-19  Cary Coutant  <ccoutant@google.com>
11148
11149         Add plugin functionality for link-time optimization (LTO).
11150         * configure.ac (plugins): Add --enable-plugins option.
11151         * configure: Regenerate.
11152         * config.in: Regenerate.
11153         * Makefile.am (LIBDL): New variable.
11154         (CCFILES): Add plugin.cc.
11155         (HFILES): Add plugin.h.
11156         (ldadd_var): Add LIBDL.
11157         * Makefile.in: Regenerate.
11158
11159         * archive.cc: Include "plugin.h".
11160         (Archive::setup): Don't preread archive symbols when using a plugin.
11161         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11162         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11163         files.
11164         (Archive::include_member): Add symbols from plugin objects.
11165         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11166         * descriptors.cc (Descriptors::open): Check for file descriptors
11167         abandoned by plugins.
11168         (Descriptors::claim_for_plugin): New function.
11169         * descriptors.h (Descriptors::claim_for_plugin): New function.
11170         (Open_descriptor::is_claimed): New field.
11171         (claim_descriptor_for_plugin): New function.
11172         * fileread.cc (File_read::claim_for_plugin): New function.
11173         * fileread.h (File_read::claim_for_plugin): New function.
11174         (File_read::descriptor): New function.
11175         * gold.cc: Include "plugin.h".
11176         (queue_initial_tasks): Add task to call plugin hooks for generating
11177         new object files.
11178         * main.cc: Include "plugin.h".
11179         (main): Load plugin libraries.
11180         * object.h (Pluginobj): Declare.
11181         (Object::pluginobj): New function.
11182         (Object::do_pluginobj): New function.
11183         (Object::set_target): New function.
11184         * options.cc: Include "plugin.h".
11185         (General_options::parse_plugin): New function.
11186         (General_options::General_options): Initialize plugins_ field.
11187         (General_options::add_plugin): New function.
11188         * options.h (Plugin_manager): Declare.
11189         (General_options): Add --plugin option.
11190         (General_options::has_plugins): New function.
11191         (General_options::plugins): New function.
11192         (General_options::add_plugin): New function.
11193         (General_options::plugins_): New field.
11194         * plugin.cc: New file.
11195         * plugin.h: New file.
11196         * readsyms.cc: Include "plugin.h".
11197         (Read_symbols::do_read_symbols): Check for archive before checking
11198         for ELF file.  Call plugin hooks to claim files.
11199         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11200         from a real object file; force override when processing replacement
11201         files.
11202         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11203         (Symbol::init_base_object): Likewise.
11204         (Symbol::init_base_output_data): Likewise.
11205         (Symbol::init_base_output_segment): Likewise.
11206         (Symbol::init_base_constant): Likewise.
11207         (Symbol::init_base_undefined): Likewise.
11208         (Symbol::output_section): Assert that object is not a plugin.
11209         (Symbol_table::add_from_pluginobj): New function.
11210         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11211         undefined.
11212         (Symbol_table::sized_write_globals): Likewise.
11213         (Symbol_table::add_from_pluginobj): Instantiate template.
11214         * symtab.h (Sized_pluginobj): Declare.
11215         (Symbol::in_real_elf): New function.
11216         (Symbol::set_in_real_elf): New function.
11217         (Symbol::in_real_elf_): New field.
11218         (Symbol_table::add_from_pluginobj): New function.
11219
11220         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11221         (LIBDL): New variable.
11222         (LDADD): Add LIBDL.
11223         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11224         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11225         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11226         (MOSTLYCLEANFILES): Likewise.
11227         * testsuite/Makefile.in: Regenerate.
11228         * testsuite/plugin_test.c: New file.
11229         * testsuite/plugin_test_1.sh: New file.
11230         * testsuite/plugin_test_2.sh: New file.
11231
11232 2008-09-16  Ian Lance Taylor  <iant@google.com>
11233
11234         * target-reloc.h (relocate_section): Check whether a symbol is
11235         defined by the ABI before reporting an undefined symbol error.
11236         * target.h (Target::is_defined_by_abi): Make parameter const.
11237         (Target::do_is_defined_by_abi): Likewise.
11238         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11239         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11240         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11241         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11242         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11243         * testsuite/Makefile.in: Rebuild.
11244
11245         * fileread.cc (make_view): Add casts to avoid warning.
11246
11247 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11248
11249         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11250         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11251
11252 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11253
11254         * options.h (General_options::output_is_executable): New.
11255         (General_options::output_is_pie): New.
11256         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11257         for shared libraries.
11258         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11259
11260 2008-09-11  Chris Demetriou  <cgd@google.com>
11261
11262         * options.h (origin): New -z option.
11263         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11264         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11265         in DT_FLAGS_1.
11266
11267 2008-09-05  Cary Coutant  <ccoutant@google.com>
11268
11269         * fileread.cc (File_read::make_view): Add check for attempt to map
11270         beyond end of file.
11271
11272 2008-09-05  Cary Coutant  <ccoutant@google.com>
11273
11274         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11275         explicit instantiations.
11276
11277 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11278
11279         PR gold/6858
11280         * options.cc (General_options::finalize): Allow undefined symbols
11281         in shlibs if linking -shared.
11282
11283         PR gold/6859
11284         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11285         symbols as not needing a dynsym entry.
11286
11287 2008-08-20  Craig Silverstein  <csilvers@google.com>
11288
11289         * fileread.cc (File_read::open): Do not lock the file unless it
11290         was successfully opened.
11291
11292 2008-08-14  Cary Coutant  <ccoutant@google.com>
11293
11294         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11295         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11296         * testsuite/tls_test.cc (struct int128): 128-bit struct
11297         for testing TLS relocs with non-zero addend.
11298         (v12): New TLS variable.
11299         (t12): New test.
11300         (t_last): Add check for v12.
11301         * testsuite/tls_test.h (t12): New function.
11302         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11303
11304 2008-08-13  Ian Lance Taylor  <iant@google.com>
11305
11306         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11307         set tls_segment_ or relro_segment_.
11308         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11309         when appropriate.
11310         * output.h (Output_section::clear_is_relro): New function.
11311         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11312         sections specially even when output_data_ is empty.
11313         (Output_segment::maximum_alignment): When first section is relro,
11314         only force alignment for PT_LOAD segments.
11315         * script.cc (script_data_segment_align): New function.
11316         (script_data_segment_relro_end): New function.
11317         * script-c.h (script_data_segment_align): Declare.
11318         (script_data_segment_relro_end): Declare.
11319         * script-sections.h (class Script_sections): Declare
11320         data_segment_align and data_segment_relro_end.  Add fields
11321         segment_align_index_ and saw_relro_end_.
11322         * script-sections.cc (class Sections_element): Add set_is_relro
11323         virtual function.  Add new bool* parameter to place_orphan_here.
11324         Add get_output_section virtual function.
11325         (class Output_section_definition): Add set_is_relro.  Add new
11326         bool* parameter to place_orphan_here.  Add get_output_section.
11327         Add is_relro_ field.
11328         (Output_section_definition::Output_section_definition): Initialize
11329         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11330         and is_relro_ fields.
11331         (Output_section_definition::place_orphan_here): Add is_relro
11332         parameter.
11333         (Output_section_definition::set_section_addresses): Set relro for
11334         output section.
11335         (Output_section_definition::alternate_constraint): Likewise.
11336         (class Orphan_output_section): Add new bool* parameter to
11337         place_orphan_here.  Add get_output_section.
11338         (Orphan_output_section::place_orphan_here): Add is_relro
11339         parameter.
11340         (Script_sections::Script_sections): Initialize
11341         data_segment_align_index_ and saw_relro_end_.
11342         (Script_sections::data_segment_align): New function.
11343         (Script_sections::data_segment_relro_end): New function.
11344         (Script_sections::place_orphan): Set or clear is_relro.
11345         (Script_sections::set_section_addresses): Force alignment of first
11346         TLS section.
11347         * yyscript.y (exp): Call script_data_segment_align and
11348         script_data_segment_relro_end.
11349         * testsuite/relro_script_test.t: New file.
11350         * testsuite/relro_test.cc (using_script): Declare.
11351         (t1, t2): Test using_script.
11352         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11353         (relro_script_test_SOURCES): Define.
11354         (relro_script_test_DEPENDENCIES): Define.
11355         (relro_script_test_LDFLAGS): Define.
11356         (relro_script_test_LDADD): Define.
11357         (relro_script_test.so): New target.
11358         * testsuite/Makefile.in: Rebuild.
11359
11360 2008-08-06  Cary Coutant <ccoutant@google.com>
11361
11362         * archive.cc (Archive::total_archives, Archive::total_members)
11363         (Archive::total_members_loaded): New variables.
11364         (Archive::setup): Add parameter.  Add option to preread
11365         archive symbols.
11366         (Archive::read_armap): Add counter.
11367         (Archive::get_file_and_offset): New function.
11368         (Archive::get_elf_object_for_member): New function.
11369         (Archive::read_all_symbols): New function.
11370         (Archive::read_symbols): New function.
11371         (Archive::add_symbols): Add counters.
11372         (Archive::include_all_members): Use armap to find members if it's
11373         already built.
11374         (Archive::include_member): Skip reading symbols if already read.
11375         Factored code into Archive::get_file_and_offset and
11376         Archive::get_elf_object_for_member.  Changed call to
11377         Mapfile::report_include_archive_member.
11378         (Archive::print_stats): New function.
11379         * archive.h: Declare Object and Read_symbols_data classes.
11380         (Archive::Archive): Add initializers for new members.
11381         (Archive::setup): Add parameter.
11382         (Archive::print_stats): New function.
11383         (Archive::total_archives, Archive::total_members)
11384         (Archive::total_members_loaded): New variables.
11385         (Archive::get_file_and_offset): New function.
11386         (Archive::get_elf_object_for_member): New function.
11387         (Archive::read_all_symbols): New function.
11388         (Archive::read_symbols): New function.
11389         (Archive::Archive_member): New class.
11390         (Archive::members_): New member.
11391         (Archive::num_members_): New member.
11392         * main.cc: Include archive.h.
11393         (main): Call Archive::print_stats.
11394         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11395         archive parameter; member_name is now the fully-decorated name.
11396         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11397         * options.h: (General_options): Add --preread-archive-symbols option.
11398         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11399         Archive::setup.
11400
11401 2008-08-04  Ian Lance Taylor  <iant@google.com>
11402
11403         * symtab.h (Symbol::use_plt_offset): New function.
11404         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11405         * powerpc.cc (Relocate::relocate): Likewise.
11406         * sparc.cc (Relocate::relocate): Likewise.
11407         * x86_64.cc (Relocate::relocate): Likewise.
11408         * testsuite/weak_plt.sh: New test.
11409         * testsuite/weak_plt_main.cc: New test.
11410         * testsuite/weak_plt_shared.cc: New test.
11411         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11412         (check_PROGRAMS): Add weak_plt.
11413         (check_DATA): Add weak_plt_shared.so.
11414         (weak_plt_main_pic.o, weak_plt): New targets.
11415         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11416         * testsuite/Makefile.in: Rebuild.
11417
11418         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11419         gcctestdir/ld.
11420         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11421         * testsuite/Makefile.in: Rebuild.
11422
11423 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11424
11425         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11426         * Makefile.in: Regenerate.
11427         * po/POTFILES.in: Regenerate.
11428
11429 2008-07-29  Ian Lance Taylor  <iant@google.com>
11430
11431         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11432         symbols before other symbols.
11433         * testsuite/script_test_2.cc (test_addr): Declare.
11434         (test_addr_alias): Declare.
11435         (main): Check that test_addr and test_addr_alias have the right
11436         values.
11437         * testsuite/script_test_2.t: Define test_addr_alias and
11438         test_addr.
11439
11440 2008-07-24  Ian Lance Taylor  <iant@google.com>
11441
11442         PR 5990
11443         * descriptors.cc: New file.
11444         * descriptors.h: New file.
11445         * gold-threads.h (class Hold_optional_lock): New class.
11446         * fileread.cc: Include "descriptors.h".
11447         (File_read::~File_read): Release descriptor rather than closing
11448         it.
11449         (File_read::open) [file]: Call open_descriptor rather than open.
11450         Set is_descriptor_opened_.
11451         (File_read::open) [memory]: Assert that descriptor is not open.
11452         (File_read::reopen_descriptor): New function.
11453         (File_read::release): Release descriptor.
11454         (File_read::do_read): Make non-const.  Reopen descriptor.
11455         (File_read::read): Make non-const.
11456         (File_read::make_view): Reopen descriptor.
11457         (File_read::do_readv): Likewise.
11458         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11459         Update declarations.
11460         * layout.cc: Include "descriptors.h".
11461         (Layout::create_build_id): Use open_descriptor rather than open.
11462         * output.cc: Include "descriptors.h".
11463         (Output_file::open): Use open_descriptor rather than open.
11464         * archive.cc (Archive::const_iterator): Change Archive to be
11465         non-const.
11466         (Archive::begin, Archive::end): Make non-const.
11467         (Archive::count_members): Likewise.
11468         * archive.h (class Archive): Update declarations.
11469         * object.h (Object::read): Make non-const.
11470         * Makefile.am (CCFILES): Add descriptors.cc.
11471         (HFILES): Add descriptors.h.
11472         * Makefile.in: Rebuild.
11473
11474         PR 6716
11475         * gold.h: Always include <clocale>.  Add Solaris workarounds
11476         following code in binutils/sysdep.h.
11477
11478         PR 6048
11479         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11480         this->eh_frame_hdr_ is NULL before using it.
11481
11482         * dynobj.cc (Versions::Versions): Update comment.
11483
11484         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11485         the base version name.
11486
11487         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11488         array size plus one.
11489         (Stringpool_template::set_string_offsets): Subtract one from key
11490         before using it as an array index.
11491         (Stringpool_template::get_offset_with_length): Likewise.
11492         (Stringpool_template::write_to_buffer): Likewise.
11493         * stringpool.h (Stringpool_template::get_offset_from_key):
11494         Likewise.
11495
11496 2008-07-23  Ian Lance Taylor  <iant@google.com>
11497
11498         PR 6658
11499         * object.h (Merged_symbol_value::value): Do our best to handle a
11500         negative addend.
11501
11502         PR 6647
11503         * script.cc (Version_script_info::get_versions): Don't add empty
11504         version tag to return value.
11505         (Version_script_info::get_symbol_version_helper): Change return
11506         type to bool.  Add pversion parameter.  Change all callers.
11507         (script_register_vers_node): Don't require a non-NULL tag.
11508         * script.h (class Version_script_info): Update declarations.
11509         (Version_script_info::get_symbol_version): Change return type to
11510         bool.  Add version parameter.  Change all callers.
11511         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11512         handling.  Handle an empty version from a version script.
11513         (Symbol_table::define_special_symbol): Likewise.
11514         * testsuite/ver_test_10.script: New file.
11515         * testsuite/ver_test_10.sh: New file.
11516         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11517         (check_DATA): Add ver_test_10.syms.
11518         (ver_test_10.syms, ver_test_10.so): New target.
11519         * testsuite/Makefile.in: Rebuild.
11520
11521 2008-07-23  Simon Baldwin  <simonb@google.com>
11522
11523         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11524         to zero for undefined symbols from dynamic libraries.
11525
11526 2008-07-23  Ian Lance Taylor  <iant@google.com>
11527
11528         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11529         Change all callers.
11530         * symtab.h (class Symbol_table): Update declaration.
11531         * testsuite/ver_test_9.cc: New file.
11532         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11533         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11534         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11535         (ver_test_9.so, ver_test_9.o): New targets.
11536         * testsuite/Makefile.in: Rebuild.
11537
11538 2008-07-22  Ian Lance Taylor  <iant@google.com>
11539
11540         * options.h (class General_options): Define --check-sections.
11541         * layout.cc (Layout::set_segment_offsets): Handle
11542         --check-sections.
11543
11544         * options.h (class General_options): Define -n/--nmagic and
11545         -N/--omagic.
11546         * options.cc (General_options::finalize): For -n/--nmagic or
11547         -N/--omagic, set -static.
11548         * layout.cc (Layout::attach_allocated_section_to_segment): If
11549         -N/--omagic, don't put read-only and read-write sections in
11550         different segments.
11551         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11552         finding a read-only segment.
11553         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11554         don't set the minimum segment alignment to the common page size,
11555         and don't set the file offset to the address modulo the page size.
11556         * script-sections.cc (Script_sections::create_segments): If
11557         -n/--omagic, don't put read-only and read-write sections in
11558         different segments.
11559
11560         * cref.cc: New file.
11561         * cref.h: New file.
11562         * options.h (class General_options): Add --print-symbol-counts.
11563         * main.cc (main): Issue defined symbol report if requested.
11564         * archive.cc (Archive::interpret_header): Make into a const member
11565         function.
11566         (Archive::add_symbols): Call Input_objects::archive_start and
11567         archive_stop.
11568         (Archive::const_iterator): Define new class.
11569         (Archive::begin, Archive::end): New functions.
11570         (Archive::include_all_members): Rewrite to use iterator.
11571         (Archive::count_members): New function.
11572         * archive.h (class Archive): Update declarations.
11573         (Archive::filename): New function.
11574         * object.cc: Include "cref.h".
11575         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11576         (Sized_relobj::do_get_global_symbol_counts): New function.
11577         (Input_objects::add_object): Add object to cross-referencer.
11578         (Input_objects::archive_start): New function.
11579         (Input_objects::archive_stop): New function.
11580         (Input_objects::print_symbol_counts): New function.
11581         * object.h: Declare Cref and Archive.
11582         (Object::get_global_symbol_counts): New function.
11583         (Object::do_get_global_symbol_counts): New pure virtual function.
11584         (class Sized_relobj): Add defined_count_ field.  Update
11585         declarations.
11586         (class Input_objects): Add cref_ field.  Update constructor.
11587         Update declarations.
11588         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11589         defined_count_.
11590         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11591         symbol counts.
11592         (Sized_dynobj::do_get_global_symbol_counts): New function.
11593         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11594         defined_count_.  Update declarations.  Define Symbols typedef.
11595         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11596         parameter.  Change all callers.
11597         (Symbol_table::add_from_dynobj): Add sympointers and defined
11598         parameters.  Change all callers.
11599         * symtab.h (class Symbol_table): Update declarations.
11600         * Makefile.am (CCFILES): Add cref.cc.
11601         (HFILES): Add cref.h.
11602         * Makefile.in: Rebuild.
11603
11604 2008-07-22  Simon Baldwin  <simonb@google.com>
11605
11606         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11607         to zero when writing undefined symbols.
11608
11609 2008-07-22  Ian Lance Taylor  <iant@google.com>
11610
11611         * output.cc (Output_section::add_input_section): Don't try to
11612         merge empty merge sections.
11613
11614 2008-07-21  Craig Silverstein  <csilvers@google.com>
11615
11616         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11617         Include symbol version in error message.
11618
11619 2008-07-20  Chris Demetriou  <cgd@google.com>
11620
11621         * configure.ac (gold_cv_c_random_seed): New configured variable.
11622         (RANDOM_SEED_CFLAGS): New substituted variable.
11623         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11624         * configure: Rebuild.
11625         * Makefile.in: Likewise.
11626         * testsuite/Makefile.in: Likewise.
11627
11628 2008-07-18  Ian Lance Taylor  <iant@google.com>
11629
11630         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11631         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11632         * testsuite/ver_test_main.cc (main): Call t4.
11633         (t4, t4_2a): Define.
11634         * testsuite/ver_test_2.cc (t4_2): Define.
11635         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11636         * testsuite/ver_test_4.cc (t4_2a): Define.
11637         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11638         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11639
11640 2008-07-17  Ian Lance Taylor  <iant@google.com>
11641
11642         * dynobj.cc (Versions::add_def): If we give an error about a
11643         missing version, go ahead and create the version anyhow.
11644
11645 2008-07-10  Ian Lance Taylor  <iant@google.com>
11646
11647         Handle output sections with more than 0x7fffffff bytes.
11648         * object.h (class Relobj): Change map_to_output_ to
11649         output_sections_, and just keep a section pointer.  Change all
11650         uses.  Move comdat group support to Sized_relobj.
11651         (Relobj::is_section_specially_mapped): Remove.
11652         (Relobj::output_section): Remove poff parameter.  Change all
11653         callers.
11654         (Relobj::output_section_offset): New function.
11655         (Relobj::set_section_offset): Rewrite.
11656         (Relobj::map_to_output): Remove.
11657         (Relobj::output_sections): New function.
11658         (Relobj::do_output_section_offset): New pure virtual function.
11659         (Relobj::do_set_section_offset): Likewise.
11660         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11661         group support from Relobj.  Update declarations.
11662         (Sized_relobj::get_output_section_offset): New function.
11663         (Sized_relobj::do_output_section_offset): New function.
11664         (Sized_relobj::do_set_section_offset): New function.
11665         * object.cc (Relobj::output_section_address): Remove.
11666         (Sized_relobj::Sized_relobj): Initialize new fields.
11667         (Sized_relobj::include_section_group): Cast find_kept_object to
11668         Sized_relobj.
11669         (Sized_relobj::include_linkonce_section): Likewise.
11670         (Sized_relobj::do_layout): Use separate arrays for output section
11671         and output offset.
11672         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11673         output_sections.
11674         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11675         output_sections and section_offsets.
11676         (Sized_relobj::write_local_symbols): Likewise.
11677         (map_to_kept_section): Compute output address directly.
11678         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11679         output_sections and section_offsets.
11680         (Sized_relobj::write_sections): Likewise.
11681         (Sized_relobj::relocate_sections): Likewise.
11682         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11683         * output.h (class Output_reloc): Update declarations.  Change
11684         u2_.relobj to Sized_relobj*.
11685         (class Output_data_reloc): Change add functions to use
11686         Sized_relobj*.
11687         * output.cc (Output_reloc::Output_reloc): Change relobj to
11688         Sized_relobj*.
11689         (Output_reloc::local_section_offset): Change return type to
11690         Elf_Addr.  Use get_output_section_offset.
11691         (Output_reloc::get_address): Likewise.
11692         (Output_section::is_input_address_mapped): Don't call
11693         is_section_specially_mapped.
11694         (Output_section::output_offset): Likewise.
11695         (Output_section::output_address): Likewise.
11696         (Output_section::starting_output_address): Likewise.
11697         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11698         parameter to Sized_relobj*.
11699         (Copy_relocs::need_copy_reloc): Likewise.
11700         (Copy_relocs::save): Likewise.
11701         * copy-relocs.h (class Copy_relocs): Update declarations.
11702         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11703         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11704         * target-reloc.h (relocate_for_relocatable): Change
11705         offset_in_output_section type to Elf_Addr.  Change code that uses
11706         it as well.
11707         * layout.cc (Layout::layout): Always set *off.
11708         * mapfile.cc (Mapfile::print_input_section): Use
11709         output_section_offset.
11710         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11711         Sized_relobj*.
11712         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11713         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11714         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11715
11716 2008-07-03  Ian Lance Taylor  <iant@google.com>
11717
11718         * layout.cc (Layout::include_section): Do not discard unrecognized
11719         SHT_STRTAB sections.
11720
11721 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11722
11723         * script.cc (Lex::can_continue_name): Make '?' allowable in
11724         version-script names.
11725         * testsuite/version_script.map: Change glob pattern to use '?'
11726
11727 2008-06-30  Manish Singh  <yosh@gimp.org>
11728
11729         PR 6585
11730         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11731         Correct typo.
11732
11733 2008-06-30  Ian Lance Taylor  <iant@google.com>
11734
11735         PR 6660
11736         PR 6682
11737         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11738         versions]: Don't try to read the value in the contents, since we
11739         don't use it.  Use the template endianness when writing.
11740
11741 2008-06-25  Cary Coutant  <ccoutant@google.com>
11742
11743         * fileread.cc (File_read::make_view): Assert on zero-length view.
11744         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11745         symbol table when there are no symbols to read.
11746
11747 2008-06-23  Craig Silverstein  <csilvers@google.com>
11748
11749         * version.cc (version_string): Bump to 1.7
11750
11751 2008-06-18  Craig Silverstein  <csilvers@google.com>
11752
11753         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11754         constant 0xFFFF to type Valtype.
11755         (Powerpc_relocate_functions::rel16_ha): Likewise.
11756
11757 2008-06-17  Ian Lance Taylor  <iant@google.com>
11758
11759         * output.h (Output_section::Input_section): Initialize p2align_ to
11760         zero for Output_section_data constructors.
11761         (Output_section::Input_section::addralign): If not an input
11762         section, return the alignment of the Output_section_data.
11763         * testsuite/copy_test.cc: New file.
11764         * testsuite/copy_test_1.cc: New file.
11765         * testsuite/copy_test_2.cc: New file.
11766         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11767         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11768         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11769         (copy_test_1_pic.o, copy_test_1.so): New targets.
11770         (copy_test_2_pic.o, copy_test_2.so): New targets.
11771         * testsuite/Makefile.in: Rebuild.
11772
11773         * script-sections.cc (Script_sections::place_orphan): Initialize
11774         local variable exact.
11775
11776 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11777
11778         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11779
11780 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11781             David S. Miller  <davem@davemloft.net>
11782
11783         * powerpc.cc: New file.
11784         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11785         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11786         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11787         * Makefile.in: Rebuild.
11788
11789 2008-06-09  Ian Lance Taylor  <iant@google.com>
11790
11791         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11792         <exception>.
11793         (throwing, orig_terminate): New static variables.
11794         (terminate_handler): New static function.
11795         (t2): Set terminate handler.
11796
11797 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11798
11799         PR 6584
11800         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11801         alignment.
11802
11803 2008-05-30  Cary Coutant  <ccoutant@google.com>
11804
11805         * archive.cc (Archive::include_all_members) Correct to step
11806         over symbol table and extended name table in thin archives.
11807
11808 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11809
11810         PR 6407
11811         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11812         calculation.
11813
11814 2008-05-28  Caleb Howe  <cshowe@google.com>
11815
11816         * reduced_debug_output.cc: New file.
11817         * reduced_debug_output.h: New file.
11818         * options.h (class General_options): Add --strip-debug-non-line.
11819         * options.cc (General_options::finalize): Add strip_debug_non_line
11820         to the strip heirarchy.
11821         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11822         fields.
11823         * layout.cc: Include "reduced_debug_output.h".
11824         (Layout::Layout): Initialize new fields.
11825         (line_only_debug_sections): New static array.
11826         (is_lines_only_debug_sections): New static inline function.
11827         (Layout::include_section): Handle --strip-debug-non-line.
11828         (Layout::make_output_section): If --strip-debug-non-line, build
11829         new output sections for .debug_abbrev and .debug_info.
11830         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11831         gold.  Warn about possible overflow.
11832         (read_signed_LEB_128): Likewise.
11833         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11834         (read_signed_LEB_128): Declare.
11835         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11836         (HFILES): Add reduced_debug_output.h.
11837         * Makefile.in: Rebuild.
11838
11839 2008-05-21  Ian Lance Taylor  <iant@google.com>
11840
11841         * mapfile.cc: New file.
11842         * mapfile.h: New file.
11843         * options.h (class General_options): Add -M/--print-map and -Map.
11844         * options.cc (General_options::finalize): Make -M equivalent to
11845         -Map -.
11846         * main.cc: Include <cstdio> and "mapfile.h".
11847         (main): Open mapfile if requested.
11848         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11849         constructor.  Change caller.
11850         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11851         (queue_middle_tasks): Likewise.
11852         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11853         declarations.
11854         * archive.cc: Include "mapfile.h".
11855         (Archive::add_symbols): Add mapfile parameter.  Change all
11856         callers.  Pass mapfile, symbol, and reason to include_member.
11857         (Archive::include_all_members): Add mapfile parameter.  Change all
11858         callers.
11859         (Archive::include_member): Add mapfile, sym, and why parameters.
11860         Change all callers.  Report inclusion to map file.
11861         * archive.h: Include "fileread.h".
11862         (class Archive): Update declarations.
11863         (Archive::file): New const method.
11864         (class Add_archive_symbols): Add mapfile_ field.  Update
11865         constructor.  Change all callers.
11866         * readsyms.h (class Read_symbols): Likewise.
11867         (class Finish_group): Likewise.
11868         (class Read_script): Likewise.
11869         * common.cc: Include "mapfile.h".
11870         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11871         all callers.
11872         (Symbol_table::do_allocate_commons): Likewise.
11873         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11874         symbol allocation to mapfile.
11875         * common.h (class Allocate_commons_task): Add mapfile_ field.
11876         Update constructor.  Change all callers.
11877         * symtab.h (class Symbol_table): Update declarations.
11878         * layout.cc: Include "mapfile.h".
11879         (Layout_task_runner::run): Print information to mapfile.
11880         (Layout::create_gold_note): Change Output_data_fixed_space to
11881         Output_data_zero_fill.
11882         (Layout::create_build_id): Likewise.
11883         (Layout::print_to_mapfile): New function.
11884         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11885         constructor.  Change caller.
11886         (class Layout): Declare print_to_mapfile.
11887         * output.cc (Output_section::Input_section::print_to_mapfile): New
11888         function.
11889         (Output_section::add_input_section): If producing a map, always
11890         add to input_sections_ list.
11891         (Output_section::do_print_to_mapfile): New function.
11892         (Output_segment::print_sections_to_mapfile): New function.
11893         (Output_segment::print_section_list_to_mapfile): New function.
11894         * output.h: Include "mapfile.h".
11895         (Output_data::print_to_mapfile): New function.
11896         (Output_data::do_print_to_mapfile): New virtual function.
11897         (Output_segment_headers::do_print_to_mapfile): New function.
11898         (Output_file_header::do_print_to_mapfile): New function.
11899         (Output_data_const::do_print_to_mapfile): New function.
11900         (class Output_data_const_buffer): Add map_name_ field.  Update
11901         constructor.  Change all callers.  Add do_print_to_mapfile
11902         function.
11903         (class Output_data_fixed_space): Likewise.
11904         (class Output_data_space): Likewise.
11905         (class Output_data_zero_fill): New class.
11906         (Output_data_strtab::do_print_to_mapfile): New function.
11907         (Output_data_reloc_base::do_print_to_mapfile): New function.
11908         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11909         (Output_data_group::do_print_to_mapfile): New function.
11910         (Output_data_got::do_print_to_mapfile): New function.
11911         (Output_data_dynamic::do_print_to_mapfile): New function.
11912         (Output_symtab_xindex::do_print_to_mapfile): New function.
11913         (class Output_section): Declare do_print_to_mapflie.  Declare
11914         print_to_mapfile in Input_section.
11915         (class Output_segment): Declare new functions.
11916         * object.h (Sized_relobj::symbol_count): New function.
11917         * script-sections.cc
11918         (Output_section_element_dot_assignment::set_section_addresses):
11919         Change Output_data_fixed_space to Output_data_zero_fill.
11920         (Output_data_expression::do_print_to_mapfile): New function.
11921         * script.cc (read_input_script): Add mapfile parameter.  Change
11922         all callers.
11923         * script.h (read_input_script): Update declaration.
11924         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11925         (Eh_frame::do_print_to_mapfile): New function.
11926         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11927         (Output_merge_string::do_print_to_mapfile): New function.
11928         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11929         function.
11930         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11931         function.
11932         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11933         function.
11934         * Makefile.am (CCFILES): Add mapfile.cc.
11935         (HFILES): Add mapfile.h.
11936         * Makefile.in: Rebuild.
11937
11938 2008-05-19  Ian Lance Taylor  <iant@google.com>
11939
11940         * options.h (class General_options): Add -z relro.
11941         * layout.cc (Layout::Layout): Initialize relro_segment_.
11942         (Layout::add_output_section_data): Return the output section.
11943         (Layout::make_output_section): Rcognize relro sections and mark
11944         them appropriately.
11945         (Layout::attach_allocated_section_to_segment): Put relro sections
11946         in a PT_GNU_RELRO segment.
11947         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11948         section as relro.
11949         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11950         PT_TLS segments.
11951         (Layout::linkonce_mapping): Map d.rel.ro.local to
11952         .data.rel.ro.local.
11953         (Layout::output_section_name): Us .data.rel.ro.local for any
11954         section which begins with that.
11955         * layout.h (class Layout): Update add_output_section_data
11956         declaration.  Add relro_segment_ field.
11957         * output.cc (Output_section::Output_section): Initialize is_relro_
11958         and is_relro_local_ fields.
11959         (Output_segment::add_output_section): Group relro sections.
11960         (Output_segment::is_first_section_relro): New function.
11961         (Output_segment::maximum_alignment): If there is a relro section,
11962         align the segment to the common page size.
11963         (Output_segment::set_section_addresses): Track whether we are
11964         looking at relro sections.  If the last section is a relro
11965         section, align to the common page size.
11966         (Output_segment::set_section_list_addresses): Add in_relro
11967         parameter.  Change all callers.  Align to the page size when
11968         moving from relro to non-relro section.
11969         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11970         segment.
11971         * output.h (class Output_section): Add is_relro_ and
11972         is_relro_local_ fields.
11973         (Output_section::is_relro): New function.
11974         (Output_section::set_is_relro): New function.
11975         (Output_section::is_relro_local): New function.
11976         (Output_section::set_is_relro_local): New function.
11977         (class Output_segment): Update declarations.
11978         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11979         * sparc.cc (Target_sparc::got_section): Likewise.
11980         * x86_64.cc (Target_x86_64::got_section): Likewise.
11981         * testsuite/relro_test_main.cc: New file.
11982         * testsuite/relro_test.cc: New file.
11983         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11984         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11985         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11986         (relro_test.so, relro_test_pic.o): New targets.
11987         * testsuite/Makefile.in: Rebuild.
11988
11989 2008-05-16  Ian Lance Taylor  <iant@google.com>
11990
11991         * output.cc (Output_segment::add_output_section): Remove front
11992         parameter.
11993         * output.h (class Output_segment): Remove
11994         add_initial_output_section and overloaded add_output_section.
11995         Update declaration of remaining add_output_section.
11996         * layout.cc (Layout::create_interp): Call add_output_section
11997         rather than add_initial_output_section.
11998         (Layout::finish_dynamic_section): Likewise.
11999
12000         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12001         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12002         know the dynamic type.
12003         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12004         field.  Initialize it in constructor.
12005         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12006         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12007         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12008         reloc.
12009
12010         * output.cc (Output_reloc::get_address): Change return type to
12011         Elf_Addr.
12012         * output.h (class Output_reloc): Update get_address declaration.
12013         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12014         for section addresses.
12015
12016 2008-05-09  Ian Lance Taylor  <iant@google.com>
12017
12018         PR 6493
12019         * gold.cc (gold_nomem): Use return value of write.
12020
12021 2008-05-08  Ian Lance Taylor  <iant@google.com>
12022
12023         * symtab.c (Symbol::init_base_output_data): Add version
12024         parameter.  Change all callers.
12025         (Symbol::init_base_output_segment): Likewise.
12026         (Symbol::init_base_constant): Likewise.
12027         (Symbol::init_base_undefined): Likewise.
12028         (Sized_symbol::init_output_data): Likewise.
12029         (Sized_symbol::init_output_segment): Likewise.
12030         (Sized_symbol::init_constant): Likewise.
12031         (Sized_symbol::init_undefined): Likewise.
12032         (Symbol_table::do_define_in_output_data): If the new symbol has a
12033         version, mark it as the default.
12034         (Symbol_table::do_define_in_output_segment): Likewise.
12035         (Symbol_table::do_define_as_constant): Likewise.
12036         * symtab.h (class Symbol): Update declarations.
12037         (class Sized_symbol): Likewise.
12038         * resolve.cc (Symbol::override_version): New function.
12039         (Symbol::override_base): Call override_version.
12040         (Symbol::override_base_with_special): Likewise.
12041         * testsuite/ver_script_8.script: New file.
12042         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12043         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12044         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12045         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12046
12047 2008-05-06  Ian Lance Taylor  <iant@google.com>
12048
12049         PR 6049
12050         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12051         functions.
12052         (class General_options): Remove existing --undefined, and add
12053         --no-undefined instead.  Add new --undefined as synonym for -u.
12054         * archive.cc (Archive::add_symbols): Check whether symbol was
12055         named with -u.
12056         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12057         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12058         all uses.  Add IS_UNDEFINED.  Update declarations to split
12059         different versions of init_base.  Declare init_base_undefined.
12060         (Symbol::is_defined): Handle IS_UNDEFINED.
12061         (Symbol::is_undefined): Likewise.
12062         (Symbol::is_weak_undefined): Call is_undefined.
12063         (Symbol::is_absolute): Handle IS_CONSTANT.
12064         (class Sized_symbol): Update declarations to split different
12065         versions of init.  Declare init_undefined.
12066         (class Symbol_table): Declare new functions.
12067         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12068         Change all callers.
12069         (Symbol::init_base_output_data): Likewise.
12070         (Symbol::init_base_output_segment): Likewise.
12071         (Symbol::init_base_constant): Likewise.
12072         (Symbol::init_base_undefined): New function.
12073         (Sized_symbol::init_object): Rename from init.  Change all
12074         callers.
12075         (Sized_symbol::init_output_data): Likewise.
12076         (Sized_symbol::init_output_segment): Likewise.
12077         (Sized_symbol::init_constant): Likewise.
12078         (Sized_symbol::init_undefined): New function.
12079         (Symbol_table::add_undefined_symbols_from_command_line): New
12080         function.
12081         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12082         function.
12083         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12084         (Symbol::output_section): Likewise.
12085         (Symbol::set_output_section): Likewise.
12086         (Symbol_table::sized_finalize_symbol): Likewise.
12087         (Symbol_table::sized_write_globals): Likewise.
12088         * resolve.cc (Symbol_table::should_override): Likewise.
12089         (Symbol::override_base_with_special): Likewise.
12090
12091         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12092         symbol, change it to have default visibility.
12093         * testsuite/protected_1.cc: New file.
12094         * testsuite/protected_2.cc: New file.
12095         * testsuite/protected_3.cc: New file.
12096         * testsuite/protected_main_1.cc: New file.
12097         * testsuite/protected_main_2.cc: New file.
12098         * testsuite/protected_main_3.cc: New file.
12099         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12100         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12101         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12102         (protected_1.so): New target.
12103         (protected_1_pic.o, protected_2_pic.o): New targets.
12104         (protected_3_pic.o): New target.
12105         (check_PROGRAMS): Add protected_2.
12106         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12107         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12108         * testsuite/Makefile.in: Rebuild.
12109
12110         * options.h (DEFINE_var): Add set_user_set_##varname__.
12111         (DEFINE_bool_alias): New macro.
12112         (class General_options): Define -Bstatic using DEFINE_bool_alias
12113         rather than DEFINE_special.  Add --undefined as an alias for -z
12114         defs.
12115         * options.cc (General_options::parse_Bstatic): Remove.
12116
12117         * options.h (class General_options): Add --fatal-warnings.
12118         * main.cc (main): Implement --fatal-warnings.
12119         * errors.h (Errors::warning_count): New function.
12120
12121         * options.h (class General_options): Add -Bsymbolic-functions.
12122         * symtab.h (Symbol::is_preemptible): Check for
12123         -Bsymbolic-functions.
12124
12125 2008-05-05  Ian Lance Taylor  <iant@google.com>
12126
12127         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12128         as noVARNAME rather than no-VARNAME.
12129         (class General_options): Add option -z combreloc.
12130         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12131         get_address.
12132         (Output_reloc::sort_before) [SHT_REL]: New function.
12133         (Output_reloc::sort_before) [SHT_RELA]: New function.
12134         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12135         Sort_relocs_comparison.
12136         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12137         parameter.  Change all callers.
12138         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12139         sort_relocs parameter.  Change all callers.
12140         * output.cc (Output_reloc::get_address): New function, broken out
12141         of write_rel.
12142         (Output_reloc::write_rel): Call it.
12143         (Output_reloc::compare): New function.
12144         (Output_data_reloc_base::do_write): Optionally sort relocs.
12145
12146         * configure.ac: If targ_extra_obj is set, link it in.
12147         * configure.tgt: Initialize all variables.
12148         (x86_64*): Set targ_extra_obj and targ_extra_size.
12149         * configure: Rebuild.
12150
12151         * object.cc (Sized_relobj::include_section_group): Adjust section
12152         indexes read from group data.  Build vector to pass to
12153         layout_group.
12154         * layout.cc (Layout::layout_group): Add flags and shndxes
12155         parameters.  Remove contents parameter.  Change caller.  Update
12156         explicit instantiations.
12157         * layout.h (class Layout): Update layout_group declaration.
12158         * output.cc (Output_data_group::Output_data_group): Add flags and
12159         input_shndxes parameters.  Remove contents parameter.  Change
12160         caller.
12161         (Output_data_group::do_write): Change input_sections_ to
12162         input_shndxes_.
12163         * output.h (class Output_data_group): Update constructor
12164         declaration.  Rename input_sections_ to input_shndxes_.
12165         * testsuite/many_sections_test.cc: Add template.
12166
12167 2008-04-30  Cary Coutant  <ccoutant@google.com>
12168
12169         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12170
12171         * layout.cc (Layout::include_section): Refactored check for debug
12172         info section.
12173         (Layout::add_comdat): Add new parameters.  Change type
12174         of signature parameter.  Add object and shndx to signatures table.
12175         (Layout::find_kept_object): New function.
12176         * layout.h: Include <cstring>.
12177         (Layout::is_debug_info_section): New function.
12178         (Layout::add_comdat): Add new parameters.
12179         (Layout::find_kept_object): New function.
12180         (Layout::Kept_section): New struct.
12181         (Layout::Signatures): Change type of map range.
12182         * object.cc (Relobj::output_section_address): New function.
12183         (Sized_relobj::include_section_group): Add new parameters.  Change
12184         calls to Layout::add_comdat.  Change to build table of kept comdat
12185         groups and table mapping discarded sections to kept sections.
12186         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12187         (Sized_relobj::do_layout): Change calls to include_section_group and
12188         include_linkonce_section.
12189         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12190         value to zero when section is discarded.
12191         (Sized_relobj::map_to_kept_section): New function.
12192         * object.h (Relobj::output_section_address): New function.
12193         (Relobj::Comdat_group): New type.
12194         (Relobj::find_comdat_group): New function.
12195         (Relobj::Comdat_group_table): New type.
12196         (Relobj::Kept_comdat_section): New type.
12197         (Relobj::Kept_comdat_section_table): New type.
12198         (Relobj::add_comdat_group): New function.
12199         (Relobj::set_kept_comdat_section): New function.
12200         (Relobj::get_kept_comdat_section): New function.
12201         (Relobj::comdat_groups_): New field.
12202         (Relobj::kept_comdat_sections_): New field.
12203         (Symbol_value::input_value): Update comment.
12204         (Sized_relobj::map_to_kept_section) New function.
12205         (Sized_relobj::include_linkonce_section): Add new parameter.
12206         * target-reloc.h (Comdat_behavior): New type.
12207         (get_comdat_behavior): New function.
12208         (relocate_section): Add code to map a discarded section to the
12209         corresponding kept section when applying a relocation.
12210
12211 2008-04-30  Craig Silverstein  <csilvers@google.com>
12212
12213         * dwarf_reader.cc (next_generation_count): New static var.
12214         (Addr2line_cache_entry): New struct.
12215         (addr2line_cache): New static var.
12216         (Dwarf_line_info::one_addr2line): Added caching.
12217         (Dwarf_line_info::clear_addr2line_cache): New function.
12218         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12219         cache-size parameter.
12220         (Dwarf_line_info::one_addr2line_cache): New function.
12221         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12222         new cache-size argument to one_addr2line(), and clear cache.
12223
12224 2008-04-28  Cary Coutant  <ccoutant@google.com>
12225
12226         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12227         R_386_PC8 relocations.
12228
12229 2008-04-23  Ian Lance Taylor  <iant@google.com>
12230
12231         * object.cc (Sized_relobj::include_section_group): Check for
12232         invalid section group.
12233
12234         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12235         header size.
12236
12237         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12238         than read for file header.
12239         * archive.cc (Archive::include_member): Likewise.
12240
12241 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12242
12243         * aclocal.m4: Regenerate.
12244         * configure: Regenerate.
12245
12246 2008-04-19  Ian Lance Taylor  <iant@google.com>
12247
12248         * version.cc (version_string): Bump to 1.6.
12249
12250         * testsuite/Makefile.am (many_sections_r_test): New target.
12251         (many_sections_r_test_SOURCES): Remove.
12252         (many_sections_r_test_DEPENDENCIES): Remove.
12253         (many_sections_r_test_LDFLAGS): Remove.
12254         (many_sections_r_test_LDADD): Remove.
12255
12256         * object.cc (Sized_relobj::do_add_symbols): Always pass
12257         local_symbol_count_ to add_from_relobj.
12258
12259         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12260         every thousand variables.
12261         * testsuite/Makefile.in: Rebuild.
12262
12263         * object.cc (Xindex::initialize_symtab_xindex): New function.
12264         (Xindex::read_symtab_xindex): New function.
12265         (Xindex::sym_xindex_to_shndx): New function.
12266         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12267         available.
12268         (Sized_relobj::do_initialize_xindex): New function.
12269         (Sized_relobj::do_read_symbols): Adjust section links.
12270         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12271         parameter.  Change all callers.
12272         (Sized_relobj::include_section_group): Adjust section links and
12273         symbol section indexes.
12274         (Sized_relobj::do_layout): Adjust section links.
12275         (Sized_relobj::do_count_local_symbols): Adjust section links and
12276         symbol section indexes.
12277         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12278         ordinary and special symbols.
12279         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12280         dynsym_xindex parameters.  Change all callers.  Adjust section
12281         links.  Use SHN_XINDEX when needed.
12282         (Sized_relobj::get_symbol_location_info): Adjust section links.
12283         Don't get fooled by special symbols.
12284         * object.h (class Xindex): Define.
12285         (class Object): Add xindex_ parameter.  Declare virtual functoin
12286         do_initialize_xindex.
12287         (Object::adjust_sym_shndx): New function.
12288         (Object::set_xindex): New protected function.
12289         (class Symbol_value): Add is_ordinary_shndx_ field.
12290         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12291         (Symbol_value::value): Assert ordinary section.
12292         (Symbol_value::initialize_input_to_output_map): Likewise.
12293         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12294         Change all callers.
12295         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12296         all callers.
12297         (class Sized_relobj): Update declarations.
12298         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12299         parameter.  Change all callers.
12300         (Sized_relobj::adjust_shndx): New function.
12301         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12302         field.
12303         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12304         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12305         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12306         (Sized_dynobj::read_dynsym_section): Adjust section links.
12307         (Sized_dynobj::read_dynamic): Likewise.
12308         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12309         section links.
12310         (Sized_dynobj::do_initialize_xindex): New function.
12311         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12312         do_initialize_xindex.
12313         (Sized_dynobj::adjust_shndx): New function.
12314         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12315         dynsym_xindex_ fields.
12316         (Layout::finalize): Add a call to set_section_indexes before
12317         creating the symtab sections.
12318         (Layout::set_section_indexes): Don't do anything if the section
12319         already has a section index.
12320         (Layout::create_symtab_sections): Add shnum parameter.  Change
12321         caller.  Create .symtab_shndx section if needed.
12322         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12323         caller.
12324         (Layout::allocated_output_section_count): New function.
12325         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12326         needed.
12327         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12328         fields.  Update declarations.
12329         (Layout::symtab_xindex): New function.
12330         (Layout::dynsym_xindex): New function.
12331         (class Write_symbols_task): Add layout_ field.
12332         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12333         Change caller.
12334         * output.cc (Output_section_headers::Output_section_headers): Add
12335         shstrtab_section parameter.  Change all callers.
12336         (Output_section_headers::do_sized_write): Store overflow values
12337         for section count and section string table section index in
12338         section header zero.
12339         (Output_file_header::do_sized_write): Check for overflow of
12340         section count and section string table section index.
12341         (Output_symtab_xindex::do_write): New function.
12342         (Output_symtab_xindex::endian_do_write): New function.
12343         * output.h (class Output_section_headers): Add shstrtab_section_.
12344         Update declarations.
12345         (class Output_symtab_xindex): Define.
12346         (Output_section::has_out_shndx): New function.
12347         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12348         field.
12349         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12350         Change all callers.
12351         (Sized_symbol::init): Likewise.
12352         (Symbol::output_section): Check for ordinary symbol.
12353         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12354         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12355         callers.
12356         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12357         Change all callers.  Simplify handling of symbols from sections
12358         not included in the link.
12359         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12360         distinction.
12361         (Weak_alias_sorter::operator()): Assert that symbols are
12362         ordinary.
12363         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12364         distinction.
12365         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12366         parameters.  Change all callers.
12367         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12368         symbol distinction.  Use SHN_XINDEX when needed.
12369         (Symbol_table::write_section_symbol): Add symtab_xindex
12370         parameter.  Change all callers.
12371         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12372         SHN_XINDEX when needed.
12373         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12374         declarations.
12375         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12376         (Symbol::is_defined): Check is_ordinary.
12377         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12378         (Symbol::is_absolute, Symbol::is_common): Likewise.
12379         (class Sized_symbol): Update declarations.
12380         (class Symbol_table): Update declarations.
12381         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12382         parameters.  Change all callers.
12383         (Sized_symbol::override): Likewise.
12384         (Symbol_table::override): Likewise.
12385         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12386         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12387         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12388         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12389         to be in an ordinary section.
12390         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12391         object and is_ordinary parameters.  Change all callers.
12392         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12393         Change all callers.  Don't add undefined or non-ordinary symbols
12394         to reloc_map_.
12395         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12396         Change all callers.
12397         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12398         declarations.
12399         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12400         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12401         (Sized_relobj::relocate_sections): Likewise.
12402         * target-reloc.h (scan_relocs): Adjust section symbol index.
12403         (scan_relocatable_relocs): Likewise.
12404         * i386.cc (Scan::local): Check for ordinary symbols.
12405         * sparc.cc (Scan::local): Likewise.
12406         * x86_64.cc (Scan::local): Likewise.
12407         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12408         to symbol_section_and_value.
12409         * testsuite/many_sections_test.cc: New file.
12410         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12411         (check_PROGRAMS): Add many_sections_test.
12412         (many_sections_test_SOURCES): Define.
12413         (many_sections_test_DEPENDENCIES): Define.
12414         (many_sections_test_LDFLAGS): Define.
12415         (BUILT_SOURCES): Add many_sections_define.h.
12416         (many_sections_define.h): New target.
12417         (BUILT_SOURCES): Add many_sections_check.h.
12418         (many_sections_check.h): New target.
12419         (check_PROGRAMS): Add many_sections_r_test.
12420         (many_sections_r_test_SOURCES): Define.
12421         (many_sections_r_test_DEPENDENCIES): Define.
12422         (many_sections_r_test_LDFLAGS): Define.
12423         (many_sections_r_test_LDADD): Define.
12424         (many_sections_r_test.o): New target.
12425         * testsuite/Makefile.in: Rebuild.
12426
12427 2008-04-17  Cary Coutant  <ccoutant@google.com>
12428
12429         * errors.cc (Errors::info): New function.
12430         (gold_info): New function.
12431         * errors.h (Errors::info): New function.
12432         * gold.h (gold_info): New function.
12433         * object.cc (Input_objects::add_object): Print trace output.
12434         * options.cc (options::parse_set): New function.
12435         (General_options::parse_wrap): Deleted.
12436         (General_options::General_options): Deleted initializer.
12437         * options.h (options::String_set): New typedef.
12438         (options::parse_set): New function.
12439         (DEFINE_set): New macro.
12440         (General_options::wrap): Changed to use DEFINE_set. Changed
12441         callers of any_wrap_symbols and is_wrap_symbol.
12442         (General_options::trace, General_options::trace_symbol):
12443         New options.
12444         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12445         (General_options::wrap_symbols_): Deleted.
12446         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12447
12448 2008-04-17  David S. Miller  <davem@davemloft.net>
12449
12450         * options.cc (General_options::parse_V): New function.
12451         * options.h: Add entries for -V and -Qy.
12452
12453 2008-04-17  Ian Lance Taylor  <iant@google.com>
12454
12455         * common.cc (Symbol_table::allocate_commons): Remove options
12456         parameter.  Change caller.
12457         (Symbol_table::do_allocate_commons): Remove options parameter.
12458         Change caller.  Just call do_allocate_commons_list twice.
12459         (Symbol_table::do_allocate_commons_list): New function, broken out
12460         of do_allocate_commons.
12461         * common.h (class Allocate_commons_task): Remove options_ field.
12462         Update constructor.
12463         * symtab.cc (Symbol_table::Symbol_table): Initialize
12464         tls_commons_.
12465         (Symbol_table::add_from_object): Put TLS common symbols on
12466         tls_commons_ list.
12467         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12468         which are IN_OUTPUT_DATA.
12469         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12470         allocate_commons and do_allocate_commons declarations.  Declare
12471         do_allocate_commons_list.
12472         * gold.cc (queue_middle_tasks): Update creation of
12473         Allocate_commons_task to not pass options.
12474         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12475         (TLS_TEST_C_FLAGS): New variable.
12476         (tls_test_c_pic.o): New target.
12477         (tls_test_shared.so): Link in tls_test_c_pic.o.
12478         (tls_test_c_pic_ie.o): New target.
12479         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12480         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12481         (tls_test_c.o): New target.
12482         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12483         (tls_pic_test_LDADD): Likewise.
12484         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12485         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12486         (tls_test_c_gnu2.o): New target.
12487         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12488         tls_test_c_gnu2.o.
12489         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12490         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12491         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12492         * testsuite/tls_test.cc: Include "config.h".
12493         (t_last): Call t11_last.
12494         * testsuite/tls_test.h (t11, t11_last): Declare.
12495         * testsuite/tls_test_c.c: New file.
12496         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12497         * configure.ac: Check for OpenMP support.
12498         * configure, config.in, Makefile.in: Rebuild.
12499         * testsuite/Makefile.in: Rebuild.
12500
12501 2008-04-16  Cary Coutant  <ccoutant@google.com>
12502
12503         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12504         (Target_i386::tls_base_symbol_defined_): New field.
12505         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12506         (Target_i386::Scan::global): Likewise.
12507         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12508         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12509         (Target_x86_64::tls_base_symbol_defined_): New field.
12510         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12511         (Target_x86_64::Scan::global): Likewise.
12512
12513 2008-04-16  Cary Coutant  <ccoutant@google.com>
12514
12515         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12516         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12517         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12518         building shared libraries.
12519         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12520         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12521         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12522         * testsuite/Makefile.in: Rebuild.
12523         * testsuite/weak_undef.h: New file.
12524         * testsuite/weak_undef_file1.cc: Add extra test cases.
12525         * testsuite/weak_undef_file2.cc: Likewise.
12526         * testsuite/weak_undef_test.cc: Likewise.
12527
12528 2008-04-16  David S. Miller  <davem@davemloft.net>
12529
12530         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12531         Add issued_non_pic_error_ field.  Declare check_non_pic.
12532         (Target_sparc::Scan::check_non_pic): New function.
12533         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12534         (Target_sparc::Scan::global): Likewise.
12535
12536         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12537         * configure: Rebuild.
12538
12539         * options.h (DEFINE_enable): New macro.
12540         (new_dtags): New enable option.
12541         (initfirst, interpose, loadfltr, nodefaultlib,
12542         nodelete, nodlopen, nodump): New -z options.
12543         * layout.cc (Layout:finish_dynamic_section): If new
12544         dtags enabled, emit DT_RUNPATH.  Also, emit a
12545         DT_FLAGS_1 containing any specified -z flags.
12546
12547 2008-04-16  Ian Lance Taylor  <iant@google.com>
12548
12549         * copy-relocs.cc: New file.
12550         * copy-relocs.h: New file.
12551         * reloc.cc: Remove Copy_relocs code.
12552         * reloc.h: Likewise.
12553         * reloc-types.h (struct Reloc_types) [both versions]: Add
12554         get_reloc_addend_noerror.
12555         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12556         variants of add_global which take an addend which must be zero.
12557         * i386.cc: Include "copy-relocs.h".
12558         (class Target_i386): Change type of copy_relocs_ to variable,
12559         update initializer.
12560         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12561         Change all callers.
12562         (Target_i386::do_finalize_sections): Change handling of
12563         copy_relocs_.
12564         * sparc.cc: Include "copy-relocs.h".
12565         (class Target_sparc): Change type of copy_relocs_ to variable,
12566         update initializer.
12567         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12568         Change all callers.
12569         (Target_sparc::do_finalize_sections): Change handling of
12570         copy_relocs_.
12571         * x86_64.cc: Include "copy-relocs.h".
12572         (class Target_x86_64): Change type of copy_relocs_ to variable,
12573         update initializer.
12574         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12575         class.  Change all callers.
12576         (Target_x86_64::do_finalize_sections): Change handling of
12577         copy_relocs_.
12578         * Makefile.am (CCFILES): Add copy-relocs.cc.
12579         (HFILES): Add copy-relocs.h.
12580
12581         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12582
12583         * testsuite/script_test_4.sh: Permit leading zeroes.
12584
12585 2008-04-15  Ian Lance Taylor  <iant@google.com>
12586
12587         * script-sections.cc (Script_sections::create_segments): Use
12588         header_size_adjustment even when there is enough room for the
12589         headers.
12590         * testsuite/script_test_4.sh: New file.
12591         * testsuite/script_test_4.t: New file.
12592         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12593         (check_DATA): Add script_test_4.stdout.
12594         (MOSTLYCLEANFILES): Likewise.
12595         (script_test_4): New target.
12596         (script_test_4.stdout): New target.
12597         * testsuite/Makefile.in: Rebuild.
12598
12599         * sparc.cc: Add definitions for Output_data_plt_sparc class
12600         constants.
12601
12602 2008-04-14  David S. Miller  <davem@davemloft.net>
12603
12604         * sparc.cc: New file.
12605         * Makefile.am (TARGETSOURCES): Add sparc.cc
12606         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12607         * configure.tgt: Document targ_extra_size and
12608         targ_extra_big_endian.  Add entries for sparc-* and
12609         sparc64-*.
12610         * configure.ac: Handle targ_extra_size and
12611         targ_extra_big_endian.
12612         * Makefile.in: Rebuild.
12613         * configure: Likewise.
12614         * po/POTFILES.in: Likewise.
12615         * po/gold.pot: Likewise.
12616
12617 2008-04-14  Ian Lance Taylor  <iant@google.com>
12618
12619         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12620         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12621         in the name/type/flags to section mapping.  Don't call
12622         allocate_output_section.
12623         (Layout::choose_output_section): Change parameter from adjust_name
12624         to is_input_section.  Don't permit input sections after sections
12625         are attached to segments.  Don't call allocate_output_section.
12626         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12627         not write_enable_output_section.
12628         (Layout::make_output_section): Don't push to
12629         unattached_section_list_ nor call attach_to_segment.  Call
12630         attach_section_to_segment if sections are attached.
12631         (Layout::attach_sections_to_segments): New function.
12632         (Layout::attach_section_to_segment): New function.
12633         (Layout::attach_allocated_section_to_segment): Rename from
12634         attach_to_segment.  Remove flags parameter.
12635         (Layout::allocate_output_section): Remove function.
12636         (Layout::write_enable_output_section): Remove function.
12637         * layout.h (class Layout): Update for above changes.  Add new
12638         field sections_are_attached_.
12639         * output.h (Output_section::update_flags_for_input_section): New
12640         function.
12641         * output.cc (Output_section::add_input_section): Call
12642         update_flags_for_input_section.
12643         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12644
12645 2008-04-11  Cary Coutant  <ccoutant@google.com>
12646
12647         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12648         thought unnecessary.
12649         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12650
12651 2008-04-11  Ian Lance Taylor  <iant@google.com>
12652
12653         * output.h (class Output_section_data): Remove inline definition
12654         of set_addralign.
12655         * output.cc (Output_section_data::set_addralign): New function.
12656
12657 2008-04-11  Cary Coutant  <ccoutant@google.com>
12658
12659         Add support for TLS descriptors for i386 and x86_64.
12660         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12661         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12662         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12663         GOT_TYPE_TLS_DESC.
12664         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12665         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12666         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12667         relocations.
12668         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12669         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12670         Fix problem with initial-exec relocations.
12671         (Target_i386::Relocate::relocate_tls): Likewise.
12672         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12673         relaxation.
12674         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12675         support for section-plus-offset dynamic table entries.
12676         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12677         (Output_data_dynamic::Dynamic_entry): Add support for
12678         section-plus-offset dynamic table entries.
12679         (Output_data_dynamic::Classification): Likewise.
12680         (Output_data_dynamic::classification_): Renamed offset_.
12681         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12682         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12683         (Target_x86_64::make_plt_section): New function.
12684         (Target_x86_64::reserve_tlsdesc_entries): New function.
12685         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12686         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12687         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12688         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12689         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12690         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12691         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12692         add extra PLT entry for TLS descriptors.
12693         (Output_data_plt_x86_64::got_): New field.
12694         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12695         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12696         fields.
12697         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12698         descriptors.
12699         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12700         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12701         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12702         R_386_TLS_DESC_CALL relocations.
12703         (Target_x86_64::Scan::global): Likewise.
12704         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12705         for TLS descriptors.
12706         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12707         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12708         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12709         GD-to-IE relaxation.
12710         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12711         and TLS_DESCRIPTORS.
12712         * Makefile.in: Rebuild.
12713         * configure: Rebuild.
12714         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12715         (tls_test_shared2.so): New target.
12716         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12717         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12718         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12719         (tls_shared_gd_to_ie_test_LDADD): New variable.
12720         (tls_shared_gnu2_gd_to_ie_test): New target.
12721         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12722         New targets.
12723         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12724         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12725         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12726         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12727         (tls_shared_gnu2_test): New target.
12728         (tls_test_gnu2_shared.so): New target.
12729         (tls_shared_gnu2_test_SOURCES): New variable.
12730         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12731         (tls_shared_gnu2_test_LDFLAGS): New variable.
12732         (tls_shared_gnu2_test_LDADD): New variable.
12733         * testsuite/Makefile.in: Rebuild.
12734         * testsuite/Makefile.
12735
12736 2008-04-11  Ian Lance Taylor  <iant@google.com>
12737
12738         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12739         justsyms.t.
12740         * testsuite/Makefile.in: Rebuild.
12741
12742         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12743         long.
12744         * testsuite/script_test_2.cc (main): Adjust test.
12745
12746 2008-04-11  David S. Miller  <davem@davemloft.net>
12747             Ian Lance Taylor  <iant@google.com>
12748
12749         * options.h (General_options): Add entries for '-Y' and
12750         '-relax'.
12751         * options.cc (General_options:finalize): If -Y was used, add those
12752         entries to the library path instead of the default "/lib" and
12753         "/usr/lib".
12754
12755 2008-04-11  David S. Miller  <davem@davemloft.net>
12756
12757         * testsuite/justsyms.t: Start at 0x100.
12758         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12759         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12760         long.
12761         * testsuite/script_test_2.cc: Adjust string and section length
12762         checks.
12763
12764 2008-04-09  Ian Lance Taylor  <iant@google.com>
12765
12766         PR gold/5996
12767         * script-sections.cc (Sections_element::allocate_to_segment): Add
12768         orphan parameter.
12769         (Output_section_definition::allocate_to_segment): Likewise.
12770         (Orphan_output_section::allocate_to_segment): Likewise.
12771         (Script_sections::attach_sections_using_phdrs_clause): Don't
12772         propagate non-PT_LOAD segments to orphan sections.
12773         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12774         readelf rather than objdump.
12775         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12776         .interp section and PT_INTERP segment are the same size.
12777         * testsuite/Makefile.in: Rebuild.
12778
12779         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12780         aliases for symbols defined in the same object.
12781         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12782         (weak_alias_test_SOURCES): New variable.
12783         (weak_alias_test_DEPENDENCIES): New variable.
12784         (weak_alias_test_LDFLAGS): New variable.
12785         (weak_alias_test_LDADD): New variable.
12786         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12787         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12788         (weak_alias_test_3.o): New target.
12789         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12790         * testsuite/weak_alias_test_main.cc: New file.
12791         * testsuite/weak_alias_test_1.cc: New file.
12792         * testsuite/weak_alias_test_2.cc: New file.
12793         * testsuite/weak_alias_test_3.cc: New file.
12794
12795 2008-04-08  Ian Lance Taylor  <iant@google.com>
12796
12797         * options.h (class General_options): Add --noinhibit-exec option.
12798         * main.cc (main): Check --noinhibit-exec.
12799
12800         * options.h (class General_options): Define --wrap as a special
12801         option.  Add wrap_symbols_ field.
12802         (General_options::any_wrap_symbols): New function.
12803         (General_options::is_wrap_symbol): New function.
12804         * options.cc (General_options::parse_wrap): New function.
12805         (General_options::General_options): Initialize wrap_symbols_.
12806         * symtab.cc (Symbol_table::wrap_symbol): New function.
12807         (Symbol_table::add_from_object): Handle --wrap.
12808         * symtab.h (class Symbol_table): Declare wrap_symbol.
12809         * target.h (Target::wrap_char): New function.
12810         (Target::Target_info): Add wrap_char field.
12811         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12812         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12813         * testsuite/testfile.cc (Target_test::test_target_info):
12814         Likewise.
12815
12816         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12817         there is one.
12818
12819         * layout.h (class Layout): Add added_eh_frame_data_ field.
12820         * layout.cc (Layout::Layout): Initialize new field.
12821         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12822         output section until we find a section we merged successfully.
12823         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12824         that the size be non-zero.
12825
12826         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12827         qualifier.
12828
12829 2008-04-08  Craig Silverstein  <csilvers@google.com>
12830
12831         * configure.ac: Export new conditional variable HAVE_ZLIB.
12832         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12833         on HAVE_ZLIB.
12834         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12835         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12836
12837 2008-04-07  Ian Lance Taylor  <iant@google.com>
12838
12839         * version.cc (version_string): Set to "1.5".
12840
12841         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12842         Add issued_non_pic_error_ field.  Declare check_non_pic.
12843         (Target_x86_64::Scan::check_non_pic): New function.
12844         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12845         (Target_x86_64::Scan::global): Likewise.
12846
12847         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12848         addend parameter.  Change caller.  Handle merge sections.
12849         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12850         Address to Addend.  Don't add in the result of
12851         local_section_offset, pass down the addend and use the returned
12852         value.
12853         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12854         Update declarations of local_section_offset and symbol_value.
12855         * testsuite/two_file_test_1.cc (t18): New function.
12856         * testsuite/two_file_test_2.cc (f18): New function.
12857         * testsuite/two_file_test_main.cc (main): Call t18.
12858         * testsuite/two_file_test.h (t18, f18): Declare.
12859
12860         * configure.ac: Don't test for objdump, c++filt, or readelf.
12861         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12862         conditionals.
12863         (TEST_READELF): New variable.
12864         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12865         (check_PROGRAMS): Add two_file_strip_test.
12866         (two_file_strip_test): New target.
12867         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12868         (two_file_same_shared_strip_test_SOURCES): New variable.
12869         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12870         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12871         (two_file_same_shared_strip_test_LDADD): New variable.
12872         (two_file_shared_strip.so): New target.
12873         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12874         (ver_test_5.syms, ver_test_7.syms): Likewise.
12875         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12876         (strip_test_3.stdout): Use TEST_OBJDUMP.
12877         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12878
12879 2008-04-04  Cary Coutant  <ccoutant@google.com>
12880
12881         * symtab.h (Symbol::is_weak_undefined): New function.
12882         (Symbol::is_strong_undefined): New function.
12883         (Symbol::is_absolute): New function.
12884         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12885         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12886         absolute symbols.
12887         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12888         (weak_undef_test): New target.
12889         * testsuite/Makefile.in: Rebuild.
12890         * testsuite/weak_undef_file1.cc: New file.
12891         * testsuite/weak_undef_file2.cc: New file.
12892         * testsuite/weak_undef_test.cc: New file.
12893
12894 2008-04-03  Craig Silverstein  <csilvers@google.com>
12895
12896         * compressed_output.h (class Output_compressed_section): Use
12897         unsigned buffer.
12898         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12899         add zlib header.
12900         (zlib_compressed_suffix): Removed.
12901         (Output_compressed_section::set_final_data_size): Use unsigned
12902         buffers.
12903         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12904         Fix linker invocation.
12905         (flagstest_o_specialfile_and_compress_debug_sections):
12906         Likewise.
12907         * testsuite/Makefile.in: Regenerated.
12908
12909 2008-04-02  David S. Miller  <davem@davemloft.net>
12910
12911         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12912         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12913
12914 2008-04-02  Craig Silverstein  <csilvers@google.com>
12915
12916         * TODO: New file.
12917
12918 2008-04-02  Ian Lance Taylor  <iant@google.com>
12919
12920         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12921         parameters.  Update for new key type to views_.  Change all
12922         callers.
12923         (File_read::read): Adjust for byteshift in returned view.
12924         (File_read::add_view): New function, broken out of
12925         find_and_make_view.
12926         (File_read::make_view): New function, broken out of
12927         find_and_make_view.
12928         (File_read::find_or_make_view): Add offset and aligned
12929         parameters.  Rewrite accordingly.  Change all callers.
12930         (File_read::get_view): Add offset and aligned parameters.  Adjust
12931         for byteshift in return value.
12932         (File_read::get_lasting_view): Likewise.
12933         * fileread.h (class File_read): Update declarations.
12934         (class File_read::View): Add byteshift_ field.  Add byteshift to
12935         constructor.  Add byteshift method.
12936         * archive.h (Archive::clear_uncached_views): New function.
12937         (Archive::get_view): Add aligned parameter.  Change all callers.
12938         * object.h (Object::get_view): Add aligned parameter.  Change all
12939         callers.
12940         (Object::get_lasting_view): Likewise.
12941
12942         * fileread.cc (File_read::release): Don't call clear_views if
12943         there are multiple objects.
12944         * fileread.h (File_read::clear_uncached_views): New function.
12945         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12946         on the archive.
12947
12948 2008-03-31  Cary Coutant  <ccoutant@google.com>
12949
12950         Add thin archive support.
12951         * archive.cc (Archive::armagt): New const.
12952         (Archive::setup): Remove task parameter and calls to unlock.
12953         (Archive::unlock_nested_archives): New function.
12954         (Archive::read_header): Add nested_off parameter. Change
12955         all callers.
12956         (Archive::interpret_header): Likewise.
12957         (Archive::include_all_members): Change to handle thin
12958         archives.
12959         (Archive::include_member): Likewise.
12960         * archive.h (Archive::Archive): Add new parameters and
12961         initializers.
12962         (Archive::armagt): New const.
12963         (Archive::setup): Remove task parameter.
12964         (Archive::unlock_nested_archives): New function.
12965         (Archive::read_header): Add nested_off parameter.
12966         (Archive::interpret_header): Likewise.
12967         (Archive::Nested_archive_table): New typedef.
12968         (Archive::is_thin_archive_): New field.
12969         (Archive::nested_archives_): New field.
12970         (Archive::options_): New field.
12971         (Archive::dirpath_): New field.
12972         (Archive::task_): New field.
12973         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12974         for thin archives.  Pass additional parameters to
12975         Archive::Archive.  Unlock the archive file after calling
12976         Archive::setup.
12977
12978 2008-03-29  Ian Lance Taylor  <iant@google.com>
12979
12980         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12981         version symbol to be local.
12982         * testsuite/ver_test_4.sh: New file.
12983         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12984         (check_DATA): Add ver_test_4.syms.
12985         (ver_test_4.syms): New target.
12986         * testsuite/Makefile.in: Rebuild.
12987
12988         * output.cc
12989         (Output_section::Input_section_sort_entry::has_priority): New
12990         function.
12991         (Output_section::Input_section_sort_entry::match_file_name): New
12992         function.
12993         (Output_section::Input_section_sort_entry::match_section_name):
12994         Remove.
12995         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12996         Remove.
12997         (Output_section::Input_section_sort_entry::match_section_file):
12998         Remove.
12999         (Output_section::Input_section_sort_compare::operator()): Rewrite
13000         using new Input_section_sort_entry functions.  Sort crtbegin and
13001         crtend first.  Sort sections with no priority before sections with
13002         a priority.
13003         * testsuite/initpri1.c (d3): Check j != 4.
13004         (cd5): New constructor/destructor function.
13005         (main): Check j != 2.
13006
13007         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13008         new symbol when resolving, don't call set_is_default.
13009         * testsuite/ver_test_7.cc: New file.
13010         * testsuite/ver_test_7.sh: New file.
13011         * testsuite/Makefile.am (ver_test_7.so): New target.
13012         (ver_test_7.o): New target.
13013         (check_SCRIPTS): Add ver_test_7.sh.
13014         (check_DATA): Add ver_test_7.syms.
13015         (ver_test_7.syms): New target.
13016
13017 2008-03-28  Ian Lance Taylor  <iant@google.com>
13018
13019         * layout.cc (Layout::layout): If we see an input section with a
13020         name that needs sorting, set the must_sort flag for the output
13021         section.
13022         (Layout::make_output_section): If the name of the output section
13023         indicates that it might require sorting, set the may_sort flag.
13024         * output.h (Output_section::may_sort_attached_input_sections): New
13025         function.
13026         (Output_section::set_may_sort_attached_input_sections): New
13027         function.
13028         (Output_section::must_sort_attached_input_sections): New
13029         function.
13030         (Output_section::set_must_sort_attached_input_sections): New
13031         function.
13032         (class Output_section): Declare Input_section_sort_entry.  Define
13033         Input_section_sort_compare.  Declare
13034         sort_attached_input_sections.  Add new fields:
13035         may_sort_attached_input_sections_,
13036         must_sort_attached_input_sections_,
13037         attached_input_sections_are_sorted_.
13038         * output.cc (Output_section::Output_section): Initialize new
13039         fields.
13040         (Output_section::add_input_section): Add an entry to
13041         input_sections_ if may_sort or must_sort are true.
13042         (Output_section::set_final_data_size): Call
13043         sort_attached_input_sections if necessary.
13044         (Output_section::Input_section_sort_entry): Define new class.
13045         (Output_section::Input_section_sort_compare::operator()): New
13046         function.
13047         (Output_section::sort_attached_input_sections): New function.
13048         * configure.ac: Check whether the compiler supports constructor
13049         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13050         * testsuite/initpri1.c: New file.
13051         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13052         CONSTRUCTOR_PRIORITY.
13053         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13054         (initpri1_LDFLAGS): New variable.
13055         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13056
13057 2008-03-27  Ian Lance Taylor  <iant@google.com>
13058
13059         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13060         * testsuite/common_test_1.c: New file.
13061         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13062         (common_test_1_SOURCES): New variable.
13063         (common_test_1_DEPENDENCIES): New variable.
13064         (common_test_1_LDFLAGS): New variable.
13065
13066         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13067         and commons_ correctly when NAME/VERSION does not override
13068         NAME/NULL.
13069         * testsuite/ver_test_6.c: New file.
13070         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13071         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13072         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13073
13074 2008-03-26  Ian Lance Taylor  <iant@google.com>
13075
13076         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13077         of an undefined symbol from a version script.
13078         * testsuite/Makefile.am (ver_test_5.so): New target.
13079         (ver_test_5.o): New target.
13080         (check_SCRIPTS): Add ver_test_5.sh.
13081         (check_DATA): Add ver_test_5.syms.
13082         (ver_test_5.syms): New target.
13083         * testsuite/ver_test_5.cc: New file.
13084         * testsuite/ver_test_5.script: New file.
13085         * testsuite/ver_test_5.sh: New file.
13086         * Makefile.in, testsuite/Makefile.in: Rebuild.
13087
13088         PR gold/5986
13089         Fix problems building gold with gcc 4.3.0.
13090         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13091         (gold_error_at_location, gold_warning_at_location): Use it.
13092         * configure.ac: Check whether we can compile and use a template
13093         function with a printf attribute.
13094         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13095         when jumping over bytes.
13096         * object.cc: Instantiate Object::read_section_data.
13097         * debug.h: Include <cstring>
13098         * dwarf_reader.cc: Include <algorithm>
13099         * main.cc: Include <cstring>.
13100         * options.cc: Include <cstring>.
13101         * output.cc: Include <cstring>.
13102         * script.cc: Include <cstring>.
13103         * script.h: Include <string>.
13104         * symtab.cc: Include <cstring> and <algorithm>.
13105         * target-select.cc: Include <cstring>.
13106         * version.cc: Include <string>.
13107         * testsuite/testmain.cc: Include <cstdlib>.
13108         * configure, config.in: Rebuild.
13109
13110 2008-03-25  Ian Lance Taylor  <iant@google.com>
13111
13112         * options.cc: Include "../bfd/bfdver.h".
13113         (options::help): Print bug reporting address.
13114
13115         * version.cc (print_version): Adjust output for current value of
13116         BFD_VERSION_STRING.
13117
13118         * NEWS: New file.
13119
13120         * options.cc (options::help): Print list of supported targets.
13121         * target-select.h: Include <vector>.
13122         (class Target_selector): Make machine_, size_, and is_big_endian_
13123         fields const.  Add bfd_name_ and instantiated_target_ fields.
13124         (Target_selector::Target_selector): Add bfd_name parameter.
13125         (Target_selector::recognize): Make non-virtual, call
13126         do_recognize.
13127         (Target_selector::recognize_by_name): Make non-virtual, call
13128         do_recognize_by_name.
13129         (Target_selector::supported_names): New function.
13130         (Target_selector::bfd_name): New function.
13131         (Target_selector::do_instantiate_target): New pure virtual
13132         function.
13133         (Target_selector::do_recognize): New virtual function.
13134         (Target_selector::do_recognize_by_name): New virtual function.
13135         (Target_selector::instantiate_target): New private function.
13136         (supported_target_names): Declare.
13137         * target-select.cc (Target_selector::Target_selector): Update for
13138         new parameter and fields.
13139         (select_target_by_name): Check that the name matches before
13140         calling recognize_by_name.
13141         (supported_target_names): New function.
13142         * i386.cc (class Target_selector_i386): Update Target_selector
13143         constructor call.  Remove recognize and recognize_by_name.  Add
13144         do_instantiate_target.
13145         * x86_64.cc (class Target_selector_x86_64): Likewise.
13146         * testsuite/testfile.cc (class Target_selector_test): Update for
13147         changes to Target_selector.
13148
13149         * README: Rewrite, with some notes on unsupported features.
13150
13151 2008-03-24  Cary Coutant  <ccoutant@google.com>
13152
13153         * i386.cc (Target_i386::Got_type): New enum declaration.
13154         (Target_i386::Scan::local): Updated callers of Output_data_got
13155         member functions.
13156         (Target_i386::Scan::global): Likewise.
13157         (Target_i386::Relocate::relocate): Likewise.
13158         (Target_i386::Relocate::relocate_tls): Likewise.
13159         * object.h (Got_offset_list): New class.
13160         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13161         (Sized_relobj::local_got_offset): Likewise.
13162         (Sized_relobj::set_local_got_offset): Likewise.
13163         (Sized_relobj::local_has_tls_got_offset): Removed.
13164         (Sized_relobj::local_tls_got_offset): Removed.
13165         (Sized_relobj::set_local_tls_got_offset): Removed.
13166         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13167         * output.cc (Output_data_got::add_global): Added got_type parameter.
13168         (Output_data_got::add_global_with_rel): Likewise.
13169         (Output_data_got::add_global_with_rela): Likewise.
13170         (Output_data_got::add_global_pair_with_rel): New function.
13171         (Output_data_got::add_global_pair_with_rela): New function.
13172         (Output_data_got::add_local): Added got_type parameter.
13173         (Output_data_got::add_local_with_rel): Likewise.
13174         (Output_data_got::add_local_with_rela): Likewise.
13175         (Output_data_got::add_local_pair_with_rel): New function.
13176         (Output_data_got::add_local_pair_with_rela): New function.
13177         (Output_data_got::add_global_tls): Removed.
13178         (Output_data_got::add_global_tls_with_rel): Removed.
13179         (Output_data_got::add_global_tls_with_rela): Removed.
13180         (Output_data_got::add_local_tls): Removed.
13181         (Output_data_got::add_local_tls_with_rel): Removed.
13182         (Output_data_got::add_local_tls_with_rela): Removed.
13183         * output.h (Output_data_got::add_global): Added got_type parameter.
13184         (Output_data_got::add_global_with_rel): Likewise.
13185         (Output_data_got::add_global_with_rela): Likewise.
13186         (Output_data_got::add_global_pair_with_rel): New function.
13187         (Output_data_got::add_global_pair_with_rela): New function.
13188         (Output_data_got::add_local): Added got_type parameter.
13189         (Output_data_got::add_local_with_rel): Likewise.
13190         (Output_data_got::add_local_with_rela): Likewise.
13191         (Output_data_got::add_local_pair_with_rel): New function.
13192         (Output_data_got::add_local_pair_with_rela): New function.
13193         (Output_data_got::add_global_tls): Removed.
13194         (Output_data_got::add_global_tls_with_rel): Removed.
13195         (Output_data_got::add_global_tls_with_rela): Removed.
13196         (Output_data_got::add_local_tls): Removed.
13197         (Output_data_got::add_local_tls_with_rel): Removed.
13198         (Output_data_got::add_local_tls_with_rela): Removed.
13199         * resolve.cc (Symbol::override_base_with_special): Removed
13200         reference to has_got_offset_ field.
13201         * symtab.cc (Symbol::init_fields): Replaced initialization
13202         of got_offset_ with got_offsets_.  Removed initialization
13203         of has_got_offset_
13204         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13205         (Symbol::got_offset): Likewise.
13206         (Symbol::set_got_offset): Likewise.
13207         (Symbol::has_tls_got_offset): Removed.
13208         (Symbol::tls_got_offset): Removed.
13209         (Symbol::set_tls_got_offset): Removed.
13210         (Symbol::got_offset_): Removed.
13211         (Symbol::tls_mod_got_offset_): Removed.
13212         (Symbol::tls_pair_got_offset_): Removed.
13213         (Symbol::got_offsets_): New field.
13214         (Symbol::has_got_offset): Removed.
13215         (Symbol::has_tls_mod_got_offset): Removed.
13216         (Symbol::has_tls_pair_got_offset): Removed.
13217         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13218         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13219         member functions.
13220         (Target_x86_64::Scan::global): Likewise.
13221         (Target_x86_64::Relocate::relocate): Likewise.
13222         (Target_x86_64::Relocate::relocate_tls): Likewise.
13223
13224 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13225
13226         * yyscript.y: Fix spelling error in comment.
13227
13228 2008-03-24  Ian Lance Taylor  <iant@google.com>
13229
13230         * options.h (class General_options): Define build_id option.
13231         * layout.h (class Layout): Declare write_build_id, create_note,
13232         create_build_id.  Add build_id_note_ member.
13233         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13234         "libiberty.h", "md5.h", "sha1.h".
13235         (Layout::Layout): Initialize eh_frame_data_,
13236         eh_frame_hdr_section_, and build_id_note_.
13237         (Layout::finalize): Call create_build_id.
13238         (Layout::create_note): New function, broken out of
13239         Layout::create_gold_note.
13240         (Layout::create_gold_note): Call create_note.
13241         (Layout::create_build_id): New function.
13242         (Layout::write_build_id): New function.
13243         (Close_task_runner::run): Call write_build_id.
13244
13245         * x86_64.cc: Correct license to GPLv3.
13246
13247 2008-03-23  Ian Lance Taylor  <iant@google.com>
13248
13249         * options.cc: Include "demangle.h".
13250         (parse_optional_string): New function.
13251         (parse_long_option): Handle takes_optional_argument.
13252         (parse_short_option): Update dash_z initializer.  Handle
13253         takes_optional_argument.
13254         (General_options::General_options): Initialize do_demangle_.
13255         (General_options::finalize): Set do_demangle_.  Handle demangling
13256         style.
13257         * options.h (parse_optional_string): Declare.
13258         (struct One_option): Add optional_arg field.  Update constructor.
13259         Update call constructor calls.  Add takes_optional_argument
13260         function.
13261         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13262         (DEFINE_optional_string): Define.
13263         (General_options::demangle): Change from DEFINE_bool to
13264         DEFINE_optional_string.
13265         (General_options::no_demangle): New function.
13266         (General_options::do_demangle): New function.
13267         (General_options::set_do_demangle): New function.
13268         (General_options::execstack_status_): Move definition to end of
13269         class definition.
13270         (General_options::static_): Likewise.
13271         (General_options::do_demangle_): New field.
13272         * object.cc (big_endian>::get_symbol_location_info): Call
13273         Options::do_demangle, not Options::demangle.
13274         * symtab.cc (demangle): Likewise.
13275
13276 2008-03-22  Ian Lance Taylor  <iant@google.com>
13277
13278         * gold.h: Include <cstddef> and <sys/types.h>
13279         * options.h: Include <cstring>.
13280
13281 2008-03-21  Ian Lance Taylor  <iant@google.com>
13282
13283         * Added source code to GNU binutils.