* powerpc.cc: Whitespace fixes. Wrap overly long lines.
[external/binutils.git] / gold / ChangeLog
1 2012-08-12  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4         (glink insn constants): Use uint32_t.
5         (Output_data_glink::add_entry): Use insert, not [] operator.
6
7 2012-08-11  Alan Modra  <amodra@gmail.com>
8
9         * object.h (Sized_relobj_file::find_shdr): New function.
10         (Sized_relobj_file::find_special_sections): New function.
11         * object.cc (Sized_relobj_file::find_shdr): New function.
12         (Sized_relobj_file::find_eh_frame): Use find_shdr.
13         (Sized_relobj_file::find_special_sections): New function, split out..
14         (Sized_relobj_file::do_read_symbols): ..from here.
15         * output.h (Output_data_got::replace_constant): New function.
16         (Output_data_got::num_entries): New function.
17         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
18         (Output_data_got::got_offset): Protected rather than private.
19         (Output_data_got::replace_got_entry): New function.
20         * output.cc (Output_data_got::replace_got_entry): New function.
21         * powerpc.cc (class Powerpc_relobj): New.
22         (class Powerpc_relocate_functions): Delete all psymval variants or
23         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
24         Implement _ha functions using corresponding _hi function.
25         (Powerpc_relobj::find_special_sections): New function.
26         (Target_powerpc::do_make_elf_object): New function.
27         (class Output_data_got_powerpc): New.
28         (class Output_data_glink): New.
29         (class Powerpc_scan_relocatable_reloc): New.
30         Many more changes througout file.
31
32 2012-08-09  Nick Clifton  <nickc@redhat.com>
33
34         * po/vi.po: Updated Vietnamese translation.
35
36 2012-08-07  Ian Lance Taylor  <iant@google.com>
37
38         * layout.cc (Layout::add_target_dynamic_tags): If
39         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
40         plt_rel.
41
42 2012-07-30  Nick Clifton  <nickc@redhat.com>
43
44         * po/gold.pot: Updated template.
45         * po/es.po: Updated Spanish translation.
46
47 2012-07-18  Cary Coutant  <ccoutant@google.com>
48
49         PR gold/14344
50         * configure.ac: Add check for -gpubnames support.
51         * configure: Regenerate.
52         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
53         support; force -gno-pubnames.
54         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
55         support.
56         (gdb_index_test_4): New test.
57         * testsuite/Makefile.in: Regenerate.
58         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
59         * testsuite/gdb_index_test_2.sh: Likewise.
60         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
61         * testsuite/gdb_index_test_4.sh: New script.
62         * testsuite/gdb_index_test_comm.sh: New script with common code;
63         don't look for space after colon.
64
65 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
66
67         * gold.cc (queue_middle_tasks): Update function order only after
68         deferred objects due to plugins are processed.
69
70 2012-07-11  Ian Lance Taylor  <iant@google.com>
71
72         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
73         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
74         (Target_arm::scan_reloc_for_stub): Likewise.
75         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
76         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
77         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
78         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
79         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
80
81 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
82             Ian Lance Taylor  <iant@google.com>
83
84         PR gold/14309
85         * configure.ac: Test whether std::tr1::hash<off_t> works.
86         * gold.h: Add a specialization for std::tr1::hash<off_t> if
87         needed.
88         * output.h (class Output_fill): Add virtual destructor.
89         * configure, config.in: Rebuild.
90
91 2012-06-22  Roland McGrath  <mcgrathr@google.com>
92
93         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
94
95 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
96
97         * plugin.cc (Plugin::load): Handle position independent executables.
98
99 2012-06-06  Cary Coutant  <ccoutant@google.com>
100
101         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
102         add .debug_macro.
103         (lines_only_debug_sections): Likewise.
104         (gdb_fast_lookup_sections): New static array.
105         (is_gdb_debug_section): Rename formal parameter.
106         (is_lines_only_debug_section): Likewise.
107         (is_gdb_fast_lookup_section): New function.
108         (Layout::include_section): Check for ".zdebug_" prefix; pass
109         section name suffix to is_gdb_debug_section, et al.; check for
110         fast-lookup sections when building .gdb_index.
111         * options.h (--strip-debug-gdb): Update GDB version number.
112
113 2012-06-06  Cary Coutant  <ccoutant@google.com>
114
115         * configure.ac: Add check for fallocate.
116         * configure: Regenerate.
117         * config.in: Regenerate.
118
119         * options.h (class General_options): Add --mmap-output-file and
120         --posix-fallocate options.
121         * output.cc: (posix_fallocate): Remove; replace with...
122         (gold_fallocate): New function.
123         (Output_file::map_no_anonymous): Call gold_fallocate.
124         (Output_file::map): Check --mmap-output-file option.
125
126 2012-06-05  Jing Yu  <jingyu@google.com>
127
128         * gold.h (textdomain): Add do {} to empty while(0).
129         (bindtextdomain): Likewise.
130
131 2012-06-04  Cary Coutant  <ccoutant@google.com>
132
133         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
134         has_dynsym_index.
135
136 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
137
138         * symtab.cc (Symbol_table::define_special_symbol):
139         Initialize *poldsym to prevent uninitialized variable errors.
140
141 2012-05-23  Cary Coutant  <ccoutant@google.com>
142
143         * layout.cc (Layout::section_name_mapping): Add rules to handle
144         exact match on .data.rel.ro.local or .data.rel.ro.
145         (Layout::output_section_name): Check for exact matches.
146
147 2012-05-23  Cary Coutant  <ccoutant@google.com>
148
149         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
150         more carefully.
151
152 2012-05-22  Cary Coutant  <ccoutant@google.com>
153
154         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
155         object before exporting symbol.
156
157 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
158
159         * testsuite/tls_test.cc: Include "config.h" first.
160         * testsuite/tls_test_c.c: Likewise.
161
162 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
163             Nick Clifton  <nickc@redhat.com>
164
165         PR 14072
166         * configure.in: Add check that sysdep.h has been included before
167         any system header files.
168         * configure: Regenerate.
169         * config.in: Regenerate.
170
171 2012-05-14  Cary Coutant  <ccoutant@google.com>
172
173         * layout.cc (Layout::make_output_section): Mark .tdata section
174         as RELRO.
175         * testsuite/relro_test.cc: Add a TLS variable.
176
177 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
178
179         PR gold/14091
180         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
181         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
182         R_X86_64_64.
183
184 2012-05-08  Cary Coutant  <ccoutant@google.com>
185
186         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
187         (lines_only_debug_sections): Likewise.
188
189 2012-05-02  Roland McGrath  <mcgrathr@google.com>
190
191         * nacl.cc: New file.
192         * nacl.h: New file.
193         * Makefile.am (CCFILES, HFILES): Add them.
194         * Makefile.in: Regenerate.
195         * i386.cc (Output_data_plt_i386_nacl): New class.
196         (Output_data_plt_i386_nacl_exec): New class.
197         (Output_data_plt_i386_nacl_dyn): New class.
198         (Target_i386_nacl): New class.
199         (Target_selector_i386_nacl): New class.
200         (target_selector_i386): Use it instead of Target_selector_i386.
201         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
202         (Target_x86_64_nacl): New class.
203         (Target_selector_x86_64_nacl): New class.
204         (target_selector_x86_64, target_selector_x32): Use it instead of
205         Target_selector_x86_64.
206         * arm.cc (Output_data_plt_arm_nacl): New class.
207         (Target_arm_nacl): New class.
208         (Target_selector_arm_nacl): New class.
209         (target_selector_arm, target_selector_armbe): Use it instead of
210         Target_selector_arm.
211
212         * target-select.cc (select_target): Take new Input_file* and off_t
213         arguments, pass them on to recognize method of selector.
214         * object.cc (make_elf_sized_object): Update caller.
215         * parameters.cc (parameters_force_valid_target): Likewise.
216         * incremental.cc (make_sized_incremental_binary): Likewise.
217         * target-select.h: Update decl.
218         (Target_selector::recognize): Take new Input_file* argument,
219         pass it on to do_recognize.
220         (Target_selector::do_recognize): Take new Input_file* argument.
221         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
222         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
223         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
224         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
225
226         * target.h (Target::Target_info): New members isolate_execinstr
227         and rosegment_gap.
228         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
229         * arm.cc (Target_arm::arm_info): Update initializer.
230         * i386.cc (Target_i386::i386_info): Likewise.
231         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
232         * sparc.cc (Target_sparc::sparc_info): Likewise.
233         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
234         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
235         * layout.cc (Layout::attach_allocated_section_to_segment):
236         Take new const Target* argument.  If target->isolate_execinstr(), act
237         like --rosegment.
238         (Layout::find_first_load_seg): Take new const Target* argument;
239         if target->isolate_execinstr(), reject PF_X segments.
240         (Layout::relaxation_loop_body): Update caller.
241         (Layout::set_segment_offsets): If target->isolate_execinstr(),
242         reset file offset to zero when we hit LOAD_SEG, and then do a second
243         loop over the segments before LOAD_SEG to reassign offsets after
244         addresses have been determined.  Handle target->rosegment_gap().
245         (Layout::attach_section_to_segment): Take new const Target* argument;
246         pass it to attach_allocated_section_to_segment.
247         (Layout::make_output_section): Update caller.
248         (Layout::attach_sections_to_segments): Take new const Target* argument;
249         pass it to attach_section_to_segment.
250         * gold.cc (queue_middle_tasks): Update caller.
251         * layout.h (Layout): Update method decls with new arguments.
252
253         * arm.cc (Target_arm::Target_arm): Take optional argument for the
254         Target_info pointer to use.
255         (Target_arm::do_make_data_plt): New virtual method.
256         (Target_arm::make_data_plt): New method that calls it.
257         (Target_arm::make_plt_entry): Use it.
258         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
259         for the section alignment.
260         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
261         method.
262         (Output_data_plt_arm::first_plt_entry_offset): Call it.
263         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
264         method.
265         (Output_data_plt_arm::get_plt_entry_size): Call it.
266         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
267         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
268         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
269         method.
270         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
271         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
272         method instead of sizeof(plt_entry).
273         (Output_data_plt_arm::add_entry): Likewise.
274         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
275         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
276         than static method.
277         (Target_arm::plt_entry_size): Likewise.
278         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
279         Move to ...
280         (Output_data_plt_arm_standard): ... here, new class.
281         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
282         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
283         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
284
285         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
286         Take additional argument for the PLT entry size.
287         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
288         Use get_plt_entry_size method rather than plt_entry_size variable.
289         (Output_data_plt_x86_64::reserve_slot): Likewise.
290         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
291         (Output_data_plt_x86_64::add_entry): Likewise.
292         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
293         (Output_data_plt_x86_64::address_for_global): Likewise.
294         (Output_data_plt_x86_64::address_for_local): Likewise.
295         (Output_data_plt_x86_64::set_final_data_size): Likewise.
296         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
297         Make method non-static.
298         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
299         method.
300         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
301         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
302         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
303         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
304         virtual method.
305         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
306         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
307         virtual method.
308         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
309         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
310         virtual method.
311         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
312         (Output_data_plt_x86_64::plt_entry_size)
313         (Output_data_plt_x86_64::first_plt_entry)
314         (Output_data_plt_x86_64::plt_entry)
315         (Output_data_plt_x86_64::tlsdesc_plt_entry)
316         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
317         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
318         (Output_data_plt_x86_64_standard): ... here, new class.
319         (Target_x86_64::Target_x86_64): Take optional argument for the
320         Target_info pointer to use.
321         (Target_x86_64::do_make_data_plt): New virtual method.
322         (Target_x86_64::make_data_plt): New method to call it.
323         (Target_x86_64::init_got_plt_for_update): Use that.
324         Call this->plt_->add_eh_frame method here.
325         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
326         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
327         rather than static method.
328         (Target_x86_64::plt_entry_size): Likewise.
329         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
330         rather than plt_entry_size variable.  Move guts of PLT filling to...
331         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
332         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
333         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
334
335         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
336         additional argument for the section alignment.
337         Don't do add_eh_frame_for_plt here.
338         (Output_data_plt_i386::first_plt_entry_offset): Make the method
339         non-static.  Use get_plt_entry_size method rather than plt_entry_size
340         variable.
341         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
342         method.
343         (Output_data_plt_i386::get_plt_entry_size): Call it.
344         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
345         (Output_data_plt_i386::add_eh_frame): New method to call it.
346         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
347         method.
348         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
349         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
350         method.
351         (Output_data_plt_i386::fill_plt_entry): New method to call it.
352         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
353         method instead of plt_entry_size.
354         (Output_data_plt_i386::plt_entry_size)
355         (Output_data_plt_i386::plt_eh_frame_fde_size)
356         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
357         (Output_data_plt_i386_standard): ... here, new class.
358         (Output_data_plt_i386_exec): New class.
359         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
360         (Output_data_plt_i386_exec::first_plt_entry): ... here.
361         (Output_data_plt_i386::exec_plt_entry): Move to ...
362         (Output_data_plt_i386_exec::plt_entry): ... here.
363         (Output_data_plt_i386_dyn): New class.
364         (Output_data_plt_i386::first_plt_entry): Move to ...
365         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
366         (Output_data_plt_i386::dyn_plt_entry): Move to ...
367         (Output_data_plt_i386_dyn::plt_entry): ... here.
368         (Target_i386::Target_i386): Take optional argument for the Target_info
369         pointer to use.
370         (Target_i386::do_make_data_plt): New virtual method.
371         (Target_i386::make_data_plt): New method to call it.
372         (Target_i386::make_plt_section): Use that.
373         Call this->plt_->add_eh_frame method here.
374         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
375         rather than plt_entry_size variable.
376         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
377         (Output_data_plt_i386::address_for_local): Likewise.
378         (Output_data_plt_i386::do_write): Likewise.
379         Move guts of PLT filling to...
380         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
381         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
382         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
383         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
384
385 2012-05-01  Cary Coutant  <ccoutant@google.com>
386
387         * dwarf_reader.cc (Dwarf_die::read_attributes)
388         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
389         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
390         * reduced_debug_output.cc
391         (Output_reduced_debug_info_section::get_die_end): Remove
392         DW_FORM_GNU_ref_index.  Add default case.
393
394 2012-04-26  Mark Wielaard  <mjw@redhat.com>
395
396         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
397         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
398         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
399         DW_AT_high_pc as offset from DW_AT_low_pc.
400
401         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
402         * testsuite/Makefile.in: Regenerate.
403         * testsuite/gdb_index_test_3.c: New test source file.
404         * testsuite/gdb_index_test_3.sh: New test source file.
405
406 2012-04-25  Ian Lance Taylor  <iant@google.com>
407
408         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
409         pointer.
410         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
411         as a class, not a struct.
412         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
413         (Target_arm::apply_cortex_a8_workaround): Likewise.
414         * gc.h: Declare Reloc_types as a struct, not a class.
415         * object.h: Declare Symbols_data as a struct.
416         * reloc.h: Declare Read_relocs_data as a struct.
417         * target.h: Declare Relocate_info as a struct.
418
419 2012-04-24  David S. Miller  <davem@davemloft.net>
420
421         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
422         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
423         and R_SPARC_WPLT30.
424
425 2012-04-24  Cary Coutant  <ccoutant@google.com>
426
427         * incremental-dump.cc (find_input_containing_global): Replace
428         magic number with symbolic constant.
429         (dump_incremental_inputs): Update version number.
430         * incremental.cc (Output_section_incremental_inputs): Update version
431         number; import symbolic constants from Incremental_inputs_reader.
432         (Incremental_inputs::create_data_sections): Align relocations
433         section correctly for 64-bit targets.
434         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
435         constants; add padding.
436         (Output_section_incremental_inputs::write_header): Add assert for
437         header_size.
438         (Output_section_incremental_inputs::write_input_files): Add assert
439         for input_entry_size.
440         (Output_section_incremental_inputs::write_info_blocks): Add padding;
441         add assert for object_info_size, input_section_entry_size,
442         global_sym_entry_size.
443         * incremental.h (Incremental_inputs_reader): Add symbolic constants
444         for data structure sizes; use them.
445         (Incremental_input_entry_reader): Import symbolic constants from
446         Incremental_inputs_reader; use them.
447
448 2012-04-23  David S. Miller  <davem@davemloft.net>
449
450         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
451         and elf_flags_set_.
452         (Target_sparc::Target_sparc): Initialize new fields.
453         (Target_sparc::do_make_elf_object): New function.
454         (Target_sparc::do_adjust_elf_header): New function.
455
456 2012-04-23  Cary Coutant  <ccoutant@google.com>
457
458         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
459         CU range table of gdb index.
460
461 2012-04-20  David S. Miller  <davem@davemloft.net>
462
463         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
464         instead of false.
465
466 2012-04-16  David S. Miller  <davem@davemloft.net>
467
468         * sparc.cc (Target_sparc::got_address): New function.
469         (Sparc_relocate_functions::gdop_hix22): New function.
470         (Sparc_relocate_functions::gdop_lox10): New function.
471         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
472         relocs.
473         (Target_sparc::Scan::local): Likewise if the global symbol is not
474         preemptible and is not IFUNC.
475         (Target_sparc::Relocate::relocate): Perform GOTDATA code
476         transformations for local and non-preemptible non-IFUNC global
477         symbols.
478
479         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
480         writing out 64-bit part of ranges.
481
482         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
483         -fpic and -fpie respectively.
484         * Makefile.in: Regenerate.
485
486         * sparc.cc (class Target_sparc): Add rela_ifunc_.
487         (Target_sparc::Target_sparc): Initialize new field.
488         (Target_sparc::do_plt_section_for_global): New function.
489         (Target_sparc::do_plt_section_for_local): New function.
490         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
491         (Target_sparc::make_plt_section): New function, broken out of
492         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
493         (Target_sparc::make_plt_entry): Call make_plt_section.
494         (Target_sparc::make_local_ifunc_plt_entry): New function.
495         (Target_sparc::rela_ifunc_section): New function.
496         (Target_sparc::plt_section): Remove const.
497         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
498         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
499         and ifunc_count_ fields.
500         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
501         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
502         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
503         (Output_data_plt_sparc::rela_ifunc): New function.
504         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
505         (Output_data_plt_sparc::has_ifunc_section): New function.
506         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
507         (Output_data_plt_sparc::address_for_global): New function.
508         (Output_data_plt_sparc::address_for_local): New function.
509         (Output_data_plt_sparc::plt_index_to_offset): New function.
510         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
511         and entry_count.
512         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
513         entry_count.
514         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
515         R_SPARC_JMP_IREL to switch.
516         (Target_sparc::Scan::check_non_pic): Likewise.
517         (Target_sparc::Scan::local): Handle IFUNC symbols.
518         (Target_sparc::Scan::local): Likewise.
519         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
520         and plt_address_for_local.
521         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
522         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
523
524         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
525         (class Output_data_reloc): Adjust calls to Output_reloc_type.
526         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
527         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
528         global relocs too.
529         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
530         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
531         calls.
532         * sparc.cc (Target_sparc::Scan::global): Likewise.
533         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
534
535 2012-04-16  Cary Coutant  <ccoutant@google.com>
536
537         * archive.cc (Library_base::should_include_member): Check for
538         --export-dynamic-symbol.
539         * options.h (class General_options): Add --export-dynamic-symbol.
540         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
541         --export-dynamic-symbol.
542         (Symbol_table::gc_mark_undef_symbols): Likewise.
543         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
544
545 2012-04-12  David S. Miller  <davem@davemloft.net>
546
547         * sparc.cc (Reloc::wdisp10): New relocation method.
548         (Reloc::h34): Likewise.
549         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
550         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
551         R_SPARC_WDISP10.
552         (Target_sparc::Scan::local): Likewise.
553         (Target_sparc::Scan::global): Likewise.
554         (Target_sparc::Relocate::relocate): Likewise.
555
556 2012-04-09  Cary Coutant  <ccoutant@google.com>
557
558         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
559         low_pc == 0.
560
561 2012-04-06  Ian Lance Taylor  <iant@google.com>
562
563         * timer.cc: #include <unistd.h>.
564
565 2012-04-06  Roland McGrath  <mcgrathr@google.com>
566
567         * configure.in (AC_CHECK_HEADERS): Add locale.h.
568         * config.in: Regenerate.
569         * configure: Regenerate.
570
571 2012-04-05  Nick Clifton  <nickc@redhat.com>
572
573         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
574         (AM_LC_MESSAGES): Add.
575         * aclocal.m4: Regenerate.
576         * config.in: Regenerate.
577         * configure: Regenerate.
578
579 2012-03-21  Cary Coutant  <ccoutant@google.com>
580
581         * Makefile.am: Add gdb-index.cc, gdb-index.h.
582         * Makefile.in: Regenerate.
583         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
584         (Sized_elf_reloc_mapper::symbol_section): New function.
585         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
586         (make_elf_reloc_mapper): New function.
587         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
588         (Dwarf_abbrev_table::do_read_abbrevs): New function.
589         (Dwarf_abbrev_table::do_get_abbrev): New function.
590         (Dwarf_ranges_table::read_ranges_table): New function.
591         (Dwarf_ranges_table::read_range_list): New function.
592         (Dwarf_pubnames_table::read_section): New function.
593         (Dwarf_pubnames_table::read_header): New function.
594         (Dwarf_pubnames_table::next_name): New function.
595         (Dwarf_die::Dwarf_die): New function.
596         (Dwarf_die::read_attributes): New function.
597         (Dwarf_die::skip_attributes): New function.
598         (Dwarf_die::set_name): New function.
599         (Dwarf_die::set_linkage_name): New function.
600         (Dwarf_die::attribute): New function.
601         (Dwarf_die::string_attribute): New function.
602         (Dwarf_die::int_attribute): New function.
603         (Dwarf_die::uint_attribute): New function.
604         (Dwarf_die::ref_attribute): New function.
605         (Dwarf_die::child_offset): New function.
606         (Dwarf_die::sibling_offset): New function.
607         (Dwarf_info_reader::check_buffer): New function.
608         (Dwarf_info_reader::parse): New function.
609         (Dwarf_info_reader::do_parse): New function.
610         (Dwarf_info_reader::do_read_string_table): New function.
611         (Dwarf_info_reader::lookup_reloc): New function.
612         (Dwarf_info_reader::get_string): New function.
613         (Dwarf_info_reader::visit_compilation_unit): New function.
614         (Dwarf_info_reader::visit_type_unit): New function.
615         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
616         Sized_elf_reloc_mapper.
617         (Sized_dwarf_line_info::symbol_section): Remove function.
618         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
619         (Sized_dwarf_line_info::read_line_mappings): Remove object
620         parameter, adjust callers.
621         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
622         * dwarf_reader.h: Include <sys/types.h>.
623         (class Track_relocs): Remove forward declaration.
624         (class Elf_reloc_mapper): New class.
625         (class Sized_elf_reloc_mapper): New class.
626         (class Dwarf_abbrev_table): New class.
627         (class Dwarf_range_list): New class.
628         (class Dwarf_ranges_table): New class.
629         (class Dwarf_pubnames_table): New class.
630         (class Dwarf_die): New class.
631         (class Dwarf_info_reader): New class.
632         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
633         (Sized_dwarf_line_info::symbol_section): Remove member function.
634         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
635         base class.
636         * gdb-index.cc: New source file.
637         * gdb-index.h: New source file.
638         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
639         and .debug_types sections, call Layout::add_to_gdb_index.
640         (Sized_relobj_incr::do_section_name): Implement.
641         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
642         return type; Implement.
643         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
644         return type.
645         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
646         parameter list and return type.
647         (Sized_incr_dynobj::do_section_contents): Likewise.
648         * layout.cc: Include gdb-index.h.
649         (Layout::Layout): Initialize gdb_index_data_.
650         (Layout::init_fixed_output_section): Check for .gdb_index section.
651         (Layout::add_to_gdb_index): New function. Instantiate.
652         * layout.h: Add forward declaration for class Gdb_index.
653         (Layout::add_to_gdb_index): New member function.
654         (Layout::gdb_index_data_): New data member.
655         * main.cc: Include gdb-index.h.
656         (main): Print statistics for gdb index.
657         * object.cc (Object::section_contents): Move code into
658         do_section_contents.
659         (need_decompressed_section): Check for sections needed when building
660         gdb index.
661         (build_compressed_section_map): Likewise.
662         (Sized_relobj_file::do_read_symbols): Need local symbols when building
663         gdb index.
664         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
665         sections; call Layout::add_to_gdb_index.
666         (Sized_relobj_file::do_decompressed_section_contents): Call
667         do_section_contents directly.
668         * object.h (Object::do_section_contents): Adjust parameter list and
669         return type.
670         (Object::do_decompressed_section_contents): Call do_section_contents
671         directly.
672         (Sized_relobj_file::do_section_contents): Adjust parameter list and
673         return type.
674         * options.h (class General_options): Add --gdb-index option.
675         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
676         list and return type.
677         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
678         * reloc.h (Track_relocs::checkpoint): New function.
679         (Track_relocs::reset): New function.
680
681         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
682         New test cases.
683         * testsuite/Makefile.in: Regenerate.
684         * testsuite/gdb_index_test.cc: New test source file.
685         * testsuite/gdb_index_test_1.sh: New test source file.
686         * testsuite/gdb_index_test_2.sh: New test source file.
687
688 2012-03-19  Doug Kwan  <dougkwan@google.com>
689
690         * arm.cc (Target_arm::do_define_standard_symbols): New method.
691         (Target_arm::do_finalize_sections): Remove code which defines
692         __exidx_start and __exidx_end.  Make symbol table parameter
693         anonymous as it is not used.
694         * gold.cc (queue_middle_tasks): Call target hook to define any
695         target-specific symbols.
696         * target.h (Target::define_standard_symbols): New method.
697         (Target::do_define_standard_symbols): Same.
698         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
699         * testsuite/Makefile.in: Regenerate.
700         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
701         and __exidx_end.
702         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
703         relocations are generated for __exidx_start and __exidx_end.
704
705 2012-03-16  Doug Kwan  <dougkwan@google.com>
706
707         * testsuite/Makefile.am: Disable test initpri3b.
708         * testsuite/Makefile.in: Regenerate.
709
710 2012-03-15  Doug Kwan  <dougkwan@google.com>
711
712         * arm.cc (Target_arm::got_section): Make .got section read-only
713         if -z now is given.
714
715 2012-03-15  Ian Lance Taylor  <iant@google.com>
716
717         PR gold/13850
718         * layout.cc (Layout::make_output_section): Correctly mark
719         SHT_INIT_ARRAY, et. al., as relro.
720
721 2012-03-14  Doug Kwan  <dougkwan@google.com>
722
723         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
724         dynamic relocations for protected symbols in shared objects.
725
726 2012-03-13  Ian Lance Taylor  <iant@google.com>
727
728         * resolve.cc (Symbol_table::resolve): When merging common symbols,
729         keep the larger alignment.
730
731 2012-03-12  Cary Coutant  <ccoutant@google.com>
732
733         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
734         handling of DW_LNE_define_file.
735
736 2012-03-12  Cary Coutant  <ccoutant@google.com>
737
738         * reduced_debug_output.cc
739         (Output_reduced_debug_info_section::get_die_end): Add new FORM
740         codes to switch.
741
742 2012-02-29  Cary Coutant  <ccoutant@google.com>
743
744         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
745
746 2012-02-29  Cary Coutant  <ccoutant@google.com>
747
748         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
749         Call Object::decompressed_section_contents.
750         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
751         New dtor.
752         (Sized_dwarf_line_info::buffer_start_): New data member.
753         * merge.cc (Output_merge_data::do_add_input_section): Call
754         Object::decompressed_section_contents.
755         (Output_merge_string::do_add_input_section): Likewise.
756         * object.cc (need_decompressed_section): New function.
757         (build_compressed_section_map): Decompress sections needed later.
758         (Sized_relobj_file::do_decompressed_section_contents): New function.
759         (Sized_relobj_file::do_discard_decompressed_sections): New function.
760         * object.h (Object::decompressed_section_contents): New function.
761         (Object::discard_decompressed_sections): New function.
762         (Object::do_decompressed_section_contents): New function.
763         (Object::do_discard_decompressed_sections): New function.
764         (Compressed_section_info): New type.
765         (Compressed_section_map): Include decompressed section contents.
766         (Sized_relobj_file::do_decompressed_section_contents): New function.
767         (Sized_relobj_file::do_discard_decompressed_sections): New function.
768
769 2012-02-16  Cary Coutant  <ccoutant@google.com>
770
771         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
772         * testsuite/Makefile.in: Regenerate.
773
774 2012-02-14  Cary Coutant  <ccoutant@google.com>
775
776         * options.cc (General_options::finalize): Disallow -pie and -static.
777
778 2012-02-03  Doug Kwan  <dougkwan@google.com>
779
780         * arm.cc (Arm_relocate_functions::abs8,
781         Arm_relocate_functions::abs16): Use
782         Bits::has_signed_unsigned_overflow32.
783         (Arm_relocate_functions::thm_abs8): Correct range of
784         overflow check.
785         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
786         in assertions.
787
788 2012-02-02  Doug Kwan  <dougkwan@google.com>
789
790         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
791         position independent outputs, not just shared objects.
792
793 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
794
795         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
796         * configure: Regenerated.
797
798 2012-01-27  Ian Lance Taylor  <iant@google.com>
799
800         * reloc.h (Bits): New class with static functions, copied from
801         namespace utils in arm.cc.
802         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
803         instead.
804
805 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
806
807         * incremental.cc (write_info_blocks): Correct relocation offset.
808
809 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
810
811         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
812         (Relocate::tls_gd_to_le): Likewise.
813
814 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
815
816         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
817
818 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
819
820         * configure.ac: Check if -mcmodel=medium works.
821         * configure: Regenerated.
822
823 2012-01-24  Cary Coutant  <ccoutant@google.com>
824
825         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
826         definition and ...
827         (read_unsigned_LEB_128_x): ... this new function.
828         (read_signed_LEB_128): Replaced with inline definition and ...
829         (read_signed_LEB_128_x): ... this new function.
830         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
831         (read_unsigned_LEB_128): Add inline definition.
832         (read_signed_LEB_128_x): New function.
833         (read_signed_LEB_128): Add inline definition.
834         * testsuite/Makefile.am (leb128_unittest): New unit test.
835         * testsuite/Makefile.in: Regenerate.
836         * testsuite/leb128_unittest.cc: New unit test.
837
838 2012-01-23  Ian Lance Taylor  <iant@google.com>
839
840         PR gold/13617
841         * i386.cc (Target_i386::do_code_fill): When using a jmp
842         instruction, pad with nop instructions.
843         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
844
845 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
846
847         * x86_64.cc (gc_process_relocs): Add typename on types used in
848         template.
849         (scan_relocs): Likewise.
850         (relocate_section): Likewise.
851         (apply_relocation): Likewise.
852
853 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
854
855         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
856         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
857         under x32.
858
859 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
860
861         * x86_64.cc: Initial support for x32.
862
863 2012-01-03  Cary Coutant  <ccoutant@google.com>
864
865         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
866         Use abstract base class for GOT.
867         * gold/output.h (class Output_data_got_base): New abstract base class.
868         (class Output_data_got): Derive from new base class, adjust ctors.
869         (Output_data_got::reserve_slot): Make virtual; rename to
870         do_reserve_slot; Adjust callers.
871         * gold/target.h (Sized_target::init_got_plt_for_update): Return
872         pointer to abstract base class.
873         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
874
875 2011-12-18  Ian Lance Taylor  <iant@google.com>
876
877         * object.h (Relobj::local_symbol_value): New function.
878         (Relobj::local_plt_offset): New function.
879         (Relobj::local_has_got_offset): New function.
880         (Relobj::local_got_offset): New function.
881         (Relobj::set_local_got_offset): New function.
882         (Relobj::do_local_symbol_value): New pure virtual function.
883         (Relobj::do_local_plt_offset): Likewise.
884         (Relobj::do_local_has_got_offset): Likewise.
885         (Relobj::do_local_got_offset): Likewise.
886         (Relobj::do_set_local_got_offset): Likewise.
887         (Sized_relobj::do_local_has_got_offset): Rename from
888         local_has_got_offset.
889         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
890         (Sized_relobj::do_set_local_got_offset): Rename from
891         set_local_got_offset.
892         (Sized_relobj_file::do_local_plt_offset): Rename from
893         local_plt_offset.
894         (Sized_relobj_file::do_local_symbol_value): New function.
895         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
896         local_plt_offset.
897         * output.cc (Output_data_got::Got_entry::write): Change object to
898         Relobj.  Use local_symbol_value.
899         (Output_data_got::add_global_with_rel): Change rel_dyn to
900         Output_data_reloc_generic*.  Use add_global_generic.
901         (Output_data_got::add_global_with_rela): Remove.  Change all
902         callers to use add_global_with_rel.
903         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
904         Output_data_reloc_generic*.  Use add_global_generic.
905         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
906         callers to use add_global_pair_with_rel.
907         (Output_data_got::add_local): Change object to Relobj*.
908         (Output_data_got::add_local_plt): Likewise.
909         (Output_data_got::add_local_with_rel): Change object to Relobj*,
910         change rel_dyn to Output_data_reloc_generic*.  Use
911         add_local_generic.
912         (Output_data_got::add_local_with_rela): Remove.  Change all
913         callers to use all_local_with_rel.
914         (Output_data_got::add_local_pair_with_rel): Change object to
915         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
916         add_output_section_generic.
917         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
918         callers to use add_local_pair_with_rel.
919         (Output_data_got::reserve_local): Change object to Relobj*.
920         * output.h: (class Output_data_reloc_generic): Add pure virtual
921         declarations for add_global_generic, add_local_generic,
922         add_output_section_generic.
923         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
924         functions for Output_data_reloc_generic.  Update declarations for
925         changes listed in output.cc.
926         (class Output_data_got): Change template parameter to got_size.
927         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
928         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
929         function.
930         (Sized_relobj_incr::do_local_plt_offset): New function.
931         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
932         add_global_generic.
933
934 2011-12-17  Cary Coutant  <ccoutant@google.com>
935
936         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
937         * resolve.cc (Symbol_table::resolve): Likewise.
938         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
939         arrays.
940         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
941
942 2011-12-16  Ian Lance Taylor  <iant@google.com>
943
944         * output.h (Output_data_reloc_generic::add): Only call
945         add_dynamic_reloc if this is a dynamic reloc section.
946
947 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
948
949         PR gold/13505
950         * target-reloc.h (apply_relocation): Replace <64, false> with
951         <size, big_endian>.
952
953 2011-11-25  Nick Clifton  <nickc@redhat.com>
954
955         * po/it.po: New Italian translation.
956
957 2011-11-17  Sterling Augustine  <saugustine@google.com>
958
959         * script.cc (script_include_directive): Implement.
960         (read_script_file): New local variables name and search_path. Update
961         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
962         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
963         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
964
965 2011-11-11  Sterling Augustine  <saugustine@google.com>
966
967         * yyscript.y (section_cmd): Add support for INCLUDE directive.
968         (file_or_sections_cmd): Likewise.
969
970 2011-11-11  Doug Kwan  <dougkwan@google.com>
971
972         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
973         if --just-symbols is given.
974
975 2011-11-10  Doug Kwan  <dougkwan@google.com>
976
977         PR gold/13362
978         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
979         when processing data relocs.
980         * reloc.h (Relocate_functions::rel_unaligned): New method.
981         (Relocate_functions::pcrel_unaligned): Ditto.
982         (Relocate_functions::rel32_unaligned): Ditto.
983         (Relocate_functions::pcrel32_unaligned): Ditto.
984
985 2011-11-09  Doug Kwan  <dougkwan@google.com>
986
987         PR gold/13362
988         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
989         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
990         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
991         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
992         (Relocate_functions::rel_unaligned): New.
993         (Relocate_functions::rel32_unaligned): New.
994         * target-reloc.h (relocate_for_relocatable): Add code to handle
995         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
996         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
997         arm_unaligned_reloc_r): New targets.
998         * testsuite/Makefile.in: Regenerate.
999         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1000         linking.
1001
1002 2011-11-02  Ian Lance Taylor  <iant@google.com>
1003
1004         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1005         NATIVE_LINKER.
1006         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1007         * options.cc (General_options::finalize): Use library search path
1008         from configure script if specified.  If not native and no sysroot,
1009         only search TOOLLIBDIR.
1010         * options.h (Search_directory::Search_directory): Change name to
1011         const std::string&.
1012         (General_options::add_to_library_path_with_sysroot): Change arg to
1013         const std::string&.
1014         * configure, Makefile.in, config.in: Rebuild.
1015
1016 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1017
1018         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1019         we are working around the ARM1176 Erratum.
1020         * options.h (General_options::fix_arm1176): Add option.
1021         * testsuite/Makefile.am: Add testcases, and keep current ones
1022         working.
1023         * testsuite/Makefile.in: Regenerate.
1024         * testsuite/arm_fix_1176.s: New file.
1025         * testsuite/arm_fix_1176.sh: Likewise.
1026
1027 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1028
1029         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1030         may_use_blx_.
1031         (Target_arm::may_use_blx): Remove method.
1032         (Target_arm::set_may_use_blx): Likewise.
1033         (Target_arm::may_use_v4t_interworking): New method.
1034         (Target_arm::may_use_v5t_interworking): Likewise.
1035         (Target_arm::may_use_blx_): Remove member variable.
1036         (Arm_relocate_functions::arm_branch_common): Check for v5T
1037         interworking.
1038         (Arm_relocate_functions::thumb_branch_common): Likewise.
1039         (Reloc_stub::stub_type_for_reloc): Likewise.
1040         (Target_arm::do_finalize_sections): Correct interworking checks.
1041         * testsuite/Makefile.am: Add new tests.
1042         * testsuite/Makefile.in: Regenerate.
1043         * testsuite/arm_farcall_arm_arm.s: New test.
1044         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1045         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1046         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1047         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1048         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1049         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1050         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1051
1052 2011-10-31  Cary Coutant  <ccoutant@google.com>
1053
1054         PR gold/13023
1055         * expression.cc (Expression::eval_with_dot): Add
1056         is_section_dot_assignment parameter.
1057         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1058         absolute and assigning to dot within a section.
1059         * script-sections.cc
1060         (Output_section_element_assignment::set_section_addresses): Pass
1061         dot_section to set_if_absolute.
1062         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1063         as is_section_dot_assignment flag to eval_with_dot.
1064         (Output_section_element_dot_assignment::set_section_addresses):
1065         Likewise.
1066         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1067         parameter.  Also set value if relative to dot_section; set the
1068         symbol's output_section.
1069         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1070         parameter.  Adjust all callers.
1071         (Expression::eval_maybe_dot): Likewise.
1072         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1073         Adjust all callers.
1074         * testsuite/script_test_2.t: Test assignment of an absolute value
1075         to dot within an output section element.
1076
1077 2011-10-31  Cary Coutant  <ccoutant@google.com>
1078
1079         * options.h (class General_options): Add --[no-]gnu-unique options.
1080         * symtab.cc (Symbol_table::sized_write_globals): Convert
1081         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1082
1083 2011-10-31  Cary Coutant  <ccoutant@google.com>
1084
1085         PR gold/13359
1086         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1087         unnecessary assertion.
1088         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1089
1090 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1091
1092         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1093         gc_mark_symbol.
1094         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1095         gc_mark_symbol.
1096         Change to just keep the section associated with symbol.
1097         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1098         they are externally visible and --export-dynamic is turned on.
1099         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1100
1101 2011-10-19  Ian Lance Taylor  <iant@google.com>
1102
1103         PR gold/13163
1104         * script-sections.cc
1105         (Output_section_element_dot_assignment::needs_output_section): New
1106         function.
1107
1108 2011-10-19  Ian Lance Taylor  <iant@google.com>
1109
1110         PR gold/13204
1111         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1112         --section-start option was seen.
1113         * options.h (General_options::any_section_start): New function.
1114
1115 2011-10-18  David S. Miller  <davem@davemloft.net>
1116
1117         PR binutils/13301
1118         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1119         member to track relocation locations that have moved during TLS
1120         reloc optimizations.
1121         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1122         (Target_sparc::Relocate::relocate): Adjust view down by 4
1123         bytes if it matches reloc_adjust_addr_.
1124         (Target_sparc::Relocate::relocate_tls): Always move the
1125         __tls_get_addr call delay slot instruction forward 4 bytes when
1126         performing relaxation.
1127
1128 2011-10-18  Cary Coutant  <ccoutant@google.com>
1129
1130         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1131         (Output_file::map_no_anonymous): Check for non-zero
1132         return code from posix_fallocate.
1133
1134 2011-10-17  Cary Coutant  <ccoutant@google.com>
1135
1136         PR gold/13245
1137         * plugin.cc (is_visible_from_outside): Check for symbols
1138         referenced from dynamic objects.
1139         * resolve.cc (Symbol_table::resolve): Don't count references
1140         from dynamic objects as references from real ELF files.
1141         * testsuite/plugin_test_2.sh: Adjust expected result.
1142
1143 2011-10-17  Cary Coutant  <ccoutant@google.com>
1144
1145         * gold.cc: Include timer.h.
1146         (queue_middle_tasks): Stamp time.
1147         (queue_final_tasks): Likewise.
1148         * main.cc (main): Store timer in parameters.  Print timers
1149         for each pass.
1150         * parameters.cc (Parameters::Parameters): Initialize timer_.
1151         (Parameters::set_timer): New function.
1152         (set_parameters_timer): New function.
1153         * parameters.h (Parameters::set_timer): New function.
1154         (Parameters::timer): New function.
1155         (Parameters::timer_): New data member.
1156         (set_parameters_timer): New function.
1157         * timer.cc (Timer::stamp): New function.
1158         (Timer::get_pass_time): New function.
1159         * timer.h (Timer::stamp): New function.
1160         (Timer::get_pass_time): New function.
1161         (Timer::pass_times_): New data member.
1162
1163 2011-10-17  Cary Coutant  <ccoutant@google.com>
1164
1165         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1166         task for members of lib groups.
1167
1168 2011-10-17  Cary Coutant  <ccoutant@google.com>
1169
1170         PR gold/13288
1171         * fileread.cc (File_read::find_view): Add assert.
1172         (File_read::make_view): Move bounds check (replace with assert)...
1173         (File_read::find_or_make_view): ... to here.
1174
1175 2011-10-12  Cary Coutant  <ccoutant@google.com>
1176
1177         * output.cc (Output_file::open_base_file): Handle case where
1178         ::read returns less than requested size.
1179
1180 2011-10-10  Cary Coutant  <ccoutant@google.com>
1181
1182         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1183         Initialize defined_count_.
1184         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1185         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1186         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1187         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1188         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1189         * incremental.h (Sized_relobj_incr::defined_count_): New data
1190         member.
1191         (Sized_incr_dynobj::defined_count_): New data member.
1192         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1193         Return zeroes instead of internal error.
1194
1195 2011-10-10  Cary Coutant  <ccoutant@google.com>
1196
1197         PR gold/13249
1198         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1199         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1200         * output.h (class Output_reloc): Add use_plt_offset flag.
1201         (Output_reloc::type_): Adjust size of bit field.
1202         (Output_reloc::use_plt_offset_): New bit field.
1203         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1204         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1205         flag.  Adjust all callers.
1206         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1207         creating RELATIVE relocations.
1208
1209 2011-10-10  Nick Clifton  <nickc@redhat.com>
1210
1211         * po/es.po: Updated Spanish translation.
1212         * po/fi.po: Updated Finnish translation.
1213
1214 2011-10-03   Diego Novillo  <dnovillo@google.com>
1215
1216         * options.cc (parse_uint): Fix dereference of RETVAL.
1217
1218 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1219
1220         * layout.h (section_order_map_): New member.
1221         (get_section_order_map): New member function.
1222         * output.cc (Output_section::add_input_section): Check for patterns
1223         only when --section-ordering-file is specified.
1224         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1225         output_sections have been formed.
1226         * layout.cc (Layout_Layout): Initialize section_order_map_.
1227         * plugin.cc (update_section_order): Store order in order_map. Do not
1228         update the order.
1229         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1230         * testsuite/Makefile.in: Regenerate.
1231         * testsuite/plugin_section_order.c: New file.
1232         * testsuite/plugin_final_layout.cc: New file.
1233         * testsuite/plugin_final_layout.sh: New file.
1234
1235 2011-09-29  Cary Coutant  <ccoutant@google.com>
1236
1237         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1238         Check for NULL.
1239         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1240         symbols during incremental update.
1241         (Symbol_table::add_from_dynobj): Likewise.
1242
1243 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1244             Ian Lance Taylor  <iant@google.com>
1245
1246         * symtab.cc (Symbol_table::define_special_symbol): Always
1247         canonicalize version string.
1248
1249 2011-09-26  Cary Coutant  <ccoutant@google.com>
1250
1251         * gold.cc (queue_initial_tasks): Move option checks ...
1252         * options.cc (General_options::finalize): ... to here. Disable
1253         some options; make others fatal.
1254
1255 2011-09-26  Cary Coutant  <ccoutant@google.com>
1256
1257         gcc PR lto/47247
1258         * plugin.cc (get_symbols_v2): New function.
1259         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1260         (is_referenced_from_outside): New function.
1261         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1262         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1263         (get_symbols): Pass version parameter.
1264         (get_symbols_v2): New function.
1265         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1266         parameter.
1267         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1268         (onload): Add LDPT_GET_SYMBOLS_V2.
1269         (all_symbols_read_hook): Use get_symbols_v2; check for
1270         LDPR_PREVAILING_DEF_IRONLY_EXP.
1271         * testsuite/plugin_test_3.sh: Update expected results.
1272
1273 2011-09-23  Simon Baldwin  <simonb@google.com>
1274
1275         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1276         configuration options.
1277         * configure: Regenerate.
1278         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1279         * Makefile.in: Regenerate.
1280         * testsuite/Makefile.in: Regenerate.
1281
1282 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1283
1284         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1285
1286 2011-09-19  Cary Coutant  <ccoutant@google.com>
1287
1288         * incremental.cc (can_incremental_update): Fix typo in comment.
1289         * incremental.h (can_incremental_update): Likewise.
1290
1291 2011-09-18  Cary Coutant  <ccoutant@google.com>
1292
1293         * incremental.cc (can_incremental_update): New function.
1294         * incremental.h (can_incremental_update): New function.
1295         * layout.cc (Layout::init_fixed_output_section): Call it.
1296         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1297         * object.cc (Sized_relobj_file::do_layout): Call
1298         can_incremental_update.
1299
1300 2011-09-13  Cary Coutant  <ccoutant@google.com>
1301
1302         * configure.ac: Check for glibc support for gnu_indirect_function
1303         support with static linking, setting automake conditional
1304         IFUNC_STATIC.
1305         * Makefile.in: Regenerate.
1306         * configure: Regenerate.
1307
1308         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1309         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1310         for IFUNC_STATIC.
1311         * testsuite/Makefile.in: Regenerate.
1312
1313 2011-09-13  Cary Coutant  <ccoutant@google.com>
1314
1315         * incremental.cc (Sized_relobj_incr::do_layout): Call
1316         report_comdat_group for kept comdat sections.
1317         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1318         * testsuite/Makefile.in: Regenerate.
1319         * testsuite/incr_comdat_test_1.cc: New source file.
1320         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1321         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1322         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1323
1324 2011-09-13  Ian Lance Taylor  <iant@google.com>
1325
1326         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1327         variable external_symbols_offset.
1328
1329 2011-09-12  Ian Lance Taylor  <iant@google.com>
1330
1331         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1332         triggered if object has no symbols.
1333
1334 2011-09-09  David S. Miller  <davem@davemloft.net>
1335
1336         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1337         (Output_fill_debug_line::do_write): Likewise.
1338
1339 2011-08-29  Cary Coutant  <ccoutant@google.com>
1340
1341         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1342         casts to match formatting specs.
1343         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1344
1345 2011-08-26  Cary Coutant  <ccoutant@google.com>
1346
1347         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1348         remaining hole size when allocating.
1349         (Layout::make_output_section): Set fill methods for debug sections.
1350         * layout.h (Free_list::Free_list_node): Move from private to
1351         public.
1352         (Free_list::set_min_hole_size): New function.
1353         (Free_list::begin, Free_list::end): New functions.
1354         (Free_list::min_hole_): New data member.
1355         * output.cc: Include dwarf.h.
1356         (Output_fill_debug_info::do_minimum_hole_size): New function.
1357         (Output_fill_debug_info::do_write): New function.
1358         (Output_fill_debug_line::do_minimum_hole_size): New function.
1359         (Output_fill_debug_line::do_write): New function.
1360         (Output_section::Output_section): Initialize new data member.
1361         (Output_section::set_final_data_size): Ensure patch space is larger
1362         than minimum hole size.
1363         (Output_section::do_write): Fill holes in debug sections.
1364         * output.h (Output_fill): New class.
1365         (Output_fill_debug_info): New class.
1366         (Output_fill_debug_line): New class.
1367         (Output_section::set_free_space_fill): New function.
1368         (Output_section::free_space_fill_): New data member.
1369         * testsuite/Makefile.am (incremental_test_3): Add
1370         --incremental-patch option.
1371         (incremental_test_4): Likewise.
1372         (incremental_test_5): Likewise.
1373         (incremental_test_6): Likewise.
1374         (incremental_copy_test): Likewise.
1375         (incremental_common_test_1): Likewise.
1376         * testsuite/Makefile.in: Regenerate.
1377
1378 2011-08-26  Nick Clifton  <nickc@redhat.com>
1379
1380         * po/es.po: Updated Spanish translation.
1381
1382 2011-08-01  Cary Coutant  <ccoutant@google.com>
1383
1384         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1385         * gold/testsuite/Makefile.in: Regenerate.
1386         * gold/testsuite/justsyms_exec.c: New source file.
1387         * gold/testsuite/justsyms_lib.c: New source file.
1388
1389 2011-08-01  Cary Coutant  <ccoutant@google.com>
1390
1391         * layout.cc (Layout::set_segment_offsets): Don't realign text
1392         segment if -Ttext was specified.
1393         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1394         file type.
1395         * object.h (Sized_relobj_file::e_type): New function.
1396         (Sized_relobj_file::e_type_): New data member.
1397         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1398         base address for ET_EXEC files.
1399         * target.cc (Target::do_make_elf_object_implementation): Allow
1400         ET_EXEC files with --just-symbols option.
1401
1402 2011-07-28  Cary Coutant  <ccoutant@google.com>
1403
1404         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1405         Add thread_number parameter.
1406         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1407         * workqueue-threads.cc
1408         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1409         current thread if its thread number is greater than desired thread
1410         count.
1411         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1412         Add thread_number parameter.
1413         (Workqueue::should_cancel_thread): Likewise.
1414         (Workqueue::find_runnable_or_wait): Pass thread_number to
1415         should_cancel_thread.
1416         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1417         parameter.
1418
1419 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1420
1421         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1422         only after checking if it cannot be forced local.
1423         * symtab.h (is_externally_visible): Check if the symbol is not forced
1424         local.
1425
1426 2011-07-15  Ian Lance Taylor  <iant@google.com>
1427
1428         * options.h (class General_options): Add --print-output-format.
1429         Move -EL next to -EB, for  better --help output.
1430         * target-select.cc: Include <cstdio>, "options.h", and
1431         "parameters.h".
1432         (Target_selector::do_target_bfd_name): New function.
1433         (print_output_format): New function.
1434         * target-select.h (class Target_selector): Update declarations.
1435         (Target_selector::target_bfd_name): New function.
1436         (print_output_format): Declare.
1437         * main.cc: Include "target-select.h".
1438         (main): Handle --print-output-format.
1439         * gold.cc: Include "target-select.h".
1440         (queue_initial_tasks): Handle --print-output-format when there are
1441         no input files.
1442         * parameters.cc (parameters_force_valid_target): Give a better
1443         error message if -EB/-EL does not match target.
1444         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1445         function.
1446
1447 2011-07-15  Ian Lance Taylor  <iant@google.com>
1448
1449         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1450         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1451         (Output_data_plt_i386::do_write): Write address of .dynamic
1452         section to first entry in .got.plt section.
1453         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1454         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1455         Initialize layout_.
1456         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1457         section to first entry in .got.plt section.
1458         * layout.h (Layout::dynamic_section): New function.
1459
1460 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1461
1462         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1463         to claim_file call.
1464         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1465         input_section_position_, and input_section_glob_.
1466         (read_layout_from_file): Call function section_ordering_specified.
1467         * layout.h (is_section_ordering_specified): New function.
1468         (section_ordering_specified): New function.
1469         (section_ordering_specified_): New boolean member.
1470         * main.cc(main): Call load_plugins after layout object is defined.
1471         * output.cc (Output_section::add_input_section): Use
1472         function section_ordering_specified to check if section ordering is
1473         needed.
1474         * output.cc (Output_section::add_relaxed_input_section): Use
1475         function section_ordering_specified to check if section ordering is
1476         needed.
1477         (Output_section::update_section_layout): New function.
1478         (Output_section::sort_attached_input_sections): Check if input section
1479         must be reordered.
1480         * output.h (Output_section::update_section_layout): New function.
1481         * plugin.cc (get_section_count): New function.
1482         (get_section_type): New function.
1483         (get_section_name): New function.
1484         (get_section_contents): New function.
1485         (update_section_order): New function.
1486         (allow_section_ordering): New function.
1487         (Plugin::load): Add the new interfaces to the transfer vector.
1488         (Plugin_manager::load_plugins): New parameter.
1489         (Plugin_manager::all_symbols_read): New parameter.
1490         (Plugin_manager::claim_file): New parameter. Save the elf object for
1491         unclaimed objects.
1492         (Plugin_manager::get_elf_object): New function.
1493         (Plugin_manager::get_view): Change to directly use the bool to check
1494         if get_view is called from claim_file_hook.
1495         * plugin.h (input_objects): New function
1496         (Plugin__manager::load_plugins): New parameter.
1497         (Plugin_manager::claim_file): New parameter.
1498         (Plugin_manager::get_elf_object): New function.
1499         (Plugin_manager::in_claim_file_handler): New function.
1500         (Plugin_manager::in_claim_file_handler_): New member.
1501         (layout): New function.
1502         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1503         handler with an extra parameter. Make the elf object before calling
1504         claim_file handler.
1505         * testsuite/plugin_test.c (get_section_count): New function pointer.
1506         (get_section_type): New function pointer.
1507         (get_section_name): New function pointer.
1508         (get_section_contents): New function pointer.
1509         (update_section_order): New function pointer.
1510         (allow_section_ordering): New function pointer.
1511         (onload): Check if the new interfaces exist.
1512
1513 2011-07-13  Ian Lance Taylor  <iant@google.com>
1514
1515         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1516         relro section.
1517         * x86_64.cc (Target_x86_64::got_section): Likewise.
1518         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1519         (relro_now_test_SOURCES): New variable.
1520         (relro_now_test_DEPENDENCIES): New variable.
1521         (relro_now_test_LDFLAGS): New variable.
1522         (relro_now_test_LDADD): New variable.
1523         (relro_now_test.so): New target.
1524         * testsuite/Makefile.in: Rebuild.
1525
1526 2011-07-12  Ian Lance Taylor  <iant@google.com>
1527
1528         PR gold/12980
1529         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1530         GLOB_DAT relocation rather than a RELATIVE relocation for a
1531         protected symbol when creating a shared library.
1532         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1533         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1534         * testsuite/protected_main_1.cc (main): Test that protected
1535         function has same address.
1536
1537 2011-07-11  Ian Lance Taylor  <iant@google.com>
1538
1539         PR gold/12979
1540         * options.h (class General_options): Add -Bgroup.
1541         * options.cc (General_options::finalize): If -Bgroup is set,
1542         default to --unresolved-symbols=report-all.
1543         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1544         * target-reloc.h (issue_undefined_symbol_error): Handle
1545         --unresolved-symbols=report-all.
1546
1547 2011-07-08  Ian Lance Taylor  <iant@google.com>
1548
1549         PR gold/11985
1550         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1551         if linker script discards key sections.
1552         (Layout::create_dynamic_symtab): Likewise.
1553         (Layout::assign_local_dynsym_offsets): Likewise.
1554         (Layout::sized_create_version_sections): Likewise.
1555         (Layout::create_interp): Likewise.
1556         (Layout::finish_dynamic_section): Likewise.
1557         (Layout::set_dynamic_symbol_size): Likewise.
1558
1559 2011-07-08  Ian Lance Taylor  <iant@google.com>
1560
1561         PR gold/12386
1562         * options.h (class General_options): Add --unresolved-symbols.
1563         * target-reloc.h (issue_undefined_symbol_error): Check
1564         --unresolved-symbols.  Add comments.
1565
1566 2011-07-08  Ian Lance Taylor  <iant@google.com>
1567
1568         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1569         expression more complex.
1570
1571 2011-07-08  Ian Lance Taylor  <iant@google.com>
1572
1573         PR gold/11317
1574         * target-reloc.h (issue_undefined_symbol_error): New inline
1575         function, broken out of relocate_section.
1576         (relocate_section): Call issue_undefined_symbol_error.
1577         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1578         there is no TLS segment if we are about to issue an undefined
1579         symbol error.
1580         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1581
1582 2011-07-08  Ian Lance Taylor  <iant@google.com>
1583
1584         PR gold/12279
1585         * resolve.cc (Symbol_table::should_override): Add fromtype
1586         parameter.  Change all callers.  Give error when linking together
1587         TLS and non-TLS symbol.
1588         (Symbol_table::should_override_with_special): Add fromtype
1589         parameter.  Change all callers.
1590         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1591         there is no TLS segment if we have reported some errors.
1592         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1593
1594 2011-07-08  Ian Lance Taylor  <iant@google.com>
1595
1596         PR gold/12372
1597         * target.h (Target::plt_address_for_global): New function.
1598         (Target::plt_address_for_local): New function.
1599         (Target::plt_section_for_global): Remove.
1600         (Target::plt_section_for_local): Remove.
1601         (Target::do_plt_address_for_global): New virtual function.
1602         (Target::do_plt_address_for_local): New virtual function.
1603         (Target::do_plt_section_for_global): Remove.
1604         (Target::do_plt_section_for_local): Remove.
1605         (Target::register_global_plt_entry): Add Symbol_table and Layout
1606         parameters.
1607         * output.cc (Output_data_got::Got_entry::write): Use
1608         plt_address_for_global and plt_address_for_local.
1609         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1610         address of output section.
1611         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1612         got_irelative_, and irelative_count_ fields.  Update
1613         declarations.
1614         (Output_data_plt_i386::has_irelative_section): New function.
1615         (Output_data_plt_i386::entry_count): Add irelative_count_.
1616         (Output_data_plt_i386::set_final_data_size): Likewise.
1617         (class Target_i386): Add got_irelative_ and rel_irelative_
1618         fields.  Update declarations.
1619         (Target_i386::Target_i386): Initialize new fields.
1620         (Target_i386::do_plt_address_for_global): New function replacing
1621         do_plt_section_for_global.
1622         (Target_i386::do_plt_address_for_local): New function replacing
1623         do_plt_section_for_local.
1624         (Target_i386::got_section): Create got_irelative_.
1625         (Target_i386::rel_irelative_section): New function.
1626         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1627         fields.  Don't define __rel_iplt_{start,end}.
1628         (Output_data_plt_i386::add_entry): Add symtab and layout
1629         parameters.  Change all callers.  Use different PLT and GOT for
1630         IFUNC symbols.
1631         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1632         layout parameters.  Change all callers.  Use different PLT and
1633         GOT.
1634         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1635         (Output_data_plt_i386::rel_irelative): New function.
1636         (Output_data_plt_i386::address_for_global): New function.
1637         (Output_data_plt_i386::address_for_local): New function.
1638         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1639         IRELATIVE GOT when changing IFUNC GOT entries.
1640         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1641         reloc.
1642         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1643         if we didn't create an IRELATIVE GOT.
1644         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1645         plt_address_for_local.
1646         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1647         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1648         got_irelative_, and irelative_count_ fields.  Update
1649         declarations.
1650         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1651         Initialize new fields.  Remove symtab parameter.  Change all
1652         callers.
1653         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1654         irelative_count_.
1655         (Output_data_plt_x86_64::has_irelative_section): New function.
1656         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1657         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1658         fields.  Update declarations.
1659         (Target_x86_64::Target_x86_64): Initialize new fields.
1660         (Target_x86_64::do_plt_address_for_global): New function replacing
1661         do_plt_section_for_global.
1662         (Target_x86_64::do_plt_address_for_local): New function replacing
1663         do_plt_section_for_local.
1664         (Target_x86_64::got_section): Create got_irelative_.
1665         (Target_x86_64::rela_irelative_section): New function.
1666         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1667         all callers.  Don't create __rel_iplt_{start,end}.
1668         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1669         parameters.  Change all callers.  Use different PLT and GOT for
1670         IFUNC symbols.
1671         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1672         layout parameters.  Change all callers.  Use different PLT and
1673         GOT.
1674         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1675         parameters.  Change all callers.  Use different PLT and GOT for
1676         IFUNC symbols.
1677         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1678         (Output_data_plt_x86_64::rela_irelative): New function.
1679         (Output_data_plt_x86_64::address_for_global): New function.
1680         (Output_data_plt_x86_64::address_for_local): New function.
1681         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1682         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1683         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1684         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1685         parameters.
1686         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1687         reloc.
1688         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1689         symbols if we didn't create an IRELATIVE GOT.
1690         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1691         plt_address_for_local.
1692         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1693         * testsuite/ifuncvar1.c: New test file.
1694         * testsuite/ifuncvar2.c: New test file.
1695         * testsuite/ifuncvar3.c: New test file.
1696         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1697         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1698         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1699         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1700         * testsuite/Makefile.in: Rebuild.
1701
1702 2011-07-07  Cary Coutant  <ccoutant@google.com>
1703
1704         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1705         (two_file_test_1_ndebug.o): Likewise.
1706         (two_file_test_1b_ndebug.o): Likewise.
1707         (two_file_test_2_ndebug.o): Likewise.
1708         (two_file_test_main_ndebug.o): Likewise.
1709         (incremental_test_2): Link with no-debug versions.
1710
1711 2011-07-06  Cary Coutant  <ccoutant@google.com>
1712
1713         * gold/incremental.cc
1714         (Output_section_incremental_inputs::write_info_blocks): Check for
1715         hidden and internal symbols.
1716
1717 2011-07-06  Cary Coutant  <ccoutant@google.com>
1718
1719         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1720         Check disposition for startup file.
1721         (Incremental_inputs::report_command_line): Ignore
1722         --incremental-startup-unchanged option.
1723         * options.cc (General_options::parse_incremental_startup_unchanged):
1724         New function.
1725         (General_options::General_options): Initialize new data member.
1726         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1727         (General_options): Add --incremental-startup-unchanged option.
1728         (General_options::incremental_startup_disposition): New function.
1729         (General_options::incremental_startup_disposition_): New data member.
1730
1731 2011-07-06  Cary Coutant  <ccoutant@google.com>
1732
1733         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1734         input file index to Script_info ctor.
1735         (Sized_incremental_binary::do_file_has_changed): Find the
1736         command-line argument for files named in scripts.
1737         * incremental.h (Script_info::Script_info): New ctor
1738         with input file index.
1739         (Script_info::input_file_index): New function.
1740         (Script_info::input_file_index_): New data member.
1741         (Incremental_binary::get_library): Add const.
1742         (Incremental_binary::get_script_info): Add const.
1743         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1744         * testsuite/Makefile.am (incremental_test_5): New test case.
1745         (incremental_test_6): New test case.
1746         * testsuite/Makefile.in: Regenerate.
1747
1748 2011-07-06  Cary Coutant  <ccoutant@google.com>
1749
1750         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1751         debug output when command lines differ.
1752
1753 2011-07-06  Cary Coutant  <ccoutant@google.com>
1754
1755         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1756         --incremental-patch option.
1757         * layout.cc (Free_list::allocate): Extend allocation beyond original
1758         end if enabled.
1759         (Layout::make_output_section): Mark sections that should get
1760         patch space.
1761         * options.cc (parse_percent): New function.
1762         * options.h (parse_percent): New function.
1763         (DEFINE_percent): New macro.
1764         (General_options): Add --incremental-patch option.
1765         * output.cc (Output_section::Output_section): Initialize new data
1766         members.
1767         (Output_section::add_input_section): Print section name when out
1768         of patch space.
1769         (Output_section::add_output_section_data): Likewise.
1770         (Output_section::set_final_data_size): Add patch space when
1771         doing --incremental-full.
1772         (Output_section::do_reset_address_and_file_offset): Remove patch
1773         space.
1774         (Output_segment::set_section_list_addresses): Print debug output
1775         only if --incremental-update.
1776         * output.h (Output_section::set_is_patch_space_allowed): New function.
1777         (Output_section::is_patch_space_allowed_): New data member.
1778         (Output_section::patch_space_): New data member.
1779         * parameters.cc (Parameters::incremental_full): New function.
1780         * parameters.h (Parameters::incremental_full): New function
1781         * testsuite/Makefile.am (incremental_test_2): Add test for
1782         --incremental-patch option.
1783         * testsuite/Makefile.in: Regenerate.
1784         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1785         (t18): Remove function body.
1786
1787 2011-07-05  Doug Kwan  <dougkwan@google.com>
1788
1789         PR gold/12771
1790         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1791         Arm_Address type for relocation result.
1792         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1793         overflow check.
1794         (Arm_relocate_functions::abs32): Use unaligned access.
1795         (Arm_relocate_functions::rel32): Ditto.
1796         (Arm_relocate_functions::prel31): Ditto.
1797         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1798         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1799         static data relocations.
1800         * testsuite/Makefile.in: Regnerate.
1801         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1802
1803 2011-07-05  Ian Lance Taylor  <iant@google.com>
1804
1805         PR gold/12392
1806         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1807         symbols if necessary.
1808         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1809
1810 2011-07-05  Ian Lance Taylor  <iant@google.com>
1811
1812         PR gold/12952
1813         * resolve.cc (Symbol::override_base_with_special): Simply override
1814         version with special symbol version, ignoring previous version.
1815
1816 2011-07-05  Ian Lance Taylor  <iant@google.com>
1817
1818         * object.cc (Sized_relobj_file::include_section_group): Add
1819         information to comment about signature location.
1820
1821 2011-07-02  Ian Lance Taylor  <iant@google.com>
1822
1823         PR gold/12957
1824         * options.h (class General_options): Add -f and -F.
1825         * options.cc (General_options::finalize): Fatal error if -f/-F
1826         are used without -shared.
1827         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1828
1829 2011-07-02  Ian Lance Taylor  <iant@google.com>
1830
1831         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1832
1833 2011-07-01  Ian Lance Taylor  <iant@google.com>
1834
1835         PR gold/12525
1836         PR gold/12952
1837         * resolve.cc (Symbol::override_base_with_special): Don't override
1838         the version if the overriding symbol has a different name.
1839         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1840         all callers.  If we give an error about an undefined version,
1841         define the base version if necessary.
1842         * dynobj.h (class Versions): Update declaration.
1843         * testsuite/weak_alias_test_5.cc: New file.
1844         * testsuite/weak_alias_test.script: New file.
1845         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1846         and versioned_alias have the right value, and call t2.
1847         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1848         weak_alias_test_5.so.
1849         (weak_alias_test_LDADD): Likewise.
1850         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1851         * testsuite/Makefile.in: Rebuild.
1852
1853 2011-07-01  Ian Lance Taylor  <iant@google.com>
1854
1855         PR gold/12525
1856         * options.h (class General_options): Support -z notext.
1857         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1858         -Wl,-z,notext.
1859         (two_file_shared_nonpic.so): Likewise.
1860         (two_file_shared_mixed.so): Likewise.
1861         (two_file_shared_mixed_1.so): Likewise.
1862         (weak_undef_lib_nonpic.so): Likewise.
1863         (alt/weak_undef_lib_nonpic.so): Likewise.
1864         (tls_test_shared_nonpic.so): Likewise.
1865         * testsuite/Makefile.in: Rebuild.
1866
1867 2011-07-01  Ian Lance Taylor  <iant@google.com>
1868
1869         PR gold/12525
1870         * configure.ac: Test whether static linking works, setting
1871         the automake conditional HAVE_STATIC.
1872         * testsuite/Makefile.am: Disable tests using -static if
1873         HAVE_STATIC is not true.
1874         * configure, testsuite/Makefile.in: Rebuild.
1875
1876 2011-07-01  Ian Lance Taylor  <iant@google.com>
1877
1878         PR gold/12525
1879         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1880         Assert if we see DW_EH_PE_indirect.
1881         * target.h (Target::ehframe_datarel_base): New function.
1882         (Target::do_ehframe_datarel_base): New target function.
1883         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1884         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1885         function.
1886
1887 2011-07-01  Ian Lance Taylor  <iant@google.com>
1888
1889         PR gold/12571
1890         * options.h (class General_options): Add
1891         --ld-generated-unwind-info.
1892         * ehframe.cc (Fde::write): Add address parameter.  Change all
1893         callers.  If associated with PLT, fill in address and size.
1894         (Cie::set_output_offset): Only add merge mapping if there is an
1895         object.
1896         (Cie::write): Add address parameter.  Change all callers.
1897         (Eh_frame::add_ehframe_for_plt): New function.
1898         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1899         input_offset_ fields into union u_, with new plt field.
1900         (Fde::Fde): Adjust for new union field.
1901         (Fde::Fde) [Output_data version]: New constructor.
1902         (Fde::add_mapping): Only add merge mapping if there is an object.
1903         (class Cie): Update declarations.
1904         (class Eh_frame): Declare add_ehframe_for_plt.
1905         * layout.cc (Layout::layout_eh_frame): Break out code into
1906         make_eh_frame_section, and call it.
1907         (Layout::make_eh_frame_section): New function.
1908         (Layout::add_eh_frame_for_plt): New function.
1909         * layout.h (class Layout): Update declarations.
1910         * merge.cc (Merge_map::add_mapping): Add assertion.
1911         * i386.cc: Include "dwarf.h".
1912         (class Output_data_plt_i386): Make first_plt_entry,
1913         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1914         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1915         and plt_eh_frame_fde.
1916         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1917         boundary.  Call add_eh_frame_for_plt if appropriate.
1918         * x86_64.cc: Include "dwarf.h".
1919         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1920         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1921         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1922         and plt_eh_frame_fde.
1923         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1924         appropriate.
1925
1926 2011-06-29  Ian Lance Taylor  <iant@google.com>
1927
1928         PR gold/12629
1929         * object.cc (Sized_relobj_file::layout_section): Change shdr
1930         parameter to be const.
1931         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1932         out of do_layout.
1933         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1934         appropriate.  Call layout_eh_frame_section.
1935         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1936         sections.
1937         * object.h (class Sized_relobj_file): Update declarations.
1938
1939 2011-06-29  Ian Lance Taylor  <iant@google.com>
1940
1941         PR gold/12652
1942         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1943         modifier.
1944         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1945
1946 2011-06-29  Ian Lance Taylor  <iant@google.com>
1947
1948         PR gold/12675
1949         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1950         SHT_X86_64_UNWIND.
1951         * layout.cc (Layout::layout_eh_frame): Likewise.
1952
1953 2011-06-29  Ian Lance Taylor  <iant@google.com>
1954
1955         PR gold/12695
1956         * layout.cc (Layout::symtab_section_shndx): New function.
1957         * layout.h (class Layout): Declare symtab_section_shndx.
1958         * output.cc (Output_section::write_header): Call it.
1959
1960 2011-06-29  Ian Lance Taylor  <iant@google.com>
1961
1962         PR gold/12818
1963         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1964         symbols which are not used in a relocation.
1965
1966 2011-06-28  Ian Lance Taylor  <iant@google.com>
1967
1968         PR gold/12898
1969         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1970         script create indistinguishable segments.
1971         (Layout::set_segment_offsets): Use stable_sort when sorting
1972         segments.  Pass this to Compare_segments constructor.
1973         * layout.h (class Layout): Make segment_precedes non-static.
1974         (class Compare_segments): Change from struct to class.  Add
1975         layout_ field.  Add constructor.
1976         * script-sections.cc
1977         (Script_sections::attach_sections_using_phdrs_clause): Rename
1978         local orphan to is_orphan.  Don't report failure to put empty
1979         section in segment.  On attachment failure, report name of
1980         section, and attach to first PT_LOAD segment.
1981
1982 2011-06-28  Ian Lance Taylor  <iant@google.com>
1983
1984         PR gold/12934
1985         * target-select.cc (Target_selector::Target_selector): Add
1986         emulation parameter.  Change all callers.
1987         (select_target_by_bfd_name): Rename from select_target_by_name.
1988         Change all callers.
1989         (select_target_by_emulation): New function.
1990         (supported_emulation_names): New function.
1991         * target-select.h (class Target_selector): Add emulation_ field.
1992         Update declarations.
1993         (Target_selector::recognize_by_bfd_name): Rename from
1994         recognize_by_name.  Change all callers.
1995         (Target_selector::supported_bfd_names): Rename from
1996         supported_names.  Change all callers.
1997         (Target_selector::recognize_by_emulation): New function.
1998         (Target_selector::supported_emulations): New function.
1999         (Target_selector::emulation): New function.
2000         (Target_selector::do_recognize_by_bfd_name): Rename from
2001         do_recognize_by_name.  Change all callers.
2002         (Target_selector::do_supported_bfd_names): Rename from
2003         do_supported_names.  Change all callers.
2004         (Target_selector::do_recognize_by_emulation): New function.
2005         (Target_selector::do_supported_emulations): New function.
2006         (select_target_by_bfd_name): Change name in declaration.
2007         (select_target_by_emulation): Declare.
2008         (supported_emulation_names): Declare.
2009         * parameters.cc (parameters_force_valid_target): Try to find
2010         target based on emulation from -m option.
2011         * options.h (class General_options): Change doc string for -m.
2012         * options.cc (help): Print emulations.
2013         (General_options::parse_V): Likewise.
2014         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2015         Add emulation parameter.  Change all callers.
2016
2017 2011-06-28  Ian Lance Taylor  <iant@google.com>
2018
2019         * target.h (class Target): Add osabi_ field.
2020         (Target::osabi): New function.
2021         (Target::set_osabi): New function.
2022         (Target::Target): Initialize osabi_.
2023         (Target::do_adjust_elf_header): Make pure virtual.
2024         (Sized_target::do_adjust_elf_header): Declare.
2025         * target.cc (Sized_target::do_adjust_elf_header): New function.
2026         (class Sized_target): Instantiate all versions.
2027         * freebsd.h (class Target_freebsd): Remove.
2028         (Target_selector_freebsd::do_recognize): Call set_osabi on
2029         Target.
2030         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2031         (Target_selector_freebsd::set_osabi): Remove.
2032         * i386.cc (class Target_i386): Inherit from Sized_target rather
2033         than Target_freebsd.
2034         * x86_64.cc (class Target_x86_64): Likewise.
2035
2036 2011-06-28  Ian Lance Taylor  <iant@google.com>
2037
2038         * target.h (Target::can_check_for_function_pointers): Rewrite.
2039         Make non-virtual.
2040         (Target::can_icf_inline_merge_sections): Likewise.
2041         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2042         (Target::Target_info): Add can_icf_inline_merge_sections field.
2043         (Target::do_can_check_for_function_pointers): New virtual
2044         function.
2045         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2046         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2047         from can_check_for_function_pointers, move in file.
2048         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2049         section_may_have_icf_unsafe_poineters, move in file.
2050         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2051         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2052         Rename from can_check_for_function_pointers, move in file.
2053         (Target_i386::can_icf_inline_merge_sections): Remove.
2054         (Target_i386::i386_info): Initialize
2055         can_icf_inline_merge_sections.
2056         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2057         Initialize can_icf_inline_merge_sections.
2058         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2059         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2060         Rename from can_check_for_function_pointers, move in file.
2061         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2062         (Target_x86_64::x86_64_info): Initialize
2063         can_icf_inline_merge_sections.
2064         * testsuite/testfile.cc (Target_test::test_target_info):
2065         Likewise.
2066         * icf.cc (get_section_contents): Correct formatting.
2067
2068 2011-06-27  Ian Lance Taylor  <iant@google.com>
2069
2070         * symtab.cc (Symbol::versioned_name): New function.
2071         (Symbol_table::add_to_final_symtab): Use versioned_name when
2072         appropriate.
2073         (Symbol_table::sized_write_symbol): Likewise.
2074         * symtab.h (class Symbol): Declare versioned_name.
2075         * stringpool.h (class Stringpool_template): Add variant of add
2076         which takes a std::basic_string.
2077         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2078         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2079         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2080         (ver_test_12.o): New target.
2081         * testsuite/Makefile.in: Rebuild.
2082
2083 2011-06-27  Doug Kwan  <dougkwan@google.com>
2084
2085         * arm.cc (Arm_relocate_functions::thm_jump8,
2086         Arm_relocate_functions::thm_jump11): Use a wider signed
2087         type to compute offset.
2088         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2089         arm_thm_jump8.
2090         * testsuite/Makefile.in: Regenerate.
2091         * testsuite/arm_branch_in_range.sh: Check test results of
2092         arm_thm_jump11 and arm_thm_jump8.
2093         * testsuite/arm_thm_jump11.s: New test source file.
2094         * testsuite/arm_thm_jump11.t: New linker script.
2095         * testsuite/arm_thm_jump8.s: New test source file.
2096         * testsuite/arm_thm_jump8.t: New linker script.
2097
2098 2011-06-24  Ian Lance Taylor  <iant@google.com>
2099
2100         * layout.cc: Include "object.h".
2101         (ctors_sections_in_init_array): New static variable.
2102         (Layout::is_ctors_in_init_array): New function.
2103         (Layout::layout): Add entry to ctors_sections_in_init_array if
2104         appropriate.
2105         * layout.h (class Layout): Declare is_ctors_in_init_array.
2106         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2107         is_ctors_reverse_view is set.
2108         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2109         all callers.  Set is_ctors_reverse_view field of View_size.
2110         (Sized_relobj_file::reverse_words): New function.
2111         * object.h (Sized_relobj_file::View_size): Add
2112         is_ctors_reverse_view field.
2113         (class Sized_relobj_file): Update declarations.
2114         * testsuite/initpri3.c: New test.
2115         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2116         initpri3b.
2117         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2118         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2119         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2120         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2121         * testsuite/Makefile.in: Rebuild.
2122
2123 2011-06-24  Cary Coutant  <ccoutant@google.com>
2124
2125         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2126         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2127         (debug_msg_cdebug.err): New targets.
2128         * testsuite/Makefile.in: Regenerate.
2129         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2130         Fix checks for link with shared library.
2131
2132 2011-06-24  Doug Kwan  <dougkwan@google.com>
2133
2134         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2135         skip empty text sections.
2136         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2137
2138 2011-06-22  Ian Lance Taylor  <iant@google.com>
2139
2140         PR gold/12910
2141         * options.h (class General_options): Add --ctors-in-init-array.
2142         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2143         friends as SHT_PROGBITS for merging sections.
2144         (Layout::layout): Remove special handling of .init_array and
2145         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2146         and .dtors if ctors_in_init_array.
2147         (Layout::make_output_section): Force correct section types for
2148         .init_array and friends.  Don't sort if doing relocatable link,
2149         Don't sort .ctors and .dtors if ctors_in_init_array.
2150         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2151         (Layout::output_section_name): Add relobj parameter.  Change all
2152         callers.  Handle .ctors. and .dtors. in code rather than table.
2153         Handle .ctors and .dtors if ctors_in_init_array.
2154         (Layout::match_file_name): New function, moved from output.cc.
2155         * layout.h (class Layout): Update declarations.
2156         * output.cc: Include "layout.h".
2157         (Input_section_sort_entry::get_priority): New function.
2158         (Input_section_sort_entry::match_file_name): Just call
2159         Layout::match_file_name.
2160         (Output_section::Input_section_sort_init_fini_compare::operator()):
2161         Handle .ctors and .dtors.  Sort by explicit priority rather than
2162         by name.
2163         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2164         * testsuite/initpri2.c: New test.
2165         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2166         (check_PROGRAMS): Add initpri2.
2167         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2168         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2169         * configure, testsuite/Makefile.in: Rebuild.
2170
2171 2011-06-19  Ian Lance Taylor  <iant@google.com>
2172
2173         PR gold/12880
2174         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2175         .interp section to a PT_INTERP segment even if we have seen a
2176         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2177         clause in a linker script.
2178         (Layout::finalize): Don't create a .interp section if we've
2179         already create a PT_INTERP segment.
2180         (Layout::create_interp): Always call choose_output_section (revert
2181         patch of 2011-06-17).  Don't create PT_INTERP segment.
2182         * script-sections.cc
2183         (Script_sections::create_note_and_tls_segments): Add a .interp
2184         section to a PT_INTERP segment even if we have seen a
2185         --dynamic-linker option.
2186
2187 2011-06-18  Ian Lance Taylor  <iant@google.com>
2188
2189         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2190         merely because a non-PT_LOAD segment has a dynamic reloc.
2191
2192 2011-06-18  Ian Lance Taylor  <iant@google.com>
2193
2194         * layout.cc (Layout::finish_dynamic_section): Don't create
2195         DT_FLAGS entry if not needed.
2196
2197 2011-06-18  Ian Lance Taylor  <iant@google.com>
2198
2199         PR gold/12745
2200         * layout.cc (Layout::layout_eh_frame): Correct handling of
2201         writable .eh_frame section.
2202
2203 2011-06-17  Ian Lance Taylor  <iant@google.com>
2204
2205         PR gold/12893
2206         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2207         symbol is redefined with the exact same object and value.
2208
2209 2011-06-17  Ian Lance Taylor  <iant@google.com>
2210
2211         PR gold/12880
2212         * layout.h (class Layout): Add interp_segment_ field.
2213         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2214         (Layout::attach_allocated_section_to_segment): If making shared
2215         library, put .interp section in PT_INTERP segment.
2216         (Layout::finalize): Also call create_interp if -dynamic-linker
2217         option was used.
2218         (Layout::create_interp): Assert that there is no PT_INTERP
2219         segment.  If not using a SECTIONS clause, use make_output_section.
2220         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2221         * script-sections.cc
2222         (Script_sections::create_note_and_tls_segments): If making shared
2223         library, put .interp section in PT_INTERP segment.
2224
2225 2011-06-17  Ian Lance Taylor  <iant@google.com>
2226
2227         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2228         when making a shared library.
2229
2230 2011-06-17  Ian Lance Taylor  <iant@google.com>
2231
2232         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2233         parameter.  Change all callers.  Don't issue warning about PC32
2234         against locally defined symbol.
2235
2236 2011-06-16  Ian Lance Taylor  <iant@google.com>
2237
2238         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2239         occurs in same object.
2240
2241 2011-06-14  Alan Modra  <amodra@gmail.com>
2242
2243         * po/POTFILES.in: Regenerate.
2244
2245 2011-06-09  Ian Lance Taylor  <iant@google.com>
2246
2247         * script-sections.cc
2248         (Orphan_output_section::set_section_addresses): For a relocatable
2249         link set address to 0.
2250
2251 2011-06-09  Cary Coutant  <ccoutant@google.com>
2252
2253         PR gold/12804
2254         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2255         used with --compress-debug-sections.
2256         * gold/object.cc (Sized_relobj_file::do_layout): Report
2257         uncompressed size of compressed input sections.
2258
2259 2011-06-08  Cary Coutant  <ccoutant@google.com>
2260
2261         PR gold/12804
2262         * testsuite/two_file_test_2_v1.cc: Change initialization of
2263         v2 to keep it in .data.
2264
2265 2011-06-07  Cary Coutant  <ccoutant@google.com>
2266
2267         * common.cc (Symbol_table::do_allocate_commons_list): Call
2268         gold_fallback.
2269         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2270         (Errors::fallback): New function.
2271         (gold_fallback): New function.
2272         * errors.h (Errors::fallback): New function.
2273         * gold.cc (gold_exit): Change status parameter to enum; adjust
2274         all callers.
2275         (queue_initial_tasks): Call gold_fallback.
2276         * gold.h: Include cstdlib.
2277         (Exit_status): New enum type.
2278         (gold_exit): Change status parameter to enum.
2279         (gold_fallback): New function.
2280         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2281         (Layout::create_symtab_sections): Likewise.
2282         (Layout::create_shdrs): Likewise.
2283         * main.cc (main): Adjust call to gold_exit.
2284         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2285         (Output_data_got::add_got_entry_pair): Likewise.
2286         (Output_section::add_input_section): Likewise.
2287         (Output_section::add_output_section_data): Likewise.
2288         (Output_segment::set_section_list_addresses): Likewise.
2289         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2290
2291 2011-06-07  Cary Coutant  <ccoutant@google.com>
2292
2293         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2294         for incremental links.
2295         * output.cc (Output_segment::set_section_list_addresses): Remove
2296         FIXME and test for TLS or BSS.
2297
2298 2011-06-07  Cary Coutant  <ccoutant@google.com>
2299
2300         * testsuite/Makefile.am: Add incremental_copy_test,
2301         incremental_common_test_1.
2302         * testsuite/Makefile.in: Regenerate.
2303         * testsuite/common_test_1_v1.c: New source file.
2304         * testsuite/common_test_1_v2.c: New source file.
2305         * testsuite/copy_test_v1.cc: New source file.
2306
2307 2011-06-07  Cary Coutant  <ccoutant@google.com>
2308
2309         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2310         update, allocate common from bss section's free list.
2311         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2312         linker-defined symbols.
2313         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2314         Skip GOT and PLT entries that are no longer referenced.
2315         (Output_section_incremental_inputs::write_info_blocks): Mark
2316         linker-defined symbols.
2317         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2318         * output.cc (Output_section::allocate): New function.
2319         * output.h (Output_section::allocate): New function.
2320         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2321         linker-defined symbols.
2322         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2323         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2324         (Symbol::init_base_output_data): Likewise.
2325         (Symbol::init_base_output_segment): Likewise.
2326         (Symbol::init_base_constant): Likewise.
2327         (Sized_symbol::init_output_data): Likewise.
2328         (Sized_symbol::init_output_segment): Likewise.
2329         (Sized_symbol::init_constant): Likewise.
2330         (Symbol_table::do_define_in_output_data): Likewise.
2331         (Symbol_table::do_define_in_output_segment): Likewise.
2332         (Symbol_table::do_define_as_constant): Likewise.
2333         * symtab.h (Symbol::is_predefined): New function.
2334         (Symbol::init_base_output_data): Add is_predefined parameter.
2335         (Symbol::init_base_output_segment): Likewise.
2336         (Symbol::init_base_constant): Likewise.
2337         (Symbol::is_predefined_): New data member.
2338         (Sized_symbol::init_output_data): Add is_predefined parameter.
2339         (Sized_symbol::init_output_segment): Likewise.
2340         (Sized_symbol::init_constant): Likewise.
2341         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2342
2343 2011-06-07  Cary Coutant  <ccoutant@google.com>
2344
2345         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2346         instead of emit_copy_reloc.
2347         (Copy_relocs::emit_copy_reloc): Refactor.
2348         (Copy_relocs::make_copy_reloc): New function.
2349         (Copy_relocs::add_copy_reloc): Remove.
2350         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2351         section.
2352         (Copy_relocs::make_copy_reloc): New function.
2353         (Copy_relocs::add_copy_reloc): Remove.
2354         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2355         unchanged input files.
2356         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2357         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2358         Reserve BSS space for COPY relocations.
2359         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2360         (Output_section_incremental_inputs::write_info_blocks): Record
2361         whether a symbol is copied from a shared object.
2362         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2363         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2364         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2365         (Incremental_input_entry_reader::get_output_symbol_index): Add
2366         is_copy parameter.
2367         (Incremental_binary::emit_copy_relocs): New function.
2368         (Incremental_binary::do_emit_copy_relocs): New function.
2369         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2370         new data member.
2371         (Sized_incremental_binary::add_copy_reloc): New function.
2372         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2373         (Sized_incremental_binary::Copy_reloc): New struct.
2374         (Sized_incremental_binary::Copy_relocs): New typedef.
2375         (Sized_incremental_binary::copy_relocs_): New data member.
2376         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2377         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2378         * target.h (Sized_target::emit_copy_reloc): New function.
2379         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2380
2381 2011-06-02  Cary Coutant  <ccoutant@google.com>
2382
2383         PR gold/12163
2384         * gold/archive.cc (Archive::Archive): Initialize new data member.
2385         (Archive::include_all_members): Return if archive has already been
2386         included.
2387         * gold/archive.h (Archive::include_all_members_): New data member.
2388
2389 2011-06-02  Nick Clifton  <nickc@redhat.com>
2390
2391         * dynobj.h: Fix spelling mistake in comment.
2392         * output.cc: Likewise.
2393
2394 2011-05-31  Doug Kwan  <dougkwan@google.com>
2395             Asier Llano
2396
2397         PR gold/12826
2398         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2399         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2400         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2401         redundant arm_exidx_test.so.
2402         * testsuite/Makefile.in: Regenerate.
2403         (check_SCRIPTS): Add pr12826.sh
2404         (check_DATA): Add pr12826.stdout
2405         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2406         * testsuite/pr12826.sh: New file.
2407         * testsuite/pr12826_1.s: Ditto.
2408         * testsuite/pr12826_1.s: Ditto.
2409
2410 2011-05-30  Ian Lance Taylor  <iant@google.com>
2411
2412         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2413         sections.
2414
2415 2011-05-29  Ian Lance Taylor  <iant@google.com>
2416
2417         PR gold/12804
2418         * testsuite/Makefile.am: Use different file name for two_file_test
2419         temporary file for each incremental test.
2420         * testsuite/Makefile.in: Rebuild.
2421
2422 2011-05-29  Ian Lance Taylor  <iant@google.com>
2423
2424         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2425         binary input file is empty.
2426
2427 2011-05-27  Ian Lance Taylor  <iant@google.com>
2428
2429         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2430         (ver_test_9.so): Likewise.
2431         * testsuite/Makefile.in: Rebuild.
2432
2433 2011-05-26 Cary Coutant  <ccoutant@google.com>
2434
2435         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2436         * incremental.cc (Incremental_inputs::report_input_section): Fix
2437         comment, indentation.
2438         (Incremental_inputs::report_comdat_group): New function.
2439         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2440         of data for incremental input file entry.
2441         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2442         group count, COMDAT group signatures.
2443         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2444         an unchanged input file.
2445         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2446         Initialize new data member.
2447         (Incremental_object_entry::add_comdat_group): New function.
2448         (Incremental_object_entry::get_comdat_group_count): New function.
2449         (Incremental_object_entry::get_comdat_signature_key): New function.
2450         (Incremental_object_entry::groups_): New data member.
2451         (Incremental_inputs::report_comdat_group): New function.
2452         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2453         data for incremental input file entry.
2454         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2455         (Incremental_input_entry_reader::get_input_section): Adjust size of
2456         data for incremental input file entry.
2457         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2458         (Incremental_input_entry_reader::get_comdat_group_signature): New
2459         function.
2460         * object.cc (Sized_relobj::include_section_group): Report kept
2461         COMDAT groups for incremental links.
2462
2463 2011-05-24  David Meyer  <pdox@google.com>
2464
2465         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2466         with name parameter.  Add found_name parameter.
2467         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2468         * dirsearch.h (class Dirsearch): Update declaration.
2469
2470 2011-05-24  Ian Lance Taylor  <iant@google.com>
2471
2472         * archive.cc (Library_base::should_include_member): Pull in object
2473         from archive if it defines the entry symbol.
2474         * parameters.cc (Parameters::entry): New function.
2475         * parameters.h (class Parameters): Declare entry.
2476         * output.h (class Output_file_header): Remove entry_ field.
2477         * output.cc (Output_file_header::Output_file_header): Remove entry
2478         parameter.  Change all callers.
2479         (Output_file_header::entry): Use parameters->entry.
2480         * gold.cc (queue_middle_tasks): Likewise.
2481         * plugin.cc (Plugin_hook::run): Likewise.
2482
2483 2011-05-24 Cary Coutant  <ccoutant@google.com>
2484
2485         * gold.cc (queue_initial_tasks): Pass incremental base filename
2486         to Output_file::open_base_file; don't print error message.
2487         * incremental-dump.cc (main): Adjust call to
2488         Output_file::open_for_modification.
2489         * incremental-dump.cc (main): Likewise.
2490         * incremental.cc (Incremental_inputs::report_command_line):
2491         Ignore --incremental-base option when comparing command lines.
2492         Ignore parameter when given as separate argument.
2493         * options.h (class General_options): Add --incremental-base.
2494         * output.cc (Output_file::Output_file):
2495         (Output_file::open_base_file): Add base_name and writable parameters;
2496         read base file into new file; print error message here.
2497         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2498         callers.
2499         * output.h (Output_file::open_for_modification): Rename to...
2500         (Output_file::open_base_file): ...this; add base_name and
2501         writable parameters; adjust all callers.
2502         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2503         callers.
2504         * testsuite/Makefile.am (incremental_test_4): Test
2505         --incremental-base.
2506         * testsuite/Makefile.in: Regenerate.
2507
2508 2011-05-24 Cary Coutant  <ccoutant@google.com>
2509
2510         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2511         incremental_test_4.
2512         * testsuite/Makefile.in: Regenerate.
2513         * testsuite/two_file_test_1_v1.cc: New test source file.
2514         * testsuite/two_file_test_1b_v1.cc: New test source file.
2515         * testsuite/two_file_test_2_v1.cc: New test source file.
2516
2517 2011-05-24 Cary Coutant  <ccoutant@google.com>
2518
2519         * dynobj.h (Dynobj::do_dynobj): New function.
2520         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2521         flag and soname for shared objects.
2522         * incremental.cc (Incremental_inputs::report_object): Make
2523         either Incremental_object_entry or Incremental_dynobj_entry; add
2524         soname to string table.
2525         (Incremental_inputs::report_input_section): Add assertion.
2526         (Output_section_incremental_inputs::set_final_data_size): Adjust
2527         type of input file entry for shared libraries; adjust size of
2528         shared library info entry.
2529         (Output_section_incremental_inputs::write_input_files): Write
2530         as_needed flag for shared libraries.
2531         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2532         of input file entry for shared libraries; write soname.
2533         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2534         soname from incremental info.
2535         * incremental.h (enum Incremental_input_flags): Add
2536         INCREMENTAL_INPUT_AS_NEEDED.
2537         (Incremental_input_entry::Incremental_input_entry): Initialize new
2538         data member.
2539         (Incremental_input_entry::set_as_needed): New function.
2540         (Incremental_input_entry::as_needed): New function.
2541         (Incremental_input_entry::do_dynobj_entry): New function.
2542         (Incremental_input_entry::as_needed_): New data member.
2543         (Incremental_object_entry::Incremental_object_entry): Don't check
2544         for shared library.
2545         (Incremental_object_entry::do_type): Likewise.
2546         (class Incremental_dynobj_entry): New class.
2547         (Incremental_input_entry_reader::as_needed): New function.
2548         (Incremental_input_entry_reader::get_soname): New function.
2549         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2550         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2551         size of shared library info entry.
2552         * layout.cc (Layout::finish_dynamic_section): Don't test for
2553         incremental link when adding DT_NEEDED entries.
2554         * object.h (Object::Object): Initialize new data member.
2555         (Object::dynobj): New function.
2556         (Object::set_as_needed): New function.
2557         (Object::as_needed): New function.
2558         (Object::do_dynobj): New function.
2559         (Object::as_needed_): New data member.
2560
2561 2011-05-24 Cary Coutant  <ccoutant@google.com>
2562
2563         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2564         info; adjust display of GOT entries.
2565         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2566         vector of input objects; remove file_status_.
2567         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2568         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2569         got_plt reader; call target hooks to reserve GOT entries.
2570         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2571         of input file info header and GOT info entry.
2572         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2573         relocation info.
2574         (Got_plt_view_info::got_descriptor): Remove.
2575         (Got_plt_view_info::sym_index): New data member.
2576         (Got_plt_view_info::input_index): New data member.
2577         (Local_got_offset_visitor::visit): Write input file index.
2578         (Global_got_offset_visitor::visit): Write 0 for input file index.
2579         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2580         with sym_index and input_index.
2581         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2582         incremental info GOT entry; replace got_descriptor with input_index.
2583         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2584         map from input file index to object.
2585         (Sized_relobj_incr::do_layout): Replace direct data member reference
2586         with accessor function.
2587         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2588         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2589         Adjust size of input file info header.
2590         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2591         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2592         (Incremental_input_entry_reader::get_input_section): Adjust size of
2593         input file info header.
2594         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2595         of incremental info GOT entry.
2596         (Incremental_got_plt_reader::get_got_desc): Remove.
2597         (Incremental_got_plt_reader::get_got_symndx): New function.
2598         (Incremental_got_plt_reader::get_got_input_index): New function.
2599         (Sized_incremental_binary::Sized_incremental_binary): Remove
2600         file_status_; add input_objects_.
2601         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2602         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2603         (Sized_incremental_binary::file_is_unchanged): Remove.
2604         (Sized_incremental_binary::set_input_object): New function.
2605         (Sized_incremental_binary::input_object): New function.
2606         (Sized_incremental_binary::file_status_): Remove.
2607         (Sized_incremental_binary::input_objects_): New data member.
2608         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2609         references.
2610         (Sized_relobj_incr::invalid_address): Move to base class.
2611         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2612         class.
2613         (Sized_relobj_incr::do_output_section_offset): Likewise.
2614         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2615         (Sized_relobj_incr::section_offsets_): Likewise.
2616         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2617         function.
2618         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2619         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2620         with accessor function.
2621         (Sized_relobj_file::do_layout): Likewise.
2622         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2623         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2624         (Sized_relobj_file::compute_final_local_value): Replace refs to
2625         section_offsets_ with accessor function.
2626         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2627         * object.h (Relobj::Relobj): Initialize new data members.
2628         (Relobj::add_dyn_reloc): New function.
2629         (Relobj::first_dyn_reloc): New function.
2630         (Relobj::dyn_reloc_count): New function.
2631         (Relobj::first_dyn_reloc_): New data member.
2632         (Relobj::dyn_reloc_count_): New data member.
2633         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2634         references.
2635         (Sized_relobj::Address): New typedef.
2636         (Sized_relobj::invalid_address): Move here from child class.
2637         (Sized_relobj::Sized_relobj): Initialize new data members.
2638         (Sized_relobj::sized_relobj): New function.
2639         (Sized_relobj::is_output_section_offset_invalid): Move here from
2640         child class.
2641         (Sized_relobj::get_output_section_offset): Likewise.
2642         (Sized_relobj::local_has_got_offset): Likewise.
2643         (Sized_relobj::local_got_offset): Likewise.
2644         (Sized_relobj::set_local_got_offset): Likewise.
2645         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2646         (Sized_relobj::clear_got_offsets): New function.
2647         (Sized_relobj::section_offsets): Move here from child class.
2648         (Sized_relobj::do_output_section_offset): Likewise.
2649         (Sized_relobj::do_set_section_offset): Likewise.
2650         (Sized_relobj::Local_got_offsets): Likewise.
2651         (Sized_relobj::local_got_offsets_): Likewise.
2652         (Sized_relobj::section_offsets_): Likewise.
2653         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2654         references.
2655         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2656         class.
2657         (Sized_relobj_file::sized_relobj): New function
2658         (Sized_relobj_file::local_has_got_offset): Move to base class.
2659         (Sized_relobj_file::local_got_offset): Likewise.
2660         (Sized_relobj_file::set_local_got_offset): Likewise.
2661         (Sized_relobj_file::get_output_section_offset): Likewise.
2662         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2663         (Sized_relobj_file::do_output_section_offset): Likewise.
2664         (Sized_relobj_file::do_set_section_offset): Likewise.
2665         (Sized_relobj_file::Local_got_offsets): Likewise.
2666         (Sized_relobj_file::local_got_offsets_): Likewise.
2667         (Sized_relobj_file::section_offsets_): Likewise.
2668         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2669         (all constructors).
2670         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2671         (Output_reloc::get_symbol_index): Likewise.
2672         (Output_reloc::local_section_offset): Likewise.
2673         (Output_reloc::get_address): Likewise.
2674         (Output_reloc::symbol_value): Likewise.
2675         (Output_data_got::reserve_slot): Move to class definition.
2676         (Output_data_got::reserve_local): New function.
2677         (Output_data_got::reserve_slot_for_global): Remove.
2678         (Output_data_got::reserve_global): New function.
2679         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2680         (all constructors, two instantiations).
2681         (Output_reloc::get_relobj): New function (two instantiations).
2682         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2683         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2684         (Output_data_reloc::add_global): Adjust type of relobj.
2685         (Output_data_reloc::add_global_relative): Likewise.
2686         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2687         (Output_data_reloc::add_local): Likewise.
2688         (Output_data_reloc::add_local_relative): Likewise.
2689         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2690         (Output_data_reloc::add_local_section): Likewise.
2691         (Output_data_reloc::add_output_section): Likewise.
2692         (Output_data_reloc::add_absolute): Likewise.
2693         (Output_data_reloc::add_target_specific): Likewise.
2694         (Output_data_got::reserve_slot): Move definition here.
2695         (Output_data_got::reserve_local): New function.
2696         (Output_data_got::reserve_global): New function.
2697         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2698         section_offsets_ with accessor function.
2699         (Sized_relobj_file::write_sections): Likewise.
2700         (Sized_relobj_file::do_relocate_sections): Likewise.
2701         * target.h (Sized_target::reserve_local_got_entry): New function.
2702         (Sized_target::reserve_global_got_entry): New function.
2703         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2704         (Target_x86_64::reserve_global_got_entry): New function.
2705         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2706
2707 2011-05-23 Cary Coutant  <ccoutant@google.com>
2708
2709         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2710         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2711         bit when checking got_type.
2712         * incremental.cc (Sized_incremental_binary::setup_readers):
2713         Store symbol table and string table locations; initialize bit vector
2714         of file status flags.
2715         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2716         unchanged files.
2717         (Sized_incremental_binary::do_process_got_plt): New function.
2718         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2719         (Output_section_incremental_inputs::set_final_data_size): Record
2720         file index for each input file.
2721         (Output_section_incremental_inputs::write_got_plt): Store file index
2722         instead of input entry offset for each GOT entry.
2723         * incremental.h
2724         (Incremental_input_entry::Incremental_input_entry): Initialize new
2725         data member.
2726         (Incremental_input_entry::set_offset): Store file index.
2727         (Incremental_input_entry::get_file_index): New function.
2728         (Incremental_input_entry::file_index_): New data member.
2729         (Incremental_binary::process_got_plt): New function.
2730         (Incremental_binary::do_process_got_plt): New function.
2731         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2732         data members.
2733         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2734         (Sized_incremental_binary::set_file_is_unchanged): New function.
2735         (Sized_incremental_binary::file_is_unchanged): New function.
2736         (Sized_incremental_binary::do_process_got_plt): New function.
2737         (Sized_incremental_binary::file_status_): New data member.
2738         (Sized_incremental_binary::main_symtab_loc_): New data member.
2739         (Sized_incremental_binary::main_strtab_loc_): New data member.
2740         * output.cc (Output_data_got::Got_entry::write): Add case
2741         RESERVED_CODE.
2742         (Output_data_got::add_global): Call add_got_entry.
2743         (Output_data_got::add_global_plt): Likewise.
2744         (Output_data_got::add_global_with_rel): Likewise.
2745         (Output_data_got::add_global_with_rela): Likewise.
2746         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2747         (Output_data_got::add_global_pair_with_rela): Likewise.
2748         (Output_data_got::add_local): Call add_got_entry.
2749         (Output_data_got::add_local_plt): Likewise.
2750         (Output_data_got::add_local_with_rel): Likewise.
2751         (Output_data_got::add_local_with_rela): Likewise.
2752         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2753         (Output_data_got::add_local_pair_with_rela): Likewise.
2754         (Output_data_got::reserve_slot): New function.
2755         (Output_data_got::reserve_slot_for_global): New function.
2756         (Output_data_got::add_got_entry): New function.
2757         (Output_data_got::add_got_entry_pair): New function.
2758         (Output_section::add_output_section_data): Edit FIXME.
2759         * output.h
2760         (Output_section_data_build::Output_section_data_build): New
2761         constructor with size parameter.
2762         (Output_data_space::Output_data_space): Likewise.
2763         (Output_data_got::Output_data_got): Initialize new data member; new
2764         constructor with size parameter.
2765         (Output_data_got::add_constant): Call add_got_entry.
2766         (Output_data_got::reserve_slot): New function.
2767         (Output_data_got::reserve_slot_for_global): New function.
2768         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2769         (Output_data_got::add_got_entry): New function.
2770         (Output_data_got::add_got_entry_pair): New function.
2771         (Output_data_got::free_list_): New data member.
2772         * target.h (Sized_target::init_got_plt_for_update): New function.
2773         (Sized_target::register_global_plt_entry): New function.
2774         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2775         Initialize new data member; call init; add constructor with PLT count.
2776         (Output_data_plt_x86_64::init): New function.
2777         (Output_data_plt_x86_64::add_relocation): New function.
2778         (Output_data_plt_x86_64::reserve_slot): New function.
2779         (Output_data_plt_x86_64::free_list_): New data member.
2780         (Target_x86_64::init_got_plt_for_update): New function.
2781         (Target_x86_64::register_global_plt_entry): New function.
2782         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2783         incremental updates.
2784         (Output_data_plt_x86_64::add_relocation): New function.
2785         * testsuite/object_unittest.cc (Object_test): Set default options.
2786
2787 2011-05-16  Ian Lance Taylor  <iant@google.com>
2788
2789         * options.h (class General_options): Make -i a synonym for -r.
2790
2791 2011-05-16  Ian Lance Taylor  <iant@google.com>
2792
2793         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2794
2795 2011-05-10 Cary Coutant  <ccoutant@google.com>
2796
2797         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2798         strip_all (-s).
2799
2800 2011-05-06  Ian Lance Taylor  <iant@google.com>
2801
2802         * layout.cc (Layout::layout): If the output section flags change,
2803         update the ordering.
2804
2805 2011-04-25 Cary Coutant  <ccoutant@google.com>
2806
2807         * incremental-dump.cc (dump_incremental_inputs): Print local
2808         symbol info for each input file.
2809         * incremental.cc
2810         (Output_section_incremental_inputs::set_final_data_size): Add local
2811         symbol info to input file entries in incremental info.
2812         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2813         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2814         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2815         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2816         implementation.
2817         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2818         (Sized_incr_relobj::do_relocate): Write the local symbols.
2819         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2820         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2821         Adjust size of input file header.
2822         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2823         (Incremental_inputs_reader::get_local_symbol_count): New function.
2824         (Incremental_inputs_reader::get_input_section): Adjust size of input
2825         file header.
2826         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2827         (Sized_incr_relobj::This): New typedef.
2828         (Sized_incr_relobj::sym_size): New const data member.
2829         (Sized_incr_relobj::Local_symbol): New struct.
2830         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2831         (Sized_incr_relobj::do_local_symbol_offset): New function.
2832         (Sized_incr_relobj::local_symbol_count_): New data member.
2833         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2834         (Sized_incr_relobj::local_symbol_index_): New data member.
2835         (Sized_incr_relobj::local_symbol_offset_): New data member.
2836         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2837         (Sized_incr_relobj::local_symbols_): New data member.
2838         * object.h (Relobj::output_local_symbol_count): New function.
2839         (Relobj::local_symbol_offset): New function.
2840         (Relobj::do_output_local_symbol_count): New function.
2841         (Relobj::do_local_symbol_offset): New function.
2842         (Sized_relobj::do_output_local_symbol_count): New function.
2843         (Sized_relobj::do_local_symbol_offset): New function.
2844
2845 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2846
2847         * descriptors.cc (set_close_on_exec): New function.
2848         (Descriptors::open): Use set_close_on_exec.
2849         * output.cc (S_ISLNK): Define if not defined.
2850
2851 2011-04-22 Cary Coutant  <ccoutant@google.com>
2852
2853         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2854         global symbol map.
2855         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2856         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2857         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2858         relocations.
2859         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2860         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2861         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2862         * incremental.h
2863         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2864         function.
2865         (Incremental_binary::apply_incremental_relocs): New function.
2866         (Incremental_binary::do_apply_incremental_relocs): New function.
2867         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2868         data member.
2869         (Sized_incremental_binary::add_global_symbol): New function.
2870         (Sized_incremental_binary::global_symbol): New function.
2871         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2872         (Sized_incremental_binary::symbol_map_): New data member.
2873         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2874         * target.h (Sized_target::apply_relocation): New function.
2875         * target-reloc.h (apply_relocation): New function.
2876         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2877
2878 2011-04-22  Doug Kwan  <dougkwan@google.com>
2879
2880         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2881         flag of a SHT_ARM_EXIDX section.
2882         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2883         * testsuite/Makefile.in: Regenerate.
2884         * testsuite/arm_exidx_test.s: New file.
2885         * testsuite/arm_exidx_test.sh: Same.
2886
2887 2011-04-20 Cary Coutant  <ccoutant@google.com>
2888
2889         PR gold/12689
2890         * archive.h (Incremental_archive_entry::Archive_member):
2891         Initialize arg_serial_ (second constructor).
2892
2893 2011-04-17  Ian Lance Taylor  <iant@google.com>
2894
2895         * object.cc (Relocate_info::location): Simplify location string.
2896         * errors.cc (Errors::error_at_location): Don't print program
2897         name.
2898         (Errors::warning_at_location): Likewise.
2899         (Errors::undefined_symbol): Likewise.
2900         * testsuite/debug_msg.sh: Update accordingly.
2901
2902 2011-04-14 Cary Coutant  <ccoutant@google.com>
2903
2904         * gold/layout.cc (Layout::symtab_section_offset): New function.
2905         * gold/layout.h (Layout::symtab_section_offset): New function.
2906         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2907
2908 2011-04-12  Ian Lance Taylor  <iant@google.com>
2909
2910         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2911         with MREMAP_MAYMOVE.
2912         * output.h (class Output_file): Add map_is_allocated_ field.
2913         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2914         not available, provide stubs.  If mremap is not available, #define
2915         it to gold_mremap.
2916         (MREMAP_MAYMOVE): Define if not defined.
2917         (Output_file::Output_file): Initialize map_is_allocated_.
2918         (Output_file::resize): Check map_is_allocated_.
2919         (Output_file::map_anonymous): If mmap fails, use malloc.
2920         (Output_file::unmap): Don't do anything for an anonymous map.
2921         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2922         is not available, provide stubs.
2923         (File_read::View::~View): Use free rather than delete[].
2924         (File_read::make_view): Use malloc rather than new[].  If mmap
2925         fails, use malloc.
2926         (File_read::find_or_make_view): Use malloc rather than new[].
2927         * gold.h: Remove HAVE_REMAP code.
2928         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2929         exists.  Rename mremap to gold_mremap.  If mmap is not available
2930         don't do anything.
2931         * configure, config.in: Rebuild.
2932
2933 2011-04-11  Ian Lance Taylor  <iant@google.com>
2934
2935         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2936         initialize local variable v.
2937
2938 2011-04-11  Cary Coutant  <ccoutant@google.com>
2939
2940         * archive.cc (Archive::include_member): Adjust call to
2941         report_object.
2942         (Add_archive_symbols::run): Track argument serial numbers.
2943         (Lib_group::include_member): Likewise.
2944         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2945         * archive.h (Incremental_archive_entry::Archive_member):
2946         Initialize arg_serial_.
2947         (Archive_member::arg_serial_): New data member.
2948         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2949         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2950         incremental link.
2951         (Sized_dynobj::do_for_all_local_got_entries): New function.
2952         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2953         function.
2954         * fileread.cc (get_mtime): New function.
2955         * fileread.h (get_mtime): New function.
2956         * gold.cc (queue_initial_tasks): Check for incremental update.
2957         (process_incremental_input): New function.
2958         (queue_middle_tasks): Don't force valid target for incremental
2959         update.
2960         * incremental-dump.cc (find_input_containing_global): Adjust
2961         size of symbol info entry.
2962         (dump_incremental_inputs): Dump argument serial number and
2963         in_system_directory flag; bias shndx by 1; print symbol names
2964         when dumping per-file symbol lists; use new symbol info readers.
2965         * incremental.cc
2966         (Output_section_incremental_inputs:update_data_size): New function.
2967         (Sized_incremental_binary::setup_readers): Setup input readers
2968         for each input file; build maps for files added from libraries
2969         and scripts.
2970         (Sized_incremental_binary::check_input_args): New function.
2971         (Sized_incremental_binary::do_check_inputs): Build map of argument
2972         serial numbers to input arguments.
2973         (Sized_incremental_binary::do_file_has_changed): Rename
2974         do_file_is_unchanged to this; compare file modification times.
2975         (Sized_incremental_binary::do_init_layout): New function.
2976         (Sized_incremental_binary::do_reserve_layout): New function.
2977         (Sized_incremental_binary::do_get_input_reader): Remove.
2978         (Sized_incremental_binary::get_symtab_view): New function.
2979         (Incremental_checker::can_incrementally_link_output_file): Remove.
2980         (Incremental_inputs::report_command_line): Exclude --debug options.
2981         (Incremental_inputs::report_archive_begin): Add parameter; track
2982         argument serial numbers; don't put input file entry for archive
2983         before archive members.
2984         (Incremental_inputs::report_archive_end): Put input file entry
2985         for archive after archive members.
2986         (Incremental_inputs::report_object): Add parameter; track argument
2987         serial numbers and in_system_directory flag.
2988         (Incremental_inputs::report_script): Add parameter; track argument
2989         serial numbers.
2990         (Output_section_incremental_inputs::set_final_data_size): Adjust
2991         size of symbol info entry; check for forwarding symbols.
2992         (Output_section_incremental_inputs::write_input_files): Write
2993         in_system_directory flag and argument serial number.
2994         (Output_section_incremental_inputs::write_info_blocks): Map section
2995         indices between incremental info and original input file; store
2996         input section index for each symbol.
2997         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2998         change operator() to visit().
2999         (class Global_got_offset_visitor): Likewise.
3000         (class Global_symbol_visitor_got_plt):
3001         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3002         classes.
3003         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3004         (Sized_incr_relobj::do_read_symbols): New function.
3005         (Sized_incr_relobj::do_layout): New function.
3006         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3007         (Sized_incr_relobj::do_add_symbols): New function.
3008         (Sized_incr_relobj::do_should_include_member): New function.
3009         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3010         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3011         (Sized_incr_relobj::do_section_size): New function.
3012         (Sized_incr_relobj::do_section_name): New function.
3013         (Sized_incr_relobj::do_section_contents): New function.
3014         (Sized_incr_relobj::do_section_flags): New function.
3015         (Sized_incr_relobj::do_section_entsize): New function.
3016         (Sized_incr_relobj::do_section_address): New function.
3017         (Sized_incr_relobj::do_section_type): New function.
3018         (Sized_incr_relobj::do_section_link): New function.
3019         (Sized_incr_relobj::do_section_info): New function.
3020         (Sized_incr_relobj::do_section_addralign): New function.
3021         (Sized_incr_relobj::do_initialize_xindex): New function.
3022         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3023         (Sized_incr_relobj::do_read_relocs): New function.
3024         (Sized_incr_relobj::do_gc_process_relocs): New function.
3025         (Sized_incr_relobj::do_scan_relocs): New function.
3026         (Sized_incr_relobj::do_count_local_symbols): New function.
3027         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3028         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3029         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3030         (Sized_incr_relobj::do_relocate): New function.
3031         (Sized_incr_relobj::do_set_section_offset): New function.
3032         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3033         (Sized_incr_dynobj::do_read_symbols): New function.
3034         (Sized_incr_dynobj::do_layout): New function.
3035         (Sized_incr_dynobj::do_add_symbols): New function.
3036         (Sized_incr_dynobj::do_should_include_member): New function.
3037         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3038         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3039         (Sized_incr_dynobj::do_section_size): New function.
3040         (Sized_incr_dynobj::do_section_name): New function.
3041         (Sized_incr_dynobj::do_section_contents): New function.
3042         (Sized_incr_dynobj::do_section_flags): New function.
3043         (Sized_incr_dynobj::do_section_entsize): New function.
3044         (Sized_incr_dynobj::do_section_address): New function.
3045         (Sized_incr_dynobj::do_section_type): New function.
3046         (Sized_incr_dynobj::do_section_link): New function.
3047         (Sized_incr_dynobj::do_section_info): New function.
3048         (Sized_incr_dynobj::do_section_addralign): New function.
3049         (Sized_incr_dynobj::do_initialize_xindex): New function.
3050         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3051         (make_sized_incremental_object): New function.
3052         (Incremental_library::copy_unused_symbols): New function.
3053         (Incremental_library::do_for_all_unused_symbols): New function.
3054         * incremental.h (enum Incremental_input_flags): New type.
3055         (class Incremental_checker): Remove.
3056         (Incremental_input_entry::Incremental_input_entry): Add argument
3057         serial number.
3058         (Incremental_input_entry::arg_serial): New function.
3059         (Incremental_input_entry::set_is_in_system_directory): New function.
3060         (Incremental_input_entry::is_in_system_directory): New function.
3061         (Incremental_input_entry::arg_serial_): New data member.
3062         (Incremental_input_entry::is_in_system_directory_): New data member.
3063         (class Script_info): Move here from script.h.
3064         (Script_info::Script_info): Add filename parameter.
3065         (Script_info::filename): New function.
3066         (Script_info::filename_): New data member.
3067         (Incremental_script_entry::Incremental_script_entry): Add argument
3068         serial number.
3069         (Incremental_object_entry::Incremental_object_entry): Likewise.
3070         (Incremental_object_entry::add_input_section): Build list of input
3071         sections with map to original shndx.
3072         (Incremental_object_entry::get_input_section_index): New function.
3073         (Incremental_object_entry::shndx_): New data member.
3074         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3075         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3076         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3077         serial number.
3078         (Incremental_inputs::report_archive_begin): Likewise.
3079         (Incremental_inputs::report_object): Likewise.
3080         (Incremental_inputs::report_script): Likewise.
3081         (class Incremental_global_symbol_reader): New class.
3082         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3083         and store flags and input file type.
3084         (Incremental_input_entry_reader::arg_serial): New function.
3085         (Incremental_input_entry_reader::type): Extract type from flags.
3086         (Incremental_input_entry_reader::is_in_system_directory): New function.
3087         (Incremental_input_entry_reader::get_input_section_count): Call
3088         accessor function for type.
3089         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3090         function for type; adjust size of global symbol entry.
3091         (Incremental_input_entry_reader::get_global_symbol_count): Call
3092         accessor function for type.
3093         (Incremental_input_entry_reader::get_object_count): Likewise.
3094         (Incremental_input_entry_reader::get_object_offset): Likewise.
3095         (Incremental_input_entry_reader::get_member_count): Likewise.
3096         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3097         (Incremental_input_entry_reader::get_member_offset): Likewise.
3098         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3099         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3100         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3101         (Incremental_input_entry_reader::get_global_symbol_reader): New
3102         function.
3103         (Incremental_input_entry_reader::get_output_symbol_index): New
3104         function.
3105         (Incremental_input_entry_reader::type_): Remove.
3106         (Incremental_input_entry_reader::flags_): New data member.
3107         (Incremental_inputs_reader::input_file_offset): New function.
3108         (Incremental_inputs_reader::input_file_index): New function.
3109         (Incremental_inputs_reader::input_file): Call input_file_offset.
3110         (Incremental_inputs_reader::input_file_at_offset): New function.
3111         (Incremental_relocs_reader::get_r_type): Reformat.
3112         (Incremental_relocs_reader::get_r_shndx): Reformat.
3113         (Incremental_relocs_reader::get_r_offset): Reformat.
3114         (Incremental_relocs_reader::data): New function.
3115         (Incremental_binary::Incremental_binary): Initialize new data members.
3116         (Incremental_binary::check_inputs): Add cmdline parameter.
3117         (Incremental_binary::file_is_unchanged): Remove.
3118         (Input_reader::arg_serial): New function.
3119         (Input_reader::get_unused_symbol_count): New function.
3120         (Input_reader::get_unused_symbol): New function.
3121         (Input_reader::do_arg_serial): New function.
3122         (Input_reader::do_get_unused_symbol_count): New function.
3123         (Input_reader::do_get_unused_symbol): New function.
3124         (Incremental_binary::input_file_count): New function.
3125         (Incremental_binary::get_input_reader): Change signature to use
3126         index instead of filename.
3127         (Incremental_binary::file_has_changed): New function.
3128         (Incremental_binary::get_input_argument): New function.
3129         (Incremental_binary::get_library): New function.
3130         (Incremental_binary::get_script_info): New function.
3131         (Incremental_binary::init_layout): New function.
3132         (Incremental_binary::reserve_layout): New function.
3133         (Incremental_binary::output_file): New function.
3134         (Incremental_binary::do_check_inputs): New function.
3135         (Incremental_binary::do_file_is_unchanged): Remove.
3136         (Incremental_binary::do_file_has_changed): New function.
3137         (Incremental_binary::do_init_layout): New function.
3138         (Incremental_binary::do_reserve_layout): New function.
3139         (Incremental_binary::do_input_file_count): New function.
3140         (Incremental_binary::do_get_input_reader): Change signature.
3141         (Incremental_binary::input_args_map_): New data member.
3142         (Incremental_binary::library_map_): New data member.
3143         (Incremental_binary::script_map_): New data member.
3144         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3145         new data members.
3146         (Sized_incremental_binary::output_section): New function.
3147         (Sized_incremental_binary::inputs_reader): Add const.
3148         (Sized_incremental_binary::symtab_reader): Add const.
3149         (Sized_incremental_binary::relocs_reader): Add const.
3150         (Sized_incremental_binary::got_plt_reader): Add const.
3151         (Sized_incremental_binary::get_symtab_view): New function.
3152         (Sized_incremental_binary::Inputs_reader): New typedef.
3153         (Sized_incremental_binary::Input_entry_reader): New typedef.
3154         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3155         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3156         (Sized_incremental_binary::do_file_has_changed): New function.
3157         (Sized_incremental_binary::do_init_layout): New function.
3158         (Sized_incremental_binary::do_reserve_layout): New function.
3159         (Sized_input_reader::Inputs_reader): Remove.
3160         (Sized_input_reader::Input_entry_reader): Remove.
3161         (Sized_input_reader::do_arg_serial): New function.
3162         (Sized_input_reader::do_get_unused_symbol_count): New function.
3163         (Sized_input_reader::do_get_unused_symbol): New function.
3164         (Sized_incremental_binary::do_input_file_count): New function.
3165         (Sized_incremental_binary::do_get_input_reader): Change signature;
3166         use index instead of filename.
3167         (Sized_incremental_binary::section_map_): New data member.
3168         (Sized_incremental_binary::input_entry_readers_): New data member.
3169         (class Sized_incr_relobj): New class.
3170         (class Sized_incr_dynobj): New class.
3171         (make_sized_incremental_object): New function.
3172         (class Incremental_library): New class.
3173         * layout.cc (Free_list::num_lists): New static data member.
3174         (Free_list::num_nodes): New static data member.
3175         (Free_list::num_removes): New static data member.
3176         (Free_list::num_remove_visits): New static data member.
3177         (Free_list::num_allocates): New static data member.
3178         (Free_list::num_allocate_visits): New static data member.
3179         (Free_list::init): New function.
3180         (Free_list::remove): New function.
3181         (Free_list::allocate): New function.
3182         (Free_list::dump): New function.
3183         (Free_list::print_stats): New function.
3184         (Layout_task_runner::run): Resize output file for incremental updates.
3185         (Layout::Layout): Initialize new data members.
3186         (Layout::set_incremental_base): New function.
3187         (Layout::init_fixed_output_section): New function.
3188         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3189         incremental updates.
3190         (Layout::create_gold_note): Do not create gold note section for
3191         incremental updates.
3192         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3193         for incremental updates.
3194         (Layout::set_section_offsets): For incremental updates, allocate space
3195         from free list.
3196         (Layout::create_symtab_sections): Layout with offsets relative to
3197         start of section; for incremental updates, allocate space from free
3198         list.
3199         (Layout::create_shdrs): For incremental updates, allocate space from
3200         free list.
3201         (Layout::finish_dynamic_section): For incremental updates, do not
3202         check --as-needed (fixed in subsequent patch).
3203         * layout.h (class Free_list): New class.
3204         (Layout::set_incremental_base): New function.
3205         (Layout::incremental_base): New function.
3206         (Layout::init_fixed_output_section): New function.
3207         (Layout::allocate): New function.
3208         (Layout::incremental_base_): New data member.
3209         (Layout::free_list_): New data member.
3210         * main.cc (main): Print Free_list statistics.
3211         * object.cc (Relobj::finalize_incremental_relocs): Add
3212         clear_counts parameter; clear counts only when clear_counts is set.
3213         (Sized_relobj::Sized_relobj): Initialize new base class.
3214         (Sized_relobj::do_layout): Don't report special sections.
3215         (Sized_relobj::do_for_all_local_got_entries): New function.
3216         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3217         symtab_off to all symbol table offsets.
3218         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3219         * object.h (class Got_offset_list): Move to top of file.
3220         (Object::Object): Allow case where input_file == NULL.
3221         (Object::~Object): Likewise.
3222         (Object::input_file): Assert that input_file != NULL.
3223         (Object::lock): Allow case where input_file == NULL.
3224         (Object::unlock): Likewise.
3225         (Object::is_locked): Likewise.
3226         (Object::token): Likewise.
3227         (Object::release): Likewise.
3228         (Object::is_incremental): New function.
3229         (Object::get_mtime): New function.
3230         (Object::for_all_local_got_entries): New function.
3231         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3232         (Object::set_is_in_system_directory): New function.
3233         (Object::is_in_system_directory): New function.
3234         (Object::do_is_incremental): New function.
3235         (Object::do_get_mtime): New function.
3236         (Object::do_for_all_local_got_entries): New function.
3237         (Object::is_in_system_directory_): New data member.
3238         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3239         (class Sized_relobj_base): New class.
3240         (class Sized_relobj): Derive from Sized_relobj_base.
3241         (class Sized_relobj::Symbols): Redeclare from base class.
3242         (class Sized_relobj::local_got_offset_list): Remove.
3243         (class Sized_relobj::Output_sections): Redeclare from base class.
3244         (class Sized_relobj::do_for_all_local_got_entries): New function.
3245         (class Sized_relobj::write_local_symbols): Add offset parameter.
3246         (class Sized_relobj::local_symbol_offset_): Update comment.
3247         (class Sized_relobj::local_dynsym_offset_): Update comment.
3248         * options.cc (Input_arguments::add_file): Remove const.
3249         * options.h (Input_file_argument::Input_file_argument):
3250         Initialize arg_serial_ (all constructors).
3251         (Input_file_argument::set_arg_serial): New function.
3252         (Input_file_argument::arg_serial): New function.
3253         (Input_file_argument::arg_serial_): New data member.
3254         (Input_arguments::Input_arguments): Initialize file_count_.
3255         (Input_arguments::add_file): Remove const.
3256         (Input_arguments::number_of_input_files): New function.
3257         (Input_arguments::file_count_): New data member.
3258         (Command_line::number_of_input_files): Call
3259         Input_arguments::number_of_input_files.
3260         * output.cc (Output_segment_headers::Output_segment_headers):
3261         Set current size.
3262         (Output_section::Input_section::current_data_size): New function.
3263         (Output_section::Output_section): Initialize new data members.
3264         (Output_section::add_input_section): Don't do merge sections for
3265         an incremental link; allocate space from free list for an
3266         incremental update.
3267         (Output_section::add_output_section_data): Allocate space from
3268         free list for an incremental update.
3269         (Output_section::update_data_size): New function.
3270         (Output_section::set_fixed_layout): New function.
3271         (Output_section::reserve): New function.
3272         (Output_segment::set_section_addresses): Remove const.
3273         (Output_segment::set_section_list_addresses): Remove const; allocate
3274         space from free list for an incremental update.
3275         (Output_segment::set_offset): Adjust size of RELRO segment for an
3276         incremental update.
3277         * output.h (Output_data::current_data_size): Move here from
3278         child classes.
3279         (Output_data::pre_finalize_data_size): New function.
3280         (Output_data::update_data_size): New function.
3281         (Output_section_headers::update_data_size): new function.
3282         (Output_section_data_build::current_data_size): Move to Output_data.
3283         (Output_data_strtab::update_data_size): New function.
3284         (Output_section::current_data_size): Move to Output_data.
3285         (Output_section::set_fixed_layout): New function.
3286         (Output_section::has_fixed_layout): New function.
3287         (Output_section::reserve): New function.
3288         (Output_section::update_data_size): New function.
3289         (Output_section::has_fixed_layout_): New data member.
3290         (Output_section::free_list_): New data member.
3291         (Output_segment::set_section_addresses): Remove const.
3292         (Output_segment::set_section_list_addresses): Remove const.
3293         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3294         New function.
3295         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3296         New function.
3297         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3298         parameter when calling Add_symbols constructor; store argument
3299         serial number for members of a lib group.
3300         (Add_symbols::locks): Allow case where token == NULL.
3301         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3302         (Read_member::~Read_member): New function.
3303         (Read_member::is_runnable): New function.
3304         (Read_member::locks): New function.
3305         (Read_member::run): New function.
3306         (Check_script::~Check_script): New function.
3307         (Check_script::is_runnable): New function.
3308         (Check_script::locks): New function.
3309         (Check_script::run): New function.
3310         (Check_library::~Check_library): New function.
3311         (Check_library::is_runnable): New function.
3312         (Check_library::locks): New function.
3313         (Check_library::run): New function.
3314         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3315         (Add_symbols::library_): New data member.
3316         (class Read_member): New class.
3317         (class Check_script): New class.
3318         (class Check_library): New class.
3319         * reloc.cc (Read_relocs::is_runnable): Allow case where
3320         token == NULL.
3321         (Read_relocs::locks): Likewise.
3322         (Scan_relocs::locks): Likewise.
3323         (Relocate_task::locks): Likewise.
3324         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3325         to clear counters.
3326         (Sized_relobj::incremental_relocs_scan): Fix comment.
3327         (Sized_relobj::do_relocate): Pass output file offset to
3328         write_local_symbols.
3329         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3330         from class declaration.
3331         * script.cc (read_input_script): Allocate Script_info; pass
3332         argument serial number to report_script.
3333         * script.h (class Script_info): Move to incremental.h.
3334         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3335         * symtab.h (Symbol_table::add_from_incrobj): New function.
3336         (Symbol_table::set_file_offset): New function.
3337
3338 2011-04-05  Cary Coutant  <ccoutant@google.com>
3339
3340         * incremental-dump.cc (dump_incremental_inputs): Change signature
3341         to take a Sized_incremental_binary; change caller.  Use readers
3342         in Sized_incremental_binary.
3343         * incremental.cc
3344         (Sized_incremental_binary::find_incremental_inputs_sections):
3345         Rename do_find_incremental_inputs_sections to this.
3346         (Sized_incremental_binary::setup_readers): New function.
3347         (Sized_incremental_binary::do_check_inputs): Check
3348         has_incremental_info_ flag; move setup code to setup_readers;
3349         use input readers.
3350         (Sized_incremental_binary::do_file_is_unchanged): New function.
3351         (Sized_incremental_binary::do_get_input_reader): New function.
3352         * incremental.h (class Incremental_binary): Move to end of file.
3353         (Incremental_binary::file_is_unchanged): New function.
3354         (Incremental_binary::do_file_is_unchanged): New function.
3355         (Incremental_binary::Input_reader): New class.
3356         (Incremental_binary::get_input_reader): New function.
3357         (class Sized_incremental_binary): Move to end of file.
3358         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3359         input section reader classes.
3360         (Sized_incremental_binary::has_incremental_info): New function.
3361         (Sized_incremental_binary::inputs_reader): New function.
3362         (Sized_incremental_binary::symtab_reader): New function.
3363         (Sized_incremental_binary::relocs_reader): New function.
3364         (Sized_incremental_binary::got_plt_reader): New function.
3365         (Sized_incremental_binary::do_file_is_unchanged): New function.
3366         (Sized_incremental_binary::Sized_input_reader): New class.
3367         (Sized_incremental_binary::get_input_reader): New function.
3368         (Sized_incremental_binary::find_incremental_inputs_sections):
3369         Rename do_find_incremental_inputs_sections to this.
3370         (Sized_incremental_binary::setup_readers): New function.
3371         (Sized_incremental_binary::has_incremental_info_): New data member.
3372         (Sized_incremental_binary::inputs_reader_): New data member.
3373         (Sized_incremental_binary::symtab_reader_): New data member.
3374         (Sized_incremental_binary::relocs_reader_): New data member.
3375         (Sized_incremental_binary::got_plt_reader_): New data member.
3376         (Sized_incremental_binary::current_input_file_): New data member.
3377
3378 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3379
3380         PR gold/12640
3381         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3382         violation.
3383
3384 2011-03-30  Cary Coutant  <ccoutant@google.com>
3385
3386         * archive.cc (Archive::include_member): Adjust call to report_object.
3387         (Add_archive_symbols::run): Add script_info to call to
3388         report_archive_begin.
3389         (Lib_group::include_member): Adjust call to report_object.
3390         (Add_lib_group_symbols::run): Adjust call to report_object.
3391         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3392         blocks.  Add object count for script input files.
3393         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3394         script_info parameter; change all callers.
3395         (Incremental_inputs::report_object): Add script_info parameter;
3396         change all callers.
3397         (Incremental_inputs::report_script): Store backpointer to
3398         incremental info entry.
3399         (Output_section_incremental_inputs::set_final_data_size): Record
3400         additional information for scripts.
3401         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3402         * incremental.h (Incremental_script_entry::add_object): New function.
3403         (Incremental_script_entry::get_object_count): New function.
3404         (Incremental_script_entry::get_object): New function.
3405         (Incremental_script_entry::objects_): New data member; adjust
3406         constructor.
3407         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3408         (Incremental_inputs::report_object): Add script_info parameter.
3409         (Incremental_inputs_reader::get_object_count): New function.
3410         (Incremental_inputs_reader::get_object_offset): New function.
3411         * options.cc (Input_arguments::add_file): Return reference to
3412         new input argument.
3413         * options.h (Input_argument::set_script_info): New function.
3414         (Input_argument::script_info): New function.
3415         (Input_argument::script_info_): New data member; adjust all
3416         constructors.
3417         (Input_file_group::add_file): Return reference to new input argument.
3418         (Input_file_lib::add_file): Likewise.
3419         (Input_arguments::add_file): Likewise.
3420         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3421         * script.cc (Parser_closure::Parser_closure): Add script_info
3422         parameter; adjust all callers.
3423         (Parser_closure::script_info): New function.
3424         (Parser_closure::script_info_): New data member.
3425         (read_input_script): Report scripts earlier to incremental info.
3426         (script_add_file): Set script_info in Input_argument.
3427         (script_add_library): Likewise.
3428         * script.h (Script_options::Script_info): Rewrite class.
3429
3430 2011-03-29  Cary Coutant  <ccoutant@google.com>
3431
3432         * archive.cc (Library_base::should_include_member): Move
3433         method here from class Archive.
3434         (Archive::Archive): Initialize base class.
3435         (Archive::should_include_member): Move to base class.
3436         (Archive::do_for_all_unused_symbols): New function.
3437         (Add_archive_symbols::run): Remove redundant access to
3438         incremental_inputs.
3439         (Lib_group::Lib_group): Initialize base class.
3440         (Lib_group::do_filename): New function.
3441         (Lib_group::include_member): Pass pointer to Lib_group to
3442         report_object.
3443         (Lib_group::do_for_all_unused_symbols): New function.
3444         (Add_lib_group_symbols::run): Report archive information for
3445         incremental links.
3446         * archive.h (class Library_base): New base class.
3447         (class Archive): Derive from Library_base.
3448         (Archive::filename): Move to base class.
3449         (Archive::set_incremental_info): Likewise.
3450         (Archive::incremental_info): Likewise.
3451         (Archive::Should_include): Likewise.
3452         (Archive::should_include_member): Likewise.
3453         (Archive::Armap_entry): Remove.
3454         (Archive::Unused_symbol_iterator): Remove.
3455         (Archive::unused_symbols_begin): Remove.
3456         (Archive::unused_symbols_end): Remove.
3457         (Archive::do_filename): New function.
3458         (Archive::do_get_mtime): New function.
3459         (Archive::do_for_all_unused_symbols): New function.
3460         (Archive::task_): Move to base class.
3461         (Archive::incremental_info_): Likewise.
3462         (class Lib_group): Derive from Library_base.
3463         (Lib_group::do_filename): New function.
3464         (Lib_group::do_get_mtime): New function.
3465         (Lib_group::do_for_all_unused_symbols): New function.
3466         (Lib_group::task_): Move to base class.
3467         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3468         function.
3469         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3470         function.
3471         * incremental.cc (Incremental_inputs::report_archive_begin):
3472         Use Library_base; call library's get_mtime; add incremental inputs
3473         entry before members.
3474         (class Unused_symbol_visitor): New class.
3475         (Incremental_inputs::report_archive_end): Use Library_base; use
3476         visitor class to record unused symbols; don't add incremental inputs
3477         entry after members.
3478         (Incremental_inputs::report_object): Use Library_base.
3479         * incremental.h
3480         (Incremental_archive_entry::Incremental_archive_entry): Remove
3481         unused Archive parameter.
3482         (Incremental_inputs::report_archive_begin): Use Library_base.
3483         (Incremental_inputs::report_archive_end): Likewise.
3484         (Incremental_inputs::report_object): Likewise.
3485         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3486         function.
3487         * object.h (Object::for_all_global_symbols): New function.
3488         (Object::do_for_all_global_symbols): New function.
3489         (Sized_relobj::do_for_all_global_symbols): New function.
3490         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3491         function.
3492         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3493         function.
3494
3495 2011-03-27  Ian Lance Taylor  <iant@google.com>
3496
3497         * archive.cc (Archive::interpret_header): Return -1 if something
3498         goes wrong.  Change callers accordingly.
3499
3500 2011-03-25  Cary Coutant  <ccoutant@google.com>
3501
3502         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3503         * testsuite/Makefile.in: Regenerate.
3504
3505 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3506
3507         * plugin.cc (get_view): New.
3508         (Plugin::load): Pass get_view to the plugin.
3509         (Plugin_manager::get_view): New.
3510
3511 2011-03-21  Ian Lance Taylor  <iant@google.com>
3512
3513         * testsuite/final_layout.sh: Rewrite to not use dc.
3514         * testsuite/relro_test.sh: Fail if dc is not present.
3515
3516 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3517
3518         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3519         Change == to -eq.
3520         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3521         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3522         Change == to -eq.
3523         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3524         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3525
3526 2011-03-14  Ian Lance Taylor  <iant@google.com>
3527
3528         * script-sections.cc (Sort_output_sections::script_compare):
3529         Rename from is_before, change return type.
3530         (Sort_output_sections::operator()): Adjust accordingly.
3531
3532 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3533
3534         PR gold/12572
3535         * testsuite/odr_violation2.cc: Add comment to make all error line
3536         numbers double digits.
3537         * testsuite/debug_msg.sh: Adjust expected errors.
3538
3539 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3540
3541         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3542         but mark earlier ones as non-canonical
3543         (offset_to_iterator): Update search target and example
3544         (do_addr2line): Return extra lines in a vector*
3545         (format_file_lineno): Extract from do_addr2line
3546         (one_addr2line): Add vector* out-param
3547         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3548         when a lineno entry appeared last for its instruction
3549         (Dwarf_line_info): Add vector* out-param
3550         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3551         * symtab.cc (Odr_violation_compare): Include the lineno in the
3552         comparison again.
3553         (linenos_from_loc): New. Combine the canonical line for an
3554         address with its other lines.
3555         (True_if_intersect): New. Helper functor to make
3556         std::set_intersection a query.
3557         (detect_odr_violations): Compare sets of lines instead of just
3558         one line for each function. This became less deterministic, but
3559         has fewer false positives.
3560         * symtab.h: Declarations.
3561         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3562         mix an optimized and non-optimized object in the same binary
3563         (odr_violation2.so): Same.
3564         * testsuite/Makefile.in: Regenerate from Makefile.am.
3565         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3566         * testsuite/debug_msg.sh: Update line numbers and add
3567         assertions.
3568         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3569         non-optimized context.
3570         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3571         isn't inlined, and use OdrDerived in an optimized context.
3572         * testsuite/odr_header1.h: Defines OdrDerived, where
3573         optimization will change the
3574         first-instruction-in-the-destructor's file and line number.
3575         * testsuite/odr_header2.h: Defines OdrBase.
3576
3577 2011-03-09  Ian Lance Taylor  <iant@google.com>
3578
3579         * fileread.cc (File_read::clear_views): Don't delete the whole
3580         file view.
3581
3582 2011-03-08  Ian Lance Taylor  <iant@google.com>
3583
3584         PR gold/12525
3585         * fileread.cc: #include <climits>.
3586         (GOLD_IOV_MAX): Define.
3587         (File_read::read_multiple): Limit number of entries by iov_max.
3588         * fileread.h (class File_read): Always set max_readv_entries to
3589         128.
3590
3591 2011-03-07  Ian Lance Taylor  <iant@google.com>
3592
3593         PR gold/12525
3594         * options.h (class General_options): Add -dy and -dn.
3595
3596 2011-03-02  Cary Coutant  <ccoutant@google.com>
3597
3598         * testsuite/script_test_9.t: Add TLS segment.
3599
3600 2011-03-02  Simon Baldwin  <simonb@google.com>
3601
3602         * configure.ac: Add check for gnu_indirect_function support in
3603         the toolchain building binutils.
3604         * configure: Rebuild.
3605
3606 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3607
3608         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3609         plugin only symbols.
3610         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3611         in plugin files as not needed in the symbol table.
3612
3613 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3614
3615         * output.cc (Output_section::add_input_section): Delay fill
3616         generation for section ordering.
3617
3618 2011-02-09  Ian Lance Taylor  <iant@google.com>
3619
3620         PR gold/12316
3621         * object.h (class Sized_relobj): Remove clear_local_symbols.
3622         * reloc.cc (Sized_relobj::do_relocate): Don't call
3623         clear_local_symbols.
3624
3625 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3626
3627         * plugin.cc (is_visible_from_outside): Return true for symbols
3628         in the -u option.
3629
3630 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3631
3632         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3633         filename.
3634
3635 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3636
3637         * icf.h (is_section_foldable_candidate): Change type of parameter
3638         to std::string.
3639         * icf.cc (Icf::find_identical_sections): Change type of local variable
3640         section_name to be std::string.
3641         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3642
3643 2011-01-25  Ian Lance Taylor  <iant@google.com>
3644
3645         * script.cc (script_add_extern): Rewrite to use
3646         add_symbol_reference.
3647
3648 2011-01-25  Doug Kwan  <dougkwan@google.com>
3649
3650         * icf.cc (get_section_contents): Always lock section's object.
3651
3652 2011-01-24  Ian Lance Taylor  <iant@google.com>
3653
3654         * options.h (class General_options): Accept
3655         --no-detect-odr-violations.
3656
3657 2011-01-24  Ian Lance Taylor  <iant@google.com>
3658
3659         * version.cc (version_string): Bump to 1.11.
3660
3661 2011-01-24  Ian Lance Taylor  <iant@google.com>
3662
3663         * plugin.cc (class Plugin_rescan): Define new class.
3664         (Plugin_manager::claim_file): Set any_claimed_.
3665         (Plugin_manager::save_archive): New function.
3666         (Plugin_manager::save_input_group): New function.
3667         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3668         necessary.
3669         (Plugin_manager::new_undefined_symbol): New function.
3670         (Plugin_manager::rescan): New function.
3671         (Plugin_manager::rescannable_defines): New function.
3672         (Plugin_manager::add_input_file): Set any_added_.
3673         * plugin.h (class Plugin_manager): define new fields rescannable_,
3674         undefined_symbols_, any_claimed_, and any_added_.  Declare
3675         Plugin_rescan as friend.  Declare new functions.
3676         (Plugin_manager::Rescannable): Define type.
3677         (Plugin_manager::Rescannable_list): Define type.
3678         (Plugin_manager::Undefined_symbol_list): Define type.
3679         (Plugin_manager::Plugin_manager): Initialize new fields.
3680         * archive.cc (Archive::defines_symbol): New function.
3681         (Add_archive_symbols::run): Pass archive to plugins if any.
3682         * archive.h (class Archive): Declare defines_symbol.
3683         * readsyms.cc (Input_group::~Input_group): New function.
3684         (Finish_group::run): Pass input_group to plugins if any.
3685         * readsyms.h (class Input_group): Declare destructor.
3686         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3687         any.
3688
3689 2011-01-10  Ian Lance Taylor  <iant@google.com>
3690
3691         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3692         section as relro.
3693         (Layout::set_segment_offsets): Reset increase_relro before calling
3694         set_section_addresses a second time.
3695
3696 2011-01-04  Cary Coutant  <ccoutant@google.com>
3697
3698         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3699         sections before NOBITS sections.
3700
3701 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3702
3703         * version.cc (print_version): Update copyright to 2011.
3704
3705 2010-12-23  Cary Coutant  <ccoutant@google.com>
3706
3707         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3708         of OS to this->add.  Add OD parameter to second form of the function.
3709
3710 2010-12-20  Ian Lance Taylor  <iant@google.com>
3711
3712         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3713         second of two consecutive entries with same offset.
3714
3715 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3716
3717         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3718         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3719         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3720         to avoid unneeded links against $(LDADD).
3721         * testsuite/Makefile.in: Regenerate.
3722
3723 2010-12-15  Ian Lance Taylor  <iant@google.com>
3724
3725         PR gold/12324
3726         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3727         for R_X86_64_32 and R_X86_64_PC32.
3728         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3729         ver_matching_def_pic.o.
3730         (ver_matching_def_pic.o): New target.
3731
3732 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3733
3734         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3735         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3736         Move definition before File_read::View member definitions.
3737         (File_read::View::~View): Initialize and hold lock before
3738         updating current_mapped_bytes.
3739
3740 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3741
3742         * dwarf_reader.cc: Remove outdated comment.
3743         * gold-threads.cc: Fix typo in error message.
3744         * archive.cc: Fix typos in comments.
3745         * archive.h: Likewise.
3746         * arm-reloc-property.cc: Likewise.
3747         * arm-reloc-property.h: Likewise.
3748         * arm-reloc.def: Likewise.
3749         * arm.cc: Likewise.
3750         * attributes.h: Likewise.
3751         * cref.cc: Likewise.
3752         * ehframe.cc: Likewise.
3753         * fileread.h: Likewise.
3754         * gold.h: Likewise.
3755         * i386.cc: Likewise.
3756         * icf.cc: Likewise.
3757         * incremental.h: Likewise.
3758         * int_encoding.cc: Likewise.
3759         * layout.h: Likewise.
3760         * main.cc: Likewise.
3761         * merge.h: Likewise.
3762         * object.cc: Likewise.
3763         * object.h: Likewise.
3764         * options.cc: Likewise.
3765         * readsyms.cc: Likewise.
3766         * reduced_debug_output.cc: Likewise.
3767         * reloc.cc: Likewise.
3768         * script-sections.cc: Likewise.
3769         * sparc.cc: Likewise.
3770         * symtab.h: Likewise.
3771         * target-reloc.h: Likewise.
3772         * target.cc: Likewise.
3773         * target.h: Likewise.
3774         * timer.cc: Likewise.
3775         * timer.h: Likewise.
3776         * x86_64.cc: Likewise.
3777
3778 2010-12-09  Cary Coutant  <ccoutant@google.com>
3779
3780         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3781         stack.
3782         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3783         parameter; change all callers.
3784         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3785         * options.h (warn_execstack): New option.
3786
3787 2010-12-07  Doug Kwan  <dougkwan@google.com>
3788
3789         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3790         like function call relocations.
3791
3792 2010-12-07  Ian Lance Taylor  <iant@google.com>
3793
3794         * archive.cc (Archive::get_elf_object_for_member): Permit
3795         punconfigured to be NULL.
3796         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3797         (Archive::include_member): Pass NULL to get_elf_object_for_member
3798         if we searched for the archive and this is the first included
3799         object.
3800
3801 2010-12-01  Ian Lance Taylor  <iant@google.com>
3802
3803         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3804         track_relocs_type_ field.
3805         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3806         Set track_relocs_type_.
3807         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3808         contents when using RELA relocs.
3809         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3810         reloc_map_.
3811         * reloc.cc (Track_relocs::next_addend): New function.
3812         * reloc.h (class Track_relocs): Declare next_addend.
3813
3814 2010-12-01  Ian Lance Taylor  <iant@google.com>
3815
3816         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3817         virtual destructor.
3818
3819 2010-12-01  Ian Lance Taylor  <iant@google.com>
3820
3821         * README: Update compilers known to work and fail.
3822
3823 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3824
3825         * configure.in: For --enable-gold, handle value `default' instead of
3826         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3827         not the default.
3828         * configure: Regenerate.
3829
3830 2010-11-18  Doug Kwan  <dougkwan@google.com>
3831
3832         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3833         and right_alignment to be zero.  Store result alignment only if it is
3834         greater than existing alignment.
3835
3836 2010-11-16  Cary Coutant  <ccoutant@google.com>
3837
3838         PR gold/12220
3839         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3840         Check for ".zdebug_line".
3841
3842 2010-11-16  Doug Kwan  <dougkwan@google.com>
3843             Cary Coutant  <ccoutant@google.com>
3844
3845         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3846         by reference; adjust all callers.
3847         * output.cc (Output_segment::set_section_addresses): Adjust references
3848         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3849         list is empty.
3850         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3851         end at page boundary.
3852
3853 2010-11-16  Cary Coutant  <ccoutant@google.com>
3854
3855         PR gold/12220
3856         * layout.cc (Layout::choose_output_section): Transform names of
3857         compressed sections even when using a script with a SECTIONS clause.
3858         (Layout::output_section_name): Remove code to transform
3859         compressed debug section names.
3860         * output.cc (Output_section::add_input_section): Use uncompressed
3861         section size when tracking input sections.
3862
3863 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3864
3865         * symtab.h (Symbol::NON_PIC_REF): Remove.
3866         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3867         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3868         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3869         (Symbol::use_plt_offset): Take a flags argument and pass it
3870         directly to needs_dynamic_reloc.  Restrict check for undefined
3871         weak symbols to function calls.
3872         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3873         (Target_arm::Scan::global): Use it.
3874         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3875         (Target_arm::Relocate::relocate): Likewise.
3876         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3877         parameter with an r_type parameter.  Use get_reference_flags
3878         to get the flags.
3879         (Target_arm::Relocate::relocate): Update accordingly.
3880         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3881         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3882         (Target_i386::Scan::global): Likewise.
3883         (Target_i386::Relocate::relocate): Likewise.
3884         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3885         parameter with an r_type parameter.  Use get_reference_flags
3886         to get the flags.
3887         (Target_i386::Relocate::relocate): Update accordingly.
3888         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3889         (Target_powerpc::Scan::global): Use it.
3890         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3891         (Target_powerpc::Relocate::relocate): Likewise.
3892         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3893         (Target_sparc::Scan::global): Use it.
3894         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3895         (Target_sparc::Relocate::relocate): Likewise.
3896         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3897         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3898         (Target_x86_64::Scan::global): Likewise.
3899         (Target_x86_64::Relocate::relocate): Likewise.
3900
3901 2010-11-08  Doug Kwan  <dougkwan@google.com>
3902             Cary Coutant  <ccoutant@google.com>
3903
3904         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3905         (Arm_exidx_merge_section::section_contents_): New data member.
3906         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3907         (Arm_input_section::~Arm_input_section): De-allocate memory.
3908         (Arm_input_section::original_contents_): New data member.
3909         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3910         in parameters instead of calling Object::section_contents without
3911         locking.
3912         (Arm_output_section::group_section): New parameter TASK.  Pass it
3913         to callees that need locking objects.
3914         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3915         to lock EXIDX input sections.  Fix a formatting issue.  Call
3916         Arm_exidx_merged_section::build_contents to create merged section
3917         contents.
3918         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3919         to lock object of stub table owner.
3920         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3921         TEXT_SIZE to initialize data member TEXT_SIZE_.
3922         (Arm_exidx_input_section::addralign): Fix typo in comment.
3923         (Arm_exidx_input_section::text_size): New method.
3924         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3925         that require locking objects.  Lock objects before scanning for stubs
3926         and updating local symbols.
3927         (Arm_input_section<big_endian>::init): Copy contents of original
3928         input section.
3929         (Arm_input_section<big_endian>::do_write): Use saved contents of
3930         original input section instead of calling Object::section_contents
3931         without locking.
3932         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3933         size without calling Object::section_size().
3934         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3935         for size.  Allocate a buffer for merged EXIDX entries.
3936         (Arm_exidx_merged_section::build_contents): New method.
3937         (Arm_exidx_merged_section::do_write): Move merge section contents
3938         building code to Arm_exidx_merged_section::build_contetns.  Write
3939         out contetns in buffer instead of building it on the fly.
3940         (Arm_relobj::make_exidx_input_section): Also pass text section size
3941         to Arm_exidx_input_section constructor.
3942         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3943         (Arm_dynobj::do_read_symbols): Fix memory leak.
3944         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3945         * target.h: (class Task): Add forward declaration.
3946         (Target::relax): Add new parameter TASK and pass it to
3947         Target::do_relax().
3948         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3949
3950 2010-11-05  Cary Coutant  <ccoutant@google.com>
3951
3952         PR gold/10708
3953         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3954         object when reading from the file.
3955         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3956         second layout pass.
3957         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3958         when reading section contents.
3959         (get_section_contents): Likewise.
3960         (icf::find_identical_sections): Likewise.
3961         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3962         object when reading from the file.
3963         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3964         the object when doing deferred section layout.
3965
3966 2010-11-03  Nick Clifton  <nickc@redhat.com>
3967
3968         PR gold/12001
3969         * script.h (class Symbol_assignment: name): New member.  Returns
3970         the name of the symbol.
3971         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3972         Returns true if the given symbol name is on the list of
3973         assignments wating to be processed.
3974         * archive.cc (should_incldue_member): If the symbol is undefined,
3975         check to see if it is on the list of symbols pending assignment.
3976
3977 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3978
3979         * script-sections.cc (Script_sections::find_memory_region): Check
3980         for a NULL output section pointer.
3981
3982 2010-10-29  Doug Kwan  <dougkwan@google.com>
3983
3984         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3985         Output_section::add_relaxed_input_section.
3986         * output.cc (Output_section::add_relaxed_input_section): Add new
3987         arguments LAYOUT and NAME.  Set section order index.
3988         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3989         Copy section order index.
3990         * output.h (Output_section::add_relaxed_input_section): Add new
3991         arguments LAYOUT and NAME.
3992
3993 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3994
3995         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3996         NATIVE_OR_CROSS_LINKER.
3997         * testsuite/Makefile.in: Regenerate.
3998
3999 2010-10-20  Doug Kwan  <dougkwan@google.com>
4000
4001         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4002         without SHF_LINK_ORDER flags.
4003         * layout.cc (Layout::choose_output_section): Do not filter
4004         SHF_LINK_ORDER flag in a relocatable link.
4005
4006 2010-10-17  Cary Coutant  <ccoutant@google.com>
4007
4008         * output.h (Output_segment::set_section_addresses): Change function
4009         signature.  Update all callers.
4010         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4011         sections.
4012         (Output_segment::set_section_addresses): Align after last TLS
4013         section.  Add padding before last relro section instead of after.
4014
4015 2010-10-17  Doug Kwan  <dougkwan@google.com>
4016
4017         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4018         GOT output section to be writable.
4019
4020 2010-10-14  Cary Coutant  <ccoutant@google.com>
4021
4022         * debug.h (DEBUG_INCREMENTAL): New flag.
4023         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4024         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4025         mode.
4026         * incremental.cc (report_command_line): Ignore all forms of
4027         --incremental.
4028         * layout.cc (Layout::Layout): Check parameters for incremental link
4029         mode.
4030         * options.cc (General_options::parse_incremental): New function.
4031         (General_options::parse_no_incremental): New function.
4032         (General_options::parse_incremental_full): New function.
4033         (General_options::parse_incremental_update): New function.
4034         (General_options::incremental_mode_): New data member.
4035         (General_options::finalize): Check incremental_mode_.
4036         * options.h (General_options): Update help text for --incremental.
4037         Add --no-incremental, --incremental-full, --incremental-update.
4038         (General_options::Incremental_mode): New enum type.
4039         (General_options::incremental_mode): New function.
4040         (General_options::incremental_mode_): New data member.
4041         * parameters.cc (Parameters::incremental_mode_): New data member.
4042         (Parameters::set_options): Set incremental_mode_.
4043         (Parameters::set_incremental_full): New function.
4044         (Parameters::incremental): New function.
4045         (Parameters::incremental_update): New function.
4046         (set_parameters_incremental_full): New function.
4047         * parameters.h (Parameters::set_incremental_full): New function.
4048         (Parameters::incremental): New function.
4049         (Parameters::incremental_update): New function.
4050         (Parameters::incremental_mode_): New data member.
4051         (set_parameters_incremental_full): New function.
4052         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4053         incremental link mode.
4054         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4055         (Sized_relobj::do_relocate_sections): Likewise.
4056         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4057         option.
4058         * testsuite/Makefile.in: Regenerate.
4059         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4060
4061 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4062
4063         * script-sections.h (class Script_sections): Make
4064         Sections_elements typedef public.
4065         * script-sections.cc (class Sort_output_sections): Add elements_
4066         field.  Add constructor which sets it; change all callers.
4067         (Sort_output_sections::is_before): New function.
4068         (Sort_output_sections::operator()): Call is_before.
4069         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4070         conditional.
4071         * testsuite/script_test_10.sh: New test. Test script section
4072         order.
4073         * testsuite/script_test_10.t: Likewise.
4074         * testsuite/script_test_10.s: Likewise.
4075         * testsuite/Makefile.am: Wrap the cross linker tests and the
4076         common tests into NATIVE_OR_CROSS_LINKER.
4077         (check_SCRIPTS): Add script_test_10.sh.
4078         (check_DATA): Add script_test_10.stdout.
4079         (script_test_10.o, script_test_10): New targets.
4080         (script_test_10.stdout): New target.
4081         * configure, testsuite/Makefile.in: Regenerate.
4082
4083 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4084
4085         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4086         error for the deprecated relocations.
4087         (Target_arm::Scan::global): Likewise.
4088         (Target_arm::Relocate::relocate): Likewise.
4089
4090 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4091
4092         * fileread.cc (Input_file::find_file): Initialize *found_name
4093         and *namep when using the fallback search for case 4.
4094
4095 2010-10-11  Cary Coutant  <ccoutant@google.com>
4096
4097         * options.h (class General_options): Redefine -z lazy as an alias for
4098         the negation of -z now.
4099
4100 2010-10-11  Ian Lance Taylor  <iant@google.com>
4101
4102         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4103         binding.
4104
4105 2010-10-06  Nick Clifton  <nickc@redhat.com>
4106
4107         * script-sections.cc(class Memory_region): Remove
4108         current_lma_offset_ field.  Rename current_vma_offset_ to
4109         current_offset_.  Add last_section_ field.
4110         (Memory_region::get_current_vma_address): Rename to
4111         get_current_address.
4112         (Memory_region::get_current_lma_address): Delete.
4113         (Memory_region::increment_vma_offset): Rename to
4114         increment_offset.
4115         (Memory_region::increment_lma_offset): Delete.
4116         (Memory_region::attributes_compatible): New method.  Returns
4117         true if the provided section is compatible with the region.
4118         (Memory_region::get_last_section): New method.  Returns the last
4119         section to use the region.
4120         (Memory_region::set_last_section): New method.  Stores the last
4121         section to use the region.
4122         (Script_sections::block_in_region): New method.  Returns true if
4123         a block of memory is contained within a region.
4124         (Script_sections::find_memory_region): New method.  Locates a
4125         memory region to be used to set a VMA or LMA address.
4126         (Output_section_definition::set_section_addresses): Add code to
4127         check for addresses set by memory regions.
4128         (Output_segment::set_section_addresses): Remove memory region
4129         walking code.
4130         (Script_sections::create_segment): Add a warning if a header
4131         segment is created outside of any region.
4132         * script-sections.h (class Script_sections): Add prototypes for
4133         find_memory_region and block_in_region methods.
4134         * testsuite/memory_test.s: Use .long instead of .word.
4135         * testsuite/memory_test.t: Add some more output sections.
4136         * testsuite/memory_test.sh: Update expected output.
4137
4138 2010-10-02  Doug Kwan  <dougkwan@google.com>
4139
4140         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4141         defintion to symtab.h
4142         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4143         declaration to defintion.
4144
4145 2010-10-01  Nick Clifton  <nickc@redhat.com>
4146
4147         * expression.cc (eval): Replace dummy argument with NULL.
4148         (eval_maybe_dot): Check for a NULL result section pointer.
4149         (Symbol_expression::value): Likewise.
4150         (Dot_expression::value): Likewise.
4151         (BINARY_EXPRESSION): Likewise.
4152         (Max_expression::value): Likewise.
4153         (Min_expression::value): Likewise.
4154         (Absolute_expression::value): Likewise.
4155         (Addr_expression::value_from_output_section): Likewise.
4156         (Loaddddr_expression::value_from_output_section): Likewise.
4157         (Segment_start_expression::value): Likewise.
4158         * script-sections.cc
4159         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4160         argument with NULL.
4161         (Sections_elememt_dot_assignment::set_section_addresses):
4162         Likewise.
4163         (Output_data_expression::do_write_to_buffer): Likewise.
4164         (Output_section_definition::finalize_symbols): Likewise.
4165         (Output_section_definition::set_section_addresses): Likewise.
4166
4167 2010-09-30  Doug Kwan  <dougkwan@google.com>
4168
4169         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4170
4171 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4172
4173         * target.h (Target::can_icf_inline_merge_sections): New virtual
4174         function.
4175         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4176         virtual function.
4177         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4178         virtual function.
4179         * icf.cc (get_section_contents): Inline merge sections only when
4180         target allows it.
4181
4182 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4183
4184         * configure: Regenerate.
4185
4186 2010-09-17  Ian Lance Taylor  <iant@google.com>
4187
4188         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4189         * testsuite/Makefile.am (memory_test.o): New target.
4190         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4191         memory_test.t.
4192         * testsuite/Makefile.in: Rebuild.
4193
4194 2010-09-17  Doug Kwan  <dougkwan@google.com>
4195
4196         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4197         defintion if relocation uses GOT entries of the symbol.
4198         * testsuite/icf_safe_test.sh: Fix test.
4199         * testsuite/icf_safe_so_test.sh: Fix test.
4200
4201 2010-09-16  Cary Coutant  <ccoutant@google.com>
4202
4203         * script_sections.cc (class Memory_region): Remove "NULL" from
4204         vector initializations.
4205
4206 2010-09-15  Cary Coutant  <ccoutant@google.com>
4207
4208         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4209         Resolve forwarding symbols.
4210
4211 2010-09-15  Doug Kwan  <dougkwan@google.com>
4212
4213         * gold/testsuite/script_test_3.t: Add ARM special sections.
4214         * gold/testsuite/script_test_4.t: Same.
4215         * gold/testsuite/script_test_5.t: Same.
4216         * gold/testsuite/script_test_6.t: Same.
4217         * gold/testsuite/script_test_7.t: Same.
4218         * gold/testsuite/script_test_7.t: Same.
4219         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4220
4221 2010-09-14  Cary Coutant  <ccoutant@google.com>
4222
4223         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4224         (Target_x86_64::Relocate::relocate_tls): Replace check for
4225         saw_tls_block_reloc_ with test for executable section.
4226
4227 2010-09-12  Cary Coutant  <ccoutant@google.com>
4228
4229         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4230         position-independent executables to shared libraries need dynamic
4231         relocations.
4232         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4233         position-independent executables.
4234         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4235         * testsuite/Makefile.in: Regenerate.
4236
4237 2010-09-10  Nick Clifton  <nickc@redhat.com>
4238
4239         PR gold/11997
4240         * testsuite/memory_test.t: Discard any sections that are not
4241         needed.
4242
4243 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4244
4245         PR gold/11996
4246         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4247         "This::" to work around a bug in gcc 4.2.
4248
4249         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4250
4251 2010-09-09  Rafael Espindola  <espindola@google.com>
4252
4253         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4254         sections with different PF_X flags in the same segment.
4255         (Layout::find_first_load_seg): Search all segments to find the first
4256         one.
4257         * options.h (rosegment): New.
4258
4259 2010-09-08  Rafael Espindola  <espindola@google.com>
4260
4261         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4262
4263 2010-09-08  Doug Kwan  <dougkwan@google.com>
4264
4265         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4266         (Arm_relobj::do_relocate_sections): Add new parameter for output
4267         file to match the parent.
4268         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4269         of local symbols instead of input values.  Update code to track
4270         changes in gold::relocate_section.
4271         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4272         (Sized_relobj::compute_final_local_value_internal): New methods.
4273         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4274         body into private version of Sized_relobj::compute_final_local_value.
4275         Call the inline method.
4276         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4277         merged symbol value if there is one.
4278         (Symbol_value::has_output_value): New method defintiion.
4279         (Sized_relobj::Compute_final_local_value_status): New enum type.
4280         (Sized_relobj::compute_final_local_value): New methods.
4281         (Sized_relobj::compute_final_local_value_internal): New methods.
4282         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4283         and arm_cortex_a8.sh.
4284         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4285         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4286         New tests.
4287         * Makefile.in: Regenerate.
4288         * testsuite/arm_bl_out_of_range.s: Update test.
4289         * testsuite/thumb_bl_out_of_range.s: Ditto.
4290         * testsuite/thumb_blx_out_of_range.s: Ditto.
4291         * testsuite/arm_branch_out_of_range.sh: New file.
4292         * testsuite/arm_cortex_a8.sh: Ditto.
4293         * testsuite/arm_cortex_a8_b.s: Ditto.
4294         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4295         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4296         * testsuite/arm_cortex_a8_bl.s: Ditto.
4297         * testsuite/arm_cortex_a8_blx.s: Ditto.
4298         * testsuite/arm_cortex_a8_local.s: Ditto.
4299         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4300         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4301
4302 2010-09-08  Rafael Espindola  <espindola@google.com>
4303
4304         * Makefile.am (memory_test.stdout): Run readelf with -W.
4305         * Makefile.in: Regenerate.
4306         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4307         64 bit output.
4308
4309 2010-09-08  Rafael Espindola  <espindola@google.com>
4310
4311         * script-sections.cc (Script_sections::add_memory_region): Convert
4312         field precision to int.
4313         * script.cc (script_set_section_region, script_set_section_region):
4314         Convert field precision to int.
4315
4316 2010-09-08  Rafael Espindola  <espindola@google.com>
4317
4318         * arm.cc (do_finalize_sections): Create the __exidx_start and
4319         __exdix_end symbols even when the section is missing.
4320
4321 2010-09-08  Nick Clifton  <nickc@redhat.com>
4322
4323         * README: Remove claim that MEMORY is not supported.
4324         * expression.cc (script_exp_function_origin)
4325         (script_exp_function_length): Move from here to ...
4326         * script.cc: ... here.
4327         (script_set_section_region, script_add_memory)
4328         (script_parse_memory_attr, script_include_directive): New
4329         functions.
4330         * script-sections.cc
4331         (class Memory_region): New class.
4332         (class Output_section_definition): Add set_memory_region,
4333         set_section_vma, set_section_lma and get_section_name methods.
4334         (class Script_Sections): Add add_memory_region,
4335         find_memory_region, find_memory_region_origin,
4336         find_memory_region_length and set_memory_region methods.
4337         Have set_section_addresses method walk the list of set memory
4338         regions.
4339         Extend the print methos to display memory regions.
4340         * script-sections.h: Add prototypes for new methods.
4341         Add enum for MEMORY region attributes.
4342         * yyscript.y: Add support for parsing MEMORY regions.
4343         * script-c.h: Add prototypes for new functions.
4344         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4345         * testsuite/Makefile.in: Regenerate.
4346         * testsuite/memory_test.sh: New script.
4347         * testsuite/memory_test.s: New assembler source file.
4348         * testsuite/memory_test.t: New linker script.
4349
4350 2010-08-27  Doug Kwan  <dougkwan@google.com>
4351
4352         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4353         reference override an existing dynamic weak reference.
4354         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4355         * testsuite/Makefile.in: Regenerate.
4356         * testsuite/dyn_weak_ref.sh: New file.
4357         * testsuite/dyn_weak_ref_1.c: Ditto.
4358         * testsuite/dyn_weak_ref_2.c: Ditto.
4359
4360 2010-08-27  Ian Lance Taylor  <iant@google.com>
4361
4362         * incremental.h (class Incremental_input_entry): Add virtual
4363         destructor.
4364
4365 2010-08-27  Ian Lance Taylor  <iant@google.com>
4366
4367         * testsuite/start_lib_test_3.c: Mark t3 as used.
4368
4369 2010-08-27  Nick Clifton  <nickc@redhat.com>
4370
4371         * options.cc (version_script): Fix small typo in previous
4372         whitespace tidyup.
4373
4374 2010-08-25  Nick Clifton  <nickc@redhat.com>
4375
4376         * archive.cc: Formatting fixes: Remove whitespace between
4377         typename and following asterisk.  Remove whitespace between
4378         function name and opening parenthesis.
4379         * archive.h: Likewise.
4380         * arm.cc: Likewise.
4381         * attributes.cc: Likewise.
4382         * attributes.h: Likewise.
4383         * common.cc: Likewise.
4384         * copy-relocs.cc: Likewise.
4385         * dirsearch.h: Likewise.
4386         * dynobj.cc: Likewise.
4387         * ehframe.cc: Likewise.
4388         * ehframe.h: Likewise.
4389         * expression.cc: Likewise.
4390         * fileread.cc: Likewise.
4391         * fileread.h: Likewise.
4392         * gc.h: Likewise.
4393         * gold-threads.cc: Likewise.
4394         * gold.cc: Likewise.
4395         * i386.cc: Likewise.
4396         * icf.h: Likewise.
4397         * incremental-dump.cc: Likewise.
4398         * incremental.cc: Likewise.
4399         * layout.cc: Likewise.
4400         * layout.h: Likewise.
4401         * main.cc: Likewise.
4402         * merge.cc: Likewise.
4403         * merge.h: Likewise.
4404         * object.cc: Likewise.
4405         * object.h: Likewise.
4406         * options.cc: Likewise.
4407         * options.h: Likewise.
4408         * output.cc: Likewise.
4409         * output.h: Likewise.
4410         * plugin.cc: Likewise.
4411         * plugin.h: Likewise.
4412         * powerpc.cc: Likewise.
4413         * reloc.cc: Likewise.
4414         * script-c.h: Likewise.
4415         * script-sections.cc: Likewise.
4416         * script.cc: Likewise.
4417         * stringpool.cc: Likewise.
4418         * symtab.cc: Likewise.
4419         * symtab.h: Likewise.
4420         * target.cc: Likewise.
4421         * timer.cc: Likewise.
4422         * timer.h: Likewise.
4423         * version.cc: Likewise.
4424         * x86_64.cc: Likewise.
4425
4426 2010-08-24  Nick Clifton  <nickc@redhat.com>
4427
4428         PR 11899
4429         * layout.cc (segment_precedes): Sort segments by their physical
4430         addresses, if they have been set.
4431
4432 2010-08-23  Cary Coutant  <ccoutant@google.com>
4433
4434         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4435         symbols data.
4436         (Lib_group::include_member): Unlock object after deleting its
4437         symbols data.
4438         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4439         the bug fixed here.
4440
4441 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4442             Cary Coutant  <ccoutant@google.com>
4443
4444         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4445         constructor, and set_blocker.
4446         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4447         readsyms_blocker_.
4448         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4449         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4450         * testsuite/Makefile.am (start_lib_test): New test case.
4451         * testsuite/Makefile.in: Regenerate.
4452         * testsuite/start_lib_test_main.c: New file.
4453         * testsuite/start_lib_test_1.c: New file.
4454         * testsuite/start_lib_test_2.c: New file.
4455         * testsuite/start_lib_test_3.c: New file.
4456
4457 2010-08-19  Ian Lance Taylor  <iant@google.com>
4458
4459         * Makefile.in: Rebuild with automake 1.11.1.
4460         * aclocal.m4: Likewise.
4461         * testsuite/Makefile.in: Likewise.
4462
4463 2010-08-19  Ian Lance Taylor  <iant@google.com>
4464
4465         PR 10893
4466         * i386.cc (class Output_data_plt_i386): Update declarations.
4467         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4468         local_ifuncs_ fields.
4469         (Target_i386::do_plt_section_for_global): New function.
4470         (Target_i386::do_plt_section_for_local): New function.
4471         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4472         parameter; change all callers.  Initialize global_ifuncs_ and
4473         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4474         __rel_iplt_end.
4475         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4476         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4477         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4478         symbols.
4479         (Target_i386::make_plt_section): New function, broken out of
4480         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4481         (Target_i386::make_plt_entry): Call make_plt_section.
4482         (Target_i386::make_local_ifunc_plt_entry): New function.
4483         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4484         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4485         R_386_IRELATIVE to switch.
4486         (Target_i386::Scan::global): Likewise.
4487         (Target_i386::Relocate::relocate): Likewise.
4488         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4489         switch.
4490         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4491         (Target_x86_64::do_plt_section_for_global): New function.
4492         (Target_x86_64::do_plt_section_for_local): New function.
4493         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4494         parameter; change all callers.  If doing a static link define
4495         __rela_iplt_start and __rela_iplt_end.
4496         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4497         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4498         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4499         to point to .plt.
4500         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4501         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4502         switch.
4503         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4504         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4505         R_X86_64_IRELATIVE to switch.
4506         (Target_x86_64::Scan::global): Likewise.
4507         (Target_x86_64::Relocate::relocate): Likewise.
4508         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4509         switch.
4510         * target.h (class Target): Add plt_section_for_global and
4511         plt_section_for_local functions.  Add do_plt_section_for_global
4512         and do_plt_section_for_local virtual functions.
4513         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4514         clarifying comments.
4515         (Symbol::use_plt_offset): Handle IFUNC symbol.
4516         * object.cc (Sized_relobj::Sized_relobj): Initialize
4517         local_plt_offsets_.
4518         (Sized_relobj::local_has_plt_offset): New function.
4519         (Sized_relobj::local_plt_offset): New function.
4520         (Sized_relobj::set_local_plt_offset): New function.
4521         (Sized_relobj::do_count): Handle IFUNC symbol.
4522         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4523         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4524         is_ifunc_symbol functions.
4525         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4526         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4527         local_plt_offsets_ field.
4528         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4529         * output.h (class Output_section_data): Add non-const
4530         output_section function.
4531         (class Output_data_got): Update declarations.
4532         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4533         Add use_plt_offset parameter to global and local constructors.
4534         Change all callers.  Change local_sym_index_ field to 31 bits.
4535         Change GSYM_CODE and CONSTANT_CODE accordingly.
4536         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4537         doing a static link don't set sh_link field.
4538         (Output_data_got::Got_entry::write): Use PLT offset if
4539         appropriate.
4540         (Output_data_got::add_global_plt): New function.
4541         (Output_data_got::add_local_plt): New function.
4542         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4543         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4544         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4545         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4546         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4547         IFUNC conditional.
4548         * testsuite/ifunc-sel.h: New file.
4549         * testsuite/ifuncmain1.c: New file.
4550         * testsuite/ifuncmain1vis.c: New file.
4551         * testsuite/ifuncmod1.c: New file.
4552         * testsuite/ifuncdep2.c: New file.
4553         * testsuite/ifuncmain2.c: New file.
4554         * testsuite/ifuncmain3.c: New file.
4555         * testsuite/ifuncmod3.c: New file.
4556         * testsuite/ifuncmain4.c: New file.
4557         * testsuite/ifuncmain5.c: New file.
4558         * testsuite/ifuncmod5.c: New file.
4559         * testsuite/ifuncmain6pie.c: New file.
4560         * testsuite/ifuncmod6.c: New file.
4561         * testsuite/ifuncmain7.c: New file.
4562         * configure, testsuite/Makefile.in: Rebuild.
4563
4564 2010-08-18  Ian Lance Taylor  <iant@google.com>
4565
4566         * incremental.cc
4567         (Output_section_incremental_inputs::write_input_files): Add cast
4568         to avoid signed/unsigned comparison warning.
4569         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4570
4571 2010-08-12  Cary Coutant  <ccoutant@google.com>
4572
4573         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4574
4575 2010-08-13  Ian Lance Taylor  <iant@google.com>
4576
4577         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4578
4579 2010-08-12  Cary Coutant  <ccoutant@google.com>
4580             Doug Kwan  <dougkwan@google.com>
4581
4582         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4583         defintion overrides non-weak undef, remember that the original undef
4584         is not weak.
4585         * symtab.cc (Symbol_table::sized_write_global): For undef without
4586         an original weak binding, set binding to global in output.
4587         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4588         * testsuite/Makefile.in: Regenerate.
4589         * testsuite/strong_ref_weak_def.sh: New file.
4590         * testsuite/strong_ref_weak_def_1.c: Ditto.
4591         * testsuite/strong_ref_weak_def_2.c: Ditto.
4592
4593 2010-08-12  Cary Coutant  <ccoutant@google.com>
4594
4595         * testsuite/incremental_test.sh: Rewrite.
4596         * testsuite/incremental_test_1.c: Rewrite.
4597         * testsuite/incremental_test_2.c: Rewrite.
4598
4599 2010-08-12  Cary Coutant  <ccoutant@google.com>
4600
4601         * arm.cc (Target_arm::got_size): Add const.
4602         (Target_arm::got_entry_count): New function.
4603         (Target_arm::plt_entry_count): New function.
4604         (Target_arm::first_plt_entry_offset): New function.
4605         (Target_arm::plt_entry_size): New function.
4606         (Output_data_plt_arm::entry_count): New function.
4607         (Output_data_plt_arm::first_plt_entry_offset): New function.
4608         (Output_data_plt_arm::get_plt_entry_size): New function.
4609         * i386.cc (Target_i386::got_size): Add const.
4610         (Target_i386::got_entry_count): New function.
4611         (Target_i386::plt_entry_count): New function.
4612         (Target_i386::first_plt_entry_offset): New function.
4613         (Target_i386::plt_entry_size): New function.
4614         (Output_data_plt_i386::entry_count): New function.
4615         (Output_data_plt_i386::first_plt_entry_offset): New function.
4616         (Output_data_plt_i386::get_plt_entry_size): New function.
4617         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4618         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4619         * incremental.cc: Include target.h.
4620         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4621         parameter.  Adjust all callers.  Find incremental_got_plt section.
4622         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4623         section.
4624         (Output_section_incremental_inputs::set_final_data_size): Calculate
4625         size of incremental_got_plt section.
4626         (Output_section_incremental_inputs::do_write): Write the
4627         incremental_got_plt section.
4628         (Got_plt_view_info): New struct.
4629         (Local_got_offset_visitor): New class.
4630         (Global_got_offset_visitor): New class.
4631         (Global_symbol_visitor_got_plt): New class.
4632         (Output_section_incremental_inputs::write_got_plt): New function.
4633         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4634         Add parameter.  Adjust all callers.
4635         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4636         (Incremental_inputs::got_plt_section): New function.
4637         (Incremental_inputs::got_plt_section_): New data member.
4638         (Incremental_got_plt_reader): New class.
4639         * layout.cc (Layout::create_incremental_info_sections): Add the
4640         incremental_got_plt section.
4641         * object.h (Got_offset_list::get_list): New function.
4642         (Got offset_list::for_all_got_offsets): New function.
4643         (Sized_relobj::local_got_offset_list): New function.
4644         * powerpc.cc (Target_powerpc::got_size): Add const.
4645         (Target_powerpc::got_entry_count): New function.
4646         (Target_powerpc::plt_entry_count): New function.
4647         (Target_powerpc::first_plt_entry_offset): New function.
4648         (Target_powerpc::plt_entry_size): New function.
4649         (Output_data_plt_powerpc::entry_count): New function.
4650         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4651         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4652         * sparc.cc (Target_sparc::got_size): Add const.
4653         (Target_sparc::got_entry_count): New function.
4654         (Target_sparc::plt_entry_count): New function.
4655         (Target_sparc::first_plt_entry_offset): New function.
4656         (Target_sparc::plt_entry_size): New function.
4657         (Output_data_plt_sparc::entry_count): New function.
4658         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4659         (Output_data_plt_sparc::get_plt_entry_size): New function.
4660         * symtab.h (Symbol::got_offset_list): New function.
4661         (Symbol_table::for_all_symbols): New function.
4662         * target.h (Sized_target::got_entry_count): New function.
4663         (Sized_target::plt_entry_count): New function.
4664         (Sized_target::plt_entry_size): New function.
4665         * x86_64.cc (Target_x86_64::got_size): Add const.
4666         (Target_x86_64::got_entry_count): New function.
4667         (Target_x86_64::plt_entry_count): New function.
4668         (Target_x86_64::first_plt_entry_offset): New function.
4669         (Target_x86_64::plt_entry_size): New function.
4670         (Output_data_plt_x86_64::entry_count): New function.
4671         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4672         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4673
4674 2010-08-12  Cary Coutant  <ccoutant@google.com>
4675
4676         * archive.cc: Include incremental.h.
4677         (Archive::Archive): Initialize incremental_info_.
4678         (Archive::include_member): Record archive members in incremental info.
4679         (Add_archive_symbols::run): Record begin and end of an archive in
4680         incremental info.
4681         (Lib_group::include_member): Record objects in incremental info.
4682         * archive.h (Incremental_archive_entry): Forward declaration.
4683         (Archive::set_incremental_info): New member function.
4684         (Archive::incremental_info): New member function.
4685         (Archive::Unused_symbol_iterator): New class.
4686         (Archive::unused_symbols_begin): New member function.
4687         (Archive::unused_symbols_end): New member function.
4688         (Archive::incremental_info_): New data member.
4689         * incremental-dump.cc (find_input_containing_global): New function.
4690         (dump_incremental_inputs): Dump new incremental info sections.
4691         * incremental.cc: Include symtab.h.
4692         (Output_section_incremental_inputs): New class.
4693         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4694         new incremental info sections.
4695         (Sized_incremental_binary::do_check_inputs): Likewise.
4696         (Incremental_inputs::report_archive): Remove.
4697         (Incremental_inputs::report_archive_begin): New function.
4698         (Incremental_inputs::report_archive_end): New function.
4699         (Incremental_inputs::report_object): New function.
4700         (Incremental_inputs::finalize_inputs): Remove.
4701         (Incremental_inputs::report_input_section): New function.
4702         (Incremental_inputs::report_script): Rewrite.
4703         (Incremental_inputs::finalize): Do nothing but finalize string table.
4704         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4705         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4706         (Incremental_inputs::create_data_sections): New function.
4707         (Incremental_inputs::relocs_entsize): New function.
4708         (Output_section_incremental_inputs::set_final_data_size): New function.
4709         (Output_section_incremental_inputs::do_write): New function.
4710         (Output_section_incremental_inputs::write_header): New function.
4711         (Output_section_incremental_inputs::write_input_files): New function.
4712         (Output_section_incremental_inputs::write_info_blocks): New function.
4713         (Output_section_incremental_inputs::write_symtab): New function.
4714         * incremental.h (Incremental_script_entry): Forward declaration.
4715         (Incremental_object_entry): Forward declaration.
4716         (Incremental_archive_entry): Forward declaration.
4717         (Incremental_inputs): Forward declaration.
4718         (Incremental_inputs_header_data): Remove.
4719         (Incremental_inputs_header): Remove.
4720         (Incremental_inputs_header_write): Remove.
4721         (Incremental_inputs_entry_data): Remove.
4722         (Incremental_inputs_entry): Remove.
4723         (Incremental_inputs_entry_write): Remove.
4724         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4725         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4726         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4727         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4728         Likewise.
4729         (Incremental_input_entry): New class.
4730         (Incremental_script_entry): New class.
4731         (Incremental_object_entry): New class.
4732         (Incremental_archive_entry): New class.
4733         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4734         (Incremental_inputs::report_inputs): Remove.
4735         (Incremental_inputs::report_archive): Remove.
4736         (Incremental_inputs::report_archive_begin): New function.
4737         (Incremental_inputs::report_archive_end): New function.
4738         (Incremental_inputs::report_object): Change prototype.
4739         (Incremental_inputs::report_input_section): New function.
4740         (Incremental_inputs::report_script): Change prototype.
4741         (Incremental_inputs::get_reloc_count): New function.
4742         (Incremental_inputs::set_reloc_count): New function.
4743         (Incremental_inputs::create_data_sections): New function.
4744         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4745         (Incremental_inputs::inputs_section): New function.
4746         (Incremental_inputs::symtab_section): New function.
4747         (Incremental_inputs::relocs_section): New function.
4748         (Incremental_inputs::get_stringpool): Add const.
4749         (Incremental_inputs::command_line): Add const.
4750         (Incremental_inputs::inputs): Remove.
4751         (Incremental_inputs::command_line_key): New function.
4752         (Incremental_inputs::input_file_count): New function.
4753         (Incremental_inputs::input_files): New function.
4754         (Incremental_inputs::relocs_entsize): New function.
4755         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4756         (Incremental_inputs::finalize_inputs): Remove.
4757         (Incremental_inputs::Input_info): Remove.
4758         (Incremental_inputs::lock_): Remove.
4759         (Incremental_inputs::inputs_): Change type.
4760         (Incremental_inputs::inputs_map_): Remove.
4761         (Incremental_inputs::current_object_entry_): New data member.
4762         (Incremental_inputs::inputs_section_): New data member.
4763         (Incremental_inputs::symtab_section_): New data member.
4764         (Incremental_inputs::relocs_section_): New data member.
4765         (Incremental_inputs::reloc_count_): New data member.
4766         (Incremental_inputs_reader): New class.
4767         (Incremental_symtab_reader): New class.
4768         (Incremental_relocs_reader): New class.
4769         * layout.cc (Layout::finalize): Move finalization of incremental info
4770         and creation of incremental info sections to follow finalization of
4771         symbol table.  Set offsets for postprocessing sections.
4772         (Layout::create_incremental_info_sections): Call
4773         Incremental_inputs::create_data_sections.  Add incremental symtab
4774         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4775         sections to layout after input sections.
4776         * layout.h (struct Timespec): Forward declaration.
4777         (Layout::incremental_inputs): Add const.
4778         (Layout::create_incremental_info_sections): Add parameter.
4779         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4780         * object.cc: Include incremental.h.
4781         (Relobj::finalize_incremental_relocs): New function.
4782         (Sized_relobj::do_layout): Record input sections in incremental info.
4783         * object.h (Object::output_section): New function.
4784         (Object::output_section_offset): Moved from Relobj.
4785         (Object::get_incremental_reloc_base): New function.
4786         (Object::get_incremental_reloc_count): New function.
4787         (Object::do_output_section): New function.
4788         (Object::do_output_section_offset): Moved from Relobj.
4789         (Object::do_get_incremental_reloc_base): New function.
4790         (Object::do_get_incremental_reloc_count): New function.
4791         (Object::Object): Initialize new data members.
4792         (Relobj::output_section): Renamed do_output_section and moved to
4793         protected.
4794         (Relobj::output_section_offset): Moved to Object.
4795         (Relobj::do_get_incremental_reloc_base): New function.
4796         (Relobj::do_get_incremental_reloc_count): New function.
4797         (Relobj::allocate_incremental_reloc_counts): New function.
4798         (Relobj::count_incremental_reloc): New function.
4799         (Relobj::finalize_incremental_relocs): New function.
4800         (Relobj::next_incremental_reloc_index): New function.
4801         (Relobj::reloc_counts_): New data member.
4802         (Relobj::reloc_bases_): New data member.
4803         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4804         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4805         (Sized_relobj::incremental_relocs_scan): New function.
4806         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4807         (Sized_relobj::incremental_relocs_write): New function.
4808         (Sized_relobj::incremental_relocs_write_reltype): New function.
4809         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4810         incremental link.
4811         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4812         archives and object files elsewhere.
4813         (Add_symbols::run): Report object files here.
4814         (Finish_group::run): Report end of archive at end of group.
4815         * reloc.cc: Include layout.h, incremental.h.
4816         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4817         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4818         (Sized_relobj::incremental_relocs_scan): New function.
4819         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4820         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4821         (Sized_relobj::incremental_relocs_write): New function.
4822         (Sized_relobj::incremental_relocs_write_reltype): New function.
4823         * script.cc (read_input_script): Rewrite test for incremental link.
4824         Change call to Incremental_inputs::report_script.
4825         * symtab.h (Symbol_table::first_global_index): New function.
4826         (Symbol_table::output_count): New function.
4827
4828 2010-08-12  Doug Kwan  <dougkwan@google.com>
4829
4830         * arm.cc (Target_arm::merge_object_attributes): Check command line
4831         options --no-wchar-size-warning and --no-enum-size-warning.
4832         * options.h (General_options): Add ld-compatible options
4833         --no-enum-size-warning and --no-wchar-size-warning.
4834
4835 2010-08-04  Ian Lance Taylor  <iant@google.com>
4836
4837         * x86_64.cc (Target_x86_64::Scan::local): Use
4838         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4839         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4840         (Target_x86_64::Scan::global): Likewise.
4841         (Target_x86_64::Relocate::relocate): Likewise.
4842         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4843         Likewise.
4844
4845 2010-08-03  Cary Coutant  <ccoutant@google.com>
4846
4847         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4848         to reserve space in merged_strings vector. Keep total input size
4849         for stats.
4850         (Output_merge_string::do_print_merge_stats): Print total input size.
4851         * merge.h (Output_merge_string): Add input_size_ field.
4852         * stringpool.cc (Stringpool_template::string_length): Move
4853         implementations out of Stringpool_template class and place in
4854         stringpool.h.
4855         * stringpool.h (string_length): Move out of Stringpool_template.
4856
4857 2010-08-03  Ian Lance Taylor  <iant@google.com>
4858
4859         PR 11712
4860         * layout.cc (relaxation_loop_body): If address of load segment is
4861         set, adjust address to include headers if possible.
4862
4863 2010-08-03  Ian Lance Taylor  <iant@google.com>
4864
4865         * version.cc (version_string): Bump to 1.10.
4866
4867 2010-08-03  Ian Lance Taylor  <iant@google.com>
4868
4869         PR 11805
4870         * layout.h (enum Output_section_order): Define.
4871         (class Layout): Update declarations.
4872         * layout.cc (Layout::get_output_section): Add order parameter.
4873         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4874         is_first_non_relro parameters.  Change all callers.
4875         (Layout::choose_output_section): Likewise.
4876         (Layout::add_output_section_data): Likewise.
4877         (Layout::make_output_section): Likewise.  Set order.
4878         (Layout::default_section_order): New function.
4879         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4880         * output.cc (Output_section::Output_section): Initialize order_.
4881         Don't initialize deleted fields.
4882         (Output_segment::Output_segment): Don't initialize deleted
4883         fields.
4884         (Output_segment::add_output_section_to_load): New function
4885         replacing add_output_section.  Change all callers to call this or
4886         add_output_section_to_nonload.
4887         (Output_segment::add_output_section_to_nonload): New function.
4888         (Output_segment::remove_output_section): Rewrite.
4889         (Output_segment::add_initial_output_data): Likewise.
4890         (Output_segment::has_any_data_sections): Likewise.
4891         (Output_segment::is_first_section_relro): Likewise.
4892         (Output_segment::maximum_alignment): Likewise.
4893         (Output_segment::has_dynamic_reloc): New function replacing
4894         dynamic_reloc_count.  Change all callers.
4895         (Output_segment::has_dynamic_reloc_list): New function replacing
4896         dynamic_reloc_count_list.  Change all callers.
4897         (Output_segment::set_section_addresses): Rewrite.
4898         (Output_segment::set_offset): Rewrite.
4899         (Output_segment::find_first_and_last_list): Remove.
4900         (Output_segment::set_tls_offsets): Rewrite.
4901         (Output_segment::first_section_load_address): Likewise.
4902         (Output_segment::output_section_count): Likewise.
4903         (Output_segment::section_with_lowest_load_address): Likewise.
4904         (Output_segment::write_section_headers): Likewise.
4905         (Output_segment::print_sections_to_map): Likewise.
4906         * output.h (class Output_data): Remove dynamic_reloc_count_
4907         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4908         (Output_data::add_dynamic_reloc): Rewrite.
4909         (Output_data::has_dynamic_reloc): New function.
4910         (Output_data::dynamic_reloc_count): Remove.
4911         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4912         is_last_relro_, is_first_non_relro_, is_interp_,
4913         is_dynamic_linker_section_ fields.  Add order and set_order
4914         functions.  Remove is_relro_local, set_is_relro_local,
4915         is_last_relro, set_is_last_relro, is_first_non_relro,
4916         set_is_first_non_relro functions, is_interp, set_is_interp,
4917         is_dynamic_linker_section, and set_is_dynamic_linker_section
4918         functions.
4919         (class Output_segment): Change Output_data_list from std::list to
4920         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4921         output_bss_ fields.  Update declarations.
4922
4923 2010-08-02  Ian Lance Taylor  <iant@google.com>
4924
4925         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4926         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4927         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4928
4929 2010-08-02  Ian Lance Taylor  <iant@google.com>
4930
4931         PR 11855
4932         * script.cc (Script_options::Script_options): Initialize
4933         symbol_definitions_ and symbol_references_.
4934         (Script_options::add_symbol_assignment): Update
4935         symbol_definitions_ and symbol_references_.
4936         (Script_options::add_symbol_reference): New function.
4937         (script_symbol): New function.
4938         * script.h (class Script_options): Add symbol_definitions_ and
4939         symbol_references_ fields.
4940         (Script_options::referenced_const_iterator): New type.
4941         (Script_options::referenced_begin): New function.
4942         (Script_options::referenced_end): New function.
4943         (Script_options::is_referenced): New function.
4944         (Script_options::any_unreferenced): New function.
4945         * script-c.h (script_symbol): Declare.
4946         * yyscript.y (exp): Call script_symbol.
4947         * symtab.cc: Include "script.h".
4948         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4949         Change all callers.  Check symbols referenced by scripts.
4950         (Symbol_table::add_undefined_symbols_from_command_line): Add
4951         layout parameter.  Change all callers.
4952         (Symbol_table::do_add_undefined_symbols_from_command_line):
4953         Likewise.  Break out loop body.  Check symbols referenced by
4954         scripts.
4955         (Symbol_table::add_undefined_symbol_from_command_line): New
4956         function broken out of
4957         do_add_undefined_symbols_from_command_line.
4958         * symtab.h (class Symbol_table): Update declarations.
4959         * archive.cc: Include "layout.h".
4960         (Archive::should_include_member): Add layout parameter.  Change
4961         all callers.  Check for symbol mentioned in expression.
4962         * archive.h (class Archive): Update declaration.
4963         * object.cc (Sized_relobj::do_should_include_member): Add layout
4964         parameter.
4965         * object.h (Object::should_include_member): Add layout parameter.
4966         Change all callers.
4967         (Object::do_should_include_member): Add layout parameter.
4968         (class Sized_relobj): Update declaration.
4969         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4970         parameter.
4971         * dynobj.h (class Sized_dynobj): Update declaration.
4972         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4973         layout parameter.
4974         * plugin.h (class Sized_pluginobj): Update declaration.
4975
4976 2010-08-02  Ian Lance Taylor  <iant@google.com>
4977
4978         PR 11866
4979         * output.cc (Output_segment::set_offset): Search for the first and
4980         last sections rather than assuming that the list is in order.
4981         (Output_segment::find_first_and_last_list): New function.
4982         * output.h (class Output_segment): Update declarations.
4983         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4984         (relro_strip_test_SOURCES): New variable.
4985         (relro_strip_test_DEPENDENCIES): New variable.
4986         (relro_strip_test_LDFLAGS): New variable.
4987         (relro_strip_test_LDADD): New variable.
4988         (relro_strip_test.so): New target.
4989
4990 2010-08-02  Ian Lance Taylor  <iant@google.com>
4991
4992         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4993         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4994         (Target_i386::got_tlsdesc_section): New function.
4995         (Target_i386::got_section): Create space for GOT entries for
4996         TLSDESC relocations.
4997         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4998         R_386_TLS_GOTDESC.
4999         (Target_i386::Scan::global): Likewise.
5000         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5001         using TLSDESC GOT.
5002         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5003         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5004         (Target_x86_64::got_tlsdesc_section): New function.
5005         (Target_x86_64::got_section): Create space for GOT entries for
5006         TLSDESC relocations.
5007         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5008         R_386_TLS_GOTDESC.
5009         (Target_x86_64::Scan::global): Likewise.
5010         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5011         using TLSDESC GOT.
5012
5013 2010-08-02  Ian Lance Taylor  <iant@google.com>
5014
5015         * testsuite/final_layout.sh: Use dc to convert from hex to
5016         decimal.
5017
5018 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5019
5020         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5021         paramter to the call to gold::gc_process_relocs.
5022         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5023         paramter to the call to gold::gc_process_relocs.
5024         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5025         parameter to the call to gold::gc_process_relocs.
5026         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5027         template parameter to the call to gold::gc_process_relocs.
5028         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5029         paramter to the call to gold::gc_process_relocs.
5030         * gc.h (get_embedded_addend_size): New function.
5031         (gc_process_relocs): Save the size of the reloc for use by ICF.
5032         * icf.cc (get_section_contents): Get the addend from the text section
5033         for SHT_REL relocation sections.
5034         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5035         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5036         * int_encoding.h (read_from_pointer): New overloaded function.
5037         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5038         * testsuite/icf_sht_rel_addend_test.sh: New file.
5039         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5040         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5041
5042 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5043
5044         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5045         * Makefile.in: Regenerate.
5046         * testsuite/Makefile.in: Regenerate.
5047
5048 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5049
5050         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5051         * gold/testsuite/debug_msg.cc: Likewise.
5052         * gold/testsuite/odr_violation1.cc
5053         * gold/testsuite/odr_violation2.cc
5054
5055 2010-07-21  Cary Coutant  <ccoutant@google.com>
5056
5057         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5058         string, and length fields.
5059         (Output_merge_string::Merged_strings_list): New type.
5060         (Output_merge_string::Merged_strings_lists): New typedef.
5061         (Output_merge_string): Replace merged_strings_ with
5062         merged_strings_lists_.
5063         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5064         Merged_strings_list per input object and section.  Don't store pointer
5065         to the string.  Don't store length with each merged string entry.
5066         (Output_merge_string::finalize_merged_data): Loop over list of merged
5067         strings lists.  Recompute length of each merged string.
5068
5069 2010-07-15  Cary Coutant  <ccoutant@google.com>
5070
5071         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5072         here.
5073
5074 2010-07-14  Ian Lance Taylor  <iant@google.com>
5075
5076         * descriptors.cc (Descriptors::open): Report correct name in error
5077         message.
5078
5079 2010-07-13  Doug Kwan  <dougkwan@google.com>
5080
5081         * arm.cc (Arm_input_section::Arm_input_section): For a
5082         SHT_ARM_EXIDX section, always keeps the input sections.
5083         (Arm_input_section::set_exidx_section_link): New method.
5084         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5085         has_errors_ to false.
5086         (Arm_exidx_input_section::has_errors,
5087         Arm_exidx_input_section::set_has_errors): New methods.
5088         (Arm_exidx_input_section::has_errors_): New data member.
5089         (Arm_relobj::get_exidx_shndx_list): New method.
5090         (Arm_output_section::append_text_sections_to_list): Do not skip
5091         section without SHF_EXECINSTR.
5092         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5093         errors.
5094         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5095         section header.  Make error messages more verbose.  Check for
5096         a non-executable section linked to an EXIDX section.
5097         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5098         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5099         check that there is no deferred EXIDX section if we exit early.
5100         Instead of not making an EXIDX section in case of an error, make one
5101         and set the has_errors flag of it.
5102         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5103         in a relocatable link.
5104         (Target_arm::do_relax): Look for the EXIDX output section instead of
5105         assuming that it is called .ARM.exidx.
5106         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5107         section list.  Do not check for SHF_EXECINSTR section flags but
5108         skip any input section with errors.
5109         * output.cc (Output_section::Output_section): Initialize
5110         always_keeps_input_sections_ to false.
5111         (Output_section::add_input_section): Check for
5112         always_keeps_input_sections_.
5113         *  output.h (Output_section::always_keeps_input_sections,
5114         Output_section::set_always_keeps_input_sections): New methods.
5115         (Output_section::always_keeps_input_sections): New data member.
5116
5117 2010-07-13  Rafael Espindola  <espindola@google.com>
5118
5119         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5120         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5121
5122 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5123             Ian Lance Taylor  <iant@google.com>
5124
5125         * output.h (Output_section_lookup_maps::add_merge_section):
5126         Correct check of whether value was inserted.
5127         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5128         (Output_section_lookup_maps::add_relaxed_input_section):
5129         Likewise.
5130         * arm.cc (Target_arm::got_section): Remove used local os.
5131         * i386.cc (Target_i386::got_section): Likewise.
5132         * x86_64.cc (Target_x86_64::got_section): Likewise.
5133         * sparc.cc (Target_sparc::got_section): Likewise.
5134         (Target_sparc::relocate): Remove unused local have_got_offset.
5135         * powerpc.cc (Target_powerpc::relocate): Likewise.
5136
5137 2010-07-13  Ian Lance Taylor  <iant@google.com>
5138
5139         * compressed_output.cc (zlib_decompress): Fix signature in
5140         !HAVE_ZLIB_H case.
5141
5142         * archive.cc (Archive::include_member): Unlock an external member
5143         of a thin archive.  Don't bother to delete an object we know is
5144         NULL.
5145
5146 2010-07-12  Cary Coutant  <ccoutant@google.com>
5147
5148         * compressed_output.cc (zlib_decompress): New function.
5149         (get_uncompressed_size): New function.
5150         (decompress_input_section): New function.
5151         * compressed_output.h (get_uncompressed_size): New function.
5152         (decompress_input_section): New function.
5153         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5154         Handle compressed debug sections.
5155         * layout.cc (is_compressed_debug_section): New function.
5156         (Layout::output_section_name): Map compressed section names to
5157         canonical names.
5158         * layout.h (is_compressed_debug_section): New function.
5159         (is_debug_info_section): Recognize compressed debug sections.
5160         * merge.cc: Include compressed_output.h.
5161         (Output_merge_data::do_add_input_section): Handle compressed
5162         debug sections.
5163         (Output_merge_string::do_add_input_section): Handle compressed
5164         debug sections.
5165         * object.cc: Include compressed_output.h.
5166         (Sized_relobj::Sized_relobj): Initialize new data members.
5167         (build_compressed_section_map): New function.
5168         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5169         * object.h (Object::section_is_compressed): New method.
5170         (Object::do_section_is_compressed): New method.
5171         (Sized_relobj::Compressed_section_map): New type.
5172         (Sized_relobj::do_section_is_compressed): New method.
5173         (Sized_relobj::compressed_sections_): New data member.
5174         * output.cc (Output_section::add_input_section): Handle compressed
5175         debug sections.
5176         * reloc.cc: Include compressed_output.h.
5177         (Sized_relobj::write_sections): Handle compressed debug sections.
5178
5179 2010-07-08  Cary Coutant  <ccoutant@google.com>
5180
5181         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5182         weak when resolving to a dynamic def.
5183         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5184         for weak undef/dynamic def cases. Adjust callers.
5185         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5186         undef_binding_weak_.
5187         (Symbol_table::sized_write_globals): Adjust symbol binding.
5188         (Symbol_table::sized_write_symbol): Add binding parameter.
5189         * symtab.h (Symbol::set_undef_binding): New method.
5190         (Symbol::is_undef_binding_weak): New method.
5191         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5192         (Symbol_table::should_override): Add new parameter.
5193         (Symbol_table::sized_write_symbol): Add new parameter.
5194
5195         * testsuite/weak_undef_file1.cc: Add new test case.
5196         * testsuite/weak_undef_file2.cc: Fix header comment.
5197         * testsuite/weak_undef_test.cc: Add new test case.
5198
5199 2010-06-29  Doug Kwan  <dougkwan@google.com>
5200
5201         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5202         Initialize USE_SYMBOL_.
5203         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5204         definition.
5205         (Arm_reloc_property::uses_symbol_): New data member declaration.
5206         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5207         uses symbol value and symbol is undefined but not weakly undefined.
5208
5209 2010-06-28  Rafael Espindola  <espindola@google.com>
5210
5211         * plugin.cc (Plugin::load): Use dlerror.
5212
5213 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5214
5215         * symtab.cc (detect_odr_violations): When reporting an ODR
5216         violation, report an object where the symbol is defined.
5217
5218 2010-06-25  Doug Kwan  <dougkwan@google.com>
5219
5220         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5221         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5222         definition.
5223         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5224         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5225         target hook to detect function points.
5226         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5227         * icf.h (Icf::check_section_for_function_pointers): Change type of
5228         parameter SECTION_NAME to const reference to std::string.  Use
5229         target hook to determine if section may have unsafe pointers.
5230         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5231         method definition.
5232
5233 2010-06-21  Rafael Espindola  <espindola@google.com>
5234
5235         * fileread.cc (Input_file::find_fie): New
5236         (Input_file::open): Use Input_file::find_fie.
5237         * fileread.h (Input_file::find_fie): New
5238         * plugin.cc (set_extra_library_path): New.
5239         (Plugin::load): Add set_extra_library_path to the transfer vector.
5240         (Plugin_manager::set_extra_library_path): New.
5241         (Plugin_manager::add_input_file): Use the extra search path if set.
5242         (set_extra_library_path(): New.
5243         * plugin.h (Plugin_manager): Add set_extra_library_path and
5244         extra_search_path_.
5245
5246 2010-06-19  Cary Coutant  <ccoutant@google.com>
5247
5248         * layout.cc (gdb_sections): Add .debug_types.
5249         (lines_only_debug_sections): Likewise.
5250
5251 2010-06-18  Rafael Espindola  <espindola@google.com>
5252
5253         * plugin.cc (add_input_file,add_input_library)
5254         (Plugin_manager::add_input_file): Make filename arguments const.
5255         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5256         const.
5257
5258 2010-06-16  Doug Kwan  <dougkwan@google.com>
5259
5260         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5261         .ARM.attributes section if we have not merged any input
5262         attributes sections.
5263
5264 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5265
5266         * arm.cc: Allow combining objects with no EABI version
5267         information.
5268
5269 2010-06-15  Rafael Espindola  <espindola@google.com>
5270
5271         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5272
5273 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5274
5275         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5276         (struct iovec): Correct !HAVE_READV definition.
5277
5278 2010-06-10  Cary Coutant  <ccoutant@google.com>
5279
5280         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5281         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5282         reloc sections.
5283         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5284
5285         PR 11683
5286         * symtab.h (Symbol::is_placeholder): New member function.
5287         * target-reloc.h (relocate_section): Check for placeholder symbols.
5288
5289         * testsuite/Makefile.am (plugin_test_8): New test.
5290         (plugin_test_9): New test.
5291         * testsuite/Makefile.in: Regenerate.
5292
5293 2010-06-09  Nick Clifton  <nickc@redhat.com>
5294
5295         * yyscript.y (input_list_element): Allow strings prefixed with
5296         the '-' character.  Treat these as libraries.
5297         * script.cc (script_add_library): New function.  Adds a library
5298         specified by "-l<name>" found in an input script.
5299         * script-c.h: Add prototype for script_add_library.
5300
5301 2010-06-07  Doug Kwan  <dougkwan@google.com>
5302
5303         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5304         Restrict stub-group size to be within long conditional branch
5305         range when working around cortex-A8 erratum.
5306
5307 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5308
5309         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5310         #ifdef typo.
5311
5312 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5313
5314         PR gold/11658
5315         * output.cc
5316         (Output_section::Input_section_sort_entry::compare_section_ordering):
5317         Change to return non-zero correctly.
5318         (Output_section::Input_section_sort_section_order_index_compare
5319         ::operator()): Change to fix ambiguity in comparisons.
5320
5321 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5322
5323         * gold.h (is_wildcard_string): New function.
5324         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5325         (Layout::layout_eh_frame): Ditto.
5326         (Layout::find_section_order_index): New method.
5327         (Layout::read_layout_from_file): New method.
5328         * layout.h (Layout::find_section_order_index): New method.
5329         (Layout::read_layout_from_file): New method.
5330         (Layout::input_section_position_): New private member.
5331         (Layout::input_section_glob_): New private member.
5332         * main.cc (main): Call read_layout_from_file here.
5333         * options.h (--section-ordering-file): New option.
5334         * output.cc (Output_section::input_section_order_specified_): New
5335         member.
5336         (Output_section::Output_section): Initialize new member.
5337         (Output_section::add_input_section): Add new parameter.
5338         Keep input sections when --section-ordering-file is used.
5339         (Output_section::set_final_data_size): Sort input sections when
5340         section ordering file is specified.
5341         (Output_section::Input_section_sort_entry): Add new parameter.
5342         Check sorting type.
5343         (Output_section::Input_section_sort_entry::compare_section_ordering):
5344         New method.
5345         (Output_section::Input_section_sort_compare::operator()): Change to
5346         consider section_order_index.
5347         (Output_section::Input_section_sort_init_fini_compare::operator()):
5348         Change to consider section_order_index.
5349         (Output_section::Input_section_sort_section_order_index_compare
5350         ::operator()): New method.
5351         (Output_section::sort_attached_input_sections): Change to sort
5352         according to section order when specified.
5353         (Output_section::add_input_section<32, true>): Add new parameter.
5354         (Output_section::add_input_section<64, true>): Add new parameter.
5355         (Output_section::add_input_section<32, false>): Add new parameter.
5356         (Output_section::add_input_section<64, false>): Add new parameter.
5357         * output.h (Output_section::add_input_section): Add new parameter.
5358         (Output_section::input_section_order_specified): New
5359         method.
5360         (Output_section::set_input_section_order_specified): New method.
5361         (Input_section::Input_section): Initialize section_order_index_.
5362         (Input_section::section_order_index): New method.
5363         (Input_section::set_section_order_index): New method.
5364         (Input_section::section_order_index_): New member.
5365         (Input_section::Input_section_sort_section_order_index_compare): New
5366         struct.
5367         (Output_section::input_section_order_specified_): New member.
5368         * script-sections.cc (is_wildcard_string): Delete and move modified
5369         method to gold.h.
5370         (Output_section_element_input::Output_section_element_input): Modify
5371         call to is_wildcard_string.
5372         (Output_section_element_input::Input_section_pattern
5373         ::Input_section_pattern): Ditto.
5374         (Output_section_element_input::Output_section_element_input): Ditto.
5375         * testsuite/Makefile.am (final_layout): New test case.
5376         * testsuite/Makefile.in: Regenerate.
5377         * testsuite/final_layout.cc: New file.
5378         * testsuite/final_layout.sh: New file.
5379
5380 2010-06-01  Rafael Espindola  <espindola@google.com>
5381
5382         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5383
5384 2010-06-01  Rafael Espindola  <espindola@google.com>
5385
5386         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5387         visibility of symbols.
5388
5389 2010-05-27  Doug Kwan  <dougkwan@google.com>
5390
5391         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5392         from start of output section instead of address for a local symbol
5393         in a merged or relaxed section when doing a relocatable link.
5394
5395 2010-05-26  Rafael Espindola  <espindola@google.com>
5396
5397        PR 11604
5398         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5399         adding sections the garbage collector removed.
5400         * gold/testsuite/Makefile.am: Add test.
5401         * gold/testsuite/Makefile.in: Regenerate.
5402         * gold/testsuite/plugin_test_7.sh: New.
5403         * gold/testsuite/plugin_test_7_1.c: New.
5404         * gold/testsuite/plugin_test_7_2.c: New.
5405
5406 2010-05-26  Rafael Espindola  <espindola@google.com>
5407
5408         * script-sections.cc (Output_section_definition::set_section_addresses):
5409         Check for --section-start.
5410
5411 2010-05-26  Doug Kwan  <dougkwan@google.com>
5412
5413         * arm.cc (Arm_scan_relocatable_relocs): New class.
5414         (Target_arm::relocate_special_relocatable): New method.
5415         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5416         (Arm_relocate_functions::thumb_branch_common): Same.
5417         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5418         instead of Default_scan_relocatable_relocs.
5419         * target-reloc.h (relocate_for_relocatable): Let target handle
5420         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5421         * target.h (Sized_target::relocate_special_relocatable): New method.
5422
5423 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5424
5425         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5426
5427 2010-05-23  Doug Kwan  <dougkwan@google.com>
5428
5429         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5430         instead of a cast.
5431         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5432         with a direct branch, not a conditional branch, to a stub.
5433         * merge.cc (Output_merge_base::record_input_section): New method
5434         defintion.
5435         (Output_merge_data::do_add_input_section): Record input section if
5436         keeps-input-sections flag is set.
5437         (Output_merge_string::do_add_input_section): Ditto.
5438         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5439         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5440         INPUT_SECTIONS_.
5441         (Output_merge_base::keeps_input_sections,
5442         Output_merge_base::set_keeps_input_sections,
5443         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5444         method definitions.
5445         (Output_merge_base::Input_sections): New type declaration.
5446         (Output_merge_base::input_sections_begin,
5447         Output_merge_base::input_sections_end,
5448         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5449         (Output_merge_base::bool keeps_input_sections_,
5450         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5451         Output_merge_base::input_sections_): New data members.
5452         (Output_merge_data::do_set_keeps_input_sections): New method
5453         defintion.
5454         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5455         * output.cc (Output_section::Input_section::relobj): Move method
5456         defintion from class declaration to here and handle merge sections.
5457         (Output_section::Input_section::shndx): Ditto.
5458         (Output_section::Output_section): Remove initializations of removed
5459         data members and initialize new data member LOOKUP_MAPS_.
5460         (Output_section::add_input_section): Set keeps-input-sections flag
5461         for a newly created merge output section as appropriate.  Adjust code
5462         to use Output_section_lookup_maps class.
5463         (Output_section::add_relaxed_input_section): Adjst code for lookup
5464         maps code refactoring.
5465         (Output_section::add_merge_input_section): Add a new parameter
5466         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5467         class.  If adding input section to a newly created merge output
5468         section fails, remove the new merge section.
5469         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5470         Adjust code for use of the Output_section_lookup_maps class.
5471         (Output_section::find_merge_section): Ditto.
5472         (Output_section::build_lookup_maps): New method defintion.
5473         (Output_section::find_relaxed_input_section): Adjust code to use
5474         Output_section_lookup_maps class.
5475         (Output_section::get_input_sections): Export merge sections.  Adjust
5476         code to use Output_section_lookup_maps class.
5477         (Output_section:::add_script_input_section): Adjust code to use
5478         Output_section_lookup_maps class.  Update lookup maps for merge
5479         sections also.
5480         (Output_section::discard_states): Use Output_section_lookup_maps.
5481         (Output_section::restore_states): Same.
5482         * output.h (Merge_section_properties): Move class defintion out of
5483         Output_section.
5484         (Output_section_lookup_maps): New class.
5485         (Output_section::Input_section::is_merge_section): New method
5486         defintion.
5487         (Output_section::Input_section::relobj): Move defintion out of class
5488         defintion.  Declare method only.
5489         (Output_section::Input_section::shndx): Ditto.
5490         (Output_section::Input_section::output_merge_base): New method defintion.
5491         (Output_section::Input_section::u2_.pomb): New union field.
5492         (Output_section::Merge_section_by_properties_map,
5493         Output_section::Output_section_data_by_input_section_map,
5494         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5495         Remove types.
5496         (Output_section::add_merge_input_section): Add new parameter
5497         KEEPS_INPUT_SECTIONS.
5498         (Output_section::build_lookup_maps): New method declaration.
5499         (Output_section::merge_section_map_,
5500         Output_section::merge_section_by_properties_map_,
5501         Output_section::relaxed_input_section_map_,
5502         Output_section::is_relaxed_input_section_map_valid_): Remove data
5503         members.
5504         (Output_section::lookup_maps_): New data member.
5505
5506 2010-05-21  Doug Kwan  <dougkwan@google.com>
5507
5508         PR gold/11619
5509         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5510         avoid a compilation error.
5511
5512 2010-05-19  Rafael Espindola  <espindola@google.com>
5513
5514         * script-sections.cc (Output_section_definition::allocate_to_segment):
5515         Update the phdrs_list even when the output section is NULL.
5516         * testsuite/Makefile.am: Add test.
5517         * testsuite/Makefile.in: Regenerate.
5518         * testsuite/script_test_9.cc: New.
5519         * testsuite/script_test_9.sh: New.
5520         * testsuite/script_test_9.t: New.
5521
5522 2010-05-19  Doug Kwan  <dougkwan@google.com>
5523
5524         * arm.cc (Arm_input_section::original_size): New method.
5525         (Arm_input_section::do_addralign): Add a cast.
5526         (Arm_input_section::do_output_offset): Remove static cast.
5527         (Arm_input_section::original_addralign,
5528          Arm_input_section::original_size_): Change type to uint32_t.
5529         (Arm_input_section::init): Add safe casts for section alignment
5530         and size.
5531         (Arm_input_section::set_final_data_size): Do not set address and
5532         offset of stub table.
5533         (Arm_output_section::fix_exidx_coverage): Change use of of
5534         Output_section::Simple_input_section to that of
5535         Output_section::Input_section.
5536         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5537         except for the first pass.
5538         * output.cc (Output_section::get_input_sections): Change type of
5539         input_sections to std::list<Input_section>.
5540         (Output_section::add_script_input_section): Rename from
5541         Output_section::add_simple_input_section.  Change type of SIS
5542         parameter from Simple_input_section to Input_section.
5543         * output.h (Output_section::Simple_input_section): Remove class.
5544         (Output_section::Input_section): Change class visibility to public.
5545         (Output_section::Input_section::addralign): Use stored alignments
5546         for special input sections if set.
5547         (Output_section::Input_section::set_addralign): New method.
5548         (Output_section::get_input_sections): Change parameter type from
5549         list of Simple_input_section to list of Input_section.
5550         (Output_section::add_script_input_section): Rename from
5551         Output_section::add_simple_input_section. Change first parameter's
5552         type from Simple_input_section to Input_section and remove the
5553         second and third parameters.
5554         * script-sections.cc (Input_section::Input_section_list): Change
5555         type to list of Output_section::Input_section/
5556         (Input_section_info::Input_section_info): Change parameter type of
5557         INPUT_SECTION to Output_section::Input_section.
5558         (Input_section_info::input_section): Change return type.
5559         (Input_section_info::input_section_): Change type to
5560         Output_section::Input_section.
5561         (Output_section_element_input::set_section_addresses): Adjust code
5562         to use Output_section::Input_section instead of
5563         Output_section::Simple_input_section.  Adjust code for renaming
5564         of Output_section::add_simple_input_section.
5565         (Orphan_output_section::set_section_addresses): Ditto.
5566
5567 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5568
5569         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5570         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5571
5572 2010-05-18  Rafael Espindola  <espindola@google.com>
5573
5574         * options.cc (General_options::finalize): Handle -nostdlib.
5575         * options.h (nostdlib): New option.
5576         * script.cc (script_add_search_dir): Handle -nostdlib.
5577
5578 2010-05-12  Doug Kwan  <dougkwan@google.com>
5579
5580         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5581         attributes section only if there no attributes section after merging.
5582         (Target_arm::merge_object_attributes): Move value of
5583         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5584         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5585         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5586         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5587         and arm_attr_merge_7.stdout.
5588         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5589         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5590         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5591         arm_attr_merge_7b.o): New rules.
5592         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5593         arm_attr_merge_7
5594         * testsuite/Makefile.in: Regenerate.
5595         * testsuite/arm_attr_merge.sh: New file.
5596         * testsuite/arm_attr_merge_[67][ab].s: Same.
5597
5598 2010-05-05  Nick Clifton  <nickc@redhat.com>
5599
5600         * po/es.po: Updated Spanish translation.
5601
5602 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5603
5604         * Makefile.am (install-exec-local): Properly install gold as
5605         default cross linker.
5606         * Makefile.in: Regenerated.
5607
5608 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5609             Nick Clifton  <nickc@redhat.com>
5610
5611         * configure.ac (install_as_default): Define and set to false
5612         unless --enable-gold or --enable-gold=both/gold has been
5613         specified.
5614         * configure: Regenerate.
5615
5616         * Makefile.am (install-exec-local): Install the executable as
5617         'ld.gold'.  If install_as_default is true then also install it as
5618         'ld'.
5619         * Makefile.in: Regenerated.
5620
5621 2010-04-24  Ian Lance Taylor  <iant@google.com>
5622
5623         * layout.cc (Layout::layout_reloc): In relocatable link don't
5624         combine reloc sections for grouped sections.
5625
5626 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5627
5628         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5629         sections that are not ordinary to icf.
5630         * icf.cc (get_section_contents): Handle relocation pointing to section
5631         with no object or shndx information.
5632         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5633         * testsuite/Makefile.in: Regenerate.
5634         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5635         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5636
5637 2010-04-22  Ian Lance Taylor  <iant@google.com>
5638
5639         * expression.cc (Expression::Expression_eval_info): Add
5640         result_alignment_pointer field.
5641         (Expression::eval_with_dot): Add result_alignment_pointer
5642         parameter.  Change all callers.
5643         (Expression::eval_maybe_dot): Likewise.
5644         (class Binary_expression): Add alignment_pointer parameter to
5645         left_value and right_value.  Change all callers.
5646         (BINARY_EXPRESSION): Set result alignment.
5647         (class Trinary_expression): Add alignment_pointer parameter to
5648         arg2_value and arg3_value.  Change all callers.
5649         (Trinary_cond::value): Set result alignment.
5650         (Max_expression::value, Min_expression::value): Likewise.
5651         (Align_expression::value): Likewise.
5652         * script-sections.cc (class Sections_element): Add dot_alignment
5653         parameter to set_section_addresses virtual function.  Update
5654         instantiations.
5655         (class Output_section_element): Likewise.
5656         (Script_sections::create_segments): Add dot_alignment parameter.
5657         Change all callers.
5658         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5659         (Script_sections::set_phdrs_clause_addresses): Likewise.
5660         * script-sections.h: Update declarations.
5661         * script.h: Update declarations.
5662         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5663         min_p_align.
5664         * testsuite/script_test_3.t: Set large alignment.
5665         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5666         segment has expected alignment.
5667
5668 2010-04-22  Nick Clifton  <nickc@redhat.com>
5669
5670         * po/gold.pot: Updated by the Translation project.
5671         * po/vi.po: Updated Vietnamese translation.
5672
5673 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5674
5675         * testsuite/Makefile.am (check_PROGRAMS): Add
5676         icf_virtual_function_folding_test.
5677         * testsuite/Makefile.in: Regenerated.
5678
5679 2010-04-15  Andrew Haley  <aph@redhat.com>
5680
5681         * options.h (merge_exidx_entries): New option.
5682         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5683         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5684         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5685         (Target_arm::merge_exidx_entries): New function.
5686         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5687         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5688         to Arm_exidx_fixup constructor.
5689         Add new arg, merge_exidx_entries.
5690         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5691         Arm_output_section::fix_exidx_coverage.
5692
5693 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5694
5695         * icf.cc (get_section_contents): Check for preemptible functions.
5696         Ignore addend when appropriate.
5697         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5698         section folded.
5699         (add_from_relobj): Check for section folded.
5700         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5701         * symtab.h (should_add_dynsym_entry): Add new parameter.
5702         * target-reloc.h (scan_relocs): Check for section folded.
5703         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5704         Check reloc types for function pointers in shared objects.
5705         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5706         case.
5707         (icf_preemptible_functions_test): New test case.
5708         (icf_string_merge_test): New test case.
5709         * testsuite.Makefile.in: Regenerate.
5710         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5711         bar_glob.  Refactor code.
5712         * testsuite/icf_preemptible_functions_test.cc: New file.
5713         * testsuite/icf_preemptible_functions_test.sh: New file.
5714         * testsuite/icf_string_merge_test.cc: New file.
5715         * testsuite/icf_string_merge_test.sh: New file.
5716         * testsuite/icf_virtual_function_folding_test.cc: New file.
5717         * testsuite/icf_virtual_function_folding_test.sh: New file.
5718
5719 2010-04-14  Doug Kwan  <dougkwan@google.com>
5720
5721         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5722         for local symbol recounting if we remove a section due to ICF.
5723         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5724         there are no regular objects in input.
5725
5726 2010-04-13  Doug Kwan  <dougkwan@google.com>
5727
5728         * arm.cc (Arm_input_section::set_final_data_size): Compute
5729         accurate final data size instead of using current data size.
5730
5731 2010-04-09  Doug Kwan  <dougkwan@google.com>
5732
5733         * layout.cc (Layout::choose_output_section): Handle script section
5734         types.
5735         (Layout::make_output_section_for_script): Add section type parameter.
5736         Handle script section types.
5737         * layout.h (Layout::make_output_section_for_script): Add section
5738         type parameter.
5739         * output.cc (Output_section::Output_section): Initialize data member
5740         is_noload_.
5741         (Output_section::do_reset_address_and_file_offset): Do not set address
5742         to 0 if section is a NOLOAD section.
5743         * output.h (Output_section::is_noload): New method.
5744         (Output_section::set_is_noload): Ditto.
5745         (Output_section::is_noload_): New data member.
5746         * script-c.h (Script_section_type): New enum type.
5747         (struct Parser_output_section_header): Add new file section_type.
5748         * script-sections.cc (Sections_element::output_section_name): Add
5749         parameter for returning script section type.
5750         (Output_section_definition::output_section_name): Ditto.
5751         (Output_section_definition::section_type)P; New method.
5752         (Output_section_definiton::script_section_type_name): Ditto.
5753         (Output_section_definition::script_section_type_): New data member.
5754         (Output_section_definition::Output_section_definition): Initialize
5755         data member Output_section_definition::script_section_type_.
5756         (Output_section_definition::create_sections): Pass script section type
5757         to Layout::make_output_section_for_script.
5758         (Output_section_definition::output_section_name): Return script
5759         section type to caller.
5760         (Output_section_definition::set_section_address): Do not advance
5761         dot value and load address if section type is NOLOAD.  Set address
5762         of NOLOAD sections regardless of section flags.
5763         (Output_section_definition::print): Print section type if it is
5764         not SCRIPT_SECTION_TYPE_NONE.
5765         (Output_section_definition::section_type): New method.
5766         (Output_section_definition::script_section_type_name): Ditto.
5767         (Script_sections::output_section_name): Add new parameter
5768         PSECTION_TYPE for returning script section type.  Pass it to
5769         section elements.  Handle discard sections.
5770         (Sort_output_sections::operator()): Handle NOLOAD sections.
5771         * script-sections.h (Script_sections::Section_type): New enum type.
5772         (Script_sections::output_section_name): Add a new parameter for
5773         returning script section type.
5774         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5775         INFO and NOLOAD.
5776         * yyscript.y (union): Add new field SECTION_TYPE.
5777         (COPY, DSECT, INFO, NOLOAD): New tokens.
5778         (opt_address_and_section_type): Change type to output_section_header.
5779         (section_type): New non-terminal
5780         (section_header): Handle section type.
5781         (opt_address_and_section_type): Return section type value.
5782
5783 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5784
5785         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5786         * testsuite/plugin_common_test_2.c (foo): Likewise.
5787
5788 2010-04-08  Doug Kwan  <dougkwan@google.com>
5789
5790         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5791         Output_merge_data.
5792         * output.cc (Output_section::add_merge_input_section): Simplify
5793         code and return status of Output_merge_base::add_input_section.
5794         Update merge section map only if Output_merge_base::add_input_section
5795         returns true.
5796
5797 2010-04-07  Doug Kwan  <dougkwan@google.com>
5798
5799         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5800         if section is marked as containing instructions but has no mapping
5801         symbols.
5802         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5803         correct section index.
5804         (Arm_relobj::find_linked_text_section): Ditto.
5805
5806 2010-04-07  Cary Coutant  <ccoutant@google.com>
5807
5808         * archive.cc (include_member): Destroy Read_symbols_data object before
5809         releasing file.
5810         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5811         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5812         (Read_symbols_data::~Read_symbols_data) New destructor.
5813         (Section_relocs::Section_relocs) New constructor.
5814         (Section_relocs::~Section_relocs) New destructor.
5815         (Read_relocs_data::Read_relocs_data) New constructor.
5816         (Read_relocs_data::~Read_relocs_data) New destructor.
5817         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5818         pointers to NULL after deleting.
5819
5820 2010-04-07  Doug Kwan  <dougkwan@google.com>
5821
5822         * arm.cc: Replace "endianity" with "endianness" in comments.
5823         (Arm_exidx_cantunwind): Ditto.
5824         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5825         (Arm_relobj::merge_flags_and_attributes): New method.
5826         (Arm_relobj::merge_flags_and_attributes_): New data member.
5827         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5828         (Arm_relobj::scan_sections_for_stubs): Ditto.
5829         (Arm_relobj::do_read_symbols): Check to see if we really want to
5830         merge processor-specific flags and attributes.  Exit early if
5831         an object is empty except for section names and the undefined symbol.
5832         (Target_arm::do_finalize_sections): Move check for ELF format to
5833         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5834         attributes from a regular object only when we have determined that
5835         it is aapropriate.  Do not create an .ARM.attributes section in
5836         output if there is no regular input object.
5837         (Target_arm::merge_processor_specific_flags): Check
5838         --warn-mismatch before printing any error.
5839         (Target_arm::merge_object_attributes): Ditto.
5840         * gold.cc (queue_middle_tasks): Handle the case in which there is
5841         no regular object in input.
5842         * options.cc (General_options::parse_EB): New method.
5843         (General_options::parse_EL): Same.
5844         (General_options::General_options): Initialize endianness_.
5845         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5846         New options.
5847         (General_options::Endianness): New enum.
5848         (General_options::endianness): New method.
5849         (General_options::endianness_): New data member.
5850         * parameters.cc (Parameters::set_options): Check target endianness.
5851         (Parameters::set_target_once): Ditto.
5852         (Parameters::check_target_endianness): New method.
5853         (parameters_force_valid_target): If either -EL or -EB is specified,
5854         use it to define endianness of default target.
5855         * parameters.h (Parameters::check_target_endianness): New method
5856         declaration.
5857         * target.h (class Target): Change "endianity" to "endianness"
5858         in comments.
5859
5860 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5861
5862         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5863         * configure: Regenerate.
5864         * Makefile.in: Regenerate.
5865         * testsuite/Makefile.in: Regenerate.
5866
5867 2010-04-06  Cary Coutant  <ccoutant@google.com>
5868
5869         gcc PR lto/42757
5870         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5871         prevailing definitions of common symbols.
5872         * testsuite/plugin_test_6.sh: New test case.
5873         * testsuite/plugin_common_test_1.c: New test case.
5874         * testsuite/plugin_common_test_2.c: New test case.
5875         * testsuite/Makefile.am (plugin_test_6): New test case.
5876         * testsuite/Makefile.in: Regenerate.
5877
5878 2010-04-06  Nick Clifton  <nickc@redhat.com>
5879
5880         * po/vi.po: New Vietnamese translation.
5881
5882 2010-03-30  Doug Kwan  <dougkwan@google.com>
5883
5884         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5885
5886 2010-03-25  Doug Kwan  <dougkwan@google.com>
5887
5888         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5889         to avoid a conversion warning on a 32-bit host.
5890
5891 2010-03-24  Ian Lance Taylor  <iant@google.com>
5892
5893         * testsuite/script_test_3.t: Add a TLS segment.
5894         * testsuite/Makefile.am (check_PROGRAMS): Add
5895         tls_phdrs_script_test.
5896         (tls_phdrs_script_test_SOURCES): Define.
5897         (tls_phdrs_script_test_DEPENDENCIES): Define.
5898         (tls_phdrs_script_test_LDFLAGS): Define.
5899         (tls_phdrs_script_test_LDADD): Define.
5900         * testsuite/Makefile.in: Rebuild.
5901
5902 2010-03-23  Cary Coutant  <ccoutant@google.com>
5903
5904         * fileread.cc (find_or_make_view): Fix comment.
5905
5906 2010-03-23  Ian Lance Taylor  <iant@google.com>
5907
5908         * script-sections.cc (class Orphan_section_placement): Define
5909         PLACE_TLS and PLACE_TLS_BSS.
5910         (Orphan_section_placement::Orphan_section_placement): Initialize
5911         new places.
5912         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5913         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5914         (tls_script_test_SOURCES): Define.
5915         (tls_script_test_DEPENDENCIES): Define.
5916         (tls_script_test_LDFLAGS): Define.
5917         (tls_script_test_LDADD): Define.
5918         * testsuite/Makefile.in: Rebuild.
5919
5920 2010-03-22  Doug Kwan  <dougkwan@google.com>
5921
5922         * arm.cc (Arm_relocate_functions::abs8,
5923         Arm_relocate_functions::abs16): Use correct check for overflow
5924         specified in the ARM ELF specs.
5925         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5926         target of a BLX instruction specially.
5927         (Reloc_stub::stub_type_for_reloc): Ditto.
5928         (Relocate::relocate): Use symbolic names instead of numeric relocation
5929         codes to report error.
5930         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5931         workaround.
5932         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5933         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5934         thumb2_blx_out_of_range.stdout
5935         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5936         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5937         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5938         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5939         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5940         thumb2_blx_in_range, thumb2_blx_in_range.o,
5941         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5942         thumb2_blx_out_of_range.o): New rules.
5943         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5944         thumb2_blx_in_range and thumb2_blx_out_of_range.
5945         * testsuite/Makefile.in: Regenerate.
5946         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5947         * testsuite/thumb_blx_in_range.s: New file.
5948         * testsuite/thumb_blx_out_of_range.s: New file.
5949
5950 2010-03-22  Rafael Espindola  <espindola@google.com>
5951
5952         * archive.cc (Should_include): Move to archive.h.
5953         (should_include_member): Make it a member of Archive.
5954         (Lib_group): New.
5955         (Add_lib_group_symbols): New.
5956         * archive.h: Include options.h.
5957         (Archive_member): Moved from Archive.
5958         (Should_include): Moved from archive.cc.
5959         (Lib_group): New.
5960         (Add_lib_group_symbols): New.
5961         * dynobj.cc (do_should_include_member): New.
5962         * dynobj.h (do_should_include_member): New.
5963         * gold.cc (queue_initial_tasks): Update call to queue.
5964         * main.cc (main): Print lib group stats.
5965         * object.cc (do_should_include_member): New.
5966         * object.h: Include archive.h.
5967         (Object::should_include_member): New.
5968         (Object::do_should_include_member): New.
5969         (Sized_relobj::do_should_include_member): New.
5970         * options.cc (General_options::parse_start_lib): New.
5971         (General_options::parse_end_lib): New.
5972         (Input_arguments::add_file): Handle lib groups.
5973         (Input_arguments::start_group): Check we are not in a lib.
5974         (Input_arguments::start_lib): New.
5975         (Input_arguments::end_lib): New.
5976         * options.h (General_options): Add start_lib and end_lib.
5977         (Input_argument::lib_): New.
5978         (Input_argument::lib): New.
5979         (Input_argument::is_lib): New.
5980         (Input_file_lib): New.
5981         (Input_arguments::in_lib_): New.
5982         (Input_arguments::in_lib): New.
5983         (Input_arguments::start_lib): New.
5984         (Input_arguments::end_lib_): New.
5985         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5986         in unused members as preempted.
5987         (Sized_pluginobj::do_should_include_member): New.
5988         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5989         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5990         return the blocker.
5991         (Read_symbols::do_whole_lib_group): New.
5992         (Read_symbols::do_lib_group): New.
5993         (Read_symbols::do_read_symbols): Handle lib groups.
5994         (Read_symbols::get_name): Handle lib groups.
5995         * readsyms.h (Read_symbols): Add an archive member pointer.
5996         (Read_symbols::do_whole_lib_group): New.
5997         (Read_symbols::do_lib_group): New.
5998         (Read_symbols::member_): New.
5999         * script.cc (read_input_script): Update call to queue_soon.
6000
6001 2010-03-19  Doug Kwan  <dougkwan@google.com>
6002
6003         * arm.cc (Stub_table::Stub_table): Initialize new data members
6004         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6005         (Stub_table::add_reloc_stub): Assign stub offset and update
6006         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6007         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6008         New data members.
6009         (Stub_table::update_data_size_and_addralign): Use
6010         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6011         instead of going over all reloc stubs.
6012         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6013         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6014         Stringpool_template::offset_ to size of Stringpool_char.
6015         (Stringpool_template::new_key_offset): Remove code to initialize
6016         Stringpool_template::offset_.
6017         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6018         Stringpool_template::offset_ to zero.
6019
6020 2010-03-15  Doug Kwan  <dougkwan@google.com>
6021
6022         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6023         offset_.
6024         (Stringpool_template::new_key_offset): New method.
6025         (Stringpool_template::add_string): Assign offsets when adding new
6026         strings.
6027         (Stringpool_template::set_string_offsets): Do not set string offsets
6028         when not optimizing.
6029         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6030         member size_.
6031         (Chunked_vector::clear): Clear size_.
6032         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6033         (Chunked_vector::size): Return size_.
6034         (Chunked_vector::push_back): Use size_ to find insert position.
6035         (Chunked_vector::size_): New data member.
6036         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6037         (Stringpool_template::new_key_offset): New method declaration.
6038         (Stringpool_template::offset_): New data member.
6039
6040 2010-03-15   Rafael Espindola  <espindola@google.com>
6041
6042         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6043         Add_symbols' constructor.
6044         * readsyms.h (Add_symbols): Remove the input_group member.
6045
6046 2010-03-10  Ian Lance Taylor  <iant@google.com>
6047
6048         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6049         target to ask whether a reference to a symbol requires a stack
6050         split.
6051         * target.h (Target::is_call_to_non_split): New function.
6052         (Target::do_is_call_to_non_split): Declare virtual function.
6053         * target.cc: Include "symtab.h".
6054         (Target::do_is_call_to_non_split): New function.
6055         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6056
6057 2010-03-10  Cary Coutant  <ccoutant@google.com>
6058
6059         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6060         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6061         (File_read::open[2]): Add whole_file_view_ to list of views.
6062         (File_read::make_view): Remove test of whole_file_view_.
6063         (File_read::find_or_make_view): Create whole_file_view_ if
6064         necessary.
6065         (File_read::clear_views): Replace bool parameter with enum;
6066         adjust all callers.  Don't delete views with permanent data;
6067         do delete cached views and views from archives if
6068         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6069         if clearing the corresponding view.
6070         * fileread.h (File_read::Clear_views_mode): New enum.
6071         (File_read::View::is_permanent_view): New method.
6072         (File_read::clear_views): Replace bool parameter
6073         with enum; adjust all callers.
6074         * options.h (General_options): Change keep_files_mapped option;
6075         add map_whole_files.
6076         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6077         releasing the file.
6078         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6079         the file.
6080
6081 2010-03-10  David S. Miller  <davem@davemloft.net>
6082
6083         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6084
6085 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6086
6087         * icf.cc (get_section_contents): Add '@' marker after processing the
6088         merge reloc.
6089
6090 2010-03-08  Doug Kwan  <dougkwan@google.com>
6091
6092         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6093         due to a conversion warning.
6094         (Arm_relobj::update_output_local_symbol_count): Check for local
6095         symbol with unset output index.
6096
6097 2010-03-05  Ian Lance Taylor  <iant@google.com>
6098
6099         * options.h (class General_options): Add --spare-dynamic-tags.
6100         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6101         --spare-dynamic-tags.
6102
6103 2010-03-05  Ian Lance Taylor  <iant@google.com>
6104
6105         * incremental.cc: Include "libiberty.h".
6106
6107 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6108
6109         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6110         function, is_info_ member.
6111         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6112         (Versions::Versions): Update caller.
6113         (Versions::define_base_version): Likewise.
6114         (Versions::add_def): Likewise.
6115
6116 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6117
6118         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6119         (Scan::possible_function_pointer_reloc): New function.
6120         (Scan::local_reloc_may_be_function_pointer): Change to call
6121         possible_function_pointer_reloc.
6122         (Scan::global_reloc_may_be_function_pointer): Ditto.
6123         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6124         relocations in ".data.rel.ro._ZTV" section.
6125         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6126         * testsuite/icf_safe_so_test.cc: Ditto.
6127         * testsuite/icf_safe_test.cc: Ditto.
6128         * testsuite/icf_safe_test.sh: Ditto.
6129
6130 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6131             Ian Lance Taylor  <iant@google.com>
6132
6133         * target-reloc.h (relocate_section): Check the symbol table index
6134         for -1U before setting the local symbol index.
6135         (scan_relocatable_relocs): If copying the relocation, record that
6136         the local symbol is required.
6137         * object.h (Symbol_value::is_output_symtab_index_set): New
6138         function.
6139         (Symbol_value::may_be_discarded_from_output_symtab): New
6140         function.
6141         (Symbol_value::has_output_symtab_entry): New function.
6142         (Symbol_value::needs_output_symtab_entry): Remove.
6143         (Symbol_value::output_symtab_index): Make sure the symbol index is
6144         set.
6145         (Symbol_value::set_output_symtab_index): Make sure the symbol
6146         index is not set.  Make sure the new index is valid.
6147         (Symbol_value::set_must_have_output_symtab_entry): New function.
6148         (Symbol_value::has_output_dynsym_entry): New function.
6149         (Symbol_value::set_output_dynsym_index): Make sure the new index
6150         is valid.
6151         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6152         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6153         local symbol if permitted.
6154         (Sized_relobj::do_finalize_local_symbols): Call
6155         is_output_symtab_index_set rather than needs_output_symtab_entry.
6156         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6157         rather than needs_output_symtab_entry.  Call
6158         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6159         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6160         is_output_symtab_index_set rather than needs_output_symtab_entry.
6161         * testsuite/discard_locals_relocatable_test.c: New file.
6162         * testsuite/discard_locals_test.sh: Test -r.
6163         * testsuite/Makefile.am (check_DATA): Add
6164         discard_locals_relocatable_test1.syms,
6165         discard_local_relocatable_test2.syms.
6166         (MOSTLYCLEANFILES): Likewise.  Also add
6167         discard_locals_relocatable_test1.lout and
6168         discard_locals_relocatable_test2.out.
6169         (discard_locals_relocatable_test1.syms): New target.
6170         (discard_locals_relocatable_test.o): New target.
6171         (discard_locals_relocatable_test1.out): New target.
6172         (discard_locals_relocatable_test2.syms): New target.
6173         (discard_locals_relocatable_test2.out): New target.
6174         (various): Add missing ../ld-new dependencies.
6175         * testsuite/Makefile.in: Rebuild.
6176
6177 2010-03-03  Nick Clifton  <nickc@redhat.com>
6178
6179         * po/fi.po: New Finnish translation.
6180
6181 2010-03-01  Doug Kwan  <dougkwan@google.com>
6182
6183         * layout.cc (Layout::Layout): Force section types of .init_array*,
6184         .preinit_array* and .fini_array* sections.
6185         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6186         Fix check of return value of std::string::find.().
6187         (Output_section::Input_section_sort_compare::operator()): Remove
6188         comment about .init_array.
6189         (Output_section::Input_section_sort_init_fini_compare::operator()):
6190         New method.
6191         (Output_section::sort_attached_input_sections): Handle .init_array
6192         and .fini_array specially.
6193         * output.h (Output_section::Inut_section_sort_compare): Update
6194         comment.
6195         (Output_section::Input_section_sort_init_fini_compare): New struct.
6196
6197 2010-02-26  Doug Kwan  <dougkwan@google.com>
6198
6199         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6200         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6201         * testsuite/debug_msg.sh: Avoid matching source line number for
6202         use of global variable undef_int.
6203
6204 2010-02-26  Doug Kwan  <dougkwan@google.com>
6205
6206         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6207         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6208         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6209         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6210         * options.cc (General_options::General_options): Initialize member
6211         fix_v4bx_.
6212         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6213         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6214         and rm_no_fix_v4bx.stdout
6215         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6216         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6217         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6218         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6219         and arm_no_fix_v4bx.
6220         * Makefile.in: Regenerate.
6221         * testsuite/arm_fix_v4bx.s: New file.
6222         * testsuite/arm_fix_v4bx.sh: Ditto.
6223
6224 2010-02-24  Doug Kwan  <dougkwan@google.com>
6225
6226         * arm.cc (Target_arm::got_section): Make the .got section the first
6227         non RELRO section in the data segment.
6228         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6229         suffixes of section names.
6230
6231 2010-02-24  Doug Kwan  <dougkwan@google.com>
6232
6233         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6234         flags and attributes merging if an input file is a binary file.
6235         * fileread.cc (Input_file::open): Record format of original file.
6236         * fileread.h (Input_file::Format): New enum type.
6237         (Input_file::Input_file): Initialize data member format_.
6238         (Input_file::format): New method definition.
6239         (Input_file::format_):: New data member.
6240
6241 2010-02-24  Doug Kwan  <dougkwan@google.com>
6242
6243         * arm.cc (Arm_output_data_got): New class.
6244         (ARM_TCB_SIZE): New constant
6245         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6246         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6247         If user uses a script with a SECTIONS clause, issue only a warning
6248         for a misplaced EXIDX input section.  Otherwise, issue an error.
6249         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6250         garbage collection.
6251         (Target_arm::got_mode_index_entry): Handle static linking.
6252         (Target_arm::Scan::local): Ditto.
6253         (Target_arm::Scan::global): Ditto.
6254         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6255         all incorrectly implemented relocations.
6256         (Target_arm::fix_exidx_coverage): Pass layout to
6257         Arm_output_section::fix_exidx_coverage.
6258         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6259         from ".ARM.exidx." and ".ARM.extab.".
6260
6261 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6262
6263         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6264         section if it does not already exist.
6265         * attributes.cc (Attributes_section_data::Attributes_section_data):
6266         Don't crash if size is zero.
6267
6268 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6269             Ian Lance Taylor  <iant@google.com>
6270
6271         * gold.cc (queue_middle_tasks): If no input files were opened,
6272         exit.
6273         * workqueue.h (Task_function::Task_function): Assert that there is
6274         a blocker.
6275
6276 2010-02-22  Doug Kwan  <dougkwan@google.com>
6277
6278         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6279         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6280         types to avoid warnings due to different uint64_t implementations
6281         on different hosts.
6282
6283 2010-02-21  Doug Kwan  <dougkwan@google.com>
6284
6285         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6286         handling of the maximum backward branch offset.
6287         (Arm_relocate_functions::thumb_branch_common): Ditto.
6288         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6289         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6290         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6291         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6292         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6293         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6294         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6295         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6296         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6297         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6298         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6299         thumb2_bl_out_of_range.o): New rules.
6300         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6301         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6302         thumb2_bl_out_of_range
6303         * testsuite/Makefile.in: Regenerate.
6304         * testsuite/arm_bl_in_range.s: New file.
6305         * testsuite/arm_bl_out_of_range.s: Ditto.
6306         * testsuite/arm_branch_in_range.sh: Ditto.
6307         * testsuite/arm_branch_range.t: Ditto.
6308         * testsuite/thumb2_branch_range.t: Ditto.
6309         * testsuite/thumb_bl_in_range.s: Ditto.
6310         * testsuite/thumb_bl_out_of_range.s: Ditto.
6311         * testsuite/thumb_branch_range.t: Ditto.
6312
6313 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6314
6315         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6316         Add reloc offset information.
6317         * icf.cc (get_section_contents): Change iterators to point to the new
6318         vectors. Add reloc offset information to the contents.
6319         * icf.h (Icf::Sections_reachable_info): New typedef.
6320         (Icf::Sections_reachable_list): New typedef.
6321         (Icf::Offset_info): New typedef.
6322         (Icf::Reloc_info): New struct typedef.
6323         (Icf::Reloc_info_list): New typedef.
6324         (Icf::symbol_reloc_list): Delete method.
6325         (Icf::addend_reloc_list): Delete method.
6326         (Icf::section_reloc_list): Delete method.
6327         (Icf::reloc_info_list): New method.
6328         (Icf::reloc_info_list_): New member.
6329
6330 2010-02-19  Doug Kwan  <dougkwan@google.com>
6331
6332         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6333         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6334         * arm.cc (Arm_relocation_functions): New forward declaration.
6335         (Target_arm::Target_arm): Initialize new data members
6336         got_mod_index_offset_ and tls_base_symbol_defined_.
6337         (Target_arm::Relocate::relocate_tls): New method.
6338         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6339          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6340         New methods.
6341         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6342         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6343         (Target_arm::got_mod_index_offset_,
6344         Target_arm::tls_base_symbol_defined_): New data members.
6345         (Target_arm::Scan::local, Target::Scan::global,
6346         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6347         relocations.
6348
6349 2010-02-18  Doug Kwan  <dougkwan@google.com>
6350
6351         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6352         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6353         text section as a parameter becuase some broken tools may not set
6354         the link in section header.
6355         (Target_arm::has_got_section): New method.
6356         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6357         without any mapping symbol as data only.  Remove warning.
6358         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6359         link in its section header, try to discover the link by inspecting the
6360         REL31 relocation at the beginning of the section.
6361         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6362         in error message.
6363         (Target_arm::Scan::global): Treat any reference to the symbol
6364         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6365
6366 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6367
6368         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6369         (Scan::global_reloc_may_be_function_pointer): New function.
6370         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6371         (Scan::global_reloc_may_be_function_pointer): New function.
6372         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6373         (Scan::global_reloc_may_be_function_pointer): New function.
6374         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6375         (Scan::global_reloc_may_be_function_pointer): New function.
6376         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6377         (Scan::global_reloc_may_be_function_pointer): New function.
6378         (Scan::possible_function_pointer_reloc): New function.
6379         (Target_x86_64::can_check_for_function_pointers): New function.
6380         * gc.h (gc_process_relocs): Scan relocation types to determine if
6381         function pointers were taken for targets that support it.
6382         * icf.cc (Icf::find_identical_sections): Include functions for
6383         folding in safe ICF whose pointer is not taken.
6384         * icf.h (Secn_fptr_taken_set): New typedef.
6385         (fptr_section_id_): New member.
6386         (section_has_function_pointers): New function.
6387         (set_section_has_function_pointers): New function.
6388         (check_section_for_function_pointers): New function.
6389         * options.h: Fix comment for safe ICF option.
6390         * target.h (can_check_for_function_pointers): New function.
6391         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6392         Modify icf_safe_test for X86-64.
6393         * testsuite/Makefile.in: Regenerate.
6394         * testsuite/icf_safe_so_test.cc: New file.
6395         * testsuite/icf_safe_so_test.sh: New file.
6396         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6397         (main): Change to take pointer to function kept_func_3.
6398         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6399         folding is done correctly for X86-64.
6400
6401 2010-02-12  David S. Miller  <davem@davemloft.net>
6402
6403         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6404         is_symbolless parameter.
6405         (Output_reloc<SHT_REL>::is_symbolless): New.
6406         (Output_reloc<SHT_REL>::is_symbolless_): New.
6407         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6408         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6409         (Output_reloc<SHT_RELA>::is_symbolless): New.
6410         (Output_data_reloc::add_global): Handle is_symbolless.
6411         (Output_data_reloc::add_global_relative): Likewise.
6412         (Output_data_reloc::add_local): Likewise.
6413         (Output_data_reloc::add_local_relative): Likewise.
6414         (Output_data_reloc::add_symbolless_global_addend): New.
6415         (Output_data_reloc::add_symbolless_local_addend): New.
6416         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6417         is_symbolless.
6418         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6419         instead of ->is_relative_
6420         (Output_reloc::write): Likewise.
6421         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6422         (Output_reloc::write_rel): Simplify.
6423
6424         * sparc.cc (Target_sparc::Scan::local): Use
6425         ->add_symbolless_local_addend as needed.
6426         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6427         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6428         based upon relocation offset.
6429
6430 2010-02-11  Doug Kwan  <dougkwan@google.com>
6431
6432         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6433         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6434         beginning of function.
6435         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6436         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6437         parameter is_32bit in calls to should_apply_static_reloc.
6438         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6439         (check_DATA): Add arm_abs_global.stdout.
6440         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6441         arm_abs_global.stdout): New rules.
6442         (MOSTLLYCLEANFILES): Add arm_abs_global
6443         * Makefile.in: Regenerate.
6444         * testsuite/arm_abs_global.s: New file.
6445         * testsuite/arm_abs_global.sh: Ditto.
6446         * testsuite/arm_abs_lib.s: Ditto.
6447
6448 2010-02-11  Ian Lance Taylor  <iant@google.com>
6449
6450         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6451         Read_relocs task.
6452         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6453         Allocate_commons_task first.
6454         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6455         task, rather than symtab_lock_.
6456         (Gc_process_relocs::~Gc_process_relocs): New function.
6457         (Gc_process_relocs::is_runnable): Check this_blocker_.
6458         (Gc_process_relocs::locks): Use next_blocker_ rather than
6459         blocker_.
6460         (Scan_relocs::~Scan_relocs): New function.
6461         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6462         symtab_lock_.
6463         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6464         next_blocker_.
6465         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6466         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6467         constructor accordingly.
6468         (class Gc_process_relocs): Likewise.
6469         (class Scan_relocs): Likewise.
6470         * common.h (class Allocate_commons_task): Remove symtab_lock_
6471         field, and corresponding constructor parameter.
6472         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6473         symtab_lock_.
6474         (Allocate_commons_task::locks): Likewise.
6475
6476 2010-02-11  Ian Lance Taylor  <iant@google.com>
6477
6478         * gold-threads.h (class Once): Define.
6479         (class Initialize_lock): Rewrite as child of Once.
6480         * gold-threads.cc (class Once_initialize): Define.
6481         (once_pointer_control): New static variable.
6482         (once_pointer, once_arg): New static variables.
6483         (c_run_once): New static function.
6484         (Once::Once, Once::run_once, Once::internal_run): New functions.
6485         (class Initialize_lock_once): Remove.
6486         (initialize_lock_control): Remove.
6487         (initialize_lock_pointer): Remove.
6488         (initialize_lock_once): Remove.
6489         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6490         (Initialize_lock::initialize): Rewrite.
6491         (Initialize_lock::do_run_once): New function.
6492         * archive.cc (Archive::interpret_header): Only clear name if it is
6493         not already empty.
6494         * fileread.cc: Include "gold-threads.h"
6495         (file_counts_lock): New static variable.
6496         (file_counts_initialize_lock): Likewise.
6497         (File_read::release): Only increment counts when using --stats.
6498         Use a lock around the increment.
6499         * parameters.cc (class Set_parameters_target_once): Define.
6500         (set_parameters_target_once): New static variable.
6501         (Parameters::Parameters): Move here from parameters.h.
6502         (Parameters::set_target): Rewrite.
6503         (Parameters::set_target_once): New function.
6504         (Parameters::clear_target): Move here and rewrite.
6505         * parameters.h (class Parameters): Update declarations.  Add
6506         set_parameters_target_once_ field.
6507         (Parameters::Parameters): Move to parameters.cc.
6508         (Parameters::clear_target): Likewise.
6509         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6510         task.
6511         (Start_group::~Start_group): New function.
6512         (Start_group::is_runnable): New function.
6513         (Start_group::locks, Start_group::run): New functions.
6514         (Finish_group::run): Change saw_undefined to size_t.
6515         * readsyms.h (class Start_group): Define.
6516         (class Finish_group): Change saw_undefined_ field to size_t.
6517         (Finish_group::Finish_group): Remove saw_undefined and
6518         this_blocker parameters.  Change all callers.
6519         (Finish_group::set_saw_undefined): New function.
6520         (Finish_group::set_blocker): New function.
6521         * symtab.h (class Symbol_table): Change saw_undefined to return
6522         size_t.  Change saw_undefined_ field to size_t.
6523         * target-select.cc (Set_target_once::do_run_once): New function.
6524         (Target_selector::Target_selector): Initialize set_target_once_
6525         field.  Don't initialize lock_ and initialize_lock_ fields.
6526         (Target_selector::instantiate_target): Rewrite.
6527         (Target_selector::set_target): New function.
6528         * target-select.h (class Set_target_once): Define.
6529         (class Target_selector): Update declarations.  Make
6530         Set_target_once a friend.  Remove lock_ and initialize_lock_
6531         fields.  Add set_target_once_ field.
6532
6533 2010-02-10  Ian Lance Taylor  <iant@google.com>
6534
6535         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6536         queueing any tasks.
6537         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6538         (queue_middle_tasks): Add all blockers before queueing any tasks.
6539         (queue_final_tasks): Likewise.
6540         * token.h (Task_token::add_blockers): New function.
6541         * object.h (Input_objects::number_of_relobjs): New function.
6542
6543 2010-02-10  Ian Lance Taylor  <iant@google.com>
6544
6545         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6546         shared, not if not position independent.
6547         * x86_64.cc (Relocate::relocate_tls): Likewise.
6548         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6549         (tls_pie_pic_test): New target.
6550         * testsuite/Makefile.in: Rebuild.
6551
6552         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6553         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6554         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6555         * testsuite/Makefile.in: Rebuild.
6556
6557 2010-02-09  David S. Miller  <davem@davemloft.net>
6558
6559         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6560         R_SPARC_RELATIVE using ->add_local_relative().
6561         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6562
6563         * output.h (Output_data_dynamic::add_section_size): New method
6564         that takes two Output_data objects.
6565         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6566         entry param.  Handle it in initializers.
6567         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6568         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6569         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6570         arg.
6571         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6572         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6573         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6574         for dynrel_includes_plt.
6575         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6576         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6577         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6578         before .rela.plt
6579         (Target_sparc::do_finalize_sections): Update to pass true for
6580         dynrel_includes_plt.
6581         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6582         output before .rela.plt
6583         (Target_powerpc::do_finalize_sections): Update to pass true for
6584         dynrel_includes_plt when 32-bit.
6585
6586 2010-02-08  Doug Kwan  <dougkwan@google.com>
6587
6588         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6589         method.
6590         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6591         Arm_relobj::scan_section_for_cortex_a8_stubs,
6592         Arm_relobj::do_relocation_section): Instead of calling
6593         Output_section::output_address, use faster
6594         Arm_relobj::simple_input_section_output_address.
6595
6596 2010-02-08  David S. Miller  <davem@davemloft.net>
6597
6598         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6599         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6600         relocation helper function.
6601
6602         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6603         just like R_SPARC_GOT{10,13,22}.
6604         (Target_sparc::Scan::local): Likewise.
6605         (Target_sparc::Relocate:relocate): Likewise.
6606
6607 2010-02-06  Ian Lance Taylor  <iant@google.com>
6608
6609         * configure.ac: Rewrite targetobjs duplicate removal code to use
6610         only shell constructs.
6611         * configure: Rebuild.
6612
6613 2010-02-05  Doug Kwan  <dougkwan@google.com>
6614
6615         PR 11247
6616         * arm.cc (Arm_relobj::section_is_scannable): New method.
6617         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6618         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6619
6620 2010-02-04  Doug Kwan  <dougkwan@google.com>
6621
6622         PR 11247
6623         * arm-reloc-property.cc (cstdio): Include.
6624         * configure.ac (targetobjs): Remove duplicates.
6625         * configure: Regenerate.
6626         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6627         big and little endian version for a given address size.
6628
6629 2010-02-03  Doug Kwan  <dougkwan@google.com>
6630
6631         * arm-reloc-property.cc
6632         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6633         definition.
6634         * arm-reloc-property.h
6635         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6636         New method definition.
6637         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6638         declaration.
6639         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6640         overflow to N.
6641         (GOT_PREL): Change implemented to Y.
6642         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6643         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6644         (Arm_relocate_functions::movw_abs_nc): Remove method.
6645         (Arm_relocate_functions::movt_abs): Ditto.
6646         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6647         (Arm_relocate_functions::thm_movt_abs): Ditto.
6648         (Arm_relocate_functions::movw_rel_nc): Ditto.
6649         (Arm_relocate_functions::movw_rel): Ditto.
6650         (Arm_relocate_functions::movt_rel): Ditto.
6651         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6652         (Arm_relocate_functions:thm_movw_rel): Ditto.
6653         (Arm_relocate_functions:thm_movt_rel): Ditto.
6654         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6655         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6656         New method definitions.
6657         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6658         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6659         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6660         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6661         (Target_arm::Relocate::relocate): Check for non-static or
6662         unimplemented relocation code and exit early.  Change calls to
6663         Target_arm::reloc_uses_thumb_bit and
6664         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6665         instead.  Refactor code to handle similar relocations to increase
6666         code sharing.  Remove check for unsupported relocation code in switch
6667         statement.
6668         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6669         relocation property table to find out size.  Change error message to
6670         print out the name of a relocation code instead of the numeric value.
6671         (Target_arm::scan_reloc_for_stub): Use relocation property table
6672         instead of calling Target_arm::reloc_uses_thumb_bit().
6673
6674 2010-02-02  Doug Kwan  <dougkwan@google.com>
6675
6676         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6677         types of relaxed input section.
6678
6679 2010-02-02  Doug Kwan  <dougkwan@google.com>
6680
6681         * Makefile.am (HFILES): Add arm-reloc-property.h.
6682         (DEFFILES): New.
6683         (TARGETSOURCES): Add arm-reloc-property.cc
6684         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6685         (libgold_a_SOURCES): $(DEFFILES)
6686         * Makefile.in: Regenerate.
6687         * arm-reloc-property.cc: New file.
6688         * arm-reloc-property.h: New file.
6689         * arm-reloc.def: New file.
6690         * arm.cc: Update comments.
6691         (arm-reloc-property.h): New included header.
6692         (arm_reloc_property_table): New global variable.
6693         (Target_arm::do_select_as_default_target): New method definition.
6694         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6695         arm-reloc-property to targ_extra_obj.
6696         * parameters.cc (set_parameters_target): Call
6697         Target::select_as_default_target().
6698         * target.h (Target::select_as_default_target): New method definition.
6699         (Target::do_select_as_default_target): Same.
6700
6701 2010-02-01  Doug Kwan  <dougkwan@google.com>
6702
6703         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6704         first_output_text_section_.
6705         (Arm_exidx_fixup::first_output_text_section): New method definition.
6706         (Arm_exidx_fixup::first_output_text_section_): New data member.
6707         (Arm_exidx_fixup::process_exidx_section): Record the first text
6708         output section seen.
6709         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6710         and entsize in output section header.
6711
6712 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6713
6714         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6715         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6716         (Arm_relocate_functions::thm_alu11): New Method.
6717         (Arm_relocate_functions::thm_pc8): New Method.
6718         (Arm_relocate_functions::thm_pc12): New Method.
6719         (Target_arm::Scan::local): Handle the relocations.
6720         (Target_arm::Scan::global): Likewise.
6721         (Target_arm::Relocate::relocate): Likewise.
6722         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6723
6724 2010-01-29  Doug Kwan  <dougkwan@google.com>
6725
6726         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6727         of relocation types as ld.
6728
6729 2010-01-29  Doug Kwan  <dougkwan@google.com>
6730
6731         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6732         to public.
6733         (Arm_relocate_functions::thumb_branch_common): Ditto.
6734         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6735         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6736         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6737         Arm_relocate_functions::jump24): Remove.
6738         (Target_arm::Relocate::relocate): Adjust code to call
6739         Arm_relocation_functions::arm_branch_common and
6740         Arm_relocation_functions::thumb_branch_common instead of their removed
6741         wrappers.  Merge switch-cases together to reduce source code size.
6742
6743 2010-01-29  Doug Kwan  <dougkwan@google.com>
6744
6745         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6746         output_local_symbol_count_needs_update_.
6747         (Arm_relobj::output_local_symbol_count_needs_update,
6748          Arm_relobj::set_output_local_symbol_count_needs_update,
6749          Arm_relobj::update_output_local_symbol_count): New methods.
6750         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6751         member.
6752         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6753         of pointed function as in a R_ARM_PREL31 relocation.
6754         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6755         for output local symbol count updating.
6756         (Target_arm::do_relax): Update output local symbol counts in objects
6757         if necessary.
6758         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6759
6760 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6761
6762         * arm.cc: Added support for the ARM relocations:
6763         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6764         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6765         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6766         movw_prel_nc).
6767         (Arm_relocate_functions::movw_rel): New method.
6768         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6769         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6770         thm_movw_prel_nc).
6771         (Arm_relocate_functions::thm_movw_rel): New method.
6772         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6773         thm_movt_prel).
6774         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6775         relocations.
6776         (Target_arm::Scan::global): Likewise.
6777         (Target_arm::Relocate::relocate): Likewise.
6778         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6779         Likewise.
6780
6781 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6782
6783         * arm.cc: Added support for ARM group relocations.
6784         (Target_arm::reloc_needs_sym_origin): New method.
6785         (Arm_relocate_functions::calc_grp_kn): New method.
6786         (Arm_relocate_functions::calc_grp_residual): New method.
6787         (Arm_relocate_functions::calc_grp_gn): New method.
6788         (Arm_relocate_functions::arm_grp_alu): New Method.
6789         (Arm_relocate_functions::arm_grp_ldr): New Method.
6790         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6791         (Arm_relocate_functions::arm_grp_ldc): New Method.
6792         (Target_arm::Scan::local): Handle the ARM group relocations.
6793         (Target_arm::Scan::global): Likewise.
6794         (Target_arm::Relocate::relocate): Likewise.
6795         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6796         Likewise.
6797
6798 2010-01-26  Doug Kwan  <dougkwan@google.com>
6799
6800         * arm.cc (set): Include.
6801         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6802         pointer type.
6803         (Arm_output_section::Text_section_list): New type.
6804         (Arm_output_section::append_text_sections_to_list): New method.
6805         (Arm_output_section::fix_exidx_coverage): Ditto.
6806         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6807         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6808         Relobj::set_section_offset() instead of
6809         Sized_relobj::invalidate_section_offset().
6810         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6811         parameter for section headers. Ignore relocation sections for
6812         unallocated sections and EXIDX sections.
6813         (Target_arm::fix_exidx_coverage): New method.
6814         (Target_arm::output_section_address_less_than): New type.
6815         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6816         linked text section instead of the EXIDX section.
6817         (Arm_output_section::create_stub_group): Add an assertion to check
6818         that this is not an EXIDX output section.
6819         (Arm_output_section::append_text_sections_to_list): New method.
6820         (Arm_output_section::fix_exidx_coverage): Ditto.
6821         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6822         Arm_relobj::section_needs_reloc_stub_scanning.
6823         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6824         first pass.
6825         (Target_arm::fix_exidx_coverage): New method.
6826         * object.h (Relobj::set_output_section): New method.
6827         (Sized_relobj::invalidate_section_offset): Remove method.
6828         (Sized_relobj::do_invalidate_section_offset): Remove method.
6829         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6830
6831 2010-01-25  Doug Kwan  <dougkwan@google.com>
6832
6833         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6834         Fix warning due to signed and unsigned comparison on a 32-bit host.
6835
6836 2010-01-22  Doug Kwan  <dougkwan@google.com>
6837
6838         * arm.cc (Target_arm::do_relax): Record an output section for section
6839         offset adjustment it contains any stub table that has changed.
6840         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6841         offsets in an output section if necessary.
6842         * output.cc (Output_section::Output_section): Initialize
6843         section_offsets_need_adjustments_.
6844         (Output_section::add_input_section_for_script): Renamed to
6845         Output_section::add_simple_input_section.
6846         (Output_section::save_states): Add a comment.
6847         (Output_section::discard_states): New method defintion.
6848         (Output_section::adjust_section_offsets): Same.
6849         * output.h (Output_section::add_input_section_for_script): Renamed to
6850         Output_section::add_simple_input_section.
6851         (Output_section::discard_states): New method declaration.
6852         (Output_section::adjust_section_offsets): Same.
6853         (Output_section::section_offsets_need_adjustment,
6854         Output_section::set_section_offsets_need_adjustment): New method
6855         definitions.
6856         (Output_section::section_offsets_need_adjustment_): New data member.
6857         * script-sections.cc
6858         (Output_section_element_input::set_section_address): Adjust code for
6859         renaming of Output_section::add_input_section_for_script.
6860         (Orphan_output_section::set_section_address): Same.
6861
6862 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6863
6864         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6865         Fix_v4bx enum values .
6866         * gold/options.h (General_options): New option definitions.
6867         (General_options::fix_v4bx): New method.
6868         (General_options::Fix_v4bx): New enum.
6869         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6870         (General_options::parse_fix_v4bx_interworking): New method.
6871
6872 2010-01-22  Doug Kwan  <dougkwan@google.com>
6873
6874         * arm.cc (Arm_exidx_fixup): New class.
6875
6876 2010-01-21  Doug Kwan  <dougkwan@google.com>
6877
6878         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6879         classes.
6880         (Arm_exidx_section_offset_map): New type.
6881
6882 2010-01-21  Doug Kwan  <dougkwan@google.com>
6883
6884         * arm.cc (Arm_exidx_input_section): New class.
6885         (Arm_relobj::exidx_input_section_by_link,
6886         Arm_relobj::exidx_input_section_by_shndx,
6887         Arm_relobj::make_exidx_input_section): New methods.
6888         (read_arm_attributes_section): Remove.
6889         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6890         information about them.
6891         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6892         to here.
6893
6894 2010-01-20  Doug Kwan  <dougkwan@google.com>
6895
6896         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6897         Input_section_specifier to Section_id.
6898         (Target_arm::new_arm_input_section: Adjust code for change of key
6899         type.
6900         (Target_arm::find_arm_input_section): Ditto.
6901         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6902         (Section_id): Remove.
6903         (Garbage_collection::Section_id_hash): Remove.
6904         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6905         (Section_id): Remove.
6906         (Icf::Section_id_hash): Remove.
6907         * object.h (Section_id, Const_section_id, Section_id_hash,
6908         Const_section_id_hash): New type definitions.
6909         * output.cc (Output_section::add_relaxed_input_section): Change to
6910         use Const_section_id instead of Input_section_specifier as key type.
6911         (Output_section::add_merge_input_section): Ditto.
6912         (Output_section::build_relaxation_map): Change to use Section_id
6913         instead of Input_section_specifier as key type.
6914         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6915         Ditto.
6916         (Output_section::convert_input_sections_to_relaxed_sections): Change
6917         to use Const_section_id instead of Input_section_specifier as key type.
6918         (Output_section::find_merge_section): Ditto.
6919         (Output_section::find_relaxed_input_section): Ditto.
6920         * output.h (Input_section_specifier): Remove class.
6921         (Output_section::Output_section_data_by_input_section_map): Change
6922         key type to Const_section_id.
6923         (Output_section::Output_relaxed_input_section_by_input_section_map):
6924         Ditto.
6925         (Output_section::Relaxation_map): Change key type to Section_id.
6926
6927 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6928
6929         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6930         (class Arm_v4bx_stub): New class.
6931         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6932         (Stub_factory::make_arm_v4bx_stub): New method.
6933         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6934         (Stub_table::empty): Handle v4bx stubs.
6935         (Stub_table::add_arm_v4bx_stub): New method.
6936         (Stub_table::find_arm_v4bx_stub): New method.
6937         (Arm_relocate_functions::v4bx): New method.
6938         (Target_arm::fix_v4bx): New method.
6939         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6940         (Stub_table::relocate_stubs): Likewise.
6941         (Stub_table::do_write): Likewise.
6942         (Stub_table::update_data_size_and_addralign): Likewise.
6943         (Stub_table::finalize_stubs):  Likewise.
6944         (Target_arm::Scan::local): Likewise.
6945         (Target_arm::Scan::global): Likewise.
6946         (Target_arm::do_finalize_sections): Likewise.
6947         (Target_arm::Relocate::relocate): Likewise.
6948         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6949         Likewise.
6950         (Target_arm::scan_reloc_for_stub): Likewise.
6951         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6952
6953 2010-01-19  Ian Lance Taylor  <iant@google.com>
6954
6955         * output.cc (Output_section_headers::do_sized_write): Write large
6956         segment count to sh_info field.
6957         (Output_file_header::do_sized_write): For large segment count,
6958         write PN_XNUM to e_phnum field.
6959
6960 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6961
6962         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6963         (Arm_relocate_functions::thm_jump8): New function.
6964         (Arm_relocate_functions::thm_jump11): New function.
6965         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6966         R_ARM_THM_JUMP11.
6967         (Target_arm::Scan::global): Likewise.
6968         (Target_arm::Relocate::relocate): Likewise.
6969         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6970         Likewise.
6971
6972 2010-01-14  Doug Kwan  <dougkwan@google.com>
6973
6974         * arm.cc (map, utility): Include headers.
6975         (Target_arm::apply_cortex_a8_workaround): New method.
6976         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6977         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6978         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6979         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6980         the --[no-]fix-cortex-a8 command line options.
6981         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6982         (Target_arm::relocate_stub): Use addend in instruction template.
6983         * options.h (DEFINE_bool): Set the user-set flag.
6984         (General_options): Add --[no-]-fix-cortex options.
6985         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6986         : Update fast look-up map after conversion.
6987
6988 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6989
6990         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6991         in the first pass of do_layout.
6992
6993 2010-01-13  Doug Kwan  <dougkwan@google.com>
6994
6995         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6996         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6997         apparent compiler problem of not folding static constant integral
6998         data members of elfcpp::Elf_sizes<32>.
6999
7000 2010-01-13  Doug Kwan  <dougkwan@google.com>
7001
7002         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7003         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7004         Arm_relobj::scan_section_for_cortex_a8_erratum,
7005         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7006         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7007         sections to scan for relocation stubs into a new method
7008         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7009         relocation and Cortex-A8 stub scanning.
7010         (Target_arm::do_relax): Force stubs to be after stubbed sections
7011         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7012         the beginning of a new relaxation pass.  Update a comment.
7013         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7014
7015 2010-01-12  Ian Lance Taylor  <iant@google.com>
7016
7017         * target-reloc.h (visibility_error): New inline function.
7018         (relocate_section): Call visibility_error.
7019         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7020         (MOSTLYCLEANFILES): Likewise.
7021         (protected_4_pic.o, protected_3.err): New targets.
7022         * testsuite/protected_4.cc: New file.
7023
7024 2010-01-12  Doug Kwan  <dougkwan@google.com>
7025
7026         * arm.cc (Cortex_a8_reloc): New class.
7027         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7028         and cortex_a8_relocs_info_.
7029         (Target_arm::fix_cortex_a8): New method definition.
7030         (Target_arm::Cortex_a8_relocs_info): New type.
7031         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7032         New data member declarations.
7033         (Target_arm::scan_reloc_for_stub): Record information about
7034         relocations for THUMB branches that might be exempted from the
7035         Cortex-A8 workaround.
7036         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7037         at the beginning of a relaxation pass.
7038
7039 2010-01-12  Doug Kwan  <dougkwan@google.com>
7040
7041         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7042         (Arm_relobj::Mapping_symbol_position,
7043          Arm_reloj::Mapping_symbol_position_less,
7044          Arm_relobj::Mapping_symbols_info): New types.
7045         (Target_arm::is_mapping_symbol_name): New method definition.
7046         (Arm_relobj::do_count_local_symbols): Save information about mapping
7047         symbols.
7048
7049 2010-01-11  Doug Kwan  <dougkwan@google.com>
7050
7051         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7052         Arm_relocate_functions::thumb32_branch_upper,
7053         Arm_relocate_functions::thumb32_branch_lower,
7054         Arm_relocate_functions::thumb32_cond_branch_offset,
7055         Arm_relocate_functions::thumb32_cond_branch_upper,
7056         Arm_relocate_functions::thumb32_cond_branch_lower,
7057         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7058         branch offset encoding.
7059         (Arm_relocate_functions::thumb_branch_common): Use new branch
7060         offset encoding methods to avoid code duplication.
7061         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7062         (Stub_addend_reader::operator()): Use new branch encoding method
7063         to avoid code duplication.
7064
7065 2010-01-11  Doug Kwan  <dougkwan@google.com>
7066
7067         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7068         (Target_arm::do_finalize_sections): Define special EXIDX section
7069         symbols only if referenced.
7070         * gc.h (Garbage_collection::add_reference): New method.
7071         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7072         code duplication.
7073
7074 2010-01-11  Ian Lance Taylor  <iant@google.com>
7075
7076         * script.cc (Version_script_info::build_expression_list_lookup):
7077         Change complaing about duplicate wildcard match from error to
7078         warning.
7079
7080         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7081         of 2009-12-30.
7082         (Version_script_info::Version_script_info): Initialize globs_,
7083         default_version_, default_is_global_, and exact_.  Don't
7084         initialize globals_ or locals_.
7085         (Version_script_info::build_lookup_tables): Build local symbols
7086         first.
7087         (Version_script_info::unquote): New function.
7088         (Version_script_info::add_exact_match): New function.
7089         (Version_script_info::build_expression_list_lookup): Remove lookup
7090         parameter.  Add is_global parameter.  Change all callers.  Handle
7091         wildcard pattern specially.  Unquote pattern.  Call
7092         add_exact_match.
7093         (Version_script_info::get_name_to_match): New function.
7094         (Version_script_info::get_symbol_version): New function.
7095         (Version_script_info::get_symbol_version_helper): Remove.
7096         (Version_script_info::check_unmatched_names): Call unquote.
7097         * script.h (class Version_script_info): Change get_symbol_version
7098         to be non-inline and add is_global parameter; change all callers.
7099         Rewrite symbol_is_local.  Update declarations.  Define struct
7100         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7101         Remove globals_ and locals_ members.  Add exact_, globs_,
7102         default_version_, is_global_.
7103         (Version_script_info::Glob): Remove pattern, add expression and
7104         is_global.  Update constructor.  Change all callers.
7105         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7106         default version.
7107         (Versions::symbol_section_contents): If a symbol is undefined, or
7108         defined in a dynamic object, set the version index to
7109         VER_NDX_LOCAL.
7110         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7111         symbol_is_local.
7112         (Symbol_table::add_from_pluginobj): Likewise.
7113         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7114
7115 2010-01-11  Doug Kwan  <dougkwan@google.com>
7116
7117         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7118         (incremental_dump_LDADD): Add linking option for libintl.
7119         * Makefile.in: Regenerate.
7120
7121 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7122
7123         PR gold/11144
7124         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7125         instead of -Ds.
7126         * testsuite/Makefile.in: Regenerated.
7127
7128 2010-01-10  Doug Kwan  <dougkwan@google.com>
7129
7130         * options.h (DEFINE_var): Use parentheses around argument varname__
7131         in macro body to avoid any unintended subsequent substitutions.
7132
7133 2010-01-10  Ian Lance Taylor  <iant@google.com>
7134
7135         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7136         candidates before doing symbol resolution.
7137
7138         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7139         ODR candidates if only one is weak.
7140
7141 2010-01-08  Ian Lance Taylor  <iant@google.com>
7142
7143         * script.cc (Version_script_info::build_expression_list_lookup):
7144         Don't warn about ambiguous version, just record the ambiguity.
7145         (Version_script_info::get_symbol_version_helper): Give error if
7146         version is ambiguous.
7147
7148 2010-01-08  Doug Kwan  <dougkwan@google.com>
7149
7150         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7151           prev_data_size_ and prev_addralign_.  Remove initializer for
7152           deleted data member has_been_changed_.
7153           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7154           to determine if the table is empty.
7155           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7156           Remove.
7157           (Stub_table::add_reloc_stub): Define method in class definition
7158           instead of just declaring it there.
7159           (Stub_table::add_cortex_a8_stub): New method definition.
7160           (Stub_table::update_data_size_and_addralign): Ditto.
7161           (Stub_table::finalize_stubs): Ditto.
7162           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7163           (Stub_table::do_addralign_): Return address alignment in the
7164           (Stub_table::do_reset_address_and_file_offset): Define method in
7165           class definition instead of declaring it there.  Set current data
7166           size to be the data size of the previous pass.
7167           (Stub_table::set_final_data_size): Use current data size as the
7168           final data size.
7169           (Stub_table::relocate_stub): Change parameter type of stub from
7170           Reloc_stub pointer to Stub pointer.
7171           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7172           (Stub_table::Cortex_a8_stub_list): New typedef.
7173           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7174            Stub_table::prev_addralign_): New data member.
7175           (Arm_relobj::Arm_relobj): Initialize data member
7176           section_has_cortex_a8_workaround_.
7177           (Arm_relobj::section_has_cortex_a8_workaround,
7178            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7179            definitions.
7180           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7181           declarations.
7182           (Target_arm::relocate_stub): Change parameter type of stub from
7183           Reloc_stub pointer to Stub pointer.
7184           (Insn_template::size, Insn_template::alignment): Handle
7185           THUMB16_SPECIAL_TYPE.
7186           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7187            Stub_table::update_data_size_and_addralign,
7188            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7189           definitions.
7190           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7191           (Stub_table::do_write): Ditto.
7192           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7193
7194 2010-01-08  Ian Lance Taylor  <iant@google.com>
7195
7196         PR 11108
7197         * symtab.h (class Symbol): Remove fields is_target_special_ and
7198         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7199         (Symbol::is_defined_in_discarded_section): New function.
7200         (Symbol::set_is_defined_in_discarded_section): New function.
7201         (Symbol::has_plt_offset): Rewrite.
7202         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7203         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7204         Don't initialize is_target_special_ or has_plt_offset_.
7205         Initialize is_defined_in_discarded_section_.
7206         (Symbol_table::add_from_relobj): If appropriate, set
7207         is_defined_in_discarded_section.
7208         * resolve.cc (Symbol::override_base_with_special): Don't test
7209         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7210         * target-reloc.h (relocate_section): Do special handling for
7211         symbols defined in discarded sections for global symbols as well
7212         as local symbols.
7213
7214 2010-01-08  Ian Lance Taylor  <iant@google.com>
7215
7216         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7217         the SHT_SYMTAB case.
7218
7219 2010-01-08  Ian Lance Taylor  <iant@google.com>
7220
7221         * object.cc (Sized_relobj::do_layout): Don't get confused if
7222         layout_eh_frame returns NULL.
7223
7224 2010-01-08  Ian Lance Taylor  <iant@google.com>
7225
7226         PR 11084
7227         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7228         dynamic symbol table, use the normal symbol table.
7229         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7230         symbol table.
7231
7232 2010-01-08  Ian Lance Taylor  <iant@google.com>
7233
7234         PR 11072
7235         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7236         sections.
7237
7238 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7239
7240         * version.cc (print_version): Change to "Copyright 2010".
7241
7242 2010-01-08  Ian Lance Taylor  <iant@google.com>
7243
7244         PR 10287
7245         PR 11063
7246         * i386.cc (class Target_i386): Change return type of plt_section
7247         to be non-const.
7248         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7249         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7250         tls_desc_rel_ field.
7251         (Output_data_plt_i386::rel_tls_desc): New function.
7252         (Target_i386::rel_tls_desc_section): New function.
7253         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7254         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7255         R_386_TLS_DESC reloc in rel_tls_desc_section.
7256         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7257         Define struct Tlsdesc_info.
7258         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7259         (Target_x86_64::do_reloc_symbol_index): New function.
7260         (Target_x86_64::add_tlsdesc_info): New function.
7261         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7262         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7263         tlsdesc_rel_ field.
7264         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7265         all callers.
7266         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7267         (Target_x86_64::rela_tlsdesc_section): New function.
7268         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7269         handling.
7270         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7271         (Target_x86_64::do_reloc_addend): New function.
7272         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7273         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7274         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7275         (Output_reloc::type): New function.
7276         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7277         (Output_reloc::is_target_specific): New function.
7278         (Output_reloc::target_arg): New function.
7279         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7280         absolute relocs and target specific relocs.
7281         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7282         add_target_specific.
7283         (class Output_data_reloc) [SHT_RELA]: Likewise.
7284         * output.cc (Output_reloc::Output_reloc): Add four new versions
7285         for absolute relocs and target specific relocs.
7286         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7287         (Output_reloc::get_symbol_index): Likewise.
7288         (Output_reloc::local_section_offset): Check that local_sym_index_
7289         is not TARGET_CODE or 0.
7290         (Output_reloc::symbol_value): Likewise.
7291         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7292         reloc.
7293         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7294         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7295         functions.
7296         * layout.cc (add_target_dynamic_tags): Use output section for
7297         DT_PLTRELSZ and DT_JMPREL.
7298
7299 2010-01-07  Ian Lance Taylor  <iant@google.com>
7300
7301         PR 11061
7302         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7303         function.
7304         (class Output_data_reloc_generic): Define.
7305         (class Output_data_reloc_base): Change base class to
7306         Output_data_reloc_generic.  Change add() method to call
7307         bump_relative_reloc_count for a relative reloc.  Remove
7308         sort_relocs_ field.
7309         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7310         to sort_relocs().
7311         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7312         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7313         appropriate.
7314         * layout.h (class Layout): Update declaration.
7315
7316 2010-01-07  Ian Lance Taylor  <iant@google.com>
7317
7318         * output.h (class Output_data): Add const version of
7319         output_section and do_output_section.
7320         (class Output_section_data): Add const version of
7321         do_output_section.
7322         (class Output_section): Likewise.
7323         * layout.cc (Layout::add_target_dynamic_tags): New function.
7324         * layout.h (class Layout): Update declarations.
7325         * arm.cc (Target_arm::do_finalize_sections): Use
7326         add_target_dynamic_tags.
7327         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7328         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7329         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7330         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7331
7332 2010-01-07  Ian Lance Taylor  <iant@google.com>
7333
7334         PR 11042
7335         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7336         object as needed.
7337
7338 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7339             Ian Lance Taylor  <iant@google.com>
7340
7341         PR 11019
7342         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7343         Xindex::read_symtab_xindex.
7344
7345 2010-01-07  Doug Kwan  <dougkwan@google.com>
7346
7347         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7348         (Insn_template::thumb16_bcond_insn): New method declaration.
7349         (Insn_template): Fix spelling.
7350         (Stub::thumb16_special): New method declaration.
7351         (Stub::do_write): Define virtual method which was previously pure
7352         virtual.
7353         (Stub::do_thumb16_special): New method declaration.
7354         (Stub::do_fixed_endian_write): New template member.
7355         (Reloc_stub::do_write): Remove.
7356         (Reloc_stub::do_fixed_endian_write): Remove.
7357         (Cortex_a8_stub): New class definition.
7358         (Stub_factory::make_cortex_a8_stub): New method definition.
7359         (Stub_factory::Stub_factory): Add missing static storage class
7360         qualifier for elf32_arm_stub_a8_veneer_blx.
7361
7362 2010-01-07  Ian Lance Taylor  <iant@google.com>
7363
7364         PR 10980
7365         * options.h (class General_options): Add --warn-unresolved-symbols
7366         and --error-unresolved-symbols.
7367         * errors.cc (Errors::undefined_symbol): Implement
7368         --warn-unresolved-symbols.
7369
7370         * options.h (class General_options): Add -z text and -z textoff.
7371         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7372
7373 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7374
7375         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7376         (Garbage_collection::cident_sections): New function.
7377         (Garbage_collection::add_cident_section): New function.
7378         (Garbage_collection::cident_sections_): New member.
7379         (gc_process_relocs): Add references to sections whose names are C
7380         identifiers.
7381         * gold.h (cident_section_start_prefix): New constant.
7382         (cident_section_stop_prefix): New constant.
7383         (is_cident): New function.
7384         * layout.cc (Layout::define_section_symbols): Replace string constants
7385         with the newly defined constants.
7386         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7387         C identifiers.
7388         * testsuite/Makefile.am: Add gc_orphan_section_test.
7389         * testsuite/Makefile.in: Regenerate.
7390         * testsuite/gc_orphan_section_test.cc: New file.
7391         * testsuite/gc_orphan_section_test.sh: New file.
7392
7393 2010-01-06  Ian Lance Taylor  <iant@google.com>
7394
7395         PR 10980
7396         * options.h (class General_options): Add --warn-shared-textrel.
7397         * layout.cc (Layout::finish_dynamic_section): Implement
7398         --warn-shared-textrel.
7399
7400         PR 10980
7401         * options.h (class General_options): Add --warn-multiple-gp.
7402
7403 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7404
7405         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7406         $(THREADSLIB) and $(LIBDL).
7407         * Makefile.in: Rebuild.
7408
7409 2010-01-06  Ian Lance Taylor  <iant@google.com>
7410
7411         PR 10980
7412         * options.cc (General_options::parse_section_start): New function.
7413         (General_options::section_start): New function.
7414         (General_options::General_options): Initialize all members.
7415         * options.h: Include <map>
7416         (class General_options): Add --section-start.  Add section_starts_
7417         member.
7418         * layout.cc (Layout::attach_allocated_section_to_segment): If
7419         --section-start was used, set the address of the segment.  Remove
7420         local sort_sections.
7421         (Layout::relaxation_loop_body): If the address of the load segment
7422         has been set by --section-start, don't use it.
7423         * output.h (Output_segment::update_flags_for_output_section): New
7424         function.
7425         * output.cc (Output_segment::add_output_section): Call
7426         update_flags_for_output_section.
7427
7428 2010-01-05  Ian Lance Taylor  <iant@google.com>
7429
7430         PR 10980
7431         * options.h (class General_options): Add --undefined-version.
7432         * script.cc (struct Version_expression): Add was_matched_by_symbol
7433         field.
7434         (Version_script_info::matched_symbol): New function.
7435         (Version_script_info::get_symbol_version_helper): Call
7436         matched_symbol.
7437         (Version_script_info::check_unmatched_names): New function.
7438         * script.h (class Version_script_info): Update declarations.
7439         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7440
7441         * options.h (class General_options): Use DEFINE_bool_alias for
7442         allow_multiple_definition.
7443         * resolve.cc (Symbol_table::should_override): Don't test
7444         allow_multiple_definition.
7445
7446         PR 10980
7447         * options.h (class General_options): Add --cref.
7448         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7449         until after printing cref table.
7450         * cref.cc: Include "symtab.h".
7451         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7452         (Cref_table_compare::operator()): New function.
7453         (Cref_inputs::gather_cref): New function.
7454         (filecol): New static const.
7455         (Cref_inputs::print_cref): New function.
7456         (Cref::print_cref): New function.
7457         * cref.h: Include <cstdio>.
7458         (class Cref): Update declarations.
7459         * mapfile.h (Mapfile::file): New function.
7460         * object.h (class Object): Define Symbols.  Declare virtual
7461         do_get_global_symbols.
7462         (Object::get_global_symbols): New function.
7463         * object.cc (Input_objects::add_object): Pass object to cref_ if
7464         --cref.
7465         (Input_objects::archive_start): Likewise.
7466         (Input_objects::archive_stop): Likewise.
7467         (Input_objects::print_cref): New function.
7468         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7469         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7470         --cref.
7471         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7472         function.
7473         * plugin.h (class Sized_pluginobj): Update declarations.
7474
7475 2010-01-05  Ian Lance Taylor  <iant@google.com>
7476
7477         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7478         to is_default_version.  Rename insdef to insdefault.
7479         (Symbol_table::add_from_relobj): Rename def to is_default_version
7480         and local to is_forced_local.
7481         (Symbol_table::add_from_pluginobj): Likewise.
7482         (Symbol_table::add_from_dynobj): Likewise.
7483         (Symbol_table::define_special_symbol): Rename insdef to
7484         insdefault.
7485
7486 2010-01-04  Ian Lance Taylor  <iant@google.com>
7487
7488         PR 10980
7489         * options.h (class General_options): Add
7490         --allow-multiple-definition and -z muldefs.
7491         * resolve.cc (Symbol_table::should_override): Don't warn about a
7492         multiple symbol definition if --allow-multiple-definition or -z
7493         muldefs.
7494
7495         PR 10980
7496         * options.h (class General_options): Add --add-needed and
7497         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7498         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7499         error if --copy-dt-needed-entries aka --add-needed is used and
7500         would cause a change in behaviour.
7501
7502         PR 10980
7503         * options.h (class General_options): Add -G as a short version of
7504         --shared.  Add no-op options -assert, -g, and -i.
7505
7506 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7507
7508         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7509         check for .text or .gnu.linkonce.t sections.
7510         * icf.cc (Icf::find_identical_sections): Ditto.
7511         Change the detection for mangled function name within the section
7512         name.
7513         * icf.h (is_section_foldable_candidate): New function.
7514
7515 2009-12-30  Ian Lance Taylor  <iant@google.com>
7516
7517         PR 10980
7518         * options.h (class General_options): Permit two dashes with
7519         --retain-symbols-file.
7520
7521 2009-12-30  Ian Lance Taylor  <iant@google.com>
7522
7523         PR 10979
7524         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7525         don't put the file header and segment headers in the text
7526         segment.
7527
7528         PR 10979
7529         * common.cc (Sort_commons::operator()): Stabilize sort when both
7530         entries are NULL.
7531         (Symbol_table::do_allocate_commons_list): When allocating common
7532         symbols, skip a symbol which is no longer common.
7533         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7534         an object before checking its type.
7535         * testsuite/common_test_2.c: New file.
7536         * testsuite/common_test_3.c: New file.
7537         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7538         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7539         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7540         (common_test_2_pic.o, common_test_2.so): New targets.
7541         (common_test_3_pic.o, common_test_3.so): New targets.
7542         * testsuite/Makefile.in: Rebuild.
7543
7544         PR 10979
7545         * script.cc (read_input_script): If we see a new SECTIONS clause,
7546         and we have added an input section, give an error.
7547         * layout.h (class Layout): Add have_added_input_section function.
7548         Add have_added_input_section_ field.
7549         * layout.cc (Layout::Layout): Initialize
7550         have_added_input_section_.
7551         (Layout::layout): Set have_added_input_section_.
7552         (Layout::layout_eh_frame): Likewise.
7553
7554 2009-12-30  Ian Lance Taylor  <iant@google.com>
7555
7556         PR 10931
7557         * options.h (class General_options): Add --sort-common option.
7558         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7559         * common.cc (Sort_common): Add sort_order parameter to
7560         constructor.  Add sort_order_ field.
7561         (Sort_commons::operator): Check sort_order_.
7562         (Symbol_table::allocate_commons): Determine the sort order.
7563         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7564         Change all callers.
7565         (Symbol_table::do_allocate_commons_list): Likewise.
7566
7567 2009-12-30  Ian Lance Taylor  <iant@google.com>
7568
7569         PR 10916
7570         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7571         symbols from this object, don't change the visibility of an
7572         undefined symbol.
7573         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7574
7575 2009-12-30  Ian Lance Taylor  <iant@google.com>
7576
7577         PR 10861
7578         * script.h (class Version_script_info): Define Language enum.
7579         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7580         new fields globals_, locals_, and is_finalized_.
7581         * script.cc: Various formatting fixes.
7582         (class Parser_closure): Change language_stack_ from a vector of
7583         std::string to one of Version_script_info::Language.  Adjust all
7584         uses accordingly.
7585         (class Lazy_demangler): Remove.
7586         (struct Version_expression): Change language from std::string to
7587         Version_script_info::Language.
7588         (Version_script_info::Version_script_info): New function.
7589         (Version_script_info::~Version_script_info): Don't call clear.
7590         (Version_script_info::finalize): New function.
7591         (Version_script_info::build_lookup_tables): New function.
7592         (Version_script_info::build_expression_list_lookup): New
7593         function.
7594         (Version_script_info::get_symbol_version_helper): Rewrite to use
7595         lookup tables.
7596         (Version_script_info::print_expression_list): Adjust to use
7597         Version_script_info::Language.
7598         (script_push_lex_into_version_mode): Check that the version script
7599         has not been finalized.
7600         (version_script_push_lang): Change language string to
7601         Version_script_info::Language.
7602         * options.cc (Command_line::version_script): New function.
7603         * options.h (class General_options): Add finalize_dynamic_list
7604         function.  Change version_script from declaration to definition.
7605         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7606         * testsuite/version_script.map: Remove duplicate def of foo.
7607         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7608         version_script.map.
7609         * testsuite/Makefile.in: Rebuild.
7610
7611 2009-12-30  Ian Lance Taylor  <iant@google.com>
7612
7613         PR 10843
7614         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7615         if the input symbol index is 0, make the output symbol index 0.
7616
7617 2009-12-30  Ian Lance Taylor  <iant@google.com>
7618
7619         PR 10670
7620         * options.h (class General_options): Add -x/--discard-all.
7621         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7622         --discard-all.  If the local symbol needs a dynamic entry, check
7623         that before handling --discard-locals.
7624
7625 2009-12-30  Ian Lance Taylor  <iant@google.com>
7626
7627         PR 10450
7628         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7629         flags to PF_R.
7630         (Output_segment::add_output_section): Don't change the flags if
7631         the type is PT_TLS.
7632
7633         PR 10450
7634         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7635         GNU hash table if they need a dynamic value.  Otherwise, don't add
7636         them if they are defined in a dynamic object or are forced local.
7637
7638 2009-12-29  Ian Lance Taylor  <iant@google.com>
7639
7640         PR 10450
7641         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7642         .gnu.hash table for a 32-bit target.
7643
7644         PR 10450
7645         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7646         regular and a dynamic object only needs a dynamic symbol table
7647         entry if it is externally visible.
7648
7649         PR 10450
7650         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7651         constructor.  Add global_offset_table_ field.
7652         (Target_i386::got_section): Set global_offset_table_.
7653         (Target_i386::do_finalize_sections): Set global_offset_table_
7654         size.
7655         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7656         in constructor.  Add global_offset_table_ field.
7657         (Target_x86_64::got_section): Set global_offset_table_.
7658         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7659         size.
7660
7661         * layout.cc (Layout::Layout): Initialize increase_relro_.
7662         (Layout::get_output_section): Add is_relro, is_last_relro, and
7663         is_first_non_relro parameters.  Change all callers.
7664         (Layout::choose_output_section): Likewise.
7665         (Layout::add_output_section_data): Likewise.
7666         (Layout::make_output_section): Likewise.
7667         (Layout::set_segment_offsets): Clear increase_relro when using a
7668         linker script.
7669         * layout.h (class Layout): Add increase_relro method.  Add
7670         increase_relro_ field.  Update declarations.
7671         * output.cc (Output_section::Output_section): Initialize
7672         is_last_relro_ and is_first_non_relro_.
7673         (Output_segment::add_output_section): Group relro sections is
7674         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7675         (Output_segment::maximum_alignment): Remove relro handling.
7676         (Output_segment::set_section_addresses): Add increase_relro
7677         parameter.  Change all callers.  Add initial alignment to align
7678         relro sections on separate page.  Remove old relro handling.
7679         (Output_segment::set_section_list_addresses): Remove in_relro
7680         parameter.  Change all callers.
7681         (Output_segment::set_offset): Add increase parameter.  Change all
7682         callers.  Remove old relro handling.
7683         * output.h (class Output_section): Add new methods: is_last_relro,
7684         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7685         Add is_last_relro_ and is_first_non_relro_ fields.
7686         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7687         Create separate .got.plt section.  Call increase_relro.
7688         * x86_64.cc (Target_x86_64::got_section): Likewise.
7689         * testsuite/relro_script_test.t: Add .got.plt.
7690
7691         PR 10450
7692         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7693         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7694         (Layout::finalize): Call set_dynamic_symbol_size.
7695         (Layout::set_dynamic_symbol_size): New function.
7696         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7697         set_dynamic_symbol_size.
7698
7699         PR 10450
7700         * output.h (class Output_section): Add is_entsize_zero_ field.
7701         * output.cc (Output_section::Output_section): Initialize
7702         is_entsize_zero_.
7703         (Output_section::set_entsize): If two different entsizes are
7704         requested, force it to zero.
7705         (Output_section::add_input_section): Set flags for .debug_str
7706         before updating section flags.  Set entsize.
7707         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7708         and SHF_STRING if all input sections have those flags.
7709
7710 2009-12-29   Rafael Espindola  <espindola@google.com>
7711
7712         * main.cc (main): Fix the sys time reporting.
7713         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7714         reporting.
7715
7716 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7717
7718         * options.cc (General_options::parse_version): Allow -v to exit
7719         without an error if there is nothing to link.
7720
7721 2009-12-29  Ian Lance Taylor  <iant@google.com>
7722
7723         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7724         using a version of gcc before 4.1.
7725         * configure: Rebuild.
7726
7727 2009-12-28  Chris Demetriou  <cgd@google.com>
7728
7729         * attributes.cc (Output_attributes_section_data::do_write): Use
7730         std::vector::front rather than std::vector::data.
7731
7732 2009-12-28  Ian Lance Taylor  <iant@google.com>
7733
7734         * symtab.h (class Symbol_table): Add enum Defined.
7735         * resolve.cc (Symbol_table::should_override): Add defined
7736         parameter.  Change all callers.  Test whether object is NULL
7737         before calling a method on it.
7738         (Symbol_table::report_resolve_problem): Add defined parameter.
7739         Change all callers.
7740         (Symbol_table::should_override_with_special): Likewise.
7741         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7742         parameter.  Change all callers.
7743         (Symbol_table::do_define_in_output_data): Likewise.
7744         (Symbol_table::define_in_output_segment): Likewise.
7745         (Symbol_table::do_define_in_output_segment): Likewise.
7746         (Symbol_table::define_as_constant): Likewise.
7747         (Symbol_table::do_define_as_constant): Likewise.
7748         * script.h (class Symbol_assignment): Add is_defsym parameter to
7749         constructor; change all callers.
7750         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7751         parameter.  Change all callers.  Add is_defsym_ field.
7752         (class Parser_closure): Add parsing_defsym parameter to
7753         constructor; change all callers.  Add parsing_defsym accessor
7754         function.  Add parsing_defsym_ field.
7755
7756 2009-12-28  Ian Lance Taylor  <iant@google.com>
7757
7758         * gold.cc (queue_middle_tasks): Fix formatting.
7759         * object.cc (Relobj::is_section_name_included): Likewise.
7760
7761 2009-12-23  Ian Lance Taylor  <iant@google.com>
7762
7763         * i386.cc (Target_i386::do_calls_non_split): Recognize
7764         -fsplit-stack prologue for a function with a static chain.
7765         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7766         -fsplit-stack prologue when using %r11.
7767
7768 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7769
7770         * options.cc (General_options::parse_version): Make -v continue and do
7771         the link like GNU ld does.
7772
7773 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7774
7775         * Makefile.am (CCFILES): Add timer.cc.
7776         (HFILES): Add timer.h.
7777         * configure.ac: Check for sysconf and times.
7778         * main.cc: include timer.h.
7779         (main): Use Timer instead of get_run_time.
7780         * timer.cc: New.
7781         * timer.h: New.
7782         * workqueue.cc: include timer.h.
7783         (Workqueue::find_and_run_task):
7784         Report user, sys and wall time.
7785         * Makefile.in: Regenerate.
7786         * config.in: Regenerate.
7787         * configure: Regenerate.
7788
7789 2009-12-16  Doug Kwan  <dougkwan@google.com>
7790
7791         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7792         sections.
7793         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7794         relaxed input sections.
7795         * output.cc (Output_section::find_relaxed_input_section): Change
7796         return type to Output_relaxed_input_section pointer.  Adjust code
7797         for new type of relaxed_input_section_map_.
7798         * output.h (Output_section::find_relaxed_input_section): Change
7799         return type to Output_relaxed_input_section pointer.
7800         (Output_section::Output_relaxed_input_section_by_input_section_map):
7801         New type.
7802         (Output_section::relaxed_input_section_map_): Change type to
7803         Output_section::Output_relaxed_input_section_by_input_section_map.
7804         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7805         input section.
7806
7807 2009-12-15  Ian Lance Taylor  <iant@google.com>
7808
7809         * layout.cc (Layout::create_shstrtab): Only write out after input
7810         sections if we are compressing debug sections.
7811
7812 2009-12-15  Ian Lance Taylor  <iant@google.com>
7813
7814         * archive.cc (Archive::add_symbols): Only look up a symbol without
7815         a version if there is, in fact, a version.
7816
7817 2009-12-14  Ian Lance Taylor  <iant@google.com>
7818
7819         Revert -Wshadow changes, all changes from:
7820         2009-12-11  Doug Kwan  <dougkwan@google.com>
7821         2009-12-11  Nick Clifton  <nickc@redhat.com>
7822         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7823
7824 2009-12-11  Doug Kwan  <dougkwan@google.com>
7825
7826         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7827         due to -Wshadow.
7828         * attributes.cc (Object_attribute::size): Ditto.
7829         (Attributes_section_data::size): Ditto.
7830         (Attributes_section_data::Attributes_section_data): Ditto.
7831         (Output_attributes_section_data::do_write): Ditto.
7832         * attributes.h (Object_attribute::set_type): Ditto.
7833         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7834
7835 2009-12-11  Nick Clifton  <nickc@redhat.com>
7836
7837         * archive.cc: Fix shadowed variable warnings.
7838         * arm.cc: Likewise.
7839         * compressed_output.cc: Likewise.
7840         * compressed_output.h: Likewise.
7841         * configure: Likewise.
7842         * dwarf_reader.cc: Likewise.
7843         * dynobj.cc: Likewise.
7844         * dynobj.h: Likewise.
7845         * ehframe.cc: Likewise.
7846         * ehframe.h: Likewise.
7847         * errors.cc: Likewise.
7848         * expression.cc: Likewise.
7849         * fileread.cc: Likewise.
7850         * fileread.h: Likewise.
7851         * freebsd.h: Likewise.
7852         * i386.cc: Likewise.
7853         * icf.cc: Likewise.
7854         * incremental.h: Likewise.
7855         * layout.cc: Likewise.
7856         * layout.h: Likewise.
7857         * mapfile.cc: Likewise.
7858         * merge.cc: Likewise.
7859         * merge.h: Likewise.
7860         * object.cc: Likewise.
7861         * object.h: Likewise.
7862         * options.h: Likewise.
7863         * output.cc: Likewise.
7864         * output.h: Likewise.
7865         * parameters.cc: Likewise.
7866         * plugin.cc: Likewise.
7867         * powerpc.cc: Likewise.
7868         * reduced_debug_output.cc: Likewise.
7869         * reduced_debug_output.h: Likewise.
7870         * reloc.cc: Likewise.
7871         * reloc.h: Likewise.
7872         * resolve.cc: Likewise.
7873         * script-sections.cc: Likewise.
7874         * script.cc: Likewise.
7875         * script.h: Likewise.
7876         * sparc.cc: Likewise.
7877         * symtab.cc: Likewise.
7878         * symtab.h: Likewise.
7879         * target-select.cc: Likewise.
7880         * target-select.h: Likewise.
7881         * token.h: Likewise.
7882         * workqueue.cc: Likewise.
7883         * workqueue.h: Likewise.
7884         * x86_64.cc: Likewise.
7885
7886 2009-12-10  Doug Kwan  <dougkwan@google.com>
7887
7888         * arm.cc (attributes.h): New include.
7889         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7890         (Arm_relobj::~Arm_relobj): Delete object pointed by
7891         attributes_section_data_.
7892         (Arm_relobj::attributes_section_data): New method definition.
7893         (Arm_relobj::attributes_section_data_): New data member declaration.
7894         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7895         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7896         attributes_section_data_.
7897         (Arm_dynobj::attributes_section_data): New method definition.
7898         (Arm_dynobj::attributes_section_data_): New data member declaration.
7899         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7900         initialization value of may_use_blx_ to false.
7901         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7902         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7903         object attributes to compute results instead of hard-coding.
7904         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7905         Target_arm::get_secondary_compatible_arch,
7906         Target_arm::set_secondary_compatible_arch
7907         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7908         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7909         New method declarations.
7910         (Target_arm::get_aeabi_object_attribute): New method definition.
7911         (Target_arm::attributes_section_data_): New data member declaration.
7912         (read_arm_attributes_section): New template definition.
7913         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7914         (Arm_dynobj::do_read_symbols): Ditto.
7915         (Target_arm::do_finalize_sections): Merge attributes sections from
7916         input.  Check for BLX use after attributes section merging.
7917         Fix __exidx_start and __exidx_end visibility.  Create an
7918         .ARM.attributes section if necessary.
7919         (Target_arm::get_secondary_compatible_arch,
7920         Target_arm::set_secondary_compatible_arch,
7921         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7922         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7923         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7924         New method definitions.
7925
7926 2009-12-09  Ian Lance Taylor  <iant@google.com>
7927
7928         * plugin.cc (Plugin::load): Don't cast from void* to a function
7929         pointer.
7930
7931 2009-12-09  Ian Lance Taylor  <iant@google.com>
7932
7933         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7934         information fields.
7935
7936 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7937
7938         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7939         Replace two_file_shared_1.so with two_file_shared_2.so.
7940         * testsuite/Makefile.in: Regenerated.
7941
7942 2009-12-08  Doug Kwan  <dougkwan@google.com>
7943
7944         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7945         (HFILES): Add attributes.h and int_encoding.h.
7946         * Makefile.in: Regenerate.
7947         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7948         function definitions to int_encoding.cc
7949         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7950         prototypes to int_encoding.h
7951         * reduced_debug_output.cc (int_encoding.h): New include.
7952         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7953         function definitions to int_encoding.cc
7954         (insert_into_vector, read_from_pointer): Move template definitions to
7955         int_encoding.h
7956         * attributes.cc: New file.
7957         * attributes.h: New file.
7958         * int_encoding.cc: New file.
7959         * int_encoding.h: New file.
7960
7961 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7962
7963         PR gold/11055
7964         * incremental-dump.cc (dump_incremental_inputs): New.
7965         (main): Use dump_incremental_inputs.
7966
7967 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7968
7969         PR gold/10893
7970         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7971         checking elfcpp::STT_FUNC.
7972         (Target_i386::Relocate::relocate): Likewise.
7973         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7974
7975         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7976         symbols from shared libraries into normal FUNC symbols.
7977
7978         * symtab.h (Symbol): Add is_func and use it.
7979
7980 2009-12-05  Doug Kwan  <dougkwan@google.com>
7981
7982         * arm.cc (Target_arm::arm_info): Initialize new fields
7983         attributes_section and attributes_vendor.
7984         * i386.cc (Target_i386::i386_info): Same.
7985         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7986         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7987         fields attributes_section and attributes_vendor.
7988         * sparc.cc (Target_sparc::sparc_info): Same.
7989         * target.h (Target::attributes_section, Target::attributes_vendor,
7990         Target::is_attributes_section, Target::attribute_arg_type,
7991         Target::attributes_order): New method definitions.
7992         (Target::Target_info::attributes_section,
7993         Target::Target_info::attributes_vendor): New fields.
7994         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7995         virtual method definitions.
7996         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7997         attributes_section and attributes_vendor.
7998         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7999
8000 2009-12-05  Doug Kwan  <dougkwan@google.com>
8001
8002         * arm.cc: Update comments about interworking and stub generation.
8003         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8004         considered as non-PIC.
8005         (Arm_relocate_functions::base_abs): Fix formatting.
8006         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8007         of function to use GOT entry address instead of offset.
8008         (Target_arm::Scan::global): Issue an error if a symbol would need a
8009         PLT does not get one because it is untyped.  Remove code to create
8010         dynamic symbols for relative branches.
8011         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8012         takes unsigned integer instead of boolean.
8013
8014 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8015
8016         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8017         (two_file_test_LDADD): Likewise.
8018         (common_test_1_LDADD): Likewise.
8019         (exception_test_LDADD) Likewise.
8020         (weak_test_LDADD): Likewise.
8021         (many_sections_test_LDADD): Likewise.
8022         (initpri1_LDADD): Likewise.
8023         (script_test_1_LDADD): Likewise.
8024         (script_test_2_LDADD): Likewise.
8025         (justsyms_LDADD): Likewise.
8026         (binary_test_LDADD): Likewise.
8027         (large_LDADD): Likewise.
8028         * testsuite/Makefile.in: Regenerated.
8029
8030 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8031
8032         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8033         (Symbol_table::override_with_special): Likewise.
8034         (Symbol_table::add_from_object): Likewise.
8035
8036 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8037
8038         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8039         Don't set the data_offset twice.
8040
8041 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8042
8043         * testsuite/Makefile.in: Regenerate.
8044
8045 2009-12-03  Doug Kwan  <dougkwan@google.com>
8046
8047         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8048         (Target_arm::do_finalize_sections): Add parameter for symbol table
8049         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8050         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8051         parameter for symbol table pointer.
8052         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8053         an additional parameter for a pointer to symbol table.
8054         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8055         parameter for a symbol table pointer.
8056         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8057         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8058         Ditto.
8059         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8060         parameter for a symbol table pointer.
8061
8062 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8063
8064         * incremental.cc (Incremental_inputs_header)
8065         (Incremental_inputs_header_write, Incremental_inputs_entry)
8066         (Incremental_inputs_entry_write): Move ...
8067         * incremental.h (Incremental_inputs_header)
8068         (Incremental_inputs_header_write, Incremental_inputs_entry)
8069         (Incremental_inputs_entry_write): here.
8070
8071 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8072
8073         * incremental.cc (make_sized_incremental_binary): Set the target.
8074         Error if it is incompatible.
8075         * output.h (Output_file): Add filename method.
8076
8077 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8078
8079         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8080         from the get_* methods.
8081
8082 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8083
8084         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8085         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8086         Write 0 for the data_offset of scripts.
8087
8088 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8089
8090         * testsuite/Makefile.am: Add the incremental_test.sh test.
8091         * testsuite/incremental_test.sh: New.
8092         * testsuite/incremental_test_1.c: New.
8093         * testsuite/incremental_test_2.c: New.
8094
8095 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8096
8097        * incremental-dump.cc (main): Fix typos.
8098
8099 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8100
8101         PR gold/11025
8102         * incremental-dump.cc (main): Use llu to print 64 bit values.
8103
8104 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8105             H.J. Lu  <hongjiu.lu@intel.com>
8106
8107         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8108         $(LIBDL).
8109         (incremental_dump_LDADD): Likewise.
8110         * Makefile.in: Regenerated.
8111
8112 2009-11-25  Doug Kwan  <dougkwan@google.com>
8113
8114         Revert:
8115
8116         2009-11-25  Doug Kwan  <dougkwan@google.com>
8117
8118                 * arm.cc (Target_arm::Target_arm): Move method definition
8119                 outside of class definition.  Add code to handle
8120                 --target1-rel, --target1-abs and --target2= options.
8121                 (Target_arm::get_reloc_reloc_type): Change method to be
8122                 non-static and const.
8123                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8124                 New data member declaration.
8125                 (Target_arm::Scan::local, Target_arm::Scan::global,
8126                 Target_arm::Relocate::relocate,
8127                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8128                 Adjust call to Target_arm::get_real_reloc_type.
8129                 (Target_arm::get_real_reloc_type): Use command line options
8130                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8131                 * options.h (--target1-rel, --target1-abs, --target2): New
8132                 ARM-only options.
8133
8134 2009-11-25  Doug Kwan  <dougkwan@google.com>
8135
8136         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8137         class definition.  Add code to handle --target1-rel, --target1-abs
8138         and --target2= options.
8139         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8140         and const.
8141         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8142         member declaration.
8143         (Target_arm::Scan::local, Target_arm::Scan::global,
8144         Target_arm::Relocate::relocate,
8145         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8146         call to Target_arm::get_real_reloc_type.
8147         (Target_arm::get_real_reloc_type): Use command line options to
8148         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8149         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8150         options.
8151
8152 2009-11-25  Doug Kwan  <dougkwan@google.com>
8153
8154         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8155         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8156         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8157         formatting.
8158         (Arm_relocate_functions::thm_call): Replace body with a call to
8159         Arm_relocate_functions::thumb_branch_common.
8160         (Arm_relocate_functions::thm_jump24,
8161         Arm_relocate_functions::thm_xpc22): New method definitions.
8162         (Arm_relocate_functions::thumb_branch_common): New method definition.
8163         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8164         operator.
8165         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8166         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8167
8168 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8169
8170         * Makefile.am: Build incremental-dump
8171         * Makefile.in: Regenerate.
8172         * incremental-dump.cc: New.
8173         * incremental.cc (Incremental_inputs_header_data,
8174         Incremental_inputs_entry_data): Move to incremental.h
8175         * incremental.h: (Incremental_inputs_header_data,
8176         Incremental_inputs_entry_data): Move from incremental.cc
8177
8178 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8179
8180         * incremental.cc (Incremental_inputs_header,
8181         Incremental_inputs_header_write, Incremental_inputs_entry,
8182         Incremental_inputs_entry_write): Add a typedef with the data type.
8183
8184 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8185
8186         * incremental.cc (Incremental_inputs_header,
8187         Incremental_inputs_header_write, Incremental_inputs_entry,
8188         Incremental_inputs_entry_write): Update comment about which
8189         type has the filed descriptions.
8190
8191 2009-11-15  Doug Kwan  <dougkwan@google.com>
8192
8193         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8194         (Arm_relocate_functions::arm_branch_common): Change method defintion
8195         in class definition to a method declaration and update list of formal
8196         parameters.
8197         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8198         Arm_relocation_functions::jump24): Adjust call to
8199         Arm_relocate_functions::arm_branch_common.  Update list of formal
8200         parameters.
8201         (Arm_relocate_functions::xpc25): New method definition.
8202         (Arm_relocate_functions::arm_branch_common): Move method defintion
8203         out from class definition.  Use stubs for mode-switching and extending
8204         branch ranges.
8205         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8206         specially.  Change code to enable use of stubs in ARM branches.
8207
8208 2009-11-10  Doug Kwan  <dougkwan@google.com>
8209
8210         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8211         in method declaration.
8212         (Target_arm::relocate_stub): New method declaration.
8213         (Target_arm::default_target): Change to return a pointer instead of
8214         a const reference.
8215         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8216         Target_arm::default_target.
8217         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8218         method definition.
8219         (Target_arm::relocate_section): Adjust view.
8220         (Target_arm::relocate_stub): New method definition.
8221
8222 2009-11-10  Doug Kwan  <dougkwan@google.com>
8223
8224         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8225         a format warning.
8226         * incremental.cc (open_incremental_binary): Initialized local
8227         variables to avoid warnings.
8228         * object.cc (make_elf_object): Ditto.
8229         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8230         a format warning.
8231
8232 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8233
8234         PR gold/10930
8235         * testsuite/plugin_test.c: Include "config.h".
8236
8237 2009-11-09  Doug Kwan  <dougkwan@google.com>
8238
8239         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8240         (arm_symbol_value): Remove.
8241         (Arm_relocate_functions::arm_branch_common,
8242         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8243         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8244         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8245         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8246         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8247         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8248         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8249         Arm_relocate_functions::thm_mobw_abs_nc,
8250         Arm_relocate_functions::thm_mov_abs,
8251         Arm_relocate_functions::movw_prel_nc,
8252         Arm_relocate_functions::thm_movt_abs,
8253         Arm_relocate_functions::movt_prel,
8254         Arm_relocate_functions::thm_movw_prel_nc,
8255         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8256         (Target_arm::Relocate::relocate): Only decompose address into two
8257         parts if relocation type uses the thumb-bit and pass the actual
8258         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8259         calls to methods in Arm_relocate_functions for this change.
8260
8261 2009-11-08  Ian Lance Taylor  <iant@google.com>
8262
8263         PR 10925
8264         * reloc.cc: Instantiate
8265         Sized_relobj::initialize_input_to_output_maps and
8266         Sized_relobj:free_input_to_output_maps.
8267
8268 2009-11-06  Ian Lance Taylor  <iant@google.com>
8269
8270         PR 10876
8271         * defstd.cc (in_segment): Set only_if_ref true for "end".
8272
8273 2009-11-06  Doug Kwan  <dougkwan@google.com>
8274
8275         * arm.cc (class Reloc_stub): Correct a comment.
8276         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8277         (Target_arm::scan_section_for_stubs): New method declaration.
8278         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8279         Change methods from private to protected.
8280         (Target_arm::do_may_relax): New method definition.
8281         (Target_arm::do_relax, Target_arm::group_sections,
8282         Target_arm::scan_reloc_for_stub,
8283         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8284         (Target_arm::arm_input_section_map_): New data member declaration.
8285         (Target_arm::scan_reloc_for_stub,
8286         Target_arm::scan_reloc_section_for_stubs,
8287         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8288         Target_arm::do_relax): New method definitions.
8289
8290 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8291
8292         * configure.ac: Check for (struct stat)::st_mtim
8293         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8294         * config.in: Regenerate.
8295         * configure: Regenerate.
8296
8297 2009-11-05  Ian Lance Taylor  <iant@google.com>
8298
8299         PR 10910
8300         * output.cc (Output_segment::add_output_section): Add missing
8301         return statement.
8302
8303 2009-11-04  Ian Lance Taylor  <iant@google.com>
8304
8305         PR 10880
8306         * object.h (class Object): Add is_needed and set_is_needed
8307         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8308         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8309         defined in a dynamic object and referenced by a regular object,
8310         set is_needed for the dynamic object.
8311         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8312         if the file is marked with as_needed and it is not needed.
8313
8314 2009-11-04  Ian Lance Taylor  <iant@google.com>
8315
8316         PR 10887
8317         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8318         tags if data is discarded by linker script.
8319         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8320         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8321         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8322         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8323
8324 2009-11-04  Ian Lance Taylor  <iant@google.com>
8325
8326         * layout.cc (Layout::get_output_section): Add is_interp and
8327         is_dynamic_linker_section parameters.  Change all callers.
8328         (Layout::choose_output_section): Likewise.
8329         (Layout::make_output_section): Likewise.
8330         (Layout::add_output_section_data): Add is_dynamic_linker_section
8331         parameter.  Change all callers.
8332         * layout.h (class Layout): Update declarations.
8333         * output.h (class Output_section): Add is_interp, set_is_interp,
8334         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8335         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8336         generate_code_fills_at_write_ to a bitfield.
8337         * output.cc (Output_section::Output_sections): Initialize new
8338         fields.
8339         (Output_segment::add_output_section): Add do_sort parameter.
8340         Change all callers.
8341
8342 2009-11-03  Ian Lance Taylor  <iant@google.com>
8343
8344         PR 10860
8345         * options.h (class General_options): Add --warn-common.
8346         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8347         merging two common symbols.
8348         (Symbol_table::should_override): Handle --warn-common when merging
8349         a common symbol with a defined symbol.  Use report_resolve_problem
8350         for multiple definitions.
8351         (Symbol_table::report_resolve_problem): New function.
8352         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8353
8354 2009-11-03  Doug Kwan  <dougkwan@google.com>
8355
8356         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8357         stub_factory_.
8358         (Target_arm::stub_factory): New method definition.
8359         (Target_arm::new_arm_input_section,
8360         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8361         Target_arm::reloc_uses_thumb_bit): New method declarations.
8362         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8363         New type definitions.
8364         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8365         member declarations.
8366         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8367         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8368         New method definitions.
8369
8370 2009-11-03  Ian Lance Taylor  <iant@google.com>
8371
8372         * options.h (class General_options): Add --warn_constructors.
8373
8374 2009-11-03  Ian Lance Taylor  <iant@google.com>
8375
8376         PR 10893
8377         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8378         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8379
8380 2009-11-03  Ian Lance Taylor  <iant@google.com>
8381
8382         PR 10895
8383         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8384         --msgid-bugs-address.
8385         (install-pdf): New target.
8386         (install-data_yes): Look up one directory to find mkinstalldirs.
8387
8388 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8389
8390         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8391         tree.
8392
8393 2009-10-30  Doug Kwan  <dougkwan@google.com>
8394
8395         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8396
8397 2009-10-30  Doug Kwan  <dougkwan@google.com>
8398
8399         * arm.cc (Stub_addend_reader): New struct template definition
8400         and partial specializations.
8401         (Stub_addend_reader::operator()): New method definition for a
8402         partially specialized template.
8403
8404 2009-10-30  Doug Kwan  <dougkwan@google.com>
8405
8406         * arm.cc (Arm_relobj::processor_specific_flags): New method
8407         definition.
8408         (Arm_relobj::do_read_symbols): New method declaration.
8409         (Arm_relobj::processor_specific_flags_): New data member declaration.
8410         (Arm_dynobj): New class definition.
8411         (Target_arm::do_finalize_sections): Add input_objects parameter.
8412         (Target_arm::do_adjust_elf_header): New method declaration.
8413         (Target_arm::are_eabi_versions_compatible,
8414         (Target_arm::merge_processor_specific_flags): New method declaration.
8415         (Target_arm::do_make_elf_object): New overloaded method definitions
8416         and declaration.
8417         (Arm_relobj::do_read_symbols): New method definition.
8418         (Arm_dynobj::do_read_symbols): Ditto.
8419         (Target_arm::do_finalize_sections): Add input_objects parameters.
8420         Merge processor-specific flags from all input objects.
8421         (Target_arm::are_eabi_versions_compatible,
8422         Target_arm::merge_processor_specific_flags,
8423         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8424         New method definitions.
8425         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8426         Input_objects pointer type parameter.
8427         * layout.cc (Layout::finalize): Pass input objects to target's.
8428         finalize_sections function.
8429         * output.cc (Output_file_header::do_sized_write): Set ELF file
8430         header's processor-specific flags.
8431         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8432         Input_objects pointer type parameter.
8433         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8434         * target.h (Input_objects): New forward class declaration.
8435         (Target::processor_specific_flags,
8436         Target::are_processor_specific_flags_sect): New method definitions.
8437         (Target::finalize_sections): Add input_objects parameter.
8438         (Target::Target): Initialize processor_specific_flags_ and
8439         are_processor_specific_flags_set_.
8440         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8441         parameter.
8442         (Target::set_processor_specific_flags): New method definition.
8443         (Target::processor_specific_flags_,
8444         Target::are_processor_specific_flags_set_): New data member
8445         declarations.
8446         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8447         Input_objects pointer type parameter.
8448
8449 2009-10-30  Doug Kwan  <dougkwan@google.com>
8450
8451         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8452
8453 2009-10-28  Ian Lance Taylor  <iant@google.com>
8454
8455         * object.h (class Relobj): Drop options parameter from
8456         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8457         do_scan_relocs, do_relocate.  Change all callers.
8458         (class Sized_relobj): Drop options parameters from
8459         do_gc_process_relocs, do_scan_relocs, do_relocate,
8460         do_relocate_sections, relocate_sections, emit_relocs_scan,
8461         emit_relocs_scan_reltype.  Change all callers.
8462         (struct Relocate_info): Remove options field and all references to
8463         it.
8464         * reloc.h (class Read_relocs): Remove options constructor
8465         parameter and options_ field.  Change all callers.
8466         (class Gc_process_relocs, class Scan_relocs): Likewise.
8467         (class Relocate_task): Likewise.
8468         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8469         all callers.
8470         (scan_relocatable_relocs): Likewise.
8471         * target.h (class Sized_target): Remove options parameter from
8472         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8473         all callers.
8474         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8475         callers.
8476         * arm.cc: Update functions to remove options parameters.
8477         * i386.cc: Likewise.
8478         * powerpc.cc: Likewise.
8479         * sparc.cc: Likewise.
8480         * x86_64.cc: Likewise.
8481         * testsuite/testfile.cc: Likewise.
8482
8483 2009-10-28  Doug Kwan  <dougkwan@google.com>
8484
8485         * arm.cc (Arm_relobj): New class definition.
8486         (Arm_relobj::scan_sections_for_stubs,
8487         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8488         New method definitions.
8489
8490 2009-10-28  Cary Coutant  <ccoutant@google.com>
8491
8492         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8493         (Plugin::cleanup_done_): New member.
8494         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8495         (Plugin_manager::cleanup_done_): Remove.
8496         (Plugin_manager::add_input_file): Edit error message.
8497         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8498         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8499
8500 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8501
8502         * fileread.cc: (File_read::View::~View): Use the new
8503         data_ownership_ filed.
8504         (File_read::~File_read): Dispose the new whole_file_view_.
8505         (File_read::open): Mmap the whole file if needed.
8506         (File_read::open): Use whole_file_view_ instead of contents_.
8507         (File_read::find_view): Use whole_file_view_ if applicable.
8508         (File_read::do_read): Use whole_file_view_ instead of contents_.
8509         (File_read::make_view): Use whole_file_view_ instead of contents_,
8510         update File_read::View::View call.
8511         (File_read::find_or_make_view): Update File_read::View::View
8512         call.
8513         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8514         remove contents_
8515         (File_read::View::Data_ownership): New enum.
8516         (File_read::View::View): Replace bool mapped_ with Data_ownership
8517         argument.
8518         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8519         (File_read::View::data_ownership_): New field.
8520         (File_read::contents_): Remove (replaced by whole_file_view_).
8521         (File_read::whole_file_view_): New field.
8522         * options.h (class General_options): Add --keep-files-mapped.
8523
8524 2009-10-27  Cary Coutant  <ccoutant@google.com>
8525
8526         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8527         * testsuite/Makefile.am (plugin_test_5): New test case.
8528         * testsuite/Makefile.in: Regenerate.
8529
8530 2009-10-25  Doug Kwan  <dougkwan@google.com>
8531
8532         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8533         from private to protected to allow access by child class.
8534         (Sized_relobj::do_relocate_sections): New method declaration.
8535         (Sized_relobj::relocate_sections): Virtualize.
8536         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8537         Sized_relobj::relocate_sections.  Instantiate template explicitly
8538         for different target sizes and endianity.
8539
8540 2009-10-24  Doug Kwan  <dougkwan@google.com>
8541
8542         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8543         (Arm_input_section::as_arm_input_section): New method.
8544         (Arm_output_section): New class definition.
8545         (Arm_output_section::create_stub_group,
8546         Arm_output_section::group_sections): New method definitions.
8547
8548 2009-10-22  Doug Kwan  <dougkwan@google.com>
8549
8550         * arm.cc (Arm_input_section): New class definition.
8551         (Arm_input_section::init, Arm_input_section:do_write,
8552         Arm_input_section::set_final_data_size,
8553         Arm_input_section::do_reset_address_and_file_offset): New method
8554         definitions.
8555
8556 2009-10-21  Doug Kwan  <dougkwan@google.com>
8557
8558         * arm.cc (Stub_table, Arm_input_section): New forward class
8559         declarations.
8560         (Stub_table): New class defintion.
8561         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8562         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8563         New method definition.
8564
8565 2009-10-21  Doug Kwan  <dougkwan@google.com>
8566
8567         * arm.cc: Update copyright comments.
8568         (Target_arm): New forward class template declaration.
8569         (Arm_address): New type.
8570         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8571         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8572         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8573         constants.
8574         (Insn_template): Same.
8575         (DEF_STUBS): New macro.
8576         (Stub_type): New enum type.
8577         (Stub_template): New class definition.
8578         (Stub): Same.
8579         (Reloc_stub): Same.
8580         (Stub_factory): Same.
8581         (Target_arm::Target_arm): Initialize may_use_blx_ and
8582         should_force_pic_veneer_.
8583         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8584         Target_arm::should_force_pic_veneer,
8585         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8586         Target_arm::using_thumb_only, Target_arm:;default_target): New
8587         method defintions.
8588         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8589         New data member declarations.
8590         (Insn_template::size, Insn_template::alignment): New method defintions.
8591         (Stub_template::Stub_template): New method definition.
8592         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8593         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8594         (Stub_factory::Stub_factory): New method definition.
8595         * gold.h (string_hash): New template.
8596         * output.h (Input_section_specifier::hash_value): Use
8597         gold::string_hash.
8598         (Input_section_specifier::string_hash): Remove.
8599         * stringpool.cc (Stringpool_template::string_hash): Use
8600         gold::string_hash.
8601
8602 2009-10-20  Doug Kwan  <dougkwan@google.com>
8603
8604         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8605         symbols of relaxed input sections.
8606         * output.h (Output_section::find_relaxed_input_section): Make
8607         method public.
8608
8609 2009-10-16  Doug Kwan  <dougkwan@google.com>
8610
8611         * dynobj.cc (Versions::Versions): Initialize version_script_.
8612         Only insert base version symbol definition for a shared object
8613         if version script defines any version versions.
8614         (Versions::define_base_version): New method definition.
8615         (Versions::add_def): Check that base version is not needed.
8616         (Versions::add_need): Define base version lazily.
8617         * dynobj.h (Versions::define_base_version): New method declaration.
8618         (Versions::needs_base_version_): New data member declaration.
8619         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8620         (check_DATA): Add no_version_test.stdout.
8621         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8622         New make rules.
8623         * testsuite/Makefile.in: Regenerate.
8624         * testsuite/no_version_test.c: New file.
8625         * testsuite/no_version_test.sh: Ditto.
8626
8627 2009-10-16  Doug Kwan  <dougkwan@google.com>
8628
8629         * expression.cc (class Segment_start_expression): New class definition.
8630         (Segment_start_expression::value): New method definition.
8631         (script_exp_function_segment_start): Return a new
8632         Segment_start_expression.
8633         * gold/script-c.h (script_saw_segment_start_expression): New function
8634         prototype.
8635         * script-sections.cc (Script_sections::Script_sections): Initialize
8636         SAW_SEGMENT_START_EXPRESSION_ to false.
8637         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8638         and -Tbbs options to specify section addresses if given in
8639         command line and no SEGMENT_START expression is seen in a script.
8640         * script-sections.h (Script_sections::saw_segment_start_expression,
8641         Script_sections::set_saw_segment_start_expression): New method
8642         definition.
8643         (Script_sections::saw_segment_start_expression_): New data member
8644         declaration.
8645         * script.cc (script_saw_segment_start_expression): New function.
8646         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8647         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8648         script_test_7.sh and script_test_8.sh.
8649         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8650         script_test_8.stdout.
8651         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8652         (script_test_6, script_test_6.stdout, script_test_7,
8653         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8654         * Makefile.in: Regenerate.
8655         * testsuite/script_test_6.sh: New file.
8656         * testsuite/script_test_6.t: Same.
8657         * testsuite/script_test_7.sh: Same.
8658         * testsuite/script_test_7.t: Same.
8659         * testsuite/script_test_8.sh: Same.
8660
8661 2009-10-16  Doug Kwan  <dougkwan@google.com>
8662
8663         * output.cc (Output_segment::set_section_list_address): Cast
8664         expressions to unsigned long long type to avoid format warnings.
8665
8666 2009-10-15  Ian Lance Taylor  <iant@google.com>
8667
8668         * script.cc (Script_options::add_symbol_assignment): Always add a
8669         dot assignment to script_sections_.
8670         * script-sections.cc (Script_sections::add_dot_assignment):
8671         Initialize if necessary.
8672
8673         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8674         program headers with no load segment if there is a linker script.
8675
8676         * layout.cc (Layout::set_segment_offsets): Align the file offset
8677         to the segment aligment for -N or -n with no load segment.
8678         * output.cc (Output_segment::add_output_section): Don't crash if
8679         the first section is a TLS section.
8680         (Output_segment::set_section_list_addresses): Print an error
8681         message if the address moves backward in a linker script.
8682         * script-sections.cc
8683         (Output_section_element_input::set_section_addresses): Don't
8684         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8685         (Orphan_output_section::set_section_addresses): Likewise.
8686
8687 2009-10-15  Doug Kwan  <dougkwan@google.com>
8688
8689         * layout.cc (Layout::finish_dynamic_section): Generate tags
8690         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8691         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8692         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8693
8694 2009-10-14  Ian Lance Taylor  <iant@google.com>
8695
8696         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8697         fields.
8698         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8699         data_shdr fields of relinfo.
8700         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8701         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8702         R_386_TLS_LDO_32, adjust based on section flags.
8703         (Target_i386::Relocate::fix_up_ldo): Remove.
8704
8705 2009-10-13  Ian Lance Taylor  <iant@google.com>
8706
8707         Add support for -pie.
8708         * options.h (class General_options): Add -pie and
8709         --pic-executable.
8710         (General_options::output_is_position_independent): Test -pie.
8711         (General_options::output_is_executable): Return true if not shared
8712         and not relocatable.
8713         (General_options::output_is_pie): Remove.
8714         * options.cc (General_options::finalize): Reject incompatible uses
8715         of -pie.
8716         * gold.cc (queue_middle_tasks): A -pie link is not static.
8717         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8718         * symtab.cc (Symbol::final_value_is_known): Return false if
8719         output_is_position_independent.
8720         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8721         output_is_position_independent.
8722         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8723         output_is_position_independent.
8724         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8725         output_is_position_independent.
8726         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8727         two_file_pie_test.
8728         (basic_pie_test.o, basic_pie_test): New targets.
8729         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8730         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8731         (two_file_pie_test): New target.
8732         * testsuite/Makefile.in: Rebuild.
8733         * README: Remove note saying that -pie is not supported.
8734
8735 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8736
8737         * options.h (class General_options): Add -init and -fini.
8738         * layout.cc (Layout::finish_dynamic_section): Emit
8739         given init and fini functions.
8740
8741 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8742
8743         * gc.h (gc_process_relocs): Check if icf is enabled using new
8744         function.
8745         * gold.cc (queue_initial_tasks): Likewise.
8746         (queue_middle_tasks): Likewise.
8747         * object.cc (do_layout): Likewise.
8748         * symtab.cc (is_section_folded): Likewise.
8749         * main.cc (main): Likewise.
8750         * reloc.cc (Read_relocs::run): Likewise.
8751         (Sized_relobj::do_scan_relocs): Likewise.
8752         * icf.cc (is_function_ctor_or_dtor): New function.
8753         (Icf::find_identical_sections): Check if function is ctor or dtor when
8754         safe icf is chosen.
8755         * options.h (General_options::icf): Change option to be an enum.
8756         (Icf_status): New enum.
8757         (icf_enabled): New method.
8758         (icf_safe_folding): New method.
8759         (set_icf_status): New method.
8760         (icf_status_): New variable.
8761         * (options.cc) (General_options::finalize): Set icf_status_.
8762         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8763         icf_test and icf_keep_unique_test to use the --icf enum flag.
8764         * testsuite/icf_safe_test.sh: New file.
8765         * testsuite/icf_safe_test.cc: New file.
8766
8767 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8768
8769         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8770         includes to gc.h and icf.h.
8771         * arm.cc: Include gc.h.
8772         * gold.cc: Likewise.
8773         * i386.cc: Likewise.
8774         * powerpc.cc: Likewise.
8775         * sparc.cc: Likewise.
8776         * x86_64.cc: Likewise.
8777         * gc.h: Include icf.h.
8778
8779 2009-10-11  Ian Lance Taylor  <iant@google.com>
8780
8781         * plugin.cc: Include "gold.h" before other header files.
8782
8783 2009-10-10  Chris Demetriou  <cgd@google.com>
8784
8785         * options.h (Input_file_argument::Input_file_type): New enum.
8786         (Input_file_argument::is_lib_): Replace with...
8787         (Input_file_argument::type_): New member.
8788         (Input_file_argument::Input_file_argument): Take Input_file_type
8789         'type' rather than boolean 'is_lib' as second argument.
8790         (Input_file_argument::is_lib): Use type_.
8791         (Input_file_argument::is_searched_file): New function.
8792         (Input_file_argument::may_need_search): Handle is_searched_file.
8793         * options.cc (General_options::parse_library): Support -l:filename.
8794         (General_options::parse_just_symbols): Update for Input_file_argument
8795         changes.
8796         (Command_line::process): Likewise.
8797         * archive.cc (Archive::get_file_and_offset): Likewise.
8798         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8799         * script.cc (read_script_file, script_add_file): Likewise.
8800         * fileread.cc (Input_file::Input_file): Likewise.
8801         (Input_file::will_search_for): Handle is_searched_file.
8802         (Input_file::open): Likewise.
8803         * readsyms.cc (Read_symbols::get_name): Likewise.
8804         * testsuite/Makefile.am (searched_file_test): New test.
8805         * testsuite/Makefile.in: Regenerate.
8806         * testsuite/searched_file_test.cc: New file.
8807         * testsuite/searched_file_test_lib.cc: New file.
8808
8809 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8810             Ian Lance Taylor  <iant@google.com>
8811
8812         * descriptor.cc: Include <cstdio> and "binary-io.h".
8813         (Descriptors::open): Open the files in binary mode always.
8814         * script.cc (Lex::get_token): Treat \r as whitespace.
8815
8816 2009-10-09  Ian Lance Taylor  <iant@google.com>
8817
8818         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8819
8820 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8821             Ian Lance Taylor  <iant@google.com>
8822
8823         * configure.ac: Check for readv function also.
8824         * fileread.cc (readv): Define if not HAVE_READV.
8825         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8826         does not exist.
8827         * config.in: Regenerate.
8828         * configure: Regenerate.
8829
8830 2009-10-09  Doug Kwan  <dougkwan@google.com>
8831
8832         * layout.cc (Layout::make_output_section): Call target hook to make
8833         ordinary output section.
8834         (Layout::finalize): Adjust parameter list of call the
8835         Target::may_relax().
8836         * layout.h (class Layout::section_list): New method.
8837         * merge.h (Output_merge_base::entsize): Change visibility to public.
8838         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8839         New methods.
8840         (Output_merge_string::do_is_string): New method.
8841         * object.cc (Sized_relobj::do_setup): renamed from
8842         Sized_relobj::set_up.
8843         * object.h (Sized_relobj::adjust_shndx,
8844         Sized_relobj::initializ_input_to_output_maps,
8845         Sized_relobj::free_input_to_output_maps): Change visibilities to
8846         protected.
8847         (Sized_relobj::setup): Virtualize.
8848         (Sized_relobj::do_setup): New method declaration.
8849         (Sized_relobj::invalidate_section_offset,
8850         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8851         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8852         * options.cc (parse_int): New function.
8853         * options.h (parse_int): New declaration.
8854         (DEFINE_int): New macro.
8855         (stub_group_size): New option.
8856         * output.cc (Output_section::Output_section): Initialize memebers
8857         merge_section_map_, merge_section_by_properties_map_,
8858         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8859         (Output_section::add_input_section): Handled deferred code-fill
8860         generation and remove an old comment.
8861         (Output_section::add_relaxed_input_section): New method definition.
8862         (Output_section::add_merge_input_section): Use merge section by
8863         properties map to speed to search.  Update merge section maps
8864         as appropriate.
8865         (Output_section::build_relaxation_map): New method definition.
8866         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8867         Same.
8868         (Output_section::relax_input_section): Renamed to
8869         Output_section::convert_input_sections_to_relaxed_sections and change
8870         interface to take a vector of pointers to relaxed sections.
8871         (Output_section::find_merge_section,
8872         Output_section::find_relaxed_input_section): New method definitions.
8873         (Output_section::is_input_address_mapped,
8874         Output_section::output_offset, Output_section::output_address):
8875         Use output section data maps to speed up searching.
8876         (Output_section::find_starting_output_address): Add comments.
8877         (Output_section::do_write,
8878         Output_section::write_to_postprocessing_buffer): Do code-fill
8879         generation as appropriate.
8880         (Output_section::get_input_sections): Invalidate relaxed input section
8881         map.
8882         (Output_section::restore_states): Adjust type of checkpoint .
8883         Invalidate relaxed input section map.
8884         * output.h (Output_merge_base): New class declaration.
8885         (Input_section_specifier): New class defintion.
8886         (class Output_relaxed_input_section) Change base class to
8887         Output_section_data_build.
8888         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8889         base class initializer.
8890         (Output_section::add_relaxed_input_section): New method declaration.
8891         (Output_section::Input_section): Change visibility to protected.
8892         (Output_section::Input_section::relobj,
8893         Output_section::Input_section::shndx): Handle relaxed input sections.
8894         Output_section::input_sections) Change visibility to protected.  Also
8895         define overload to return a non-const pointer.
8896         (Output_section::Merge_section_properties): New class defintion.
8897         (Output_section::Merge_section_by_properties_map,
8898         Output_section::Output_section_data_by_input_section_map,
8899         Output_section::Relaxation_map): New types.
8900         (Output_section::relax_input_section): Rename method to
8901         Output_section::convert_input_sections_to_relaxed_sections and change
8902         interface to take a vector of relaxed section pointers.
8903         (Output_section::find_merge_section,
8904         Output_section::find_relaxed_input_section,
8905         Output_section::build_relaxation_map,
8906         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8907         New method declarations.
8908         (Output_section::merge_section_map_
8909         Output_section::merge_section_by_properties_map_,
8910         Output_section::relaxed_input_section_map_,
8911         Output_section::is_relaxed_input_section_map_valid_,
8912         Output_section::generate_code_fills_at_write_): New data members.
8913         * script-sections.cc
8914         (Output_section_element_input::set_section_addresses): Call
8915         current_data_size and addralign methods of relaxed input sections.
8916         (Orphan_output_section::set_section_addresses): Call current_data_size
8917         and addralign methods of relaxed input sections.
8918         * symtab.cc (Symbol_table::compute_final_value): Extract template
8919         from the body of Symbol_table::sized_finalize_symbol.
8920         (Symbol_table::sized_finalized_symbol): Call
8921         Symbol_table::compute_final_value.
8922         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8923         (Symbol_table::compute_final_value): New templated method declaration.
8924         * target.cc (Target::do_make_output_section): New method defintion.
8925         * target.h (Target::make_output_section): New method declaration.
8926         (Target::relax): Add more parameters for input objects, symbol table
8927         and layout.  Adjust call to do_relax.
8928         (Target::do_make_output_section): New method declaration.
8929         (Target::do_relax): Add parameters for input objects, symbol table
8930         and layout.
8931
8932 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8933
8934         * pread.c: Include stdio.h.
8935
8936 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8937
8938         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8939         defined.
8940
8941 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8942
8943         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8944         Change read_shndx type to unsigned int.
8945         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8946         int.
8947         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8948         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8949         Change read_shndx type to unsigned int.
8950         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8951         int.
8952         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8953         * layout.cc (Layout::create_symtab_sections): Cast the result of
8954         local_symcount * symsize to off_t in the gold_assert.
8955
8956 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8957
8958         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8959         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8960         R_ARM_BASE_ABS.
8961         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8962         (Arm_relocate_functions::thm_abs5): New function.
8963         (Arm_relocate_functions::abs12): New function.
8964         (Arm_relocate_functions::abs16): New function.
8965         (Arm_relocate_functions::base_abs): New function.
8966         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8967         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8968         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8969         R_ARM_BASE_ABS.
8970         (Scan::global): Likewise.
8971         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8972         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8973         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8974         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8975         R_ARM_BASE_ABS.
8976
8977 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8978
8979         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8980         (Arm_relocate_functions::movt_prel): New function.
8981         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8982         (Arm_relocate_functions::thm_movt_prel): New function.
8983         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8984         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8985         (Scan::global, Relocate::relocate): Likewise.
8986         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8987
8988 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8989
8990         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8991         Incremental_checker.
8992         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8993         unsigned int.
8994         (class Incremental_inputs_header): New class.
8995         (Incremental_inputs_header_writer): Edit comment.
8996         (Incremental_inputs_entry): New class.
8997         (Incremental_inputs_entry_writer): Edit comment.
8998         (Sized_incremental_binary::do_find_incremental_inputs_section):
8999         Add *strtab_shndx parameter, fill it.
9000         (Sized_incremental_binary::do_check_inputs): New method.
9001         (Incremental_checker::can_incrementally_link_output_file): Use
9002         Sized_incremental_binary::check_inputs.
9003         (Incremental_inputs::report_command_line): Save command line in
9004         command_line_.
9005         * incremental.h:
9006         (Incremental_binary::find_incremental_inputs_section): New
9007         method.
9008         (Incremental_binary::do_find_incremental_inputs_section): Add
9009         strtab_shndx parameter.
9010         (Incremental_binary::do_check_inputs): New pure virtual method.
9011         (Sized_incremental_binary::do_check_inputs): Declare.
9012         (Incremental_checker::Incremental_checker): Add incremental_inputs
9013         parameter, use it to initialize incremental_inputs_.
9014         (Incremental_checker::incremental_inputs_): New field.
9015         (Incremental_checker::command_line): New method.
9016         (Incremental_checker::inputs): New method.
9017         (Incremental_checker::command_line_): New field.
9018
9019 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9020
9021         * incremental.cc: Include <cstdarg> and "target-select.h".
9022         (vexplain_no_incremental): New function.
9023         (explain_no_incremental): New function.
9024         (Incremental_binary::error): New method.
9025         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9026         method.
9027         (make_sized_incremental_binary): New function.
9028         (open_incremental_binary): New function.
9029         (can_incrementally_link_file): Add checks if output is ELF and has
9030         inputs section.
9031         * incremental.h: Include "elfcpp_file.h" and "output.h".
9032         (Incremental_binary): New class.
9033         (Sized_incremental_binary): New class.
9034         (open_incremental_binary): Declare.
9035         * object.cc (is_elf_object): Use
9036         elfcpp::Elf_recognizer::is_elf_file.
9037         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9038         * output.h (Output_file::filesize): New method.
9039
9040 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9041
9042         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9043         New function.
9044         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9045         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9046         function.
9047         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9048         function.
9049         (Arm_relocate_functions::movw_abs_nc): New function.
9050         (Arm_relocate_functions::movt_abs): New function.
9051         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9052         (Arm_relocate_functions::thm_movt_abs): New function.
9053         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9054         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9055         (Scan::global): Likewise.
9056         (Relocate::relocate): Likewise.
9057         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9058
9059 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9060
9061         * arm.cc (Arm_relocate_functions::got_prel) New function.
9062         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9063         (Relocate::relocate): Likewise.
9064         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9065
9066 2009-10-06  Ian Lance Taylor  <iant@google.com>
9067
9068         * options.h (class General_options): Define
9069         split_stack_adjust_size parameter.
9070         * object.h (class Object): Add uses_split_stack_ and
9071         has_no_split_stack_ fields.  Add uses_split_stack and
9072         has_no_split_stack accessor functions.  Declare
9073         handle_split_stack_section.
9074         (class Reloc_symbol_changes): Define.
9075         (class Sized_relobj): Define Function_offsets.  Declare
9076         split_stack_adjust, split_stack_adjust_reltype, and
9077         find_functions.
9078         * object.cc (Object::handle_split_stack_section): New function.
9079         (Sized_relobj::do_layout): Call handle_split_stack_section.
9080         * dynobj.cc (Sized_dynobj::do_layout): Call
9081         handle_split_stack_section.
9082         * reloc.cc (Sized_relobj::relocate_sections): Call
9083         split_stack_adjust for executable sections in split_stack
9084         objects.  Pass reloc_map to relocate_section.
9085         (Sized_relobj::split_stack_adjust): New function.
9086         (Sized_relobj::split_stack_adjust_reltype): New function.
9087         (Sized_relobj::find_functions): New function.
9088         * target-reloc.h: Include "object.h".
9089         (relocate_section): Add reloc_symbol_changes parameter.  Change
9090         all callers.
9091         * target.h (class Target): Add calls_non_split method.  Declare
9092         do_calls_non_split virtual method.  Declare match_view and
9093         set_view_to_nop.
9094         * target.cc: Include "elfcpp.h".
9095         (Target::do_calls_non_split): New function.
9096         (Target::match_view): New function.
9097         (Target::set_view_to_nop): New function.
9098         * gold.cc (queue_middle_tasks): Give an error if mixing
9099         split-stack and non-split-stack objects with -r.
9100         * i386.cc (Target_i386::relocate_section): Add
9101         reloc_symbol_changes parameter.
9102         (Target_i386::do_calls_non_split): New function.
9103         * x86_64.cc (Target_x86_64::relocate_section): Add
9104         reloc_symbol_changes parameter.
9105         (Target_x86_64::do_calls_non_split): New function.
9106         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9107         parameter.
9108         * powerpc.cc (Target_powerpc::relocate_section): Add
9109         reloc_symbol_changes parameter.
9110         * sparc.cc (Target_sparc::relocate_section): Add
9111         reloc_symbol_changes parameter.
9112         * configure.ac: Call AM_CONDITIONAL for the default target.
9113         * configure: Rebuild.
9114         * testsuite/Makefile.am (TEST_AS): New variable.
9115         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9116         (check_DATA): Add split_i386 and split_x86_64 files.
9117         (SPLIT_DEFSYMS): Define.
9118         (split_i386_[1234n].o): New targets.
9119         (split_i386_[124]): New targets.
9120         (split_i386_[1234r].stdout): New targets.
9121         (split_x86_64_[1234n].o): New targets.
9122         (split_x86_64_[124]): New targets.
9123         (split_x86_64_[1234r].stdout): New targets.
9124         (MOSTLYCLEANFILES): Add new executables.
9125         * testsuite/split_i386.sh: New file.
9126         * testsuite/split_x86_64.sh: New file.
9127         * testsuite/split_i386_1.s: New file.
9128         * testsuite/split_i386_2.s: New file.
9129         * testsuite/split_i386_3.s: New file.
9130         * testsuite/split_i386_4.s: New file.
9131         * testsuite/split_i386_n.s: New file.
9132         * testsuite/split_x86_64_1.s: New file.
9133         * testsuite/split_x86_64_2.s: New file.
9134         * testsuite/split_x86_64_3.s: New file.
9135         * testsuite/split_x86_64_4.s: New file.
9136         * testsuite/split_x86_64_n.s: New file.
9137         * testsuite/testfile.cc (Target_test): Update relocation_section
9138         function.
9139         * testsuite/Makefile.in: Rebuild.
9140
9141 2009-10-06  Ian Lance Taylor  <iant@google.com>
9142
9143         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9144         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9145         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9146         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9147         the address on ldo_addrs_.
9148         (Target_i386::Relocate::fix_up_ldo): New function.
9149
9150 2009-10-06   Rafael Espindola  <espindola@google.com>
9151
9152         * plugin.cc (add_input_library): New.
9153         (Plugin::load): Add add_input_library to tv.
9154         (Plugin_manager::add_input_file): Add the is_lib argument.
9155         (add_input_file): Update call to Plugin_manager::add_input_file.
9156         (add_input_library): New.
9157         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9158
9159 2009-09-30  Doug Kwan  <dougkwan@google.com>
9160
9161         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9162         symbol and call Symbol::may_need_copy_reloc to determine if
9163         a copy reloc is needed.
9164         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9165         nocopyreloc is given in command line.
9166         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9167         given in command line.
9168         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9169         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9170         of the removed Target_i386::may_need_copy_reloc.
9171         * options.h (copyreloc): New option with default value false.
9172         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9173         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9174         instead of the removed Target_powerpc::may_need_copy_reloc.
9175         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9176         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9177         instead of the removed Target_sparc::may_need_copy_reloc.
9178         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9179         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9180         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9181         instead of the removed Target_x86_64::may_need_copy_reloc.
9182
9183 2009-09-30  Ian Lance Taylor  <iant@google.com>
9184
9185         * object.h (class Object): Remove target_ field, and target,
9186         sized_target, and set_target methods.
9187         (Object::sized_target): Remove.
9188         (class Sized_relobj): Update declarations.  Remove sized_target.
9189         * object.cc (Sized_relobj::setup): Remove target parameter.
9190         Change all callers.
9191         (Input_objects::add_object): Don't do anything with the target.
9192         (make_elf_sized_object): Add punconfigured parameter.  Change all
9193         callers.  Set or test parameter target.
9194         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9195         Change all callers.
9196         * parameters.cc (Parameters::set_target): Change parameter type to
9197         be non-const.
9198         (Parameters::default_target): Remove.
9199         (set_parameters_target): Change parameter type to be non-const.
9200         (parameters_force_valid_target): New function.
9201         (parameters_clear_target): New function.
9202         * parameters.h (class Parameters): Update declarations.  Remove
9203         default_target method.  Add sized_target and clear_target
9204         methods.  Change target_ to be non-const.
9205         (set_parameters_target): Update declaration.
9206         (parameters_force_valid_target): Declare.
9207         (parameters_clear_target): Declare.
9208         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9209         as NULL if we aren't searching.
9210         (Add_symbols::run): Don't check for compatible target.
9211         * fileread.cc (Input_file::open_binary): Call
9212         parameters_force_valid_target.
9213         * gold.cc (queue_middle_tasks): Likewise.
9214         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9215         set_target on object.
9216         * dynobj.h (class Sized_dynobj): Update declarations.
9217         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9218         make_elf_object returns NULL.
9219         (Archive::include_member): Don't check whether object target is
9220         compatible.
9221         * output.cc (Output_section::add_input_section): Get target from
9222         parameters.
9223         (Output_section::relax_input_section): Likewise.
9224         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9225         parameters.
9226         (Sized_relobj::do_scan_relocs): Likewise.
9227         (Sized_relobj::relocate_sections): Likewise.
9228         * resolve.cc (Symbol_table::resolve): Likewise.
9229         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9230         parameter.  Change all callers.
9231         (Symbol_table::add_from_object): Get target from parameters.
9232         (Symbol_table::add_from_relobj): Don't check object target.
9233         (Symbol_table::add_from_dynobj): Likewise.
9234         (Symbol_table::define_special_symbol): Get target from
9235         parameters.
9236         * symtab.h (class Symbol_table): Update declaration.
9237         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9238         parameter.  Change all callers.  Clear parameter target.
9239         (Binary_test): Test target here.
9240         * testsuite/object_unittest.cc (gold_testsuite): Remove
9241         target_test_pointer parameter.  Change all callers.
9242         (Object_test): Test target here.
9243
9244 2009-09-26  Ian Lance Taylor  <iant@google.com>
9245
9246         * testsuite/initpri1.c: Don't try to use constructor priorities if
9247         compiling with gcc before 4.3.
9248
9249 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9250
9251         * testsuite/retain_symbols_file_test.sh (check_present): Change
9252         output file name to retain_symbols_file_test.stdout.
9253         (check_absent): Likewise.
9254
9255 2009-09-18  Craig Silverstein  <csilvers@google.com>
9256
9257         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9258         * options.cc: Include <cerrno> and <fstream>.
9259         (General_options::finalize): Parse -retain-symbols-file tag.
9260         * options.h: New flag.
9261         (General_options): New method should_retain_symbol, new
9262         variable symbols_to_retain.
9263         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9264         should_retain_symbol map.
9265         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9266         * testsuite/Makefile.in: Regenerate.
9267         * testsuite/retain_symbols_file_test.sh: New file.
9268
9269 2009-09-18  Nick Clifton  <nickc@redhat.com>
9270
9271         * po/es.po: Updated Spanish translation.
9272
9273 2009-09-17  Doug Kwan  <dougkwan@google.com>
9274
9275         * debug.h (DEBUG_RELAXATION): New constant.
9276         (DEBUG_ALL): Add DEBUG_RELAXATION.
9277         (debug_string_to_enum): Add relaxation debug option.
9278         * layout.cc
9279         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9280         Layout::Relaxation_debug_check::read_sections,
9281         Layout::Relaxation_debug_check::read_sections): New method definitions.
9282         (Layout::Layout): Initialize data members
9283         record_output_section_data_from_scrips_,
9284         script_output_section_data_list_ and relaxation_debug_check_.
9285         (Layout::save_segments, Layout::restore_segments,
9286         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9287         Layout::relaxation_loop_body): New method definitions.
9288         (Layout::finalize): Support relaxation.  Move section layout code to
9289         Layout::relaxation_loop_body.
9290         (Layout::set_asection_address_from_script): Move code for orphan
9291         section placement out.
9292         (Layout::place_orphan_sections_in_script): New method definition.
9293         * layout.h (Output_segment_headers, Output_file_header):
9294         New forward class declarations.
9295         (Layout::~Layout): Define.
9296         (Layout::new_output_section_data_from_script): New method definition.
9297         (Layout::place_orphan_sections_in_script): New method declaration.
9298         (Layout::Segment_states): New type declaration.
9299         (Layout::save_segments, Layout::restore_segments,
9300         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9301         Layout::relaxation_loop_body): New method declarations.
9302         (Layout::Output_section_data_list): New type declaration.
9303         (Layout::Relaxation_debug_check): New class definition.
9304         (Layout::record_output_section_data_from_script_,
9305         Layout::script_output_section_data_list_, Layout::segment_states_,
9306         Layout::relaxation_debug_check_): New data members.
9307         * output.cc: (Output_section_headers::do_size): New method definition.
9308         (Output_section_headers::Output_section_headers): Move size
9309         computation to Output_section_headers::do_size.
9310         (Output_segment_headers::do_size): New method definition.
9311         (Output_file_header::Output_file_header): Move size computation to
9312         Output_file_header::do_size and call it.
9313         (Output_file_header::do_size): New method definition.
9314         (Output_data_group::Output_data_group): Adjust call to
9315         Output_section_data.
9316         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9317         (Output_symtab_xindex::do_write): Add array bound check.
9318         (Output_section::Input_section::print_to_mapfile): Handle
9319         RELAXED_INPUT_SECTION_CODE.
9320         (Output_section::Output_section): Initialize data member checkpoint_.
9321         (Output_section::~Output_section): Delete checkpoint object pointed
9322         by checkpoint_.
9323         (Output_section::add_input_section): Always add an Input_section if
9324         relaxing.
9325         (Output_section::add_merge_input_section): Add assert.
9326         (Output_section::relax_input_section): New method definition.
9327         (Output_section::set_final_data_size): Set load address to zero for
9328         an unallocated section.
9329         (Output_section::do_address_and_file_offset_have_reset_values):
9330         New method definition.
9331         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9332         Handle relaxed input section.
9333         (Output_section::sort_attached_input_sections): Checkpoint input
9334         section list lazily.
9335         (Output_section::get_input_sections): Change type of input_sections to
9336         list of Simple_input_section pointers.  Checkpoint input section list
9337         lazily.  Also handle relaxed input sections.
9338         (Output_section::add_input_section_for_script): Take a reference to
9339         a Simple_input_section object instead of Relobj pointer and section
9340         index as parameter.  Handle relaxed input sections.
9341         (Output_section::save_states, Output_section::restore_states): New
9342         method definitions.
9343         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9344         (Output_data::is_data_size_fixed): New method definition.
9345         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9346         if it is fixed.
9347         (Output_data::address_and_file_offset_have_reset_values): New method
9348         definition.
9349         (Output_data::do_address_and_file_offset_have_reset_values): New method
9350         definition.
9351         (Output_data::set_data_size): Check that data size is not fixed.
9352         (Output_data::fix_data_size): New method definition.
9353         (Output_data::is_data_size_fixed_): New data member.
9354         (Output_section_headers::set_final_data_size): New method definition.
9355         (Output_section_headers::do_size): New method declaration.
9356         (Output_segment_headers::set_final_data_size): New method definition.
9357         (Output_segment_headers::do_size): New method declaration.
9358         (Output_file_header::set_final_data_size)::New method definition.
9359         (Output_file_header::do_size)::New method declaration.
9360         (Output_section_data::Output_section_data): Add new parameter
9361         is_data_size_fixed and use it to fix data size.
9362         (Output_data_const::Output_data_const): Adjust call to base class
9363         constructor and fix data size.
9364         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9365         base class constructor and fix data size.
9366         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9367         base class constructor and fix data size.
9368         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9369         class constructor and fix data size.
9370         (Output_data_group::set_final_data_size): New method definition.
9371         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9372         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9373         class constructor and fix data size.
9374         (Output_relaxed_input_section): New class definition.
9375         (Output_section::Simple_input_section): New class definition.
9376         (Output_section::get_input_sections): Adjust parameter list.
9377         (Output_section::add_input_section_for_script): Same.
9378         (Output_section::save_states, Output_section::restore_states,
9379         Output_section::do_address_and_file_offset_have_reset_values,
9380         (Output_section::Input_section::Input_section): Handle
9381         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9382         Output_relaxed_input_section.
9383         (Output_section::Input_section::is_input_section,
9384         Output_section::Input_section::set_output_section): Handle relaxed
9385         input section.
9386         (Output_section::Input_section::is_relaxed_input_section,
9387         Output_section::Input_section::output_section_data,
9388         Output_section::Input_section::relaxed_input_section): New method
9389         definitions.
9390         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9391         value.
9392         (Output_section::Input_section::u1_): Update comments.
9393         (Output_section::Input_section::u2_): Add new union member poris.
9394         (Output_section::Checkpoint_output_section): New classs definition.
9395         (Output_section::relax_input_section): New method declaration.
9396         (Output_section::checkpoint_): New data member.
9397         (Output_segment): Update comments.
9398         (Output_segment::Output_segment): Un-privatize copy constructor.
9399         (Output_segment::operator=): Un-privatize.
9400         * script-sections.cc (Output_section_element::Input_section_list):
9401         Change element type to Output_section::Simple_input_section.
9402         (Output_section_element_dot_assignment::set_section_addresses):
9403         Register output section data for relaxation clean up.
9404         (Output_data_exression::Output_data_expression): Adjust call to base
9405         constructor to fix data size.
9406         (Output_section_element_data::set_section_addresses): Register
9407         Output_data_expression object for relaxation clean up.
9408         (struct Input_section_info): Replace Relobj pointer and section index
9409         pair with Output_section::Simple_input_section and Convert struct to a
9410         class.
9411         (Input_section_sorter::operator()): Adjust access to
9412         Input_section_info data member to use accessors.
9413         (Output_section_element_input::set_section_addresses): Use layout
9414         parameter.  Adjust code to use Output_section::Simple_input_section
9415         and Input_secction_info classes.  Register filler for relaxation
9416         clean up.
9417         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9418         and section index pair with Output_section::Simple_input_section
9419         class.  Adjust code accordingly.
9420         (Phdrs_element::release_segment): New method definition.
9421         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9422         segment list.
9423         (Script_sections::release_segments): New method definition.
9424         * gold/script-sections.h (Script_sections::release_segments): New
9425         method declaration.
9426         * gold/target.h (Target::may_relax, Target::relax,
9427         Target::do_may_relax, Target::do_relax): New method definitions.
9428
9429 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9430
9431         * arm.cc (has_signed_unsigned_overflow): New function.
9432         (Arm_relocate_functions::abs8): New function.
9433         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9434         (Target_arm::Scan::global): Likewise.
9435         (Target_arm::relocate::relocate): Likewise.
9436         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9437         Likewise.
9438
9439 2009-09-16  Cary Coutant  <ccoutant@google.com>
9440
9441         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9442         * testsuite/Makefile.in: Regenerate.
9443
9444 2009-09-11  Nick Clifton  <nickc@redhat.com>
9445
9446         * po/gold.pot: Updated by the Translation project.
9447
9448 2009-09-08  Cary Coutant  <ccoutant@google.com>
9449
9450         * output.cc (Output_file::open): Add execute permission to empty file.
9451         * testsuite/Makefile.am (permission_test): New test.
9452         * testsuite/Makefile.in: Regenerate.
9453
9454 2009-09-02  Ian Lance Taylor  <iant@google.com>
9455
9456         * output.cc (Output_file::resize): Call map_no_anonymous rather
9457         than map.
9458
9459 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9460
9461         * gold.cc: Include "incremental.h".
9462         (queue_initial_tasks): Call Incremental_checker methods.
9463         * incremental.cc: Include "output.h".
9464         (Incremental_checker::can_incrementally_link_output_file): New
9465         method.
9466         * incremental.h (Incremental_checker): New class.
9467
9468         * output.cc (Output_file::open_for_modification): New method.
9469         (Output_file::map_anonymous): Changed return type to bool.  Record
9470         map in base_ field.
9471         (Output_file::map_no_anonymous): New method, broken out of map.
9472         (Output_file::map): Use map_no_anonymous and map_anonymous.
9473         * output.h (class Output_file): Update declarations.
9474
9475 2009-08-24  Cary Coutant  <ccoutant@google.com>
9476
9477         * options.h (Command_line::Pre_options): New class.
9478         (Command_line::pre_options): New member.
9479         * options.cc (gold::options::ready_to_register): New variable.
9480         (One_option::register_option): Do nothing if not registering options.
9481         Assert if same short option registered twice.
9482         (General_options::General_options): Turn off option registration when
9483         done constructing.
9484         (Command_line::Pre_options::Pre_options): New constructor.
9485
9486 2009-08-24  Cary Coutant  <ccoutant@google.com>
9487
9488         * options.h (General_options::no_keep_memory): Remove incorrect
9489         short option.
9490
9491 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9492
9493         * Makefile.am (am__skiplex, am__skipyacc): New.
9494         * Makefile.in: Regenerate.
9495
9496 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9497
9498         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9499         (INCLUDES): ... this.
9500         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9501         (AM_CPPFLAGS): Renamed from ...
9502         (INCLUDE): ... this.
9503         * Makefile.in, testsuite/Makefile.in: Regenerate.
9504
9505         * Makefile.in: Regenerate.
9506         * aclocal.m4: Likewise.
9507         * config.in: Likewise.
9508         * configure: Likewise.
9509         * testsuite/Makefile.in: Likewise.
9510
9511         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9512         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9513         * Makefile.in: Regenerate.
9514         * testsuite/Makefile.in: Regenerate.
9515
9516 2009-08-19  Cary Coutant  <ccoutant@google.com>
9517
9518         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9519         symbols in shared libraries overridden by hidden or internal symbols
9520         in the main program.
9521
9522 2009-08-19  Chris Demetriou  <cgd@google.com>
9523
9524         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9525         checking source file names in error messages.
9526
9527 2009-08-18  Doug Kwan  <dougkwan@google.com>
9528
9529         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9530         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9531         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9532         an elfcpp::Ehdr as parameter.
9533         * object.cc (Object::set_target): Remove the version that looks up
9534         a target and sets it.
9535         (Sized_relobj::setup): Take a Target object instead of
9536         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9537         (make_elf_sized_object): Find target and ask target to
9538         make an ELF object.
9539         * object.h: (Object::set_target): Remove the version that looks up
9540         a target and sets it.
9541         (Sized_relobj::setup): Take a Target object instead of
9542         an elfcpp:Ehdr as parameter.
9543         * target.cc: Include dynobj.h.
9544         (Target::do_make_elf_object_implementation): New.
9545         (Target::do_make_elf_object): New.
9546         * target.h (Target::make_elf_object): New template declaration.
9547         (Target::do_make_elf_object): New method declarations.
9548         (Target::do_make_elf_object_implementation): New template declaration.
9549
9550 2009-08-14  Ian Lance Taylor  <iant@google.com>
9551
9552         * gold.h (FUNCTION_NAME): Define.
9553         (gold_unreachable): Use FUNCTION_NAME.
9554
9555 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9556
9557         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9558         symbol in the --keep-unique list is not found.
9559
9560 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9561
9562         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9563         been maked as --keep-unique.
9564         (Icf::unfold_section): New function.
9565         * icf.h (Icf::unfold_section): New function.
9566         * options.h (General_options::keep_unique): New option.
9567         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9568         * testsuite/Makefile.in: Regenerate.
9569         * testsuite/icf_keep_unique_test.sh: New file.
9570         * testsuite/icf_keep_unique_test.cc: New file.
9571
9572 2009-08-12  Cary Coutant  <ccoutant@google.com>
9573
9574         PR 10471
9575         * resolve.cc (Symbol_table::resolve): Check for references from
9576         dynamic objects to hidden and internal symbols.
9577         * testsuite/Makefile.am (hidden_test.sh): New test.
9578         * testsuite/Makefile.in: Regenerate.
9579         * testsuite/hidden_test.sh: New script.
9580         * testsuite/hidden_test_1.c: New test source.
9581         * testsuite/hidden_test_main.c: New test source.
9582
9583 2009-08-11  Doug Kwan  <dougkwan@google.com>
9584
9585         * arm.cc: Update comments.
9586         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9587         segment to locate the .ARM.exidx section if present.
9588
9589 2009-08-09  Doug Kwan  <dougkwan@google.com>
9590
9591         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9592         patch.
9593
9594 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9595         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9596         compiler warnings.
9597
9598 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9599
9600         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9601         valid tls_segment only for non-debug-section relocations.
9602         * testsuite/Makefile.am: Add gc_tls_test.
9603         * testsuite/Makefile.in: Regenerate.
9604         * testsuite/gc_tls_test.cc: New file.
9605         * testsuite/gc_tls_test.sh: New file.
9606
9607 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9608
9609         * icf.cc: New file.
9610         * icf.h: New file.
9611         * Makefile.am (CCFILES): Add icf.cc.
9612         (HFILES): Add icf.h
9613         * Makefile.in: Regenerate.
9614         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9615         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9616         section, symbol and addend information for the relocs.
9617         * gold.cc (queue_middle_tasks): Call identical code folding.
9618         * gold.h: Add defines for multimap.
9619         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9620         to the call of finalize_local_symbols.
9621         * main.cc (main): Create object of class Icf.
9622         * object.cc (Sized_relobj::do_layout): Allow this function to be
9623         called twice during icf.
9624         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9625         to sections marked as identical by icf.
9626         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9627         when available.
9628         (Sized_relobj::do_section_entsize): New function.
9629         * object.h (Object::section_entsize): New function.
9630         (Object::do_section_entsize): New pure virtual function.
9631         (Relobj::finalize_local_symbols): Add new parameter.
9632         (Relobj::do_section_entsize): New function.
9633         * options.h (General_options::icf): New option.
9634         (General_options::icf_iterations): New option.
9635         (General_options::print_icf_sections): New option.
9636         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9637         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9638         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9639         icf.
9640         * symtab.cc (Symbol_table::is_section_folded): New function.
9641         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9642         to sections marked as identical by icf.
9643         * symtab.h (Symbol_table::set_icf): New function.
9644         (Symbol_table::icf): New function.
9645         (Symbol_table::is_section_folded): New function.
9646         (Symbol_table::icf_): New data member.
9647         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9648         * testsuite/Makefile.am: Add commands to build icf_test.
9649         * testsuite/Makefile.in: Regenerate.
9650         * testsuite/icf_test.sh: New file.
9651         * testsuite/icf_test.cc: New file.
9652
9653 2009-07-24  Chris Demetriou  <cgd@google.com>
9654
9655         * layout.cc (is_compressible_debug_section): Fix incorrect
9656         comment about compressed section names.
9657
9658 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9659
9660         PR 10419
9661         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9662
9663 2009-07-16  Ian Lance Taylor  <iant@google.com>
9664
9665         PR 10400
9666         * layout.h: #include <map>.
9667         (class Kept_section): Change from struct to class.  Add accessors
9668         and setters.  Add section size to Comdat_group mapping.  Change
9669         Comdat_group to std::map.  Add is_comdat_ field.  Add
9670         linkonce_size field in union.
9671         (class Layout): Update declaration of find_or_add_kept_section.
9672         Don't declare find_kept_object.
9673         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9674         parameter.  Add object, shndx, is_comdat, and is_group_name
9675         parameters.  Change all callers.  Adjust for new Kept_section.
9676         (Layout::find_kept_object): Remove.
9677         * object.cc (Sized_relobj::include_section_group): Update use of
9678         Kept_section.  Rename secnum to shndx.  Only record
9679         Kept_comdat_section if sections are the same size.
9680         (Sized_relobj::include_linkonce_section): Update use of
9681         Kept_section.  Only record Kept_comdat_section if sections are the
9682         same size.  Set size of linkonce section.
9683         (Sized_relobj::map_to_kept_section): Update call to
9684         get_kept_comdat_section.
9685         * object.h (class Sized_relobj): Rename fields in
9686         Kept_comdat_section to drop trailing underscores; change object
9687         field to Relobj*.  Change Kept_comdat_section_table to store
9688         struct rather than pointer.
9689         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9690         Add kept_object and kept_shndx parameters.  Change all callers.
9691         (Sized_relobj::get_kept_comdat_section): Change return type to
9692         bool.  Add kept_object and kept_shndx parameters.  Change all
9693         callers.
9694         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9695         Layout::find_or_add_kept_section.
9696
9697 2009-07-09  Ian Lance Taylor  <iant@google.com>
9698
9699         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9700         Reserve space in the hash table.
9701
9702 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9703
9704         * fileread.cc (File_read::get_mtime): New method.
9705         * fileread.h (Timespec): New structure.
9706         (File_read::get_mtime): New method.
9707         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9708         Renamed from timestamp_nsec.
9709         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9710         Elf_Xword.
9711         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9712         timestamp_nsec.
9713         (Incremental_inputs::report_archive): Save mtime; style fix.
9714         (Incremental_inputs::report_obejct): Save mtime; style fix.
9715         (Incremental_inputs::report_script): Save mtime; style fix.
9716         (Incremental_inputs::finalize_inputs): Style fix.
9717         (Incremental_inputs::finalize): Style fix.
9718         (Incremental_inputs::create_input_section_data): Store inputs
9719         mtime.
9720         * incremental.h (Incremental_inputs::report_script): Add mtime
9721         argument.
9722         (Incremental_inputs::Input_info::Input_info): Intialize only one
9723         union member.
9724         (Incremental_inputs::Input_info::archive): Move to nameless
9725         union.
9726         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9727         (Incremental_inputs::Input_info::script): Move to nameless union.
9728         (Incremental_inputs::mtime): New field.
9729         * script.cc (read_input_script): Pass file mtime to
9730         Incremental_input.
9731         * script.h (Script_info::inputs): Style fix.
9732
9733 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9734
9735         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9736         instead of 32.
9737
9738 2009-06-24  Ian Lance Taylor  <iant@google.com>
9739
9740         PR 10156
9741         * layout.cc (Layout::choose_output_section): If we find an
9742         existing section, update the flags.
9743         (Layout::create_notes): New function, broken out of
9744         Layout::finalize.
9745         (Layout::finalize): Don't create note sections.
9746         (Layout::create_note): Don't crash if linker script discards
9747         section.
9748         (Layout::create_gold_note): Likewise.
9749         (Layout::create_build_id): Likewise.  Don't set
9750         after_input_sections on the section.
9751         (Layout::create_executable_stack_info): Remove target parameter.
9752         Change caller.
9753         * layout.h (class Layout): Declare create_notes.  Update
9754         declaration of create_executable_stack_info.
9755         * gold.cc (queue_middle_tasks): Call create_notes.
9756         * output.cc (Output_section::update_flags_for_input_section): Move
9757         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9758         invalid.
9759         * output.h (Output_data::mark_address_invalid): New function.
9760         (class Output_section): Only declare, not define,
9761         update_flags_for_input_section.  Remove set_flags.
9762
9763 2009-06-24  Ian Lance Taylor  <iant@google.com>
9764
9765         * script-sections.cc (Output_section_definition::
9766         set_section_addresses): Rename shadowing local load_address to
9767         laddr.
9768
9769 2009-06-24  Ian Lance Taylor  <iant@google.com>
9770
9771         PR 10244
9772         * reloc.cc (relocate_sections): Skip empty relocation sections.
9773
9774 2009-06-23  Ian Lance Taylor  <iant@google.com>
9775
9776         PR 10156
9777         * layout.cc (Layout::create_note): Use choose_output_section
9778         rather than make_output_section.
9779
9780 2009-06-23  Ian Lance Taylor  <iant@google.com>
9781
9782         PR 10237
9783         * options.cc (General_options::parse_V): Set printed_version_.
9784         (General_options::General_options): Initialize printed_version_.
9785         * options.h (class General_options): Add printed_version_ field.
9786         * gold.cc (queue_initial_tasks): If there are no input files,
9787         don't give a fatal error if we printed the version information.
9788         (queue_middle_tasks): If using -r with a shared object, give a
9789         fatal error rather than an ordinary error.
9790
9791 2009-06-23  Ian Lance Taylor  <iant@google.com>
9792
9793         PR 10219
9794         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9795         (Layout::make_output_section): Set have_stabstr_section_ if we see
9796         a .stab*str section.
9797         (Layout::finalize): Call link_stabs_sections.
9798         (Layout::link_stabs_sections): New file.
9799         * layout.h (class Layout): Add have_stabstr_section_ field.
9800         Declare link_stabs_sections.
9801
9802 2009-06-23  Doug Kwan  <dougkwan@google.com>
9803
9804         * Makefile.am (libgold_a_LIBADD): New.
9805         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9806         * Makefile.in: Regenerate.
9807         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9808         * configure: Regenerate.
9809         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9810         * fileread.cc: Include sys/state.h
9811         * gold.h: Declare memmem and strndup if found missing.
9812         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9813
9814 2009-06-23  Ian Lance Taylor  <iant@google.com>
9815
9816         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9817         * configure: Rebuild.
9818
9819 2009-06-23  Ian Lance Taylor  <iant@google.com>
9820
9821         PR 10147
9822         * object.cc (Object::section_contents): Don't try to get a view if
9823         the section has length zero.
9824         (Object::handle_gnu_warning_section): If the section is empty, use
9825         the name of the section as the warning.
9826
9827 2009-06-23  Ian Lance Taylor  <iant@google.com>
9828
9829         PR 10133
9830         * stringpool.h (class Stringpool_template): Add optimize_ field.
9831         (Stringpool_template::set_optimize): New function.
9832         * stringpool.cc (Stringpool_template::Stringpool_template):
9833         Initialize optimize_ field.
9834         (Stringpool_template::set_string_offsets): Test local optimize
9835         fild rather than parameter.
9836         * layout.cc (Layout::Layout): Call set_optimize on the section
9837         name stringpool.
9838
9839 2009-06-22  Ian Lance Taylor  <iant@google.com>
9840
9841         PR 10030
9842         * yyscript.y: Parse TARGET.
9843         * script.cc (script_set_target): New function.
9844         * script-c.h (script_set_target): Declare.
9845         * options.cc (General_options::string_to_object_format): Rename
9846         from string_to_object_format in anonymous namespace.  Change
9847         callers.
9848         * options.h (class General_options): Declare
9849         string_to_object_format.
9850
9851 2009-06-22  Ian Lance Taylor  <iant@google.com>
9852
9853         * script-sections.cc (Script_sections::create_segments): Don't put
9854         program headers in a PT_LOAD segment if -n or -N.
9855
9856 2009-06-22  Ian Lance Taylor  <iant@google.com>
9857
9858         PR 10141
9859         * options.h (class General_options): Add -z lazy and -z now.  Sort
9860         -z options into alphabetical order.
9861         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9862
9863 2009-06-21  Ian Lance Taylor  <iant@google.com>
9864
9865         * layout.cc (Layout::make_output_section): Call
9866         Target::new_output_section.
9867         (Layout::attach_allocated_section_to_segment): Put large section
9868         sections in a separate load segment with the large segment flag
9869         set.
9870         (Layout::segment_precedes): Sort large data segments after other
9871         load segments.
9872         (align_file_offset): New static function.
9873         (Layout::set_segment_offsets): Use align_file_offset.
9874         * output.h (class Output_section): Add is_small_section_ and
9875         is_large_section_ fields.
9876         (Output_section::is_small_section): New function.
9877         (Output_section::set_is_small_section):  New function.
9878         (Output_section::is_large_section): New function.
9879         (Output_section::set_is_large_section): New function.
9880         (Output_section::is_large_data_section): New function.
9881         (class Output_segment): Add is_large_data_segment_ field.
9882         (Output_segment::is_large_data_segment): New function.
9883         (Output_segment::set_is_large_data_segment): New function.
9884         * output.cc (Output_section::Output_section): Initialize new
9885         fields.
9886         (Output_segment::Output_segment): Likewise.
9887         (Output_segment::add_output_section): Add assertion that large
9888         data sections always go in large data segments.  Force small data
9889         sections to the end of the list of data sections.  Force small BSS
9890         sections to the start of the list of BSS sections.  For large BSS
9891         sections to the end of the list of BSS sections.
9892         * symtab.h (class Symbol): Declare is_common_shndx.
9893         (Symbol::is_defined): Check Symbol::is_common_shndx.
9894         (Symbol::is_common): Likewise.
9895         (class Symbol_table): Define enum Commons_section_type.  Update
9896         declarations.  Add small_commons_ and large_commons_ fields.
9897         * symtab.cc (Symbol::is_common_shndx): New function.
9898         (Symbol_table::Symbol_table): Initialize new fields.
9899         (Symbol_table::add_from_object): Put small and large common
9900         symbols in the right list.
9901         (Symbol_table::sized_finalized_symbol): Check
9902         Symbol::is_common_shndx.
9903         (Symbol_table::sized_write_globals): Likewise.
9904         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9905         common symbol lists.  Don't call do_allocate_commons_list if the
9906         list is empty.
9907         (Symbol_table::do_allocate_commons_list): Remove is_tls
9908         parameter.  Add comons_section_type parameter.  Change all
9909         callers.  Handle small and large common symbols.
9910         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9911         Symbol::is_common_shndx.
9912         * resolve.cc (symbol_to_bits): Likewise.
9913         * target.h (Target::small_common_shndx): New function.
9914         (Target::small_common_section_flags): New function.
9915         (Target::large_common_shndx): New function.
9916         (Target::large_common_section_flags): New function.
9917         (Target::new_output_section): New function.
9918         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9919         small_common_section_flags, and large_common_section_flags
9920         fields.
9921         (Target::do_new_output_section): New virtual function.
9922         * arm.cc (Target_arm::arm_info): Initialize new fields.
9923         * i386.cc (Target_i386::i386_info): Likewise.
9924         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9925         Likewise.
9926         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9927         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9928         (Target_x86_64::do_new_output_section): New function.
9929         * configure.ac: Define conditional MCMODEL_MEDIUM.
9930         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9931         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9932         (large_LDFLAGS): Define.
9933         * testsuite/large.c: New file.
9934         * testsuite/testfile.cc (Target_test::test_target_info):
9935         Initialize new fields.
9936         * configure, testsuite/Makefile.in: Rebuild.
9937
9938 2009-06-05  Doug Kwan  <dougkwan@google.com>
9939
9940         * Makefile.am (CCFILES): Add target.cc.
9941         * Makefile.in: Regenerate.
9942         * i386.cc (class Target_i386): Define new virtual method to
9943         override do_is_local_label_name in parent.
9944         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9945         local symbols if --discard-locals or -X is given.
9946         * options.h (class General_options): Declare new options
9947         '--discard-locals' and '-X' for discarding locals.
9948         * target.h (class Target): Define new methods is_local_label_name.
9949         Declare new virtual method do_is_local_label_name.
9950         * target.cc: New file.
9951         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9952         (check_SCRIPTS): Add discard_locals_test.sh.
9953         (check_DATA): Add discard_local_tests.syms.
9954         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9955         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9956         * testsuite/Makefile.in: Regenerate.
9957         * testsuite/discard_locals_test.c: New file.
9958         * testsuite/discard_locals_test.sh: Same.
9959
9960 2009-06-05  Doug Kwan  <dougkwan@google.com>
9961
9962         * object.cc (Sized_relobj::Sized_relobj): Initialize
9963         discarded_eh_frame_shndx_ to -1U.
9964         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9965         section.
9966         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9967         a discarded .eh_frame section.
9968         (Sized_relobj::do_finalize_local_symbols): Ditto.
9969         * object.h (class Sized_relobj): Declare new member
9970         discarded_eh_frame_shndx_.
9971         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9972         (local_labels_test.o, local_labels_test): New rules.
9973         * testsuite/Makefile.in: Regenerate.
9974
9975 2009-06-04  Doug Kwan  <dougkwan@google.com>
9976
9977         * layout.cc (Layout::section_name_mapping): Add mapping for
9978         special ARM sections.
9979
9980 2009-06-03  Doug Kwan  <dougkwan@google.com>
9981
9982         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9983         (utils::has_overflow): Same.
9984
9985 2009-06-03  Ian Lance Taylor  <iant@google.com>
9986
9987         * layout.cc (Layout::section_name_mapping): New array, replacing
9988         Layout::linkonce_mapping.
9989         (Layout::section_name_mapping_count): New variable, replacing
9990         Layout::linkonce_mapping_count.
9991         (Layout::linkonce_output_name): Remove.
9992         (Layout::output_section_name): Rewrite.
9993         * layout.h (class Layout): Rename Linkonce_mapping to
9994         Section_name_mapping, linkonce_mapping to section_name_mapping,
9995         linkonce_mapping_count to section_name_mapping_count.  Don't
9996         declare linkonce_output_name.
9997
9998 2009-06-03  Doug Kwan  <dougkwan@google.com>
9999
10000         * gold/arm.cc (namespace utils): New.
10001         (Target_arm::reloc_is_non_pic): Define new method.
10002         (class Arm_relocate_functions): New.
10003         (Target_arm::Relocate::relocate): Handle relocation types used by
10004         Android.
10005
10006 2009-06-03  Ian Lance Taylor  <iant@google.com>
10007
10008         * arm.cc (Target_arm::scan::global): Use || instead of |.
10009
10010 2009-06-02  Doug Kwan  <dougkwan@google.com>
10011
10012         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10013         issued_non_pic_error_.
10014         (class Target_arm::Scan): Declare new method check_non_pic.
10015         Define new method symbol_needs_plt_entry.
10016         Declare new data member issued_non_pic_error_.
10017         (class Target_arm::Relocate): Declare new method
10018         should_apply_static_reloc.
10019         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10020         (Target_arm::Scan::check_non_pic): Define new method.
10021         (Target_arm::Scan::local): Handle a small subset of reloc types used
10022         by Android.
10023         (Target_arm::Scan::local): Same.
10024         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10025
10026 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10027
10028         * incremental.cc (Incremental_inputs::report_command_line): Filter
10029         out --incremental-* options.
10030
10031 2009-05-29  Doug Kwan  <dougkwan@google.com>
10032
10033         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10034         template class.
10035         (class Target_arm): Update comment.
10036         (Target_arm::Target_arm): Initialize new data members GOT_,
10037         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10038         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10039         and Target_arm::rel_dyn_section.
10040         Declare new_enum Target_arm::Got_type.
10041         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10042         and DYNBSS_.
10043         Update commments for member do_dynsym_value.
10044         (Target_arm::got_size, Target_arm::plt_section,
10045         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10046         new methods inside class defintion.
10047         (Target_arm::got_section): Define new method.
10048         (Target_arm::rel_dyn_section): Same.
10049         (Output_data_plt_arm): New template class.
10050         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10051         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10052         (Output_data_plt_arm::add_entry): Same.
10053         (Output_data_plt_arm::first_plt_entry): Define new
10054         static data member for PLT instruction template.
10055         (Output_data_plt_arm::plt_entry): Same.
10056         (Output_data_plt_arm::do_write): Define new method.
10057         (Target_arm::make_plt_entry): Same.
10058         (Target_arm::do_finalize_sections): Same.
10059         (Target_arm::do_dynsym_value): Same.
10060
10061 2009-05-28  Doug Kwan  <dougkwan@google.com>
10062
10063         * Makefile.am (TARGETSOURCES): Add arm.cc.
10064         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10065         * Makefile.in: Regenerate.
10066         * arm.cc: New file.
10067         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10068
10069 2009-05-26  Doug Kwan  <dougkwan@google.com>
10070
10071         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10072         (General_options::check_excluded_libs): Strip off directories in
10073         archive name before matching like GNU ld does.
10074         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10075         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10076         (exclude_libs_test_LDFLAGS): Add linker option
10077         -Wl,--exclude-libs,libexclude_libs_test_3
10078         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10079         an explicit archive without using -l.
10080         (alt/libexclude_libs_test_3.a): New make rule.
10081         * testsuite/Makefile.in: Regenerate.
10082         * testsuite/exclude_libs_test.c : Declare lib3_default().
10083         (main): Call it.
10084         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10085         * exclude_libs_test_3.c: New file.
10086
10087 2009-05-26  Nick Clifton  <nickc@redhat.com>
10088
10089         * po/id.po: New Indonesian translation.
10090         * po/gold.pot: Updated template file.
10091
10092 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10093
10094         * testsuite/Makefile.am: Add -ffunction-sections to compile
10095         gc_comdat_test files.  Add -Wl,--gc-sections to build
10096         gc_comdat_test.
10097         * testsuite/Makefile.in: Regenerate.
10098         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10099
10100 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10101
10102         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10103         kept comdat section was garbage collected.
10104         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10105         * testsuite/Makefile.in: Regenerate.
10106         * testsuite/gc_comdat_test.sh: New file.
10107         * testsuite/gc_comdat_test_1.cc: New file.
10108         * testsuite/gc_comdat_test_2.cc: New file.
10109
10110 2009-05-19  Doug Kwan  <dougkwan@google.com>
10111
10112         * archive.cc (Archive::Archive): Move constructor from archive.h
10113         to here.  Initialize no_export_.
10114         (Archive::get_elf_object_for_member): Set no_export flag of object.
10115         * archive.h (Archive::Archive): Move constructor body to
10116         archive.cc.
10117         (Archive::no_export): New method.
10118         (Archive::no_export_): New field.
10119         * object.h (Object::Object): Initialize no_export_ to false.
10120         (Object::no_export, Object::set_no_export): New methods.
10121         (Object::no_export_): New field.
10122         * options.cc (General_options::parse_exclude_libs): New method.
10123         (General_options::check_excluded_libs) Same.
10124         * options.h (exclude_libs): New option.
10125         (General_options::check_excluded_libs): New method declaration.
10126         (General_options::excluded_libs_): New field.
10127         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10128         default or protected visibility if an object has no-export flag set.
10129         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10130         (check_SCRIPTS): Add exclude_libs_test.sh.
10131         (check_DATA): Add exclude_libs_test.syms.
10132         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10133         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10134         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10135         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10136         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10137         libexclude_libs_test_2.a): New rules.
10138         * testsuite/Makefile.in: Regenerate.
10139         * testsuite/exclude_libs_test.c: New file.
10140         * testsuite/exclude_libs_test.sh: Ditto.
10141         * testsuite/exclude_libs_test_1.c: Ditto.
10142         * testsuite/exclude_libs_test_2.c: Ditto.
10143
10144 2009-05-15  Ian Lance Taylor  <iant@google.com>
10145
10146         * configure.ac: Check for declarations for cases where libiberty.h
10147         checks HAVE_DECL_xxx.
10148         * configure, config.in: Rebuild.
10149
10150 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10151
10152         * gold.h (Incremental_argument_list): Remove (invalid) forward
10153         declaration.
10154         * incremental.cc (Incremental_inputs::report_achive): New method.
10155         (Incremental_inputs::report_object): New method.
10156         (Incremental_inputs::report_script): New method.
10157         (Incremental_inputs::finalize_inputs): New method.
10158         (Incremental_inputs::finalize): Call finalize_inputs().
10159         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10160         Create inputs entries.
10161         * incremental.h (Incremental_input_type): New enum.
10162         (Incremental_inputs::Incremental_input): Initialize new fields.
10163         (Incremental_inputs::report_inputs): New method.
10164         (Incremental_inputs::report_achive): New method.
10165         (Incremental_inputs::report_object): New method.
10166         (Incremental_inputs::report_script): New method.
10167         (Incremental_inputs::finalize_inputs): New method.
10168         (Incremental_inputs::Input_info): New struct.
10169         (Incremental_inputs::Input_info_map): New typedef.
10170         (Incremental_inputs::lock_): New field.
10171         (Incremental_inputs::Inputs_): New field.
10172         (Incremental_inputs::Inputs_map): New field.
10173         * main.cc (main): Call Incremental_input::report_inputs.
10174         * options.h (Input_argument_list): Typedef moved from
10175         Input_arguments.
10176         (Input_file_group::Files): Remove, use ::Input_argument_list.
10177         (Input_file_group::Input_argument_list): Remove, use
10178         ::Input_argument_list.
10179         * plugin.cc (Plugin_manager::add_input_file): Add error in
10180         incremental build.
10181         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10182         functions.
10183         * script.cc (read_input_script): Call
10184         Incremental_input::report_script.
10185         * script.h (Script_info): New class.
10186
10187 2009-04-27  Ian Lance Taylor  <iant@google.com>
10188
10189         * x86_64.cc (do_adjust_output_section): Set entsize to
10190         plt_entry_size.
10191
10192 2009-04-23  Elliott Hughes  <enh@google.com>
10193
10194         * output.cc (Output_file::close): After short writes, continue
10195         writing from the correct offset in the buffer being written.
10196
10197 2009-04-23  Chris Demetriou  <cgd@google.com>
10198
10199         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10200         * configure: Regenerate.
10201         * config.in: Regenerate.
10202         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10203         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10204
10205 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10206
10207         * incremental.cc (Incremental_inputs_header_data): Renamed from
10208         Incremental_input_header_data.
10209         (Incremental_inputs_header_data::data_size): New field.
10210         (Incremental_inputs_header_data::put_input_file_count): Renamed
10211         from input_file_count.
10212         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10213         from command_line_offset.
10214         (Incremental_inputs_header_data::put_reserved): Renamed from
10215         put_reserved.
10216         (Incremental_inputs_entry_data): Renamed from
10217         Incremental_input_entry_data.
10218         (Incremental_inputs_entry_data::data_size): New field.
10219         (Incremental_inputs::report_command_line): New method.
10220         (Incremental_inputs::finalize): New method.
10221         (Incremental_inputs::create_incremental_inputs_data): New method.
10222         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10223         * incremental.h: New file.
10224         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10225        (Layout::finalize): Create incremental inputs section in
10226         incremental builds.
10227        (Layout::create_incremental_info_sections): New method.
10228         * layout.h (Layout::incremental_inputs): New method.
10229        (Layout::create_incremental_info_sections): New method.
10230        (Layout::incremental_inputs_): New field.
10231         * main.cc (main): Notify Incremental_input of the command line.
10232
10233 2009-04-01  Ian Lance Taylor  <iant@google.com>
10234             Mikolaj Zalewski  <mikolajz@google.com>
10235
10236         * gold.h (reserve_unordered_map): Define, three versions, one for
10237         each version of Unordered_map.
10238         * layout.cc (Layout::Layout): Remove options parameter.  Add
10239         number_of_input_files parameter.  Don't initialize options_.
10240         Initialize number_of_input_files_ and resized_signatures_.  Move
10241         sections_are_attached_.
10242         (Layout::layout_group): Reserve space for group_signatures_.
10243         (Layout::find_or_add_kept_section): Change name parameter to be a
10244         reference.  Resize signatures_ map when it gets large enough.
10245         (Layout::layout_eh_frame): Use parameters->options() instead of
10246         this->options_.
10247         (Layout::make_output_section): Likewise.
10248         (Layout::attach_allocated_section_to_segment): Likewise.
10249         (Layout::finalize, Layout::create_executable_stack): Likewise.
10250         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10251         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10252         * layout.h (class Layout): Update declarations.  Remove options_
10253         field.  Add number_of_input_files_ and resized_signatures_
10254         fields.  Move sections_are_attached_ field.
10255         * main.cc (main): Pass number of input files to Layout
10256         constructor.  Don't pass options.
10257
10258 2009-03-30  Ian Lance Taylor  <iant@google.com>
10259
10260         * ffsll.c (ffsll): Correct implementation.
10261
10262 2009-03-27  Ian Lance Taylor  <iant@google.com>
10263
10264         * ffsll.c: New file.
10265         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10266         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10267         * ftruncate.c (ftruncate): Declare before definition.
10268         * mremap.c (mremap): Likewise.
10269         * pread.c (pread): Likewise.
10270         * configure, Makefile.in, config.in: Rebuild.
10271
10272         * mremap.c: New file.
10273         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10274         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10275         (mremap): Declare if HAVE_MREMAP is not defined.
10276         * configure, Makefile.in, config.in: Rebuild.
10277
10278 2009-03-27  Cary Coutant  <ccoutant@google.com>
10279
10280         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10281         position independent.
10282         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10283         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10284
10285 2009-03-24  Cary Coutant  <ccoutant@google.com>
10286
10287         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10288         an executable.
10289         (needs_dynamic_reloc): Likewise.
10290
10291 2009-03-24  Ian Lance Taylor  <iant@google.com>
10292
10293         * yyscript.y (file_cmd): Recognize EXTERN.
10294         (extern_name_list, extern_name_list_body): New nonterminals.
10295         * script.cc (script_add_extern): Define.
10296         * script-c.h (script_add_extern): Declare.
10297
10298 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10299
10300         * object.cc (is_elf_object): Define.
10301         * object.h (is_elf_object): Declare.
10302         * archive.cc (Archive::get_elf_object_for_member): Call
10303         is_elf_object.
10304         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10305
10306 2009-03-24  Elliott Hughes  <enh@google.com>
10307
10308         * output.cc (Output_file::map_anonymous): Define.
10309         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10310         try an anonymous one.  Report the size if the mmap fails.
10311         * output.h (class Output_file): Declare map_anonymous.
10312
10313 2009-03-24  Ian Lance Taylor  <iant@google.com>
10314
10315         * target-select.cc (instantiate_target): Don't acquire the lock if
10316         the instantiated_target_ field has already been set.
10317
10318 2009-03-23  Ian Lance Taylor  <iant@google.com>
10319
10320         * gold-threads.h (class Initialize_lock): Define.
10321         * gold-threads.cc (class Initialize_lock_once): Define.
10322         (initialize_lock_control): New static variable.
10323         (initialize_lock_pointer): New static variable.
10324         (initialize_lock_once): New static function.
10325         (Initialize_lock::Initialize_lock): Define.
10326         (Initialize_lock::initialize): Define.
10327         * target-select.h: Include "gold-threads.h".
10328         (class Target_selector): Add lock_ and initialize_lock_ fields.
10329         Don't define instantiate_target, just declare it.
10330         * target-select.cc (Target_selector::Target_selector): Initialize
10331         new fields.
10332         (Target_selector::instantiate_target): Define.
10333         * descriptors.h: Include "gold-threads.h".
10334         (class Descriptors): Add initialize_lock_ field.
10335         * descriptors.cc (Descriptors::Descriptors): Initialize new
10336         field.
10337         (Descriptors::open): Use initialize_lock_ field
10338         * errors.h (class Errors): Add initialize_lock_ field.
10339         * errors.cc (Errors::Errors): Initialize new field.
10340         (Errors::initialize_lock): Use initialize_lock_ field.
10341         * powerpc.cc (class Target_selector_powerpc): Remove
10342         instantiated_target_ field.  In do_recognize call
10343         instantiate_target rather than do_instantiate_target.  In
10344         do_instantiate_target just allocate a new target.
10345         * sparc.cc (class Target_selector_sparc): Likewise.
10346
10347         * freebsd.h: New file.
10348         * i386.cc: Include "freebsd.h".
10349         (Target_i386): Derive from Target_freebsd rather than
10350         Sized_target.
10351         (Target_selector_i386): Derive from Target_selector_freebsd rather
10352         than Target_selector.
10353         * x86_64.cc: Include "freebsd.h".
10354         (Target_x86_64): Derive from Target_freebsd rather than
10355         Sized_target.
10356         (Target_selector_x86_64): Derive from Target_selector_freebsd
10357         rather than Target_selector.
10358         * target.h (class Target): Add adjust_elf_header and
10359         do_adjust_elf_header.
10360         * output.cc (Output_file_header:: do_sized_write): Call target
10361         adjust_elf_header routine.
10362         * configure.tgt: Set targ_osabi.
10363         * configure.ac: Define GOLD_DEFAULT_OSABI.
10364         * parameters.cc (Parameters::default_target): Pass
10365         GOLD_DEFAULT_OSABI to select_target.
10366         * target-select.h (class Target_selector): Make instantiate_target
10367         protected rather than private.
10368         * Makefile.am (HFILES): Add freebsd.h.
10369         * configure, Makefile.in, config.in: Rebuild.
10370
10371         * merge.cc (do_add_input_section): Correct pend value.  Change
10372         message about last entry not being null terminated from error to
10373         warning.
10374
10375 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10376
10377         * incremental.cc: New file.
10378         * Makefile.am (CCFILES): Add incremental.cc.
10379         * Makefile.in: Rebuild.
10380
10381 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10382
10383         * layout.cc (Layout::output_section_name): Preserve names
10384         of '.note.' sections.
10385
10386 2009-03-19  Ian Lance Taylor  <iant@google.com>
10387
10388         * descriptors.cc (Descriptors::open): Check that the options are
10389         valid before using them.
10390
10391 2009-03-18  Ian Lance Taylor  <iant@google.com>
10392
10393         * script-sections.h: Include <list>.
10394         (class Script_sections): Change Sections_elements from std::vector
10395         to std::list.  Typedef public Elements_iterator.  Add
10396         orphan_section_placement_, data_segment_align_start_, and
10397         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10398         field.
10399         * script-sections.cc (class Orphan_section_placement): New class.
10400         (class Sections_element): Add virtual functions is_relro and
10401         orphan_section_init.  Remove virtual function place_orphan_here.
10402         (class Output_section_definition): Add is_relro and
10403         orphan_section_init.  Remove place_orphan_here.
10404         (class Orphan_output_section): Likewise.
10405         (Script_sections::Script_sections): Update for field changes.
10406         (Script_sections::data_segment_align): Set saw_data_segment_align_
10407         and data_segment_align_start_, not data_segment_align_index.
10408         (Script_sections::data_segment_relro_end): Check
10409         saw_data_segment_align_.  Use data_segment_align_start_ rather
10410         than data_segment_align_index_.
10411         (Script_sections::place_orphan): Rewrite to use
10412         Orphan_section_placement.
10413
10414 2009-03-17  Ian Lance Taylor  <iant@google.com>
10415
10416         * archive.cc (Archive::add_symbols): Check for a version attached
10417         to the symbol name in the archive map.
10418         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10419         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10420         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10421         (ver_test_11.a): New target.
10422         * testsuite/Makefile.in: Rebuild.
10423
10424         * configure.ac: Check for chsize and posix_fallocate.  Replace
10425         ftruncate.
10426         * ftruncate.c: New file, from gnulib.
10427         * output.cc (posix_fallocate): Define dummy version if not
10428         HAVE_POSIX_FALLOCATE.
10429         (Output_file::map): Call posix_fallocate rather than lseek and
10430         write.
10431         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10432         * configure, Makefile.in, config.in: Rebuild.
10433
10434 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10435
10436         * layout.h (Layout::create_note): Add section_name parameter.
10437         * layout.cc (Layout::create_note): Likewise.
10438         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10439
10440 2009-03-17  Ian Lance Taylor  <iant@google.com>
10441
10442         * descriptors.cc: Include "options.h".
10443         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10444         (Descriptors::open): Always use O_CLOEXEC when opening a new
10445         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10446         then set FD_CLOEXEC.
10447
10448         * sparc.cc (class Target_sparc): Add has_got_section.
10449         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10450         make sure we have a GOT section.
10451
10452         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10453         (Target_sparc::Scan::local): Likewise.
10454         (Target_sparc::Scan::global): Likewise.
10455         (Target_sparc::Relocate::relocate): Likewise.
10456         (Target_sparc::Relocate::relocate_tls): Likewise.
10457
10458         * symtab.cc (Symbol_table::define_default_version): New function,
10459         broken out of add_from_object.
10460         (Symbol_table::add_from_object): Call define_default_version.
10461         (Symbol_table::define_special_symbol): Add resolve_oldsym
10462         parameter.  Change all callers.  If the version for a symbol comes
10463         from a version script, resolve it with the symbol with the same
10464         name with no version.  Also add the symbol without a version if
10465         appropriate.
10466         (do_define_in_output_data): If resolving with oldsym, don't delete
10467         sym.
10468         (do_define_in_output_segment): Likewise.
10469         (do_define_as_constant): Likewise.
10470         * symtab.h (class Symbol_table): Update declarations.
10471
10472 2009-03-13  Ian Lance Taylor  <iant@google.com>
10473
10474         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10475         (Read_symbols::requeue): New function.
10476         (Read_symbols::do_read_symbols): If make_elf_object fails because
10477         the target type is not configured, and the file was searched for,
10478         issue a warning and retry with the next directory.
10479         (Add_symbols::run): If the file has an incompatible format, and
10480         it was searched for, requeue the Read_symbols task.  On error,
10481         release the object.
10482         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10483         dirindex parameter to constructor.  Change all callers.  Declare
10484         incompatible_warning and requeue.
10485         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10486         input_argument_ and input_group_ fields.  Add them to
10487         constructor.  Change all callers.
10488         (class Read_script): Add dirindex_ field.  Add it to constructor.
10489         Change all callers.
10490         * archive.cc (Archive::setup): Remove input_objects parameter.
10491         Change all callers.
10492         (Archive::get_file_and_offset): Likewise.
10493         (Archive::read_all_symbols): Likewise.
10494         (Archive::read_symbols): Likewise.
10495         (Archive::get_elf_object_for_member): Remove input_objects
10496         parameter.  Add punconfigured parameter.  Change all callers.
10497         (Archive::add_symbols): Change return type to bool.  Check return
10498         value of include_member.
10499         (Archive::include_all_members): Likewise.
10500         (Archive::include_member): Change return type to bool.  Return
10501         false if first included object has incompatible target.  Set
10502         included_member_ field.
10503         (Add_archive_symbols::run): If add_symbols returns false, requeue
10504         Read_symbols task.
10505         * archive.h (class Archive): Add included_member_ field.
10506         Initialize it in constructor.  Add input_file and searched_for
10507         methods.  Update declarations.
10508         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10509         input_argument_ fields.  Add them to constructor.  Change all
10510         callers.
10511         * script.cc: Include "target-select.h".
10512         (class Parser_closure): Add skip_on_incompatible_target_ and
10513         found_incompatible_target_ fields.  Add
10514         skip_on_incompatible_target parameter to constructor.  Change all
10515         callers.  Add methods skip_on_incompatible_target,
10516         clear_skip_on_incompatible_target, found_incompatible_target, and
10517         set_found_incompatible_target.
10518         (read_input_script): Add dirindex parameter.  Change all callers.
10519         If parser finds an incompatible target, requeue Read_symbols
10520         task.
10521         (script_set_symbol): Clear skip_on_incompatible_target in
10522         closure.
10523         (script_add_assertion, script_parse_option): Likewise.
10524         (script_start_sections, script_add_phdr): Likewise.
10525         (script_check_output_format): New function.
10526         * script.h (read_input_script): Update declaration.
10527         * script-c.h (script_check_output_format): Declare.
10528         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10529         (ignore_cmd): Remove OUTPUT_FORMAT.
10530         * fileread.cc (Input_file::Input_file): Add explicit this.
10531         (Input_file::will_search_for): New function.
10532         (Input_file::open): Add pindex parameter.  Change all callers.
10533         * fileread.h (class Input_file): Add input_file_argument method.
10534         Declare will_search_for.  Update declarations.
10535         * object.cc (make_elf_object): Add punconfigured parameter.
10536         Change all callers.
10537         * object.h (class Object): Make input_file public.  Add
10538         searched_for method.
10539         (make_elf_object): Update declaration.
10540         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10541         restart search.
10542         * dirsearch.h (class Dirsearch): Update declaration.
10543         * options.h (class General_options): Add --warn-search-mismatch.
10544         * parameters.cc (Parameters::is_compatible_target): New function.
10545         * parameters.h (class Parameters): Declare is_compatible_target.
10546         * workqueue.cc (Workqueue::add_blocker): New function.
10547         * workqueue.h (class Workqueue): Declare add_blocker.
10548
10549         * fileread.cc (Input_file::open): Remove options parameter.
10550         Change all callers.
10551         (Input_file::open_binary): Likewise.
10552         * script.cc (read_input_script): Likewise.
10553         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10554         options parameter from constructor.  Change all callers.
10555         (class Read_script): Likewise.
10556         * fileread.h (class Input_file): Update declarations.
10557         * script.h (read_input_script): Update declaration.
10558
10559 2009-03-10  Nick Clifton  <nickc@redhat.com>
10560
10561         * po/es.po: New Spanish translation.
10562
10563 2009-03-06  Cary Coutant  <ccoutant@google.com>
10564
10565         * options.cc (parse_short_option): Keep dash_z from registering itself.
10566
10567 2009-03-03  Ian Lance Taylor  <iant@google.com>
10568
10569         PR 9918
10570         * target-reloc.h (relocate_section): Pass output_section to
10571         relocate.
10572         * i386.cc (Target_i386::should_apply_static_reloc): Add
10573         output_section parameter.  Change all callers.
10574         (Target_i386::Relocate::relocate): Add output_section parameter.
10575         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10576         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10577         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10578         * testsuite/two_file_shared.sh: New script.
10579         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10580         (check_DATA): Add two_file_shared.dbg.
10581         (two_file_shared.dbg): New target.
10582         * testsuite/Makefile.in: Rebuild.
10583
10584 2009-03-01  Ian Lance Taylor  <iant@google.com>
10585
10586         * configure.ac: Check for byteswap.h.
10587         * configure: Rebuild.
10588         * config.in: Rebuild.
10589
10590 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10591
10592         * layout.cc (Layout::find_or_add_kept_section): New function.
10593         (Layout::add_comdat): Removed.
10594         * layout.h (struct Kept_section): Move out of class Layout.
10595         Remove trailing underscores from field names.  Add group_sections
10596         field.  Rename group_ field to is_group.  Change all uses.
10597         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10598         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10599         comdat_groups_ field.
10600         (Sized_relobj::include_section_group): Use
10601         find_or_add_kept_section and Kept_section::group_sections.
10602         (Sized_relobj::include_linkonce_section): Likewise.
10603         * object.cc (class Sized_relobj): Don't define Comdat_group or
10604         Comdat_group_table.  Remove find_comdat_group and
10605         add_comdat_group.  Remove comdat_groups_ field.
10606         * plugin.cc (include_comdat_group): Use
10607         Layout::find_or_add_kept_section.
10608
10609 2009-02-28  Ian Lance Taylor  <iant@google.com>
10610
10611         * README: --gc-sections and map files are now supported.  Document
10612         some build requirements.
10613
10614         PR 6992
10615         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10616         relocatable link set the value of the section symbol to zero.
10617         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10618         relocatable link don't include the section address in the local
10619         symbol value.
10620
10621 2009-02-27  Ian Lance Taylor  <iant@google.com>
10622
10623         PR 6811
10624         * options.h (class Search_directory): Add is_system_directory.
10625         (class General_options): Declare is_in_system_directory.
10626         * options.cc (get_relative_sysroot): Make static.
10627         (get_default_sysroot): Make static.
10628         (General_optoins::is_in_system_directory): New function.
10629         * fileread.cc (Input_file::is_in_system_directory): New function.
10630         * fileread.h (class Input_file): Declare is_in_system_directory.
10631         * object.h (class Object): Add is_in_system_directory.
10632         (class Input_objects): Remove system_library_directory_ field.
10633         * object.cc (Input_objects::add_object): Don't set
10634         system_library_directory_.
10635         (input_objects::found_in_system_library_directory): Remove.
10636         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10637         parameter.  Change all callers.
10638         (Symbol_table::sized_write_globals): Likewise.
10639         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10640         Call Object::is_in_system_directory.
10641         * symtab.h (class Symbol_table): Update declarations.
10642
10643         PR 5990
10644         * descriptors.h (Open_descriptor): Add is_on_stack field.
10645         * descriptors.cc (Descriptors::open): If the descriptor is on the
10646         top of the stack, remove it.  Initialize is_on_stack field.
10647         (Descriptors::release): Only add pod to stack if it is not on the
10648         stack already.
10649         (Descriptors::close_some_descriptor): Clear stack_next and
10650         is_on_stack fields.
10651
10652         PR 7091
10653         * output.cc (Output_section::find_starting_output_address): Rename
10654         from starting_output_address; add PADDR parameter; change return
10655         type.
10656         * output.h (class Output_section): Declare
10657         find_starting_output_address instead of starting_output_address.
10658         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10659         section symbol for which we can't find a merge section.
10660
10661         PR 9836
10662         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10663         hidden or internal, force the symbol to be local.
10664         * resolve.cc (Symbol::override_visibility): Define.
10665         (Symbol::override_base): Use override_visibility.
10666         (Symbol_table::resolve): Likewise.
10667         (Symbol::override_base_with_special): Likewise.
10668         (Symbol_table::override_with_special): If the visibility is hidden
10669         or internal, force the symbol to be local.
10670         * symtab.h (class Symbol): Add set_visibility and
10671         override_visibility.
10672         * testsuite/ver_test_1.sh: New file.
10673         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10674         (check_DATA): Add ver_test_1.syms.
10675         (ver_test_1.syms): New target.
10676         * testsuite/Makefile.in: Rebuild.
10677
10678 2009-02-25  Cary Coutant  <ccoutant@google.com>
10679
10680         * layout.cc (Layout::choose_output_section): Don't rename sections
10681         when using a linker script that has a SECTIONS clause.
10682         * Makefile.in: Regenerate.
10683
10684         * testsuite/Makefile.am (script_test_5.sh): New test case.
10685         * testsuite/Makefile.in: Regenerate.
10686         * testsuite/script_test_5.cc: New file.
10687         * testsuite/script_test_5.sh: New file.
10688         * testsuite/script_test_5.t: New file.
10689
10690 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10691
10692         * archive.cc (Archive::include_member): Update calls to add_symbols.
10693         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10694         the Layout argument.
10695         * dynobj.h (do_add_symbols): Add the Layout argument.
10696         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10697         Layout argument.
10698         * object.h (Object::add_symbols): Add the Layout argument.
10699         (Object::do_add_symbols): Add the Layout argument.
10700         (Sized_relobj::do_add_symbols): Add the Layout argument.
10701         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10702         Unify the two versions.
10703         (Add_plugin_symbols): Remove.
10704         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10705         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10706         (Add_plugin_symbols): Remove.
10707         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10708         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10709         (Add_symbols::run): Make it work with Pulginobj.
10710
10711 2009-02-06  Ian Lance Taylor  <iant@google.com>
10712
10713         * object.cc (Sized_relobj::do_layout): Make info message start
10714         with lower case letter.
10715
10716 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10717
10718         * binary.cc: Fix file comment.
10719
10720         * options.h (enum Incremental_disposition): Define.
10721         (class General_options): Add new options: --incremental,
10722         --incremental_changed, --incremental_unchanged,
10723         --incremental_unknown.  Add incremental_disposition_ and
10724         implicit_incremental_ fields.
10725         (General_options::incremental_disposition): New function.
10726         (class Position_dependent_options): Add incremental_disposition
10727         option.
10728         (Position_dependent_options::copy_from_options): Set incremental
10729         dispositions.
10730         * options.cc (General_options::parse_incremental_changed): New
10731         function.
10732         (General_options::parse_incremental_unchanged): New function.
10733         (General_options::parse_incremental_unknown): New function.
10734         (General_options::General_options): Initialize new fields
10735         incremental_disposition_ and implicit_incremental_.
10736         (General_options::finalize): Check for uasge of --incremental-*
10737         without --incremental.
10738
10739 2009-02-06  Chris Demetriou  <cgd@google.com>
10740
10741         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10742         pointer and to report location as the file name associated with
10743         the symbol.
10744         (gold_undefined_symbol_at_location): New function to replace the
10745         old gold_undefined_symbol functionality.
10746         * target-reloc.h (relocate_section): Update to use
10747         gold_undefined_symbol_at_location.
10748         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10749         Call gold_undefined_symbol function rather than gold_error.
10750         * errors.h (Errors::undefined_symbol): Take location as a
10751         string, rather than calculating it from a relocation.
10752         * errors.cc (Errors::fatal): Print "fatal error:" before the
10753         formatted message.
10754         (Errors::error, Errors::error_at_location): Print "error: "
10755         before the formatted message.
10756         (Errors::undefined_symbol): Take location as a string, rather
10757         than calculating it from a relocation.
10758         (gold_undefined_symbol_at_location): New function akin to
10759         old gold_undefined_symbol, calculates location from relocation.
10760         (gold_undefined_symbol): Change to take only a Symbol pointer
10761         and to report location as the file name associated with the symbol.
10762         * testsuite/debug_msg.sh: Update for changed error messages.
10763         * testsuite/undef_symbol.sh: Likewise.
10764
10765 2009-02-04  Duncan Sands  <baldrick@free.fr>
10766
10767         PR 9812
10768         * reduced_debug_output.h
10769         (Output_reduced_debug_abbrev_section::failed): Use format for
10770         gold_warning.
10771         (Output_reduced_debug_info_section::faild): Likewise.
10772
10773 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10774
10775         * script.cc (Lazy_demangler): New class.
10776         (Version_script_info::get_symbol_version_helper): Demangle a
10777         symbol only once.
10778
10779 2009-01-29  Cary Coutant  <ccoutant@google.com>
10780
10781         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10782         to __tls_get_addr.
10783         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10784
10785 2009-01-28  Ian Lance Taylor  <iant@google.com>
10786
10787         * version.cc (version_string): Bump to 1.9.
10788
10789         * gold.h: Include <cstring> and <stdint.h>.
10790         * version.cc: Include <cstdio>.
10791         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10792         warning.
10793         * reduced_debug_output.cc (insert_into_vector): Rename from
10794         Insert_into_vector; change all callers.  Use Swap_unaligned to
10795         avoid aliasing issue; remove union since it is unnecessary.
10796
10797 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10798
10799         * Makefile.am (CCFILES): Add gc.cc.
10800         (HFILES): Add gc.h.
10801         * Makefile.in: Regenerate.
10802         * gold.cc (Gc_runner): New class.
10803         (queue_initial_tasks): Call garbage collection related tasks
10804         when corresponding options are invoked.
10805         (queue_middle_gc_tasks): New function.
10806         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10807         processed early before laying out sections during garbage collection.
10808         * gold.h (queue_middle_gc_tasks): New function.
10809         (is_prefix_of): Move from "layout.cc".
10810         * i386.cc (Target_i386::gc_process_relocs): New function.
10811         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10812         * main.cc (main): Create object of class "Garbage_collection".
10813         * object.cc (Relobj::copy_symbols_data): New function.
10814         (Relobj::is_section_name_included): New function.
10815         (Sized_relobj::do_layout): Allow this function to be called twice
10816         during garbage collection and defer layout of section during the
10817         first call.
10818         * object.h (Relobj::get_symbols_data): New function.
10819         (Relobj::is_section_name_included): New function.
10820         (Relobj::copy_symbols_data): New function.
10821         (Relobj::set_symbols_data): New function.
10822         (Relobj::get_relocs_data): New function.
10823         (Relobj::set_relocs_data): New function.
10824         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10825         (Relobj::gc_process_relocs): New function.
10826         (Relobj::do_gc_process_relocs): New pure virtual function.
10827         (Relobj::sd_): New data member.
10828         (Sized_relobj::is_output_section_offset_invalid): New function.
10829         (Sized_relobj::do_gc_process_relocs): New function.
10830         * options.h (General_options::gc_sections): Modify to not be a no-op.
10831         (General_options::print_gc_sections): New option.
10832         * plugin.cc (Plugin_finish::run): Remove function call to
10833         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10834         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10835         * reloc.cc (Read_relocs::run): Add task to process relocs and
10836         determine unreferenced sections when doing garbage collection.
10837         (Gc_process_relocs): New class.
10838         (Sized_relobj::do_gc_process_relocs): New function.
10839         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10840         sections that are garbage collected.
10841         * reloc.h (Gc_process_relocs): New class.
10842         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10843         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10844         symbols whose corresponding sections are garbage collected.
10845         (Symbol_table::Symbol_table): Add new parameter for the garbage
10846         collection object.
10847         (Symbol_table::gc_mark_undef_symbols): New function.
10848         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10849         (Symbol_table::gc_mark_dyn_syms): New function.
10850         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10851         as garbage.
10852         (Symbol_table::add_from_object): Likewise.
10853         (Symbol_table::add_from_relobj): When building shared objects, do not
10854         treat externally visible symbols as garbage.
10855         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10856         table information for static and relocatable links.
10857         * symtab.h (Symbol_table::set_gc): New function.
10858         (Symbol_table::gc): New function.
10859         (Symbol_table::gc_mark_undef_symbols): New function.
10860         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10861         (Symbol_table::gc_mark_dyn_syms): New function.
10862         (Symbol_table::gc_): New data member.
10863         * target.h (Sized_target::gc_process_relocs): New pure virtual
10864         function.
10865         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10866         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10867
10868 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10869
10870         * options.h (General_options::gc_sections): Define as a no-op for now.
10871         (General_options::no_keep_memory): Ditto.
10872         (General_options::Bshareable): Define.
10873         * options.cc (General_options::finalize): Honor -Bshareable.
10874
10875 2009-01-20  Andreas Schwab  <schwab@suse.de>
10876
10877         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10878         read the value in the contents, since we don't use it.  Use the
10879         template endianness when writing.
10880         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10881
10882 2009-01-19  Andreas Schwab  <schwab@suse.de>
10883
10884         * configure.tgt (powerpc64-*): Fix targ_obj.
10885
10886 2009-01-15  Ian Lance Taylor  <iant@google.com>
10887
10888         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10889         local symbols when stripping all symbols.
10890
10891 2009-01-14  Cary Coutant  <ccoutant@google.com>
10892
10893         * output.cc (Output_reloc): Add explicit instantiations.
10894
10895 2009-01-14  Cary Coutant  <ccoutant@google.com>
10896
10897         * archive.cc (Archive::get_elf_object_for_member): Remove call
10898         to File_read::claim_for_plugin.
10899         * descriptors.cc (Descriptors::open): Remove reference to
10900         is_claimed.
10901         (Descriptors::claim_for_plugin): Remove.
10902         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10903         (Descriptors::is_claimed): Remove.
10904         (claim_descriptor_for_plugin): Remove.
10905         * fileread.cc (File_read::claim_for_plugin): Remove.
10906         * fileread.h (File_read::claim_for_plugin): Remove.
10907         (File_read::descriptor): Reopen descriptor if necessary.
10908         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10909         (Plugin_manager::all_symbols_read): Add task parameter. Change
10910         all callers.
10911         (Plugin_manager::get_input_file): New function.
10912         (Plugin_manager::release_input_file): New function.
10913         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10914         corresponding data member.
10915         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10916         and pass to base constructor. Change all callers.
10917         (get_input_file, release_input_file): New functions.
10918         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10919         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10920         (Plugin_manager::all_symbols_read): Add task parameter.
10921         (Plugin_manager::get_input_file): New function.
10922         (Plugin_manager::release_input_file): New function.
10923         (Plugin_manager::task_): New data member.
10924         (Pluginobj::Pluginobj): Add filesize parameter.
10925         (Pluginobj::filename): New function.
10926         (Pluginobj::descriptor): New function.
10927         (Pluginobj::filesize): New function.
10928         (Pluginobj::filesize_): New data member.
10929         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10930         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10931         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10932
10933         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10934         with archive libraries.
10935         * testsuite/Makefile.in: Regenerate.
10936         * testsuite/plugin_test.c (struct sym_info): New type.
10937         (get_input_file, release_input_file): New static variables.
10938         (onload): Capture new transfer vector entries.
10939         (claim_file_hook): Stop reading at end of file according to filesize.
10940         Factor out parsing of readelf output into separate function.
10941         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10942         APIs and get the source file name from the symbol table.  Convert
10943         source file name to corresponding object file name.  Print info
10944         message when adding new input files.
10945         (parse_readelf_line): New function.
10946         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10947         * testsuite/plugin_test_2.sh: Likewise.
10948         * testsuite/plugin_test_3.sh: Likewise.
10949         * testsuite/plugin_test_4.sh: New test case.
10950
10951 2009-01-07  Ian Lance Taylor  <iant@google.com>
10952
10953         * version.cc (version_string): Bump to 1.8.
10954
10955 2008-12-23  Cary Coutant  <ccoutant@google.com>
10956
10957         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10958         * plugin.cc (Plugin_manager::finish): Rename as
10959         layout_deferred_objects.  Move cleanup to separate function.
10960         (Plugin_manager::cleanup): New function.
10961         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10962         separately.
10963         * plugin.h (Plugin_manager::finish): Rename as
10964         layout_deferred_objects.
10965         (Plugin_manager::cleanup): New function.
10966         (Plugin_manager::cleanup_done): New field.
10967
10968 2008-12-23  Cary Coutant  <ccoutant@google.com>
10969
10970         * plugin.cc (is_visible_from_outside): New function.
10971         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10972         so we don't return "IR only" status for exported symbols or -r links.
10973
10974         * testsuite/Makefile.am (plugin_test_3): New test case.
10975         * testsuite/Makefile.in: Regenerate.
10976         * testsuite/plugin_test_3.sh: New file.
10977
10978 2008-12-22  Cary Coutant  <ccoutant@google.com>
10979
10980         * object.cc (Sized_relobj::layout_section): New function.
10981         (Sized_relobj::do_layout): Defer layout of input sections until after
10982         plugin has provided replacement files.
10983         (Sized_relobj::do_layout_deferred_sections): New function.
10984         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10985         (Relobj::layout_deferred_sections): New function.
10986         (Relobj::do_layout_deferred_sections): New function.
10987         (Sized_relobj::do_layout_deferred_sections): New function.
10988         (Sized_relobj::layout_section): New function.
10989         (Sized_relobj::Deferred_layout): New structure.
10990         (Sized_relobj::deferred_layout_): New field.
10991         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10992         Change all callers.  Layout deferred sections.
10993         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10994         references.
10995         (Plugin_hook::run): Move code from do_plugin_hook inline.
10996         (Plugin_hook::do_plugin_hook): Remove.
10997         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10998         (Plugin_manager::finish): Renamed, was cleanup.
10999         (Plugin_manager::should_defer_layout): New function.
11000         (Plugin_manager::add_deferred_layout_object): New function.
11001         (Plugin_manager::Deferred_layout_list): New type.
11002         (Plugin_manager::deferred_layout_objects_): New field.
11003         (Plugin_hook::do_plugin_hook): Remove.
11004
11005 2008-12-17  Ian Lance Taylor  <iant@google.com>
11006
11007         * options.h (class General_options): Add --no case for
11008         --export-dynamic.
11009
11010 2008-12-16  Cary Coutant  <ccoutant@google.com>
11011
11012         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11013         vector.
11014         (Plugin_manager::claim_file): Create plugin object even if
11015         plugin did not call the add_symbols callback.
11016         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11017         asking for more symbols than were added.
11018         * testsuite/Makefile.am (plugin_test_1): Add test case with
11019         no global symbols.
11020         (empty.syms): New target.
11021         * testsuite/Makefile.in: Regenerate.
11022         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11023         message. Don't call add_symbols if no globals.
11024         (all_symbols_read_hook): Don't provide replacement for empty
11025         claimed file.
11026
11027 2008-12-12  Ian Lance Taylor  <iant@google.com>
11028
11029         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11030         r_type == 0 for a local symbol with r_sym == 0.
11031         (scan_relocatable_relocs): Pass r_sym to
11032         local_non_section_strategy.
11033         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11034         r_sym parameter.
11035
11036         * configure.ac: Update test for TLS descriptors: they are
11037         supported as of glibc 2.9.
11038         * configure: Rebuild.
11039
11040 2008-12-11  Ian Lance Taylor  <iant@google.com>
11041
11042         PR 7091
11043         * target-reloc.h (Default_scan_relocatable_relocs): For each
11044         function, map r_type == 0 to RELOC_DISCARD.
11045
11046 2008-12-10  Cary Coutant  <ccoutant@google.com>
11047
11048         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11049         object to override a kept COMDAT group from a plugin object.
11050
11051 2008-12-09  Ian Lance Taylor  <iant@google.com>
11052
11053         PR 7088
11054         * yyscript.y (file_cmd): Handle INPUT.
11055
11056         * testsuite/initpri1.c: Change all declarations to be full
11057         prototypes by adding void, to avoid compiler warnings.
11058
11059 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11060
11061         * options.cc (General_options::parse_plugin_opt): New.
11062         (General_options::add_plugin): The argument now is just the filename.
11063         (General_options::add_plugin_option): New.
11064         * options.h (plugin_opt): New.
11065         (add_plugin): Change argument name.
11066         (add_plugin_option): New.
11067         * plugin.cc (Plugin::load): Don't parse the plugin option.
11068         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11069         (Plugin::add_option): New.
11070         (Plugin::args_): Change type.
11071         (Plugin::filename_): New.
11072         (Plugin_manager::add_plugin_option): New.
11073         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11074         * testsuite/Makefile.in: Regenerate.
11075
11076 2008-12-05  Cary Coutant  <ccoutant@google.com>
11077
11078         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11079         Handle --strip-lto-sections option.
11080         * options.h (strip_lto_sections): New option.
11081
11082 2008-12-01  Cary Coutant  <ccoutant@google.com>
11083
11084         * plugin.cc (ld_plugin_message): Change format parameter to const.
11085         Fix mismatch between new[] and delete.
11086
11087 2008-11-14  Cary Coutant  <ccoutant@google.com>
11088
11089         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11090         instead of -1U.
11091
11092 2008-11-05  Craig Silverstein  <csilvers@google.com>
11093
11094         * options.cc (General_options::parse_dynamic_list): New function.
11095         * options.h (General_options): New flags dynamic_list,
11096         dynamic_list_data, dynamic_list_cpp_new, and
11097         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11098         (General_options::in_dynamic_list): New function.
11099         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11100         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11101         (Lex::can_continue_name): Likewise.
11102         (yylex): Likewise.
11103         (read_script_file): New parameter script_options.
11104         (read_dynamic_list): New function.
11105         (Script_options::define_dynamic_list): New function.
11106         (dynamic_list_keyword_parsecodes): New variable.
11107         (dynamic_list_keywords): New variable.
11108         * script.h (Script_options::define_dynamic_list): New function
11109         prototype.
11110         (read_dynamic_list): New function prototype.
11111         * symtab.cc (strprefix): New macro.
11112         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11113         dynamic_list_data, dynamic_list_cpp_new, and
11114         dynamic_list_cpp_typeinfo.
11115         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11116         (dynamic_list_expr): New rule.
11117         (dynamic_list_nodes): Likewise.
11118         (dynamic_list_node): Likewise.
11119         * testsuite/Makefile.am (dynamic_list): New test.
11120         * testsuite/Makefile.in: Regenerated.
11121         * testsuite/dynamic_list.t: New file.
11122         * testsuite/dynamic_list.sh: New file.
11123
11124 2008-11-05  Craig Silverstein  <csilvers@google.com>
11125
11126         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11127         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11128         (t11_last): Likewise.
11129         * testsuite/ver_test_6.c (main): Likewise.
11130
11131 2008-10-07  Cary Coutant  <ccoutant@google.com>
11132
11133         * options.c (General_options::finalize): Add check for -static and
11134         -shared.
11135         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11136         is not empty.
11137
11138 2008-10-02  Cary Coutant  <ccoutant@google.com>
11139
11140         * plugin.cc (make_sized_plugin_object): Fix conditional
11141         compilation to work when not all targets are enabled.
11142
11143 2008-09-29  Cary Coutant  <ccoutant@google.com>
11144
11145         * archive.cc (Archive::get_file_and_offset): Use filename instead
11146         of name to get library path.
11147         (Archive::include_member): Unlock external member of a thin archive.
11148
11149         * testsuite/Makefile.am (TEST_AR): New variable.
11150         (thin_archive_test_1): New test.
11151         (thin_archive_test_2): New test.
11152         * testsuite/Makefile.in: Regenerate.
11153         * testsuite/thin_archive_main.cc: New file.
11154         * testsuite/thin_archive_test_1.cc: New file.
11155         * testsuite/thin_archive_test_2.cc: New file.
11156         * testsuite/thin_archive_test_3.cc: New file.
11157         * testsuite/thin_archive_test_4.cc: New file.
11158
11159 2008-09-29  Cary Coutant  <ccoutant@google.com>
11160
11161         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11162         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11163         instead of -1U.
11164         (Sized_relobj::do_finalize_local_symbols): Likewise.
11165         (Sized_relobj::map_to_kept_section): Likewise.
11166         * object.h (Sized_relobj::invalid_address): New constant.
11167         (Sized_relobj::do_output_section_offset): Check for invalid_address
11168         and return -1ULL.
11169         * output.cc (Output_reloc::local_section_offset): Use constant
11170         invalid_address instead of -1U.
11171         (Output_reloc::get_address): Likewise.
11172         (Output_section::output_address): Change -1U to -1ULL.
11173         * output.h (Output_reloc::invalid_address): New constant.
11174         * reloc.cc (Sized_relobj::write_sections): Use constant
11175         invalid_address instead of -1U.
11176         (Sized_relobj::relocate_sections): Likewise.
11177         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11178         values for merge sections.
11179         * target-reloc.h (relocate_for_relocatable): Use constant
11180         invalid_address instead of -1U.
11181
11182 2008-09-19  Cary Coutant  <ccoutant@google.com>
11183
11184         Add plugin functionality for link-time optimization (LTO).
11185         * configure.ac (plugins): Add --enable-plugins option.
11186         * configure: Regenerate.
11187         * config.in: Regenerate.
11188         * Makefile.am (LIBDL): New variable.
11189         (CCFILES): Add plugin.cc.
11190         (HFILES): Add plugin.h.
11191         (ldadd_var): Add LIBDL.
11192         * Makefile.in: Regenerate.
11193
11194         * archive.cc: Include "plugin.h".
11195         (Archive::setup): Don't preread archive symbols when using a plugin.
11196         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11197         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11198         files.
11199         (Archive::include_member): Add symbols from plugin objects.
11200         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11201         * descriptors.cc (Descriptors::open): Check for file descriptors
11202         abandoned by plugins.
11203         (Descriptors::claim_for_plugin): New function.
11204         * descriptors.h (Descriptors::claim_for_plugin): New function.
11205         (Open_descriptor::is_claimed): New field.
11206         (claim_descriptor_for_plugin): New function.
11207         * fileread.cc (File_read::claim_for_plugin): New function.
11208         * fileread.h (File_read::claim_for_plugin): New function.
11209         (File_read::descriptor): New function.
11210         * gold.cc: Include "plugin.h".
11211         (queue_initial_tasks): Add task to call plugin hooks for generating
11212         new object files.
11213         * main.cc: Include "plugin.h".
11214         (main): Load plugin libraries.
11215         * object.h (Pluginobj): Declare.
11216         (Object::pluginobj): New function.
11217         (Object::do_pluginobj): New function.
11218         (Object::set_target): New function.
11219         * options.cc: Include "plugin.h".
11220         (General_options::parse_plugin): New function.
11221         (General_options::General_options): Initialize plugins_ field.
11222         (General_options::add_plugin): New function.
11223         * options.h (Plugin_manager): Declare.
11224         (General_options): Add --plugin option.
11225         (General_options::has_plugins): New function.
11226         (General_options::plugins): New function.
11227         (General_options::add_plugin): New function.
11228         (General_options::plugins_): New field.
11229         * plugin.cc: New file.
11230         * plugin.h: New file.
11231         * readsyms.cc: Include "plugin.h".
11232         (Read_symbols::do_read_symbols): Check for archive before checking
11233         for ELF file.  Call plugin hooks to claim files.
11234         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11235         from a real object file; force override when processing replacement
11236         files.
11237         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11238         (Symbol::init_base_object): Likewise.
11239         (Symbol::init_base_output_data): Likewise.
11240         (Symbol::init_base_output_segment): Likewise.
11241         (Symbol::init_base_constant): Likewise.
11242         (Symbol::init_base_undefined): Likewise.
11243         (Symbol::output_section): Assert that object is not a plugin.
11244         (Symbol_table::add_from_pluginobj): New function.
11245         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11246         undefined.
11247         (Symbol_table::sized_write_globals): Likewise.
11248         (Symbol_table::add_from_pluginobj): Instantiate template.
11249         * symtab.h (Sized_pluginobj): Declare.
11250         (Symbol::in_real_elf): New function.
11251         (Symbol::set_in_real_elf): New function.
11252         (Symbol::in_real_elf_): New field.
11253         (Symbol_table::add_from_pluginobj): New function.
11254
11255         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11256         (LIBDL): New variable.
11257         (LDADD): Add LIBDL.
11258         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11259         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11260         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11261         (MOSTLYCLEANFILES): Likewise.
11262         * testsuite/Makefile.in: Regenerate.
11263         * testsuite/plugin_test.c: New file.
11264         * testsuite/plugin_test_1.sh: New file.
11265         * testsuite/plugin_test_2.sh: New file.
11266
11267 2008-09-16  Ian Lance Taylor  <iant@google.com>
11268
11269         * target-reloc.h (relocate_section): Check whether a symbol is
11270         defined by the ABI before reporting an undefined symbol error.
11271         * target.h (Target::is_defined_by_abi): Make parameter const.
11272         (Target::do_is_defined_by_abi): Likewise.
11273         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11274         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11275         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11276         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11277         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11278         * testsuite/Makefile.in: Rebuild.
11279
11280         * fileread.cc (make_view): Add casts to avoid warning.
11281
11282 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11283
11284         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11285         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11286
11287 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11288
11289         * options.h (General_options::output_is_executable): New.
11290         (General_options::output_is_pie): New.
11291         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11292         for shared libraries.
11293         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11294
11295 2008-09-11  Chris Demetriou  <cgd@google.com>
11296
11297         * options.h (origin): New -z option.
11298         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11299         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11300         in DT_FLAGS_1.
11301
11302 2008-09-05  Cary Coutant  <ccoutant@google.com>
11303
11304         * fileread.cc (File_read::make_view): Add check for attempt to map
11305         beyond end of file.
11306
11307 2008-09-05  Cary Coutant  <ccoutant@google.com>
11308
11309         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11310         explicit instantiations.
11311
11312 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11313
11314         PR gold/6858
11315         * options.cc (General_options::finalize): Allow undefined symbols
11316         in shlibs if linking -shared.
11317
11318         PR gold/6859
11319         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11320         symbols as not needing a dynsym entry.
11321
11322 2008-08-20  Craig Silverstein  <csilvers@google.com>
11323
11324         * fileread.cc (File_read::open): Do not lock the file unless it
11325         was successfully opened.
11326
11327 2008-08-14  Cary Coutant  <ccoutant@google.com>
11328
11329         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11330         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11331         * testsuite/tls_test.cc (struct int128): 128-bit struct
11332         for testing TLS relocs with non-zero addend.
11333         (v12): New TLS variable.
11334         (t12): New test.
11335         (t_last): Add check for v12.
11336         * testsuite/tls_test.h (t12): New function.
11337         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11338
11339 2008-08-13  Ian Lance Taylor  <iant@google.com>
11340
11341         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11342         set tls_segment_ or relro_segment_.
11343         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11344         when appropriate.
11345         * output.h (Output_section::clear_is_relro): New function.
11346         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11347         sections specially even when output_data_ is empty.
11348         (Output_segment::maximum_alignment): When first section is relro,
11349         only force alignment for PT_LOAD segments.
11350         * script.cc (script_data_segment_align): New function.
11351         (script_data_segment_relro_end): New function.
11352         * script-c.h (script_data_segment_align): Declare.
11353         (script_data_segment_relro_end): Declare.
11354         * script-sections.h (class Script_sections): Declare
11355         data_segment_align and data_segment_relro_end.  Add fields
11356         segment_align_index_ and saw_relro_end_.
11357         * script-sections.cc (class Sections_element): Add set_is_relro
11358         virtual function.  Add new bool* parameter to place_orphan_here.
11359         Add get_output_section virtual function.
11360         (class Output_section_definition): Add set_is_relro.  Add new
11361         bool* parameter to place_orphan_here.  Add get_output_section.
11362         Add is_relro_ field.
11363         (Output_section_definition::Output_section_definition): Initialize
11364         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11365         and is_relro_ fields.
11366         (Output_section_definition::place_orphan_here): Add is_relro
11367         parameter.
11368         (Output_section_definition::set_section_addresses): Set relro for
11369         output section.
11370         (Output_section_definition::alternate_constraint): Likewise.
11371         (class Orphan_output_section): Add new bool* parameter to
11372         place_orphan_here.  Add get_output_section.
11373         (Orphan_output_section::place_orphan_here): Add is_relro
11374         parameter.
11375         (Script_sections::Script_sections): Initialize
11376         data_segment_align_index_ and saw_relro_end_.
11377         (Script_sections::data_segment_align): New function.
11378         (Script_sections::data_segment_relro_end): New function.
11379         (Script_sections::place_orphan): Set or clear is_relro.
11380         (Script_sections::set_section_addresses): Force alignment of first
11381         TLS section.
11382         * yyscript.y (exp): Call script_data_segment_align and
11383         script_data_segment_relro_end.
11384         * testsuite/relro_script_test.t: New file.
11385         * testsuite/relro_test.cc (using_script): Declare.
11386         (t1, t2): Test using_script.
11387         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11388         (relro_script_test_SOURCES): Define.
11389         (relro_script_test_DEPENDENCIES): Define.
11390         (relro_script_test_LDFLAGS): Define.
11391         (relro_script_test_LDADD): Define.
11392         (relro_script_test.so): New target.
11393         * testsuite/Makefile.in: Rebuild.
11394
11395 2008-08-06  Cary Coutant <ccoutant@google.com>
11396
11397         * archive.cc (Archive::total_archives, Archive::total_members)
11398         (Archive::total_members_loaded): New variables.
11399         (Archive::setup): Add parameter.  Add option to preread
11400         archive symbols.
11401         (Archive::read_armap): Add counter.
11402         (Archive::get_file_and_offset): New function.
11403         (Archive::get_elf_object_for_member): New function.
11404         (Archive::read_all_symbols): New function.
11405         (Archive::read_symbols): New function.
11406         (Archive::add_symbols): Add counters.
11407         (Archive::include_all_members): Use armap to find members if it's
11408         already built.
11409         (Archive::include_member): Skip reading symbols if already read.
11410         Factored code into Archive::get_file_and_offset and
11411         Archive::get_elf_object_for_member.  Changed call to
11412         Mapfile::report_include_archive_member.
11413         (Archive::print_stats): New function.
11414         * archive.h: Declare Object and Read_symbols_data classes.
11415         (Archive::Archive): Add initializers for new members.
11416         (Archive::setup): Add parameter.
11417         (Archive::print_stats): New function.
11418         (Archive::total_archives, Archive::total_members)
11419         (Archive::total_members_loaded): New variables.
11420         (Archive::get_file_and_offset): New function.
11421         (Archive::get_elf_object_for_member): New function.
11422         (Archive::read_all_symbols): New function.
11423         (Archive::read_symbols): New function.
11424         (Archive::Archive_member): New class.
11425         (Archive::members_): New member.
11426         (Archive::num_members_): New member.
11427         * main.cc: Include archive.h.
11428         (main): Call Archive::print_stats.
11429         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11430         archive parameter; member_name is now the fully-decorated name.
11431         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11432         * options.h: (General_options): Add --preread-archive-symbols option.
11433         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11434         Archive::setup.
11435
11436 2008-08-04  Ian Lance Taylor  <iant@google.com>
11437
11438         * symtab.h (Symbol::use_plt_offset): New function.
11439         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11440         * powerpc.cc (Relocate::relocate): Likewise.
11441         * sparc.cc (Relocate::relocate): Likewise.
11442         * x86_64.cc (Relocate::relocate): Likewise.
11443         * testsuite/weak_plt.sh: New test.
11444         * testsuite/weak_plt_main.cc: New test.
11445         * testsuite/weak_plt_shared.cc: New test.
11446         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11447         (check_PROGRAMS): Add weak_plt.
11448         (check_DATA): Add weak_plt_shared.so.
11449         (weak_plt_main_pic.o, weak_plt): New targets.
11450         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11451         * testsuite/Makefile.in: Rebuild.
11452
11453         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11454         gcctestdir/ld.
11455         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11456         * testsuite/Makefile.in: Rebuild.
11457
11458 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11459
11460         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11461         * Makefile.in: Regenerate.
11462         * po/POTFILES.in: Regenerate.
11463
11464 2008-07-29  Ian Lance Taylor  <iant@google.com>
11465
11466         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11467         symbols before other symbols.
11468         * testsuite/script_test_2.cc (test_addr): Declare.
11469         (test_addr_alias): Declare.
11470         (main): Check that test_addr and test_addr_alias have the right
11471         values.
11472         * testsuite/script_test_2.t: Define test_addr_alias and
11473         test_addr.
11474
11475 2008-07-24  Ian Lance Taylor  <iant@google.com>
11476
11477         PR 5990
11478         * descriptors.cc: New file.
11479         * descriptors.h: New file.
11480         * gold-threads.h (class Hold_optional_lock): New class.
11481         * fileread.cc: Include "descriptors.h".
11482         (File_read::~File_read): Release descriptor rather than closing
11483         it.
11484         (File_read::open) [file]: Call open_descriptor rather than open.
11485         Set is_descriptor_opened_.
11486         (File_read::open) [memory]: Assert that descriptor is not open.
11487         (File_read::reopen_descriptor): New function.
11488         (File_read::release): Release descriptor.
11489         (File_read::do_read): Make non-const.  Reopen descriptor.
11490         (File_read::read): Make non-const.
11491         (File_read::make_view): Reopen descriptor.
11492         (File_read::do_readv): Likewise.
11493         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11494         Update declarations.
11495         * layout.cc: Include "descriptors.h".
11496         (Layout::create_build_id): Use open_descriptor rather than open.
11497         * output.cc: Include "descriptors.h".
11498         (Output_file::open): Use open_descriptor rather than open.
11499         * archive.cc (Archive::const_iterator): Change Archive to be
11500         non-const.
11501         (Archive::begin, Archive::end): Make non-const.
11502         (Archive::count_members): Likewise.
11503         * archive.h (class Archive): Update declarations.
11504         * object.h (Object::read): Make non-const.
11505         * Makefile.am (CCFILES): Add descriptors.cc.
11506         (HFILES): Add descriptors.h.
11507         * Makefile.in: Rebuild.
11508
11509         PR 6716
11510         * gold.h: Always include <clocale>.  Add Solaris workarounds
11511         following code in binutils/sysdep.h.
11512
11513         PR 6048
11514         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11515         this->eh_frame_hdr_ is NULL before using it.
11516
11517         * dynobj.cc (Versions::Versions): Update comment.
11518
11519         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11520         the base version name.
11521
11522         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11523         array size plus one.
11524         (Stringpool_template::set_string_offsets): Subtract one from key
11525         before using it as an array index.
11526         (Stringpool_template::get_offset_with_length): Likewise.
11527         (Stringpool_template::write_to_buffer): Likewise.
11528         * stringpool.h (Stringpool_template::get_offset_from_key):
11529         Likewise.
11530
11531 2008-07-23  Ian Lance Taylor  <iant@google.com>
11532
11533         PR 6658
11534         * object.h (Merged_symbol_value::value): Do our best to handle a
11535         negative addend.
11536
11537         PR 6647
11538         * script.cc (Version_script_info::get_versions): Don't add empty
11539         version tag to return value.
11540         (Version_script_info::get_symbol_version_helper): Change return
11541         type to bool.  Add pversion parameter.  Change all callers.
11542         (script_register_vers_node): Don't require a non-NULL tag.
11543         * script.h (class Version_script_info): Update declarations.
11544         (Version_script_info::get_symbol_version): Change return type to
11545         bool.  Add version parameter.  Change all callers.
11546         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11547         handling.  Handle an empty version from a version script.
11548         (Symbol_table::define_special_symbol): Likewise.
11549         * testsuite/ver_test_10.script: New file.
11550         * testsuite/ver_test_10.sh: New file.
11551         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11552         (check_DATA): Add ver_test_10.syms.
11553         (ver_test_10.syms, ver_test_10.so): New target.
11554         * testsuite/Makefile.in: Rebuild.
11555
11556 2008-07-23  Simon Baldwin  <simonb@google.com>
11557
11558         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11559         to zero for undefined symbols from dynamic libraries.
11560
11561 2008-07-23  Ian Lance Taylor  <iant@google.com>
11562
11563         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11564         Change all callers.
11565         * symtab.h (class Symbol_table): Update declaration.
11566         * testsuite/ver_test_9.cc: New file.
11567         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11568         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11569         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11570         (ver_test_9.so, ver_test_9.o): New targets.
11571         * testsuite/Makefile.in: Rebuild.
11572
11573 2008-07-22  Ian Lance Taylor  <iant@google.com>
11574
11575         * options.h (class General_options): Define --check-sections.
11576         * layout.cc (Layout::set_segment_offsets): Handle
11577         --check-sections.
11578
11579         * options.h (class General_options): Define -n/--nmagic and
11580         -N/--omagic.
11581         * options.cc (General_options::finalize): For -n/--nmagic or
11582         -N/--omagic, set -static.
11583         * layout.cc (Layout::attach_allocated_section_to_segment): If
11584         -N/--omagic, don't put read-only and read-write sections in
11585         different segments.
11586         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11587         finding a read-only segment.
11588         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11589         don't set the minimum segment alignment to the common page size,
11590         and don't set the file offset to the address modulo the page size.
11591         * script-sections.cc (Script_sections::create_segments): If
11592         -n/--omagic, don't put read-only and read-write sections in
11593         different segments.
11594
11595         * cref.cc: New file.
11596         * cref.h: New file.
11597         * options.h (class General_options): Add --print-symbol-counts.
11598         * main.cc (main): Issue defined symbol report if requested.
11599         * archive.cc (Archive::interpret_header): Make into a const member
11600         function.
11601         (Archive::add_symbols): Call Input_objects::archive_start and
11602         archive_stop.
11603         (Archive::const_iterator): Define new class.
11604         (Archive::begin, Archive::end): New functions.
11605         (Archive::include_all_members): Rewrite to use iterator.
11606         (Archive::count_members): New function.
11607         * archive.h (class Archive): Update declarations.
11608         (Archive::filename): New function.
11609         * object.cc: Include "cref.h".
11610         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11611         (Sized_relobj::do_get_global_symbol_counts): New function.
11612         (Input_objects::add_object): Add object to cross-referencer.
11613         (Input_objects::archive_start): New function.
11614         (Input_objects::archive_stop): New function.
11615         (Input_objects::print_symbol_counts): New function.
11616         * object.h: Declare Cref and Archive.
11617         (Object::get_global_symbol_counts): New function.
11618         (Object::do_get_global_symbol_counts): New pure virtual function.
11619         (class Sized_relobj): Add defined_count_ field.  Update
11620         declarations.
11621         (class Input_objects): Add cref_ field.  Update constructor.
11622         Update declarations.
11623         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11624         defined_count_.
11625         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11626         symbol counts.
11627         (Sized_dynobj::do_get_global_symbol_counts): New function.
11628         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11629         defined_count_.  Update declarations.  Define Symbols typedef.
11630         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11631         parameter.  Change all callers.
11632         (Symbol_table::add_from_dynobj): Add sympointers and defined
11633         parameters.  Change all callers.
11634         * symtab.h (class Symbol_table): Update declarations.
11635         * Makefile.am (CCFILES): Add cref.cc.
11636         (HFILES): Add cref.h.
11637         * Makefile.in: Rebuild.
11638
11639 2008-07-22  Simon Baldwin  <simonb@google.com>
11640
11641         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11642         to zero when writing undefined symbols.
11643
11644 2008-07-22  Ian Lance Taylor  <iant@google.com>
11645
11646         * output.cc (Output_section::add_input_section): Don't try to
11647         merge empty merge sections.
11648
11649 2008-07-21  Craig Silverstein  <csilvers@google.com>
11650
11651         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11652         Include symbol version in error message.
11653
11654 2008-07-20  Chris Demetriou  <cgd@google.com>
11655
11656         * configure.ac (gold_cv_c_random_seed): New configured variable.
11657         (RANDOM_SEED_CFLAGS): New substituted variable.
11658         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11659         * configure: Rebuild.
11660         * Makefile.in: Likewise.
11661         * testsuite/Makefile.in: Likewise.
11662
11663 2008-07-18  Ian Lance Taylor  <iant@google.com>
11664
11665         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11666         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11667         * testsuite/ver_test_main.cc (main): Call t4.
11668         (t4, t4_2a): Define.
11669         * testsuite/ver_test_2.cc (t4_2): Define.
11670         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11671         * testsuite/ver_test_4.cc (t4_2a): Define.
11672         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11673         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11674
11675 2008-07-17  Ian Lance Taylor  <iant@google.com>
11676
11677         * dynobj.cc (Versions::add_def): If we give an error about a
11678         missing version, go ahead and create the version anyhow.
11679
11680 2008-07-10  Ian Lance Taylor  <iant@google.com>
11681
11682         Handle output sections with more than 0x7fffffff bytes.
11683         * object.h (class Relobj): Change map_to_output_ to
11684         output_sections_, and just keep a section pointer.  Change all
11685         uses.  Move comdat group support to Sized_relobj.
11686         (Relobj::is_section_specially_mapped): Remove.
11687         (Relobj::output_section): Remove poff parameter.  Change all
11688         callers.
11689         (Relobj::output_section_offset): New function.
11690         (Relobj::set_section_offset): Rewrite.
11691         (Relobj::map_to_output): Remove.
11692         (Relobj::output_sections): New function.
11693         (Relobj::do_output_section_offset): New pure virtual function.
11694         (Relobj::do_set_section_offset): Likewise.
11695         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11696         group support from Relobj.  Update declarations.
11697         (Sized_relobj::get_output_section_offset): New function.
11698         (Sized_relobj::do_output_section_offset): New function.
11699         (Sized_relobj::do_set_section_offset): New function.
11700         * object.cc (Relobj::output_section_address): Remove.
11701         (Sized_relobj::Sized_relobj): Initialize new fields.
11702         (Sized_relobj::include_section_group): Cast find_kept_object to
11703         Sized_relobj.
11704         (Sized_relobj::include_linkonce_section): Likewise.
11705         (Sized_relobj::do_layout): Use separate arrays for output section
11706         and output offset.
11707         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11708         output_sections.
11709         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11710         output_sections and section_offsets.
11711         (Sized_relobj::write_local_symbols): Likewise.
11712         (map_to_kept_section): Compute output address directly.
11713         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11714         output_sections and section_offsets.
11715         (Sized_relobj::write_sections): Likewise.
11716         (Sized_relobj::relocate_sections): Likewise.
11717         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11718         * output.h (class Output_reloc): Update declarations.  Change
11719         u2_.relobj to Sized_relobj*.
11720         (class Output_data_reloc): Change add functions to use
11721         Sized_relobj*.
11722         * output.cc (Output_reloc::Output_reloc): Change relobj to
11723         Sized_relobj*.
11724         (Output_reloc::local_section_offset): Change return type to
11725         Elf_Addr.  Use get_output_section_offset.
11726         (Output_reloc::get_address): Likewise.
11727         (Output_section::is_input_address_mapped): Don't call
11728         is_section_specially_mapped.
11729         (Output_section::output_offset): Likewise.
11730         (Output_section::output_address): Likewise.
11731         (Output_section::starting_output_address): Likewise.
11732         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11733         parameter to Sized_relobj*.
11734         (Copy_relocs::need_copy_reloc): Likewise.
11735         (Copy_relocs::save): Likewise.
11736         * copy-relocs.h (class Copy_relocs): Update declarations.
11737         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11738         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11739         * target-reloc.h (relocate_for_relocatable): Change
11740         offset_in_output_section type to Elf_Addr.  Change code that uses
11741         it as well.
11742         * layout.cc (Layout::layout): Always set *off.
11743         * mapfile.cc (Mapfile::print_input_section): Use
11744         output_section_offset.
11745         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11746         Sized_relobj*.
11747         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11748         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11749         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11750
11751 2008-07-03  Ian Lance Taylor  <iant@google.com>
11752
11753         * layout.cc (Layout::include_section): Do not discard unrecognized
11754         SHT_STRTAB sections.
11755
11756 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11757
11758         * script.cc (Lex::can_continue_name): Make '?' allowable in
11759         version-script names.
11760         * testsuite/version_script.map: Change glob pattern to use '?'
11761
11762 2008-06-30  Manish Singh  <yosh@gimp.org>
11763
11764         PR 6585
11765         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11766         Correct typo.
11767
11768 2008-06-30  Ian Lance Taylor  <iant@google.com>
11769
11770         PR 6660
11771         PR 6682
11772         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11773         versions]: Don't try to read the value in the contents, since we
11774         don't use it.  Use the template endianness when writing.
11775
11776 2008-06-25  Cary Coutant  <ccoutant@google.com>
11777
11778         * fileread.cc (File_read::make_view): Assert on zero-length view.
11779         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11780         symbol table when there are no symbols to read.
11781
11782 2008-06-23  Craig Silverstein  <csilvers@google.com>
11783
11784         * version.cc (version_string): Bump to 1.7
11785
11786 2008-06-18  Craig Silverstein  <csilvers@google.com>
11787
11788         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11789         constant 0xFFFF to type Valtype.
11790         (Powerpc_relocate_functions::rel16_ha): Likewise.
11791
11792 2008-06-17  Ian Lance Taylor  <iant@google.com>
11793
11794         * output.h (Output_section::Input_section): Initialize p2align_ to
11795         zero for Output_section_data constructors.
11796         (Output_section::Input_section::addralign): If not an input
11797         section, return the alignment of the Output_section_data.
11798         * testsuite/copy_test.cc: New file.
11799         * testsuite/copy_test_1.cc: New file.
11800         * testsuite/copy_test_2.cc: New file.
11801         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11802         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11803         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11804         (copy_test_1_pic.o, copy_test_1.so): New targets.
11805         (copy_test_2_pic.o, copy_test_2.so): New targets.
11806         * testsuite/Makefile.in: Rebuild.
11807
11808         * script-sections.cc (Script_sections::place_orphan): Initialize
11809         local variable exact.
11810
11811 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11812
11813         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11814
11815 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11816             David S. Miller  <davem@davemloft.net>
11817
11818         * powerpc.cc: New file.
11819         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11820         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11821         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11822         * Makefile.in: Rebuild.
11823
11824 2008-06-09  Ian Lance Taylor  <iant@google.com>
11825
11826         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11827         <exception>.
11828         (throwing, orig_terminate): New static variables.
11829         (terminate_handler): New static function.
11830         (t2): Set terminate handler.
11831
11832 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11833
11834         PR 6584
11835         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11836         alignment.
11837
11838 2008-05-30  Cary Coutant  <ccoutant@google.com>
11839
11840         * archive.cc (Archive::include_all_members) Correct to step
11841         over symbol table and extended name table in thin archives.
11842
11843 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11844
11845         PR 6407
11846         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11847         calculation.
11848
11849 2008-05-28  Caleb Howe  <cshowe@google.com>
11850
11851         * reduced_debug_output.cc: New file.
11852         * reduced_debug_output.h: New file.
11853         * options.h (class General_options): Add --strip-debug-non-line.
11854         * options.cc (General_options::finalize): Add strip_debug_non_line
11855         to the strip heirarchy.
11856         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11857         fields.
11858         * layout.cc: Include "reduced_debug_output.h".
11859         (Layout::Layout): Initialize new fields.
11860         (line_only_debug_sections): New static array.
11861         (is_lines_only_debug_sections): New static inline function.
11862         (Layout::include_section): Handle --strip-debug-non-line.
11863         (Layout::make_output_section): If --strip-debug-non-line, build
11864         new output sections for .debug_abbrev and .debug_info.
11865         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11866         gold.  Warn about possible overflow.
11867         (read_signed_LEB_128): Likewise.
11868         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11869         (read_signed_LEB_128): Declare.
11870         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11871         (HFILES): Add reduced_debug_output.h.
11872         * Makefile.in: Rebuild.
11873
11874 2008-05-21  Ian Lance Taylor  <iant@google.com>
11875
11876         * mapfile.cc: New file.
11877         * mapfile.h: New file.
11878         * options.h (class General_options): Add -M/--print-map and -Map.
11879         * options.cc (General_options::finalize): Make -M equivalent to
11880         -Map -.
11881         * main.cc: Include <cstdio> and "mapfile.h".
11882         (main): Open mapfile if requested.
11883         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11884         constructor.  Change caller.
11885         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11886         (queue_middle_tasks): Likewise.
11887         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11888         declarations.
11889         * archive.cc: Include "mapfile.h".
11890         (Archive::add_symbols): Add mapfile parameter.  Change all
11891         callers.  Pass mapfile, symbol, and reason to include_member.
11892         (Archive::include_all_members): Add mapfile parameter.  Change all
11893         callers.
11894         (Archive::include_member): Add mapfile, sym, and why parameters.
11895         Change all callers.  Report inclusion to map file.
11896         * archive.h: Include "fileread.h".
11897         (class Archive): Update declarations.
11898         (Archive::file): New const method.
11899         (class Add_archive_symbols): Add mapfile_ field.  Update
11900         constructor.  Change all callers.
11901         * readsyms.h (class Read_symbols): Likewise.
11902         (class Finish_group): Likewise.
11903         (class Read_script): Likewise.
11904         * common.cc: Include "mapfile.h".
11905         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11906         all callers.
11907         (Symbol_table::do_allocate_commons): Likewise.
11908         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11909         symbol allocation to mapfile.
11910         * common.h (class Allocate_commons_task): Add mapfile_ field.
11911         Update constructor.  Change all callers.
11912         * symtab.h (class Symbol_table): Update declarations.
11913         * layout.cc: Include "mapfile.h".
11914         (Layout_task_runner::run): Print information to mapfile.
11915         (Layout::create_gold_note): Change Output_data_fixed_space to
11916         Output_data_zero_fill.
11917         (Layout::create_build_id): Likewise.
11918         (Layout::print_to_mapfile): New function.
11919         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11920         constructor.  Change caller.
11921         (class Layout): Declare print_to_mapfile.
11922         * output.cc (Output_section::Input_section::print_to_mapfile): New
11923         function.
11924         (Output_section::add_input_section): If producing a map, always
11925         add to input_sections_ list.
11926         (Output_section::do_print_to_mapfile): New function.
11927         (Output_segment::print_sections_to_mapfile): New function.
11928         (Output_segment::print_section_list_to_mapfile): New function.
11929         * output.h: Include "mapfile.h".
11930         (Output_data::print_to_mapfile): New function.
11931         (Output_data::do_print_to_mapfile): New virtual function.
11932         (Output_segment_headers::do_print_to_mapfile): New function.
11933         (Output_file_header::do_print_to_mapfile): New function.
11934         (Output_data_const::do_print_to_mapfile): New function.
11935         (class Output_data_const_buffer): Add map_name_ field.  Update
11936         constructor.  Change all callers.  Add do_print_to_mapfile
11937         function.
11938         (class Output_data_fixed_space): Likewise.
11939         (class Output_data_space): Likewise.
11940         (class Output_data_zero_fill): New class.
11941         (Output_data_strtab::do_print_to_mapfile): New function.
11942         (Output_data_reloc_base::do_print_to_mapfile): New function.
11943         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11944         (Output_data_group::do_print_to_mapfile): New function.
11945         (Output_data_got::do_print_to_mapfile): New function.
11946         (Output_data_dynamic::do_print_to_mapfile): New function.
11947         (Output_symtab_xindex::do_print_to_mapfile): New function.
11948         (class Output_section): Declare do_print_to_mapflie.  Declare
11949         print_to_mapfile in Input_section.
11950         (class Output_segment): Declare new functions.
11951         * object.h (Sized_relobj::symbol_count): New function.
11952         * script-sections.cc
11953         (Output_section_element_dot_assignment::set_section_addresses):
11954         Change Output_data_fixed_space to Output_data_zero_fill.
11955         (Output_data_expression::do_print_to_mapfile): New function.
11956         * script.cc (read_input_script): Add mapfile parameter.  Change
11957         all callers.
11958         * script.h (read_input_script): Update declaration.
11959         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11960         (Eh_frame::do_print_to_mapfile): New function.
11961         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11962         (Output_merge_string::do_print_to_mapfile): New function.
11963         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11964         function.
11965         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11966         function.
11967         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11968         function.
11969         * Makefile.am (CCFILES): Add mapfile.cc.
11970         (HFILES): Add mapfile.h.
11971         * Makefile.in: Rebuild.
11972
11973 2008-05-19  Ian Lance Taylor  <iant@google.com>
11974
11975         * options.h (class General_options): Add -z relro.
11976         * layout.cc (Layout::Layout): Initialize relro_segment_.
11977         (Layout::add_output_section_data): Return the output section.
11978         (Layout::make_output_section): Rcognize relro sections and mark
11979         them appropriately.
11980         (Layout::attach_allocated_section_to_segment): Put relro sections
11981         in a PT_GNU_RELRO segment.
11982         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11983         section as relro.
11984         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11985         PT_TLS segments.
11986         (Layout::linkonce_mapping): Map d.rel.ro.local to
11987         .data.rel.ro.local.
11988         (Layout::output_section_name): Us .data.rel.ro.local for any
11989         section which begins with that.
11990         * layout.h (class Layout): Update add_output_section_data
11991         declaration.  Add relro_segment_ field.
11992         * output.cc (Output_section::Output_section): Initialize is_relro_
11993         and is_relro_local_ fields.
11994         (Output_segment::add_output_section): Group relro sections.
11995         (Output_segment::is_first_section_relro): New function.
11996         (Output_segment::maximum_alignment): If there is a relro section,
11997         align the segment to the common page size.
11998         (Output_segment::set_section_addresses): Track whether we are
11999         looking at relro sections.  If the last section is a relro
12000         section, align to the common page size.
12001         (Output_segment::set_section_list_addresses): Add in_relro
12002         parameter.  Change all callers.  Align to the page size when
12003         moving from relro to non-relro section.
12004         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12005         segment.
12006         * output.h (class Output_section): Add is_relro_ and
12007         is_relro_local_ fields.
12008         (Output_section::is_relro): New function.
12009         (Output_section::set_is_relro): New function.
12010         (Output_section::is_relro_local): New function.
12011         (Output_section::set_is_relro_local): New function.
12012         (class Output_segment): Update declarations.
12013         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12014         * sparc.cc (Target_sparc::got_section): Likewise.
12015         * x86_64.cc (Target_x86_64::got_section): Likewise.
12016         * testsuite/relro_test_main.cc: New file.
12017         * testsuite/relro_test.cc: New file.
12018         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12019         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12020         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12021         (relro_test.so, relro_test_pic.o): New targets.
12022         * testsuite/Makefile.in: Rebuild.
12023
12024 2008-05-16  Ian Lance Taylor  <iant@google.com>
12025
12026         * output.cc (Output_segment::add_output_section): Remove front
12027         parameter.
12028         * output.h (class Output_segment): Remove
12029         add_initial_output_section and overloaded add_output_section.
12030         Update declaration of remaining add_output_section.
12031         * layout.cc (Layout::create_interp): Call add_output_section
12032         rather than add_initial_output_section.
12033         (Layout::finish_dynamic_section): Likewise.
12034
12035         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12036         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12037         know the dynamic type.
12038         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12039         field.  Initialize it in constructor.
12040         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12041         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12042         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12043         reloc.
12044
12045         * output.cc (Output_reloc::get_address): Change return type to
12046         Elf_Addr.
12047         * output.h (class Output_reloc): Update get_address declaration.
12048         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12049         for section addresses.
12050
12051 2008-05-09  Ian Lance Taylor  <iant@google.com>
12052
12053         PR 6493
12054         * gold.cc (gold_nomem): Use return value of write.
12055
12056 2008-05-08  Ian Lance Taylor  <iant@google.com>
12057
12058         * symtab.c (Symbol::init_base_output_data): Add version
12059         parameter.  Change all callers.
12060         (Symbol::init_base_output_segment): Likewise.
12061         (Symbol::init_base_constant): Likewise.
12062         (Symbol::init_base_undefined): Likewise.
12063         (Sized_symbol::init_output_data): Likewise.
12064         (Sized_symbol::init_output_segment): Likewise.
12065         (Sized_symbol::init_constant): Likewise.
12066         (Sized_symbol::init_undefined): Likewise.
12067         (Symbol_table::do_define_in_output_data): If the new symbol has a
12068         version, mark it as the default.
12069         (Symbol_table::do_define_in_output_segment): Likewise.
12070         (Symbol_table::do_define_as_constant): Likewise.
12071         * symtab.h (class Symbol): Update declarations.
12072         (class Sized_symbol): Likewise.
12073         * resolve.cc (Symbol::override_version): New function.
12074         (Symbol::override_base): Call override_version.
12075         (Symbol::override_base_with_special): Likewise.
12076         * testsuite/ver_script_8.script: New file.
12077         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12078         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12079         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12080         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12081
12082 2008-05-06  Ian Lance Taylor  <iant@google.com>
12083
12084         PR 6049
12085         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12086         functions.
12087         (class General_options): Remove existing --undefined, and add
12088         --no-undefined instead.  Add new --undefined as synonym for -u.
12089         * archive.cc (Archive::add_symbols): Check whether symbol was
12090         named with -u.
12091         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12092         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12093         all uses.  Add IS_UNDEFINED.  Update declarations to split
12094         different versions of init_base.  Declare init_base_undefined.
12095         (Symbol::is_defined): Handle IS_UNDEFINED.
12096         (Symbol::is_undefined): Likewise.
12097         (Symbol::is_weak_undefined): Call is_undefined.
12098         (Symbol::is_absolute): Handle IS_CONSTANT.
12099         (class Sized_symbol): Update declarations to split different
12100         versions of init.  Declare init_undefined.
12101         (class Symbol_table): Declare new functions.
12102         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12103         Change all callers.
12104         (Symbol::init_base_output_data): Likewise.
12105         (Symbol::init_base_output_segment): Likewise.
12106         (Symbol::init_base_constant): Likewise.
12107         (Symbol::init_base_undefined): New function.
12108         (Sized_symbol::init_object): Rename from init.  Change all
12109         callers.
12110         (Sized_symbol::init_output_data): Likewise.
12111         (Sized_symbol::init_output_segment): Likewise.
12112         (Sized_symbol::init_constant): Likewise.
12113         (Sized_symbol::init_undefined): New function.
12114         (Symbol_table::add_undefined_symbols_from_command_line): New
12115         function.
12116         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12117         function.
12118         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12119         (Symbol::output_section): Likewise.
12120         (Symbol::set_output_section): Likewise.
12121         (Symbol_table::sized_finalize_symbol): Likewise.
12122         (Symbol_table::sized_write_globals): Likewise.
12123         * resolve.cc (Symbol_table::should_override): Likewise.
12124         (Symbol::override_base_with_special): Likewise.
12125
12126         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12127         symbol, change it to have default visibility.
12128         * testsuite/protected_1.cc: New file.
12129         * testsuite/protected_2.cc: New file.
12130         * testsuite/protected_3.cc: New file.
12131         * testsuite/protected_main_1.cc: New file.
12132         * testsuite/protected_main_2.cc: New file.
12133         * testsuite/protected_main_3.cc: New file.
12134         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12135         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12136         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12137         (protected_1.so): New target.
12138         (protected_1_pic.o, protected_2_pic.o): New targets.
12139         (protected_3_pic.o): New target.
12140         (check_PROGRAMS): Add protected_2.
12141         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12142         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12143         * testsuite/Makefile.in: Rebuild.
12144
12145         * options.h (DEFINE_var): Add set_user_set_##varname__.
12146         (DEFINE_bool_alias): New macro.
12147         (class General_options): Define -Bstatic using DEFINE_bool_alias
12148         rather than DEFINE_special.  Add --undefined as an alias for -z
12149         defs.
12150         * options.cc (General_options::parse_Bstatic): Remove.
12151
12152         * options.h (class General_options): Add --fatal-warnings.
12153         * main.cc (main): Implement --fatal-warnings.
12154         * errors.h (Errors::warning_count): New function.
12155
12156         * options.h (class General_options): Add -Bsymbolic-functions.
12157         * symtab.h (Symbol::is_preemptible): Check for
12158         -Bsymbolic-functions.
12159
12160 2008-05-05  Ian Lance Taylor  <iant@google.com>
12161
12162         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12163         as noVARNAME rather than no-VARNAME.
12164         (class General_options): Add option -z combreloc.
12165         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12166         get_address.
12167         (Output_reloc::sort_before) [SHT_REL]: New function.
12168         (Output_reloc::sort_before) [SHT_RELA]: New function.
12169         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12170         Sort_relocs_comparison.
12171         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12172         parameter.  Change all callers.
12173         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12174         sort_relocs parameter.  Change all callers.
12175         * output.cc (Output_reloc::get_address): New function, broken out
12176         of write_rel.
12177         (Output_reloc::write_rel): Call it.
12178         (Output_reloc::compare): New function.
12179         (Output_data_reloc_base::do_write): Optionally sort relocs.
12180
12181         * configure.ac: If targ_extra_obj is set, link it in.
12182         * configure.tgt: Initialize all variables.
12183         (x86_64*): Set targ_extra_obj and targ_extra_size.
12184         * configure: Rebuild.
12185
12186         * object.cc (Sized_relobj::include_section_group): Adjust section
12187         indexes read from group data.  Build vector to pass to
12188         layout_group.
12189         * layout.cc (Layout::layout_group): Add flags and shndxes
12190         parameters.  Remove contents parameter.  Change caller.  Update
12191         explicit instantiations.
12192         * layout.h (class Layout): Update layout_group declaration.
12193         * output.cc (Output_data_group::Output_data_group): Add flags and
12194         input_shndxes parameters.  Remove contents parameter.  Change
12195         caller.
12196         (Output_data_group::do_write): Change input_sections_ to
12197         input_shndxes_.
12198         * output.h (class Output_data_group): Update constructor
12199         declaration.  Rename input_sections_ to input_shndxes_.
12200         * testsuite/many_sections_test.cc: Add template.
12201
12202 2008-04-30  Cary Coutant  <ccoutant@google.com>
12203
12204         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12205
12206         * layout.cc (Layout::include_section): Refactored check for debug
12207         info section.
12208         (Layout::add_comdat): Add new parameters.  Change type
12209         of signature parameter.  Add object and shndx to signatures table.
12210         (Layout::find_kept_object): New function.
12211         * layout.h: Include <cstring>.
12212         (Layout::is_debug_info_section): New function.
12213         (Layout::add_comdat): Add new parameters.
12214         (Layout::find_kept_object): New function.
12215         (Layout::Kept_section): New struct.
12216         (Layout::Signatures): Change type of map range.
12217         * object.cc (Relobj::output_section_address): New function.
12218         (Sized_relobj::include_section_group): Add new parameters.  Change
12219         calls to Layout::add_comdat.  Change to build table of kept comdat
12220         groups and table mapping discarded sections to kept sections.
12221         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12222         (Sized_relobj::do_layout): Change calls to include_section_group and
12223         include_linkonce_section.
12224         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12225         value to zero when section is discarded.
12226         (Sized_relobj::map_to_kept_section): New function.
12227         * object.h (Relobj::output_section_address): New function.
12228         (Relobj::Comdat_group): New type.
12229         (Relobj::find_comdat_group): New function.
12230         (Relobj::Comdat_group_table): New type.
12231         (Relobj::Kept_comdat_section): New type.
12232         (Relobj::Kept_comdat_section_table): New type.
12233         (Relobj::add_comdat_group): New function.
12234         (Relobj::set_kept_comdat_section): New function.
12235         (Relobj::get_kept_comdat_section): New function.
12236         (Relobj::comdat_groups_): New field.
12237         (Relobj::kept_comdat_sections_): New field.
12238         (Symbol_value::input_value): Update comment.
12239         (Sized_relobj::map_to_kept_section) New function.
12240         (Sized_relobj::include_linkonce_section): Add new parameter.
12241         * target-reloc.h (Comdat_behavior): New type.
12242         (get_comdat_behavior): New function.
12243         (relocate_section): Add code to map a discarded section to the
12244         corresponding kept section when applying a relocation.
12245
12246 2008-04-30  Craig Silverstein  <csilvers@google.com>
12247
12248         * dwarf_reader.cc (next_generation_count): New static var.
12249         (Addr2line_cache_entry): New struct.
12250         (addr2line_cache): New static var.
12251         (Dwarf_line_info::one_addr2line): Added caching.
12252         (Dwarf_line_info::clear_addr2line_cache): New function.
12253         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12254         cache-size parameter.
12255         (Dwarf_line_info::one_addr2line_cache): New function.
12256         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12257         new cache-size argument to one_addr2line(), and clear cache.
12258
12259 2008-04-28  Cary Coutant  <ccoutant@google.com>
12260
12261         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12262         R_386_PC8 relocations.
12263
12264 2008-04-23  Ian Lance Taylor  <iant@google.com>
12265
12266         * object.cc (Sized_relobj::include_section_group): Check for
12267         invalid section group.
12268
12269         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12270         header size.
12271
12272         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12273         than read for file header.
12274         * archive.cc (Archive::include_member): Likewise.
12275
12276 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12277
12278         * aclocal.m4: Regenerate.
12279         * configure: Regenerate.
12280
12281 2008-04-19  Ian Lance Taylor  <iant@google.com>
12282
12283         * version.cc (version_string): Bump to 1.6.
12284
12285         * testsuite/Makefile.am (many_sections_r_test): New target.
12286         (many_sections_r_test_SOURCES): Remove.
12287         (many_sections_r_test_DEPENDENCIES): Remove.
12288         (many_sections_r_test_LDFLAGS): Remove.
12289         (many_sections_r_test_LDADD): Remove.
12290
12291         * object.cc (Sized_relobj::do_add_symbols): Always pass
12292         local_symbol_count_ to add_from_relobj.
12293
12294         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12295         every thousand variables.
12296         * testsuite/Makefile.in: Rebuild.
12297
12298         * object.cc (Xindex::initialize_symtab_xindex): New function.
12299         (Xindex::read_symtab_xindex): New function.
12300         (Xindex::sym_xindex_to_shndx): New function.
12301         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12302         available.
12303         (Sized_relobj::do_initialize_xindex): New function.
12304         (Sized_relobj::do_read_symbols): Adjust section links.
12305         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12306         parameter.  Change all callers.
12307         (Sized_relobj::include_section_group): Adjust section links and
12308         symbol section indexes.
12309         (Sized_relobj::do_layout): Adjust section links.
12310         (Sized_relobj::do_count_local_symbols): Adjust section links and
12311         symbol section indexes.
12312         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12313         ordinary and special symbols.
12314         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12315         dynsym_xindex parameters.  Change all callers.  Adjust section
12316         links.  Use SHN_XINDEX when needed.
12317         (Sized_relobj::get_symbol_location_info): Adjust section links.
12318         Don't get fooled by special symbols.
12319         * object.h (class Xindex): Define.
12320         (class Object): Add xindex_ parameter.  Declare virtual functoin
12321         do_initialize_xindex.
12322         (Object::adjust_sym_shndx): New function.
12323         (Object::set_xindex): New protected function.
12324         (class Symbol_value): Add is_ordinary_shndx_ field.
12325         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12326         (Symbol_value::value): Assert ordinary section.
12327         (Symbol_value::initialize_input_to_output_map): Likewise.
12328         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12329         Change all callers.
12330         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12331         all callers.
12332         (class Sized_relobj): Update declarations.
12333         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12334         parameter.  Change all callers.
12335         (Sized_relobj::adjust_shndx): New function.
12336         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12337         field.
12338         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12339         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12340         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12341         (Sized_dynobj::read_dynsym_section): Adjust section links.
12342         (Sized_dynobj::read_dynamic): Likewise.
12343         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12344         section links.
12345         (Sized_dynobj::do_initialize_xindex): New function.
12346         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12347         do_initialize_xindex.
12348         (Sized_dynobj::adjust_shndx): New function.
12349         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12350         dynsym_xindex_ fields.
12351         (Layout::finalize): Add a call to set_section_indexes before
12352         creating the symtab sections.
12353         (Layout::set_section_indexes): Don't do anything if the section
12354         already has a section index.
12355         (Layout::create_symtab_sections): Add shnum parameter.  Change
12356         caller.  Create .symtab_shndx section if needed.
12357         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12358         caller.
12359         (Layout::allocated_output_section_count): New function.
12360         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12361         needed.
12362         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12363         fields.  Update declarations.
12364         (Layout::symtab_xindex): New function.
12365         (Layout::dynsym_xindex): New function.
12366         (class Write_symbols_task): Add layout_ field.
12367         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12368         Change caller.
12369         * output.cc (Output_section_headers::Output_section_headers): Add
12370         shstrtab_section parameter.  Change all callers.
12371         (Output_section_headers::do_sized_write): Store overflow values
12372         for section count and section string table section index in
12373         section header zero.
12374         (Output_file_header::do_sized_write): Check for overflow of
12375         section count and section string table section index.
12376         (Output_symtab_xindex::do_write): New function.
12377         (Output_symtab_xindex::endian_do_write): New function.
12378         * output.h (class Output_section_headers): Add shstrtab_section_.
12379         Update declarations.
12380         (class Output_symtab_xindex): Define.
12381         (Output_section::has_out_shndx): New function.
12382         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12383         field.
12384         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12385         Change all callers.
12386         (Sized_symbol::init): Likewise.
12387         (Symbol::output_section): Check for ordinary symbol.
12388         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12389         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12390         callers.
12391         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12392         Change all callers.  Simplify handling of symbols from sections
12393         not included in the link.
12394         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12395         distinction.
12396         (Weak_alias_sorter::operator()): Assert that symbols are
12397         ordinary.
12398         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12399         distinction.
12400         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12401         parameters.  Change all callers.
12402         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12403         symbol distinction.  Use SHN_XINDEX when needed.
12404         (Symbol_table::write_section_symbol): Add symtab_xindex
12405         parameter.  Change all callers.
12406         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12407         SHN_XINDEX when needed.
12408         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12409         declarations.
12410         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12411         (Symbol::is_defined): Check is_ordinary.
12412         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12413         (Symbol::is_absolute, Symbol::is_common): Likewise.
12414         (class Sized_symbol): Update declarations.
12415         (class Symbol_table): Update declarations.
12416         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12417         parameters.  Change all callers.
12418         (Sized_symbol::override): Likewise.
12419         (Symbol_table::override): Likewise.
12420         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12421         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12422         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12423         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12424         to be in an ordinary section.
12425         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12426         object and is_ordinary parameters.  Change all callers.
12427         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12428         Change all callers.  Don't add undefined or non-ordinary symbols
12429         to reloc_map_.
12430         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12431         Change all callers.
12432         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12433         declarations.
12434         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12435         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12436         (Sized_relobj::relocate_sections): Likewise.
12437         * target-reloc.h (scan_relocs): Adjust section symbol index.
12438         (scan_relocatable_relocs): Likewise.
12439         * i386.cc (Scan::local): Check for ordinary symbols.
12440         * sparc.cc (Scan::local): Likewise.
12441         * x86_64.cc (Scan::local): Likewise.
12442         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12443         to symbol_section_and_value.
12444         * testsuite/many_sections_test.cc: New file.
12445         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12446         (check_PROGRAMS): Add many_sections_test.
12447         (many_sections_test_SOURCES): Define.
12448         (many_sections_test_DEPENDENCIES): Define.
12449         (many_sections_test_LDFLAGS): Define.
12450         (BUILT_SOURCES): Add many_sections_define.h.
12451         (many_sections_define.h): New target.
12452         (BUILT_SOURCES): Add many_sections_check.h.
12453         (many_sections_check.h): New target.
12454         (check_PROGRAMS): Add many_sections_r_test.
12455         (many_sections_r_test_SOURCES): Define.
12456         (many_sections_r_test_DEPENDENCIES): Define.
12457         (many_sections_r_test_LDFLAGS): Define.
12458         (many_sections_r_test_LDADD): Define.
12459         (many_sections_r_test.o): New target.
12460         * testsuite/Makefile.in: Rebuild.
12461
12462 2008-04-17  Cary Coutant  <ccoutant@google.com>
12463
12464         * errors.cc (Errors::info): New function.
12465         (gold_info): New function.
12466         * errors.h (Errors::info): New function.
12467         * gold.h (gold_info): New function.
12468         * object.cc (Input_objects::add_object): Print trace output.
12469         * options.cc (options::parse_set): New function.
12470         (General_options::parse_wrap): Deleted.
12471         (General_options::General_options): Deleted initializer.
12472         * options.h (options::String_set): New typedef.
12473         (options::parse_set): New function.
12474         (DEFINE_set): New macro.
12475         (General_options::wrap): Changed to use DEFINE_set. Changed
12476         callers of any_wrap_symbols and is_wrap_symbol.
12477         (General_options::trace, General_options::trace_symbol):
12478         New options.
12479         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12480         (General_options::wrap_symbols_): Deleted.
12481         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12482
12483 2008-04-17  David S. Miller  <davem@davemloft.net>
12484
12485         * options.cc (General_options::parse_V): New function.
12486         * options.h: Add entries for -V and -Qy.
12487
12488 2008-04-17  Ian Lance Taylor  <iant@google.com>
12489
12490         * common.cc (Symbol_table::allocate_commons): Remove options
12491         parameter.  Change caller.
12492         (Symbol_table::do_allocate_commons): Remove options parameter.
12493         Change caller.  Just call do_allocate_commons_list twice.
12494         (Symbol_table::do_allocate_commons_list): New function, broken out
12495         of do_allocate_commons.
12496         * common.h (class Allocate_commons_task): Remove options_ field.
12497         Update constructor.
12498         * symtab.cc (Symbol_table::Symbol_table): Initialize
12499         tls_commons_.
12500         (Symbol_table::add_from_object): Put TLS common symbols on
12501         tls_commons_ list.
12502         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12503         which are IN_OUTPUT_DATA.
12504         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12505         allocate_commons and do_allocate_commons declarations.  Declare
12506         do_allocate_commons_list.
12507         * gold.cc (queue_middle_tasks): Update creation of
12508         Allocate_commons_task to not pass options.
12509         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12510         (TLS_TEST_C_FLAGS): New variable.
12511         (tls_test_c_pic.o): New target.
12512         (tls_test_shared.so): Link in tls_test_c_pic.o.
12513         (tls_test_c_pic_ie.o): New target.
12514         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12515         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12516         (tls_test_c.o): New target.
12517         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12518         (tls_pic_test_LDADD): Likewise.
12519         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12520         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12521         (tls_test_c_gnu2.o): New target.
12522         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12523         tls_test_c_gnu2.o.
12524         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12525         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12526         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12527         * testsuite/tls_test.cc: Include "config.h".
12528         (t_last): Call t11_last.
12529         * testsuite/tls_test.h (t11, t11_last): Declare.
12530         * testsuite/tls_test_c.c: New file.
12531         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12532         * configure.ac: Check for OpenMP support.
12533         * configure, config.in, Makefile.in: Rebuild.
12534         * testsuite/Makefile.in: Rebuild.
12535
12536 2008-04-16  Cary Coutant  <ccoutant@google.com>
12537
12538         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12539         (Target_i386::tls_base_symbol_defined_): New field.
12540         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12541         (Target_i386::Scan::global): Likewise.
12542         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12543         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12544         (Target_x86_64::tls_base_symbol_defined_): New field.
12545         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12546         (Target_x86_64::Scan::global): Likewise.
12547
12548 2008-04-16  Cary Coutant  <ccoutant@google.com>
12549
12550         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12551         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12552         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12553         building shared libraries.
12554         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12555         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12556         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12557         * testsuite/Makefile.in: Rebuild.
12558         * testsuite/weak_undef.h: New file.
12559         * testsuite/weak_undef_file1.cc: Add extra test cases.
12560         * testsuite/weak_undef_file2.cc: Likewise.
12561         * testsuite/weak_undef_test.cc: Likewise.
12562
12563 2008-04-16  David S. Miller  <davem@davemloft.net>
12564
12565         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12566         Add issued_non_pic_error_ field.  Declare check_non_pic.
12567         (Target_sparc::Scan::check_non_pic): New function.
12568         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12569         (Target_sparc::Scan::global): Likewise.
12570
12571         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12572         * configure: Rebuild.
12573
12574         * options.h (DEFINE_enable): New macro.
12575         (new_dtags): New enable option.
12576         (initfirst, interpose, loadfltr, nodefaultlib,
12577         nodelete, nodlopen, nodump): New -z options.
12578         * layout.cc (Layout:finish_dynamic_section): If new
12579         dtags enabled, emit DT_RUNPATH.  Also, emit a
12580         DT_FLAGS_1 containing any specified -z flags.
12581
12582 2008-04-16  Ian Lance Taylor  <iant@google.com>
12583
12584         * copy-relocs.cc: New file.
12585         * copy-relocs.h: New file.
12586         * reloc.cc: Remove Copy_relocs code.
12587         * reloc.h: Likewise.
12588         * reloc-types.h (struct Reloc_types) [both versions]: Add
12589         get_reloc_addend_noerror.
12590         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12591         variants of add_global which take an addend which must be zero.
12592         * i386.cc: Include "copy-relocs.h".
12593         (class Target_i386): Change type of copy_relocs_ to variable,
12594         update initializer.
12595         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12596         Change all callers.
12597         (Target_i386::do_finalize_sections): Change handling of
12598         copy_relocs_.
12599         * sparc.cc: Include "copy-relocs.h".
12600         (class Target_sparc): Change type of copy_relocs_ to variable,
12601         update initializer.
12602         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12603         Change all callers.
12604         (Target_sparc::do_finalize_sections): Change handling of
12605         copy_relocs_.
12606         * x86_64.cc: Include "copy-relocs.h".
12607         (class Target_x86_64): Change type of copy_relocs_ to variable,
12608         update initializer.
12609         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12610         class.  Change all callers.
12611         (Target_x86_64::do_finalize_sections): Change handling of
12612         copy_relocs_.
12613         * Makefile.am (CCFILES): Add copy-relocs.cc.
12614         (HFILES): Add copy-relocs.h.
12615
12616         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12617
12618         * testsuite/script_test_4.sh: Permit leading zeroes.
12619
12620 2008-04-15  Ian Lance Taylor  <iant@google.com>
12621
12622         * script-sections.cc (Script_sections::create_segments): Use
12623         header_size_adjustment even when there is enough room for the
12624         headers.
12625         * testsuite/script_test_4.sh: New file.
12626         * testsuite/script_test_4.t: New file.
12627         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12628         (check_DATA): Add script_test_4.stdout.
12629         (MOSTLYCLEANFILES): Likewise.
12630         (script_test_4): New target.
12631         (script_test_4.stdout): New target.
12632         * testsuite/Makefile.in: Rebuild.
12633
12634         * sparc.cc: Add definitions for Output_data_plt_sparc class
12635         constants.
12636
12637 2008-04-14  David S. Miller  <davem@davemloft.net>
12638
12639         * sparc.cc: New file.
12640         * Makefile.am (TARGETSOURCES): Add sparc.cc
12641         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12642         * configure.tgt: Document targ_extra_size and
12643         targ_extra_big_endian.  Add entries for sparc-* and
12644         sparc64-*.
12645         * configure.ac: Handle targ_extra_size and
12646         targ_extra_big_endian.
12647         * Makefile.in: Rebuild.
12648         * configure: Likewise.
12649         * po/POTFILES.in: Likewise.
12650         * po/gold.pot: Likewise.
12651
12652 2008-04-14  Ian Lance Taylor  <iant@google.com>
12653
12654         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12655         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12656         in the name/type/flags to section mapping.  Don't call
12657         allocate_output_section.
12658         (Layout::choose_output_section): Change parameter from adjust_name
12659         to is_input_section.  Don't permit input sections after sections
12660         are attached to segments.  Don't call allocate_output_section.
12661         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12662         not write_enable_output_section.
12663         (Layout::make_output_section): Don't push to
12664         unattached_section_list_ nor call attach_to_segment.  Call
12665         attach_section_to_segment if sections are attached.
12666         (Layout::attach_sections_to_segments): New function.
12667         (Layout::attach_section_to_segment): New function.
12668         (Layout::attach_allocated_section_to_segment): Rename from
12669         attach_to_segment.  Remove flags parameter.
12670         (Layout::allocate_output_section): Remove function.
12671         (Layout::write_enable_output_section): Remove function.
12672         * layout.h (class Layout): Update for above changes.  Add new
12673         field sections_are_attached_.
12674         * output.h (Output_section::update_flags_for_input_section): New
12675         function.
12676         * output.cc (Output_section::add_input_section): Call
12677         update_flags_for_input_section.
12678         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12679
12680 2008-04-11  Cary Coutant  <ccoutant@google.com>
12681
12682         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12683         thought unnecessary.
12684         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12685
12686 2008-04-11  Ian Lance Taylor  <iant@google.com>
12687
12688         * output.h (class Output_section_data): Remove inline definition
12689         of set_addralign.
12690         * output.cc (Output_section_data::set_addralign): New function.
12691
12692 2008-04-11  Cary Coutant  <ccoutant@google.com>
12693
12694         Add support for TLS descriptors for i386 and x86_64.
12695         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12696         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12697         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12698         GOT_TYPE_TLS_DESC.
12699         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12700         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12701         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12702         relocations.
12703         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12704         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12705         Fix problem with initial-exec relocations.
12706         (Target_i386::Relocate::relocate_tls): Likewise.
12707         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12708         relaxation.
12709         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12710         support for section-plus-offset dynamic table entries.
12711         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12712         (Output_data_dynamic::Dynamic_entry): Add support for
12713         section-plus-offset dynamic table entries.
12714         (Output_data_dynamic::Classification): Likewise.
12715         (Output_data_dynamic::classification_): Renamed offset_.
12716         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12717         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12718         (Target_x86_64::make_plt_section): New function.
12719         (Target_x86_64::reserve_tlsdesc_entries): New function.
12720         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12721         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12722         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12723         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12724         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12725         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12726         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12727         add extra PLT entry for TLS descriptors.
12728         (Output_data_plt_x86_64::got_): New field.
12729         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12730         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12731         fields.
12732         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12733         descriptors.
12734         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12735         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12736         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12737         R_386_TLS_DESC_CALL relocations.
12738         (Target_x86_64::Scan::global): Likewise.
12739         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12740         for TLS descriptors.
12741         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12742         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12743         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12744         GD-to-IE relaxation.
12745         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12746         and TLS_DESCRIPTORS.
12747         * Makefile.in: Rebuild.
12748         * configure: Rebuild.
12749         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12750         (tls_test_shared2.so): New target.
12751         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12752         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12753         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12754         (tls_shared_gd_to_ie_test_LDADD): New variable.
12755         (tls_shared_gnu2_gd_to_ie_test): New target.
12756         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12757         New targets.
12758         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12759         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12760         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12761         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12762         (tls_shared_gnu2_test): New target.
12763         (tls_test_gnu2_shared.so): New target.
12764         (tls_shared_gnu2_test_SOURCES): New variable.
12765         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12766         (tls_shared_gnu2_test_LDFLAGS): New variable.
12767         (tls_shared_gnu2_test_LDADD): New variable.
12768         * testsuite/Makefile.in: Rebuild.
12769         * testsuite/Makefile.
12770
12771 2008-04-11  Ian Lance Taylor  <iant@google.com>
12772
12773         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12774         justsyms.t.
12775         * testsuite/Makefile.in: Rebuild.
12776
12777         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12778         long.
12779         * testsuite/script_test_2.cc (main): Adjust test.
12780
12781 2008-04-11  David S. Miller  <davem@davemloft.net>
12782             Ian Lance Taylor  <iant@google.com>
12783
12784         * options.h (General_options): Add entries for '-Y' and
12785         '-relax'.
12786         * options.cc (General_options:finalize): If -Y was used, add those
12787         entries to the library path instead of the default "/lib" and
12788         "/usr/lib".
12789
12790 2008-04-11  David S. Miller  <davem@davemloft.net>
12791
12792         * testsuite/justsyms.t: Start at 0x100.
12793         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12794         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12795         long.
12796         * testsuite/script_test_2.cc: Adjust string and section length
12797         checks.
12798
12799 2008-04-09  Ian Lance Taylor  <iant@google.com>
12800
12801         PR gold/5996
12802         * script-sections.cc (Sections_element::allocate_to_segment): Add
12803         orphan parameter.
12804         (Output_section_definition::allocate_to_segment): Likewise.
12805         (Orphan_output_section::allocate_to_segment): Likewise.
12806         (Script_sections::attach_sections_using_phdrs_clause): Don't
12807         propagate non-PT_LOAD segments to orphan sections.
12808         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12809         readelf rather than objdump.
12810         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12811         .interp section and PT_INTERP segment are the same size.
12812         * testsuite/Makefile.in: Rebuild.
12813
12814         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12815         aliases for symbols defined in the same object.
12816         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12817         (weak_alias_test_SOURCES): New variable.
12818         (weak_alias_test_DEPENDENCIES): New variable.
12819         (weak_alias_test_LDFLAGS): New variable.
12820         (weak_alias_test_LDADD): New variable.
12821         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12822         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12823         (weak_alias_test_3.o): New target.
12824         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12825         * testsuite/weak_alias_test_main.cc: New file.
12826         * testsuite/weak_alias_test_1.cc: New file.
12827         * testsuite/weak_alias_test_2.cc: New file.
12828         * testsuite/weak_alias_test_3.cc: New file.
12829
12830 2008-04-08  Ian Lance Taylor  <iant@google.com>
12831
12832         * options.h (class General_options): Add --noinhibit-exec option.
12833         * main.cc (main): Check --noinhibit-exec.
12834
12835         * options.h (class General_options): Define --wrap as a special
12836         option.  Add wrap_symbols_ field.
12837         (General_options::any_wrap_symbols): New function.
12838         (General_options::is_wrap_symbol): New function.
12839         * options.cc (General_options::parse_wrap): New function.
12840         (General_options::General_options): Initialize wrap_symbols_.
12841         * symtab.cc (Symbol_table::wrap_symbol): New function.
12842         (Symbol_table::add_from_object): Handle --wrap.
12843         * symtab.h (class Symbol_table): Declare wrap_symbol.
12844         * target.h (Target::wrap_char): New function.
12845         (Target::Target_info): Add wrap_char field.
12846         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12847         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12848         * testsuite/testfile.cc (Target_test::test_target_info):
12849         Likewise.
12850
12851         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12852         there is one.
12853
12854         * layout.h (class Layout): Add added_eh_frame_data_ field.
12855         * layout.cc (Layout::Layout): Initialize new field.
12856         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12857         output section until we find a section we merged successfully.
12858         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12859         that the size be non-zero.
12860
12861         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12862         qualifier.
12863
12864 2008-04-08  Craig Silverstein  <csilvers@google.com>
12865
12866         * configure.ac: Export new conditional variable HAVE_ZLIB.
12867         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12868         on HAVE_ZLIB.
12869         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12870         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12871
12872 2008-04-07  Ian Lance Taylor  <iant@google.com>
12873
12874         * version.cc (version_string): Set to "1.5".
12875
12876         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12877         Add issued_non_pic_error_ field.  Declare check_non_pic.
12878         (Target_x86_64::Scan::check_non_pic): New function.
12879         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12880         (Target_x86_64::Scan::global): Likewise.
12881
12882         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12883         addend parameter.  Change caller.  Handle merge sections.
12884         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12885         Address to Addend.  Don't add in the result of
12886         local_section_offset, pass down the addend and use the returned
12887         value.
12888         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12889         Update declarations of local_section_offset and symbol_value.
12890         * testsuite/two_file_test_1.cc (t18): New function.
12891         * testsuite/two_file_test_2.cc (f18): New function.
12892         * testsuite/two_file_test_main.cc (main): Call t18.
12893         * testsuite/two_file_test.h (t18, f18): Declare.
12894
12895         * configure.ac: Don't test for objdump, c++filt, or readelf.
12896         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12897         conditionals.
12898         (TEST_READELF): New variable.
12899         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12900         (check_PROGRAMS): Add two_file_strip_test.
12901         (two_file_strip_test): New target.
12902         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12903         (two_file_same_shared_strip_test_SOURCES): New variable.
12904         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12905         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12906         (two_file_same_shared_strip_test_LDADD): New variable.
12907         (two_file_shared_strip.so): New target.
12908         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12909         (ver_test_5.syms, ver_test_7.syms): Likewise.
12910         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12911         (strip_test_3.stdout): Use TEST_OBJDUMP.
12912         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12913
12914 2008-04-04  Cary Coutant  <ccoutant@google.com>
12915
12916         * symtab.h (Symbol::is_weak_undefined): New function.
12917         (Symbol::is_strong_undefined): New function.
12918         (Symbol::is_absolute): New function.
12919         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12920         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12921         absolute symbols.
12922         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12923         (weak_undef_test): New target.
12924         * testsuite/Makefile.in: Rebuild.
12925         * testsuite/weak_undef_file1.cc: New file.
12926         * testsuite/weak_undef_file2.cc: New file.
12927         * testsuite/weak_undef_test.cc: New file.
12928
12929 2008-04-03  Craig Silverstein  <csilvers@google.com>
12930
12931         * compressed_output.h (class Output_compressed_section): Use
12932         unsigned buffer.
12933         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12934         add zlib header.
12935         (zlib_compressed_suffix): Removed.
12936         (Output_compressed_section::set_final_data_size): Use unsigned
12937         buffers.
12938         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12939         Fix linker invocation.
12940         (flagstest_o_specialfile_and_compress_debug_sections):
12941         Likewise.
12942         * testsuite/Makefile.in: Regenerated.
12943
12944 2008-04-02  David S. Miller  <davem@davemloft.net>
12945
12946         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12947         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12948
12949 2008-04-02  Craig Silverstein  <csilvers@google.com>
12950
12951         * TODO: New file.
12952
12953 2008-04-02  Ian Lance Taylor  <iant@google.com>
12954
12955         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12956         parameters.  Update for new key type to views_.  Change all
12957         callers.
12958         (File_read::read): Adjust for byteshift in returned view.
12959         (File_read::add_view): New function, broken out of
12960         find_and_make_view.
12961         (File_read::make_view): New function, broken out of
12962         find_and_make_view.
12963         (File_read::find_or_make_view): Add offset and aligned
12964         parameters.  Rewrite accordingly.  Change all callers.
12965         (File_read::get_view): Add offset and aligned parameters.  Adjust
12966         for byteshift in return value.
12967         (File_read::get_lasting_view): Likewise.
12968         * fileread.h (class File_read): Update declarations.
12969         (class File_read::View): Add byteshift_ field.  Add byteshift to
12970         constructor.  Add byteshift method.
12971         * archive.h (Archive::clear_uncached_views): New function.
12972         (Archive::get_view): Add aligned parameter.  Change all callers.
12973         * object.h (Object::get_view): Add aligned parameter.  Change all
12974         callers.
12975         (Object::get_lasting_view): Likewise.
12976
12977         * fileread.cc (File_read::release): Don't call clear_views if
12978         there are multiple objects.
12979         * fileread.h (File_read::clear_uncached_views): New function.
12980         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12981         on the archive.
12982
12983 2008-03-31  Cary Coutant  <ccoutant@google.com>
12984
12985         Add thin archive support.
12986         * archive.cc (Archive::armagt): New const.
12987         (Archive::setup): Remove task parameter and calls to unlock.
12988         (Archive::unlock_nested_archives): New function.
12989         (Archive::read_header): Add nested_off parameter. Change
12990         all callers.
12991         (Archive::interpret_header): Likewise.
12992         (Archive::include_all_members): Change to handle thin
12993         archives.
12994         (Archive::include_member): Likewise.
12995         * archive.h (Archive::Archive): Add new parameters and
12996         initializers.
12997         (Archive::armagt): New const.
12998         (Archive::setup): Remove task parameter.
12999         (Archive::unlock_nested_archives): New function.
13000         (Archive::read_header): Add nested_off parameter.
13001         (Archive::interpret_header): Likewise.
13002         (Archive::Nested_archive_table): New typedef.
13003         (Archive::is_thin_archive_): New field.
13004         (Archive::nested_archives_): New field.
13005         (Archive::options_): New field.
13006         (Archive::dirpath_): New field.
13007         (Archive::task_): New field.
13008         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13009         for thin archives.  Pass additional parameters to
13010         Archive::Archive.  Unlock the archive file after calling
13011         Archive::setup.
13012
13013 2008-03-29  Ian Lance Taylor  <iant@google.com>
13014
13015         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13016         version symbol to be local.
13017         * testsuite/ver_test_4.sh: New file.
13018         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13019         (check_DATA): Add ver_test_4.syms.
13020         (ver_test_4.syms): New target.
13021         * testsuite/Makefile.in: Rebuild.
13022
13023         * output.cc
13024         (Output_section::Input_section_sort_entry::has_priority): New
13025         function.
13026         (Output_section::Input_section_sort_entry::match_file_name): New
13027         function.
13028         (Output_section::Input_section_sort_entry::match_section_name):
13029         Remove.
13030         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13031         Remove.
13032         (Output_section::Input_section_sort_entry::match_section_file):
13033         Remove.
13034         (Output_section::Input_section_sort_compare::operator()): Rewrite
13035         using new Input_section_sort_entry functions.  Sort crtbegin and
13036         crtend first.  Sort sections with no priority before sections with
13037         a priority.
13038         * testsuite/initpri1.c (d3): Check j != 4.
13039         (cd5): New constructor/destructor function.
13040         (main): Check j != 2.
13041
13042         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13043         new symbol when resolving, don't call set_is_default.
13044         * testsuite/ver_test_7.cc: New file.
13045         * testsuite/ver_test_7.sh: New file.
13046         * testsuite/Makefile.am (ver_test_7.so): New target.
13047         (ver_test_7.o): New target.
13048         (check_SCRIPTS): Add ver_test_7.sh.
13049         (check_DATA): Add ver_test_7.syms.
13050         (ver_test_7.syms): New target.
13051
13052 2008-03-28  Ian Lance Taylor  <iant@google.com>
13053
13054         * layout.cc (Layout::layout): If we see an input section with a
13055         name that needs sorting, set the must_sort flag for the output
13056         section.
13057         (Layout::make_output_section): If the name of the output section
13058         indicates that it might require sorting, set the may_sort flag.
13059         * output.h (Output_section::may_sort_attached_input_sections): New
13060         function.
13061         (Output_section::set_may_sort_attached_input_sections): New
13062         function.
13063         (Output_section::must_sort_attached_input_sections): New
13064         function.
13065         (Output_section::set_must_sort_attached_input_sections): New
13066         function.
13067         (class Output_section): Declare Input_section_sort_entry.  Define
13068         Input_section_sort_compare.  Declare
13069         sort_attached_input_sections.  Add new fields:
13070         may_sort_attached_input_sections_,
13071         must_sort_attached_input_sections_,
13072         attached_input_sections_are_sorted_.
13073         * output.cc (Output_section::Output_section): Initialize new
13074         fields.
13075         (Output_section::add_input_section): Add an entry to
13076         input_sections_ if may_sort or must_sort are true.
13077         (Output_section::set_final_data_size): Call
13078         sort_attached_input_sections if necessary.
13079         (Output_section::Input_section_sort_entry): Define new class.
13080         (Output_section::Input_section_sort_compare::operator()): New
13081         function.
13082         (Output_section::sort_attached_input_sections): New function.
13083         * configure.ac: Check whether the compiler supports constructor
13084         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13085         * testsuite/initpri1.c: New file.
13086         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13087         CONSTRUCTOR_PRIORITY.
13088         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13089         (initpri1_LDFLAGS): New variable.
13090         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13091
13092 2008-03-27  Ian Lance Taylor  <iant@google.com>
13093
13094         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13095         * testsuite/common_test_1.c: New file.
13096         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13097         (common_test_1_SOURCES): New variable.
13098         (common_test_1_DEPENDENCIES): New variable.
13099         (common_test_1_LDFLAGS): New variable.
13100
13101         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13102         and commons_ correctly when NAME/VERSION does not override
13103         NAME/NULL.
13104         * testsuite/ver_test_6.c: New file.
13105         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13106         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13107         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13108
13109 2008-03-26  Ian Lance Taylor  <iant@google.com>
13110
13111         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13112         of an undefined symbol from a version script.
13113         * testsuite/Makefile.am (ver_test_5.so): New target.
13114         (ver_test_5.o): New target.
13115         (check_SCRIPTS): Add ver_test_5.sh.
13116         (check_DATA): Add ver_test_5.syms.
13117         (ver_test_5.syms): New target.
13118         * testsuite/ver_test_5.cc: New file.
13119         * testsuite/ver_test_5.script: New file.
13120         * testsuite/ver_test_5.sh: New file.
13121         * Makefile.in, testsuite/Makefile.in: Rebuild.
13122
13123         PR gold/5986
13124         Fix problems building gold with gcc 4.3.0.
13125         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13126         (gold_error_at_location, gold_warning_at_location): Use it.
13127         * configure.ac: Check whether we can compile and use a template
13128         function with a printf attribute.
13129         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13130         when jumping over bytes.
13131         * object.cc: Instantiate Object::read_section_data.
13132         * debug.h: Include <cstring>
13133         * dwarf_reader.cc: Include <algorithm>
13134         * main.cc: Include <cstring>.
13135         * options.cc: Include <cstring>.
13136         * output.cc: Include <cstring>.
13137         * script.cc: Include <cstring>.
13138         * script.h: Include <string>.
13139         * symtab.cc: Include <cstring> and <algorithm>.
13140         * target-select.cc: Include <cstring>.
13141         * version.cc: Include <string>.
13142         * testsuite/testmain.cc: Include <cstdlib>.
13143         * configure, config.in: Rebuild.
13144
13145 2008-03-25  Ian Lance Taylor  <iant@google.com>
13146
13147         * options.cc: Include "../bfd/bfdver.h".
13148         (options::help): Print bug reporting address.
13149
13150         * version.cc (print_version): Adjust output for current value of
13151         BFD_VERSION_STRING.
13152
13153         * NEWS: New file.
13154
13155         * options.cc (options::help): Print list of supported targets.
13156         * target-select.h: Include <vector>.
13157         (class Target_selector): Make machine_, size_, and is_big_endian_
13158         fields const.  Add bfd_name_ and instantiated_target_ fields.
13159         (Target_selector::Target_selector): Add bfd_name parameter.
13160         (Target_selector::recognize): Make non-virtual, call
13161         do_recognize.
13162         (Target_selector::recognize_by_name): Make non-virtual, call
13163         do_recognize_by_name.
13164         (Target_selector::supported_names): New function.
13165         (Target_selector::bfd_name): New function.
13166         (Target_selector::do_instantiate_target): New pure virtual
13167         function.
13168         (Target_selector::do_recognize): New virtual function.
13169         (Target_selector::do_recognize_by_name): New virtual function.
13170         (Target_selector::instantiate_target): New private function.
13171         (supported_target_names): Declare.
13172         * target-select.cc (Target_selector::Target_selector): Update for
13173         new parameter and fields.
13174         (select_target_by_name): Check that the name matches before
13175         calling recognize_by_name.
13176         (supported_target_names): New function.
13177         * i386.cc (class Target_selector_i386): Update Target_selector
13178         constructor call.  Remove recognize and recognize_by_name.  Add
13179         do_instantiate_target.
13180         * x86_64.cc (class Target_selector_x86_64): Likewise.
13181         * testsuite/testfile.cc (class Target_selector_test): Update for
13182         changes to Target_selector.
13183
13184         * README: Rewrite, with some notes on unsupported features.
13185
13186 2008-03-24  Cary Coutant  <ccoutant@google.com>
13187
13188         * i386.cc (Target_i386::Got_type): New enum declaration.
13189         (Target_i386::Scan::local): Updated callers of Output_data_got
13190         member functions.
13191         (Target_i386::Scan::global): Likewise.
13192         (Target_i386::Relocate::relocate): Likewise.
13193         (Target_i386::Relocate::relocate_tls): Likewise.
13194         * object.h (Got_offset_list): New class.
13195         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13196         (Sized_relobj::local_got_offset): Likewise.
13197         (Sized_relobj::set_local_got_offset): Likewise.
13198         (Sized_relobj::local_has_tls_got_offset): Removed.
13199         (Sized_relobj::local_tls_got_offset): Removed.
13200         (Sized_relobj::set_local_tls_got_offset): Removed.
13201         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13202         * output.cc (Output_data_got::add_global): Added got_type parameter.
13203         (Output_data_got::add_global_with_rel): Likewise.
13204         (Output_data_got::add_global_with_rela): Likewise.
13205         (Output_data_got::add_global_pair_with_rel): New function.
13206         (Output_data_got::add_global_pair_with_rela): New function.
13207         (Output_data_got::add_local): Added got_type parameter.
13208         (Output_data_got::add_local_with_rel): Likewise.
13209         (Output_data_got::add_local_with_rela): Likewise.
13210         (Output_data_got::add_local_pair_with_rel): New function.
13211         (Output_data_got::add_local_pair_with_rela): New function.
13212         (Output_data_got::add_global_tls): Removed.
13213         (Output_data_got::add_global_tls_with_rel): Removed.
13214         (Output_data_got::add_global_tls_with_rela): Removed.
13215         (Output_data_got::add_local_tls): Removed.
13216         (Output_data_got::add_local_tls_with_rel): Removed.
13217         (Output_data_got::add_local_tls_with_rela): Removed.
13218         * output.h (Output_data_got::add_global): Added got_type parameter.
13219         (Output_data_got::add_global_with_rel): Likewise.
13220         (Output_data_got::add_global_with_rela): Likewise.
13221         (Output_data_got::add_global_pair_with_rel): New function.
13222         (Output_data_got::add_global_pair_with_rela): New function.
13223         (Output_data_got::add_local): Added got_type parameter.
13224         (Output_data_got::add_local_with_rel): Likewise.
13225         (Output_data_got::add_local_with_rela): Likewise.
13226         (Output_data_got::add_local_pair_with_rel): New function.
13227         (Output_data_got::add_local_pair_with_rela): New function.
13228         (Output_data_got::add_global_tls): Removed.
13229         (Output_data_got::add_global_tls_with_rel): Removed.
13230         (Output_data_got::add_global_tls_with_rela): Removed.
13231         (Output_data_got::add_local_tls): Removed.
13232         (Output_data_got::add_local_tls_with_rel): Removed.
13233         (Output_data_got::add_local_tls_with_rela): Removed.
13234         * resolve.cc (Symbol::override_base_with_special): Removed
13235         reference to has_got_offset_ field.
13236         * symtab.cc (Symbol::init_fields): Replaced initialization
13237         of got_offset_ with got_offsets_.  Removed initialization
13238         of has_got_offset_
13239         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13240         (Symbol::got_offset): Likewise.
13241         (Symbol::set_got_offset): Likewise.
13242         (Symbol::has_tls_got_offset): Removed.
13243         (Symbol::tls_got_offset): Removed.
13244         (Symbol::set_tls_got_offset): Removed.
13245         (Symbol::got_offset_): Removed.
13246         (Symbol::tls_mod_got_offset_): Removed.
13247         (Symbol::tls_pair_got_offset_): Removed.
13248         (Symbol::got_offsets_): New field.
13249         (Symbol::has_got_offset): Removed.
13250         (Symbol::has_tls_mod_got_offset): Removed.
13251         (Symbol::has_tls_pair_got_offset): Removed.
13252         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13253         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13254         member functions.
13255         (Target_x86_64::Scan::global): Likewise.
13256         (Target_x86_64::Relocate::relocate): Likewise.
13257         (Target_x86_64::Relocate::relocate_tls): Likewise.
13258
13259 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13260
13261         * yyscript.y: Fix spelling error in comment.
13262
13263 2008-03-24  Ian Lance Taylor  <iant@google.com>
13264
13265         * options.h (class General_options): Define build_id option.
13266         * layout.h (class Layout): Declare write_build_id, create_note,
13267         create_build_id.  Add build_id_note_ member.
13268         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13269         "libiberty.h", "md5.h", "sha1.h".
13270         (Layout::Layout): Initialize eh_frame_data_,
13271         eh_frame_hdr_section_, and build_id_note_.
13272         (Layout::finalize): Call create_build_id.
13273         (Layout::create_note): New function, broken out of
13274         Layout::create_gold_note.
13275         (Layout::create_gold_note): Call create_note.
13276         (Layout::create_build_id): New function.
13277         (Layout::write_build_id): New function.
13278         (Close_task_runner::run): Call write_build_id.
13279
13280         * x86_64.cc: Correct license to GPLv3.
13281
13282 2008-03-23  Ian Lance Taylor  <iant@google.com>
13283
13284         * options.cc: Include "demangle.h".
13285         (parse_optional_string): New function.
13286         (parse_long_option): Handle takes_optional_argument.
13287         (parse_short_option): Update dash_z initializer.  Handle
13288         takes_optional_argument.
13289         (General_options::General_options): Initialize do_demangle_.
13290         (General_options::finalize): Set do_demangle_.  Handle demangling
13291         style.
13292         * options.h (parse_optional_string): Declare.
13293         (struct One_option): Add optional_arg field.  Update constructor.
13294         Update call constructor calls.  Add takes_optional_argument
13295         function.
13296         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13297         (DEFINE_optional_string): Define.
13298         (General_options::demangle): Change from DEFINE_bool to
13299         DEFINE_optional_string.
13300         (General_options::no_demangle): New function.
13301         (General_options::do_demangle): New function.
13302         (General_options::set_do_demangle): New function.
13303         (General_options::execstack_status_): Move definition to end of
13304         class definition.
13305         (General_options::static_): Likewise.
13306         (General_options::do_demangle_): New field.
13307         * object.cc (big_endian>::get_symbol_location_info): Call
13308         Options::do_demangle, not Options::demangle.
13309         * symtab.cc (demangle): Likewise.
13310
13311 2008-03-22  Ian Lance Taylor  <iant@google.com>
13312
13313         * gold.h: Include <cstddef> and <sys/types.h>
13314         * options.h: Include <cstring>.
13315
13316 2008-03-21  Ian Lance Taylor  <iant@google.com>
13317
13318         * Added source code to GNU binutils.