Updated Vietnamese translation.
[external/binutils.git] / gold / ChangeLog
1 2012-08-09  Nick Clifton  <nickc@redhat.com>
2
3         * po/vi.po: Updated Vietnamese translation.
4
5 2012-08-07  Ian Lance Taylor  <iant@google.com>
6
7         * layout.cc (Layout::add_target_dynamic_tags): If
8         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
9         plt_rel.
10
11 2012-07-30  Nick Clifton  <nickc@redhat.com>
12
13         * po/gold.pot: Updated template.
14         * po/es.po: Updated Spanish translation.
15
16 2012-07-18  Cary Coutant  <ccoutant@google.com>
17
18         PR gold/14344
19         * configure.ac: Add check for -gpubnames support.
20         * configure: Regenerate.
21         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
22         support; force -gno-pubnames.
23         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
24         support.
25         (gdb_index_test_4): New test.
26         * testsuite/Makefile.in: Regenerate.
27         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
28         * testsuite/gdb_index_test_2.sh: Likewise.
29         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
30         * testsuite/gdb_index_test_4.sh: New script.
31         * testsuite/gdb_index_test_comm.sh: New script with common code;
32         don't look for space after colon.
33
34 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
35
36         * gold.cc (queue_middle_tasks): Update function order only after
37         deferred objects due to plugins are processed.
38
39 2012-07-11  Ian Lance Taylor  <iant@google.com>
40
41         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
42         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
43         (Target_arm::scan_reloc_for_stub): Likewise.
44         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
45         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
46         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
47         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
48         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
49
50 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
51             Ian Lance Taylor  <iant@google.com>
52
53         PR gold/14309
54         * configure.ac: Test whether std::tr1::hash<off_t> works.
55         * gold.h: Add a specialization for std::tr1::hash<off_t> if
56         needed.
57         * output.h (class Output_fill): Add virtual destructor.
58         * configure, config.in: Rebuild.
59
60 2012-06-22  Roland McGrath  <mcgrathr@google.com>
61
62         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
63
64 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
65
66         * plugin.cc (Plugin::load): Handle position independent executables.
67
68 2012-06-06  Cary Coutant  <ccoutant@google.com>
69
70         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
71         add .debug_macro.
72         (lines_only_debug_sections): Likewise.
73         (gdb_fast_lookup_sections): New static array.
74         (is_gdb_debug_section): Rename formal parameter.
75         (is_lines_only_debug_section): Likewise.
76         (is_gdb_fast_lookup_section): New function.
77         (Layout::include_section): Check for ".zdebug_" prefix; pass
78         section name suffix to is_gdb_debug_section, et al.; check for
79         fast-lookup sections when building .gdb_index.
80         * options.h (--strip-debug-gdb): Update GDB version number.
81
82 2012-06-06  Cary Coutant  <ccoutant@google.com>
83
84         * configure.ac: Add check for fallocate.
85         * configure: Regenerate.
86         * config.in: Regenerate.
87
88         * options.h (class General_options): Add --mmap-output-file and
89         --posix-fallocate options.
90         * output.cc: (posix_fallocate): Remove; replace with...
91         (gold_fallocate): New function.
92         (Output_file::map_no_anonymous): Call gold_fallocate.
93         (Output_file::map): Check --mmap-output-file option.
94
95 2012-06-05  Jing Yu  <jingyu@google.com>
96
97         * gold.h (textdomain): Add do {} to empty while(0).
98         (bindtextdomain): Likewise.
99
100 2012-06-04  Cary Coutant  <ccoutant@google.com>
101
102         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
103         has_dynsym_index.
104
105 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
106
107         * symtab.cc (Symbol_table::define_special_symbol):
108         Initialize *poldsym to prevent uninitialized variable errors.
109
110 2012-05-23  Cary Coutant  <ccoutant@google.com>
111
112         * layout.cc (Layout::section_name_mapping): Add rules to handle
113         exact match on .data.rel.ro.local or .data.rel.ro.
114         (Layout::output_section_name): Check for exact matches.
115
116 2012-05-23  Cary Coutant  <ccoutant@google.com>
117
118         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
119         more carefully.
120
121 2012-05-22  Cary Coutant  <ccoutant@google.com>
122
123         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
124         object before exporting symbol.
125
126 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
127
128         * testsuite/tls_test.cc: Include "config.h" first.
129         * testsuite/tls_test_c.c: Likewise.
130
131 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
132             Nick Clifton  <nickc@redhat.com>
133
134         PR 14072
135         * configure.in: Add check that sysdep.h has been included before
136         any system header files.
137         * configure: Regenerate.
138         * config.in: Regenerate.
139
140 2012-05-14  Cary Coutant  <ccoutant@google.com>
141
142         * layout.cc (Layout::make_output_section): Mark .tdata section
143         as RELRO.
144         * testsuite/relro_test.cc: Add a TLS variable.
145
146 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
147
148         PR gold/14091
149         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
150         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
151         R_X86_64_64.
152
153 2012-05-08  Cary Coutant  <ccoutant@google.com>
154
155         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
156         (lines_only_debug_sections): Likewise.
157
158 2012-05-02  Roland McGrath  <mcgrathr@google.com>
159
160         * nacl.cc: New file.
161         * nacl.h: New file.
162         * Makefile.am (CCFILES, HFILES): Add them.
163         * Makefile.in: Regenerate.
164         * i386.cc (Output_data_plt_i386_nacl): New class.
165         (Output_data_plt_i386_nacl_exec): New class.
166         (Output_data_plt_i386_nacl_dyn): New class.
167         (Target_i386_nacl): New class.
168         (Target_selector_i386_nacl): New class.
169         (target_selector_i386): Use it instead of Target_selector_i386.
170         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
171         (Target_x86_64_nacl): New class.
172         (Target_selector_x86_64_nacl): New class.
173         (target_selector_x86_64, target_selector_x32): Use it instead of
174         Target_selector_x86_64.
175         * arm.cc (Output_data_plt_arm_nacl): New class.
176         (Target_arm_nacl): New class.
177         (Target_selector_arm_nacl): New class.
178         (target_selector_arm, target_selector_armbe): Use it instead of
179         Target_selector_arm.
180
181         * target-select.cc (select_target): Take new Input_file* and off_t
182         arguments, pass them on to recognize method of selector.
183         * object.cc (make_elf_sized_object): Update caller.
184         * parameters.cc (parameters_force_valid_target): Likewise.
185         * incremental.cc (make_sized_incremental_binary): Likewise.
186         * target-select.h: Update decl.
187         (Target_selector::recognize): Take new Input_file* argument,
188         pass it on to do_recognize.
189         (Target_selector::do_recognize): Take new Input_file* argument.
190         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
191         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
192         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
193         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
194
195         * target.h (Target::Target_info): New members isolate_execinstr
196         and rosegment_gap.
197         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
198         * arm.cc (Target_arm::arm_info): Update initializer.
199         * i386.cc (Target_i386::i386_info): Likewise.
200         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
201         * sparc.cc (Target_sparc::sparc_info): Likewise.
202         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
203         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
204         * layout.cc (Layout::attach_allocated_section_to_segment):
205         Take new const Target* argument.  If target->isolate_execinstr(), act
206         like --rosegment.
207         (Layout::find_first_load_seg): Take new const Target* argument;
208         if target->isolate_execinstr(), reject PF_X segments.
209         (Layout::relaxation_loop_body): Update caller.
210         (Layout::set_segment_offsets): If target->isolate_execinstr(),
211         reset file offset to zero when we hit LOAD_SEG, and then do a second
212         loop over the segments before LOAD_SEG to reassign offsets after
213         addresses have been determined.  Handle target->rosegment_gap().
214         (Layout::attach_section_to_segment): Take new const Target* argument;
215         pass it to attach_allocated_section_to_segment.
216         (Layout::make_output_section): Update caller.
217         (Layout::attach_sections_to_segments): Take new const Target* argument;
218         pass it to attach_section_to_segment.
219         * gold.cc (queue_middle_tasks): Update caller.
220         * layout.h (Layout): Update method decls with new arguments.
221
222         * arm.cc (Target_arm::Target_arm): Take optional argument for the
223         Target_info pointer to use.
224         (Target_arm::do_make_data_plt): New virtual method.
225         (Target_arm::make_data_plt): New method that calls it.
226         (Target_arm::make_plt_entry): Use it.
227         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
228         for the section alignment.
229         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
230         method.
231         (Output_data_plt_arm::first_plt_entry_offset): Call it.
232         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
233         method.
234         (Output_data_plt_arm::get_plt_entry_size): Call it.
235         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
236         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
237         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
238         method.
239         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
240         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
241         method instead of sizeof(plt_entry).
242         (Output_data_plt_arm::add_entry): Likewise.
243         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
244         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
245         than static method.
246         (Target_arm::plt_entry_size): Likewise.
247         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
248         Move to ...
249         (Output_data_plt_arm_standard): ... here, new class.
250         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
251         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
252         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
253
254         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
255         Take additional argument for the PLT entry size.
256         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
257         Use get_plt_entry_size method rather than plt_entry_size variable.
258         (Output_data_plt_x86_64::reserve_slot): Likewise.
259         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
260         (Output_data_plt_x86_64::add_entry): Likewise.
261         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
262         (Output_data_plt_x86_64::address_for_global): Likewise.
263         (Output_data_plt_x86_64::address_for_local): Likewise.
264         (Output_data_plt_x86_64::set_final_data_size): Likewise.
265         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
266         Make method non-static.
267         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
268         method.
269         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
270         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
271         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
272         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
273         virtual method.
274         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
275         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
276         virtual method.
277         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
278         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
279         virtual method.
280         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
281         (Output_data_plt_x86_64::plt_entry_size)
282         (Output_data_plt_x86_64::first_plt_entry)
283         (Output_data_plt_x86_64::plt_entry)
284         (Output_data_plt_x86_64::tlsdesc_plt_entry)
285         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
286         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
287         (Output_data_plt_x86_64_standard): ... here, new class.
288         (Target_x86_64::Target_x86_64): Take optional argument for the
289         Target_info pointer to use.
290         (Target_x86_64::do_make_data_plt): New virtual method.
291         (Target_x86_64::make_data_plt): New method to call it.
292         (Target_x86_64::init_got_plt_for_update): Use that.
293         Call this->plt_->add_eh_frame method here.
294         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
295         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
296         rather than static method.
297         (Target_x86_64::plt_entry_size): Likewise.
298         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
299         rather than plt_entry_size variable.  Move guts of PLT filling to...
300         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
301         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
302         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
303
304         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
305         additional argument for the section alignment.
306         Don't do add_eh_frame_for_plt here.
307         (Output_data_plt_i386::first_plt_entry_offset): Make the method
308         non-static.  Use get_plt_entry_size method rather than plt_entry_size
309         variable.
310         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
311         method.
312         (Output_data_plt_i386::get_plt_entry_size): Call it.
313         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
314         (Output_data_plt_i386::add_eh_frame): New method to call it.
315         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
316         method.
317         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
318         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
319         method.
320         (Output_data_plt_i386::fill_plt_entry): New method to call it.
321         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
322         method instead of plt_entry_size.
323         (Output_data_plt_i386::plt_entry_size)
324         (Output_data_plt_i386::plt_eh_frame_fde_size)
325         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
326         (Output_data_plt_i386_standard): ... here, new class.
327         (Output_data_plt_i386_exec): New class.
328         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
329         (Output_data_plt_i386_exec::first_plt_entry): ... here.
330         (Output_data_plt_i386::exec_plt_entry): Move to ...
331         (Output_data_plt_i386_exec::plt_entry): ... here.
332         (Output_data_plt_i386_dyn): New class.
333         (Output_data_plt_i386::first_plt_entry): Move to ...
334         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
335         (Output_data_plt_i386::dyn_plt_entry): Move to ...
336         (Output_data_plt_i386_dyn::plt_entry): ... here.
337         (Target_i386::Target_i386): Take optional argument for the Target_info
338         pointer to use.
339         (Target_i386::do_make_data_plt): New virtual method.
340         (Target_i386::make_data_plt): New method to call it.
341         (Target_i386::make_plt_section): Use that.
342         Call this->plt_->add_eh_frame method here.
343         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
344         rather than plt_entry_size variable.
345         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
346         (Output_data_plt_i386::address_for_local): Likewise.
347         (Output_data_plt_i386::do_write): Likewise.
348         Move guts of PLT filling to...
349         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
350         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
351         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
352         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
353
354 2012-05-01  Cary Coutant  <ccoutant@google.com>
355
356         * dwarf_reader.cc (Dwarf_die::read_attributes)
357         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
358         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
359         * reduced_debug_output.cc
360         (Output_reduced_debug_info_section::get_die_end): Remove
361         DW_FORM_GNU_ref_index.  Add default case.
362
363 2012-04-26  Mark Wielaard  <mjw@redhat.com>
364
365         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
366         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
367         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
368         DW_AT_high_pc as offset from DW_AT_low_pc.
369
370         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
371         * testsuite/Makefile.in: Regenerate.
372         * testsuite/gdb_index_test_3.c: New test source file.
373         * testsuite/gdb_index_test_3.sh: New test source file.
374
375 2012-04-25  Ian Lance Taylor  <iant@google.com>
376
377         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
378         pointer.
379         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
380         as a class, not a struct.
381         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
382         (Target_arm::apply_cortex_a8_workaround): Likewise.
383         * gc.h: Declare Reloc_types as a struct, not a class.
384         * object.h: Declare Symbols_data as a struct.
385         * reloc.h: Declare Read_relocs_data as a struct.
386         * target.h: Declare Relocate_info as a struct.
387
388 2012-04-24  David S. Miller  <davem@davemloft.net>
389
390         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
391         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
392         and R_SPARC_WPLT30.
393
394 2012-04-24  Cary Coutant  <ccoutant@google.com>
395
396         * incremental-dump.cc (find_input_containing_global): Replace
397         magic number with symbolic constant.
398         (dump_incremental_inputs): Update version number.
399         * incremental.cc (Output_section_incremental_inputs): Update version
400         number; import symbolic constants from Incremental_inputs_reader.
401         (Incremental_inputs::create_data_sections): Align relocations
402         section correctly for 64-bit targets.
403         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
404         constants; add padding.
405         (Output_section_incremental_inputs::write_header): Add assert for
406         header_size.
407         (Output_section_incremental_inputs::write_input_files): Add assert
408         for input_entry_size.
409         (Output_section_incremental_inputs::write_info_blocks): Add padding;
410         add assert for object_info_size, input_section_entry_size,
411         global_sym_entry_size.
412         * incremental.h (Incremental_inputs_reader): Add symbolic constants
413         for data structure sizes; use them.
414         (Incremental_input_entry_reader): Import symbolic constants from
415         Incremental_inputs_reader; use them.
416
417 2012-04-23  David S. Miller  <davem@davemloft.net>
418
419         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
420         and elf_flags_set_.
421         (Target_sparc::Target_sparc): Initialize new fields.
422         (Target_sparc::do_make_elf_object): New function.
423         (Target_sparc::do_adjust_elf_header): New function.
424
425 2012-04-23  Cary Coutant  <ccoutant@google.com>
426
427         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
428         CU range table of gdb index.
429
430 2012-04-20  David S. Miller  <davem@davemloft.net>
431
432         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
433         instead of false.
434
435 2012-04-16  David S. Miller  <davem@davemloft.net>
436
437         * sparc.cc (Target_sparc::got_address): New function.
438         (Sparc_relocate_functions::gdop_hix22): New function.
439         (Sparc_relocate_functions::gdop_lox10): New function.
440         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
441         relocs.
442         (Target_sparc::Scan::local): Likewise if the global symbol is not
443         preemptible and is not IFUNC.
444         (Target_sparc::Relocate::relocate): Perform GOTDATA code
445         transformations for local and non-preemptible non-IFUNC global
446         symbols.
447
448         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
449         writing out 64-bit part of ranges.
450
451         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
452         -fpic and -fpie respectively.
453         * Makefile.in: Regenerate.
454
455         * sparc.cc (class Target_sparc): Add rela_ifunc_.
456         (Target_sparc::Target_sparc): Initialize new field.
457         (Target_sparc::do_plt_section_for_global): New function.
458         (Target_sparc::do_plt_section_for_local): New function.
459         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
460         (Target_sparc::make_plt_section): New function, broken out of
461         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
462         (Target_sparc::make_plt_entry): Call make_plt_section.
463         (Target_sparc::make_local_ifunc_plt_entry): New function.
464         (Target_sparc::rela_ifunc_section): New function.
465         (Target_sparc::plt_section): Remove const.
466         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
467         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
468         and ifunc_count_ fields.
469         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
470         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
471         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
472         (Output_data_plt_sparc::rela_ifunc): New function.
473         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
474         (Output_data_plt_sparc::has_ifunc_section): New function.
475         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
476         (Output_data_plt_sparc::address_for_global): New function.
477         (Output_data_plt_sparc::address_for_local): New function.
478         (Output_data_plt_sparc::plt_index_to_offset): New function.
479         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
480         and entry_count.
481         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
482         entry_count.
483         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
484         R_SPARC_JMP_IREL to switch.
485         (Target_sparc::Scan::check_non_pic): Likewise.
486         (Target_sparc::Scan::local): Handle IFUNC symbols.
487         (Target_sparc::Scan::local): Likewise.
488         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
489         and plt_address_for_local.
490         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
491         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
492
493         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
494         (class Output_data_reloc): Adjust calls to Output_reloc_type.
495         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
496         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
497         global relocs too.
498         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
499         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
500         calls.
501         * sparc.cc (Target_sparc::Scan::global): Likewise.
502         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
503
504 2012-04-16  Cary Coutant  <ccoutant@google.com>
505
506         * archive.cc (Library_base::should_include_member): Check for
507         --export-dynamic-symbol.
508         * options.h (class General_options): Add --export-dynamic-symbol.
509         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
510         --export-dynamic-symbol.
511         (Symbol_table::gc_mark_undef_symbols): Likewise.
512         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
513
514 2012-04-12  David S. Miller  <davem@davemloft.net>
515
516         * sparc.cc (Reloc::wdisp10): New relocation method.
517         (Reloc::h34): Likewise.
518         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
519         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
520         R_SPARC_WDISP10.
521         (Target_sparc::Scan::local): Likewise.
522         (Target_sparc::Scan::global): Likewise.
523         (Target_sparc::Relocate::relocate): Likewise.
524
525 2012-04-09  Cary Coutant  <ccoutant@google.com>
526
527         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
528         low_pc == 0.
529
530 2012-04-06  Ian Lance Taylor  <iant@google.com>
531
532         * timer.cc: #include <unistd.h>.
533
534 2012-04-06  Roland McGrath  <mcgrathr@google.com>
535
536         * configure.in (AC_CHECK_HEADERS): Add locale.h.
537         * config.in: Regenerate.
538         * configure: Regenerate.
539
540 2012-04-05  Nick Clifton  <nickc@redhat.com>
541
542         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
543         (AM_LC_MESSAGES): Add.
544         * aclocal.m4: Regenerate.
545         * config.in: Regenerate.
546         * configure: Regenerate.
547
548 2012-03-21  Cary Coutant  <ccoutant@google.com>
549
550         * Makefile.am: Add gdb-index.cc, gdb-index.h.
551         * Makefile.in: Regenerate.
552         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
553         (Sized_elf_reloc_mapper::symbol_section): New function.
554         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
555         (make_elf_reloc_mapper): New function.
556         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
557         (Dwarf_abbrev_table::do_read_abbrevs): New function.
558         (Dwarf_abbrev_table::do_get_abbrev): New function.
559         (Dwarf_ranges_table::read_ranges_table): New function.
560         (Dwarf_ranges_table::read_range_list): New function.
561         (Dwarf_pubnames_table::read_section): New function.
562         (Dwarf_pubnames_table::read_header): New function.
563         (Dwarf_pubnames_table::next_name): New function.
564         (Dwarf_die::Dwarf_die): New function.
565         (Dwarf_die::read_attributes): New function.
566         (Dwarf_die::skip_attributes): New function.
567         (Dwarf_die::set_name): New function.
568         (Dwarf_die::set_linkage_name): New function.
569         (Dwarf_die::attribute): New function.
570         (Dwarf_die::string_attribute): New function.
571         (Dwarf_die::int_attribute): New function.
572         (Dwarf_die::uint_attribute): New function.
573         (Dwarf_die::ref_attribute): New function.
574         (Dwarf_die::child_offset): New function.
575         (Dwarf_die::sibling_offset): New function.
576         (Dwarf_info_reader::check_buffer): New function.
577         (Dwarf_info_reader::parse): New function.
578         (Dwarf_info_reader::do_parse): New function.
579         (Dwarf_info_reader::do_read_string_table): New function.
580         (Dwarf_info_reader::lookup_reloc): New function.
581         (Dwarf_info_reader::get_string): New function.
582         (Dwarf_info_reader::visit_compilation_unit): New function.
583         (Dwarf_info_reader::visit_type_unit): New function.
584         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
585         Sized_elf_reloc_mapper.
586         (Sized_dwarf_line_info::symbol_section): Remove function.
587         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
588         (Sized_dwarf_line_info::read_line_mappings): Remove object
589         parameter, adjust callers.
590         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
591         * dwarf_reader.h: Include <sys/types.h>.
592         (class Track_relocs): Remove forward declaration.
593         (class Elf_reloc_mapper): New class.
594         (class Sized_elf_reloc_mapper): New class.
595         (class Dwarf_abbrev_table): New class.
596         (class Dwarf_range_list): New class.
597         (class Dwarf_ranges_table): New class.
598         (class Dwarf_pubnames_table): New class.
599         (class Dwarf_die): New class.
600         (class Dwarf_info_reader): New class.
601         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
602         (Sized_dwarf_line_info::symbol_section): Remove member function.
603         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
604         base class.
605         * gdb-index.cc: New source file.
606         * gdb-index.h: New source file.
607         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
608         and .debug_types sections, call Layout::add_to_gdb_index.
609         (Sized_relobj_incr::do_section_name): Implement.
610         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
611         return type; Implement.
612         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
613         return type.
614         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
615         parameter list and return type.
616         (Sized_incr_dynobj::do_section_contents): Likewise.
617         * layout.cc: Include gdb-index.h.
618         (Layout::Layout): Initialize gdb_index_data_.
619         (Layout::init_fixed_output_section): Check for .gdb_index section.
620         (Layout::add_to_gdb_index): New function. Instantiate.
621         * layout.h: Add forward declaration for class Gdb_index.
622         (Layout::add_to_gdb_index): New member function.
623         (Layout::gdb_index_data_): New data member.
624         * main.cc: Include gdb-index.h.
625         (main): Print statistics for gdb index.
626         * object.cc (Object::section_contents): Move code into
627         do_section_contents.
628         (need_decompressed_section): Check for sections needed when building
629         gdb index.
630         (build_compressed_section_map): Likewise.
631         (Sized_relobj_file::do_read_symbols): Need local symbols when building
632         gdb index.
633         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
634         sections; call Layout::add_to_gdb_index.
635         (Sized_relobj_file::do_decompressed_section_contents): Call
636         do_section_contents directly.
637         * object.h (Object::do_section_contents): Adjust parameter list and
638         return type.
639         (Object::do_decompressed_section_contents): Call do_section_contents
640         directly.
641         (Sized_relobj_file::do_section_contents): Adjust parameter list and
642         return type.
643         * options.h (class General_options): Add --gdb-index option.
644         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
645         list and return type.
646         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
647         * reloc.h (Track_relocs::checkpoint): New function.
648         (Track_relocs::reset): New function.
649
650         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
651         New test cases.
652         * testsuite/Makefile.in: Regenerate.
653         * testsuite/gdb_index_test.cc: New test source file.
654         * testsuite/gdb_index_test_1.sh: New test source file.
655         * testsuite/gdb_index_test_2.sh: New test source file.
656
657 2012-03-19  Doug Kwan  <dougkwan@google.com>
658
659         * arm.cc (Target_arm::do_define_standard_symbols): New method.
660         (Target_arm::do_finalize_sections): Remove code which defines
661         __exidx_start and __exidx_end.  Make symbol table parameter
662         anonymous as it is not used.
663         * gold.cc (queue_middle_tasks): Call target hook to define any
664         target-specific symbols.
665         * target.h (Target::define_standard_symbols): New method.
666         (Target::do_define_standard_symbols): Same.
667         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
668         * testsuite/Makefile.in: Regenerate.
669         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
670         and __exidx_end.
671         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
672         relocations are generated for __exidx_start and __exidx_end.
673
674 2012-03-16  Doug Kwan  <dougkwan@google.com>
675
676         * testsuite/Makefile.am: Disable test initpri3b.
677         * testsuite/Makefile.in: Regenerate.
678
679 2012-03-15  Doug Kwan  <dougkwan@google.com>
680
681         * arm.cc (Target_arm::got_section): Make .got section read-only
682         if -z now is given.
683
684 2012-03-15  Ian Lance Taylor  <iant@google.com>
685
686         PR gold/13850
687         * layout.cc (Layout::make_output_section): Correctly mark
688         SHT_INIT_ARRAY, et. al., as relro.
689
690 2012-03-14  Doug Kwan  <dougkwan@google.com>
691
692         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
693         dynamic relocations for protected symbols in shared objects.
694
695 2012-03-13  Ian Lance Taylor  <iant@google.com>
696
697         * resolve.cc (Symbol_table::resolve): When merging common symbols,
698         keep the larger alignment.
699
700 2012-03-12  Cary Coutant  <ccoutant@google.com>
701
702         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
703         handling of DW_LNE_define_file.
704
705 2012-03-12  Cary Coutant  <ccoutant@google.com>
706
707         * reduced_debug_output.cc
708         (Output_reduced_debug_info_section::get_die_end): Add new FORM
709         codes to switch.
710
711 2012-02-29  Cary Coutant  <ccoutant@google.com>
712
713         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
714
715 2012-02-29  Cary Coutant  <ccoutant@google.com>
716
717         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
718         Call Object::decompressed_section_contents.
719         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
720         New dtor.
721         (Sized_dwarf_line_info::buffer_start_): New data member.
722         * merge.cc (Output_merge_data::do_add_input_section): Call
723         Object::decompressed_section_contents.
724         (Output_merge_string::do_add_input_section): Likewise.
725         * object.cc (need_decompressed_section): New function.
726         (build_compressed_section_map): Decompress sections needed later.
727         (Sized_relobj_file::do_decompressed_section_contents): New function.
728         (Sized_relobj_file::do_discard_decompressed_sections): New function.
729         * object.h (Object::decompressed_section_contents): New function.
730         (Object::discard_decompressed_sections): New function.
731         (Object::do_decompressed_section_contents): New function.
732         (Object::do_discard_decompressed_sections): New function.
733         (Compressed_section_info): New type.
734         (Compressed_section_map): Include decompressed section contents.
735         (Sized_relobj_file::do_decompressed_section_contents): New function.
736         (Sized_relobj_file::do_discard_decompressed_sections): New function.
737
738 2012-02-16  Cary Coutant  <ccoutant@google.com>
739
740         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
741         * testsuite/Makefile.in: Regenerate.
742
743 2012-02-14  Cary Coutant  <ccoutant@google.com>
744
745         * options.cc (General_options::finalize): Disallow -pie and -static.
746
747 2012-02-03  Doug Kwan  <dougkwan@google.com>
748
749         * arm.cc (Arm_relocate_functions::abs8,
750         Arm_relocate_functions::abs16): Use
751         Bits::has_signed_unsigned_overflow32.
752         (Arm_relocate_functions::thm_abs8): Correct range of
753         overflow check.
754         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
755         in assertions.
756
757 2012-02-02  Doug Kwan  <dougkwan@google.com>
758
759         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
760         position independent outputs, not just shared objects.
761
762 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
763
764         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
765         * configure: Regenerated.
766
767 2012-01-27  Ian Lance Taylor  <iant@google.com>
768
769         * reloc.h (Bits): New class with static functions, copied from
770         namespace utils in arm.cc.
771         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
772         instead.
773
774 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
775
776         * incremental.cc (write_info_blocks): Correct relocation offset.
777
778 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
779
780         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
781         (Relocate::tls_gd_to_le): Likewise.
782
783 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
784
785         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
786
787 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
788
789         * configure.ac: Check if -mcmodel=medium works.
790         * configure: Regenerated.
791
792 2012-01-24  Cary Coutant  <ccoutant@google.com>
793
794         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
795         definition and ...
796         (read_unsigned_LEB_128_x): ... this new function.
797         (read_signed_LEB_128): Replaced with inline definition and ...
798         (read_signed_LEB_128_x): ... this new function.
799         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
800         (read_unsigned_LEB_128): Add inline definition.
801         (read_signed_LEB_128_x): New function.
802         (read_signed_LEB_128): Add inline definition.
803         * testsuite/Makefile.am (leb128_unittest): New unit test.
804         * testsuite/Makefile.in: Regenerate.
805         * testsuite/leb128_unittest.cc: New unit test.
806
807 2012-01-23  Ian Lance Taylor  <iant@google.com>
808
809         PR gold/13617
810         * i386.cc (Target_i386::do_code_fill): When using a jmp
811         instruction, pad with nop instructions.
812         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
813
814 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
815
816         * x86_64.cc (gc_process_relocs): Add typename on types used in
817         template.
818         (scan_relocs): Likewise.
819         (relocate_section): Likewise.
820         (apply_relocation): Likewise.
821
822 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
823
824         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
825         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
826         under x32.
827
828 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
829
830         * x86_64.cc: Initial support for x32.
831
832 2012-01-03  Cary Coutant  <ccoutant@google.com>
833
834         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
835         Use abstract base class for GOT.
836         * gold/output.h (class Output_data_got_base): New abstract base class.
837         (class Output_data_got): Derive from new base class, adjust ctors.
838         (Output_data_got::reserve_slot): Make virtual; rename to
839         do_reserve_slot; Adjust callers.
840         * gold/target.h (Sized_target::init_got_plt_for_update): Return
841         pointer to abstract base class.
842         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
843
844 2011-12-18  Ian Lance Taylor  <iant@google.com>
845
846         * object.h (Relobj::local_symbol_value): New function.
847         (Relobj::local_plt_offset): New function.
848         (Relobj::local_has_got_offset): New function.
849         (Relobj::local_got_offset): New function.
850         (Relobj::set_local_got_offset): New function.
851         (Relobj::do_local_symbol_value): New pure virtual function.
852         (Relobj::do_local_plt_offset): Likewise.
853         (Relobj::do_local_has_got_offset): Likewise.
854         (Relobj::do_local_got_offset): Likewise.
855         (Relobj::do_set_local_got_offset): Likewise.
856         (Sized_relobj::do_local_has_got_offset): Rename from
857         local_has_got_offset.
858         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
859         (Sized_relobj::do_set_local_got_offset): Rename from
860         set_local_got_offset.
861         (Sized_relobj_file::do_local_plt_offset): Rename from
862         local_plt_offset.
863         (Sized_relobj_file::do_local_symbol_value): New function.
864         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
865         local_plt_offset.
866         * output.cc (Output_data_got::Got_entry::write): Change object to
867         Relobj.  Use local_symbol_value.
868         (Output_data_got::add_global_with_rel): Change rel_dyn to
869         Output_data_reloc_generic*.  Use add_global_generic.
870         (Output_data_got::add_global_with_rela): Remove.  Change all
871         callers to use add_global_with_rel.
872         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
873         Output_data_reloc_generic*.  Use add_global_generic.
874         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
875         callers to use add_global_pair_with_rel.
876         (Output_data_got::add_local): Change object to Relobj*.
877         (Output_data_got::add_local_plt): Likewise.
878         (Output_data_got::add_local_with_rel): Change object to Relobj*,
879         change rel_dyn to Output_data_reloc_generic*.  Use
880         add_local_generic.
881         (Output_data_got::add_local_with_rela): Remove.  Change all
882         callers to use all_local_with_rel.
883         (Output_data_got::add_local_pair_with_rel): Change object to
884         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
885         add_output_section_generic.
886         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
887         callers to use add_local_pair_with_rel.
888         (Output_data_got::reserve_local): Change object to Relobj*.
889         * output.h: (class Output_data_reloc_generic): Add pure virtual
890         declarations for add_global_generic, add_local_generic,
891         add_output_section_generic.
892         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
893         functions for Output_data_reloc_generic.  Update declarations for
894         changes listed in output.cc.
895         (class Output_data_got): Change template parameter to got_size.
896         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
897         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
898         function.
899         (Sized_relobj_incr::do_local_plt_offset): New function.
900         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
901         add_global_generic.
902
903 2011-12-17  Cary Coutant  <ccoutant@google.com>
904
905         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
906         * resolve.cc (Symbol_table::resolve): Likewise.
907         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
908         arrays.
909         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
910
911 2011-12-16  Ian Lance Taylor  <iant@google.com>
912
913         * output.h (Output_data_reloc_generic::add): Only call
914         add_dynamic_reloc if this is a dynamic reloc section.
915
916 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
917
918         PR gold/13505
919         * target-reloc.h (apply_relocation): Replace <64, false> with
920         <size, big_endian>.
921
922 2011-11-25  Nick Clifton  <nickc@redhat.com>
923
924         * po/it.po: New Italian translation.
925
926 2011-11-17  Sterling Augustine  <saugustine@google.com>
927
928         * script.cc (script_include_directive): Implement.
929         (read_script_file): New local variables name and search_path. Update
930         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
931         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
932         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
933
934 2011-11-11  Sterling Augustine  <saugustine@google.com>
935
936         * yyscript.y (section_cmd): Add support for INCLUDE directive.
937         (file_or_sections_cmd): Likewise.
938
939 2011-11-11  Doug Kwan  <dougkwan@google.com>
940
941         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
942         if --just-symbols is given.
943
944 2011-11-10  Doug Kwan  <dougkwan@google.com>
945
946         PR gold/13362
947         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
948         when processing data relocs.
949         * reloc.h (Relocate_functions::rel_unaligned): New method.
950         (Relocate_functions::pcrel_unaligned): Ditto.
951         (Relocate_functions::rel32_unaligned): Ditto.
952         (Relocate_functions::pcrel32_unaligned): Ditto.
953
954 2011-11-09  Doug Kwan  <dougkwan@google.com>
955
956         PR gold/13362
957         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
958         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
959         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
960         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
961         (Relocate_functions::rel_unaligned): New.
962         (Relocate_functions::rel32_unaligned): New.
963         * target-reloc.h (relocate_for_relocatable): Add code to handle
964         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
965         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
966         arm_unaligned_reloc_r): New targets.
967         * testsuite/Makefile.in: Regenerate.
968         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
969         linking.
970
971 2011-11-02  Ian Lance Taylor  <iant@google.com>
972
973         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
974         NATIVE_LINKER.
975         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
976         * options.cc (General_options::finalize): Use library search path
977         from configure script if specified.  If not native and no sysroot,
978         only search TOOLLIBDIR.
979         * options.h (Search_directory::Search_directory): Change name to
980         const std::string&.
981         (General_options::add_to_library_path_with_sysroot): Change arg to
982         const std::string&.
983         * configure, Makefile.in, config.in: Rebuild.
984
985 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
986
987         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
988         we are working around the ARM1176 Erratum.
989         * options.h (General_options::fix_arm1176): Add option.
990         * testsuite/Makefile.am: Add testcases, and keep current ones
991         working.
992         * testsuite/Makefile.in: Regenerate.
993         * testsuite/arm_fix_1176.s: New file.
994         * testsuite/arm_fix_1176.sh: Likewise.
995
996 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
997
998         * arm.cc (Target_arm::Target_arm): Remove initialisation of
999         may_use_blx_.
1000         (Target_arm::may_use_blx): Remove method.
1001         (Target_arm::set_may_use_blx): Likewise.
1002         (Target_arm::may_use_v4t_interworking): New method.
1003         (Target_arm::may_use_v5t_interworking): Likewise.
1004         (Target_arm::may_use_blx_): Remove member variable.
1005         (Arm_relocate_functions::arm_branch_common): Check for v5T
1006         interworking.
1007         (Arm_relocate_functions::thumb_branch_common): Likewise.
1008         (Reloc_stub::stub_type_for_reloc): Likewise.
1009         (Target_arm::do_finalize_sections): Correct interworking checks.
1010         * testsuite/Makefile.am: Add new tests.
1011         * testsuite/Makefile.in: Regenerate.
1012         * testsuite/arm_farcall_arm_arm.s: New test.
1013         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1014         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1015         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1016         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1017         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1018         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1019         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1020
1021 2011-10-31  Cary Coutant  <ccoutant@google.com>
1022
1023         PR gold/13023
1024         * expression.cc (Expression::eval_with_dot): Add
1025         is_section_dot_assignment parameter.
1026         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1027         absolute and assigning to dot within a section.
1028         * script-sections.cc
1029         (Output_section_element_assignment::set_section_addresses): Pass
1030         dot_section to set_if_absolute.
1031         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1032         as is_section_dot_assignment flag to eval_with_dot.
1033         (Output_section_element_dot_assignment::set_section_addresses):
1034         Likewise.
1035         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1036         parameter.  Also set value if relative to dot_section; set the
1037         symbol's output_section.
1038         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1039         parameter.  Adjust all callers.
1040         (Expression::eval_maybe_dot): Likewise.
1041         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1042         Adjust all callers.
1043         * testsuite/script_test_2.t: Test assignment of an absolute value
1044         to dot within an output section element.
1045
1046 2011-10-31  Cary Coutant  <ccoutant@google.com>
1047
1048         * options.h (class General_options): Add --[no-]gnu-unique options.
1049         * symtab.cc (Symbol_table::sized_write_globals): Convert
1050         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1051
1052 2011-10-31  Cary Coutant  <ccoutant@google.com>
1053
1054         PR gold/13359
1055         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1056         unnecessary assertion.
1057         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1058
1059 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1060
1061         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1062         gc_mark_symbol.
1063         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1064         gc_mark_symbol.
1065         Change to just keep the section associated with symbol.
1066         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1067         they are externally visible and --export-dynamic is turned on.
1068         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1069
1070 2011-10-19  Ian Lance Taylor  <iant@google.com>
1071
1072         PR gold/13163
1073         * script-sections.cc
1074         (Output_section_element_dot_assignment::needs_output_section): New
1075         function.
1076
1077 2011-10-19  Ian Lance Taylor  <iant@google.com>
1078
1079         PR gold/13204
1080         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1081         --section-start option was seen.
1082         * options.h (General_options::any_section_start): New function.
1083
1084 2011-10-18  David S. Miller  <davem@davemloft.net>
1085
1086         PR binutils/13301
1087         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1088         member to track relocation locations that have moved during TLS
1089         reloc optimizations.
1090         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1091         (Target_sparc::Relocate::relocate): Adjust view down by 4
1092         bytes if it matches reloc_adjust_addr_.
1093         (Target_sparc::Relocate::relocate_tls): Always move the
1094         __tls_get_addr call delay slot instruction forward 4 bytes when
1095         performing relaxation.
1096
1097 2011-10-18  Cary Coutant  <ccoutant@google.com>
1098
1099         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1100         (Output_file::map_no_anonymous): Check for non-zero
1101         return code from posix_fallocate.
1102
1103 2011-10-17  Cary Coutant  <ccoutant@google.com>
1104
1105         PR gold/13245
1106         * plugin.cc (is_visible_from_outside): Check for symbols
1107         referenced from dynamic objects.
1108         * resolve.cc (Symbol_table::resolve): Don't count references
1109         from dynamic objects as references from real ELF files.
1110         * testsuite/plugin_test_2.sh: Adjust expected result.
1111
1112 2011-10-17  Cary Coutant  <ccoutant@google.com>
1113
1114         * gold.cc: Include timer.h.
1115         (queue_middle_tasks): Stamp time.
1116         (queue_final_tasks): Likewise.
1117         * main.cc (main): Store timer in parameters.  Print timers
1118         for each pass.
1119         * parameters.cc (Parameters::Parameters): Initialize timer_.
1120         (Parameters::set_timer): New function.
1121         (set_parameters_timer): New function.
1122         * parameters.h (Parameters::set_timer): New function.
1123         (Parameters::timer): New function.
1124         (Parameters::timer_): New data member.
1125         (set_parameters_timer): New function.
1126         * timer.cc (Timer::stamp): New function.
1127         (Timer::get_pass_time): New function.
1128         * timer.h (Timer::stamp): New function.
1129         (Timer::get_pass_time): New function.
1130         (Timer::pass_times_): New data member.
1131
1132 2011-10-17  Cary Coutant  <ccoutant@google.com>
1133
1134         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1135         task for members of lib groups.
1136
1137 2011-10-17  Cary Coutant  <ccoutant@google.com>
1138
1139         PR gold/13288
1140         * fileread.cc (File_read::find_view): Add assert.
1141         (File_read::make_view): Move bounds check (replace with assert)...
1142         (File_read::find_or_make_view): ... to here.
1143
1144 2011-10-12  Cary Coutant  <ccoutant@google.com>
1145
1146         * output.cc (Output_file::open_base_file): Handle case where
1147         ::read returns less than requested size.
1148
1149 2011-10-10  Cary Coutant  <ccoutant@google.com>
1150
1151         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1152         Initialize defined_count_.
1153         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1154         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1155         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1156         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1157         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1158         * incremental.h (Sized_relobj_incr::defined_count_): New data
1159         member.
1160         (Sized_incr_dynobj::defined_count_): New data member.
1161         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1162         Return zeroes instead of internal error.
1163
1164 2011-10-10  Cary Coutant  <ccoutant@google.com>
1165
1166         PR gold/13249
1167         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1168         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1169         * output.h (class Output_reloc): Add use_plt_offset flag.
1170         (Output_reloc::type_): Adjust size of bit field.
1171         (Output_reloc::use_plt_offset_): New bit field.
1172         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1173         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1174         flag.  Adjust all callers.
1175         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1176         creating RELATIVE relocations.
1177
1178 2011-10-10  Nick Clifton  <nickc@redhat.com>
1179
1180         * po/es.po: Updated Spanish translation.
1181         * po/fi.po: Updated Finnish translation.
1182
1183 2011-10-03   Diego Novillo  <dnovillo@google.com>
1184
1185         * options.cc (parse_uint): Fix dereference of RETVAL.
1186
1187 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1188
1189         * layout.h (section_order_map_): New member.
1190         (get_section_order_map): New member function.
1191         * output.cc (Output_section::add_input_section): Check for patterns
1192         only when --section-ordering-file is specified.
1193         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1194         output_sections have been formed.
1195         * layout.cc (Layout_Layout): Initialize section_order_map_.
1196         * plugin.cc (update_section_order): Store order in order_map. Do not
1197         update the order.
1198         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1199         * testsuite/Makefile.in: Regenerate.
1200         * testsuite/plugin_section_order.c: New file.
1201         * testsuite/plugin_final_layout.cc: New file.
1202         * testsuite/plugin_final_layout.sh: New file.
1203
1204 2011-09-29  Cary Coutant  <ccoutant@google.com>
1205
1206         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1207         Check for NULL.
1208         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1209         symbols during incremental update.
1210         (Symbol_table::add_from_dynobj): Likewise.
1211
1212 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1213             Ian Lance Taylor  <iant@google.com>
1214
1215         * symtab.cc (Symbol_table::define_special_symbol): Always
1216         canonicalize version string.
1217
1218 2011-09-26  Cary Coutant  <ccoutant@google.com>
1219
1220         * gold.cc (queue_initial_tasks): Move option checks ...
1221         * options.cc (General_options::finalize): ... to here. Disable
1222         some options; make others fatal.
1223
1224 2011-09-26  Cary Coutant  <ccoutant@google.com>
1225
1226         gcc PR lto/47247
1227         * plugin.cc (get_symbols_v2): New function.
1228         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1229         (is_referenced_from_outside): New function.
1230         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1231         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1232         (get_symbols): Pass version parameter.
1233         (get_symbols_v2): New function.
1234         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1235         parameter.
1236         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1237         (onload): Add LDPT_GET_SYMBOLS_V2.
1238         (all_symbols_read_hook): Use get_symbols_v2; check for
1239         LDPR_PREVAILING_DEF_IRONLY_EXP.
1240         * testsuite/plugin_test_3.sh: Update expected results.
1241
1242 2011-09-23  Simon Baldwin  <simonb@google.com>
1243
1244         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1245         configuration options.
1246         * configure: Regenerate.
1247         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1248         * Makefile.in: Regenerate.
1249         * testsuite/Makefile.in: Regenerate.
1250
1251 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1252
1253         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1254
1255 2011-09-19  Cary Coutant  <ccoutant@google.com>
1256
1257         * incremental.cc (can_incremental_update): Fix typo in comment.
1258         * incremental.h (can_incremental_update): Likewise.
1259
1260 2011-09-18  Cary Coutant  <ccoutant@google.com>
1261
1262         * incremental.cc (can_incremental_update): New function.
1263         * incremental.h (can_incremental_update): New function.
1264         * layout.cc (Layout::init_fixed_output_section): Call it.
1265         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1266         * object.cc (Sized_relobj_file::do_layout): Call
1267         can_incremental_update.
1268
1269 2011-09-13  Cary Coutant  <ccoutant@google.com>
1270
1271         * configure.ac: Check for glibc support for gnu_indirect_function
1272         support with static linking, setting automake conditional
1273         IFUNC_STATIC.
1274         * Makefile.in: Regenerate.
1275         * configure: Regenerate.
1276
1277         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1278         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1279         for IFUNC_STATIC.
1280         * testsuite/Makefile.in: Regenerate.
1281
1282 2011-09-13  Cary Coutant  <ccoutant@google.com>
1283
1284         * incremental.cc (Sized_relobj_incr::do_layout): Call
1285         report_comdat_group for kept comdat sections.
1286         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1287         * testsuite/Makefile.in: Regenerate.
1288         * testsuite/incr_comdat_test_1.cc: New source file.
1289         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1290         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1291         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1292
1293 2011-09-13  Ian Lance Taylor  <iant@google.com>
1294
1295         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1296         variable external_symbols_offset.
1297
1298 2011-09-12  Ian Lance Taylor  <iant@google.com>
1299
1300         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1301         triggered if object has no symbols.
1302
1303 2011-09-09  David S. Miller  <davem@davemloft.net>
1304
1305         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1306         (Output_fill_debug_line::do_write): Likewise.
1307
1308 2011-08-29  Cary Coutant  <ccoutant@google.com>
1309
1310         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1311         casts to match formatting specs.
1312         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1313
1314 2011-08-26  Cary Coutant  <ccoutant@google.com>
1315
1316         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1317         remaining hole size when allocating.
1318         (Layout::make_output_section): Set fill methods for debug sections.
1319         * layout.h (Free_list::Free_list_node): Move from private to
1320         public.
1321         (Free_list::set_min_hole_size): New function.
1322         (Free_list::begin, Free_list::end): New functions.
1323         (Free_list::min_hole_): New data member.
1324         * output.cc: Include dwarf.h.
1325         (Output_fill_debug_info::do_minimum_hole_size): New function.
1326         (Output_fill_debug_info::do_write): New function.
1327         (Output_fill_debug_line::do_minimum_hole_size): New function.
1328         (Output_fill_debug_line::do_write): New function.
1329         (Output_section::Output_section): Initialize new data member.
1330         (Output_section::set_final_data_size): Ensure patch space is larger
1331         than minimum hole size.
1332         (Output_section::do_write): Fill holes in debug sections.
1333         * output.h (Output_fill): New class.
1334         (Output_fill_debug_info): New class.
1335         (Output_fill_debug_line): New class.
1336         (Output_section::set_free_space_fill): New function.
1337         (Output_section::free_space_fill_): New data member.
1338         * testsuite/Makefile.am (incremental_test_3): Add
1339         --incremental-patch option.
1340         (incremental_test_4): Likewise.
1341         (incremental_test_5): Likewise.
1342         (incremental_test_6): Likewise.
1343         (incremental_copy_test): Likewise.
1344         (incremental_common_test_1): Likewise.
1345         * testsuite/Makefile.in: Regenerate.
1346
1347 2011-08-26  Nick Clifton  <nickc@redhat.com>
1348
1349         * po/es.po: Updated Spanish translation.
1350
1351 2011-08-01  Cary Coutant  <ccoutant@google.com>
1352
1353         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1354         * gold/testsuite/Makefile.in: Regenerate.
1355         * gold/testsuite/justsyms_exec.c: New source file.
1356         * gold/testsuite/justsyms_lib.c: New source file.
1357
1358 2011-08-01  Cary Coutant  <ccoutant@google.com>
1359
1360         * layout.cc (Layout::set_segment_offsets): Don't realign text
1361         segment if -Ttext was specified.
1362         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1363         file type.
1364         * object.h (Sized_relobj_file::e_type): New function.
1365         (Sized_relobj_file::e_type_): New data member.
1366         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1367         base address for ET_EXEC files.
1368         * target.cc (Target::do_make_elf_object_implementation): Allow
1369         ET_EXEC files with --just-symbols option.
1370
1371 2011-07-28  Cary Coutant  <ccoutant@google.com>
1372
1373         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1374         Add thread_number parameter.
1375         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1376         * workqueue-threads.cc
1377         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1378         current thread if its thread number is greater than desired thread
1379         count.
1380         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1381         Add thread_number parameter.
1382         (Workqueue::should_cancel_thread): Likewise.
1383         (Workqueue::find_runnable_or_wait): Pass thread_number to
1384         should_cancel_thread.
1385         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1386         parameter.
1387
1388 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1389
1390         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1391         only after checking if it cannot be forced local.
1392         * symtab.h (is_externally_visible): Check if the symbol is not forced
1393         local.
1394
1395 2011-07-15  Ian Lance Taylor  <iant@google.com>
1396
1397         * options.h (class General_options): Add --print-output-format.
1398         Move -EL next to -EB, for  better --help output.
1399         * target-select.cc: Include <cstdio>, "options.h", and
1400         "parameters.h".
1401         (Target_selector::do_target_bfd_name): New function.
1402         (print_output_format): New function.
1403         * target-select.h (class Target_selector): Update declarations.
1404         (Target_selector::target_bfd_name): New function.
1405         (print_output_format): Declare.
1406         * main.cc: Include "target-select.h".
1407         (main): Handle --print-output-format.
1408         * gold.cc: Include "target-select.h".
1409         (queue_initial_tasks): Handle --print-output-format when there are
1410         no input files.
1411         * parameters.cc (parameters_force_valid_target): Give a better
1412         error message if -EB/-EL does not match target.
1413         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1414         function.
1415
1416 2011-07-15  Ian Lance Taylor  <iant@google.com>
1417
1418         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1419         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1420         (Output_data_plt_i386::do_write): Write address of .dynamic
1421         section to first entry in .got.plt section.
1422         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1423         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1424         Initialize layout_.
1425         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1426         section to first entry in .got.plt section.
1427         * layout.h (Layout::dynamic_section): New function.
1428
1429 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1430
1431         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1432         to claim_file call.
1433         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1434         input_section_position_, and input_section_glob_.
1435         (read_layout_from_file): Call function section_ordering_specified.
1436         * layout.h (is_section_ordering_specified): New function.
1437         (section_ordering_specified): New function.
1438         (section_ordering_specified_): New boolean member.
1439         * main.cc(main): Call load_plugins after layout object is defined.
1440         * output.cc (Output_section::add_input_section): Use
1441         function section_ordering_specified to check if section ordering is
1442         needed.
1443         * output.cc (Output_section::add_relaxed_input_section): Use
1444         function section_ordering_specified to check if section ordering is
1445         needed.
1446         (Output_section::update_section_layout): New function.
1447         (Output_section::sort_attached_input_sections): Check if input section
1448         must be reordered.
1449         * output.h (Output_section::update_section_layout): New function.
1450         * plugin.cc (get_section_count): New function.
1451         (get_section_type): New function.
1452         (get_section_name): New function.
1453         (get_section_contents): New function.
1454         (update_section_order): New function.
1455         (allow_section_ordering): New function.
1456         (Plugin::load): Add the new interfaces to the transfer vector.
1457         (Plugin_manager::load_plugins): New parameter.
1458         (Plugin_manager::all_symbols_read): New parameter.
1459         (Plugin_manager::claim_file): New parameter. Save the elf object for
1460         unclaimed objects.
1461         (Plugin_manager::get_elf_object): New function.
1462         (Plugin_manager::get_view): Change to directly use the bool to check
1463         if get_view is called from claim_file_hook.
1464         * plugin.h (input_objects): New function
1465         (Plugin__manager::load_plugins): New parameter.
1466         (Plugin_manager::claim_file): New parameter.
1467         (Plugin_manager::get_elf_object): New function.
1468         (Plugin_manager::in_claim_file_handler): New function.
1469         (Plugin_manager::in_claim_file_handler_): New member.
1470         (layout): New function.
1471         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1472         handler with an extra parameter. Make the elf object before calling
1473         claim_file handler.
1474         * testsuite/plugin_test.c (get_section_count): New function pointer.
1475         (get_section_type): New function pointer.
1476         (get_section_name): New function pointer.
1477         (get_section_contents): New function pointer.
1478         (update_section_order): New function pointer.
1479         (allow_section_ordering): New function pointer.
1480         (onload): Check if the new interfaces exist.
1481
1482 2011-07-13  Ian Lance Taylor  <iant@google.com>
1483
1484         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1485         relro section.
1486         * x86_64.cc (Target_x86_64::got_section): Likewise.
1487         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1488         (relro_now_test_SOURCES): New variable.
1489         (relro_now_test_DEPENDENCIES): New variable.
1490         (relro_now_test_LDFLAGS): New variable.
1491         (relro_now_test_LDADD): New variable.
1492         (relro_now_test.so): New target.
1493         * testsuite/Makefile.in: Rebuild.
1494
1495 2011-07-12  Ian Lance Taylor  <iant@google.com>
1496
1497         PR gold/12980
1498         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1499         GLOB_DAT relocation rather than a RELATIVE relocation for a
1500         protected symbol when creating a shared library.
1501         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1502         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1503         * testsuite/protected_main_1.cc (main): Test that protected
1504         function has same address.
1505
1506 2011-07-11  Ian Lance Taylor  <iant@google.com>
1507
1508         PR gold/12979
1509         * options.h (class General_options): Add -Bgroup.
1510         * options.cc (General_options::finalize): If -Bgroup is set,
1511         default to --unresolved-symbols=report-all.
1512         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1513         * target-reloc.h (issue_undefined_symbol_error): Handle
1514         --unresolved-symbols=report-all.
1515
1516 2011-07-08  Ian Lance Taylor  <iant@google.com>
1517
1518         PR gold/11985
1519         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1520         if linker script discards key sections.
1521         (Layout::create_dynamic_symtab): Likewise.
1522         (Layout::assign_local_dynsym_offsets): Likewise.
1523         (Layout::sized_create_version_sections): Likewise.
1524         (Layout::create_interp): Likewise.
1525         (Layout::finish_dynamic_section): Likewise.
1526         (Layout::set_dynamic_symbol_size): Likewise.
1527
1528 2011-07-08  Ian Lance Taylor  <iant@google.com>
1529
1530         PR gold/12386
1531         * options.h (class General_options): Add --unresolved-symbols.
1532         * target-reloc.h (issue_undefined_symbol_error): Check
1533         --unresolved-symbols.  Add comments.
1534
1535 2011-07-08  Ian Lance Taylor  <iant@google.com>
1536
1537         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1538         expression more complex.
1539
1540 2011-07-08  Ian Lance Taylor  <iant@google.com>
1541
1542         PR gold/11317
1543         * target-reloc.h (issue_undefined_symbol_error): New inline
1544         function, broken out of relocate_section.
1545         (relocate_section): Call issue_undefined_symbol_error.
1546         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1547         there is no TLS segment if we are about to issue an undefined
1548         symbol error.
1549         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1550
1551 2011-07-08  Ian Lance Taylor  <iant@google.com>
1552
1553         PR gold/12279
1554         * resolve.cc (Symbol_table::should_override): Add fromtype
1555         parameter.  Change all callers.  Give error when linking together
1556         TLS and non-TLS symbol.
1557         (Symbol_table::should_override_with_special): Add fromtype
1558         parameter.  Change all callers.
1559         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1560         there is no TLS segment if we have reported some errors.
1561         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1562
1563 2011-07-08  Ian Lance Taylor  <iant@google.com>
1564
1565         PR gold/12372
1566         * target.h (Target::plt_address_for_global): New function.
1567         (Target::plt_address_for_local): New function.
1568         (Target::plt_section_for_global): Remove.
1569         (Target::plt_section_for_local): Remove.
1570         (Target::do_plt_address_for_global): New virtual function.
1571         (Target::do_plt_address_for_local): New virtual function.
1572         (Target::do_plt_section_for_global): Remove.
1573         (Target::do_plt_section_for_local): Remove.
1574         (Target::register_global_plt_entry): Add Symbol_table and Layout
1575         parameters.
1576         * output.cc (Output_data_got::Got_entry::write): Use
1577         plt_address_for_global and plt_address_for_local.
1578         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1579         address of output section.
1580         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1581         got_irelative_, and irelative_count_ fields.  Update
1582         declarations.
1583         (Output_data_plt_i386::has_irelative_section): New function.
1584         (Output_data_plt_i386::entry_count): Add irelative_count_.
1585         (Output_data_plt_i386::set_final_data_size): Likewise.
1586         (class Target_i386): Add got_irelative_ and rel_irelative_
1587         fields.  Update declarations.
1588         (Target_i386::Target_i386): Initialize new fields.
1589         (Target_i386::do_plt_address_for_global): New function replacing
1590         do_plt_section_for_global.
1591         (Target_i386::do_plt_address_for_local): New function replacing
1592         do_plt_section_for_local.
1593         (Target_i386::got_section): Create got_irelative_.
1594         (Target_i386::rel_irelative_section): New function.
1595         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1596         fields.  Don't define __rel_iplt_{start,end}.
1597         (Output_data_plt_i386::add_entry): Add symtab and layout
1598         parameters.  Change all callers.  Use different PLT and GOT for
1599         IFUNC symbols.
1600         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1601         layout parameters.  Change all callers.  Use different PLT and
1602         GOT.
1603         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1604         (Output_data_plt_i386::rel_irelative): New function.
1605         (Output_data_plt_i386::address_for_global): New function.
1606         (Output_data_plt_i386::address_for_local): New function.
1607         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1608         IRELATIVE GOT when changing IFUNC GOT entries.
1609         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1610         reloc.
1611         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1612         if we didn't create an IRELATIVE GOT.
1613         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1614         plt_address_for_local.
1615         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1616         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1617         got_irelative_, and irelative_count_ fields.  Update
1618         declarations.
1619         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1620         Initialize new fields.  Remove symtab parameter.  Change all
1621         callers.
1622         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1623         irelative_count_.
1624         (Output_data_plt_x86_64::has_irelative_section): New function.
1625         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1626         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1627         fields.  Update declarations.
1628         (Target_x86_64::Target_x86_64): Initialize new fields.
1629         (Target_x86_64::do_plt_address_for_global): New function replacing
1630         do_plt_section_for_global.
1631         (Target_x86_64::do_plt_address_for_local): New function replacing
1632         do_plt_section_for_local.
1633         (Target_x86_64::got_section): Create got_irelative_.
1634         (Target_x86_64::rela_irelative_section): New function.
1635         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1636         all callers.  Don't create __rel_iplt_{start,end}.
1637         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1638         parameters.  Change all callers.  Use different PLT and GOT for
1639         IFUNC symbols.
1640         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1641         layout parameters.  Change all callers.  Use different PLT and
1642         GOT.
1643         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1644         parameters.  Change all callers.  Use different PLT and GOT for
1645         IFUNC symbols.
1646         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1647         (Output_data_plt_x86_64::rela_irelative): New function.
1648         (Output_data_plt_x86_64::address_for_global): New function.
1649         (Output_data_plt_x86_64::address_for_local): New function.
1650         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1651         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1652         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1653         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1654         parameters.
1655         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1656         reloc.
1657         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1658         symbols if we didn't create an IRELATIVE GOT.
1659         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1660         plt_address_for_local.
1661         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1662         * testsuite/ifuncvar1.c: New test file.
1663         * testsuite/ifuncvar2.c: New test file.
1664         * testsuite/ifuncvar3.c: New test file.
1665         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1666         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1667         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1668         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1669         * testsuite/Makefile.in: Rebuild.
1670
1671 2011-07-07  Cary Coutant  <ccoutant@google.com>
1672
1673         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1674         (two_file_test_1_ndebug.o): Likewise.
1675         (two_file_test_1b_ndebug.o): Likewise.
1676         (two_file_test_2_ndebug.o): Likewise.
1677         (two_file_test_main_ndebug.o): Likewise.
1678         (incremental_test_2): Link with no-debug versions.
1679
1680 2011-07-06  Cary Coutant  <ccoutant@google.com>
1681
1682         * gold/incremental.cc
1683         (Output_section_incremental_inputs::write_info_blocks): Check for
1684         hidden and internal symbols.
1685
1686 2011-07-06  Cary Coutant  <ccoutant@google.com>
1687
1688         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1689         Check disposition for startup file.
1690         (Incremental_inputs::report_command_line): Ignore
1691         --incremental-startup-unchanged option.
1692         * options.cc (General_options::parse_incremental_startup_unchanged):
1693         New function.
1694         (General_options::General_options): Initialize new data member.
1695         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1696         (General_options): Add --incremental-startup-unchanged option.
1697         (General_options::incremental_startup_disposition): New function.
1698         (General_options::incremental_startup_disposition_): New data member.
1699
1700 2011-07-06  Cary Coutant  <ccoutant@google.com>
1701
1702         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1703         input file index to Script_info ctor.
1704         (Sized_incremental_binary::do_file_has_changed): Find the
1705         command-line argument for files named in scripts.
1706         * incremental.h (Script_info::Script_info): New ctor
1707         with input file index.
1708         (Script_info::input_file_index): New function.
1709         (Script_info::input_file_index_): New data member.
1710         (Incremental_binary::get_library): Add const.
1711         (Incremental_binary::get_script_info): Add const.
1712         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1713         * testsuite/Makefile.am (incremental_test_5): New test case.
1714         (incremental_test_6): New test case.
1715         * testsuite/Makefile.in: Regenerate.
1716
1717 2011-07-06  Cary Coutant  <ccoutant@google.com>
1718
1719         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1720         debug output when command lines differ.
1721
1722 2011-07-06  Cary Coutant  <ccoutant@google.com>
1723
1724         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1725         --incremental-patch option.
1726         * layout.cc (Free_list::allocate): Extend allocation beyond original
1727         end if enabled.
1728         (Layout::make_output_section): Mark sections that should get
1729         patch space.
1730         * options.cc (parse_percent): New function.
1731         * options.h (parse_percent): New function.
1732         (DEFINE_percent): New macro.
1733         (General_options): Add --incremental-patch option.
1734         * output.cc (Output_section::Output_section): Initialize new data
1735         members.
1736         (Output_section::add_input_section): Print section name when out
1737         of patch space.
1738         (Output_section::add_output_section_data): Likewise.
1739         (Output_section::set_final_data_size): Add patch space when
1740         doing --incremental-full.
1741         (Output_section::do_reset_address_and_file_offset): Remove patch
1742         space.
1743         (Output_segment::set_section_list_addresses): Print debug output
1744         only if --incremental-update.
1745         * output.h (Output_section::set_is_patch_space_allowed): New function.
1746         (Output_section::is_patch_space_allowed_): New data member.
1747         (Output_section::patch_space_): New data member.
1748         * parameters.cc (Parameters::incremental_full): New function.
1749         * parameters.h (Parameters::incremental_full): New function
1750         * testsuite/Makefile.am (incremental_test_2): Add test for
1751         --incremental-patch option.
1752         * testsuite/Makefile.in: Regenerate.
1753         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1754         (t18): Remove function body.
1755
1756 2011-07-05  Doug Kwan  <dougkwan@google.com>
1757
1758         PR gold/12771
1759         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1760         Arm_Address type for relocation result.
1761         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1762         overflow check.
1763         (Arm_relocate_functions::abs32): Use unaligned access.
1764         (Arm_relocate_functions::rel32): Ditto.
1765         (Arm_relocate_functions::prel31): Ditto.
1766         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1767         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1768         static data relocations.
1769         * testsuite/Makefile.in: Regnerate.
1770         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1771
1772 2011-07-05  Ian Lance Taylor  <iant@google.com>
1773
1774         PR gold/12392
1775         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1776         symbols if necessary.
1777         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1778
1779 2011-07-05  Ian Lance Taylor  <iant@google.com>
1780
1781         PR gold/12952
1782         * resolve.cc (Symbol::override_base_with_special): Simply override
1783         version with special symbol version, ignoring previous version.
1784
1785 2011-07-05  Ian Lance Taylor  <iant@google.com>
1786
1787         * object.cc (Sized_relobj_file::include_section_group): Add
1788         information to comment about signature location.
1789
1790 2011-07-02  Ian Lance Taylor  <iant@google.com>
1791
1792         PR gold/12957
1793         * options.h (class General_options): Add -f and -F.
1794         * options.cc (General_options::finalize): Fatal error if -f/-F
1795         are used without -shared.
1796         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1797
1798 2011-07-02  Ian Lance Taylor  <iant@google.com>
1799
1800         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1801
1802 2011-07-01  Ian Lance Taylor  <iant@google.com>
1803
1804         PR gold/12525
1805         PR gold/12952
1806         * resolve.cc (Symbol::override_base_with_special): Don't override
1807         the version if the overriding symbol has a different name.
1808         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1809         all callers.  If we give an error about an undefined version,
1810         define the base version if necessary.
1811         * dynobj.h (class Versions): Update declaration.
1812         * testsuite/weak_alias_test_5.cc: New file.
1813         * testsuite/weak_alias_test.script: New file.
1814         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1815         and versioned_alias have the right value, and call t2.
1816         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1817         weak_alias_test_5.so.
1818         (weak_alias_test_LDADD): Likewise.
1819         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1820         * testsuite/Makefile.in: Rebuild.
1821
1822 2011-07-01  Ian Lance Taylor  <iant@google.com>
1823
1824         PR gold/12525
1825         * options.h (class General_options): Support -z notext.
1826         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1827         -Wl,-z,notext.
1828         (two_file_shared_nonpic.so): Likewise.
1829         (two_file_shared_mixed.so): Likewise.
1830         (two_file_shared_mixed_1.so): Likewise.
1831         (weak_undef_lib_nonpic.so): Likewise.
1832         (alt/weak_undef_lib_nonpic.so): Likewise.
1833         (tls_test_shared_nonpic.so): Likewise.
1834         * testsuite/Makefile.in: Rebuild.
1835
1836 2011-07-01  Ian Lance Taylor  <iant@google.com>
1837
1838         PR gold/12525
1839         * configure.ac: Test whether static linking works, setting
1840         the automake conditional HAVE_STATIC.
1841         * testsuite/Makefile.am: Disable tests using -static if
1842         HAVE_STATIC is not true.
1843         * configure, testsuite/Makefile.in: Rebuild.
1844
1845 2011-07-01  Ian Lance Taylor  <iant@google.com>
1846
1847         PR gold/12525
1848         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1849         Assert if we see DW_EH_PE_indirect.
1850         * target.h (Target::ehframe_datarel_base): New function.
1851         (Target::do_ehframe_datarel_base): New target function.
1852         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1853         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1854         function.
1855
1856 2011-07-01  Ian Lance Taylor  <iant@google.com>
1857
1858         PR gold/12571
1859         * options.h (class General_options): Add
1860         --ld-generated-unwind-info.
1861         * ehframe.cc (Fde::write): Add address parameter.  Change all
1862         callers.  If associated with PLT, fill in address and size.
1863         (Cie::set_output_offset): Only add merge mapping if there is an
1864         object.
1865         (Cie::write): Add address parameter.  Change all callers.
1866         (Eh_frame::add_ehframe_for_plt): New function.
1867         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1868         input_offset_ fields into union u_, with new plt field.
1869         (Fde::Fde): Adjust for new union field.
1870         (Fde::Fde) [Output_data version]: New constructor.
1871         (Fde::add_mapping): Only add merge mapping if there is an object.
1872         (class Cie): Update declarations.
1873         (class Eh_frame): Declare add_ehframe_for_plt.
1874         * layout.cc (Layout::layout_eh_frame): Break out code into
1875         make_eh_frame_section, and call it.
1876         (Layout::make_eh_frame_section): New function.
1877         (Layout::add_eh_frame_for_plt): New function.
1878         * layout.h (class Layout): Update declarations.
1879         * merge.cc (Merge_map::add_mapping): Add assertion.
1880         * i386.cc: Include "dwarf.h".
1881         (class Output_data_plt_i386): Make first_plt_entry,
1882         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1883         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1884         and plt_eh_frame_fde.
1885         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1886         boundary.  Call add_eh_frame_for_plt if appropriate.
1887         * x86_64.cc: Include "dwarf.h".
1888         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1889         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1890         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1891         and plt_eh_frame_fde.
1892         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1893         appropriate.
1894
1895 2011-06-29  Ian Lance Taylor  <iant@google.com>
1896
1897         PR gold/12629
1898         * object.cc (Sized_relobj_file::layout_section): Change shdr
1899         parameter to be const.
1900         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1901         out of do_layout.
1902         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1903         appropriate.  Call layout_eh_frame_section.
1904         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1905         sections.
1906         * object.h (class Sized_relobj_file): Update declarations.
1907
1908 2011-06-29  Ian Lance Taylor  <iant@google.com>
1909
1910         PR gold/12652
1911         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1912         modifier.
1913         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1914
1915 2011-06-29  Ian Lance Taylor  <iant@google.com>
1916
1917         PR gold/12675
1918         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1919         SHT_X86_64_UNWIND.
1920         * layout.cc (Layout::layout_eh_frame): Likewise.
1921
1922 2011-06-29  Ian Lance Taylor  <iant@google.com>
1923
1924         PR gold/12695
1925         * layout.cc (Layout::symtab_section_shndx): New function.
1926         * layout.h (class Layout): Declare symtab_section_shndx.
1927         * output.cc (Output_section::write_header): Call it.
1928
1929 2011-06-29  Ian Lance Taylor  <iant@google.com>
1930
1931         PR gold/12818
1932         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1933         symbols which are not used in a relocation.
1934
1935 2011-06-28  Ian Lance Taylor  <iant@google.com>
1936
1937         PR gold/12898
1938         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1939         script create indistinguishable segments.
1940         (Layout::set_segment_offsets): Use stable_sort when sorting
1941         segments.  Pass this to Compare_segments constructor.
1942         * layout.h (class Layout): Make segment_precedes non-static.
1943         (class Compare_segments): Change from struct to class.  Add
1944         layout_ field.  Add constructor.
1945         * script-sections.cc
1946         (Script_sections::attach_sections_using_phdrs_clause): Rename
1947         local orphan to is_orphan.  Don't report failure to put empty
1948         section in segment.  On attachment failure, report name of
1949         section, and attach to first PT_LOAD segment.
1950
1951 2011-06-28  Ian Lance Taylor  <iant@google.com>
1952
1953         PR gold/12934
1954         * target-select.cc (Target_selector::Target_selector): Add
1955         emulation parameter.  Change all callers.
1956         (select_target_by_bfd_name): Rename from select_target_by_name.
1957         Change all callers.
1958         (select_target_by_emulation): New function.
1959         (supported_emulation_names): New function.
1960         * target-select.h (class Target_selector): Add emulation_ field.
1961         Update declarations.
1962         (Target_selector::recognize_by_bfd_name): Rename from
1963         recognize_by_name.  Change all callers.
1964         (Target_selector::supported_bfd_names): Rename from
1965         supported_names.  Change all callers.
1966         (Target_selector::recognize_by_emulation): New function.
1967         (Target_selector::supported_emulations): New function.
1968         (Target_selector::emulation): New function.
1969         (Target_selector::do_recognize_by_bfd_name): Rename from
1970         do_recognize_by_name.  Change all callers.
1971         (Target_selector::do_supported_bfd_names): Rename from
1972         do_supported_names.  Change all callers.
1973         (Target_selector::do_recognize_by_emulation): New function.
1974         (Target_selector::do_supported_emulations): New function.
1975         (select_target_by_bfd_name): Change name in declaration.
1976         (select_target_by_emulation): Declare.
1977         (supported_emulation_names): Declare.
1978         * parameters.cc (parameters_force_valid_target): Try to find
1979         target based on emulation from -m option.
1980         * options.h (class General_options): Change doc string for -m.
1981         * options.cc (help): Print emulations.
1982         (General_options::parse_V): Likewise.
1983         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1984         Add emulation parameter.  Change all callers.
1985
1986 2011-06-28  Ian Lance Taylor  <iant@google.com>
1987
1988         * target.h (class Target): Add osabi_ field.
1989         (Target::osabi): New function.
1990         (Target::set_osabi): New function.
1991         (Target::Target): Initialize osabi_.
1992         (Target::do_adjust_elf_header): Make pure virtual.
1993         (Sized_target::do_adjust_elf_header): Declare.
1994         * target.cc (Sized_target::do_adjust_elf_header): New function.
1995         (class Sized_target): Instantiate all versions.
1996         * freebsd.h (class Target_freebsd): Remove.
1997         (Target_selector_freebsd::do_recognize): Call set_osabi on
1998         Target.
1999         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2000         (Target_selector_freebsd::set_osabi): Remove.
2001         * i386.cc (class Target_i386): Inherit from Sized_target rather
2002         than Target_freebsd.
2003         * x86_64.cc (class Target_x86_64): Likewise.
2004
2005 2011-06-28  Ian Lance Taylor  <iant@google.com>
2006
2007         * target.h (Target::can_check_for_function_pointers): Rewrite.
2008         Make non-virtual.
2009         (Target::can_icf_inline_merge_sections): Likewise.
2010         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2011         (Target::Target_info): Add can_icf_inline_merge_sections field.
2012         (Target::do_can_check_for_function_pointers): New virtual
2013         function.
2014         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2015         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2016         from can_check_for_function_pointers, move in file.
2017         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2018         section_may_have_icf_unsafe_poineters, move in file.
2019         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2020         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2021         Rename from can_check_for_function_pointers, move in file.
2022         (Target_i386::can_icf_inline_merge_sections): Remove.
2023         (Target_i386::i386_info): Initialize
2024         can_icf_inline_merge_sections.
2025         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2026         Initialize can_icf_inline_merge_sections.
2027         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2028         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2029         Rename from can_check_for_function_pointers, move in file.
2030         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2031         (Target_x86_64::x86_64_info): Initialize
2032         can_icf_inline_merge_sections.
2033         * testsuite/testfile.cc (Target_test::test_target_info):
2034         Likewise.
2035         * icf.cc (get_section_contents): Correct formatting.
2036
2037 2011-06-27  Ian Lance Taylor  <iant@google.com>
2038
2039         * symtab.cc (Symbol::versioned_name): New function.
2040         (Symbol_table::add_to_final_symtab): Use versioned_name when
2041         appropriate.
2042         (Symbol_table::sized_write_symbol): Likewise.
2043         * symtab.h (class Symbol): Declare versioned_name.
2044         * stringpool.h (class Stringpool_template): Add variant of add
2045         which takes a std::basic_string.
2046         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2047         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2048         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2049         (ver_test_12.o): New target.
2050         * testsuite/Makefile.in: Rebuild.
2051
2052 2011-06-27  Doug Kwan  <dougkwan@google.com>
2053
2054         * arm.cc (Arm_relocate_functions::thm_jump8,
2055         Arm_relocate_functions::thm_jump11): Use a wider signed
2056         type to compute offset.
2057         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2058         arm_thm_jump8.
2059         * testsuite/Makefile.in: Regenerate.
2060         * testsuite/arm_branch_in_range.sh: Check test results of
2061         arm_thm_jump11 and arm_thm_jump8.
2062         * testsuite/arm_thm_jump11.s: New test source file.
2063         * testsuite/arm_thm_jump11.t: New linker script.
2064         * testsuite/arm_thm_jump8.s: New test source file.
2065         * testsuite/arm_thm_jump8.t: New linker script.
2066
2067 2011-06-24  Ian Lance Taylor  <iant@google.com>
2068
2069         * layout.cc: Include "object.h".
2070         (ctors_sections_in_init_array): New static variable.
2071         (Layout::is_ctors_in_init_array): New function.
2072         (Layout::layout): Add entry to ctors_sections_in_init_array if
2073         appropriate.
2074         * layout.h (class Layout): Declare is_ctors_in_init_array.
2075         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2076         is_ctors_reverse_view is set.
2077         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2078         all callers.  Set is_ctors_reverse_view field of View_size.
2079         (Sized_relobj_file::reverse_words): New function.
2080         * object.h (Sized_relobj_file::View_size): Add
2081         is_ctors_reverse_view field.
2082         (class Sized_relobj_file): Update declarations.
2083         * testsuite/initpri3.c: New test.
2084         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2085         initpri3b.
2086         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2087         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2088         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2089         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2090         * testsuite/Makefile.in: Rebuild.
2091
2092 2011-06-24  Cary Coutant  <ccoutant@google.com>
2093
2094         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2095         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2096         (debug_msg_cdebug.err): New targets.
2097         * testsuite/Makefile.in: Regenerate.
2098         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2099         Fix checks for link with shared library.
2100
2101 2011-06-24  Doug Kwan  <dougkwan@google.com>
2102
2103         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2104         skip empty text sections.
2105         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2106
2107 2011-06-22  Ian Lance Taylor  <iant@google.com>
2108
2109         PR gold/12910
2110         * options.h (class General_options): Add --ctors-in-init-array.
2111         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2112         friends as SHT_PROGBITS for merging sections.
2113         (Layout::layout): Remove special handling of .init_array and
2114         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2115         and .dtors if ctors_in_init_array.
2116         (Layout::make_output_section): Force correct section types for
2117         .init_array and friends.  Don't sort if doing relocatable link,
2118         Don't sort .ctors and .dtors if ctors_in_init_array.
2119         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2120         (Layout::output_section_name): Add relobj parameter.  Change all
2121         callers.  Handle .ctors. and .dtors. in code rather than table.
2122         Handle .ctors and .dtors if ctors_in_init_array.
2123         (Layout::match_file_name): New function, moved from output.cc.
2124         * layout.h (class Layout): Update declarations.
2125         * output.cc: Include "layout.h".
2126         (Input_section_sort_entry::get_priority): New function.
2127         (Input_section_sort_entry::match_file_name): Just call
2128         Layout::match_file_name.
2129         (Output_section::Input_section_sort_init_fini_compare::operator()):
2130         Handle .ctors and .dtors.  Sort by explicit priority rather than
2131         by name.
2132         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2133         * testsuite/initpri2.c: New test.
2134         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2135         (check_PROGRAMS): Add initpri2.
2136         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2137         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2138         * configure, testsuite/Makefile.in: Rebuild.
2139
2140 2011-06-19  Ian Lance Taylor  <iant@google.com>
2141
2142         PR gold/12880
2143         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2144         .interp section to a PT_INTERP segment even if we have seen a
2145         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2146         clause in a linker script.
2147         (Layout::finalize): Don't create a .interp section if we've
2148         already create a PT_INTERP segment.
2149         (Layout::create_interp): Always call choose_output_section (revert
2150         patch of 2011-06-17).  Don't create PT_INTERP segment.
2151         * script-sections.cc
2152         (Script_sections::create_note_and_tls_segments): Add a .interp
2153         section to a PT_INTERP segment even if we have seen a
2154         --dynamic-linker option.
2155
2156 2011-06-18  Ian Lance Taylor  <iant@google.com>
2157
2158         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2159         merely because a non-PT_LOAD segment has a dynamic reloc.
2160
2161 2011-06-18  Ian Lance Taylor  <iant@google.com>
2162
2163         * layout.cc (Layout::finish_dynamic_section): Don't create
2164         DT_FLAGS entry if not needed.
2165
2166 2011-06-18  Ian Lance Taylor  <iant@google.com>
2167
2168         PR gold/12745
2169         * layout.cc (Layout::layout_eh_frame): Correct handling of
2170         writable .eh_frame section.
2171
2172 2011-06-17  Ian Lance Taylor  <iant@google.com>
2173
2174         PR gold/12893
2175         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2176         symbol is redefined with the exact same object and value.
2177
2178 2011-06-17  Ian Lance Taylor  <iant@google.com>
2179
2180         PR gold/12880
2181         * layout.h (class Layout): Add interp_segment_ field.
2182         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2183         (Layout::attach_allocated_section_to_segment): If making shared
2184         library, put .interp section in PT_INTERP segment.
2185         (Layout::finalize): Also call create_interp if -dynamic-linker
2186         option was used.
2187         (Layout::create_interp): Assert that there is no PT_INTERP
2188         segment.  If not using a SECTIONS clause, use make_output_section.
2189         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2190         * script-sections.cc
2191         (Script_sections::create_note_and_tls_segments): If making shared
2192         library, put .interp section in PT_INTERP segment.
2193
2194 2011-06-17  Ian Lance Taylor  <iant@google.com>
2195
2196         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2197         when making a shared library.
2198
2199 2011-06-17  Ian Lance Taylor  <iant@google.com>
2200
2201         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2202         parameter.  Change all callers.  Don't issue warning about PC32
2203         against locally defined symbol.
2204
2205 2011-06-16  Ian Lance Taylor  <iant@google.com>
2206
2207         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2208         occurs in same object.
2209
2210 2011-06-14  Alan Modra  <amodra@gmail.com>
2211
2212         * po/POTFILES.in: Regenerate.
2213
2214 2011-06-09  Ian Lance Taylor  <iant@google.com>
2215
2216         * script-sections.cc
2217         (Orphan_output_section::set_section_addresses): For a relocatable
2218         link set address to 0.
2219
2220 2011-06-09  Cary Coutant  <ccoutant@google.com>
2221
2222         PR gold/12804
2223         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2224         used with --compress-debug-sections.
2225         * gold/object.cc (Sized_relobj_file::do_layout): Report
2226         uncompressed size of compressed input sections.
2227
2228 2011-06-08  Cary Coutant  <ccoutant@google.com>
2229
2230         PR gold/12804
2231         * testsuite/two_file_test_2_v1.cc: Change initialization of
2232         v2 to keep it in .data.
2233
2234 2011-06-07  Cary Coutant  <ccoutant@google.com>
2235
2236         * common.cc (Symbol_table::do_allocate_commons_list): Call
2237         gold_fallback.
2238         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2239         (Errors::fallback): New function.
2240         (gold_fallback): New function.
2241         * errors.h (Errors::fallback): New function.
2242         * gold.cc (gold_exit): Change status parameter to enum; adjust
2243         all callers.
2244         (queue_initial_tasks): Call gold_fallback.
2245         * gold.h: Include cstdlib.
2246         (Exit_status): New enum type.
2247         (gold_exit): Change status parameter to enum.
2248         (gold_fallback): New function.
2249         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2250         (Layout::create_symtab_sections): Likewise.
2251         (Layout::create_shdrs): Likewise.
2252         * main.cc (main): Adjust call to gold_exit.
2253         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2254         (Output_data_got::add_got_entry_pair): Likewise.
2255         (Output_section::add_input_section): Likewise.
2256         (Output_section::add_output_section_data): Likewise.
2257         (Output_segment::set_section_list_addresses): Likewise.
2258         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2259
2260 2011-06-07  Cary Coutant  <ccoutant@google.com>
2261
2262         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2263         for incremental links.
2264         * output.cc (Output_segment::set_section_list_addresses): Remove
2265         FIXME and test for TLS or BSS.
2266
2267 2011-06-07  Cary Coutant  <ccoutant@google.com>
2268
2269         * testsuite/Makefile.am: Add incremental_copy_test,
2270         incremental_common_test_1.
2271         * testsuite/Makefile.in: Regenerate.
2272         * testsuite/common_test_1_v1.c: New source file.
2273         * testsuite/common_test_1_v2.c: New source file.
2274         * testsuite/copy_test_v1.cc: New source file.
2275
2276 2011-06-07  Cary Coutant  <ccoutant@google.com>
2277
2278         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2279         update, allocate common from bss section's free list.
2280         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2281         linker-defined symbols.
2282         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2283         Skip GOT and PLT entries that are no longer referenced.
2284         (Output_section_incremental_inputs::write_info_blocks): Mark
2285         linker-defined symbols.
2286         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2287         * output.cc (Output_section::allocate): New function.
2288         * output.h (Output_section::allocate): New function.
2289         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2290         linker-defined symbols.
2291         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2292         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2293         (Symbol::init_base_output_data): Likewise.
2294         (Symbol::init_base_output_segment): Likewise.
2295         (Symbol::init_base_constant): Likewise.
2296         (Sized_symbol::init_output_data): Likewise.
2297         (Sized_symbol::init_output_segment): Likewise.
2298         (Sized_symbol::init_constant): Likewise.
2299         (Symbol_table::do_define_in_output_data): Likewise.
2300         (Symbol_table::do_define_in_output_segment): Likewise.
2301         (Symbol_table::do_define_as_constant): Likewise.
2302         * symtab.h (Symbol::is_predefined): New function.
2303         (Symbol::init_base_output_data): Add is_predefined parameter.
2304         (Symbol::init_base_output_segment): Likewise.
2305         (Symbol::init_base_constant): Likewise.
2306         (Symbol::is_predefined_): New data member.
2307         (Sized_symbol::init_output_data): Add is_predefined parameter.
2308         (Sized_symbol::init_output_segment): Likewise.
2309         (Sized_symbol::init_constant): Likewise.
2310         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2311
2312 2011-06-07  Cary Coutant  <ccoutant@google.com>
2313
2314         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2315         instead of emit_copy_reloc.
2316         (Copy_relocs::emit_copy_reloc): Refactor.
2317         (Copy_relocs::make_copy_reloc): New function.
2318         (Copy_relocs::add_copy_reloc): Remove.
2319         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2320         section.
2321         (Copy_relocs::make_copy_reloc): New function.
2322         (Copy_relocs::add_copy_reloc): Remove.
2323         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2324         unchanged input files.
2325         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2326         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2327         Reserve BSS space for COPY relocations.
2328         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2329         (Output_section_incremental_inputs::write_info_blocks): Record
2330         whether a symbol is copied from a shared object.
2331         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2332         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2333         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2334         (Incremental_input_entry_reader::get_output_symbol_index): Add
2335         is_copy parameter.
2336         (Incremental_binary::emit_copy_relocs): New function.
2337         (Incremental_binary::do_emit_copy_relocs): New function.
2338         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2339         new data member.
2340         (Sized_incremental_binary::add_copy_reloc): New function.
2341         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2342         (Sized_incremental_binary::Copy_reloc): New struct.
2343         (Sized_incremental_binary::Copy_relocs): New typedef.
2344         (Sized_incremental_binary::copy_relocs_): New data member.
2345         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2346         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2347         * target.h (Sized_target::emit_copy_reloc): New function.
2348         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2349
2350 2011-06-02  Cary Coutant  <ccoutant@google.com>
2351
2352         PR gold/12163
2353         * gold/archive.cc (Archive::Archive): Initialize new data member.
2354         (Archive::include_all_members): Return if archive has already been
2355         included.
2356         * gold/archive.h (Archive::include_all_members_): New data member.
2357
2358 2011-06-02  Nick Clifton  <nickc@redhat.com>
2359
2360         * dynobj.h: Fix spelling mistake in comment.
2361         * output.cc: Likewise.
2362
2363 2011-05-31  Doug Kwan  <dougkwan@google.com>
2364             Asier Llano
2365
2366         PR gold/12826
2367         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2368         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2369         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2370         redundant arm_exidx_test.so.
2371         * testsuite/Makefile.in: Regenerate.
2372         (check_SCRIPTS): Add pr12826.sh
2373         (check_DATA): Add pr12826.stdout
2374         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2375         * testsuite/pr12826.sh: New file.
2376         * testsuite/pr12826_1.s: Ditto.
2377         * testsuite/pr12826_1.s: Ditto.
2378
2379 2011-05-30  Ian Lance Taylor  <iant@google.com>
2380
2381         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2382         sections.
2383
2384 2011-05-29  Ian Lance Taylor  <iant@google.com>
2385
2386         PR gold/12804
2387         * testsuite/Makefile.am: Use different file name for two_file_test
2388         temporary file for each incremental test.
2389         * testsuite/Makefile.in: Rebuild.
2390
2391 2011-05-29  Ian Lance Taylor  <iant@google.com>
2392
2393         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2394         binary input file is empty.
2395
2396 2011-05-27  Ian Lance Taylor  <iant@google.com>
2397
2398         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2399         (ver_test_9.so): Likewise.
2400         * testsuite/Makefile.in: Rebuild.
2401
2402 2011-05-26 Cary Coutant  <ccoutant@google.com>
2403
2404         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2405         * incremental.cc (Incremental_inputs::report_input_section): Fix
2406         comment, indentation.
2407         (Incremental_inputs::report_comdat_group): New function.
2408         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2409         of data for incremental input file entry.
2410         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2411         group count, COMDAT group signatures.
2412         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2413         an unchanged input file.
2414         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2415         Initialize new data member.
2416         (Incremental_object_entry::add_comdat_group): New function.
2417         (Incremental_object_entry::get_comdat_group_count): New function.
2418         (Incremental_object_entry::get_comdat_signature_key): New function.
2419         (Incremental_object_entry::groups_): New data member.
2420         (Incremental_inputs::report_comdat_group): New function.
2421         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2422         data for incremental input file entry.
2423         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2424         (Incremental_input_entry_reader::get_input_section): Adjust size of
2425         data for incremental input file entry.
2426         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2427         (Incremental_input_entry_reader::get_comdat_group_signature): New
2428         function.
2429         * object.cc (Sized_relobj::include_section_group): Report kept
2430         COMDAT groups for incremental links.
2431
2432 2011-05-24  David Meyer  <pdox@google.com>
2433
2434         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2435         with name parameter.  Add found_name parameter.
2436         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2437         * dirsearch.h (class Dirsearch): Update declaration.
2438
2439 2011-05-24  Ian Lance Taylor  <iant@google.com>
2440
2441         * archive.cc (Library_base::should_include_member): Pull in object
2442         from archive if it defines the entry symbol.
2443         * parameters.cc (Parameters::entry): New function.
2444         * parameters.h (class Parameters): Declare entry.
2445         * output.h (class Output_file_header): Remove entry_ field.
2446         * output.cc (Output_file_header::Output_file_header): Remove entry
2447         parameter.  Change all callers.
2448         (Output_file_header::entry): Use parameters->entry.
2449         * gold.cc (queue_middle_tasks): Likewise.
2450         * plugin.cc (Plugin_hook::run): Likewise.
2451
2452 2011-05-24 Cary Coutant  <ccoutant@google.com>
2453
2454         * gold.cc (queue_initial_tasks): Pass incremental base filename
2455         to Output_file::open_base_file; don't print error message.
2456         * incremental-dump.cc (main): Adjust call to
2457         Output_file::open_for_modification.
2458         * incremental-dump.cc (main): Likewise.
2459         * incremental.cc (Incremental_inputs::report_command_line):
2460         Ignore --incremental-base option when comparing command lines.
2461         Ignore parameter when given as separate argument.
2462         * options.h (class General_options): Add --incremental-base.
2463         * output.cc (Output_file::Output_file):
2464         (Output_file::open_base_file): Add base_name and writable parameters;
2465         read base file into new file; print error message here.
2466         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2467         callers.
2468         * output.h (Output_file::open_for_modification): Rename to...
2469         (Output_file::open_base_file): ...this; add base_name and
2470         writable parameters; adjust all callers.
2471         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2472         callers.
2473         * testsuite/Makefile.am (incremental_test_4): Test
2474         --incremental-base.
2475         * testsuite/Makefile.in: Regenerate.
2476
2477 2011-05-24 Cary Coutant  <ccoutant@google.com>
2478
2479         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2480         incremental_test_4.
2481         * testsuite/Makefile.in: Regenerate.
2482         * testsuite/two_file_test_1_v1.cc: New test source file.
2483         * testsuite/two_file_test_1b_v1.cc: New test source file.
2484         * testsuite/two_file_test_2_v1.cc: New test source file.
2485
2486 2011-05-24 Cary Coutant  <ccoutant@google.com>
2487
2488         * dynobj.h (Dynobj::do_dynobj): New function.
2489         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2490         flag and soname for shared objects.
2491         * incremental.cc (Incremental_inputs::report_object): Make
2492         either Incremental_object_entry or Incremental_dynobj_entry; add
2493         soname to string table.
2494         (Incremental_inputs::report_input_section): Add assertion.
2495         (Output_section_incremental_inputs::set_final_data_size): Adjust
2496         type of input file entry for shared libraries; adjust size of
2497         shared library info entry.
2498         (Output_section_incremental_inputs::write_input_files): Write
2499         as_needed flag for shared libraries.
2500         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2501         of input file entry for shared libraries; write soname.
2502         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2503         soname from incremental info.
2504         * incremental.h (enum Incremental_input_flags): Add
2505         INCREMENTAL_INPUT_AS_NEEDED.
2506         (Incremental_input_entry::Incremental_input_entry): Initialize new
2507         data member.
2508         (Incremental_input_entry::set_as_needed): New function.
2509         (Incremental_input_entry::as_needed): New function.
2510         (Incremental_input_entry::do_dynobj_entry): New function.
2511         (Incremental_input_entry::as_needed_): New data member.
2512         (Incremental_object_entry::Incremental_object_entry): Don't check
2513         for shared library.
2514         (Incremental_object_entry::do_type): Likewise.
2515         (class Incremental_dynobj_entry): New class.
2516         (Incremental_input_entry_reader::as_needed): New function.
2517         (Incremental_input_entry_reader::get_soname): New function.
2518         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2519         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2520         size of shared library info entry.
2521         * layout.cc (Layout::finish_dynamic_section): Don't test for
2522         incremental link when adding DT_NEEDED entries.
2523         * object.h (Object::Object): Initialize new data member.
2524         (Object::dynobj): New function.
2525         (Object::set_as_needed): New function.
2526         (Object::as_needed): New function.
2527         (Object::do_dynobj): New function.
2528         (Object::as_needed_): New data member.
2529
2530 2011-05-24 Cary Coutant  <ccoutant@google.com>
2531
2532         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2533         info; adjust display of GOT entries.
2534         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2535         vector of input objects; remove file_status_.
2536         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2537         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2538         got_plt reader; call target hooks to reserve GOT entries.
2539         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2540         of input file info header and GOT info entry.
2541         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2542         relocation info.
2543         (Got_plt_view_info::got_descriptor): Remove.
2544         (Got_plt_view_info::sym_index): New data member.
2545         (Got_plt_view_info::input_index): New data member.
2546         (Local_got_offset_visitor::visit): Write input file index.
2547         (Global_got_offset_visitor::visit): Write 0 for input file index.
2548         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2549         with sym_index and input_index.
2550         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2551         incremental info GOT entry; replace got_descriptor with input_index.
2552         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2553         map from input file index to object.
2554         (Sized_relobj_incr::do_layout): Replace direct data member reference
2555         with accessor function.
2556         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2557         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2558         Adjust size of input file info header.
2559         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2560         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2561         (Incremental_input_entry_reader::get_input_section): Adjust size of
2562         input file info header.
2563         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2564         of incremental info GOT entry.
2565         (Incremental_got_plt_reader::get_got_desc): Remove.
2566         (Incremental_got_plt_reader::get_got_symndx): New function.
2567         (Incremental_got_plt_reader::get_got_input_index): New function.
2568         (Sized_incremental_binary::Sized_incremental_binary): Remove
2569         file_status_; add input_objects_.
2570         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2571         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2572         (Sized_incremental_binary::file_is_unchanged): Remove.
2573         (Sized_incremental_binary::set_input_object): New function.
2574         (Sized_incremental_binary::input_object): New function.
2575         (Sized_incremental_binary::file_status_): Remove.
2576         (Sized_incremental_binary::input_objects_): New data member.
2577         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2578         references.
2579         (Sized_relobj_incr::invalid_address): Move to base class.
2580         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2581         class.
2582         (Sized_relobj_incr::do_output_section_offset): Likewise.
2583         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2584         (Sized_relobj_incr::section_offsets_): Likewise.
2585         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2586         function.
2587         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2588         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2589         with accessor function.
2590         (Sized_relobj_file::do_layout): Likewise.
2591         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2592         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2593         (Sized_relobj_file::compute_final_local_value): Replace refs to
2594         section_offsets_ with accessor function.
2595         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2596         * object.h (Relobj::Relobj): Initialize new data members.
2597         (Relobj::add_dyn_reloc): New function.
2598         (Relobj::first_dyn_reloc): New function.
2599         (Relobj::dyn_reloc_count): New function.
2600         (Relobj::first_dyn_reloc_): New data member.
2601         (Relobj::dyn_reloc_count_): New data member.
2602         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2603         references.
2604         (Sized_relobj::Address): New typedef.
2605         (Sized_relobj::invalid_address): Move here from child class.
2606         (Sized_relobj::Sized_relobj): Initialize new data members.
2607         (Sized_relobj::sized_relobj): New function.
2608         (Sized_relobj::is_output_section_offset_invalid): Move here from
2609         child class.
2610         (Sized_relobj::get_output_section_offset): Likewise.
2611         (Sized_relobj::local_has_got_offset): Likewise.
2612         (Sized_relobj::local_got_offset): Likewise.
2613         (Sized_relobj::set_local_got_offset): Likewise.
2614         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2615         (Sized_relobj::clear_got_offsets): New function.
2616         (Sized_relobj::section_offsets): Move here from child class.
2617         (Sized_relobj::do_output_section_offset): Likewise.
2618         (Sized_relobj::do_set_section_offset): Likewise.
2619         (Sized_relobj::Local_got_offsets): Likewise.
2620         (Sized_relobj::local_got_offsets_): Likewise.
2621         (Sized_relobj::section_offsets_): Likewise.
2622         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2623         references.
2624         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2625         class.
2626         (Sized_relobj_file::sized_relobj): New function
2627         (Sized_relobj_file::local_has_got_offset): Move to base class.
2628         (Sized_relobj_file::local_got_offset): Likewise.
2629         (Sized_relobj_file::set_local_got_offset): Likewise.
2630         (Sized_relobj_file::get_output_section_offset): Likewise.
2631         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2632         (Sized_relobj_file::do_output_section_offset): Likewise.
2633         (Sized_relobj_file::do_set_section_offset): Likewise.
2634         (Sized_relobj_file::Local_got_offsets): Likewise.
2635         (Sized_relobj_file::local_got_offsets_): Likewise.
2636         (Sized_relobj_file::section_offsets_): Likewise.
2637         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2638         (all constructors).
2639         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2640         (Output_reloc::get_symbol_index): Likewise.
2641         (Output_reloc::local_section_offset): Likewise.
2642         (Output_reloc::get_address): Likewise.
2643         (Output_reloc::symbol_value): Likewise.
2644         (Output_data_got::reserve_slot): Move to class definition.
2645         (Output_data_got::reserve_local): New function.
2646         (Output_data_got::reserve_slot_for_global): Remove.
2647         (Output_data_got::reserve_global): New function.
2648         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2649         (all constructors, two instantiations).
2650         (Output_reloc::get_relobj): New function (two instantiations).
2651         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2652         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2653         (Output_data_reloc::add_global): Adjust type of relobj.
2654         (Output_data_reloc::add_global_relative): Likewise.
2655         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2656         (Output_data_reloc::add_local): Likewise.
2657         (Output_data_reloc::add_local_relative): Likewise.
2658         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2659         (Output_data_reloc::add_local_section): Likewise.
2660         (Output_data_reloc::add_output_section): Likewise.
2661         (Output_data_reloc::add_absolute): Likewise.
2662         (Output_data_reloc::add_target_specific): Likewise.
2663         (Output_data_got::reserve_slot): Move definition here.
2664         (Output_data_got::reserve_local): New function.
2665         (Output_data_got::reserve_global): New function.
2666         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2667         section_offsets_ with accessor function.
2668         (Sized_relobj_file::write_sections): Likewise.
2669         (Sized_relobj_file::do_relocate_sections): Likewise.
2670         * target.h (Sized_target::reserve_local_got_entry): New function.
2671         (Sized_target::reserve_global_got_entry): New function.
2672         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2673         (Target_x86_64::reserve_global_got_entry): New function.
2674         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2675
2676 2011-05-23 Cary Coutant  <ccoutant@google.com>
2677
2678         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2679         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2680         bit when checking got_type.
2681         * incremental.cc (Sized_incremental_binary::setup_readers):
2682         Store symbol table and string table locations; initialize bit vector
2683         of file status flags.
2684         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2685         unchanged files.
2686         (Sized_incremental_binary::do_process_got_plt): New function.
2687         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2688         (Output_section_incremental_inputs::set_final_data_size): Record
2689         file index for each input file.
2690         (Output_section_incremental_inputs::write_got_plt): Store file index
2691         instead of input entry offset for each GOT entry.
2692         * incremental.h
2693         (Incremental_input_entry::Incremental_input_entry): Initialize new
2694         data member.
2695         (Incremental_input_entry::set_offset): Store file index.
2696         (Incremental_input_entry::get_file_index): New function.
2697         (Incremental_input_entry::file_index_): New data member.
2698         (Incremental_binary::process_got_plt): New function.
2699         (Incremental_binary::do_process_got_plt): New function.
2700         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2701         data members.
2702         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2703         (Sized_incremental_binary::set_file_is_unchanged): New function.
2704         (Sized_incremental_binary::file_is_unchanged): New function.
2705         (Sized_incremental_binary::do_process_got_plt): New function.
2706         (Sized_incremental_binary::file_status_): New data member.
2707         (Sized_incremental_binary::main_symtab_loc_): New data member.
2708         (Sized_incremental_binary::main_strtab_loc_): New data member.
2709         * output.cc (Output_data_got::Got_entry::write): Add case
2710         RESERVED_CODE.
2711         (Output_data_got::add_global): Call add_got_entry.
2712         (Output_data_got::add_global_plt): Likewise.
2713         (Output_data_got::add_global_with_rel): Likewise.
2714         (Output_data_got::add_global_with_rela): Likewise.
2715         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2716         (Output_data_got::add_global_pair_with_rela): Likewise.
2717         (Output_data_got::add_local): Call add_got_entry.
2718         (Output_data_got::add_local_plt): Likewise.
2719         (Output_data_got::add_local_with_rel): Likewise.
2720         (Output_data_got::add_local_with_rela): Likewise.
2721         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2722         (Output_data_got::add_local_pair_with_rela): Likewise.
2723         (Output_data_got::reserve_slot): New function.
2724         (Output_data_got::reserve_slot_for_global): New function.
2725         (Output_data_got::add_got_entry): New function.
2726         (Output_data_got::add_got_entry_pair): New function.
2727         (Output_section::add_output_section_data): Edit FIXME.
2728         * output.h
2729         (Output_section_data_build::Output_section_data_build): New
2730         constructor with size parameter.
2731         (Output_data_space::Output_data_space): Likewise.
2732         (Output_data_got::Output_data_got): Initialize new data member; new
2733         constructor with size parameter.
2734         (Output_data_got::add_constant): Call add_got_entry.
2735         (Output_data_got::reserve_slot): New function.
2736         (Output_data_got::reserve_slot_for_global): New function.
2737         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2738         (Output_data_got::add_got_entry): New function.
2739         (Output_data_got::add_got_entry_pair): New function.
2740         (Output_data_got::free_list_): New data member.
2741         * target.h (Sized_target::init_got_plt_for_update): New function.
2742         (Sized_target::register_global_plt_entry): New function.
2743         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2744         Initialize new data member; call init; add constructor with PLT count.
2745         (Output_data_plt_x86_64::init): New function.
2746         (Output_data_plt_x86_64::add_relocation): New function.
2747         (Output_data_plt_x86_64::reserve_slot): New function.
2748         (Output_data_plt_x86_64::free_list_): New data member.
2749         (Target_x86_64::init_got_plt_for_update): New function.
2750         (Target_x86_64::register_global_plt_entry): New function.
2751         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2752         incremental updates.
2753         (Output_data_plt_x86_64::add_relocation): New function.
2754         * testsuite/object_unittest.cc (Object_test): Set default options.
2755
2756 2011-05-16  Ian Lance Taylor  <iant@google.com>
2757
2758         * options.h (class General_options): Make -i a synonym for -r.
2759
2760 2011-05-16  Ian Lance Taylor  <iant@google.com>
2761
2762         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2763
2764 2011-05-10 Cary Coutant  <ccoutant@google.com>
2765
2766         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2767         strip_all (-s).
2768
2769 2011-05-06  Ian Lance Taylor  <iant@google.com>
2770
2771         * layout.cc (Layout::layout): If the output section flags change,
2772         update the ordering.
2773
2774 2011-04-25 Cary Coutant  <ccoutant@google.com>
2775
2776         * incremental-dump.cc (dump_incremental_inputs): Print local
2777         symbol info for each input file.
2778         * incremental.cc
2779         (Output_section_incremental_inputs::set_final_data_size): Add local
2780         symbol info to input file entries in incremental info.
2781         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2782         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2783         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2784         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2785         implementation.
2786         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2787         (Sized_incr_relobj::do_relocate): Write the local symbols.
2788         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2789         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2790         Adjust size of input file header.
2791         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2792         (Incremental_inputs_reader::get_local_symbol_count): New function.
2793         (Incremental_inputs_reader::get_input_section): Adjust size of input
2794         file header.
2795         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2796         (Sized_incr_relobj::This): New typedef.
2797         (Sized_incr_relobj::sym_size): New const data member.
2798         (Sized_incr_relobj::Local_symbol): New struct.
2799         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2800         (Sized_incr_relobj::do_local_symbol_offset): New function.
2801         (Sized_incr_relobj::local_symbol_count_): New data member.
2802         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2803         (Sized_incr_relobj::local_symbol_index_): New data member.
2804         (Sized_incr_relobj::local_symbol_offset_): New data member.
2805         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2806         (Sized_incr_relobj::local_symbols_): New data member.
2807         * object.h (Relobj::output_local_symbol_count): New function.
2808         (Relobj::local_symbol_offset): New function.
2809         (Relobj::do_output_local_symbol_count): New function.
2810         (Relobj::do_local_symbol_offset): New function.
2811         (Sized_relobj::do_output_local_symbol_count): New function.
2812         (Sized_relobj::do_local_symbol_offset): New function.
2813
2814 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2815
2816         * descriptors.cc (set_close_on_exec): New function.
2817         (Descriptors::open): Use set_close_on_exec.
2818         * output.cc (S_ISLNK): Define if not defined.
2819
2820 2011-04-22 Cary Coutant  <ccoutant@google.com>
2821
2822         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2823         global symbol map.
2824         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2825         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2826         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2827         relocations.
2828         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2829         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2830         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2831         * incremental.h
2832         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2833         function.
2834         (Incremental_binary::apply_incremental_relocs): New function.
2835         (Incremental_binary::do_apply_incremental_relocs): New function.
2836         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2837         data member.
2838         (Sized_incremental_binary::add_global_symbol): New function.
2839         (Sized_incremental_binary::global_symbol): New function.
2840         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2841         (Sized_incremental_binary::symbol_map_): New data member.
2842         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2843         * target.h (Sized_target::apply_relocation): New function.
2844         * target-reloc.h (apply_relocation): New function.
2845         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2846
2847 2011-04-22  Doug Kwan  <dougkwan@google.com>
2848
2849         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2850         flag of a SHT_ARM_EXIDX section.
2851         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2852         * testsuite/Makefile.in: Regenerate.
2853         * testsuite/arm_exidx_test.s: New file.
2854         * testsuite/arm_exidx_test.sh: Same.
2855
2856 2011-04-20 Cary Coutant  <ccoutant@google.com>
2857
2858         PR gold/12689
2859         * archive.h (Incremental_archive_entry::Archive_member):
2860         Initialize arg_serial_ (second constructor).
2861
2862 2011-04-17  Ian Lance Taylor  <iant@google.com>
2863
2864         * object.cc (Relocate_info::location): Simplify location string.
2865         * errors.cc (Errors::error_at_location): Don't print program
2866         name.
2867         (Errors::warning_at_location): Likewise.
2868         (Errors::undefined_symbol): Likewise.
2869         * testsuite/debug_msg.sh: Update accordingly.
2870
2871 2011-04-14 Cary Coutant  <ccoutant@google.com>
2872
2873         * gold/layout.cc (Layout::symtab_section_offset): New function.
2874         * gold/layout.h (Layout::symtab_section_offset): New function.
2875         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2876
2877 2011-04-12  Ian Lance Taylor  <iant@google.com>
2878
2879         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2880         with MREMAP_MAYMOVE.
2881         * output.h (class Output_file): Add map_is_allocated_ field.
2882         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2883         not available, provide stubs.  If mremap is not available, #define
2884         it to gold_mremap.
2885         (MREMAP_MAYMOVE): Define if not defined.
2886         (Output_file::Output_file): Initialize map_is_allocated_.
2887         (Output_file::resize): Check map_is_allocated_.
2888         (Output_file::map_anonymous): If mmap fails, use malloc.
2889         (Output_file::unmap): Don't do anything for an anonymous map.
2890         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2891         is not available, provide stubs.
2892         (File_read::View::~View): Use free rather than delete[].
2893         (File_read::make_view): Use malloc rather than new[].  If mmap
2894         fails, use malloc.
2895         (File_read::find_or_make_view): Use malloc rather than new[].
2896         * gold.h: Remove HAVE_REMAP code.
2897         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2898         exists.  Rename mremap to gold_mremap.  If mmap is not available
2899         don't do anything.
2900         * configure, config.in: Rebuild.
2901
2902 2011-04-11  Ian Lance Taylor  <iant@google.com>
2903
2904         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2905         initialize local variable v.
2906
2907 2011-04-11  Cary Coutant  <ccoutant@google.com>
2908
2909         * archive.cc (Archive::include_member): Adjust call to
2910         report_object.
2911         (Add_archive_symbols::run): Track argument serial numbers.
2912         (Lib_group::include_member): Likewise.
2913         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2914         * archive.h (Incremental_archive_entry::Archive_member):
2915         Initialize arg_serial_.
2916         (Archive_member::arg_serial_): New data member.
2917         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2918         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2919         incremental link.
2920         (Sized_dynobj::do_for_all_local_got_entries): New function.
2921         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2922         function.
2923         * fileread.cc (get_mtime): New function.
2924         * fileread.h (get_mtime): New function.
2925         * gold.cc (queue_initial_tasks): Check for incremental update.
2926         (process_incremental_input): New function.
2927         (queue_middle_tasks): Don't force valid target for incremental
2928         update.
2929         * incremental-dump.cc (find_input_containing_global): Adjust
2930         size of symbol info entry.
2931         (dump_incremental_inputs): Dump argument serial number and
2932         in_system_directory flag; bias shndx by 1; print symbol names
2933         when dumping per-file symbol lists; use new symbol info readers.
2934         * incremental.cc
2935         (Output_section_incremental_inputs:update_data_size): New function.
2936         (Sized_incremental_binary::setup_readers): Setup input readers
2937         for each input file; build maps for files added from libraries
2938         and scripts.
2939         (Sized_incremental_binary::check_input_args): New function.
2940         (Sized_incremental_binary::do_check_inputs): Build map of argument
2941         serial numbers to input arguments.
2942         (Sized_incremental_binary::do_file_has_changed): Rename
2943         do_file_is_unchanged to this; compare file modification times.
2944         (Sized_incremental_binary::do_init_layout): New function.
2945         (Sized_incremental_binary::do_reserve_layout): New function.
2946         (Sized_incremental_binary::do_get_input_reader): Remove.
2947         (Sized_incremental_binary::get_symtab_view): New function.
2948         (Incremental_checker::can_incrementally_link_output_file): Remove.
2949         (Incremental_inputs::report_command_line): Exclude --debug options.
2950         (Incremental_inputs::report_archive_begin): Add parameter; track
2951         argument serial numbers; don't put input file entry for archive
2952         before archive members.
2953         (Incremental_inputs::report_archive_end): Put input file entry
2954         for archive after archive members.
2955         (Incremental_inputs::report_object): Add parameter; track argument
2956         serial numbers and in_system_directory flag.
2957         (Incremental_inputs::report_script): Add parameter; track argument
2958         serial numbers.
2959         (Output_section_incremental_inputs::set_final_data_size): Adjust
2960         size of symbol info entry; check for forwarding symbols.
2961         (Output_section_incremental_inputs::write_input_files): Write
2962         in_system_directory flag and argument serial number.
2963         (Output_section_incremental_inputs::write_info_blocks): Map section
2964         indices between incremental info and original input file; store
2965         input section index for each symbol.
2966         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2967         change operator() to visit().
2968         (class Global_got_offset_visitor): Likewise.
2969         (class Global_symbol_visitor_got_plt):
2970         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2971         classes.
2972         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2973         (Sized_incr_relobj::do_read_symbols): New function.
2974         (Sized_incr_relobj::do_layout): New function.
2975         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2976         (Sized_incr_relobj::do_add_symbols): New function.
2977         (Sized_incr_relobj::do_should_include_member): New function.
2978         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2979         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2980         (Sized_incr_relobj::do_section_size): New function.
2981         (Sized_incr_relobj::do_section_name): New function.
2982         (Sized_incr_relobj::do_section_contents): New function.
2983         (Sized_incr_relobj::do_section_flags): New function.
2984         (Sized_incr_relobj::do_section_entsize): New function.
2985         (Sized_incr_relobj::do_section_address): New function.
2986         (Sized_incr_relobj::do_section_type): New function.
2987         (Sized_incr_relobj::do_section_link): New function.
2988         (Sized_incr_relobj::do_section_info): New function.
2989         (Sized_incr_relobj::do_section_addralign): New function.
2990         (Sized_incr_relobj::do_initialize_xindex): New function.
2991         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2992         (Sized_incr_relobj::do_read_relocs): New function.
2993         (Sized_incr_relobj::do_gc_process_relocs): New function.
2994         (Sized_incr_relobj::do_scan_relocs): New function.
2995         (Sized_incr_relobj::do_count_local_symbols): New function.
2996         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2997         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2998         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2999         (Sized_incr_relobj::do_relocate): New function.
3000         (Sized_incr_relobj::do_set_section_offset): New function.
3001         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3002         (Sized_incr_dynobj::do_read_symbols): New function.
3003         (Sized_incr_dynobj::do_layout): New function.
3004         (Sized_incr_dynobj::do_add_symbols): New function.
3005         (Sized_incr_dynobj::do_should_include_member): New function.
3006         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3007         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3008         (Sized_incr_dynobj::do_section_size): New function.
3009         (Sized_incr_dynobj::do_section_name): New function.
3010         (Sized_incr_dynobj::do_section_contents): New function.
3011         (Sized_incr_dynobj::do_section_flags): New function.
3012         (Sized_incr_dynobj::do_section_entsize): New function.
3013         (Sized_incr_dynobj::do_section_address): New function.
3014         (Sized_incr_dynobj::do_section_type): New function.
3015         (Sized_incr_dynobj::do_section_link): New function.
3016         (Sized_incr_dynobj::do_section_info): New function.
3017         (Sized_incr_dynobj::do_section_addralign): New function.
3018         (Sized_incr_dynobj::do_initialize_xindex): New function.
3019         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3020         (make_sized_incremental_object): New function.
3021         (Incremental_library::copy_unused_symbols): New function.
3022         (Incremental_library::do_for_all_unused_symbols): New function.
3023         * incremental.h (enum Incremental_input_flags): New type.
3024         (class Incremental_checker): Remove.
3025         (Incremental_input_entry::Incremental_input_entry): Add argument
3026         serial number.
3027         (Incremental_input_entry::arg_serial): New function.
3028         (Incremental_input_entry::set_is_in_system_directory): New function.
3029         (Incremental_input_entry::is_in_system_directory): New function.
3030         (Incremental_input_entry::arg_serial_): New data member.
3031         (Incremental_input_entry::is_in_system_directory_): New data member.
3032         (class Script_info): Move here from script.h.
3033         (Script_info::Script_info): Add filename parameter.
3034         (Script_info::filename): New function.
3035         (Script_info::filename_): New data member.
3036         (Incremental_script_entry::Incremental_script_entry): Add argument
3037         serial number.
3038         (Incremental_object_entry::Incremental_object_entry): Likewise.
3039         (Incremental_object_entry::add_input_section): Build list of input
3040         sections with map to original shndx.
3041         (Incremental_object_entry::get_input_section_index): New function.
3042         (Incremental_object_entry::shndx_): New data member.
3043         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3044         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3045         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3046         serial number.
3047         (Incremental_inputs::report_archive_begin): Likewise.
3048         (Incremental_inputs::report_object): Likewise.
3049         (Incremental_inputs::report_script): Likewise.
3050         (class Incremental_global_symbol_reader): New class.
3051         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3052         and store flags and input file type.
3053         (Incremental_input_entry_reader::arg_serial): New function.
3054         (Incremental_input_entry_reader::type): Extract type from flags.
3055         (Incremental_input_entry_reader::is_in_system_directory): New function.
3056         (Incremental_input_entry_reader::get_input_section_count): Call
3057         accessor function for type.
3058         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3059         function for type; adjust size of global symbol entry.
3060         (Incremental_input_entry_reader::get_global_symbol_count): Call
3061         accessor function for type.
3062         (Incremental_input_entry_reader::get_object_count): Likewise.
3063         (Incremental_input_entry_reader::get_object_offset): Likewise.
3064         (Incremental_input_entry_reader::get_member_count): Likewise.
3065         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3066         (Incremental_input_entry_reader::get_member_offset): Likewise.
3067         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3068         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3069         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3070         (Incremental_input_entry_reader::get_global_symbol_reader): New
3071         function.
3072         (Incremental_input_entry_reader::get_output_symbol_index): New
3073         function.
3074         (Incremental_input_entry_reader::type_): Remove.
3075         (Incremental_input_entry_reader::flags_): New data member.
3076         (Incremental_inputs_reader::input_file_offset): New function.
3077         (Incremental_inputs_reader::input_file_index): New function.
3078         (Incremental_inputs_reader::input_file): Call input_file_offset.
3079         (Incremental_inputs_reader::input_file_at_offset): New function.
3080         (Incremental_relocs_reader::get_r_type): Reformat.
3081         (Incremental_relocs_reader::get_r_shndx): Reformat.
3082         (Incremental_relocs_reader::get_r_offset): Reformat.
3083         (Incremental_relocs_reader::data): New function.
3084         (Incremental_binary::Incremental_binary): Initialize new data members.
3085         (Incremental_binary::check_inputs): Add cmdline parameter.
3086         (Incremental_binary::file_is_unchanged): Remove.
3087         (Input_reader::arg_serial): New function.
3088         (Input_reader::get_unused_symbol_count): New function.
3089         (Input_reader::get_unused_symbol): New function.
3090         (Input_reader::do_arg_serial): New function.
3091         (Input_reader::do_get_unused_symbol_count): New function.
3092         (Input_reader::do_get_unused_symbol): New function.
3093         (Incremental_binary::input_file_count): New function.
3094         (Incremental_binary::get_input_reader): Change signature to use
3095         index instead of filename.
3096         (Incremental_binary::file_has_changed): New function.
3097         (Incremental_binary::get_input_argument): New function.
3098         (Incremental_binary::get_library): New function.
3099         (Incremental_binary::get_script_info): New function.
3100         (Incremental_binary::init_layout): New function.
3101         (Incremental_binary::reserve_layout): New function.
3102         (Incremental_binary::output_file): New function.
3103         (Incremental_binary::do_check_inputs): New function.
3104         (Incremental_binary::do_file_is_unchanged): Remove.
3105         (Incremental_binary::do_file_has_changed): New function.
3106         (Incremental_binary::do_init_layout): New function.
3107         (Incremental_binary::do_reserve_layout): New function.
3108         (Incremental_binary::do_input_file_count): New function.
3109         (Incremental_binary::do_get_input_reader): Change signature.
3110         (Incremental_binary::input_args_map_): New data member.
3111         (Incremental_binary::library_map_): New data member.
3112         (Incremental_binary::script_map_): New data member.
3113         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3114         new data members.
3115         (Sized_incremental_binary::output_section): New function.
3116         (Sized_incremental_binary::inputs_reader): Add const.
3117         (Sized_incremental_binary::symtab_reader): Add const.
3118         (Sized_incremental_binary::relocs_reader): Add const.
3119         (Sized_incremental_binary::got_plt_reader): Add const.
3120         (Sized_incremental_binary::get_symtab_view): New function.
3121         (Sized_incremental_binary::Inputs_reader): New typedef.
3122         (Sized_incremental_binary::Input_entry_reader): New typedef.
3123         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3124         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3125         (Sized_incremental_binary::do_file_has_changed): New function.
3126         (Sized_incremental_binary::do_init_layout): New function.
3127         (Sized_incremental_binary::do_reserve_layout): New function.
3128         (Sized_input_reader::Inputs_reader): Remove.
3129         (Sized_input_reader::Input_entry_reader): Remove.
3130         (Sized_input_reader::do_arg_serial): New function.
3131         (Sized_input_reader::do_get_unused_symbol_count): New function.
3132         (Sized_input_reader::do_get_unused_symbol): New function.
3133         (Sized_incremental_binary::do_input_file_count): New function.
3134         (Sized_incremental_binary::do_get_input_reader): Change signature;
3135         use index instead of filename.
3136         (Sized_incremental_binary::section_map_): New data member.
3137         (Sized_incremental_binary::input_entry_readers_): New data member.
3138         (class Sized_incr_relobj): New class.
3139         (class Sized_incr_dynobj): New class.
3140         (make_sized_incremental_object): New function.
3141         (class Incremental_library): New class.
3142         * layout.cc (Free_list::num_lists): New static data member.
3143         (Free_list::num_nodes): New static data member.
3144         (Free_list::num_removes): New static data member.
3145         (Free_list::num_remove_visits): New static data member.
3146         (Free_list::num_allocates): New static data member.
3147         (Free_list::num_allocate_visits): New static data member.
3148         (Free_list::init): New function.
3149         (Free_list::remove): New function.
3150         (Free_list::allocate): New function.
3151         (Free_list::dump): New function.
3152         (Free_list::print_stats): New function.
3153         (Layout_task_runner::run): Resize output file for incremental updates.
3154         (Layout::Layout): Initialize new data members.
3155         (Layout::set_incremental_base): New function.
3156         (Layout::init_fixed_output_section): New function.
3157         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3158         incremental updates.
3159         (Layout::create_gold_note): Do not create gold note section for
3160         incremental updates.
3161         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3162         for incremental updates.
3163         (Layout::set_section_offsets): For incremental updates, allocate space
3164         from free list.
3165         (Layout::create_symtab_sections): Layout with offsets relative to
3166         start of section; for incremental updates, allocate space from free
3167         list.
3168         (Layout::create_shdrs): For incremental updates, allocate space from
3169         free list.
3170         (Layout::finish_dynamic_section): For incremental updates, do not
3171         check --as-needed (fixed in subsequent patch).
3172         * layout.h (class Free_list): New class.
3173         (Layout::set_incremental_base): New function.
3174         (Layout::incremental_base): New function.
3175         (Layout::init_fixed_output_section): New function.
3176         (Layout::allocate): New function.
3177         (Layout::incremental_base_): New data member.
3178         (Layout::free_list_): New data member.
3179         * main.cc (main): Print Free_list statistics.
3180         * object.cc (Relobj::finalize_incremental_relocs): Add
3181         clear_counts parameter; clear counts only when clear_counts is set.
3182         (Sized_relobj::Sized_relobj): Initialize new base class.
3183         (Sized_relobj::do_layout): Don't report special sections.
3184         (Sized_relobj::do_for_all_local_got_entries): New function.
3185         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3186         symtab_off to all symbol table offsets.
3187         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3188         * object.h (class Got_offset_list): Move to top of file.
3189         (Object::Object): Allow case where input_file == NULL.
3190         (Object::~Object): Likewise.
3191         (Object::input_file): Assert that input_file != NULL.
3192         (Object::lock): Allow case where input_file == NULL.
3193         (Object::unlock): Likewise.
3194         (Object::is_locked): Likewise.
3195         (Object::token): Likewise.
3196         (Object::release): Likewise.
3197         (Object::is_incremental): New function.
3198         (Object::get_mtime): New function.
3199         (Object::for_all_local_got_entries): New function.
3200         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3201         (Object::set_is_in_system_directory): New function.
3202         (Object::is_in_system_directory): New function.
3203         (Object::do_is_incremental): New function.
3204         (Object::do_get_mtime): New function.
3205         (Object::do_for_all_local_got_entries): New function.
3206         (Object::is_in_system_directory_): New data member.
3207         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3208         (class Sized_relobj_base): New class.
3209         (class Sized_relobj): Derive from Sized_relobj_base.
3210         (class Sized_relobj::Symbols): Redeclare from base class.
3211         (class Sized_relobj::local_got_offset_list): Remove.
3212         (class Sized_relobj::Output_sections): Redeclare from base class.
3213         (class Sized_relobj::do_for_all_local_got_entries): New function.
3214         (class Sized_relobj::write_local_symbols): Add offset parameter.
3215         (class Sized_relobj::local_symbol_offset_): Update comment.
3216         (class Sized_relobj::local_dynsym_offset_): Update comment.
3217         * options.cc (Input_arguments::add_file): Remove const.
3218         * options.h (Input_file_argument::Input_file_argument):
3219         Initialize arg_serial_ (all constructors).
3220         (Input_file_argument::set_arg_serial): New function.
3221         (Input_file_argument::arg_serial): New function.
3222         (Input_file_argument::arg_serial_): New data member.
3223         (Input_arguments::Input_arguments): Initialize file_count_.
3224         (Input_arguments::add_file): Remove const.
3225         (Input_arguments::number_of_input_files): New function.
3226         (Input_arguments::file_count_): New data member.
3227         (Command_line::number_of_input_files): Call
3228         Input_arguments::number_of_input_files.
3229         * output.cc (Output_segment_headers::Output_segment_headers):
3230         Set current size.
3231         (Output_section::Input_section::current_data_size): New function.
3232         (Output_section::Output_section): Initialize new data members.
3233         (Output_section::add_input_section): Don't do merge sections for
3234         an incremental link; allocate space from free list for an
3235         incremental update.
3236         (Output_section::add_output_section_data): Allocate space from
3237         free list for an incremental update.
3238         (Output_section::update_data_size): New function.
3239         (Output_section::set_fixed_layout): New function.
3240         (Output_section::reserve): New function.
3241         (Output_segment::set_section_addresses): Remove const.
3242         (Output_segment::set_section_list_addresses): Remove const; allocate
3243         space from free list for an incremental update.
3244         (Output_segment::set_offset): Adjust size of RELRO segment for an
3245         incremental update.
3246         * output.h (Output_data::current_data_size): Move here from
3247         child classes.
3248         (Output_data::pre_finalize_data_size): New function.
3249         (Output_data::update_data_size): New function.
3250         (Output_section_headers::update_data_size): new function.
3251         (Output_section_data_build::current_data_size): Move to Output_data.
3252         (Output_data_strtab::update_data_size): New function.
3253         (Output_section::current_data_size): Move to Output_data.
3254         (Output_section::set_fixed_layout): New function.
3255         (Output_section::has_fixed_layout): New function.
3256         (Output_section::reserve): New function.
3257         (Output_section::update_data_size): New function.
3258         (Output_section::has_fixed_layout_): New data member.
3259         (Output_section::free_list_): New data member.
3260         (Output_segment::set_section_addresses): Remove const.
3261         (Output_segment::set_section_list_addresses): Remove const.
3262         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3263         New function.
3264         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3265         New function.
3266         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3267         parameter when calling Add_symbols constructor; store argument
3268         serial number for members of a lib group.
3269         (Add_symbols::locks): Allow case where token == NULL.
3270         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3271         (Read_member::~Read_member): New function.
3272         (Read_member::is_runnable): New function.
3273         (Read_member::locks): New function.
3274         (Read_member::run): New function.
3275         (Check_script::~Check_script): New function.
3276         (Check_script::is_runnable): New function.
3277         (Check_script::locks): New function.
3278         (Check_script::run): New function.
3279         (Check_library::~Check_library): New function.
3280         (Check_library::is_runnable): New function.
3281         (Check_library::locks): New function.
3282         (Check_library::run): New function.
3283         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3284         (Add_symbols::library_): New data member.
3285         (class Read_member): New class.
3286         (class Check_script): New class.
3287         (class Check_library): New class.
3288         * reloc.cc (Read_relocs::is_runnable): Allow case where
3289         token == NULL.
3290         (Read_relocs::locks): Likewise.
3291         (Scan_relocs::locks): Likewise.
3292         (Relocate_task::locks): Likewise.
3293         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3294         to clear counters.
3295         (Sized_relobj::incremental_relocs_scan): Fix comment.
3296         (Sized_relobj::do_relocate): Pass output file offset to
3297         write_local_symbols.
3298         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3299         from class declaration.
3300         * script.cc (read_input_script): Allocate Script_info; pass
3301         argument serial number to report_script.
3302         * script.h (class Script_info): Move to incremental.h.
3303         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3304         * symtab.h (Symbol_table::add_from_incrobj): New function.
3305         (Symbol_table::set_file_offset): New function.
3306
3307 2011-04-05  Cary Coutant  <ccoutant@google.com>
3308
3309         * incremental-dump.cc (dump_incremental_inputs): Change signature
3310         to take a Sized_incremental_binary; change caller.  Use readers
3311         in Sized_incremental_binary.
3312         * incremental.cc
3313         (Sized_incremental_binary::find_incremental_inputs_sections):
3314         Rename do_find_incremental_inputs_sections to this.
3315         (Sized_incremental_binary::setup_readers): New function.
3316         (Sized_incremental_binary::do_check_inputs): Check
3317         has_incremental_info_ flag; move setup code to setup_readers;
3318         use input readers.
3319         (Sized_incremental_binary::do_file_is_unchanged): New function.
3320         (Sized_incremental_binary::do_get_input_reader): New function.
3321         * incremental.h (class Incremental_binary): Move to end of file.
3322         (Incremental_binary::file_is_unchanged): New function.
3323         (Incremental_binary::do_file_is_unchanged): New function.
3324         (Incremental_binary::Input_reader): New class.
3325         (Incremental_binary::get_input_reader): New function.
3326         (class Sized_incremental_binary): Move to end of file.
3327         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3328         input section reader classes.
3329         (Sized_incremental_binary::has_incremental_info): New function.
3330         (Sized_incremental_binary::inputs_reader): New function.
3331         (Sized_incremental_binary::symtab_reader): New function.
3332         (Sized_incremental_binary::relocs_reader): New function.
3333         (Sized_incremental_binary::got_plt_reader): New function.
3334         (Sized_incremental_binary::do_file_is_unchanged): New function.
3335         (Sized_incremental_binary::Sized_input_reader): New class.
3336         (Sized_incremental_binary::get_input_reader): New function.
3337         (Sized_incremental_binary::find_incremental_inputs_sections):
3338         Rename do_find_incremental_inputs_sections to this.
3339         (Sized_incremental_binary::setup_readers): New function.
3340         (Sized_incremental_binary::has_incremental_info_): New data member.
3341         (Sized_incremental_binary::inputs_reader_): New data member.
3342         (Sized_incremental_binary::symtab_reader_): New data member.
3343         (Sized_incremental_binary::relocs_reader_): New data member.
3344         (Sized_incremental_binary::got_plt_reader_): New data member.
3345         (Sized_incremental_binary::current_input_file_): New data member.
3346
3347 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3348
3349         PR gold/12640
3350         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3351         violation.
3352
3353 2011-03-30  Cary Coutant  <ccoutant@google.com>
3354
3355         * archive.cc (Archive::include_member): Adjust call to report_object.
3356         (Add_archive_symbols::run): Add script_info to call to
3357         report_archive_begin.
3358         (Lib_group::include_member): Adjust call to report_object.
3359         (Add_lib_group_symbols::run): Adjust call to report_object.
3360         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3361         blocks.  Add object count for script input files.
3362         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3363         script_info parameter; change all callers.
3364         (Incremental_inputs::report_object): Add script_info parameter;
3365         change all callers.
3366         (Incremental_inputs::report_script): Store backpointer to
3367         incremental info entry.
3368         (Output_section_incremental_inputs::set_final_data_size): Record
3369         additional information for scripts.
3370         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3371         * incremental.h (Incremental_script_entry::add_object): New function.
3372         (Incremental_script_entry::get_object_count): New function.
3373         (Incremental_script_entry::get_object): New function.
3374         (Incremental_script_entry::objects_): New data member; adjust
3375         constructor.
3376         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3377         (Incremental_inputs::report_object): Add script_info parameter.
3378         (Incremental_inputs_reader::get_object_count): New function.
3379         (Incremental_inputs_reader::get_object_offset): New function.
3380         * options.cc (Input_arguments::add_file): Return reference to
3381         new input argument.
3382         * options.h (Input_argument::set_script_info): New function.
3383         (Input_argument::script_info): New function.
3384         (Input_argument::script_info_): New data member; adjust all
3385         constructors.
3386         (Input_file_group::add_file): Return reference to new input argument.
3387         (Input_file_lib::add_file): Likewise.
3388         (Input_arguments::add_file): Likewise.
3389         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3390         * script.cc (Parser_closure::Parser_closure): Add script_info
3391         parameter; adjust all callers.
3392         (Parser_closure::script_info): New function.
3393         (Parser_closure::script_info_): New data member.
3394         (read_input_script): Report scripts earlier to incremental info.
3395         (script_add_file): Set script_info in Input_argument.
3396         (script_add_library): Likewise.
3397         * script.h (Script_options::Script_info): Rewrite class.
3398
3399 2011-03-29  Cary Coutant  <ccoutant@google.com>
3400
3401         * archive.cc (Library_base::should_include_member): Move
3402         method here from class Archive.
3403         (Archive::Archive): Initialize base class.
3404         (Archive::should_include_member): Move to base class.
3405         (Archive::do_for_all_unused_symbols): New function.
3406         (Add_archive_symbols::run): Remove redundant access to
3407         incremental_inputs.
3408         (Lib_group::Lib_group): Initialize base class.
3409         (Lib_group::do_filename): New function.
3410         (Lib_group::include_member): Pass pointer to Lib_group to
3411         report_object.
3412         (Lib_group::do_for_all_unused_symbols): New function.
3413         (Add_lib_group_symbols::run): Report archive information for
3414         incremental links.
3415         * archive.h (class Library_base): New base class.
3416         (class Archive): Derive from Library_base.
3417         (Archive::filename): Move to base class.
3418         (Archive::set_incremental_info): Likewise.
3419         (Archive::incremental_info): Likewise.
3420         (Archive::Should_include): Likewise.
3421         (Archive::should_include_member): Likewise.
3422         (Archive::Armap_entry): Remove.
3423         (Archive::Unused_symbol_iterator): Remove.
3424         (Archive::unused_symbols_begin): Remove.
3425         (Archive::unused_symbols_end): Remove.
3426         (Archive::do_filename): New function.
3427         (Archive::do_get_mtime): New function.
3428         (Archive::do_for_all_unused_symbols): New function.
3429         (Archive::task_): Move to base class.
3430         (Archive::incremental_info_): Likewise.
3431         (class Lib_group): Derive from Library_base.
3432         (Lib_group::do_filename): New function.
3433         (Lib_group::do_get_mtime): New function.
3434         (Lib_group::do_for_all_unused_symbols): New function.
3435         (Lib_group::task_): Move to base class.
3436         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3437         function.
3438         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3439         function.
3440         * incremental.cc (Incremental_inputs::report_archive_begin):
3441         Use Library_base; call library's get_mtime; add incremental inputs
3442         entry before members.
3443         (class Unused_symbol_visitor): New class.
3444         (Incremental_inputs::report_archive_end): Use Library_base; use
3445         visitor class to record unused symbols; don't add incremental inputs
3446         entry after members.
3447         (Incremental_inputs::report_object): Use Library_base.
3448         * incremental.h
3449         (Incremental_archive_entry::Incremental_archive_entry): Remove
3450         unused Archive parameter.
3451         (Incremental_inputs::report_archive_begin): Use Library_base.
3452         (Incremental_inputs::report_archive_end): Likewise.
3453         (Incremental_inputs::report_object): Likewise.
3454         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3455         function.
3456         * object.h (Object::for_all_global_symbols): New function.
3457         (Object::do_for_all_global_symbols): New function.
3458         (Sized_relobj::do_for_all_global_symbols): New function.
3459         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3460         function.
3461         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3462         function.
3463
3464 2011-03-27  Ian Lance Taylor  <iant@google.com>
3465
3466         * archive.cc (Archive::interpret_header): Return -1 if something
3467         goes wrong.  Change callers accordingly.
3468
3469 2011-03-25  Cary Coutant  <ccoutant@google.com>
3470
3471         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3472         * testsuite/Makefile.in: Regenerate.
3473
3474 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3475
3476         * plugin.cc (get_view): New.
3477         (Plugin::load): Pass get_view to the plugin.
3478         (Plugin_manager::get_view): New.
3479
3480 2011-03-21  Ian Lance Taylor  <iant@google.com>
3481
3482         * testsuite/final_layout.sh: Rewrite to not use dc.
3483         * testsuite/relro_test.sh: Fail if dc is not present.
3484
3485 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3486
3487         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3488         Change == to -eq.
3489         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3490         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3491         Change == to -eq.
3492         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3493         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3494
3495 2011-03-14  Ian Lance Taylor  <iant@google.com>
3496
3497         * script-sections.cc (Sort_output_sections::script_compare):
3498         Rename from is_before, change return type.
3499         (Sort_output_sections::operator()): Adjust accordingly.
3500
3501 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3502
3503         PR gold/12572
3504         * testsuite/odr_violation2.cc: Add comment to make all error line
3505         numbers double digits.
3506         * testsuite/debug_msg.sh: Adjust expected errors.
3507
3508 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3509
3510         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3511         but mark earlier ones as non-canonical
3512         (offset_to_iterator): Update search target and example
3513         (do_addr2line): Return extra lines in a vector*
3514         (format_file_lineno): Extract from do_addr2line
3515         (one_addr2line): Add vector* out-param
3516         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3517         when a lineno entry appeared last for its instruction
3518         (Dwarf_line_info): Add vector* out-param
3519         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3520         * symtab.cc (Odr_violation_compare): Include the lineno in the
3521         comparison again.
3522         (linenos_from_loc): New. Combine the canonical line for an
3523         address with its other lines.
3524         (True_if_intersect): New. Helper functor to make
3525         std::set_intersection a query.
3526         (detect_odr_violations): Compare sets of lines instead of just
3527         one line for each function. This became less deterministic, but
3528         has fewer false positives.
3529         * symtab.h: Declarations.
3530         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3531         mix an optimized and non-optimized object in the same binary
3532         (odr_violation2.so): Same.
3533         * testsuite/Makefile.in: Regenerate from Makefile.am.
3534         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3535         * testsuite/debug_msg.sh: Update line numbers and add
3536         assertions.
3537         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3538         non-optimized context.
3539         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3540         isn't inlined, and use OdrDerived in an optimized context.
3541         * testsuite/odr_header1.h: Defines OdrDerived, where
3542         optimization will change the
3543         first-instruction-in-the-destructor's file and line number.
3544         * testsuite/odr_header2.h: Defines OdrBase.
3545
3546 2011-03-09  Ian Lance Taylor  <iant@google.com>
3547
3548         * fileread.cc (File_read::clear_views): Don't delete the whole
3549         file view.
3550
3551 2011-03-08  Ian Lance Taylor  <iant@google.com>
3552
3553         PR gold/12525
3554         * fileread.cc: #include <climits>.
3555         (GOLD_IOV_MAX): Define.
3556         (File_read::read_multiple): Limit number of entries by iov_max.
3557         * fileread.h (class File_read): Always set max_readv_entries to
3558         128.
3559
3560 2011-03-07  Ian Lance Taylor  <iant@google.com>
3561
3562         PR gold/12525
3563         * options.h (class General_options): Add -dy and -dn.
3564
3565 2011-03-02  Cary Coutant  <ccoutant@google.com>
3566
3567         * testsuite/script_test_9.t: Add TLS segment.
3568
3569 2011-03-02  Simon Baldwin  <simonb@google.com>
3570
3571         * configure.ac: Add check for gnu_indirect_function support in
3572         the toolchain building binutils.
3573         * configure: Rebuild.
3574
3575 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3576
3577         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3578         plugin only symbols.
3579         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3580         in plugin files as not needed in the symbol table.
3581
3582 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3583
3584         * output.cc (Output_section::add_input_section): Delay fill
3585         generation for section ordering.
3586
3587 2011-02-09  Ian Lance Taylor  <iant@google.com>
3588
3589         PR gold/12316
3590         * object.h (class Sized_relobj): Remove clear_local_symbols.
3591         * reloc.cc (Sized_relobj::do_relocate): Don't call
3592         clear_local_symbols.
3593
3594 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3595
3596         * plugin.cc (is_visible_from_outside): Return true for symbols
3597         in the -u option.
3598
3599 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3600
3601         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3602         filename.
3603
3604 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3605
3606         * icf.h (is_section_foldable_candidate): Change type of parameter
3607         to std::string.
3608         * icf.cc (Icf::find_identical_sections): Change type of local variable
3609         section_name to be std::string.
3610         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3611
3612 2011-01-25  Ian Lance Taylor  <iant@google.com>
3613
3614         * script.cc (script_add_extern): Rewrite to use
3615         add_symbol_reference.
3616
3617 2011-01-25  Doug Kwan  <dougkwan@google.com>
3618
3619         * icf.cc (get_section_contents): Always lock section's object.
3620
3621 2011-01-24  Ian Lance Taylor  <iant@google.com>
3622
3623         * options.h (class General_options): Accept
3624         --no-detect-odr-violations.
3625
3626 2011-01-24  Ian Lance Taylor  <iant@google.com>
3627
3628         * version.cc (version_string): Bump to 1.11.
3629
3630 2011-01-24  Ian Lance Taylor  <iant@google.com>
3631
3632         * plugin.cc (class Plugin_rescan): Define new class.
3633         (Plugin_manager::claim_file): Set any_claimed_.
3634         (Plugin_manager::save_archive): New function.
3635         (Plugin_manager::save_input_group): New function.
3636         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3637         necessary.
3638         (Plugin_manager::new_undefined_symbol): New function.
3639         (Plugin_manager::rescan): New function.
3640         (Plugin_manager::rescannable_defines): New function.
3641         (Plugin_manager::add_input_file): Set any_added_.
3642         * plugin.h (class Plugin_manager): define new fields rescannable_,
3643         undefined_symbols_, any_claimed_, and any_added_.  Declare
3644         Plugin_rescan as friend.  Declare new functions.
3645         (Plugin_manager::Rescannable): Define type.
3646         (Plugin_manager::Rescannable_list): Define type.
3647         (Plugin_manager::Undefined_symbol_list): Define type.
3648         (Plugin_manager::Plugin_manager): Initialize new fields.
3649         * archive.cc (Archive::defines_symbol): New function.
3650         (Add_archive_symbols::run): Pass archive to plugins if any.
3651         * archive.h (class Archive): Declare defines_symbol.
3652         * readsyms.cc (Input_group::~Input_group): New function.
3653         (Finish_group::run): Pass input_group to plugins if any.
3654         * readsyms.h (class Input_group): Declare destructor.
3655         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3656         any.
3657
3658 2011-01-10  Ian Lance Taylor  <iant@google.com>
3659
3660         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3661         section as relro.
3662         (Layout::set_segment_offsets): Reset increase_relro before calling
3663         set_section_addresses a second time.
3664
3665 2011-01-04  Cary Coutant  <ccoutant@google.com>
3666
3667         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3668         sections before NOBITS sections.
3669
3670 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3671
3672         * version.cc (print_version): Update copyright to 2011.
3673
3674 2010-12-23  Cary Coutant  <ccoutant@google.com>
3675
3676         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3677         of OS to this->add.  Add OD parameter to second form of the function.
3678
3679 2010-12-20  Ian Lance Taylor  <iant@google.com>
3680
3681         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3682         second of two consecutive entries with same offset.
3683
3684 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3685
3686         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3687         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3688         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3689         to avoid unneeded links against $(LDADD).
3690         * testsuite/Makefile.in: Regenerate.
3691
3692 2010-12-15  Ian Lance Taylor  <iant@google.com>
3693
3694         PR gold/12324
3695         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3696         for R_X86_64_32 and R_X86_64_PC32.
3697         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3698         ver_matching_def_pic.o.
3699         (ver_matching_def_pic.o): New target.
3700
3701 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3702
3703         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3704         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3705         Move definition before File_read::View member definitions.
3706         (File_read::View::~View): Initialize and hold lock before
3707         updating current_mapped_bytes.
3708
3709 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3710
3711         * dwarf_reader.cc: Remove outdated comment.
3712         * gold-threads.cc: Fix typo in error message.
3713         * archive.cc: Fix typos in comments.
3714         * archive.h: Likewise.
3715         * arm-reloc-property.cc: Likewise.
3716         * arm-reloc-property.h: Likewise.
3717         * arm-reloc.def: Likewise.
3718         * arm.cc: Likewise.
3719         * attributes.h: Likewise.
3720         * cref.cc: Likewise.
3721         * ehframe.cc: Likewise.
3722         * fileread.h: Likewise.
3723         * gold.h: Likewise.
3724         * i386.cc: Likewise.
3725         * icf.cc: Likewise.
3726         * incremental.h: Likewise.
3727         * int_encoding.cc: Likewise.
3728         * layout.h: Likewise.
3729         * main.cc: Likewise.
3730         * merge.h: Likewise.
3731         * object.cc: Likewise.
3732         * object.h: Likewise.
3733         * options.cc: Likewise.
3734         * readsyms.cc: Likewise.
3735         * reduced_debug_output.cc: Likewise.
3736         * reloc.cc: Likewise.
3737         * script-sections.cc: Likewise.
3738         * sparc.cc: Likewise.
3739         * symtab.h: Likewise.
3740         * target-reloc.h: Likewise.
3741         * target.cc: Likewise.
3742         * target.h: Likewise.
3743         * timer.cc: Likewise.
3744         * timer.h: Likewise.
3745         * x86_64.cc: Likewise.
3746
3747 2010-12-09  Cary Coutant  <ccoutant@google.com>
3748
3749         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3750         stack.
3751         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3752         parameter; change all callers.
3753         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3754         * options.h (warn_execstack): New option.
3755
3756 2010-12-07  Doug Kwan  <dougkwan@google.com>
3757
3758         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3759         like function call relocations.
3760
3761 2010-12-07  Ian Lance Taylor  <iant@google.com>
3762
3763         * archive.cc (Archive::get_elf_object_for_member): Permit
3764         punconfigured to be NULL.
3765         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3766         (Archive::include_member): Pass NULL to get_elf_object_for_member
3767         if we searched for the archive and this is the first included
3768         object.
3769
3770 2010-12-01  Ian Lance Taylor  <iant@google.com>
3771
3772         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3773         track_relocs_type_ field.
3774         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3775         Set track_relocs_type_.
3776         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3777         contents when using RELA relocs.
3778         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3779         reloc_map_.
3780         * reloc.cc (Track_relocs::next_addend): New function.
3781         * reloc.h (class Track_relocs): Declare next_addend.
3782
3783 2010-12-01  Ian Lance Taylor  <iant@google.com>
3784
3785         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3786         virtual destructor.
3787
3788 2010-12-01  Ian Lance Taylor  <iant@google.com>
3789
3790         * README: Update compilers known to work and fail.
3791
3792 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3793
3794         * configure.in: For --enable-gold, handle value `default' instead of
3795         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3796         not the default.
3797         * configure: Regenerate.
3798
3799 2010-11-18  Doug Kwan  <dougkwan@google.com>
3800
3801         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3802         and right_alignment to be zero.  Store result alignment only if it is
3803         greater than existing alignment.
3804
3805 2010-11-16  Cary Coutant  <ccoutant@google.com>
3806
3807         PR gold/12220
3808         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3809         Check for ".zdebug_line".
3810
3811 2010-11-16  Doug Kwan  <dougkwan@google.com>
3812             Cary Coutant  <ccoutant@google.com>
3813
3814         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3815         by reference; adjust all callers.
3816         * output.cc (Output_segment::set_section_addresses): Adjust references
3817         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3818         list is empty.
3819         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3820         end at page boundary.
3821
3822 2010-11-16  Cary Coutant  <ccoutant@google.com>
3823
3824         PR gold/12220
3825         * layout.cc (Layout::choose_output_section): Transform names of
3826         compressed sections even when using a script with a SECTIONS clause.
3827         (Layout::output_section_name): Remove code to transform
3828         compressed debug section names.
3829         * output.cc (Output_section::add_input_section): Use uncompressed
3830         section size when tracking input sections.
3831
3832 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3833
3834         * symtab.h (Symbol::NON_PIC_REF): Remove.
3835         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3836         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3837         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3838         (Symbol::use_plt_offset): Take a flags argument and pass it
3839         directly to needs_dynamic_reloc.  Restrict check for undefined
3840         weak symbols to function calls.
3841         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3842         (Target_arm::Scan::global): Use it.
3843         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3844         (Target_arm::Relocate::relocate): Likewise.
3845         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3846         parameter with an r_type parameter.  Use get_reference_flags
3847         to get the flags.
3848         (Target_arm::Relocate::relocate): Update accordingly.
3849         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3850         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3851         (Target_i386::Scan::global): Likewise.
3852         (Target_i386::Relocate::relocate): Likewise.
3853         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3854         parameter with an r_type parameter.  Use get_reference_flags
3855         to get the flags.
3856         (Target_i386::Relocate::relocate): Update accordingly.
3857         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3858         (Target_powerpc::Scan::global): Use it.
3859         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3860         (Target_powerpc::Relocate::relocate): Likewise.
3861         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3862         (Target_sparc::Scan::global): Use it.
3863         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3864         (Target_sparc::Relocate::relocate): Likewise.
3865         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3866         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3867         (Target_x86_64::Scan::global): Likewise.
3868         (Target_x86_64::Relocate::relocate): Likewise.
3869
3870 2010-11-08  Doug Kwan  <dougkwan@google.com>
3871             Cary Coutant  <ccoutant@google.com>
3872
3873         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3874         (Arm_exidx_merge_section::section_contents_): New data member.
3875         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3876         (Arm_input_section::~Arm_input_section): De-allocate memory.
3877         (Arm_input_section::original_contents_): New data member.
3878         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3879         in parameters instead of calling Object::section_contents without
3880         locking.
3881         (Arm_output_section::group_section): New parameter TASK.  Pass it
3882         to callees that need locking objects.
3883         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3884         to lock EXIDX input sections.  Fix a formatting issue.  Call
3885         Arm_exidx_merged_section::build_contents to create merged section
3886         contents.
3887         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3888         to lock object of stub table owner.
3889         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3890         TEXT_SIZE to initialize data member TEXT_SIZE_.
3891         (Arm_exidx_input_section::addralign): Fix typo in comment.
3892         (Arm_exidx_input_section::text_size): New method.
3893         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3894         that require locking objects.  Lock objects before scanning for stubs
3895         and updating local symbols.
3896         (Arm_input_section<big_endian>::init): Copy contents of original
3897         input section.
3898         (Arm_input_section<big_endian>::do_write): Use saved contents of
3899         original input section instead of calling Object::section_contents
3900         without locking.
3901         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3902         size without calling Object::section_size().
3903         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3904         for size.  Allocate a buffer for merged EXIDX entries.
3905         (Arm_exidx_merged_section::build_contents): New method.
3906         (Arm_exidx_merged_section::do_write): Move merge section contents
3907         building code to Arm_exidx_merged_section::build_contetns.  Write
3908         out contetns in buffer instead of building it on the fly.
3909         (Arm_relobj::make_exidx_input_section): Also pass text section size
3910         to Arm_exidx_input_section constructor.
3911         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3912         (Arm_dynobj::do_read_symbols): Fix memory leak.
3913         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3914         * target.h: (class Task): Add forward declaration.
3915         (Target::relax): Add new parameter TASK and pass it to
3916         Target::do_relax().
3917         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3918
3919 2010-11-05  Cary Coutant  <ccoutant@google.com>
3920
3921         PR gold/10708
3922         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3923         object when reading from the file.
3924         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3925         second layout pass.
3926         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3927         when reading section contents.
3928         (get_section_contents): Likewise.
3929         (icf::find_identical_sections): Likewise.
3930         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3931         object when reading from the file.
3932         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3933         the object when doing deferred section layout.
3934
3935 2010-11-03  Nick Clifton  <nickc@redhat.com>
3936
3937         PR gold/12001
3938         * script.h (class Symbol_assignment: name): New member.  Returns
3939         the name of the symbol.
3940         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3941         Returns true if the given symbol name is on the list of
3942         assignments wating to be processed.
3943         * archive.cc (should_incldue_member): If the symbol is undefined,
3944         check to see if it is on the list of symbols pending assignment.
3945
3946 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3947
3948         * script-sections.cc (Script_sections::find_memory_region): Check
3949         for a NULL output section pointer.
3950
3951 2010-10-29  Doug Kwan  <dougkwan@google.com>
3952
3953         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3954         Output_section::add_relaxed_input_section.
3955         * output.cc (Output_section::add_relaxed_input_section): Add new
3956         arguments LAYOUT and NAME.  Set section order index.
3957         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3958         Copy section order index.
3959         * output.h (Output_section::add_relaxed_input_section): Add new
3960         arguments LAYOUT and NAME.
3961
3962 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3963
3964         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3965         NATIVE_OR_CROSS_LINKER.
3966         * testsuite/Makefile.in: Regenerate.
3967
3968 2010-10-20  Doug Kwan  <dougkwan@google.com>
3969
3970         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3971         without SHF_LINK_ORDER flags.
3972         * layout.cc (Layout::choose_output_section): Do not filter
3973         SHF_LINK_ORDER flag in a relocatable link.
3974
3975 2010-10-17  Cary Coutant  <ccoutant@google.com>
3976
3977         * output.h (Output_segment::set_section_addresses): Change function
3978         signature.  Update all callers.
3979         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3980         sections.
3981         (Output_segment::set_section_addresses): Align after last TLS
3982         section.  Add padding before last relro section instead of after.
3983
3984 2010-10-17  Doug Kwan  <dougkwan@google.com>
3985
3986         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3987         GOT output section to be writable.
3988
3989 2010-10-14  Cary Coutant  <ccoutant@google.com>
3990
3991         * debug.h (DEBUG_INCREMENTAL): New flag.
3992         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3993         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3994         mode.
3995         * incremental.cc (report_command_line): Ignore all forms of
3996         --incremental.
3997         * layout.cc (Layout::Layout): Check parameters for incremental link
3998         mode.
3999         * options.cc (General_options::parse_incremental): New function.
4000         (General_options::parse_no_incremental): New function.
4001         (General_options::parse_incremental_full): New function.
4002         (General_options::parse_incremental_update): New function.
4003         (General_options::incremental_mode_): New data member.
4004         (General_options::finalize): Check incremental_mode_.
4005         * options.h (General_options): Update help text for --incremental.
4006         Add --no-incremental, --incremental-full, --incremental-update.
4007         (General_options::Incremental_mode): New enum type.
4008         (General_options::incremental_mode): New function.
4009         (General_options::incremental_mode_): New data member.
4010         * parameters.cc (Parameters::incremental_mode_): New data member.
4011         (Parameters::set_options): Set incremental_mode_.
4012         (Parameters::set_incremental_full): New function.
4013         (Parameters::incremental): New function.
4014         (Parameters::incremental_update): New function.
4015         (set_parameters_incremental_full): New function.
4016         * parameters.h (Parameters::set_incremental_full): New function.
4017         (Parameters::incremental): New function.
4018         (Parameters::incremental_update): New function.
4019         (Parameters::incremental_mode_): New data member.
4020         (set_parameters_incremental_full): New function.
4021         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4022         incremental link mode.
4023         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4024         (Sized_relobj::do_relocate_sections): Likewise.
4025         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4026         option.
4027         * testsuite/Makefile.in: Regenerate.
4028         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4029
4030 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4031
4032         * script-sections.h (class Script_sections): Make
4033         Sections_elements typedef public.
4034         * script-sections.cc (class Sort_output_sections): Add elements_
4035         field.  Add constructor which sets it; change all callers.
4036         (Sort_output_sections::is_before): New function.
4037         (Sort_output_sections::operator()): Call is_before.
4038         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4039         conditional.
4040         * testsuite/script_test_10.sh: New test. Test script section
4041         order.
4042         * testsuite/script_test_10.t: Likewise.
4043         * testsuite/script_test_10.s: Likewise.
4044         * testsuite/Makefile.am: Wrap the cross linker tests and the
4045         common tests into NATIVE_OR_CROSS_LINKER.
4046         (check_SCRIPTS): Add script_test_10.sh.
4047         (check_DATA): Add script_test_10.stdout.
4048         (script_test_10.o, script_test_10): New targets.
4049         (script_test_10.stdout): New target.
4050         * configure, testsuite/Makefile.in: Regenerate.
4051
4052 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4053
4054         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4055         error for the deprecated relocations.
4056         (Target_arm::Scan::global): Likewise.
4057         (Target_arm::Relocate::relocate): Likewise.
4058
4059 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4060
4061         * fileread.cc (Input_file::find_file): Initialize *found_name
4062         and *namep when using the fallback search for case 4.
4063
4064 2010-10-11  Cary Coutant  <ccoutant@google.com>
4065
4066         * options.h (class General_options): Redefine -z lazy as an alias for
4067         the negation of -z now.
4068
4069 2010-10-11  Ian Lance Taylor  <iant@google.com>
4070
4071         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4072         binding.
4073
4074 2010-10-06  Nick Clifton  <nickc@redhat.com>
4075
4076         * script-sections.cc(class Memory_region): Remove
4077         current_lma_offset_ field.  Rename current_vma_offset_ to
4078         current_offset_.  Add last_section_ field.
4079         (Memory_region::get_current_vma_address): Rename to
4080         get_current_address.
4081         (Memory_region::get_current_lma_address): Delete.
4082         (Memory_region::increment_vma_offset): Rename to
4083         increment_offset.
4084         (Memory_region::increment_lma_offset): Delete.
4085         (Memory_region::attributes_compatible): New method.  Returns
4086         true if the provided section is compatible with the region.
4087         (Memory_region::get_last_section): New method.  Returns the last
4088         section to use the region.
4089         (Memory_region::set_last_section): New method.  Stores the last
4090         section to use the region.
4091         (Script_sections::block_in_region): New method.  Returns true if
4092         a block of memory is contained within a region.
4093         (Script_sections::find_memory_region): New method.  Locates a
4094         memory region to be used to set a VMA or LMA address.
4095         (Output_section_definition::set_section_addresses): Add code to
4096         check for addresses set by memory regions.
4097         (Output_segment::set_section_addresses): Remove memory region
4098         walking code.
4099         (Script_sections::create_segment): Add a warning if a header
4100         segment is created outside of any region.
4101         * script-sections.h (class Script_sections): Add prototypes for
4102         find_memory_region and block_in_region methods.
4103         * testsuite/memory_test.s: Use .long instead of .word.
4104         * testsuite/memory_test.t: Add some more output sections.
4105         * testsuite/memory_test.sh: Update expected output.
4106
4107 2010-10-02  Doug Kwan  <dougkwan@google.com>
4108
4109         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4110         defintion to symtab.h
4111         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4112         declaration to defintion.
4113
4114 2010-10-01  Nick Clifton  <nickc@redhat.com>
4115
4116         * expression.cc (eval): Replace dummy argument with NULL.
4117         (eval_maybe_dot): Check for a NULL result section pointer.
4118         (Symbol_expression::value): Likewise.
4119         (Dot_expression::value): Likewise.
4120         (BINARY_EXPRESSION): Likewise.
4121         (Max_expression::value): Likewise.
4122         (Min_expression::value): Likewise.
4123         (Absolute_expression::value): Likewise.
4124         (Addr_expression::value_from_output_section): Likewise.
4125         (Loaddddr_expression::value_from_output_section): Likewise.
4126         (Segment_start_expression::value): Likewise.
4127         * script-sections.cc
4128         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4129         argument with NULL.
4130         (Sections_elememt_dot_assignment::set_section_addresses):
4131         Likewise.
4132         (Output_data_expression::do_write_to_buffer): Likewise.
4133         (Output_section_definition::finalize_symbols): Likewise.
4134         (Output_section_definition::set_section_addresses): Likewise.
4135
4136 2010-09-30  Doug Kwan  <dougkwan@google.com>
4137
4138         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4139
4140 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4141
4142         * target.h (Target::can_icf_inline_merge_sections): New virtual
4143         function.
4144         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4145         virtual function.
4146         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4147         virtual function.
4148         * icf.cc (get_section_contents): Inline merge sections only when
4149         target allows it.
4150
4151 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4152
4153         * configure: Regenerate.
4154
4155 2010-09-17  Ian Lance Taylor  <iant@google.com>
4156
4157         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4158         * testsuite/Makefile.am (memory_test.o): New target.
4159         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4160         memory_test.t.
4161         * testsuite/Makefile.in: Rebuild.
4162
4163 2010-09-17  Doug Kwan  <dougkwan@google.com>
4164
4165         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4166         defintion if relocation uses GOT entries of the symbol.
4167         * testsuite/icf_safe_test.sh: Fix test.
4168         * testsuite/icf_safe_so_test.sh: Fix test.
4169
4170 2010-09-16  Cary Coutant  <ccoutant@google.com>
4171
4172         * script_sections.cc (class Memory_region): Remove "NULL" from
4173         vector initializations.
4174
4175 2010-09-15  Cary Coutant  <ccoutant@google.com>
4176
4177         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4178         Resolve forwarding symbols.
4179
4180 2010-09-15  Doug Kwan  <dougkwan@google.com>
4181
4182         * gold/testsuite/script_test_3.t: Add ARM special sections.
4183         * gold/testsuite/script_test_4.t: Same.
4184         * gold/testsuite/script_test_5.t: Same.
4185         * gold/testsuite/script_test_6.t: Same.
4186         * gold/testsuite/script_test_7.t: Same.
4187         * gold/testsuite/script_test_7.t: Same.
4188         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4189
4190 2010-09-14  Cary Coutant  <ccoutant@google.com>
4191
4192         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4193         (Target_x86_64::Relocate::relocate_tls): Replace check for
4194         saw_tls_block_reloc_ with test for executable section.
4195
4196 2010-09-12  Cary Coutant  <ccoutant@google.com>
4197
4198         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4199         position-independent executables to shared libraries need dynamic
4200         relocations.
4201         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4202         position-independent executables.
4203         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4204         * testsuite/Makefile.in: Regenerate.
4205
4206 2010-09-10  Nick Clifton  <nickc@redhat.com>
4207
4208         PR gold/11997
4209         * testsuite/memory_test.t: Discard any sections that are not
4210         needed.
4211
4212 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4213
4214         PR gold/11996
4215         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4216         "This::" to work around a bug in gcc 4.2.
4217
4218         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4219
4220 2010-09-09  Rafael Espindola  <espindola@google.com>
4221
4222         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4223         sections with different PF_X flags in the same segment.
4224         (Layout::find_first_load_seg): Search all segments to find the first
4225         one.
4226         * options.h (rosegment): New.
4227
4228 2010-09-08  Rafael Espindola  <espindola@google.com>
4229
4230         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4231
4232 2010-09-08  Doug Kwan  <dougkwan@google.com>
4233
4234         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4235         (Arm_relobj::do_relocate_sections): Add new parameter for output
4236         file to match the parent.
4237         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4238         of local symbols instead of input values.  Update code to track
4239         changes in gold::relocate_section.
4240         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4241         (Sized_relobj::compute_final_local_value_internal): New methods.
4242         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4243         body into private version of Sized_relobj::compute_final_local_value.
4244         Call the inline method.
4245         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4246         merged symbol value if there is one.
4247         (Symbol_value::has_output_value): New method defintiion.
4248         (Sized_relobj::Compute_final_local_value_status): New enum type.
4249         (Sized_relobj::compute_final_local_value): New methods.
4250         (Sized_relobj::compute_final_local_value_internal): New methods.
4251         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4252         and arm_cortex_a8.sh.
4253         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4254         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4255         New tests.
4256         * Makefile.in: Regenerate.
4257         * testsuite/arm_bl_out_of_range.s: Update test.
4258         * testsuite/thumb_bl_out_of_range.s: Ditto.
4259         * testsuite/thumb_blx_out_of_range.s: Ditto.
4260         * testsuite/arm_branch_out_of_range.sh: New file.
4261         * testsuite/arm_cortex_a8.sh: Ditto.
4262         * testsuite/arm_cortex_a8_b.s: Ditto.
4263         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4264         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4265         * testsuite/arm_cortex_a8_bl.s: Ditto.
4266         * testsuite/arm_cortex_a8_blx.s: Ditto.
4267         * testsuite/arm_cortex_a8_local.s: Ditto.
4268         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4269         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4270
4271 2010-09-08  Rafael Espindola  <espindola@google.com>
4272
4273         * Makefile.am (memory_test.stdout): Run readelf with -W.
4274         * Makefile.in: Regenerate.
4275         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4276         64 bit output.
4277
4278 2010-09-08  Rafael Espindola  <espindola@google.com>
4279
4280         * script-sections.cc (Script_sections::add_memory_region): Convert
4281         field precision to int.
4282         * script.cc (script_set_section_region, script_set_section_region):
4283         Convert field precision to int.
4284
4285 2010-09-08  Rafael Espindola  <espindola@google.com>
4286
4287         * arm.cc (do_finalize_sections): Create the __exidx_start and
4288         __exdix_end symbols even when the section is missing.
4289
4290 2010-09-08  Nick Clifton  <nickc@redhat.com>
4291
4292         * README: Remove claim that MEMORY is not supported.
4293         * expression.cc (script_exp_function_origin)
4294         (script_exp_function_length): Move from here to ...
4295         * script.cc: ... here.
4296         (script_set_section_region, script_add_memory)
4297         (script_parse_memory_attr, script_include_directive): New
4298         functions.
4299         * script-sections.cc
4300         (class Memory_region): New class.
4301         (class Output_section_definition): Add set_memory_region,
4302         set_section_vma, set_section_lma and get_section_name methods.
4303         (class Script_Sections): Add add_memory_region,
4304         find_memory_region, find_memory_region_origin,
4305         find_memory_region_length and set_memory_region methods.
4306         Have set_section_addresses method walk the list of set memory
4307         regions.
4308         Extend the print methos to display memory regions.
4309         * script-sections.h: Add prototypes for new methods.
4310         Add enum for MEMORY region attributes.
4311         * yyscript.y: Add support for parsing MEMORY regions.
4312         * script-c.h: Add prototypes for new functions.
4313         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4314         * testsuite/Makefile.in: Regenerate.
4315         * testsuite/memory_test.sh: New script.
4316         * testsuite/memory_test.s: New assembler source file.
4317         * testsuite/memory_test.t: New linker script.
4318
4319 2010-08-27  Doug Kwan  <dougkwan@google.com>
4320
4321         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4322         reference override an existing dynamic weak reference.
4323         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4324         * testsuite/Makefile.in: Regenerate.
4325         * testsuite/dyn_weak_ref.sh: New file.
4326         * testsuite/dyn_weak_ref_1.c: Ditto.
4327         * testsuite/dyn_weak_ref_2.c: Ditto.
4328
4329 2010-08-27  Ian Lance Taylor  <iant@google.com>
4330
4331         * incremental.h (class Incremental_input_entry): Add virtual
4332         destructor.
4333
4334 2010-08-27  Ian Lance Taylor  <iant@google.com>
4335
4336         * testsuite/start_lib_test_3.c: Mark t3 as used.
4337
4338 2010-08-27  Nick Clifton  <nickc@redhat.com>
4339
4340         * options.cc (version_script): Fix small typo in previous
4341         whitespace tidyup.
4342
4343 2010-08-25  Nick Clifton  <nickc@redhat.com>
4344
4345         * archive.cc: Formatting fixes: Remove whitespace between
4346         typename and following asterisk.  Remove whitespace between
4347         function name and opening parenthesis.
4348         * archive.h: Likewise.
4349         * arm.cc: Likewise.
4350         * attributes.cc: Likewise.
4351         * attributes.h: Likewise.
4352         * common.cc: Likewise.
4353         * copy-relocs.cc: Likewise.
4354         * dirsearch.h: Likewise.
4355         * dynobj.cc: Likewise.
4356         * ehframe.cc: Likewise.
4357         * ehframe.h: Likewise.
4358         * expression.cc: Likewise.
4359         * fileread.cc: Likewise.
4360         * fileread.h: Likewise.
4361         * gc.h: Likewise.
4362         * gold-threads.cc: Likewise.
4363         * gold.cc: Likewise.
4364         * i386.cc: Likewise.
4365         * icf.h: Likewise.
4366         * incremental-dump.cc: Likewise.
4367         * incremental.cc: Likewise.
4368         * layout.cc: Likewise.
4369         * layout.h: Likewise.
4370         * main.cc: Likewise.
4371         * merge.cc: Likewise.
4372         * merge.h: Likewise.
4373         * object.cc: Likewise.
4374         * object.h: Likewise.
4375         * options.cc: Likewise.
4376         * options.h: Likewise.
4377         * output.cc: Likewise.
4378         * output.h: Likewise.
4379         * plugin.cc: Likewise.
4380         * plugin.h: Likewise.
4381         * powerpc.cc: Likewise.
4382         * reloc.cc: Likewise.
4383         * script-c.h: Likewise.
4384         * script-sections.cc: Likewise.
4385         * script.cc: Likewise.
4386         * stringpool.cc: Likewise.
4387         * symtab.cc: Likewise.
4388         * symtab.h: Likewise.
4389         * target.cc: Likewise.
4390         * timer.cc: Likewise.
4391         * timer.h: Likewise.
4392         * version.cc: Likewise.
4393         * x86_64.cc: Likewise.
4394
4395 2010-08-24  Nick Clifton  <nickc@redhat.com>
4396
4397         PR 11899
4398         * layout.cc (segment_precedes): Sort segments by their physical
4399         addresses, if they have been set.
4400
4401 2010-08-23  Cary Coutant  <ccoutant@google.com>
4402
4403         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4404         symbols data.
4405         (Lib_group::include_member): Unlock object after deleting its
4406         symbols data.
4407         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4408         the bug fixed here.
4409
4410 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4411             Cary Coutant  <ccoutant@google.com>
4412
4413         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4414         constructor, and set_blocker.
4415         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4416         readsyms_blocker_.
4417         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4418         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4419         * testsuite/Makefile.am (start_lib_test): New test case.
4420         * testsuite/Makefile.in: Regenerate.
4421         * testsuite/start_lib_test_main.c: New file.
4422         * testsuite/start_lib_test_1.c: New file.
4423         * testsuite/start_lib_test_2.c: New file.
4424         * testsuite/start_lib_test_3.c: New file.
4425
4426 2010-08-19  Ian Lance Taylor  <iant@google.com>
4427
4428         * Makefile.in: Rebuild with automake 1.11.1.
4429         * aclocal.m4: Likewise.
4430         * testsuite/Makefile.in: Likewise.
4431
4432 2010-08-19  Ian Lance Taylor  <iant@google.com>
4433
4434         PR 10893
4435         * i386.cc (class Output_data_plt_i386): Update declarations.
4436         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4437         local_ifuncs_ fields.
4438         (Target_i386::do_plt_section_for_global): New function.
4439         (Target_i386::do_plt_section_for_local): New function.
4440         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4441         parameter; change all callers.  Initialize global_ifuncs_ and
4442         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4443         __rel_iplt_end.
4444         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4445         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4446         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4447         symbols.
4448         (Target_i386::make_plt_section): New function, broken out of
4449         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4450         (Target_i386::make_plt_entry): Call make_plt_section.
4451         (Target_i386::make_local_ifunc_plt_entry): New function.
4452         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4453         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4454         R_386_IRELATIVE to switch.
4455         (Target_i386::Scan::global): Likewise.
4456         (Target_i386::Relocate::relocate): Likewise.
4457         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4458         switch.
4459         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4460         (Target_x86_64::do_plt_section_for_global): New function.
4461         (Target_x86_64::do_plt_section_for_local): New function.
4462         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4463         parameter; change all callers.  If doing a static link define
4464         __rela_iplt_start and __rela_iplt_end.
4465         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4466         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4467         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4468         to point to .plt.
4469         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4470         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4471         switch.
4472         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4473         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4474         R_X86_64_IRELATIVE to switch.
4475         (Target_x86_64::Scan::global): Likewise.
4476         (Target_x86_64::Relocate::relocate): Likewise.
4477         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4478         switch.
4479         * target.h (class Target): Add plt_section_for_global and
4480         plt_section_for_local functions.  Add do_plt_section_for_global
4481         and do_plt_section_for_local virtual functions.
4482         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4483         clarifying comments.
4484         (Symbol::use_plt_offset): Handle IFUNC symbol.
4485         * object.cc (Sized_relobj::Sized_relobj): Initialize
4486         local_plt_offsets_.
4487         (Sized_relobj::local_has_plt_offset): New function.
4488         (Sized_relobj::local_plt_offset): New function.
4489         (Sized_relobj::set_local_plt_offset): New function.
4490         (Sized_relobj::do_count): Handle IFUNC symbol.
4491         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4492         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4493         is_ifunc_symbol functions.
4494         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4495         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4496         local_plt_offsets_ field.
4497         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4498         * output.h (class Output_section_data): Add non-const
4499         output_section function.
4500         (class Output_data_got): Update declarations.
4501         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4502         Add use_plt_offset parameter to global and local constructors.
4503         Change all callers.  Change local_sym_index_ field to 31 bits.
4504         Change GSYM_CODE and CONSTANT_CODE accordingly.
4505         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4506         doing a static link don't set sh_link field.
4507         (Output_data_got::Got_entry::write): Use PLT offset if
4508         appropriate.
4509         (Output_data_got::add_global_plt): New function.
4510         (Output_data_got::add_local_plt): New function.
4511         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4512         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4513         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4514         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4515         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4516         IFUNC conditional.
4517         * testsuite/ifunc-sel.h: New file.
4518         * testsuite/ifuncmain1.c: New file.
4519         * testsuite/ifuncmain1vis.c: New file.
4520         * testsuite/ifuncmod1.c: New file.
4521         * testsuite/ifuncdep2.c: New file.
4522         * testsuite/ifuncmain2.c: New file.
4523         * testsuite/ifuncmain3.c: New file.
4524         * testsuite/ifuncmod3.c: New file.
4525         * testsuite/ifuncmain4.c: New file.
4526         * testsuite/ifuncmain5.c: New file.
4527         * testsuite/ifuncmod5.c: New file.
4528         * testsuite/ifuncmain6pie.c: New file.
4529         * testsuite/ifuncmod6.c: New file.
4530         * testsuite/ifuncmain7.c: New file.
4531         * configure, testsuite/Makefile.in: Rebuild.
4532
4533 2010-08-18  Ian Lance Taylor  <iant@google.com>
4534
4535         * incremental.cc
4536         (Output_section_incremental_inputs::write_input_files): Add cast
4537         to avoid signed/unsigned comparison warning.
4538         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4539
4540 2010-08-12  Cary Coutant  <ccoutant@google.com>
4541
4542         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4543
4544 2010-08-13  Ian Lance Taylor  <iant@google.com>
4545
4546         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4547
4548 2010-08-12  Cary Coutant  <ccoutant@google.com>
4549             Doug Kwan  <dougkwan@google.com>
4550
4551         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4552         defintion overrides non-weak undef, remember that the original undef
4553         is not weak.
4554         * symtab.cc (Symbol_table::sized_write_global): For undef without
4555         an original weak binding, set binding to global in output.
4556         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4557         * testsuite/Makefile.in: Regenerate.
4558         * testsuite/strong_ref_weak_def.sh: New file.
4559         * testsuite/strong_ref_weak_def_1.c: Ditto.
4560         * testsuite/strong_ref_weak_def_2.c: Ditto.
4561
4562 2010-08-12  Cary Coutant  <ccoutant@google.com>
4563
4564         * testsuite/incremental_test.sh: Rewrite.
4565         * testsuite/incremental_test_1.c: Rewrite.
4566         * testsuite/incremental_test_2.c: Rewrite.
4567
4568 2010-08-12  Cary Coutant  <ccoutant@google.com>
4569
4570         * arm.cc (Target_arm::got_size): Add const.
4571         (Target_arm::got_entry_count): New function.
4572         (Target_arm::plt_entry_count): New function.
4573         (Target_arm::first_plt_entry_offset): New function.
4574         (Target_arm::plt_entry_size): New function.
4575         (Output_data_plt_arm::entry_count): New function.
4576         (Output_data_plt_arm::first_plt_entry_offset): New function.
4577         (Output_data_plt_arm::get_plt_entry_size): New function.
4578         * i386.cc (Target_i386::got_size): Add const.
4579         (Target_i386::got_entry_count): New function.
4580         (Target_i386::plt_entry_count): New function.
4581         (Target_i386::first_plt_entry_offset): New function.
4582         (Target_i386::plt_entry_size): New function.
4583         (Output_data_plt_i386::entry_count): New function.
4584         (Output_data_plt_i386::first_plt_entry_offset): New function.
4585         (Output_data_plt_i386::get_plt_entry_size): New function.
4586         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4587         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4588         * incremental.cc: Include target.h.
4589         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4590         parameter.  Adjust all callers.  Find incremental_got_plt section.
4591         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4592         section.
4593         (Output_section_incremental_inputs::set_final_data_size): Calculate
4594         size of incremental_got_plt section.
4595         (Output_section_incremental_inputs::do_write): Write the
4596         incremental_got_plt section.
4597         (Got_plt_view_info): New struct.
4598         (Local_got_offset_visitor): New class.
4599         (Global_got_offset_visitor): New class.
4600         (Global_symbol_visitor_got_plt): New class.
4601         (Output_section_incremental_inputs::write_got_plt): New function.
4602         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4603         Add parameter.  Adjust all callers.
4604         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4605         (Incremental_inputs::got_plt_section): New function.
4606         (Incremental_inputs::got_plt_section_): New data member.
4607         (Incremental_got_plt_reader): New class.
4608         * layout.cc (Layout::create_incremental_info_sections): Add the
4609         incremental_got_plt section.
4610         * object.h (Got_offset_list::get_list): New function.
4611         (Got offset_list::for_all_got_offsets): New function.
4612         (Sized_relobj::local_got_offset_list): New function.
4613         * powerpc.cc (Target_powerpc::got_size): Add const.
4614         (Target_powerpc::got_entry_count): New function.
4615         (Target_powerpc::plt_entry_count): New function.
4616         (Target_powerpc::first_plt_entry_offset): New function.
4617         (Target_powerpc::plt_entry_size): New function.
4618         (Output_data_plt_powerpc::entry_count): New function.
4619         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4620         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4621         * sparc.cc (Target_sparc::got_size): Add const.
4622         (Target_sparc::got_entry_count): New function.
4623         (Target_sparc::plt_entry_count): New function.
4624         (Target_sparc::first_plt_entry_offset): New function.
4625         (Target_sparc::plt_entry_size): New function.
4626         (Output_data_plt_sparc::entry_count): New function.
4627         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4628         (Output_data_plt_sparc::get_plt_entry_size): New function.
4629         * symtab.h (Symbol::got_offset_list): New function.
4630         (Symbol_table::for_all_symbols): New function.
4631         * target.h (Sized_target::got_entry_count): New function.
4632         (Sized_target::plt_entry_count): New function.
4633         (Sized_target::plt_entry_size): New function.
4634         * x86_64.cc (Target_x86_64::got_size): Add const.
4635         (Target_x86_64::got_entry_count): New function.
4636         (Target_x86_64::plt_entry_count): New function.
4637         (Target_x86_64::first_plt_entry_offset): New function.
4638         (Target_x86_64::plt_entry_size): New function.
4639         (Output_data_plt_x86_64::entry_count): New function.
4640         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4641         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4642
4643 2010-08-12  Cary Coutant  <ccoutant@google.com>
4644
4645         * archive.cc: Include incremental.h.
4646         (Archive::Archive): Initialize incremental_info_.
4647         (Archive::include_member): Record archive members in incremental info.
4648         (Add_archive_symbols::run): Record begin and end of an archive in
4649         incremental info.
4650         (Lib_group::include_member): Record objects in incremental info.
4651         * archive.h (Incremental_archive_entry): Forward declaration.
4652         (Archive::set_incremental_info): New member function.
4653         (Archive::incremental_info): New member function.
4654         (Archive::Unused_symbol_iterator): New class.
4655         (Archive::unused_symbols_begin): New member function.
4656         (Archive::unused_symbols_end): New member function.
4657         (Archive::incremental_info_): New data member.
4658         * incremental-dump.cc (find_input_containing_global): New function.
4659         (dump_incremental_inputs): Dump new incremental info sections.
4660         * incremental.cc: Include symtab.h.
4661         (Output_section_incremental_inputs): New class.
4662         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4663         new incremental info sections.
4664         (Sized_incremental_binary::do_check_inputs): Likewise.
4665         (Incremental_inputs::report_archive): Remove.
4666         (Incremental_inputs::report_archive_begin): New function.
4667         (Incremental_inputs::report_archive_end): New function.
4668         (Incremental_inputs::report_object): New function.
4669         (Incremental_inputs::finalize_inputs): Remove.
4670         (Incremental_inputs::report_input_section): New function.
4671         (Incremental_inputs::report_script): Rewrite.
4672         (Incremental_inputs::finalize): Do nothing but finalize string table.
4673         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4674         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4675         (Incremental_inputs::create_data_sections): New function.
4676         (Incremental_inputs::relocs_entsize): New function.
4677         (Output_section_incremental_inputs::set_final_data_size): New function.
4678         (Output_section_incremental_inputs::do_write): New function.
4679         (Output_section_incremental_inputs::write_header): New function.
4680         (Output_section_incremental_inputs::write_input_files): New function.
4681         (Output_section_incremental_inputs::write_info_blocks): New function.
4682         (Output_section_incremental_inputs::write_symtab): New function.
4683         * incremental.h (Incremental_script_entry): Forward declaration.
4684         (Incremental_object_entry): Forward declaration.
4685         (Incremental_archive_entry): Forward declaration.
4686         (Incremental_inputs): Forward declaration.
4687         (Incremental_inputs_header_data): Remove.
4688         (Incremental_inputs_header): Remove.
4689         (Incremental_inputs_header_write): Remove.
4690         (Incremental_inputs_entry_data): Remove.
4691         (Incremental_inputs_entry): Remove.
4692         (Incremental_inputs_entry_write): Remove.
4693         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4694         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4695         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4696         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4697         Likewise.
4698         (Incremental_input_entry): New class.
4699         (Incremental_script_entry): New class.
4700         (Incremental_object_entry): New class.
4701         (Incremental_archive_entry): New class.
4702         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4703         (Incremental_inputs::report_inputs): Remove.
4704         (Incremental_inputs::report_archive): Remove.
4705         (Incremental_inputs::report_archive_begin): New function.
4706         (Incremental_inputs::report_archive_end): New function.
4707         (Incremental_inputs::report_object): Change prototype.
4708         (Incremental_inputs::report_input_section): New function.
4709         (Incremental_inputs::report_script): Change prototype.
4710         (Incremental_inputs::get_reloc_count): New function.
4711         (Incremental_inputs::set_reloc_count): New function.
4712         (Incremental_inputs::create_data_sections): New function.
4713         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4714         (Incremental_inputs::inputs_section): New function.
4715         (Incremental_inputs::symtab_section): New function.
4716         (Incremental_inputs::relocs_section): New function.
4717         (Incremental_inputs::get_stringpool): Add const.
4718         (Incremental_inputs::command_line): Add const.
4719         (Incremental_inputs::inputs): Remove.
4720         (Incremental_inputs::command_line_key): New function.
4721         (Incremental_inputs::input_file_count): New function.
4722         (Incremental_inputs::input_files): New function.
4723         (Incremental_inputs::relocs_entsize): New function.
4724         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4725         (Incremental_inputs::finalize_inputs): Remove.
4726         (Incremental_inputs::Input_info): Remove.
4727         (Incremental_inputs::lock_): Remove.
4728         (Incremental_inputs::inputs_): Change type.
4729         (Incremental_inputs::inputs_map_): Remove.
4730         (Incremental_inputs::current_object_entry_): New data member.
4731         (Incremental_inputs::inputs_section_): New data member.
4732         (Incremental_inputs::symtab_section_): New data member.
4733         (Incremental_inputs::relocs_section_): New data member.
4734         (Incremental_inputs::reloc_count_): New data member.
4735         (Incremental_inputs_reader): New class.
4736         (Incremental_symtab_reader): New class.
4737         (Incremental_relocs_reader): New class.
4738         * layout.cc (Layout::finalize): Move finalization of incremental info
4739         and creation of incremental info sections to follow finalization of
4740         symbol table.  Set offsets for postprocessing sections.
4741         (Layout::create_incremental_info_sections): Call
4742         Incremental_inputs::create_data_sections.  Add incremental symtab
4743         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4744         sections to layout after input sections.
4745         * layout.h (struct Timespec): Forward declaration.
4746         (Layout::incremental_inputs): Add const.
4747         (Layout::create_incremental_info_sections): Add parameter.
4748         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4749         * object.cc: Include incremental.h.
4750         (Relobj::finalize_incremental_relocs): New function.
4751         (Sized_relobj::do_layout): Record input sections in incremental info.
4752         * object.h (Object::output_section): New function.
4753         (Object::output_section_offset): Moved from Relobj.
4754         (Object::get_incremental_reloc_base): New function.
4755         (Object::get_incremental_reloc_count): New function.
4756         (Object::do_output_section): New function.
4757         (Object::do_output_section_offset): Moved from Relobj.
4758         (Object::do_get_incremental_reloc_base): New function.
4759         (Object::do_get_incremental_reloc_count): New function.
4760         (Object::Object): Initialize new data members.
4761         (Relobj::output_section): Renamed do_output_section and moved to
4762         protected.
4763         (Relobj::output_section_offset): Moved to Object.
4764         (Relobj::do_get_incremental_reloc_base): New function.
4765         (Relobj::do_get_incremental_reloc_count): New function.
4766         (Relobj::allocate_incremental_reloc_counts): New function.
4767         (Relobj::count_incremental_reloc): New function.
4768         (Relobj::finalize_incremental_relocs): New function.
4769         (Relobj::next_incremental_reloc_index): New function.
4770         (Relobj::reloc_counts_): New data member.
4771         (Relobj::reloc_bases_): New data member.
4772         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4773         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4774         (Sized_relobj::incremental_relocs_scan): New function.
4775         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4776         (Sized_relobj::incremental_relocs_write): New function.
4777         (Sized_relobj::incremental_relocs_write_reltype): New function.
4778         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4779         incremental link.
4780         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4781         archives and object files elsewhere.
4782         (Add_symbols::run): Report object files here.
4783         (Finish_group::run): Report end of archive at end of group.
4784         * reloc.cc: Include layout.h, incremental.h.
4785         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4786         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4787         (Sized_relobj::incremental_relocs_scan): New function.
4788         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4789         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4790         (Sized_relobj::incremental_relocs_write): New function.
4791         (Sized_relobj::incremental_relocs_write_reltype): New function.
4792         * script.cc (read_input_script): Rewrite test for incremental link.
4793         Change call to Incremental_inputs::report_script.
4794         * symtab.h (Symbol_table::first_global_index): New function.
4795         (Symbol_table::output_count): New function.
4796
4797 2010-08-12  Doug Kwan  <dougkwan@google.com>
4798
4799         * arm.cc (Target_arm::merge_object_attributes): Check command line
4800         options --no-wchar-size-warning and --no-enum-size-warning.
4801         * options.h (General_options): Add ld-compatible options
4802         --no-enum-size-warning and --no-wchar-size-warning.
4803
4804 2010-08-04  Ian Lance Taylor  <iant@google.com>
4805
4806         * x86_64.cc (Target_x86_64::Scan::local): Use
4807         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4808         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4809         (Target_x86_64::Scan::global): Likewise.
4810         (Target_x86_64::Relocate::relocate): Likewise.
4811         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4812         Likewise.
4813
4814 2010-08-03  Cary Coutant  <ccoutant@google.com>
4815
4816         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4817         to reserve space in merged_strings vector. Keep total input size
4818         for stats.
4819         (Output_merge_string::do_print_merge_stats): Print total input size.
4820         * merge.h (Output_merge_string): Add input_size_ field.
4821         * stringpool.cc (Stringpool_template::string_length): Move
4822         implementations out of Stringpool_template class and place in
4823         stringpool.h.
4824         * stringpool.h (string_length): Move out of Stringpool_template.
4825
4826 2010-08-03  Ian Lance Taylor  <iant@google.com>
4827
4828         PR 11712
4829         * layout.cc (relaxation_loop_body): If address of load segment is
4830         set, adjust address to include headers if possible.
4831
4832 2010-08-03  Ian Lance Taylor  <iant@google.com>
4833
4834         * version.cc (version_string): Bump to 1.10.
4835
4836 2010-08-03  Ian Lance Taylor  <iant@google.com>
4837
4838         PR 11805
4839         * layout.h (enum Output_section_order): Define.
4840         (class Layout): Update declarations.
4841         * layout.cc (Layout::get_output_section): Add order parameter.
4842         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4843         is_first_non_relro parameters.  Change all callers.
4844         (Layout::choose_output_section): Likewise.
4845         (Layout::add_output_section_data): Likewise.
4846         (Layout::make_output_section): Likewise.  Set order.
4847         (Layout::default_section_order): New function.
4848         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4849         * output.cc (Output_section::Output_section): Initialize order_.
4850         Don't initialize deleted fields.
4851         (Output_segment::Output_segment): Don't initialize deleted
4852         fields.
4853         (Output_segment::add_output_section_to_load): New function
4854         replacing add_output_section.  Change all callers to call this or
4855         add_output_section_to_nonload.
4856         (Output_segment::add_output_section_to_nonload): New function.
4857         (Output_segment::remove_output_section): Rewrite.
4858         (Output_segment::add_initial_output_data): Likewise.
4859         (Output_segment::has_any_data_sections): Likewise.
4860         (Output_segment::is_first_section_relro): Likewise.
4861         (Output_segment::maximum_alignment): Likewise.
4862         (Output_segment::has_dynamic_reloc): New function replacing
4863         dynamic_reloc_count.  Change all callers.
4864         (Output_segment::has_dynamic_reloc_list): New function replacing
4865         dynamic_reloc_count_list.  Change all callers.
4866         (Output_segment::set_section_addresses): Rewrite.
4867         (Output_segment::set_offset): Rewrite.
4868         (Output_segment::find_first_and_last_list): Remove.
4869         (Output_segment::set_tls_offsets): Rewrite.
4870         (Output_segment::first_section_load_address): Likewise.
4871         (Output_segment::output_section_count): Likewise.
4872         (Output_segment::section_with_lowest_load_address): Likewise.
4873         (Output_segment::write_section_headers): Likewise.
4874         (Output_segment::print_sections_to_map): Likewise.
4875         * output.h (class Output_data): Remove dynamic_reloc_count_
4876         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4877         (Output_data::add_dynamic_reloc): Rewrite.
4878         (Output_data::has_dynamic_reloc): New function.
4879         (Output_data::dynamic_reloc_count): Remove.
4880         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4881         is_last_relro_, is_first_non_relro_, is_interp_,
4882         is_dynamic_linker_section_ fields.  Add order and set_order
4883         functions.  Remove is_relro_local, set_is_relro_local,
4884         is_last_relro, set_is_last_relro, is_first_non_relro,
4885         set_is_first_non_relro functions, is_interp, set_is_interp,
4886         is_dynamic_linker_section, and set_is_dynamic_linker_section
4887         functions.
4888         (class Output_segment): Change Output_data_list from std::list to
4889         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4890         output_bss_ fields.  Update declarations.
4891
4892 2010-08-02  Ian Lance Taylor  <iant@google.com>
4893
4894         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4895         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4896         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4897
4898 2010-08-02  Ian Lance Taylor  <iant@google.com>
4899
4900         PR 11855
4901         * script.cc (Script_options::Script_options): Initialize
4902         symbol_definitions_ and symbol_references_.
4903         (Script_options::add_symbol_assignment): Update
4904         symbol_definitions_ and symbol_references_.
4905         (Script_options::add_symbol_reference): New function.
4906         (script_symbol): New function.
4907         * script.h (class Script_options): Add symbol_definitions_ and
4908         symbol_references_ fields.
4909         (Script_options::referenced_const_iterator): New type.
4910         (Script_options::referenced_begin): New function.
4911         (Script_options::referenced_end): New function.
4912         (Script_options::is_referenced): New function.
4913         (Script_options::any_unreferenced): New function.
4914         * script-c.h (script_symbol): Declare.
4915         * yyscript.y (exp): Call script_symbol.
4916         * symtab.cc: Include "script.h".
4917         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4918         Change all callers.  Check symbols referenced by scripts.
4919         (Symbol_table::add_undefined_symbols_from_command_line): Add
4920         layout parameter.  Change all callers.
4921         (Symbol_table::do_add_undefined_symbols_from_command_line):
4922         Likewise.  Break out loop body.  Check symbols referenced by
4923         scripts.
4924         (Symbol_table::add_undefined_symbol_from_command_line): New
4925         function broken out of
4926         do_add_undefined_symbols_from_command_line.
4927         * symtab.h (class Symbol_table): Update declarations.
4928         * archive.cc: Include "layout.h".
4929         (Archive::should_include_member): Add layout parameter.  Change
4930         all callers.  Check for symbol mentioned in expression.
4931         * archive.h (class Archive): Update declaration.
4932         * object.cc (Sized_relobj::do_should_include_member): Add layout
4933         parameter.
4934         * object.h (Object::should_include_member): Add layout parameter.
4935         Change all callers.
4936         (Object::do_should_include_member): Add layout parameter.
4937         (class Sized_relobj): Update declaration.
4938         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4939         parameter.
4940         * dynobj.h (class Sized_dynobj): Update declaration.
4941         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4942         layout parameter.
4943         * plugin.h (class Sized_pluginobj): Update declaration.
4944
4945 2010-08-02  Ian Lance Taylor  <iant@google.com>
4946
4947         PR 11866
4948         * output.cc (Output_segment::set_offset): Search for the first and
4949         last sections rather than assuming that the list is in order.
4950         (Output_segment::find_first_and_last_list): New function.
4951         * output.h (class Output_segment): Update declarations.
4952         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4953         (relro_strip_test_SOURCES): New variable.
4954         (relro_strip_test_DEPENDENCIES): New variable.
4955         (relro_strip_test_LDFLAGS): New variable.
4956         (relro_strip_test_LDADD): New variable.
4957         (relro_strip_test.so): New target.
4958
4959 2010-08-02  Ian Lance Taylor  <iant@google.com>
4960
4961         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4962         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4963         (Target_i386::got_tlsdesc_section): New function.
4964         (Target_i386::got_section): Create space for GOT entries for
4965         TLSDESC relocations.
4966         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4967         R_386_TLS_GOTDESC.
4968         (Target_i386::Scan::global): Likewise.
4969         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4970         using TLSDESC GOT.
4971         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4972         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4973         (Target_x86_64::got_tlsdesc_section): New function.
4974         (Target_x86_64::got_section): Create space for GOT entries for
4975         TLSDESC relocations.
4976         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4977         R_386_TLS_GOTDESC.
4978         (Target_x86_64::Scan::global): Likewise.
4979         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4980         using TLSDESC GOT.
4981
4982 2010-08-02  Ian Lance Taylor  <iant@google.com>
4983
4984         * testsuite/final_layout.sh: Use dc to convert from hex to
4985         decimal.
4986
4987 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4988
4989         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4990         paramter to the call to gold::gc_process_relocs.
4991         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4992         paramter to the call to gold::gc_process_relocs.
4993         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4994         parameter to the call to gold::gc_process_relocs.
4995         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4996         template parameter to the call to gold::gc_process_relocs.
4997         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4998         paramter to the call to gold::gc_process_relocs.
4999         * gc.h (get_embedded_addend_size): New function.
5000         (gc_process_relocs): Save the size of the reloc for use by ICF.
5001         * icf.cc (get_section_contents): Get the addend from the text section
5002         for SHT_REL relocation sections.
5003         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5004         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5005         * int_encoding.h (read_from_pointer): New overloaded function.
5006         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5007         * testsuite/icf_sht_rel_addend_test.sh: New file.
5008         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5009         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5010
5011 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5012
5013         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5014         * Makefile.in: Regenerate.
5015         * testsuite/Makefile.in: Regenerate.
5016
5017 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5018
5019         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5020         * gold/testsuite/debug_msg.cc: Likewise.
5021         * gold/testsuite/odr_violation1.cc
5022         * gold/testsuite/odr_violation2.cc
5023
5024 2010-07-21  Cary Coutant  <ccoutant@google.com>
5025
5026         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5027         string, and length fields.
5028         (Output_merge_string::Merged_strings_list): New type.
5029         (Output_merge_string::Merged_strings_lists): New typedef.
5030         (Output_merge_string): Replace merged_strings_ with
5031         merged_strings_lists_.
5032         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5033         Merged_strings_list per input object and section.  Don't store pointer
5034         to the string.  Don't store length with each merged string entry.
5035         (Output_merge_string::finalize_merged_data): Loop over list of merged
5036         strings lists.  Recompute length of each merged string.
5037
5038 2010-07-15  Cary Coutant  <ccoutant@google.com>
5039
5040         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5041         here.
5042
5043 2010-07-14  Ian Lance Taylor  <iant@google.com>
5044
5045         * descriptors.cc (Descriptors::open): Report correct name in error
5046         message.
5047
5048 2010-07-13  Doug Kwan  <dougkwan@google.com>
5049
5050         * arm.cc (Arm_input_section::Arm_input_section): For a
5051         SHT_ARM_EXIDX section, always keeps the input sections.
5052         (Arm_input_section::set_exidx_section_link): New method.
5053         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5054         has_errors_ to false.
5055         (Arm_exidx_input_section::has_errors,
5056         Arm_exidx_input_section::set_has_errors): New methods.
5057         (Arm_exidx_input_section::has_errors_): New data member.
5058         (Arm_relobj::get_exidx_shndx_list): New method.
5059         (Arm_output_section::append_text_sections_to_list): Do not skip
5060         section without SHF_EXECINSTR.
5061         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5062         errors.
5063         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5064         section header.  Make error messages more verbose.  Check for
5065         a non-executable section linked to an EXIDX section.
5066         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5067         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5068         check that there is no deferred EXIDX section if we exit early.
5069         Instead of not making an EXIDX section in case of an error, make one
5070         and set the has_errors flag of it.
5071         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5072         in a relocatable link.
5073         (Target_arm::do_relax): Look for the EXIDX output section instead of
5074         assuming that it is called .ARM.exidx.
5075         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5076         section list.  Do not check for SHF_EXECINSTR section flags but
5077         skip any input section with errors.
5078         * output.cc (Output_section::Output_section): Initialize
5079         always_keeps_input_sections_ to false.
5080         (Output_section::add_input_section): Check for
5081         always_keeps_input_sections_.
5082         *  output.h (Output_section::always_keeps_input_sections,
5083         Output_section::set_always_keeps_input_sections): New methods.
5084         (Output_section::always_keeps_input_sections): New data member.
5085
5086 2010-07-13  Rafael Espindola  <espindola@google.com>
5087
5088         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5089         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5090
5091 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5092             Ian Lance Taylor  <iant@google.com>
5093
5094         * output.h (Output_section_lookup_maps::add_merge_section):
5095         Correct check of whether value was inserted.
5096         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5097         (Output_section_lookup_maps::add_relaxed_input_section):
5098         Likewise.
5099         * arm.cc (Target_arm::got_section): Remove used local os.
5100         * i386.cc (Target_i386::got_section): Likewise.
5101         * x86_64.cc (Target_x86_64::got_section): Likewise.
5102         * sparc.cc (Target_sparc::got_section): Likewise.
5103         (Target_sparc::relocate): Remove unused local have_got_offset.
5104         * powerpc.cc (Target_powerpc::relocate): Likewise.
5105
5106 2010-07-13  Ian Lance Taylor  <iant@google.com>
5107
5108         * compressed_output.cc (zlib_decompress): Fix signature in
5109         !HAVE_ZLIB_H case.
5110
5111         * archive.cc (Archive::include_member): Unlock an external member
5112         of a thin archive.  Don't bother to delete an object we know is
5113         NULL.
5114
5115 2010-07-12  Cary Coutant  <ccoutant@google.com>
5116
5117         * compressed_output.cc (zlib_decompress): New function.
5118         (get_uncompressed_size): New function.
5119         (decompress_input_section): New function.
5120         * compressed_output.h (get_uncompressed_size): New function.
5121         (decompress_input_section): New function.
5122         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5123         Handle compressed debug sections.
5124         * layout.cc (is_compressed_debug_section): New function.
5125         (Layout::output_section_name): Map compressed section names to
5126         canonical names.
5127         * layout.h (is_compressed_debug_section): New function.
5128         (is_debug_info_section): Recognize compressed debug sections.
5129         * merge.cc: Include compressed_output.h.
5130         (Output_merge_data::do_add_input_section): Handle compressed
5131         debug sections.
5132         (Output_merge_string::do_add_input_section): Handle compressed
5133         debug sections.
5134         * object.cc: Include compressed_output.h.
5135         (Sized_relobj::Sized_relobj): Initialize new data members.
5136         (build_compressed_section_map): New function.
5137         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5138         * object.h (Object::section_is_compressed): New method.
5139         (Object::do_section_is_compressed): New method.
5140         (Sized_relobj::Compressed_section_map): New type.
5141         (Sized_relobj::do_section_is_compressed): New method.
5142         (Sized_relobj::compressed_sections_): New data member.
5143         * output.cc (Output_section::add_input_section): Handle compressed
5144         debug sections.
5145         * reloc.cc: Include compressed_output.h.
5146         (Sized_relobj::write_sections): Handle compressed debug sections.
5147
5148 2010-07-08  Cary Coutant  <ccoutant@google.com>
5149
5150         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5151         weak when resolving to a dynamic def.
5152         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5153         for weak undef/dynamic def cases. Adjust callers.
5154         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5155         undef_binding_weak_.
5156         (Symbol_table::sized_write_globals): Adjust symbol binding.
5157         (Symbol_table::sized_write_symbol): Add binding parameter.
5158         * symtab.h (Symbol::set_undef_binding): New method.
5159         (Symbol::is_undef_binding_weak): New method.
5160         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5161         (Symbol_table::should_override): Add new parameter.
5162         (Symbol_table::sized_write_symbol): Add new parameter.
5163
5164         * testsuite/weak_undef_file1.cc: Add new test case.
5165         * testsuite/weak_undef_file2.cc: Fix header comment.
5166         * testsuite/weak_undef_test.cc: Add new test case.
5167
5168 2010-06-29  Doug Kwan  <dougkwan@google.com>
5169
5170         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5171         Initialize USE_SYMBOL_.
5172         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5173         definition.
5174         (Arm_reloc_property::uses_symbol_): New data member declaration.
5175         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5176         uses symbol value and symbol is undefined but not weakly undefined.
5177
5178 2010-06-28  Rafael Espindola  <espindola@google.com>
5179
5180         * plugin.cc (Plugin::load): Use dlerror.
5181
5182 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5183
5184         * symtab.cc (detect_odr_violations): When reporting an ODR
5185         violation, report an object where the symbol is defined.
5186
5187 2010-06-25  Doug Kwan  <dougkwan@google.com>
5188
5189         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5190         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5191         definition.
5192         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5193         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5194         target hook to detect function points.
5195         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5196         * icf.h (Icf::check_section_for_function_pointers): Change type of
5197         parameter SECTION_NAME to const reference to std::string.  Use
5198         target hook to determine if section may have unsafe pointers.
5199         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5200         method definition.
5201
5202 2010-06-21  Rafael Espindola  <espindola@google.com>
5203
5204         * fileread.cc (Input_file::find_fie): New
5205         (Input_file::open): Use Input_file::find_fie.
5206         * fileread.h (Input_file::find_fie): New
5207         * plugin.cc (set_extra_library_path): New.
5208         (Plugin::load): Add set_extra_library_path to the transfer vector.
5209         (Plugin_manager::set_extra_library_path): New.
5210         (Plugin_manager::add_input_file): Use the extra search path if set.
5211         (set_extra_library_path(): New.
5212         * plugin.h (Plugin_manager): Add set_extra_library_path and
5213         extra_search_path_.
5214
5215 2010-06-19  Cary Coutant  <ccoutant@google.com>
5216
5217         * layout.cc (gdb_sections): Add .debug_types.
5218         (lines_only_debug_sections): Likewise.
5219
5220 2010-06-18  Rafael Espindola  <espindola@google.com>
5221
5222         * plugin.cc (add_input_file,add_input_library)
5223         (Plugin_manager::add_input_file): Make filename arguments const.
5224         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5225         const.
5226
5227 2010-06-16  Doug Kwan  <dougkwan@google.com>
5228
5229         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5230         .ARM.attributes section if we have not merged any input
5231         attributes sections.
5232
5233 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5234
5235         * arm.cc: Allow combining objects with no EABI version
5236         information.
5237
5238 2010-06-15  Rafael Espindola  <espindola@google.com>
5239
5240         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5241
5242 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5243
5244         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5245         (struct iovec): Correct !HAVE_READV definition.
5246
5247 2010-06-10  Cary Coutant  <ccoutant@google.com>
5248
5249         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5250         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5251         reloc sections.
5252         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5253
5254         PR 11683
5255         * symtab.h (Symbol::is_placeholder): New member function.
5256         * target-reloc.h (relocate_section): Check for placeholder symbols.
5257
5258         * testsuite/Makefile.am (plugin_test_8): New test.
5259         (plugin_test_9): New test.
5260         * testsuite/Makefile.in: Regenerate.
5261
5262 2010-06-09  Nick Clifton  <nickc@redhat.com>
5263
5264         * yyscript.y (input_list_element): Allow strings prefixed with
5265         the '-' character.  Treat these as libraries.
5266         * script.cc (script_add_library): New function.  Adds a library
5267         specified by "-l<name>" found in an input script.
5268         * script-c.h: Add prototype for script_add_library.
5269
5270 2010-06-07  Doug Kwan  <dougkwan@google.com>
5271
5272         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5273         Restrict stub-group size to be within long conditional branch
5274         range when working around cortex-A8 erratum.
5275
5276 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5277
5278         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5279         #ifdef typo.
5280
5281 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5282
5283         PR gold/11658
5284         * output.cc
5285         (Output_section::Input_section_sort_entry::compare_section_ordering):
5286         Change to return non-zero correctly.
5287         (Output_section::Input_section_sort_section_order_index_compare
5288         ::operator()): Change to fix ambiguity in comparisons.
5289
5290 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5291
5292         * gold.h (is_wildcard_string): New function.
5293         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5294         (Layout::layout_eh_frame): Ditto.
5295         (Layout::find_section_order_index): New method.
5296         (Layout::read_layout_from_file): New method.
5297         * layout.h (Layout::find_section_order_index): New method.
5298         (Layout::read_layout_from_file): New method.
5299         (Layout::input_section_position_): New private member.
5300         (Layout::input_section_glob_): New private member.
5301         * main.cc (main): Call read_layout_from_file here.
5302         * options.h (--section-ordering-file): New option.
5303         * output.cc (Output_section::input_section_order_specified_): New
5304         member.
5305         (Output_section::Output_section): Initialize new member.
5306         (Output_section::add_input_section): Add new parameter.
5307         Keep input sections when --section-ordering-file is used.
5308         (Output_section::set_final_data_size): Sort input sections when
5309         section ordering file is specified.
5310         (Output_section::Input_section_sort_entry): Add new parameter.
5311         Check sorting type.
5312         (Output_section::Input_section_sort_entry::compare_section_ordering):
5313         New method.
5314         (Output_section::Input_section_sort_compare::operator()): Change to
5315         consider section_order_index.
5316         (Output_section::Input_section_sort_init_fini_compare::operator()):
5317         Change to consider section_order_index.
5318         (Output_section::Input_section_sort_section_order_index_compare
5319         ::operator()): New method.
5320         (Output_section::sort_attached_input_sections): Change to sort
5321         according to section order when specified.
5322         (Output_section::add_input_section<32, true>): Add new parameter.
5323         (Output_section::add_input_section<64, true>): Add new parameter.
5324         (Output_section::add_input_section<32, false>): Add new parameter.
5325         (Output_section::add_input_section<64, false>): Add new parameter.
5326         * output.h (Output_section::add_input_section): Add new parameter.
5327         (Output_section::input_section_order_specified): New
5328         method.
5329         (Output_section::set_input_section_order_specified): New method.
5330         (Input_section::Input_section): Initialize section_order_index_.
5331         (Input_section::section_order_index): New method.
5332         (Input_section::set_section_order_index): New method.
5333         (Input_section::section_order_index_): New member.
5334         (Input_section::Input_section_sort_section_order_index_compare): New
5335         struct.
5336         (Output_section::input_section_order_specified_): New member.
5337         * script-sections.cc (is_wildcard_string): Delete and move modified
5338         method to gold.h.
5339         (Output_section_element_input::Output_section_element_input): Modify
5340         call to is_wildcard_string.
5341         (Output_section_element_input::Input_section_pattern
5342         ::Input_section_pattern): Ditto.
5343         (Output_section_element_input::Output_section_element_input): Ditto.
5344         * testsuite/Makefile.am (final_layout): New test case.
5345         * testsuite/Makefile.in: Regenerate.
5346         * testsuite/final_layout.cc: New file.
5347         * testsuite/final_layout.sh: New file.
5348
5349 2010-06-01  Rafael Espindola  <espindola@google.com>
5350
5351         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5352
5353 2010-06-01  Rafael Espindola  <espindola@google.com>
5354
5355         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5356         visibility of symbols.
5357
5358 2010-05-27  Doug Kwan  <dougkwan@google.com>
5359
5360         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5361         from start of output section instead of address for a local symbol
5362         in a merged or relaxed section when doing a relocatable link.
5363
5364 2010-05-26  Rafael Espindola  <espindola@google.com>
5365
5366        PR 11604
5367         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5368         adding sections the garbage collector removed.
5369         * gold/testsuite/Makefile.am: Add test.
5370         * gold/testsuite/Makefile.in: Regenerate.
5371         * gold/testsuite/plugin_test_7.sh: New.
5372         * gold/testsuite/plugin_test_7_1.c: New.
5373         * gold/testsuite/plugin_test_7_2.c: New.
5374
5375 2010-05-26  Rafael Espindola  <espindola@google.com>
5376
5377         * script-sections.cc (Output_section_definition::set_section_addresses):
5378         Check for --section-start.
5379
5380 2010-05-26  Doug Kwan  <dougkwan@google.com>
5381
5382         * arm.cc (Arm_scan_relocatable_relocs): New class.
5383         (Target_arm::relocate_special_relocatable): New method.
5384         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5385         (Arm_relocate_functions::thumb_branch_common): Same.
5386         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5387         instead of Default_scan_relocatable_relocs.
5388         * target-reloc.h (relocate_for_relocatable): Let target handle
5389         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5390         * target.h (Sized_target::relocate_special_relocatable): New method.
5391
5392 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5393
5394         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5395
5396 2010-05-23  Doug Kwan  <dougkwan@google.com>
5397
5398         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5399         instead of a cast.
5400         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5401         with a direct branch, not a conditional branch, to a stub.
5402         * merge.cc (Output_merge_base::record_input_section): New method
5403         defintion.
5404         (Output_merge_data::do_add_input_section): Record input section if
5405         keeps-input-sections flag is set.
5406         (Output_merge_string::do_add_input_section): Ditto.
5407         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5408         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5409         INPUT_SECTIONS_.
5410         (Output_merge_base::keeps_input_sections,
5411         Output_merge_base::set_keeps_input_sections,
5412         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5413         method definitions.
5414         (Output_merge_base::Input_sections): New type declaration.
5415         (Output_merge_base::input_sections_begin,
5416         Output_merge_base::input_sections_end,
5417         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5418         (Output_merge_base::bool keeps_input_sections_,
5419         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5420         Output_merge_base::input_sections_): New data members.
5421         (Output_merge_data::do_set_keeps_input_sections): New method
5422         defintion.
5423         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5424         * output.cc (Output_section::Input_section::relobj): Move method
5425         defintion from class declaration to here and handle merge sections.
5426         (Output_section::Input_section::shndx): Ditto.
5427         (Output_section::Output_section): Remove initializations of removed
5428         data members and initialize new data member LOOKUP_MAPS_.
5429         (Output_section::add_input_section): Set keeps-input-sections flag
5430         for a newly created merge output section as appropriate.  Adjust code
5431         to use Output_section_lookup_maps class.
5432         (Output_section::add_relaxed_input_section): Adjst code for lookup
5433         maps code refactoring.
5434         (Output_section::add_merge_input_section): Add a new parameter
5435         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5436         class.  If adding input section to a newly created merge output
5437         section fails, remove the new merge section.
5438         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5439         Adjust code for use of the Output_section_lookup_maps class.
5440         (Output_section::find_merge_section): Ditto.
5441         (Output_section::build_lookup_maps): New method defintion.
5442         (Output_section::find_relaxed_input_section): Adjust code to use
5443         Output_section_lookup_maps class.
5444         (Output_section::get_input_sections): Export merge sections.  Adjust
5445         code to use Output_section_lookup_maps class.
5446         (Output_section:::add_script_input_section): Adjust code to use
5447         Output_section_lookup_maps class.  Update lookup maps for merge
5448         sections also.
5449         (Output_section::discard_states): Use Output_section_lookup_maps.
5450         (Output_section::restore_states): Same.
5451         * output.h (Merge_section_properties): Move class defintion out of
5452         Output_section.
5453         (Output_section_lookup_maps): New class.
5454         (Output_section::Input_section::is_merge_section): New method
5455         defintion.
5456         (Output_section::Input_section::relobj): Move defintion out of class
5457         defintion.  Declare method only.
5458         (Output_section::Input_section::shndx): Ditto.
5459         (Output_section::Input_section::output_merge_base): New method defintion.
5460         (Output_section::Input_section::u2_.pomb): New union field.
5461         (Output_section::Merge_section_by_properties_map,
5462         Output_section::Output_section_data_by_input_section_map,
5463         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5464         Remove types.
5465         (Output_section::add_merge_input_section): Add new parameter
5466         KEEPS_INPUT_SECTIONS.
5467         (Output_section::build_lookup_maps): New method declaration.
5468         (Output_section::merge_section_map_,
5469         Output_section::merge_section_by_properties_map_,
5470         Output_section::relaxed_input_section_map_,
5471         Output_section::is_relaxed_input_section_map_valid_): Remove data
5472         members.
5473         (Output_section::lookup_maps_): New data member.
5474
5475 2010-05-21  Doug Kwan  <dougkwan@google.com>
5476
5477         PR gold/11619
5478         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5479         avoid a compilation error.
5480
5481 2010-05-19  Rafael Espindola  <espindola@google.com>
5482
5483         * script-sections.cc (Output_section_definition::allocate_to_segment):
5484         Update the phdrs_list even when the output section is NULL.
5485         * testsuite/Makefile.am: Add test.
5486         * testsuite/Makefile.in: Regenerate.
5487         * testsuite/script_test_9.cc: New.
5488         * testsuite/script_test_9.sh: New.
5489         * testsuite/script_test_9.t: New.
5490
5491 2010-05-19  Doug Kwan  <dougkwan@google.com>
5492
5493         * arm.cc (Arm_input_section::original_size): New method.
5494         (Arm_input_section::do_addralign): Add a cast.
5495         (Arm_input_section::do_output_offset): Remove static cast.
5496         (Arm_input_section::original_addralign,
5497          Arm_input_section::original_size_): Change type to uint32_t.
5498         (Arm_input_section::init): Add safe casts for section alignment
5499         and size.
5500         (Arm_input_section::set_final_data_size): Do not set address and
5501         offset of stub table.
5502         (Arm_output_section::fix_exidx_coverage): Change use of of
5503         Output_section::Simple_input_section to that of
5504         Output_section::Input_section.
5505         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5506         except for the first pass.
5507         * output.cc (Output_section::get_input_sections): Change type of
5508         input_sections to std::list<Input_section>.
5509         (Output_section::add_script_input_section): Rename from
5510         Output_section::add_simple_input_section.  Change type of SIS
5511         parameter from Simple_input_section to Input_section.
5512         * output.h (Output_section::Simple_input_section): Remove class.
5513         (Output_section::Input_section): Change class visibility to public.
5514         (Output_section::Input_section::addralign): Use stored alignments
5515         for special input sections if set.
5516         (Output_section::Input_section::set_addralign): New method.
5517         (Output_section::get_input_sections): Change parameter type from
5518         list of Simple_input_section to list of Input_section.
5519         (Output_section::add_script_input_section): Rename from
5520         Output_section::add_simple_input_section. Change first parameter's
5521         type from Simple_input_section to Input_section and remove the
5522         second and third parameters.
5523         * script-sections.cc (Input_section::Input_section_list): Change
5524         type to list of Output_section::Input_section/
5525         (Input_section_info::Input_section_info): Change parameter type of
5526         INPUT_SECTION to Output_section::Input_section.
5527         (Input_section_info::input_section): Change return type.
5528         (Input_section_info::input_section_): Change type to
5529         Output_section::Input_section.
5530         (Output_section_element_input::set_section_addresses): Adjust code
5531         to use Output_section::Input_section instead of
5532         Output_section::Simple_input_section.  Adjust code for renaming
5533         of Output_section::add_simple_input_section.
5534         (Orphan_output_section::set_section_addresses): Ditto.
5535
5536 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5537
5538         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5539         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5540
5541 2010-05-18  Rafael Espindola  <espindola@google.com>
5542
5543         * options.cc (General_options::finalize): Handle -nostdlib.
5544         * options.h (nostdlib): New option.
5545         * script.cc (script_add_search_dir): Handle -nostdlib.
5546
5547 2010-05-12  Doug Kwan  <dougkwan@google.com>
5548
5549         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5550         attributes section only if there no attributes section after merging.
5551         (Target_arm::merge_object_attributes): Move value of
5552         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5553         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5554         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5555         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5556         and arm_attr_merge_7.stdout.
5557         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5558         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5559         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5560         arm_attr_merge_7b.o): New rules.
5561         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5562         arm_attr_merge_7
5563         * testsuite/Makefile.in: Regenerate.
5564         * testsuite/arm_attr_merge.sh: New file.
5565         * testsuite/arm_attr_merge_[67][ab].s: Same.
5566
5567 2010-05-05  Nick Clifton  <nickc@redhat.com>
5568
5569         * po/es.po: Updated Spanish translation.
5570
5571 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5572
5573         * Makefile.am (install-exec-local): Properly install gold as
5574         default cross linker.
5575         * Makefile.in: Regenerated.
5576
5577 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5578             Nick Clifton  <nickc@redhat.com>
5579
5580         * configure.ac (install_as_default): Define and set to false
5581         unless --enable-gold or --enable-gold=both/gold has been
5582         specified.
5583         * configure: Regenerate.
5584
5585         * Makefile.am (install-exec-local): Install the executable as
5586         'ld.gold'.  If install_as_default is true then also install it as
5587         'ld'.
5588         * Makefile.in: Regenerated.
5589
5590 2010-04-24  Ian Lance Taylor  <iant@google.com>
5591
5592         * layout.cc (Layout::layout_reloc): In relocatable link don't
5593         combine reloc sections for grouped sections.
5594
5595 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5596
5597         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5598         sections that are not ordinary to icf.
5599         * icf.cc (get_section_contents): Handle relocation pointing to section
5600         with no object or shndx information.
5601         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5602         * testsuite/Makefile.in: Regenerate.
5603         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5604         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5605
5606 2010-04-22  Ian Lance Taylor  <iant@google.com>
5607
5608         * expression.cc (Expression::Expression_eval_info): Add
5609         result_alignment_pointer field.
5610         (Expression::eval_with_dot): Add result_alignment_pointer
5611         parameter.  Change all callers.
5612         (Expression::eval_maybe_dot): Likewise.
5613         (class Binary_expression): Add alignment_pointer parameter to
5614         left_value and right_value.  Change all callers.
5615         (BINARY_EXPRESSION): Set result alignment.
5616         (class Trinary_expression): Add alignment_pointer parameter to
5617         arg2_value and arg3_value.  Change all callers.
5618         (Trinary_cond::value): Set result alignment.
5619         (Max_expression::value, Min_expression::value): Likewise.
5620         (Align_expression::value): Likewise.
5621         * script-sections.cc (class Sections_element): Add dot_alignment
5622         parameter to set_section_addresses virtual function.  Update
5623         instantiations.
5624         (class Output_section_element): Likewise.
5625         (Script_sections::create_segments): Add dot_alignment parameter.
5626         Change all callers.
5627         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5628         (Script_sections::set_phdrs_clause_addresses): Likewise.
5629         * script-sections.h: Update declarations.
5630         * script.h: Update declarations.
5631         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5632         min_p_align.
5633         * testsuite/script_test_3.t: Set large alignment.
5634         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5635         segment has expected alignment.
5636
5637 2010-04-22  Nick Clifton  <nickc@redhat.com>
5638
5639         * po/gold.pot: Updated by the Translation project.
5640         * po/vi.po: Updated Vietnamese translation.
5641
5642 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5643
5644         * testsuite/Makefile.am (check_PROGRAMS): Add
5645         icf_virtual_function_folding_test.
5646         * testsuite/Makefile.in: Regenerated.
5647
5648 2010-04-15  Andrew Haley  <aph@redhat.com>
5649
5650         * options.h (merge_exidx_entries): New option.
5651         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5652         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5653         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5654         (Target_arm::merge_exidx_entries): New function.
5655         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5656         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5657         to Arm_exidx_fixup constructor.
5658         Add new arg, merge_exidx_entries.
5659         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5660         Arm_output_section::fix_exidx_coverage.
5661
5662 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5663
5664         * icf.cc (get_section_contents): Check for preemptible functions.
5665         Ignore addend when appropriate.
5666         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5667         section folded.
5668         (add_from_relobj): Check for section folded.
5669         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5670         * symtab.h (should_add_dynsym_entry): Add new parameter.
5671         * target-reloc.h (scan_relocs): Check for section folded.
5672         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5673         Check reloc types for function pointers in shared objects.
5674         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5675         case.
5676         (icf_preemptible_functions_test): New test case.
5677         (icf_string_merge_test): New test case.
5678         * testsuite.Makefile.in: Regenerate.
5679         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5680         bar_glob.  Refactor code.
5681         * testsuite/icf_preemptible_functions_test.cc: New file.
5682         * testsuite/icf_preemptible_functions_test.sh: New file.
5683         * testsuite/icf_string_merge_test.cc: New file.
5684         * testsuite/icf_string_merge_test.sh: New file.
5685         * testsuite/icf_virtual_function_folding_test.cc: New file.
5686         * testsuite/icf_virtual_function_folding_test.sh: New file.
5687
5688 2010-04-14  Doug Kwan  <dougkwan@google.com>
5689
5690         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5691         for local symbol recounting if we remove a section due to ICF.
5692         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5693         there are no regular objects in input.
5694
5695 2010-04-13  Doug Kwan  <dougkwan@google.com>
5696
5697         * arm.cc (Arm_input_section::set_final_data_size): Compute
5698         accurate final data size instead of using current data size.
5699
5700 2010-04-09  Doug Kwan  <dougkwan@google.com>
5701
5702         * layout.cc (Layout::choose_output_section): Handle script section
5703         types.
5704         (Layout::make_output_section_for_script): Add section type parameter.
5705         Handle script section types.
5706         * layout.h (Layout::make_output_section_for_script): Add section
5707         type parameter.
5708         * output.cc (Output_section::Output_section): Initialize data member
5709         is_noload_.
5710         (Output_section::do_reset_address_and_file_offset): Do not set address
5711         to 0 if section is a NOLOAD section.
5712         * output.h (Output_section::is_noload): New method.
5713         (Output_section::set_is_noload): Ditto.
5714         (Output_section::is_noload_): New data member.
5715         * script-c.h (Script_section_type): New enum type.
5716         (struct Parser_output_section_header): Add new file section_type.
5717         * script-sections.cc (Sections_element::output_section_name): Add
5718         parameter for returning script section type.
5719         (Output_section_definition::output_section_name): Ditto.
5720         (Output_section_definition::section_type)P; New method.
5721         (Output_section_definiton::script_section_type_name): Ditto.
5722         (Output_section_definition::script_section_type_): New data member.
5723         (Output_section_definition::Output_section_definition): Initialize
5724         data member Output_section_definition::script_section_type_.
5725         (Output_section_definition::create_sections): Pass script section type
5726         to Layout::make_output_section_for_script.
5727         (Output_section_definition::output_section_name): Return script
5728         section type to caller.
5729         (Output_section_definition::set_section_address): Do not advance
5730         dot value and load address if section type is NOLOAD.  Set address
5731         of NOLOAD sections regardless of section flags.
5732         (Output_section_definition::print): Print section type if it is
5733         not SCRIPT_SECTION_TYPE_NONE.
5734         (Output_section_definition::section_type): New method.
5735         (Output_section_definition::script_section_type_name): Ditto.
5736         (Script_sections::output_section_name): Add new parameter
5737         PSECTION_TYPE for returning script section type.  Pass it to
5738         section elements.  Handle discard sections.
5739         (Sort_output_sections::operator()): Handle NOLOAD sections.
5740         * script-sections.h (Script_sections::Section_type): New enum type.
5741         (Script_sections::output_section_name): Add a new parameter for
5742         returning script section type.
5743         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5744         INFO and NOLOAD.
5745         * yyscript.y (union): Add new field SECTION_TYPE.
5746         (COPY, DSECT, INFO, NOLOAD): New tokens.
5747         (opt_address_and_section_type): Change type to output_section_header.
5748         (section_type): New non-terminal
5749         (section_header): Handle section type.
5750         (opt_address_and_section_type): Return section type value.
5751
5752 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5753
5754         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5755         * testsuite/plugin_common_test_2.c (foo): Likewise.
5756
5757 2010-04-08  Doug Kwan  <dougkwan@google.com>
5758
5759         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5760         Output_merge_data.
5761         * output.cc (Output_section::add_merge_input_section): Simplify
5762         code and return status of Output_merge_base::add_input_section.
5763         Update merge section map only if Output_merge_base::add_input_section
5764         returns true.
5765
5766 2010-04-07  Doug Kwan  <dougkwan@google.com>
5767
5768         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5769         if section is marked as containing instructions but has no mapping
5770         symbols.
5771         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5772         correct section index.
5773         (Arm_relobj::find_linked_text_section): Ditto.
5774
5775 2010-04-07  Cary Coutant  <ccoutant@google.com>
5776
5777         * archive.cc (include_member): Destroy Read_symbols_data object before
5778         releasing file.
5779         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5780         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5781         (Read_symbols_data::~Read_symbols_data) New destructor.
5782         (Section_relocs::Section_relocs) New constructor.
5783         (Section_relocs::~Section_relocs) New destructor.
5784         (Read_relocs_data::Read_relocs_data) New constructor.
5785         (Read_relocs_data::~Read_relocs_data) New destructor.
5786         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5787         pointers to NULL after deleting.
5788
5789 2010-04-07  Doug Kwan  <dougkwan@google.com>
5790
5791         * arm.cc: Replace "endianity" with "endianness" in comments.
5792         (Arm_exidx_cantunwind): Ditto.
5793         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5794         (Arm_relobj::merge_flags_and_attributes): New method.
5795         (Arm_relobj::merge_flags_and_attributes_): New data member.
5796         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5797         (Arm_relobj::scan_sections_for_stubs): Ditto.
5798         (Arm_relobj::do_read_symbols): Check to see if we really want to
5799         merge processor-specific flags and attributes.  Exit early if
5800         an object is empty except for section names and the undefined symbol.
5801         (Target_arm::do_finalize_sections): Move check for ELF format to
5802         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5803         attributes from a regular object only when we have determined that
5804         it is aapropriate.  Do not create an .ARM.attributes section in
5805         output if there is no regular input object.
5806         (Target_arm::merge_processor_specific_flags): Check
5807         --warn-mismatch before printing any error.
5808         (Target_arm::merge_object_attributes): Ditto.
5809         * gold.cc (queue_middle_tasks): Handle the case in which there is
5810         no regular object in input.
5811         * options.cc (General_options::parse_EB): New method.
5812         (General_options::parse_EL): Same.
5813         (General_options::General_options): Initialize endianness_.
5814         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5815         New options.
5816         (General_options::Endianness): New enum.
5817         (General_options::endianness): New method.
5818         (General_options::endianness_): New data member.
5819         * parameters.cc (Parameters::set_options): Check target endianness.
5820         (Parameters::set_target_once): Ditto.
5821         (Parameters::check_target_endianness): New method.
5822         (parameters_force_valid_target): If either -EL or -EB is specified,
5823         use it to define endianness of default target.
5824         * parameters.h (Parameters::check_target_endianness): New method
5825         declaration.
5826         * target.h (class Target): Change "endianity" to "endianness"
5827         in comments.
5828
5829 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5830
5831         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5832         * configure: Regenerate.
5833         * Makefile.in: Regenerate.
5834         * testsuite/Makefile.in: Regenerate.
5835
5836 2010-04-06  Cary Coutant  <ccoutant@google.com>
5837
5838         gcc PR lto/42757
5839         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5840         prevailing definitions of common symbols.
5841         * testsuite/plugin_test_6.sh: New test case.
5842         * testsuite/plugin_common_test_1.c: New test case.
5843         * testsuite/plugin_common_test_2.c: New test case.
5844         * testsuite/Makefile.am (plugin_test_6): New test case.
5845         * testsuite/Makefile.in: Regenerate.
5846
5847 2010-04-06  Nick Clifton  <nickc@redhat.com>
5848
5849         * po/vi.po: New Vietnamese translation.
5850
5851 2010-03-30  Doug Kwan  <dougkwan@google.com>
5852
5853         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5854
5855 2010-03-25  Doug Kwan  <dougkwan@google.com>
5856
5857         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5858         to avoid a conversion warning on a 32-bit host.
5859
5860 2010-03-24  Ian Lance Taylor  <iant@google.com>
5861
5862         * testsuite/script_test_3.t: Add a TLS segment.
5863         * testsuite/Makefile.am (check_PROGRAMS): Add
5864         tls_phdrs_script_test.
5865         (tls_phdrs_script_test_SOURCES): Define.
5866         (tls_phdrs_script_test_DEPENDENCIES): Define.
5867         (tls_phdrs_script_test_LDFLAGS): Define.
5868         (tls_phdrs_script_test_LDADD): Define.
5869         * testsuite/Makefile.in: Rebuild.
5870
5871 2010-03-23  Cary Coutant  <ccoutant@google.com>
5872
5873         * fileread.cc (find_or_make_view): Fix comment.
5874
5875 2010-03-23  Ian Lance Taylor  <iant@google.com>
5876
5877         * script-sections.cc (class Orphan_section_placement): Define
5878         PLACE_TLS and PLACE_TLS_BSS.
5879         (Orphan_section_placement::Orphan_section_placement): Initialize
5880         new places.
5881         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5882         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5883         (tls_script_test_SOURCES): Define.
5884         (tls_script_test_DEPENDENCIES): Define.
5885         (tls_script_test_LDFLAGS): Define.
5886         (tls_script_test_LDADD): Define.
5887         * testsuite/Makefile.in: Rebuild.
5888
5889 2010-03-22  Doug Kwan  <dougkwan@google.com>
5890
5891         * arm.cc (Arm_relocate_functions::abs8,
5892         Arm_relocate_functions::abs16): Use correct check for overflow
5893         specified in the ARM ELF specs.
5894         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5895         target of a BLX instruction specially.
5896         (Reloc_stub::stub_type_for_reloc): Ditto.
5897         (Relocate::relocate): Use symbolic names instead of numeric relocation
5898         codes to report error.
5899         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5900         workaround.
5901         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5902         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5903         thumb2_blx_out_of_range.stdout
5904         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5905         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5906         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5907         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5908         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5909         thumb2_blx_in_range, thumb2_blx_in_range.o,
5910         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5911         thumb2_blx_out_of_range.o): New rules.
5912         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5913         thumb2_blx_in_range and thumb2_blx_out_of_range.
5914         * testsuite/Makefile.in: Regenerate.
5915         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5916         * testsuite/thumb_blx_in_range.s: New file.
5917         * testsuite/thumb_blx_out_of_range.s: New file.
5918
5919 2010-03-22  Rafael Espindola  <espindola@google.com>
5920
5921         * archive.cc (Should_include): Move to archive.h.
5922         (should_include_member): Make it a member of Archive.
5923         (Lib_group): New.
5924         (Add_lib_group_symbols): New.
5925         * archive.h: Include options.h.
5926         (Archive_member): Moved from Archive.
5927         (Should_include): Moved from archive.cc.
5928         (Lib_group): New.
5929         (Add_lib_group_symbols): New.
5930         * dynobj.cc (do_should_include_member): New.
5931         * dynobj.h (do_should_include_member): New.
5932         * gold.cc (queue_initial_tasks): Update call to queue.
5933         * main.cc (main): Print lib group stats.
5934         * object.cc (do_should_include_member): New.
5935         * object.h: Include archive.h.
5936         (Object::should_include_member): New.
5937         (Object::do_should_include_member): New.
5938         (Sized_relobj::do_should_include_member): New.
5939         * options.cc (General_options::parse_start_lib): New.
5940         (General_options::parse_end_lib): New.
5941         (Input_arguments::add_file): Handle lib groups.
5942         (Input_arguments::start_group): Check we are not in a lib.
5943         (Input_arguments::start_lib): New.
5944         (Input_arguments::end_lib): New.
5945         * options.h (General_options): Add start_lib and end_lib.
5946         (Input_argument::lib_): New.
5947         (Input_argument::lib): New.
5948         (Input_argument::is_lib): New.
5949         (Input_file_lib): New.
5950         (Input_arguments::in_lib_): New.
5951         (Input_arguments::in_lib): New.
5952         (Input_arguments::start_lib): New.
5953         (Input_arguments::end_lib_): New.
5954         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5955         in unused members as preempted.
5956         (Sized_pluginobj::do_should_include_member): New.
5957         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5958         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5959         return the blocker.
5960         (Read_symbols::do_whole_lib_group): New.
5961         (Read_symbols::do_lib_group): New.
5962         (Read_symbols::do_read_symbols): Handle lib groups.
5963         (Read_symbols::get_name): Handle lib groups.
5964         * readsyms.h (Read_symbols): Add an archive member pointer.
5965         (Read_symbols::do_whole_lib_group): New.
5966         (Read_symbols::do_lib_group): New.
5967         (Read_symbols::member_): New.
5968         * script.cc (read_input_script): Update call to queue_soon.
5969
5970 2010-03-19  Doug Kwan  <dougkwan@google.com>
5971
5972         * arm.cc (Stub_table::Stub_table): Initialize new data members
5973         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5974         (Stub_table::add_reloc_stub): Assign stub offset and update
5975         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5976         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5977         New data members.
5978         (Stub_table::update_data_size_and_addralign): Use
5979         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5980         instead of going over all reloc stubs.
5981         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5982         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5983         Stringpool_template::offset_ to size of Stringpool_char.
5984         (Stringpool_template::new_key_offset): Remove code to initialize
5985         Stringpool_template::offset_.
5986         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5987         Stringpool_template::offset_ to zero.
5988
5989 2010-03-15  Doug Kwan  <dougkwan@google.com>
5990
5991         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5992         offset_.
5993         (Stringpool_template::new_key_offset): New method.
5994         (Stringpool_template::add_string): Assign offsets when adding new
5995         strings.
5996         (Stringpool_template::set_string_offsets): Do not set string offsets
5997         when not optimizing.
5998         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5999         member size_.
6000         (Chunked_vector::clear): Clear size_.
6001         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6002         (Chunked_vector::size): Return size_.
6003         (Chunked_vector::push_back): Use size_ to find insert position.
6004         (Chunked_vector::size_): New data member.
6005         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6006         (Stringpool_template::new_key_offset): New method declaration.
6007         (Stringpool_template::offset_): New data member.
6008
6009 2010-03-15   Rafael Espindola  <espindola@google.com>
6010
6011         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6012         Add_symbols' constructor.
6013         * readsyms.h (Add_symbols): Remove the input_group member.
6014
6015 2010-03-10  Ian Lance Taylor  <iant@google.com>
6016
6017         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6018         target to ask whether a reference to a symbol requires a stack
6019         split.
6020         * target.h (Target::is_call_to_non_split): New function.
6021         (Target::do_is_call_to_non_split): Declare virtual function.
6022         * target.cc: Include "symtab.h".
6023         (Target::do_is_call_to_non_split): New function.
6024         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6025
6026 2010-03-10  Cary Coutant  <ccoutant@google.com>
6027
6028         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6029         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6030         (File_read::open[2]): Add whole_file_view_ to list of views.
6031         (File_read::make_view): Remove test of whole_file_view_.
6032         (File_read::find_or_make_view): Create whole_file_view_ if
6033         necessary.
6034         (File_read::clear_views): Replace bool parameter with enum;
6035         adjust all callers.  Don't delete views with permanent data;
6036         do delete cached views and views from archives if
6037         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6038         if clearing the corresponding view.
6039         * fileread.h (File_read::Clear_views_mode): New enum.
6040         (File_read::View::is_permanent_view): New method.
6041         (File_read::clear_views): Replace bool parameter
6042         with enum; adjust all callers.
6043         * options.h (General_options): Change keep_files_mapped option;
6044         add map_whole_files.
6045         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6046         releasing the file.
6047         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6048         the file.
6049
6050 2010-03-10  David S. Miller  <davem@davemloft.net>
6051
6052         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6053
6054 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6055
6056         * icf.cc (get_section_contents): Add '@' marker after processing the
6057         merge reloc.
6058
6059 2010-03-08  Doug Kwan  <dougkwan@google.com>
6060
6061         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6062         due to a conversion warning.
6063         (Arm_relobj::update_output_local_symbol_count): Check for local
6064         symbol with unset output index.
6065
6066 2010-03-05  Ian Lance Taylor  <iant@google.com>
6067
6068         * options.h (class General_options): Add --spare-dynamic-tags.
6069         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6070         --spare-dynamic-tags.
6071
6072 2010-03-05  Ian Lance Taylor  <iant@google.com>
6073
6074         * incremental.cc: Include "libiberty.h".
6075
6076 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6077
6078         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6079         function, is_info_ member.
6080         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6081         (Versions::Versions): Update caller.
6082         (Versions::define_base_version): Likewise.
6083         (Versions::add_def): Likewise.
6084
6085 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6086
6087         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6088         (Scan::possible_function_pointer_reloc): New function.
6089         (Scan::local_reloc_may_be_function_pointer): Change to call
6090         possible_function_pointer_reloc.
6091         (Scan::global_reloc_may_be_function_pointer): Ditto.
6092         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6093         relocations in ".data.rel.ro._ZTV" section.
6094         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6095         * testsuite/icf_safe_so_test.cc: Ditto.
6096         * testsuite/icf_safe_test.cc: Ditto.
6097         * testsuite/icf_safe_test.sh: Ditto.
6098
6099 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6100             Ian Lance Taylor  <iant@google.com>
6101
6102         * target-reloc.h (relocate_section): Check the symbol table index
6103         for -1U before setting the local symbol index.
6104         (scan_relocatable_relocs): If copying the relocation, record that
6105         the local symbol is required.
6106         * object.h (Symbol_value::is_output_symtab_index_set): New
6107         function.
6108         (Symbol_value::may_be_discarded_from_output_symtab): New
6109         function.
6110         (Symbol_value::has_output_symtab_entry): New function.
6111         (Symbol_value::needs_output_symtab_entry): Remove.
6112         (Symbol_value::output_symtab_index): Make sure the symbol index is
6113         set.
6114         (Symbol_value::set_output_symtab_index): Make sure the symbol
6115         index is not set.  Make sure the new index is valid.
6116         (Symbol_value::set_must_have_output_symtab_entry): New function.
6117         (Symbol_value::has_output_dynsym_entry): New function.
6118         (Symbol_value::set_output_dynsym_index): Make sure the new index
6119         is valid.
6120         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6121         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6122         local symbol if permitted.
6123         (Sized_relobj::do_finalize_local_symbols): Call
6124         is_output_symtab_index_set rather than needs_output_symtab_entry.
6125         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6126         rather than needs_output_symtab_entry.  Call
6127         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6128         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6129         is_output_symtab_index_set rather than needs_output_symtab_entry.
6130         * testsuite/discard_locals_relocatable_test.c: New file.
6131         * testsuite/discard_locals_test.sh: Test -r.
6132         * testsuite/Makefile.am (check_DATA): Add
6133         discard_locals_relocatable_test1.syms,
6134         discard_local_relocatable_test2.syms.
6135         (MOSTLYCLEANFILES): Likewise.  Also add
6136         discard_locals_relocatable_test1.lout and
6137         discard_locals_relocatable_test2.out.
6138         (discard_locals_relocatable_test1.syms): New target.
6139         (discard_locals_relocatable_test.o): New target.
6140         (discard_locals_relocatable_test1.out): New target.
6141         (discard_locals_relocatable_test2.syms): New target.
6142         (discard_locals_relocatable_test2.out): New target.
6143         (various): Add missing ../ld-new dependencies.
6144         * testsuite/Makefile.in: Rebuild.
6145
6146 2010-03-03  Nick Clifton  <nickc@redhat.com>
6147
6148         * po/fi.po: New Finnish translation.
6149
6150 2010-03-01  Doug Kwan  <dougkwan@google.com>
6151
6152         * layout.cc (Layout::Layout): Force section types of .init_array*,
6153         .preinit_array* and .fini_array* sections.
6154         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6155         Fix check of return value of std::string::find.().
6156         (Output_section::Input_section_sort_compare::operator()): Remove
6157         comment about .init_array.
6158         (Output_section::Input_section_sort_init_fini_compare::operator()):
6159         New method.
6160         (Output_section::sort_attached_input_sections): Handle .init_array
6161         and .fini_array specially.
6162         * output.h (Output_section::Inut_section_sort_compare): Update
6163         comment.
6164         (Output_section::Input_section_sort_init_fini_compare): New struct.
6165
6166 2010-02-26  Doug Kwan  <dougkwan@google.com>
6167
6168         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6169         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6170         * testsuite/debug_msg.sh: Avoid matching source line number for
6171         use of global variable undef_int.
6172
6173 2010-02-26  Doug Kwan  <dougkwan@google.com>
6174
6175         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6176         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6177         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6178         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6179         * options.cc (General_options::General_options): Initialize member
6180         fix_v4bx_.
6181         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6182         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6183         and rm_no_fix_v4bx.stdout
6184         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6185         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6186         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6187         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6188         and arm_no_fix_v4bx.
6189         * Makefile.in: Regenerate.
6190         * testsuite/arm_fix_v4bx.s: New file.
6191         * testsuite/arm_fix_v4bx.sh: Ditto.
6192
6193 2010-02-24  Doug Kwan  <dougkwan@google.com>
6194
6195         * arm.cc (Target_arm::got_section): Make the .got section the first
6196         non RELRO section in the data segment.
6197         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6198         suffixes of section names.
6199
6200 2010-02-24  Doug Kwan  <dougkwan@google.com>
6201
6202         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6203         flags and attributes merging if an input file is a binary file.
6204         * fileread.cc (Input_file::open): Record format of original file.
6205         * fileread.h (Input_file::Format): New enum type.
6206         (Input_file::Input_file): Initialize data member format_.
6207         (Input_file::format): New method definition.
6208         (Input_file::format_):: New data member.
6209
6210 2010-02-24  Doug Kwan  <dougkwan@google.com>
6211
6212         * arm.cc (Arm_output_data_got): New class.
6213         (ARM_TCB_SIZE): New constant
6214         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6215         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6216         If user uses a script with a SECTIONS clause, issue only a warning
6217         for a misplaced EXIDX input section.  Otherwise, issue an error.
6218         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6219         garbage collection.
6220         (Target_arm::got_mode_index_entry): Handle static linking.
6221         (Target_arm::Scan::local): Ditto.
6222         (Target_arm::Scan::global): Ditto.
6223         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6224         all incorrectly implemented relocations.
6225         (Target_arm::fix_exidx_coverage): Pass layout to
6226         Arm_output_section::fix_exidx_coverage.
6227         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6228         from ".ARM.exidx." and ".ARM.extab.".
6229
6230 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6231
6232         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6233         section if it does not already exist.
6234         * attributes.cc (Attributes_section_data::Attributes_section_data):
6235         Don't crash if size is zero.
6236
6237 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6238             Ian Lance Taylor  <iant@google.com>
6239
6240         * gold.cc (queue_middle_tasks): If no input files were opened,
6241         exit.
6242         * workqueue.h (Task_function::Task_function): Assert that there is
6243         a blocker.
6244
6245 2010-02-22  Doug Kwan  <dougkwan@google.com>
6246
6247         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6248         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6249         types to avoid warnings due to different uint64_t implementations
6250         on different hosts.
6251
6252 2010-02-21  Doug Kwan  <dougkwan@google.com>
6253
6254         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6255         handling of the maximum backward branch offset.
6256         (Arm_relocate_functions::thumb_branch_common): Ditto.
6257         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6258         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6259         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6260         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6261         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6262         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6263         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6264         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6265         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6266         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6267         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6268         thumb2_bl_out_of_range.o): New rules.
6269         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6270         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6271         thumb2_bl_out_of_range
6272         * testsuite/Makefile.in: Regenerate.
6273         * testsuite/arm_bl_in_range.s: New file.
6274         * testsuite/arm_bl_out_of_range.s: Ditto.
6275         * testsuite/arm_branch_in_range.sh: Ditto.
6276         * testsuite/arm_branch_range.t: Ditto.
6277         * testsuite/thumb2_branch_range.t: Ditto.
6278         * testsuite/thumb_bl_in_range.s: Ditto.
6279         * testsuite/thumb_bl_out_of_range.s: Ditto.
6280         * testsuite/thumb_branch_range.t: Ditto.
6281
6282 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6283
6284         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6285         Add reloc offset information.
6286         * icf.cc (get_section_contents): Change iterators to point to the new
6287         vectors. Add reloc offset information to the contents.
6288         * icf.h (Icf::Sections_reachable_info): New typedef.
6289         (Icf::Sections_reachable_list): New typedef.
6290         (Icf::Offset_info): New typedef.
6291         (Icf::Reloc_info): New struct typedef.
6292         (Icf::Reloc_info_list): New typedef.
6293         (Icf::symbol_reloc_list): Delete method.
6294         (Icf::addend_reloc_list): Delete method.
6295         (Icf::section_reloc_list): Delete method.
6296         (Icf::reloc_info_list): New method.
6297         (Icf::reloc_info_list_): New member.
6298
6299 2010-02-19  Doug Kwan  <dougkwan@google.com>
6300
6301         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6302         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6303         * arm.cc (Arm_relocation_functions): New forward declaration.
6304         (Target_arm::Target_arm): Initialize new data members
6305         got_mod_index_offset_ and tls_base_symbol_defined_.
6306         (Target_arm::Relocate::relocate_tls): New method.
6307         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6308          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6309         New methods.
6310         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6311         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6312         (Target_arm::got_mod_index_offset_,
6313         Target_arm::tls_base_symbol_defined_): New data members.
6314         (Target_arm::Scan::local, Target::Scan::global,
6315         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6316         relocations.
6317
6318 2010-02-18  Doug Kwan  <dougkwan@google.com>
6319
6320         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6321         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6322         text section as a parameter becuase some broken tools may not set
6323         the link in section header.
6324         (Target_arm::has_got_section): New method.
6325         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6326         without any mapping symbol as data only.  Remove warning.
6327         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6328         link in its section header, try to discover the link by inspecting the
6329         REL31 relocation at the beginning of the section.
6330         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6331         in error message.
6332         (Target_arm::Scan::global): Treat any reference to the symbol
6333         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6334
6335 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6336
6337         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6338         (Scan::global_reloc_may_be_function_pointer): New function.
6339         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6340         (Scan::global_reloc_may_be_function_pointer): New function.
6341         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6342         (Scan::global_reloc_may_be_function_pointer): New function.
6343         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6344         (Scan::global_reloc_may_be_function_pointer): New function.
6345         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6346         (Scan::global_reloc_may_be_function_pointer): New function.
6347         (Scan::possible_function_pointer_reloc): New function.
6348         (Target_x86_64::can_check_for_function_pointers): New function.
6349         * gc.h (gc_process_relocs): Scan relocation types to determine if
6350         function pointers were taken for targets that support it.
6351         * icf.cc (Icf::find_identical_sections): Include functions for
6352         folding in safe ICF whose pointer is not taken.
6353         * icf.h (Secn_fptr_taken_set): New typedef.
6354         (fptr_section_id_): New member.
6355         (section_has_function_pointers): New function.
6356         (set_section_has_function_pointers): New function.
6357         (check_section_for_function_pointers): New function.
6358         * options.h: Fix comment for safe ICF option.
6359         * target.h (can_check_for_function_pointers): New function.
6360         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6361         Modify icf_safe_test for X86-64.
6362         * testsuite/Makefile.in: Regenerate.
6363         * testsuite/icf_safe_so_test.cc: New file.
6364         * testsuite/icf_safe_so_test.sh: New file.
6365         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6366         (main): Change to take pointer to function kept_func_3.
6367         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6368         folding is done correctly for X86-64.
6369
6370 2010-02-12  David S. Miller  <davem@davemloft.net>
6371
6372         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6373         is_symbolless parameter.
6374         (Output_reloc<SHT_REL>::is_symbolless): New.
6375         (Output_reloc<SHT_REL>::is_symbolless_): New.
6376         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6377         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6378         (Output_reloc<SHT_RELA>::is_symbolless): New.
6379         (Output_data_reloc::add_global): Handle is_symbolless.
6380         (Output_data_reloc::add_global_relative): Likewise.
6381         (Output_data_reloc::add_local): Likewise.
6382         (Output_data_reloc::add_local_relative): Likewise.
6383         (Output_data_reloc::add_symbolless_global_addend): New.
6384         (Output_data_reloc::add_symbolless_local_addend): New.
6385         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6386         is_symbolless.
6387         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6388         instead of ->is_relative_
6389         (Output_reloc::write): Likewise.
6390         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6391         (Output_reloc::write_rel): Simplify.
6392
6393         * sparc.cc (Target_sparc::Scan::local): Use
6394         ->add_symbolless_local_addend as needed.
6395         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6396         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6397         based upon relocation offset.
6398
6399 2010-02-11  Doug Kwan  <dougkwan@google.com>
6400
6401         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6402         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6403         beginning of function.
6404         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6405         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6406         parameter is_32bit in calls to should_apply_static_reloc.
6407         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6408         (check_DATA): Add arm_abs_global.stdout.
6409         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6410         arm_abs_global.stdout): New rules.
6411         (MOSTLLYCLEANFILES): Add arm_abs_global
6412         * Makefile.in: Regenerate.
6413         * testsuite/arm_abs_global.s: New file.
6414         * testsuite/arm_abs_global.sh: Ditto.
6415         * testsuite/arm_abs_lib.s: Ditto.
6416
6417 2010-02-11  Ian Lance Taylor  <iant@google.com>
6418
6419         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6420         Read_relocs task.
6421         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6422         Allocate_commons_task first.
6423         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6424         task, rather than symtab_lock_.
6425         (Gc_process_relocs::~Gc_process_relocs): New function.
6426         (Gc_process_relocs::is_runnable): Check this_blocker_.
6427         (Gc_process_relocs::locks): Use next_blocker_ rather than
6428         blocker_.
6429         (Scan_relocs::~Scan_relocs): New function.
6430         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6431         symtab_lock_.
6432         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6433         next_blocker_.
6434         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6435         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6436         constructor accordingly.
6437         (class Gc_process_relocs): Likewise.
6438         (class Scan_relocs): Likewise.
6439         * common.h (class Allocate_commons_task): Remove symtab_lock_
6440         field, and corresponding constructor parameter.
6441         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6442         symtab_lock_.
6443         (Allocate_commons_task::locks): Likewise.
6444
6445 2010-02-11  Ian Lance Taylor  <iant@google.com>
6446
6447         * gold-threads.h (class Once): Define.
6448         (class Initialize_lock): Rewrite as child of Once.
6449         * gold-threads.cc (class Once_initialize): Define.
6450         (once_pointer_control): New static variable.
6451         (once_pointer, once_arg): New static variables.
6452         (c_run_once): New static function.
6453         (Once::Once, Once::run_once, Once::internal_run): New functions.
6454         (class Initialize_lock_once): Remove.
6455         (initialize_lock_control): Remove.
6456         (initialize_lock_pointer): Remove.
6457         (initialize_lock_once): Remove.
6458         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6459         (Initialize_lock::initialize): Rewrite.
6460         (Initialize_lock::do_run_once): New function.
6461         * archive.cc (Archive::interpret_header): Only clear name if it is
6462         not already empty.
6463         * fileread.cc: Include "gold-threads.h"
6464         (file_counts_lock): New static variable.
6465         (file_counts_initialize_lock): Likewise.
6466         (File_read::release): Only increment counts when using --stats.
6467         Use a lock around the increment.
6468         * parameters.cc (class Set_parameters_target_once): Define.
6469         (set_parameters_target_once): New static variable.
6470         (Parameters::Parameters): Move here from parameters.h.
6471         (Parameters::set_target): Rewrite.
6472         (Parameters::set_target_once): New function.
6473         (Parameters::clear_target): Move here and rewrite.
6474         * parameters.h (class Parameters): Update declarations.  Add
6475         set_parameters_target_once_ field.
6476         (Parameters::Parameters): Move to parameters.cc.
6477         (Parameters::clear_target): Likewise.
6478         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6479         task.
6480         (Start_group::~Start_group): New function.
6481         (Start_group::is_runnable): New function.
6482         (Start_group::locks, Start_group::run): New functions.
6483         (Finish_group::run): Change saw_undefined to size_t.
6484         * readsyms.h (class Start_group): Define.
6485         (class Finish_group): Change saw_undefined_ field to size_t.
6486         (Finish_group::Finish_group): Remove saw_undefined and
6487         this_blocker parameters.  Change all callers.
6488         (Finish_group::set_saw_undefined): New function.
6489         (Finish_group::set_blocker): New function.
6490         * symtab.h (class Symbol_table): Change saw_undefined to return
6491         size_t.  Change saw_undefined_ field to size_t.
6492         * target-select.cc (Set_target_once::do_run_once): New function.
6493         (Target_selector::Target_selector): Initialize set_target_once_
6494         field.  Don't initialize lock_ and initialize_lock_ fields.
6495         (Target_selector::instantiate_target): Rewrite.
6496         (Target_selector::set_target): New function.
6497         * target-select.h (class Set_target_once): Define.
6498         (class Target_selector): Update declarations.  Make
6499         Set_target_once a friend.  Remove lock_ and initialize_lock_
6500         fields.  Add set_target_once_ field.
6501
6502 2010-02-10  Ian Lance Taylor  <iant@google.com>
6503
6504         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6505         queueing any tasks.
6506         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6507         (queue_middle_tasks): Add all blockers before queueing any tasks.
6508         (queue_final_tasks): Likewise.
6509         * token.h (Task_token::add_blockers): New function.
6510         * object.h (Input_objects::number_of_relobjs): New function.
6511
6512 2010-02-10  Ian Lance Taylor  <iant@google.com>
6513
6514         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6515         shared, not if not position independent.
6516         * x86_64.cc (Relocate::relocate_tls): Likewise.
6517         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6518         (tls_pie_pic_test): New target.
6519         * testsuite/Makefile.in: Rebuild.
6520
6521         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6522         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6523         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6524         * testsuite/Makefile.in: Rebuild.
6525
6526 2010-02-09  David S. Miller  <davem@davemloft.net>
6527
6528         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6529         R_SPARC_RELATIVE using ->add_local_relative().
6530         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6531
6532         * output.h (Output_data_dynamic::add_section_size): New method
6533         that takes two Output_data objects.
6534         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6535         entry param.  Handle it in initializers.
6536         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6537         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6538         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6539         arg.
6540         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6541         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6542         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6543         for dynrel_includes_plt.
6544         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6545         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6546         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6547         before .rela.plt
6548         (Target_sparc::do_finalize_sections): Update to pass true for
6549         dynrel_includes_plt.
6550         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6551         output before .rela.plt
6552         (Target_powerpc::do_finalize_sections): Update to pass true for
6553         dynrel_includes_plt when 32-bit.
6554
6555 2010-02-08  Doug Kwan  <dougkwan@google.com>
6556
6557         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6558         method.
6559         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6560         Arm_relobj::scan_section_for_cortex_a8_stubs,
6561         Arm_relobj::do_relocation_section): Instead of calling
6562         Output_section::output_address, use faster
6563         Arm_relobj::simple_input_section_output_address.
6564
6565 2010-02-08  David S. Miller  <davem@davemloft.net>
6566
6567         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6568         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6569         relocation helper function.
6570
6571         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6572         just like R_SPARC_GOT{10,13,22}.
6573         (Target_sparc::Scan::local): Likewise.
6574         (Target_sparc::Relocate:relocate): Likewise.
6575
6576 2010-02-06  Ian Lance Taylor  <iant@google.com>
6577
6578         * configure.ac: Rewrite targetobjs duplicate removal code to use
6579         only shell constructs.
6580         * configure: Rebuild.
6581
6582 2010-02-05  Doug Kwan  <dougkwan@google.com>
6583
6584         PR 11247
6585         * arm.cc (Arm_relobj::section_is_scannable): New method.
6586         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6587         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6588
6589 2010-02-04  Doug Kwan  <dougkwan@google.com>
6590
6591         PR 11247
6592         * arm-reloc-property.cc (cstdio): Include.
6593         * configure.ac (targetobjs): Remove duplicates.
6594         * configure: Regenerate.
6595         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6596         big and little endian version for a given address size.
6597
6598 2010-02-03  Doug Kwan  <dougkwan@google.com>
6599
6600         * arm-reloc-property.cc
6601         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6602         definition.
6603         * arm-reloc-property.h
6604         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6605         New method definition.
6606         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6607         declaration.
6608         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6609         overflow to N.
6610         (GOT_PREL): Change implemented to Y.
6611         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6612         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6613         (Arm_relocate_functions::movw_abs_nc): Remove method.
6614         (Arm_relocate_functions::movt_abs): Ditto.
6615         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6616         (Arm_relocate_functions::thm_movt_abs): Ditto.
6617         (Arm_relocate_functions::movw_rel_nc): Ditto.
6618         (Arm_relocate_functions::movw_rel): Ditto.
6619         (Arm_relocate_functions::movt_rel): Ditto.
6620         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6621         (Arm_relocate_functions:thm_movw_rel): Ditto.
6622         (Arm_relocate_functions:thm_movt_rel): Ditto.
6623         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6624         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6625         New method definitions.
6626         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6627         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6628         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6629         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6630         (Target_arm::Relocate::relocate): Check for non-static or
6631         unimplemented relocation code and exit early.  Change calls to
6632         Target_arm::reloc_uses_thumb_bit and
6633         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6634         instead.  Refactor code to handle similar relocations to increase
6635         code sharing.  Remove check for unsupported relocation code in switch
6636         statement.
6637         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6638         relocation property table to find out size.  Change error message to
6639         print out the name of a relocation code instead of the numeric value.
6640         (Target_arm::scan_reloc_for_stub): Use relocation property table
6641         instead of calling Target_arm::reloc_uses_thumb_bit().
6642
6643 2010-02-02  Doug Kwan  <dougkwan@google.com>
6644
6645         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6646         types of relaxed input section.
6647
6648 2010-02-02  Doug Kwan  <dougkwan@google.com>
6649
6650         * Makefile.am (HFILES): Add arm-reloc-property.h.
6651         (DEFFILES): New.
6652         (TARGETSOURCES): Add arm-reloc-property.cc
6653         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6654         (libgold_a_SOURCES): $(DEFFILES)
6655         * Makefile.in: Regenerate.
6656         * arm-reloc-property.cc: New file.
6657         * arm-reloc-property.h: New file.
6658         * arm-reloc.def: New file.
6659         * arm.cc: Update comments.
6660         (arm-reloc-property.h): New included header.
6661         (arm_reloc_property_table): New global variable.
6662         (Target_arm::do_select_as_default_target): New method definition.
6663         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6664         arm-reloc-property to targ_extra_obj.
6665         * parameters.cc (set_parameters_target): Call
6666         Target::select_as_default_target().
6667         * target.h (Target::select_as_default_target): New method definition.
6668         (Target::do_select_as_default_target): Same.
6669
6670 2010-02-01  Doug Kwan  <dougkwan@google.com>
6671
6672         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6673         first_output_text_section_.
6674         (Arm_exidx_fixup::first_output_text_section): New method definition.
6675         (Arm_exidx_fixup::first_output_text_section_): New data member.
6676         (Arm_exidx_fixup::process_exidx_section): Record the first text
6677         output section seen.
6678         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6679         and entsize in output section header.
6680
6681 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6682
6683         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6684         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6685         (Arm_relocate_functions::thm_alu11): New Method.
6686         (Arm_relocate_functions::thm_pc8): New Method.
6687         (Arm_relocate_functions::thm_pc12): New Method.
6688         (Target_arm::Scan::local): Handle the relocations.
6689         (Target_arm::Scan::global): Likewise.
6690         (Target_arm::Relocate::relocate): Likewise.
6691         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6692
6693 2010-01-29  Doug Kwan  <dougkwan@google.com>
6694
6695         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6696         of relocation types as ld.
6697
6698 2010-01-29  Doug Kwan  <dougkwan@google.com>
6699
6700         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6701         to public.
6702         (Arm_relocate_functions::thumb_branch_common): Ditto.
6703         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6704         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6705         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6706         Arm_relocate_functions::jump24): Remove.
6707         (Target_arm::Relocate::relocate): Adjust code to call
6708         Arm_relocation_functions::arm_branch_common and
6709         Arm_relocation_functions::thumb_branch_common instead of their removed
6710         wrappers.  Merge switch-cases together to reduce source code size.
6711
6712 2010-01-29  Doug Kwan  <dougkwan@google.com>
6713
6714         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6715         output_local_symbol_count_needs_update_.
6716         (Arm_relobj::output_local_symbol_count_needs_update,
6717          Arm_relobj::set_output_local_symbol_count_needs_update,
6718          Arm_relobj::update_output_local_symbol_count): New methods.
6719         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6720         member.
6721         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6722         of pointed function as in a R_ARM_PREL31 relocation.
6723         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6724         for output local symbol count updating.
6725         (Target_arm::do_relax): Update output local symbol counts in objects
6726         if necessary.
6727         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6728
6729 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6730
6731         * arm.cc: Added support for the ARM relocations:
6732         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6733         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6734         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6735         movw_prel_nc).
6736         (Arm_relocate_functions::movw_rel): New method.
6737         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6738         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6739         thm_movw_prel_nc).
6740         (Arm_relocate_functions::thm_movw_rel): New method.
6741         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6742         thm_movt_prel).
6743         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6744         relocations.
6745         (Target_arm::Scan::global): Likewise.
6746         (Target_arm::Relocate::relocate): Likewise.
6747         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6748         Likewise.
6749
6750 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6751
6752         * arm.cc: Added support for ARM group relocations.
6753         (Target_arm::reloc_needs_sym_origin): New method.
6754         (Arm_relocate_functions::calc_grp_kn): New method.
6755         (Arm_relocate_functions::calc_grp_residual): New method.
6756         (Arm_relocate_functions::calc_grp_gn): New method.
6757         (Arm_relocate_functions::arm_grp_alu): New Method.
6758         (Arm_relocate_functions::arm_grp_ldr): New Method.
6759         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6760         (Arm_relocate_functions::arm_grp_ldc): New Method.
6761         (Target_arm::Scan::local): Handle the ARM group relocations.
6762         (Target_arm::Scan::global): Likewise.
6763         (Target_arm::Relocate::relocate): Likewise.
6764         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6765         Likewise.
6766
6767 2010-01-26  Doug Kwan  <dougkwan@google.com>
6768
6769         * arm.cc (set): Include.
6770         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6771         pointer type.
6772         (Arm_output_section::Text_section_list): New type.
6773         (Arm_output_section::append_text_sections_to_list): New method.
6774         (Arm_output_section::fix_exidx_coverage): Ditto.
6775         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6776         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6777         Relobj::set_section_offset() instead of
6778         Sized_relobj::invalidate_section_offset().
6779         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6780         parameter for section headers. Ignore relocation sections for
6781         unallocated sections and EXIDX sections.
6782         (Target_arm::fix_exidx_coverage): New method.
6783         (Target_arm::output_section_address_less_than): New type.
6784         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6785         linked text section instead of the EXIDX section.
6786         (Arm_output_section::create_stub_group): Add an assertion to check
6787         that this is not an EXIDX output section.
6788         (Arm_output_section::append_text_sections_to_list): New method.
6789         (Arm_output_section::fix_exidx_coverage): Ditto.
6790         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6791         Arm_relobj::section_needs_reloc_stub_scanning.
6792         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6793         first pass.
6794         (Target_arm::fix_exidx_coverage): New method.
6795         * object.h (Relobj::set_output_section): New method.
6796         (Sized_relobj::invalidate_section_offset): Remove method.
6797         (Sized_relobj::do_invalidate_section_offset): Remove method.
6798         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6799
6800 2010-01-25  Doug Kwan  <dougkwan@google.com>
6801
6802         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6803         Fix warning due to signed and unsigned comparison on a 32-bit host.
6804
6805 2010-01-22  Doug Kwan  <dougkwan@google.com>
6806
6807         * arm.cc (Target_arm::do_relax): Record an output section for section
6808         offset adjustment it contains any stub table that has changed.
6809         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6810         offsets in an output section if necessary.
6811         * output.cc (Output_section::Output_section): Initialize
6812         section_offsets_need_adjustments_.
6813         (Output_section::add_input_section_for_script): Renamed to
6814         Output_section::add_simple_input_section.
6815         (Output_section::save_states): Add a comment.
6816         (Output_section::discard_states): New method defintion.
6817         (Output_section::adjust_section_offsets): Same.
6818         * output.h (Output_section::add_input_section_for_script): Renamed to
6819         Output_section::add_simple_input_section.
6820         (Output_section::discard_states): New method declaration.
6821         (Output_section::adjust_section_offsets): Same.
6822         (Output_section::section_offsets_need_adjustment,
6823         Output_section::set_section_offsets_need_adjustment): New method
6824         definitions.
6825         (Output_section::section_offsets_need_adjustment_): New data member.
6826         * script-sections.cc
6827         (Output_section_element_input::set_section_address): Adjust code for
6828         renaming of Output_section::add_input_section_for_script.
6829         (Orphan_output_section::set_section_address): Same.
6830
6831 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6832
6833         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6834         Fix_v4bx enum values .
6835         * gold/options.h (General_options): New option definitions.
6836         (General_options::fix_v4bx): New method.
6837         (General_options::Fix_v4bx): New enum.
6838         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6839         (General_options::parse_fix_v4bx_interworking): New method.
6840
6841 2010-01-22  Doug Kwan  <dougkwan@google.com>
6842
6843         * arm.cc (Arm_exidx_fixup): New class.
6844
6845 2010-01-21  Doug Kwan  <dougkwan@google.com>
6846
6847         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6848         classes.
6849         (Arm_exidx_section_offset_map): New type.
6850
6851 2010-01-21  Doug Kwan  <dougkwan@google.com>
6852
6853         * arm.cc (Arm_exidx_input_section): New class.
6854         (Arm_relobj::exidx_input_section_by_link,
6855         Arm_relobj::exidx_input_section_by_shndx,
6856         Arm_relobj::make_exidx_input_section): New methods.
6857         (read_arm_attributes_section): Remove.
6858         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6859         information about them.
6860         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6861         to here.
6862
6863 2010-01-20  Doug Kwan  <dougkwan@google.com>
6864
6865         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6866         Input_section_specifier to Section_id.
6867         (Target_arm::new_arm_input_section: Adjust code for change of key
6868         type.
6869         (Target_arm::find_arm_input_section): Ditto.
6870         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6871         (Section_id): Remove.
6872         (Garbage_collection::Section_id_hash): Remove.
6873         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6874         (Section_id): Remove.
6875         (Icf::Section_id_hash): Remove.
6876         * object.h (Section_id, Const_section_id, Section_id_hash,
6877         Const_section_id_hash): New type definitions.
6878         * output.cc (Output_section::add_relaxed_input_section): Change to
6879         use Const_section_id instead of Input_section_specifier as key type.
6880         (Output_section::add_merge_input_section): Ditto.
6881         (Output_section::build_relaxation_map): Change to use Section_id
6882         instead of Input_section_specifier as key type.
6883         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6884         Ditto.
6885         (Output_section::convert_input_sections_to_relaxed_sections): Change
6886         to use Const_section_id instead of Input_section_specifier as key type.
6887         (Output_section::find_merge_section): Ditto.
6888         (Output_section::find_relaxed_input_section): Ditto.
6889         * output.h (Input_section_specifier): Remove class.
6890         (Output_section::Output_section_data_by_input_section_map): Change
6891         key type to Const_section_id.
6892         (Output_section::Output_relaxed_input_section_by_input_section_map):
6893         Ditto.
6894         (Output_section::Relaxation_map): Change key type to Section_id.
6895
6896 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6897
6898         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6899         (class Arm_v4bx_stub): New class.
6900         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6901         (Stub_factory::make_arm_v4bx_stub): New method.
6902         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6903         (Stub_table::empty): Handle v4bx stubs.
6904         (Stub_table::add_arm_v4bx_stub): New method.
6905         (Stub_table::find_arm_v4bx_stub): New method.
6906         (Arm_relocate_functions::v4bx): New method.
6907         (Target_arm::fix_v4bx): New method.
6908         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6909         (Stub_table::relocate_stubs): Likewise.
6910         (Stub_table::do_write): Likewise.
6911         (Stub_table::update_data_size_and_addralign): Likewise.
6912         (Stub_table::finalize_stubs):  Likewise.
6913         (Target_arm::Scan::local): Likewise.
6914         (Target_arm::Scan::global): Likewise.
6915         (Target_arm::do_finalize_sections): Likewise.
6916         (Target_arm::Relocate::relocate): Likewise.
6917         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6918         Likewise.
6919         (Target_arm::scan_reloc_for_stub): Likewise.
6920         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6921
6922 2010-01-19  Ian Lance Taylor  <iant@google.com>
6923
6924         * output.cc (Output_section_headers::do_sized_write): Write large
6925         segment count to sh_info field.
6926         (Output_file_header::do_sized_write): For large segment count,
6927         write PN_XNUM to e_phnum field.
6928
6929 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6930
6931         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6932         (Arm_relocate_functions::thm_jump8): New function.
6933         (Arm_relocate_functions::thm_jump11): New function.
6934         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6935         R_ARM_THM_JUMP11.
6936         (Target_arm::Scan::global): Likewise.
6937         (Target_arm::Relocate::relocate): Likewise.
6938         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6939         Likewise.
6940
6941 2010-01-14  Doug Kwan  <dougkwan@google.com>
6942
6943         * arm.cc (map, utility): Include headers.
6944         (Target_arm::apply_cortex_a8_workaround): New method.
6945         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6946         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6947         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6948         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6949         the --[no-]fix-cortex-a8 command line options.
6950         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6951         (Target_arm::relocate_stub): Use addend in instruction template.
6952         * options.h (DEFINE_bool): Set the user-set flag.
6953         (General_options): Add --[no-]-fix-cortex options.
6954         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6955         : Update fast look-up map after conversion.
6956
6957 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6958
6959         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6960         in the first pass of do_layout.
6961
6962 2010-01-13  Doug Kwan  <dougkwan@google.com>
6963
6964         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6965         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6966         apparent compiler problem of not folding static constant integral
6967         data members of elfcpp::Elf_sizes<32>.
6968
6969 2010-01-13  Doug Kwan  <dougkwan@google.com>
6970
6971         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6972         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6973         Arm_relobj::scan_section_for_cortex_a8_erratum,
6974         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6975         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6976         sections to scan for relocation stubs into a new method
6977         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6978         relocation and Cortex-A8 stub scanning.
6979         (Target_arm::do_relax): Force stubs to be after stubbed sections
6980         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6981         the beginning of a new relaxation pass.  Update a comment.
6982         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6983
6984 2010-01-12  Ian Lance Taylor  <iant@google.com>
6985
6986         * target-reloc.h (visibility_error): New inline function.
6987         (relocate_section): Call visibility_error.
6988         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6989         (MOSTLYCLEANFILES): Likewise.
6990         (protected_4_pic.o, protected_3.err): New targets.
6991         * testsuite/protected_4.cc: New file.
6992
6993 2010-01-12  Doug Kwan  <dougkwan@google.com>
6994
6995         * arm.cc (Cortex_a8_reloc): New class.
6996         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6997         and cortex_a8_relocs_info_.
6998         (Target_arm::fix_cortex_a8): New method definition.
6999         (Target_arm::Cortex_a8_relocs_info): New type.
7000         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7001         New data member declarations.
7002         (Target_arm::scan_reloc_for_stub): Record information about
7003         relocations for THUMB branches that might be exempted from the
7004         Cortex-A8 workaround.
7005         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7006         at the beginning of a relaxation pass.
7007
7008 2010-01-12  Doug Kwan  <dougkwan@google.com>
7009
7010         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7011         (Arm_relobj::Mapping_symbol_position,
7012          Arm_reloj::Mapping_symbol_position_less,
7013          Arm_relobj::Mapping_symbols_info): New types.
7014         (Target_arm::is_mapping_symbol_name): New method definition.
7015         (Arm_relobj::do_count_local_symbols): Save information about mapping
7016         symbols.
7017
7018 2010-01-11  Doug Kwan  <dougkwan@google.com>
7019
7020         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7021         Arm_relocate_functions::thumb32_branch_upper,
7022         Arm_relocate_functions::thumb32_branch_lower,
7023         Arm_relocate_functions::thumb32_cond_branch_offset,
7024         Arm_relocate_functions::thumb32_cond_branch_upper,
7025         Arm_relocate_functions::thumb32_cond_branch_lower,
7026         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7027         branch offset encoding.
7028         (Arm_relocate_functions::thumb_branch_common): Use new branch
7029         offset encoding methods to avoid code duplication.
7030         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7031         (Stub_addend_reader::operator()): Use new branch encoding method
7032         to avoid code duplication.
7033
7034 2010-01-11  Doug Kwan  <dougkwan@google.com>
7035
7036         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7037         (Target_arm::do_finalize_sections): Define special EXIDX section
7038         symbols only if referenced.
7039         * gc.h (Garbage_collection::add_reference): New method.
7040         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7041         code duplication.
7042
7043 2010-01-11  Ian Lance Taylor  <iant@google.com>
7044
7045         * script.cc (Version_script_info::build_expression_list_lookup):
7046         Change complaing about duplicate wildcard match from error to
7047         warning.
7048
7049         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7050         of 2009-12-30.
7051         (Version_script_info::Version_script_info): Initialize globs_,
7052         default_version_, default_is_global_, and exact_.  Don't
7053         initialize globals_ or locals_.
7054         (Version_script_info::build_lookup_tables): Build local symbols
7055         first.
7056         (Version_script_info::unquote): New function.
7057         (Version_script_info::add_exact_match): New function.
7058         (Version_script_info::build_expression_list_lookup): Remove lookup
7059         parameter.  Add is_global parameter.  Change all callers.  Handle
7060         wildcard pattern specially.  Unquote pattern.  Call
7061         add_exact_match.
7062         (Version_script_info::get_name_to_match): New function.
7063         (Version_script_info::get_symbol_version): New function.
7064         (Version_script_info::get_symbol_version_helper): Remove.
7065         (Version_script_info::check_unmatched_names): Call unquote.
7066         * script.h (class Version_script_info): Change get_symbol_version
7067         to be non-inline and add is_global parameter; change all callers.
7068         Rewrite symbol_is_local.  Update declarations.  Define struct
7069         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7070         Remove globals_ and locals_ members.  Add exact_, globs_,
7071         default_version_, is_global_.
7072         (Version_script_info::Glob): Remove pattern, add expression and
7073         is_global.  Update constructor.  Change all callers.
7074         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7075         default version.
7076         (Versions::symbol_section_contents): If a symbol is undefined, or
7077         defined in a dynamic object, set the version index to
7078         VER_NDX_LOCAL.
7079         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7080         symbol_is_local.
7081         (Symbol_table::add_from_pluginobj): Likewise.
7082         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7083
7084 2010-01-11  Doug Kwan  <dougkwan@google.com>
7085
7086         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7087         (incremental_dump_LDADD): Add linking option for libintl.
7088         * Makefile.in: Regenerate.
7089
7090 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7091
7092         PR gold/11144
7093         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7094         instead of -Ds.
7095         * testsuite/Makefile.in: Regenerated.
7096
7097 2010-01-10  Doug Kwan  <dougkwan@google.com>
7098
7099         * options.h (DEFINE_var): Use parentheses around argument varname__
7100         in macro body to avoid any unintended subsequent substitutions.
7101
7102 2010-01-10  Ian Lance Taylor  <iant@google.com>
7103
7104         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7105         candidates before doing symbol resolution.
7106
7107         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7108         ODR candidates if only one is weak.
7109
7110 2010-01-08  Ian Lance Taylor  <iant@google.com>
7111
7112         * script.cc (Version_script_info::build_expression_list_lookup):
7113         Don't warn about ambiguous version, just record the ambiguity.
7114         (Version_script_info::get_symbol_version_helper): Give error if
7115         version is ambiguous.
7116
7117 2010-01-08  Doug Kwan  <dougkwan@google.com>
7118
7119         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7120           prev_data_size_ and prev_addralign_.  Remove initializer for
7121           deleted data member has_been_changed_.
7122           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7123           to determine if the table is empty.
7124           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7125           Remove.
7126           (Stub_table::add_reloc_stub): Define method in class definition
7127           instead of just declaring it there.
7128           (Stub_table::add_cortex_a8_stub): New method definition.
7129           (Stub_table::update_data_size_and_addralign): Ditto.
7130           (Stub_table::finalize_stubs): Ditto.
7131           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7132           (Stub_table::do_addralign_): Return address alignment in the
7133           (Stub_table::do_reset_address_and_file_offset): Define method in
7134           class definition instead of declaring it there.  Set current data
7135           size to be the data size of the previous pass.
7136           (Stub_table::set_final_data_size): Use current data size as the
7137           final data size.
7138           (Stub_table::relocate_stub): Change parameter type of stub from
7139           Reloc_stub pointer to Stub pointer.
7140           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7141           (Stub_table::Cortex_a8_stub_list): New typedef.
7142           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7143            Stub_table::prev_addralign_): New data member.
7144           (Arm_relobj::Arm_relobj): Initialize data member
7145           section_has_cortex_a8_workaround_.
7146           (Arm_relobj::section_has_cortex_a8_workaround,
7147            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7148            definitions.
7149           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7150           declarations.
7151           (Target_arm::relocate_stub): Change parameter type of stub from
7152           Reloc_stub pointer to Stub pointer.
7153           (Insn_template::size, Insn_template::alignment): Handle
7154           THUMB16_SPECIAL_TYPE.
7155           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7156            Stub_table::update_data_size_and_addralign,
7157            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7158           definitions.
7159           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7160           (Stub_table::do_write): Ditto.
7161           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7162
7163 2010-01-08  Ian Lance Taylor  <iant@google.com>
7164
7165         PR 11108
7166         * symtab.h (class Symbol): Remove fields is_target_special_ and
7167         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7168         (Symbol::is_defined_in_discarded_section): New function.
7169         (Symbol::set_is_defined_in_discarded_section): New function.
7170         (Symbol::has_plt_offset): Rewrite.
7171         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7172         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7173         Don't initialize is_target_special_ or has_plt_offset_.
7174         Initialize is_defined_in_discarded_section_.
7175         (Symbol_table::add_from_relobj): If appropriate, set
7176         is_defined_in_discarded_section.
7177         * resolve.cc (Symbol::override_base_with_special): Don't test
7178         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7179         * target-reloc.h (relocate_section): Do special handling for
7180         symbols defined in discarded sections for global symbols as well
7181         as local symbols.
7182
7183 2010-01-08  Ian Lance Taylor  <iant@google.com>
7184
7185         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7186         the SHT_SYMTAB case.
7187
7188 2010-01-08  Ian Lance Taylor  <iant@google.com>
7189
7190         * object.cc (Sized_relobj::do_layout): Don't get confused if
7191         layout_eh_frame returns NULL.
7192
7193 2010-01-08  Ian Lance Taylor  <iant@google.com>
7194
7195         PR 11084
7196         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7197         dynamic symbol table, use the normal symbol table.
7198         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7199         symbol table.
7200
7201 2010-01-08  Ian Lance Taylor  <iant@google.com>
7202
7203         PR 11072
7204         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7205         sections.
7206
7207 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7208
7209         * version.cc (print_version): Change to "Copyright 2010".
7210
7211 2010-01-08  Ian Lance Taylor  <iant@google.com>
7212
7213         PR 10287
7214         PR 11063
7215         * i386.cc (class Target_i386): Change return type of plt_section
7216         to be non-const.
7217         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7218         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7219         tls_desc_rel_ field.
7220         (Output_data_plt_i386::rel_tls_desc): New function.
7221         (Target_i386::rel_tls_desc_section): New function.
7222         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7223         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7224         R_386_TLS_DESC reloc in rel_tls_desc_section.
7225         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7226         Define struct Tlsdesc_info.
7227         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7228         (Target_x86_64::do_reloc_symbol_index): New function.
7229         (Target_x86_64::add_tlsdesc_info): New function.
7230         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7231         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7232         tlsdesc_rel_ field.
7233         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7234         all callers.
7235         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7236         (Target_x86_64::rela_tlsdesc_section): New function.
7237         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7238         handling.
7239         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7240         (Target_x86_64::do_reloc_addend): New function.
7241         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7242         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7243         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7244         (Output_reloc::type): New function.
7245         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7246         (Output_reloc::is_target_specific): New function.
7247         (Output_reloc::target_arg): New function.
7248         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7249         absolute relocs and target specific relocs.
7250         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7251         add_target_specific.
7252         (class Output_data_reloc) [SHT_RELA]: Likewise.
7253         * output.cc (Output_reloc::Output_reloc): Add four new versions
7254         for absolute relocs and target specific relocs.
7255         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7256         (Output_reloc::get_symbol_index): Likewise.
7257         (Output_reloc::local_section_offset): Check that local_sym_index_
7258         is not TARGET_CODE or 0.
7259         (Output_reloc::symbol_value): Likewise.
7260         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7261         reloc.
7262         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7263         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7264         functions.
7265         * layout.cc (add_target_dynamic_tags): Use output section for
7266         DT_PLTRELSZ and DT_JMPREL.
7267
7268 2010-01-07  Ian Lance Taylor  <iant@google.com>
7269
7270         PR 11061
7271         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7272         function.
7273         (class Output_data_reloc_generic): Define.
7274         (class Output_data_reloc_base): Change base class to
7275         Output_data_reloc_generic.  Change add() method to call
7276         bump_relative_reloc_count for a relative reloc.  Remove
7277         sort_relocs_ field.
7278         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7279         to sort_relocs().
7280         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7281         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7282         appropriate.
7283         * layout.h (class Layout): Update declaration.
7284
7285 2010-01-07  Ian Lance Taylor  <iant@google.com>
7286
7287         * output.h (class Output_data): Add const version of
7288         output_section and do_output_section.
7289         (class Output_section_data): Add const version of
7290         do_output_section.
7291         (class Output_section): Likewise.
7292         * layout.cc (Layout::add_target_dynamic_tags): New function.
7293         * layout.h (class Layout): Update declarations.
7294         * arm.cc (Target_arm::do_finalize_sections): Use
7295         add_target_dynamic_tags.
7296         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7297         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7298         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7299         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7300
7301 2010-01-07  Ian Lance Taylor  <iant@google.com>
7302
7303         PR 11042
7304         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7305         object as needed.
7306
7307 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7308             Ian Lance Taylor  <iant@google.com>
7309
7310         PR 11019
7311         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7312         Xindex::read_symtab_xindex.
7313
7314 2010-01-07  Doug Kwan  <dougkwan@google.com>
7315
7316         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7317         (Insn_template::thumb16_bcond_insn): New method declaration.
7318         (Insn_template): Fix spelling.
7319         (Stub::thumb16_special): New method declaration.
7320         (Stub::do_write): Define virtual method which was previously pure
7321         virtual.
7322         (Stub::do_thumb16_special): New method declaration.
7323         (Stub::do_fixed_endian_write): New template member.
7324         (Reloc_stub::do_write): Remove.
7325         (Reloc_stub::do_fixed_endian_write): Remove.
7326         (Cortex_a8_stub): New class definition.
7327         (Stub_factory::make_cortex_a8_stub): New method definition.
7328         (Stub_factory::Stub_factory): Add missing static storage class
7329         qualifier for elf32_arm_stub_a8_veneer_blx.
7330
7331 2010-01-07  Ian Lance Taylor  <iant@google.com>
7332
7333         PR 10980
7334         * options.h (class General_options): Add --warn-unresolved-symbols
7335         and --error-unresolved-symbols.
7336         * errors.cc (Errors::undefined_symbol): Implement
7337         --warn-unresolved-symbols.
7338
7339         * options.h (class General_options): Add -z text and -z textoff.
7340         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7341
7342 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7343
7344         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7345         (Garbage_collection::cident_sections): New function.
7346         (Garbage_collection::add_cident_section): New function.
7347         (Garbage_collection::cident_sections_): New member.
7348         (gc_process_relocs): Add references to sections whose names are C
7349         identifiers.
7350         * gold.h (cident_section_start_prefix): New constant.
7351         (cident_section_stop_prefix): New constant.
7352         (is_cident): New function.
7353         * layout.cc (Layout::define_section_symbols): Replace string constants
7354         with the newly defined constants.
7355         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7356         C identifiers.
7357         * testsuite/Makefile.am: Add gc_orphan_section_test.
7358         * testsuite/Makefile.in: Regenerate.
7359         * testsuite/gc_orphan_section_test.cc: New file.
7360         * testsuite/gc_orphan_section_test.sh: New file.
7361
7362 2010-01-06  Ian Lance Taylor  <iant@google.com>
7363
7364         PR 10980
7365         * options.h (class General_options): Add --warn-shared-textrel.
7366         * layout.cc (Layout::finish_dynamic_section): Implement
7367         --warn-shared-textrel.
7368
7369         PR 10980
7370         * options.h (class General_options): Add --warn-multiple-gp.
7371
7372 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7373
7374         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7375         $(THREADSLIB) and $(LIBDL).
7376         * Makefile.in: Rebuild.
7377
7378 2010-01-06  Ian Lance Taylor  <iant@google.com>
7379
7380         PR 10980
7381         * options.cc (General_options::parse_section_start): New function.
7382         (General_options::section_start): New function.
7383         (General_options::General_options): Initialize all members.
7384         * options.h: Include <map>
7385         (class General_options): Add --section-start.  Add section_starts_
7386         member.
7387         * layout.cc (Layout::attach_allocated_section_to_segment): If
7388         --section-start was used, set the address of the segment.  Remove
7389         local sort_sections.
7390         (Layout::relaxation_loop_body): If the address of the load segment
7391         has been set by --section-start, don't use it.
7392         * output.h (Output_segment::update_flags_for_output_section): New
7393         function.
7394         * output.cc (Output_segment::add_output_section): Call
7395         update_flags_for_output_section.
7396
7397 2010-01-05  Ian Lance Taylor  <iant@google.com>
7398
7399         PR 10980
7400         * options.h (class General_options): Add --undefined-version.
7401         * script.cc (struct Version_expression): Add was_matched_by_symbol
7402         field.
7403         (Version_script_info::matched_symbol): New function.
7404         (Version_script_info::get_symbol_version_helper): Call
7405         matched_symbol.
7406         (Version_script_info::check_unmatched_names): New function.
7407         * script.h (class Version_script_info): Update declarations.
7408         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7409
7410         * options.h (class General_options): Use DEFINE_bool_alias for
7411         allow_multiple_definition.
7412         * resolve.cc (Symbol_table::should_override): Don't test
7413         allow_multiple_definition.
7414
7415         PR 10980
7416         * options.h (class General_options): Add --cref.
7417         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7418         until after printing cref table.
7419         * cref.cc: Include "symtab.h".
7420         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7421         (Cref_table_compare::operator()): New function.
7422         (Cref_inputs::gather_cref): New function.
7423         (filecol): New static const.
7424         (Cref_inputs::print_cref): New function.
7425         (Cref::print_cref): New function.
7426         * cref.h: Include <cstdio>.
7427         (class Cref): Update declarations.
7428         * mapfile.h (Mapfile::file): New function.
7429         * object.h (class Object): Define Symbols.  Declare virtual
7430         do_get_global_symbols.
7431         (Object::get_global_symbols): New function.
7432         * object.cc (Input_objects::add_object): Pass object to cref_ if
7433         --cref.
7434         (Input_objects::archive_start): Likewise.
7435         (Input_objects::archive_stop): Likewise.
7436         (Input_objects::print_cref): New function.
7437         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7438         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7439         --cref.
7440         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7441         function.
7442         * plugin.h (class Sized_pluginobj): Update declarations.
7443
7444 2010-01-05  Ian Lance Taylor  <iant@google.com>
7445
7446         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7447         to is_default_version.  Rename insdef to insdefault.
7448         (Symbol_table::add_from_relobj): Rename def to is_default_version
7449         and local to is_forced_local.
7450         (Symbol_table::add_from_pluginobj): Likewise.
7451         (Symbol_table::add_from_dynobj): Likewise.
7452         (Symbol_table::define_special_symbol): Rename insdef to
7453         insdefault.
7454
7455 2010-01-04  Ian Lance Taylor  <iant@google.com>
7456
7457         PR 10980
7458         * options.h (class General_options): Add
7459         --allow-multiple-definition and -z muldefs.
7460         * resolve.cc (Symbol_table::should_override): Don't warn about a
7461         multiple symbol definition if --allow-multiple-definition or -z
7462         muldefs.
7463
7464         PR 10980
7465         * options.h (class General_options): Add --add-needed and
7466         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7467         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7468         error if --copy-dt-needed-entries aka --add-needed is used and
7469         would cause a change in behaviour.
7470
7471         PR 10980
7472         * options.h (class General_options): Add -G as a short version of
7473         --shared.  Add no-op options -assert, -g, and -i.
7474
7475 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7476
7477         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7478         check for .text or .gnu.linkonce.t sections.
7479         * icf.cc (Icf::find_identical_sections): Ditto.
7480         Change the detection for mangled function name within the section
7481         name.
7482         * icf.h (is_section_foldable_candidate): New function.
7483
7484 2009-12-30  Ian Lance Taylor  <iant@google.com>
7485
7486         PR 10980
7487         * options.h (class General_options): Permit two dashes with
7488         --retain-symbols-file.
7489
7490 2009-12-30  Ian Lance Taylor  <iant@google.com>
7491
7492         PR 10979
7493         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7494         don't put the file header and segment headers in the text
7495         segment.
7496
7497         PR 10979
7498         * common.cc (Sort_commons::operator()): Stabilize sort when both
7499         entries are NULL.
7500         (Symbol_table::do_allocate_commons_list): When allocating common
7501         symbols, skip a symbol which is no longer common.
7502         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7503         an object before checking its type.
7504         * testsuite/common_test_2.c: New file.
7505         * testsuite/common_test_3.c: New file.
7506         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7507         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7508         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7509         (common_test_2_pic.o, common_test_2.so): New targets.
7510         (common_test_3_pic.o, common_test_3.so): New targets.
7511         * testsuite/Makefile.in: Rebuild.
7512
7513         PR 10979
7514         * script.cc (read_input_script): If we see a new SECTIONS clause,
7515         and we have added an input section, give an error.
7516         * layout.h (class Layout): Add have_added_input_section function.
7517         Add have_added_input_section_ field.
7518         * layout.cc (Layout::Layout): Initialize
7519         have_added_input_section_.
7520         (Layout::layout): Set have_added_input_section_.
7521         (Layout::layout_eh_frame): Likewise.
7522
7523 2009-12-30  Ian Lance Taylor  <iant@google.com>
7524
7525         PR 10931
7526         * options.h (class General_options): Add --sort-common option.
7527         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7528         * common.cc (Sort_common): Add sort_order parameter to
7529         constructor.  Add sort_order_ field.
7530         (Sort_commons::operator): Check sort_order_.
7531         (Symbol_table::allocate_commons): Determine the sort order.
7532         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7533         Change all callers.
7534         (Symbol_table::do_allocate_commons_list): Likewise.
7535
7536 2009-12-30  Ian Lance Taylor  <iant@google.com>
7537
7538         PR 10916
7539         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7540         symbols from this object, don't change the visibility of an
7541         undefined symbol.
7542         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7543
7544 2009-12-30  Ian Lance Taylor  <iant@google.com>
7545
7546         PR 10861
7547         * script.h (class Version_script_info): Define Language enum.
7548         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7549         new fields globals_, locals_, and is_finalized_.
7550         * script.cc: Various formatting fixes.
7551         (class Parser_closure): Change language_stack_ from a vector of
7552         std::string to one of Version_script_info::Language.  Adjust all
7553         uses accordingly.
7554         (class Lazy_demangler): Remove.
7555         (struct Version_expression): Change language from std::string to
7556         Version_script_info::Language.
7557         (Version_script_info::Version_script_info): New function.
7558         (Version_script_info::~Version_script_info): Don't call clear.
7559         (Version_script_info::finalize): New function.
7560         (Version_script_info::build_lookup_tables): New function.
7561         (Version_script_info::build_expression_list_lookup): New
7562         function.
7563         (Version_script_info::get_symbol_version_helper): Rewrite to use
7564         lookup tables.
7565         (Version_script_info::print_expression_list): Adjust to use
7566         Version_script_info::Language.
7567         (script_push_lex_into_version_mode): Check that the version script
7568         has not been finalized.
7569         (version_script_push_lang): Change language string to
7570         Version_script_info::Language.
7571         * options.cc (Command_line::version_script): New function.
7572         * options.h (class General_options): Add finalize_dynamic_list
7573         function.  Change version_script from declaration to definition.
7574         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7575         * testsuite/version_script.map: Remove duplicate def of foo.
7576         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7577         version_script.map.
7578         * testsuite/Makefile.in: Rebuild.
7579
7580 2009-12-30  Ian Lance Taylor  <iant@google.com>
7581
7582         PR 10843
7583         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7584         if the input symbol index is 0, make the output symbol index 0.
7585
7586 2009-12-30  Ian Lance Taylor  <iant@google.com>
7587
7588         PR 10670
7589         * options.h (class General_options): Add -x/--discard-all.
7590         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7591         --discard-all.  If the local symbol needs a dynamic entry, check
7592         that before handling --discard-locals.
7593
7594 2009-12-30  Ian Lance Taylor  <iant@google.com>
7595
7596         PR 10450
7597         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7598         flags to PF_R.
7599         (Output_segment::add_output_section): Don't change the flags if
7600         the type is PT_TLS.
7601
7602         PR 10450
7603         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7604         GNU hash table if they need a dynamic value.  Otherwise, don't add
7605         them if they are defined in a dynamic object or are forced local.
7606
7607 2009-12-29  Ian Lance Taylor  <iant@google.com>
7608
7609         PR 10450
7610         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7611         .gnu.hash table for a 32-bit target.
7612
7613         PR 10450
7614         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7615         regular and a dynamic object only needs a dynamic symbol table
7616         entry if it is externally visible.
7617
7618         PR 10450
7619         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7620         constructor.  Add global_offset_table_ field.
7621         (Target_i386::got_section): Set global_offset_table_.
7622         (Target_i386::do_finalize_sections): Set global_offset_table_
7623         size.
7624         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7625         in constructor.  Add global_offset_table_ field.
7626         (Target_x86_64::got_section): Set global_offset_table_.
7627         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7628         size.
7629
7630         * layout.cc (Layout::Layout): Initialize increase_relro_.
7631         (Layout::get_output_section): Add is_relro, is_last_relro, and
7632         is_first_non_relro parameters.  Change all callers.
7633         (Layout::choose_output_section): Likewise.
7634         (Layout::add_output_section_data): Likewise.
7635         (Layout::make_output_section): Likewise.
7636         (Layout::set_segment_offsets): Clear increase_relro when using a
7637         linker script.
7638         * layout.h (class Layout): Add increase_relro method.  Add
7639         increase_relro_ field.  Update declarations.
7640         * output.cc (Output_section::Output_section): Initialize
7641         is_last_relro_ and is_first_non_relro_.
7642         (Output_segment::add_output_section): Group relro sections is
7643         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7644         (Output_segment::maximum_alignment): Remove relro handling.
7645         (Output_segment::set_section_addresses): Add increase_relro
7646         parameter.  Change all callers.  Add initial alignment to align
7647         relro sections on separate page.  Remove old relro handling.
7648         (Output_segment::set_section_list_addresses): Remove in_relro
7649         parameter.  Change all callers.
7650         (Output_segment::set_offset): Add increase parameter.  Change all
7651         callers.  Remove old relro handling.
7652         * output.h (class Output_section): Add new methods: is_last_relro,
7653         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7654         Add is_last_relro_ and is_first_non_relro_ fields.
7655         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7656         Create separate .got.plt section.  Call increase_relro.
7657         * x86_64.cc (Target_x86_64::got_section): Likewise.
7658         * testsuite/relro_script_test.t: Add .got.plt.
7659
7660         PR 10450
7661         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7662         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7663         (Layout::finalize): Call set_dynamic_symbol_size.
7664         (Layout::set_dynamic_symbol_size): New function.
7665         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7666         set_dynamic_symbol_size.
7667
7668         PR 10450
7669         * output.h (class Output_section): Add is_entsize_zero_ field.
7670         * output.cc (Output_section::Output_section): Initialize
7671         is_entsize_zero_.
7672         (Output_section::set_entsize): If two different entsizes are
7673         requested, force it to zero.
7674         (Output_section::add_input_section): Set flags for .debug_str
7675         before updating section flags.  Set entsize.
7676         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7677         and SHF_STRING if all input sections have those flags.
7678
7679 2009-12-29   Rafael Espindola  <espindola@google.com>
7680
7681         * main.cc (main): Fix the sys time reporting.
7682         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7683         reporting.
7684
7685 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7686
7687         * options.cc (General_options::parse_version): Allow -v to exit
7688         without an error if there is nothing to link.
7689
7690 2009-12-29  Ian Lance Taylor  <iant@google.com>
7691
7692         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7693         using a version of gcc before 4.1.
7694         * configure: Rebuild.
7695
7696 2009-12-28  Chris Demetriou  <cgd@google.com>
7697
7698         * attributes.cc (Output_attributes_section_data::do_write): Use
7699         std::vector::front rather than std::vector::data.
7700
7701 2009-12-28  Ian Lance Taylor  <iant@google.com>
7702
7703         * symtab.h (class Symbol_table): Add enum Defined.
7704         * resolve.cc (Symbol_table::should_override): Add defined
7705         parameter.  Change all callers.  Test whether object is NULL
7706         before calling a method on it.
7707         (Symbol_table::report_resolve_problem): Add defined parameter.
7708         Change all callers.
7709         (Symbol_table::should_override_with_special): Likewise.
7710         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7711         parameter.  Change all callers.
7712         (Symbol_table::do_define_in_output_data): Likewise.
7713         (Symbol_table::define_in_output_segment): Likewise.
7714         (Symbol_table::do_define_in_output_segment): Likewise.
7715         (Symbol_table::define_as_constant): Likewise.
7716         (Symbol_table::do_define_as_constant): Likewise.
7717         * script.h (class Symbol_assignment): Add is_defsym parameter to
7718         constructor; change all callers.
7719         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7720         parameter.  Change all callers.  Add is_defsym_ field.
7721         (class Parser_closure): Add parsing_defsym parameter to
7722         constructor; change all callers.  Add parsing_defsym accessor
7723         function.  Add parsing_defsym_ field.
7724
7725 2009-12-28  Ian Lance Taylor  <iant@google.com>
7726
7727         * gold.cc (queue_middle_tasks): Fix formatting.
7728         * object.cc (Relobj::is_section_name_included): Likewise.
7729
7730 2009-12-23  Ian Lance Taylor  <iant@google.com>
7731
7732         * i386.cc (Target_i386::do_calls_non_split): Recognize
7733         -fsplit-stack prologue for a function with a static chain.
7734         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7735         -fsplit-stack prologue when using %r11.
7736
7737 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7738
7739         * options.cc (General_options::parse_version): Make -v continue and do
7740         the link like GNU ld does.
7741
7742 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7743
7744         * Makefile.am (CCFILES): Add timer.cc.
7745         (HFILES): Add timer.h.
7746         * configure.ac: Check for sysconf and times.
7747         * main.cc: include timer.h.
7748         (main): Use Timer instead of get_run_time.
7749         * timer.cc: New.
7750         * timer.h: New.
7751         * workqueue.cc: include timer.h.
7752         (Workqueue::find_and_run_task):
7753         Report user, sys and wall time.
7754         * Makefile.in: Regenerate.
7755         * config.in: Regenerate.
7756         * configure: Regenerate.
7757
7758 2009-12-16  Doug Kwan  <dougkwan@google.com>
7759
7760         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7761         sections.
7762         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7763         relaxed input sections.
7764         * output.cc (Output_section::find_relaxed_input_section): Change
7765         return type to Output_relaxed_input_section pointer.  Adjust code
7766         for new type of relaxed_input_section_map_.
7767         * output.h (Output_section::find_relaxed_input_section): Change
7768         return type to Output_relaxed_input_section pointer.
7769         (Output_section::Output_relaxed_input_section_by_input_section_map):
7770         New type.
7771         (Output_section::relaxed_input_section_map_): Change type to
7772         Output_section::Output_relaxed_input_section_by_input_section_map.
7773         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7774         input section.
7775
7776 2009-12-15  Ian Lance Taylor  <iant@google.com>
7777
7778         * layout.cc (Layout::create_shstrtab): Only write out after input
7779         sections if we are compressing debug sections.
7780
7781 2009-12-15  Ian Lance Taylor  <iant@google.com>
7782
7783         * archive.cc (Archive::add_symbols): Only look up a symbol without
7784         a version if there is, in fact, a version.
7785
7786 2009-12-14  Ian Lance Taylor  <iant@google.com>
7787
7788         Revert -Wshadow changes, all changes from:
7789         2009-12-11  Doug Kwan  <dougkwan@google.com>
7790         2009-12-11  Nick Clifton  <nickc@redhat.com>
7791         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7792
7793 2009-12-11  Doug Kwan  <dougkwan@google.com>
7794
7795         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7796         due to -Wshadow.
7797         * attributes.cc (Object_attribute::size): Ditto.
7798         (Attributes_section_data::size): Ditto.
7799         (Attributes_section_data::Attributes_section_data): Ditto.
7800         (Output_attributes_section_data::do_write): Ditto.
7801         * attributes.h (Object_attribute::set_type): Ditto.
7802         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7803
7804 2009-12-11  Nick Clifton  <nickc@redhat.com>
7805
7806         * archive.cc: Fix shadowed variable warnings.
7807         * arm.cc: Likewise.
7808         * compressed_output.cc: Likewise.
7809         * compressed_output.h: Likewise.
7810         * configure: Likewise.
7811         * dwarf_reader.cc: Likewise.
7812         * dynobj.cc: Likewise.
7813         * dynobj.h: Likewise.
7814         * ehframe.cc: Likewise.
7815         * ehframe.h: Likewise.
7816         * errors.cc: Likewise.
7817         * expression.cc: Likewise.
7818         * fileread.cc: Likewise.
7819         * fileread.h: Likewise.
7820         * freebsd.h: Likewise.
7821         * i386.cc: Likewise.
7822         * icf.cc: Likewise.
7823         * incremental.h: Likewise.
7824         * layout.cc: Likewise.
7825         * layout.h: Likewise.
7826         * mapfile.cc: Likewise.
7827         * merge.cc: Likewise.
7828         * merge.h: Likewise.
7829         * object.cc: Likewise.
7830         * object.h: Likewise.
7831         * options.h: Likewise.
7832         * output.cc: Likewise.
7833         * output.h: Likewise.
7834         * parameters.cc: Likewise.
7835         * plugin.cc: Likewise.
7836         * powerpc.cc: Likewise.
7837         * reduced_debug_output.cc: Likewise.
7838         * reduced_debug_output.h: Likewise.
7839         * reloc.cc: Likewise.
7840         * reloc.h: Likewise.
7841         * resolve.cc: Likewise.
7842         * script-sections.cc: Likewise.
7843         * script.cc: Likewise.
7844         * script.h: Likewise.
7845         * sparc.cc: Likewise.
7846         * symtab.cc: Likewise.
7847         * symtab.h: Likewise.
7848         * target-select.cc: Likewise.
7849         * target-select.h: Likewise.
7850         * token.h: Likewise.
7851         * workqueue.cc: Likewise.
7852         * workqueue.h: Likewise.
7853         * x86_64.cc: Likewise.
7854
7855 2009-12-10  Doug Kwan  <dougkwan@google.com>
7856
7857         * arm.cc (attributes.h): New include.
7858         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7859         (Arm_relobj::~Arm_relobj): Delete object pointed by
7860         attributes_section_data_.
7861         (Arm_relobj::attributes_section_data): New method definition.
7862         (Arm_relobj::attributes_section_data_): New data member declaration.
7863         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7864         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7865         attributes_section_data_.
7866         (Arm_dynobj::attributes_section_data): New method definition.
7867         (Arm_dynobj::attributes_section_data_): New data member declaration.
7868         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7869         initialization value of may_use_blx_ to false.
7870         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7871         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7872         object attributes to compute results instead of hard-coding.
7873         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7874         Target_arm::get_secondary_compatible_arch,
7875         Target_arm::set_secondary_compatible_arch
7876         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7877         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7878         New method declarations.
7879         (Target_arm::get_aeabi_object_attribute): New method definition.
7880         (Target_arm::attributes_section_data_): New data member declaration.
7881         (read_arm_attributes_section): New template definition.
7882         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7883         (Arm_dynobj::do_read_symbols): Ditto.
7884         (Target_arm::do_finalize_sections): Merge attributes sections from
7885         input.  Check for BLX use after attributes section merging.
7886         Fix __exidx_start and __exidx_end visibility.  Create an
7887         .ARM.attributes section if necessary.
7888         (Target_arm::get_secondary_compatible_arch,
7889         Target_arm::set_secondary_compatible_arch,
7890         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7891         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7892         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7893         New method definitions.
7894
7895 2009-12-09  Ian Lance Taylor  <iant@google.com>
7896
7897         * plugin.cc (Plugin::load): Don't cast from void* to a function
7898         pointer.
7899
7900 2009-12-09  Ian Lance Taylor  <iant@google.com>
7901
7902         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7903         information fields.
7904
7905 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7906
7907         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7908         Replace two_file_shared_1.so with two_file_shared_2.so.
7909         * testsuite/Makefile.in: Regenerated.
7910
7911 2009-12-08  Doug Kwan  <dougkwan@google.com>
7912
7913         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7914         (HFILES): Add attributes.h and int_encoding.h.
7915         * Makefile.in: Regenerate.
7916         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7917         function definitions to int_encoding.cc
7918         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7919         prototypes to int_encoding.h
7920         * reduced_debug_output.cc (int_encoding.h): New include.
7921         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7922         function definitions to int_encoding.cc
7923         (insert_into_vector, read_from_pointer): Move template definitions to
7924         int_encoding.h
7925         * attributes.cc: New file.
7926         * attributes.h: New file.
7927         * int_encoding.cc: New file.
7928         * int_encoding.h: New file.
7929
7930 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7931
7932         PR gold/11055
7933         * incremental-dump.cc (dump_incremental_inputs): New.
7934         (main): Use dump_incremental_inputs.
7935
7936 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7937
7938         PR gold/10893
7939         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7940         checking elfcpp::STT_FUNC.
7941         (Target_i386::Relocate::relocate): Likewise.
7942         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7943
7944         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7945         symbols from shared libraries into normal FUNC symbols.
7946
7947         * symtab.h (Symbol): Add is_func and use it.
7948
7949 2009-12-05  Doug Kwan  <dougkwan@google.com>
7950
7951         * arm.cc (Target_arm::arm_info): Initialize new fields
7952         attributes_section and attributes_vendor.
7953         * i386.cc (Target_i386::i386_info): Same.
7954         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7955         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7956         fields attributes_section and attributes_vendor.
7957         * sparc.cc (Target_sparc::sparc_info): Same.
7958         * target.h (Target::attributes_section, Target::attributes_vendor,
7959         Target::is_attributes_section, Target::attribute_arg_type,
7960         Target::attributes_order): New method definitions.
7961         (Target::Target_info::attributes_section,
7962         Target::Target_info::attributes_vendor): New fields.
7963         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7964         virtual method definitions.
7965         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7966         attributes_section and attributes_vendor.
7967         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7968
7969 2009-12-05  Doug Kwan  <dougkwan@google.com>
7970
7971         * arm.cc: Update comments about interworking and stub generation.
7972         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7973         considered as non-PIC.
7974         (Arm_relocate_functions::base_abs): Fix formatting.
7975         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7976         of function to use GOT entry address instead of offset.
7977         (Target_arm::Scan::global): Issue an error if a symbol would need a
7978         PLT does not get one because it is untyped.  Remove code to create
7979         dynamic symbols for relative branches.
7980         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7981         takes unsigned integer instead of boolean.
7982
7983 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7984
7985         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7986         (two_file_test_LDADD): Likewise.
7987         (common_test_1_LDADD): Likewise.
7988         (exception_test_LDADD) Likewise.
7989         (weak_test_LDADD): Likewise.
7990         (many_sections_test_LDADD): Likewise.
7991         (initpri1_LDADD): Likewise.
7992         (script_test_1_LDADD): Likewise.
7993         (script_test_2_LDADD): Likewise.
7994         (justsyms_LDADD): Likewise.
7995         (binary_test_LDADD): Likewise.
7996         (large_LDADD): Likewise.
7997         * testsuite/Makefile.in: Regenerated.
7998
7999 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8000
8001         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8002         (Symbol_table::override_with_special): Likewise.
8003         (Symbol_table::add_from_object): Likewise.
8004
8005 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8006
8007         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8008         Don't set the data_offset twice.
8009
8010 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8011
8012         * testsuite/Makefile.in: Regenerate.
8013
8014 2009-12-03  Doug Kwan  <dougkwan@google.com>
8015
8016         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8017         (Target_arm::do_finalize_sections): Add parameter for symbol table
8018         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8019         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8020         parameter for symbol table pointer.
8021         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8022         an additional parameter for a pointer to symbol table.
8023         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8024         parameter for a symbol table pointer.
8025         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8026         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8027         Ditto.
8028         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8029         parameter for a symbol table pointer.
8030
8031 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8032
8033         * incremental.cc (Incremental_inputs_header)
8034         (Incremental_inputs_header_write, Incremental_inputs_entry)
8035         (Incremental_inputs_entry_write): Move ...
8036         * incremental.h (Incremental_inputs_header)
8037         (Incremental_inputs_header_write, Incremental_inputs_entry)
8038         (Incremental_inputs_entry_write): here.
8039
8040 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8041
8042         * incremental.cc (make_sized_incremental_binary): Set the target.
8043         Error if it is incompatible.
8044         * output.h (Output_file): Add filename method.
8045
8046 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8047
8048         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8049         from the get_* methods.
8050
8051 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8052
8053         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8054         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8055         Write 0 for the data_offset of scripts.
8056
8057 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8058
8059         * testsuite/Makefile.am: Add the incremental_test.sh test.
8060         * testsuite/incremental_test.sh: New.
8061         * testsuite/incremental_test_1.c: New.
8062         * testsuite/incremental_test_2.c: New.
8063
8064 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8065
8066        * incremental-dump.cc (main): Fix typos.
8067
8068 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8069
8070         PR gold/11025
8071         * incremental-dump.cc (main): Use llu to print 64 bit values.
8072
8073 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8074             H.J. Lu  <hongjiu.lu@intel.com>
8075
8076         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8077         $(LIBDL).
8078         (incremental_dump_LDADD): Likewise.
8079         * Makefile.in: Regenerated.
8080
8081 2009-11-25  Doug Kwan  <dougkwan@google.com>
8082
8083         Revert:
8084
8085         2009-11-25  Doug Kwan  <dougkwan@google.com>
8086
8087                 * arm.cc (Target_arm::Target_arm): Move method definition
8088                 outside of class definition.  Add code to handle
8089                 --target1-rel, --target1-abs and --target2= options.
8090                 (Target_arm::get_reloc_reloc_type): Change method to be
8091                 non-static and const.
8092                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8093                 New data member declaration.
8094                 (Target_arm::Scan::local, Target_arm::Scan::global,
8095                 Target_arm::Relocate::relocate,
8096                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8097                 Adjust call to Target_arm::get_real_reloc_type.
8098                 (Target_arm::get_real_reloc_type): Use command line options
8099                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8100                 * options.h (--target1-rel, --target1-abs, --target2): New
8101                 ARM-only options.
8102
8103 2009-11-25  Doug Kwan  <dougkwan@google.com>
8104
8105         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8106         class definition.  Add code to handle --target1-rel, --target1-abs
8107         and --target2= options.
8108         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8109         and const.
8110         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8111         member declaration.
8112         (Target_arm::Scan::local, Target_arm::Scan::global,
8113         Target_arm::Relocate::relocate,
8114         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8115         call to Target_arm::get_real_reloc_type.
8116         (Target_arm::get_real_reloc_type): Use command line options to
8117         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8118         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8119         options.
8120
8121 2009-11-25  Doug Kwan  <dougkwan@google.com>
8122
8123         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8124         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8125         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8126         formatting.
8127         (Arm_relocate_functions::thm_call): Replace body with a call to
8128         Arm_relocate_functions::thumb_branch_common.
8129         (Arm_relocate_functions::thm_jump24,
8130         Arm_relocate_functions::thm_xpc22): New method definitions.
8131         (Arm_relocate_functions::thumb_branch_common): New method definition.
8132         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8133         operator.
8134         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8135         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8136
8137 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8138
8139         * Makefile.am: Build incremental-dump
8140         * Makefile.in: Regenerate.
8141         * incremental-dump.cc: New.
8142         * incremental.cc (Incremental_inputs_header_data,
8143         Incremental_inputs_entry_data): Move to incremental.h
8144         * incremental.h: (Incremental_inputs_header_data,
8145         Incremental_inputs_entry_data): Move from incremental.cc
8146
8147 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8148
8149         * incremental.cc (Incremental_inputs_header,
8150         Incremental_inputs_header_write, Incremental_inputs_entry,
8151         Incremental_inputs_entry_write): Add a typedef with the data type.
8152
8153 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8154
8155         * incremental.cc (Incremental_inputs_header,
8156         Incremental_inputs_header_write, Incremental_inputs_entry,
8157         Incremental_inputs_entry_write): Update comment about which
8158         type has the filed descriptions.
8159
8160 2009-11-15  Doug Kwan  <dougkwan@google.com>
8161
8162         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8163         (Arm_relocate_functions::arm_branch_common): Change method defintion
8164         in class definition to a method declaration and update list of formal
8165         parameters.
8166         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8167         Arm_relocation_functions::jump24): Adjust call to
8168         Arm_relocate_functions::arm_branch_common.  Update list of formal
8169         parameters.
8170         (Arm_relocate_functions::xpc25): New method definition.
8171         (Arm_relocate_functions::arm_branch_common): Move method defintion
8172         out from class definition.  Use stubs for mode-switching and extending
8173         branch ranges.
8174         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8175         specially.  Change code to enable use of stubs in ARM branches.
8176
8177 2009-11-10  Doug Kwan  <dougkwan@google.com>
8178
8179         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8180         in method declaration.
8181         (Target_arm::relocate_stub): New method declaration.
8182         (Target_arm::default_target): Change to return a pointer instead of
8183         a const reference.
8184         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8185         Target_arm::default_target.
8186         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8187         method definition.
8188         (Target_arm::relocate_section): Adjust view.
8189         (Target_arm::relocate_stub): New method definition.
8190
8191 2009-11-10  Doug Kwan  <dougkwan@google.com>
8192
8193         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8194         a format warning.
8195         * incremental.cc (open_incremental_binary): Initialized local
8196         variables to avoid warnings.
8197         * object.cc (make_elf_object): Ditto.
8198         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8199         a format warning.
8200
8201 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8202
8203         PR gold/10930
8204         * testsuite/plugin_test.c: Include "config.h".
8205
8206 2009-11-09  Doug Kwan  <dougkwan@google.com>
8207
8208         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8209         (arm_symbol_value): Remove.
8210         (Arm_relocate_functions::arm_branch_common,
8211         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8212         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8213         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8214         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8215         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8216         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8217         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8218         Arm_relocate_functions::thm_mobw_abs_nc,
8219         Arm_relocate_functions::thm_mov_abs,
8220         Arm_relocate_functions::movw_prel_nc,
8221         Arm_relocate_functions::thm_movt_abs,
8222         Arm_relocate_functions::movt_prel,
8223         Arm_relocate_functions::thm_movw_prel_nc,
8224         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8225         (Target_arm::Relocate::relocate): Only decompose address into two
8226         parts if relocation type uses the thumb-bit and pass the actual
8227         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8228         calls to methods in Arm_relocate_functions for this change.
8229
8230 2009-11-08  Ian Lance Taylor  <iant@google.com>
8231
8232         PR 10925
8233         * reloc.cc: Instantiate
8234         Sized_relobj::initialize_input_to_output_maps and
8235         Sized_relobj:free_input_to_output_maps.
8236
8237 2009-11-06  Ian Lance Taylor  <iant@google.com>
8238
8239         PR 10876
8240         * defstd.cc (in_segment): Set only_if_ref true for "end".
8241
8242 2009-11-06  Doug Kwan  <dougkwan@google.com>
8243
8244         * arm.cc (class Reloc_stub): Correct a comment.
8245         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8246         (Target_arm::scan_section_for_stubs): New method declaration.
8247         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8248         Change methods from private to protected.
8249         (Target_arm::do_may_relax): New method definition.
8250         (Target_arm::do_relax, Target_arm::group_sections,
8251         Target_arm::scan_reloc_for_stub,
8252         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8253         (Target_arm::arm_input_section_map_): New data member declaration.
8254         (Target_arm::scan_reloc_for_stub,
8255         Target_arm::scan_reloc_section_for_stubs,
8256         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8257         Target_arm::do_relax): New method definitions.
8258
8259 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8260
8261         * configure.ac: Check for (struct stat)::st_mtim
8262         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8263         * config.in: Regenerate.
8264         * configure: Regenerate.
8265
8266 2009-11-05  Ian Lance Taylor  <iant@google.com>
8267
8268         PR 10910
8269         * output.cc (Output_segment::add_output_section): Add missing
8270         return statement.
8271
8272 2009-11-04  Ian Lance Taylor  <iant@google.com>
8273
8274         PR 10880
8275         * object.h (class Object): Add is_needed and set_is_needed
8276         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8277         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8278         defined in a dynamic object and referenced by a regular object,
8279         set is_needed for the dynamic object.
8280         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8281         if the file is marked with as_needed and it is not needed.
8282
8283 2009-11-04  Ian Lance Taylor  <iant@google.com>
8284
8285         PR 10887
8286         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8287         tags if data is discarded by linker script.
8288         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8289         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8290         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8291         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8292
8293 2009-11-04  Ian Lance Taylor  <iant@google.com>
8294
8295         * layout.cc (Layout::get_output_section): Add is_interp and
8296         is_dynamic_linker_section parameters.  Change all callers.
8297         (Layout::choose_output_section): Likewise.
8298         (Layout::make_output_section): Likewise.
8299         (Layout::add_output_section_data): Add is_dynamic_linker_section
8300         parameter.  Change all callers.
8301         * layout.h (class Layout): Update declarations.
8302         * output.h (class Output_section): Add is_interp, set_is_interp,
8303         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8304         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8305         generate_code_fills_at_write_ to a bitfield.
8306         * output.cc (Output_section::Output_sections): Initialize new
8307         fields.
8308         (Output_segment::add_output_section): Add do_sort parameter.
8309         Change all callers.
8310
8311 2009-11-03  Ian Lance Taylor  <iant@google.com>
8312
8313         PR 10860
8314         * options.h (class General_options): Add --warn-common.
8315         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8316         merging two common symbols.
8317         (Symbol_table::should_override): Handle --warn-common when merging
8318         a common symbol with a defined symbol.  Use report_resolve_problem
8319         for multiple definitions.
8320         (Symbol_table::report_resolve_problem): New function.
8321         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8322
8323 2009-11-03  Doug Kwan  <dougkwan@google.com>
8324
8325         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8326         stub_factory_.
8327         (Target_arm::stub_factory): New method definition.
8328         (Target_arm::new_arm_input_section,
8329         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8330         Target_arm::reloc_uses_thumb_bit): New method declarations.
8331         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8332         New type definitions.
8333         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8334         member declarations.
8335         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8336         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8337         New method definitions.
8338
8339 2009-11-03  Ian Lance Taylor  <iant@google.com>
8340
8341         * options.h (class General_options): Add --warn_constructors.
8342
8343 2009-11-03  Ian Lance Taylor  <iant@google.com>
8344
8345         PR 10893
8346         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8347         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8348
8349 2009-11-03  Ian Lance Taylor  <iant@google.com>
8350
8351         PR 10895
8352         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8353         --msgid-bugs-address.
8354         (install-pdf): New target.
8355         (install-data_yes): Look up one directory to find mkinstalldirs.
8356
8357 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8358
8359         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8360         tree.
8361
8362 2009-10-30  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8365
8366 2009-10-30  Doug Kwan  <dougkwan@google.com>
8367
8368         * arm.cc (Stub_addend_reader): New struct template definition
8369         and partial specializations.
8370         (Stub_addend_reader::operator()): New method definition for a
8371         partially specialized template.
8372
8373 2009-10-30  Doug Kwan  <dougkwan@google.com>
8374
8375         * arm.cc (Arm_relobj::processor_specific_flags): New method
8376         definition.
8377         (Arm_relobj::do_read_symbols): New method declaration.
8378         (Arm_relobj::processor_specific_flags_): New data member declaration.
8379         (Arm_dynobj): New class definition.
8380         (Target_arm::do_finalize_sections): Add input_objects parameter.
8381         (Target_arm::do_adjust_elf_header): New method declaration.
8382         (Target_arm::are_eabi_versions_compatible,
8383         (Target_arm::merge_processor_specific_flags): New method declaration.
8384         (Target_arm::do_make_elf_object): New overloaded method definitions
8385         and declaration.
8386         (Arm_relobj::do_read_symbols): New method definition.
8387         (Arm_dynobj::do_read_symbols): Ditto.
8388         (Target_arm::do_finalize_sections): Add input_objects parameters.
8389         Merge processor-specific flags from all input objects.
8390         (Target_arm::are_eabi_versions_compatible,
8391         Target_arm::merge_processor_specific_flags,
8392         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8393         New method definitions.
8394         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8395         Input_objects pointer type parameter.
8396         * layout.cc (Layout::finalize): Pass input objects to target's.
8397         finalize_sections function.
8398         * output.cc (Output_file_header::do_sized_write): Set ELF file
8399         header's processor-specific flags.
8400         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8401         Input_objects pointer type parameter.
8402         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8403         * target.h (Input_objects): New forward class declaration.
8404         (Target::processor_specific_flags,
8405         Target::are_processor_specific_flags_sect): New method definitions.
8406         (Target::finalize_sections): Add input_objects parameter.
8407         (Target::Target): Initialize processor_specific_flags_ and
8408         are_processor_specific_flags_set_.
8409         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8410         parameter.
8411         (Target::set_processor_specific_flags): New method definition.
8412         (Target::processor_specific_flags_,
8413         Target::are_processor_specific_flags_set_): New data member
8414         declarations.
8415         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8416         Input_objects pointer type parameter.
8417
8418 2009-10-30  Doug Kwan  <dougkwan@google.com>
8419
8420         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8421
8422 2009-10-28  Ian Lance Taylor  <iant@google.com>
8423
8424         * object.h (class Relobj): Drop options parameter from
8425         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8426         do_scan_relocs, do_relocate.  Change all callers.
8427         (class Sized_relobj): Drop options parameters from
8428         do_gc_process_relocs, do_scan_relocs, do_relocate,
8429         do_relocate_sections, relocate_sections, emit_relocs_scan,
8430         emit_relocs_scan_reltype.  Change all callers.
8431         (struct Relocate_info): Remove options field and all references to
8432         it.
8433         * reloc.h (class Read_relocs): Remove options constructor
8434         parameter and options_ field.  Change all callers.
8435         (class Gc_process_relocs, class Scan_relocs): Likewise.
8436         (class Relocate_task): Likewise.
8437         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8438         all callers.
8439         (scan_relocatable_relocs): Likewise.
8440         * target.h (class Sized_target): Remove options parameter from
8441         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8442         all callers.
8443         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8444         callers.
8445         * arm.cc: Update functions to remove options parameters.
8446         * i386.cc: Likewise.
8447         * powerpc.cc: Likewise.
8448         * sparc.cc: Likewise.
8449         * x86_64.cc: Likewise.
8450         * testsuite/testfile.cc: Likewise.
8451
8452 2009-10-28  Doug Kwan  <dougkwan@google.com>
8453
8454         * arm.cc (Arm_relobj): New class definition.
8455         (Arm_relobj::scan_sections_for_stubs,
8456         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8457         New method definitions.
8458
8459 2009-10-28  Cary Coutant  <ccoutant@google.com>
8460
8461         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8462         (Plugin::cleanup_done_): New member.
8463         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8464         (Plugin_manager::cleanup_done_): Remove.
8465         (Plugin_manager::add_input_file): Edit error message.
8466         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8467         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8468
8469 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8470
8471         * fileread.cc: (File_read::View::~View): Use the new
8472         data_ownership_ filed.
8473         (File_read::~File_read): Dispose the new whole_file_view_.
8474         (File_read::open): Mmap the whole file if needed.
8475         (File_read::open): Use whole_file_view_ instead of contents_.
8476         (File_read::find_view): Use whole_file_view_ if applicable.
8477         (File_read::do_read): Use whole_file_view_ instead of contents_.
8478         (File_read::make_view): Use whole_file_view_ instead of contents_,
8479         update File_read::View::View call.
8480         (File_read::find_or_make_view): Update File_read::View::View
8481         call.
8482         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8483         remove contents_
8484         (File_read::View::Data_ownership): New enum.
8485         (File_read::View::View): Replace bool mapped_ with Data_ownership
8486         argument.
8487         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8488         (File_read::View::data_ownership_): New field.
8489         (File_read::contents_): Remove (replaced by whole_file_view_).
8490         (File_read::whole_file_view_): New field.
8491         * options.h (class General_options): Add --keep-files-mapped.
8492
8493 2009-10-27  Cary Coutant  <ccoutant@google.com>
8494
8495         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8496         * testsuite/Makefile.am (plugin_test_5): New test case.
8497         * testsuite/Makefile.in: Regenerate.
8498
8499 2009-10-25  Doug Kwan  <dougkwan@google.com>
8500
8501         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8502         from private to protected to allow access by child class.
8503         (Sized_relobj::do_relocate_sections): New method declaration.
8504         (Sized_relobj::relocate_sections): Virtualize.
8505         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8506         Sized_relobj::relocate_sections.  Instantiate template explicitly
8507         for different target sizes and endianity.
8508
8509 2009-10-24  Doug Kwan  <dougkwan@google.com>
8510
8511         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8512         (Arm_input_section::as_arm_input_section): New method.
8513         (Arm_output_section): New class definition.
8514         (Arm_output_section::create_stub_group,
8515         Arm_output_section::group_sections): New method definitions.
8516
8517 2009-10-22  Doug Kwan  <dougkwan@google.com>
8518
8519         * arm.cc (Arm_input_section): New class definition.
8520         (Arm_input_section::init, Arm_input_section:do_write,
8521         Arm_input_section::set_final_data_size,
8522         Arm_input_section::do_reset_address_and_file_offset): New method
8523         definitions.
8524
8525 2009-10-21  Doug Kwan  <dougkwan@google.com>
8526
8527         * arm.cc (Stub_table, Arm_input_section): New forward class
8528         declarations.
8529         (Stub_table): New class defintion.
8530         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8531         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8532         New method definition.
8533
8534 2009-10-21  Doug Kwan  <dougkwan@google.com>
8535
8536         * arm.cc: Update copyright comments.
8537         (Target_arm): New forward class template declaration.
8538         (Arm_address): New type.
8539         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8540         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8541         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8542         constants.
8543         (Insn_template): Same.
8544         (DEF_STUBS): New macro.
8545         (Stub_type): New enum type.
8546         (Stub_template): New class definition.
8547         (Stub): Same.
8548         (Reloc_stub): Same.
8549         (Stub_factory): Same.
8550         (Target_arm::Target_arm): Initialize may_use_blx_ and
8551         should_force_pic_veneer_.
8552         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8553         Target_arm::should_force_pic_veneer,
8554         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8555         Target_arm::using_thumb_only, Target_arm:;default_target): New
8556         method defintions.
8557         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8558         New data member declarations.
8559         (Insn_template::size, Insn_template::alignment): New method defintions.
8560         (Stub_template::Stub_template): New method definition.
8561         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8562         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8563         (Stub_factory::Stub_factory): New method definition.
8564         * gold.h (string_hash): New template.
8565         * output.h (Input_section_specifier::hash_value): Use
8566         gold::string_hash.
8567         (Input_section_specifier::string_hash): Remove.
8568         * stringpool.cc (Stringpool_template::string_hash): Use
8569         gold::string_hash.
8570
8571 2009-10-20  Doug Kwan  <dougkwan@google.com>
8572
8573         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8574         symbols of relaxed input sections.
8575         * output.h (Output_section::find_relaxed_input_section): Make
8576         method public.
8577
8578 2009-10-16  Doug Kwan  <dougkwan@google.com>
8579
8580         * dynobj.cc (Versions::Versions): Initialize version_script_.
8581         Only insert base version symbol definition for a shared object
8582         if version script defines any version versions.
8583         (Versions::define_base_version): New method definition.
8584         (Versions::add_def): Check that base version is not needed.
8585         (Versions::add_need): Define base version lazily.
8586         * dynobj.h (Versions::define_base_version): New method declaration.
8587         (Versions::needs_base_version_): New data member declaration.
8588         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8589         (check_DATA): Add no_version_test.stdout.
8590         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8591         New make rules.
8592         * testsuite/Makefile.in: Regenerate.
8593         * testsuite/no_version_test.c: New file.
8594         * testsuite/no_version_test.sh: Ditto.
8595
8596 2009-10-16  Doug Kwan  <dougkwan@google.com>
8597
8598         * expression.cc (class Segment_start_expression): New class definition.
8599         (Segment_start_expression::value): New method definition.
8600         (script_exp_function_segment_start): Return a new
8601         Segment_start_expression.
8602         * gold/script-c.h (script_saw_segment_start_expression): New function
8603         prototype.
8604         * script-sections.cc (Script_sections::Script_sections): Initialize
8605         SAW_SEGMENT_START_EXPRESSION_ to false.
8606         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8607         and -Tbbs options to specify section addresses if given in
8608         command line and no SEGMENT_START expression is seen in a script.
8609         * script-sections.h (Script_sections::saw_segment_start_expression,
8610         Script_sections::set_saw_segment_start_expression): New method
8611         definition.
8612         (Script_sections::saw_segment_start_expression_): New data member
8613         declaration.
8614         * script.cc (script_saw_segment_start_expression): New function.
8615         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8616         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8617         script_test_7.sh and script_test_8.sh.
8618         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8619         script_test_8.stdout.
8620         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8621         (script_test_6, script_test_6.stdout, script_test_7,
8622         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8623         * Makefile.in: Regenerate.
8624         * testsuite/script_test_6.sh: New file.
8625         * testsuite/script_test_6.t: Same.
8626         * testsuite/script_test_7.sh: Same.
8627         * testsuite/script_test_7.t: Same.
8628         * testsuite/script_test_8.sh: Same.
8629
8630 2009-10-16  Doug Kwan  <dougkwan@google.com>
8631
8632         * output.cc (Output_segment::set_section_list_address): Cast
8633         expressions to unsigned long long type to avoid format warnings.
8634
8635 2009-10-15  Ian Lance Taylor  <iant@google.com>
8636
8637         * script.cc (Script_options::add_symbol_assignment): Always add a
8638         dot assignment to script_sections_.
8639         * script-sections.cc (Script_sections::add_dot_assignment):
8640         Initialize if necessary.
8641
8642         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8643         program headers with no load segment if there is a linker script.
8644
8645         * layout.cc (Layout::set_segment_offsets): Align the file offset
8646         to the segment aligment for -N or -n with no load segment.
8647         * output.cc (Output_segment::add_output_section): Don't crash if
8648         the first section is a TLS section.
8649         (Output_segment::set_section_list_addresses): Print an error
8650         message if the address moves backward in a linker script.
8651         * script-sections.cc
8652         (Output_section_element_input::set_section_addresses): Don't
8653         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8654         (Orphan_output_section::set_section_addresses): Likewise.
8655
8656 2009-10-15  Doug Kwan  <dougkwan@google.com>
8657
8658         * layout.cc (Layout::finish_dynamic_section): Generate tags
8659         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8660         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8661         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8662
8663 2009-10-14  Ian Lance Taylor  <iant@google.com>
8664
8665         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8666         fields.
8667         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8668         data_shdr fields of relinfo.
8669         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8670         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8671         R_386_TLS_LDO_32, adjust based on section flags.
8672         (Target_i386::Relocate::fix_up_ldo): Remove.
8673
8674 2009-10-13  Ian Lance Taylor  <iant@google.com>
8675
8676         Add support for -pie.
8677         * options.h (class General_options): Add -pie and
8678         --pic-executable.
8679         (General_options::output_is_position_independent): Test -pie.
8680         (General_options::output_is_executable): Return true if not shared
8681         and not relocatable.
8682         (General_options::output_is_pie): Remove.
8683         * options.cc (General_options::finalize): Reject incompatible uses
8684         of -pie.
8685         * gold.cc (queue_middle_tasks): A -pie link is not static.
8686         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8687         * symtab.cc (Symbol::final_value_is_known): Return false if
8688         output_is_position_independent.
8689         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8690         output_is_position_independent.
8691         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8692         output_is_position_independent.
8693         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8694         output_is_position_independent.
8695         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8696         two_file_pie_test.
8697         (basic_pie_test.o, basic_pie_test): New targets.
8698         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8699         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8700         (two_file_pie_test): New target.
8701         * testsuite/Makefile.in: Rebuild.
8702         * README: Remove note saying that -pie is not supported.
8703
8704 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8705
8706         * options.h (class General_options): Add -init and -fini.
8707         * layout.cc (Layout::finish_dynamic_section): Emit
8708         given init and fini functions.
8709
8710 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8711
8712         * gc.h (gc_process_relocs): Check if icf is enabled using new
8713         function.
8714         * gold.cc (queue_initial_tasks): Likewise.
8715         (queue_middle_tasks): Likewise.
8716         * object.cc (do_layout): Likewise.
8717         * symtab.cc (is_section_folded): Likewise.
8718         * main.cc (main): Likewise.
8719         * reloc.cc (Read_relocs::run): Likewise.
8720         (Sized_relobj::do_scan_relocs): Likewise.
8721         * icf.cc (is_function_ctor_or_dtor): New function.
8722         (Icf::find_identical_sections): Check if function is ctor or dtor when
8723         safe icf is chosen.
8724         * options.h (General_options::icf): Change option to be an enum.
8725         (Icf_status): New enum.
8726         (icf_enabled): New method.
8727         (icf_safe_folding): New method.
8728         (set_icf_status): New method.
8729         (icf_status_): New variable.
8730         * (options.cc) (General_options::finalize): Set icf_status_.
8731         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8732         icf_test and icf_keep_unique_test to use the --icf enum flag.
8733         * testsuite/icf_safe_test.sh: New file.
8734         * testsuite/icf_safe_test.cc: New file.
8735
8736 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8737
8738         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8739         includes to gc.h and icf.h.
8740         * arm.cc: Include gc.h.
8741         * gold.cc: Likewise.
8742         * i386.cc: Likewise.
8743         * powerpc.cc: Likewise.
8744         * sparc.cc: Likewise.
8745         * x86_64.cc: Likewise.
8746         * gc.h: Include icf.h.
8747
8748 2009-10-11  Ian Lance Taylor  <iant@google.com>
8749
8750         * plugin.cc: Include "gold.h" before other header files.
8751
8752 2009-10-10  Chris Demetriou  <cgd@google.com>
8753
8754         * options.h (Input_file_argument::Input_file_type): New enum.
8755         (Input_file_argument::is_lib_): Replace with...
8756         (Input_file_argument::type_): New member.
8757         (Input_file_argument::Input_file_argument): Take Input_file_type
8758         'type' rather than boolean 'is_lib' as second argument.
8759         (Input_file_argument::is_lib): Use type_.
8760         (Input_file_argument::is_searched_file): New function.
8761         (Input_file_argument::may_need_search): Handle is_searched_file.
8762         * options.cc (General_options::parse_library): Support -l:filename.
8763         (General_options::parse_just_symbols): Update for Input_file_argument
8764         changes.
8765         (Command_line::process): Likewise.
8766         * archive.cc (Archive::get_file_and_offset): Likewise.
8767         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8768         * script.cc (read_script_file, script_add_file): Likewise.
8769         * fileread.cc (Input_file::Input_file): Likewise.
8770         (Input_file::will_search_for): Handle is_searched_file.
8771         (Input_file::open): Likewise.
8772         * readsyms.cc (Read_symbols::get_name): Likewise.
8773         * testsuite/Makefile.am (searched_file_test): New test.
8774         * testsuite/Makefile.in: Regenerate.
8775         * testsuite/searched_file_test.cc: New file.
8776         * testsuite/searched_file_test_lib.cc: New file.
8777
8778 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8779             Ian Lance Taylor  <iant@google.com>
8780
8781         * descriptor.cc: Include <cstdio> and "binary-io.h".
8782         (Descriptors::open): Open the files in binary mode always.
8783         * script.cc (Lex::get_token): Treat \r as whitespace.
8784
8785 2009-10-09  Ian Lance Taylor  <iant@google.com>
8786
8787         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8788
8789 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8790             Ian Lance Taylor  <iant@google.com>
8791
8792         * configure.ac: Check for readv function also.
8793         * fileread.cc (readv): Define if not HAVE_READV.
8794         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8795         does not exist.
8796         * config.in: Regenerate.
8797         * configure: Regenerate.
8798
8799 2009-10-09  Doug Kwan  <dougkwan@google.com>
8800
8801         * layout.cc (Layout::make_output_section): Call target hook to make
8802         ordinary output section.
8803         (Layout::finalize): Adjust parameter list of call the
8804         Target::may_relax().
8805         * layout.h (class Layout::section_list): New method.
8806         * merge.h (Output_merge_base::entsize): Change visibility to public.
8807         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8808         New methods.
8809         (Output_merge_string::do_is_string): New method.
8810         * object.cc (Sized_relobj::do_setup): renamed from
8811         Sized_relobj::set_up.
8812         * object.h (Sized_relobj::adjust_shndx,
8813         Sized_relobj::initializ_input_to_output_maps,
8814         Sized_relobj::free_input_to_output_maps): Change visibilities to
8815         protected.
8816         (Sized_relobj::setup): Virtualize.
8817         (Sized_relobj::do_setup): New method declaration.
8818         (Sized_relobj::invalidate_section_offset,
8819         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8820         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8821         * options.cc (parse_int): New function.
8822         * options.h (parse_int): New declaration.
8823         (DEFINE_int): New macro.
8824         (stub_group_size): New option.
8825         * output.cc (Output_section::Output_section): Initialize memebers
8826         merge_section_map_, merge_section_by_properties_map_,
8827         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8828         (Output_section::add_input_section): Handled deferred code-fill
8829         generation and remove an old comment.
8830         (Output_section::add_relaxed_input_section): New method definition.
8831         (Output_section::add_merge_input_section): Use merge section by
8832         properties map to speed to search.  Update merge section maps
8833         as appropriate.
8834         (Output_section::build_relaxation_map): New method definition.
8835         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8836         Same.
8837         (Output_section::relax_input_section): Renamed to
8838         Output_section::convert_input_sections_to_relaxed_sections and change
8839         interface to take a vector of pointers to relaxed sections.
8840         (Output_section::find_merge_section,
8841         Output_section::find_relaxed_input_section): New method definitions.
8842         (Output_section::is_input_address_mapped,
8843         Output_section::output_offset, Output_section::output_address):
8844         Use output section data maps to speed up searching.
8845         (Output_section::find_starting_output_address): Add comments.
8846         (Output_section::do_write,
8847         Output_section::write_to_postprocessing_buffer): Do code-fill
8848         generation as appropriate.
8849         (Output_section::get_input_sections): Invalidate relaxed input section
8850         map.
8851         (Output_section::restore_states): Adjust type of checkpoint .
8852         Invalidate relaxed input section map.
8853         * output.h (Output_merge_base): New class declaration.
8854         (Input_section_specifier): New class defintion.
8855         (class Output_relaxed_input_section) Change base class to
8856         Output_section_data_build.
8857         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8858         base class initializer.
8859         (Output_section::add_relaxed_input_section): New method declaration.
8860         (Output_section::Input_section): Change visibility to protected.
8861         (Output_section::Input_section::relobj,
8862         Output_section::Input_section::shndx): Handle relaxed input sections.
8863         Output_section::input_sections) Change visibility to protected.  Also
8864         define overload to return a non-const pointer.
8865         (Output_section::Merge_section_properties): New class defintion.
8866         (Output_section::Merge_section_by_properties_map,
8867         Output_section::Output_section_data_by_input_section_map,
8868         Output_section::Relaxation_map): New types.
8869         (Output_section::relax_input_section): Rename method to
8870         Output_section::convert_input_sections_to_relaxed_sections and change
8871         interface to take a vector of relaxed section pointers.
8872         (Output_section::find_merge_section,
8873         Output_section::find_relaxed_input_section,
8874         Output_section::build_relaxation_map,
8875         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8876         New method declarations.
8877         (Output_section::merge_section_map_
8878         Output_section::merge_section_by_properties_map_,
8879         Output_section::relaxed_input_section_map_,
8880         Output_section::is_relaxed_input_section_map_valid_,
8881         Output_section::generate_code_fills_at_write_): New data members.
8882         * script-sections.cc
8883         (Output_section_element_input::set_section_addresses): Call
8884         current_data_size and addralign methods of relaxed input sections.
8885         (Orphan_output_section::set_section_addresses): Call current_data_size
8886         and addralign methods of relaxed input sections.
8887         * symtab.cc (Symbol_table::compute_final_value): Extract template
8888         from the body of Symbol_table::sized_finalize_symbol.
8889         (Symbol_table::sized_finalized_symbol): Call
8890         Symbol_table::compute_final_value.
8891         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8892         (Symbol_table::compute_final_value): New templated method declaration.
8893         * target.cc (Target::do_make_output_section): New method defintion.
8894         * target.h (Target::make_output_section): New method declaration.
8895         (Target::relax): Add more parameters for input objects, symbol table
8896         and layout.  Adjust call to do_relax.
8897         (Target::do_make_output_section): New method declaration.
8898         (Target::do_relax): Add parameters for input objects, symbol table
8899         and layout.
8900
8901 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8902
8903         * pread.c: Include stdio.h.
8904
8905 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8906
8907         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8908         defined.
8909
8910 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8911
8912         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8913         Change read_shndx type to unsigned int.
8914         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8915         int.
8916         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8917         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8918         Change read_shndx type to unsigned int.
8919         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8920         int.
8921         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8922         * layout.cc (Layout::create_symtab_sections): Cast the result of
8923         local_symcount * symsize to off_t in the gold_assert.
8924
8925 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8926
8927         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8928         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8929         R_ARM_BASE_ABS.
8930         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8931         (Arm_relocate_functions::thm_abs5): New function.
8932         (Arm_relocate_functions::abs12): New function.
8933         (Arm_relocate_functions::abs16): New function.
8934         (Arm_relocate_functions::base_abs): New function.
8935         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8936         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8937         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8938         R_ARM_BASE_ABS.
8939         (Scan::global): Likewise.
8940         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8941         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8942         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8943         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8944         R_ARM_BASE_ABS.
8945
8946 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8947
8948         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8949         (Arm_relocate_functions::movt_prel): New function.
8950         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8951         (Arm_relocate_functions::thm_movt_prel): New function.
8952         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8953         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8954         (Scan::global, Relocate::relocate): Likewise.
8955         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8956
8957 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8958
8959         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8960         Incremental_checker.
8961         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8962         unsigned int.
8963         (class Incremental_inputs_header): New class.
8964         (Incremental_inputs_header_writer): Edit comment.
8965         (Incremental_inputs_entry): New class.
8966         (Incremental_inputs_entry_writer): Edit comment.
8967         (Sized_incremental_binary::do_find_incremental_inputs_section):
8968         Add *strtab_shndx parameter, fill it.
8969         (Sized_incremental_binary::do_check_inputs): New method.
8970         (Incremental_checker::can_incrementally_link_output_file): Use
8971         Sized_incremental_binary::check_inputs.
8972         (Incremental_inputs::report_command_line): Save command line in
8973         command_line_.
8974         * incremental.h:
8975         (Incremental_binary::find_incremental_inputs_section): New
8976         method.
8977         (Incremental_binary::do_find_incremental_inputs_section): Add
8978         strtab_shndx parameter.
8979         (Incremental_binary::do_check_inputs): New pure virtual method.
8980         (Sized_incremental_binary::do_check_inputs): Declare.
8981         (Incremental_checker::Incremental_checker): Add incremental_inputs
8982         parameter, use it to initialize incremental_inputs_.
8983         (Incremental_checker::incremental_inputs_): New field.
8984         (Incremental_checker::command_line): New method.
8985         (Incremental_checker::inputs): New method.
8986         (Incremental_checker::command_line_): New field.
8987
8988 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8989
8990         * incremental.cc: Include <cstdarg> and "target-select.h".
8991         (vexplain_no_incremental): New function.
8992         (explain_no_incremental): New function.
8993         (Incremental_binary::error): New method.
8994         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8995         method.
8996         (make_sized_incremental_binary): New function.
8997         (open_incremental_binary): New function.
8998         (can_incrementally_link_file): Add checks if output is ELF and has
8999         inputs section.
9000         * incremental.h: Include "elfcpp_file.h" and "output.h".
9001         (Incremental_binary): New class.
9002         (Sized_incremental_binary): New class.
9003         (open_incremental_binary): Declare.
9004         * object.cc (is_elf_object): Use
9005         elfcpp::Elf_recognizer::is_elf_file.
9006         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9007         * output.h (Output_file::filesize): New method.
9008
9009 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9010
9011         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9012         New function.
9013         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9014         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9015         function.
9016         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9017         function.
9018         (Arm_relocate_functions::movw_abs_nc): New function.
9019         (Arm_relocate_functions::movt_abs): New function.
9020         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9021         (Arm_relocate_functions::thm_movt_abs): New function.
9022         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9023         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9024         (Scan::global): Likewise.
9025         (Relocate::relocate): Likewise.
9026         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9027
9028 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9029
9030         * arm.cc (Arm_relocate_functions::got_prel) New function.
9031         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9032         (Relocate::relocate): Likewise.
9033         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9034
9035 2009-10-06  Ian Lance Taylor  <iant@google.com>
9036
9037         * options.h (class General_options): Define
9038         split_stack_adjust_size parameter.
9039         * object.h (class Object): Add uses_split_stack_ and
9040         has_no_split_stack_ fields.  Add uses_split_stack and
9041         has_no_split_stack accessor functions.  Declare
9042         handle_split_stack_section.
9043         (class Reloc_symbol_changes): Define.
9044         (class Sized_relobj): Define Function_offsets.  Declare
9045         split_stack_adjust, split_stack_adjust_reltype, and
9046         find_functions.
9047         * object.cc (Object::handle_split_stack_section): New function.
9048         (Sized_relobj::do_layout): Call handle_split_stack_section.
9049         * dynobj.cc (Sized_dynobj::do_layout): Call
9050         handle_split_stack_section.
9051         * reloc.cc (Sized_relobj::relocate_sections): Call
9052         split_stack_adjust for executable sections in split_stack
9053         objects.  Pass reloc_map to relocate_section.
9054         (Sized_relobj::split_stack_adjust): New function.
9055         (Sized_relobj::split_stack_adjust_reltype): New function.
9056         (Sized_relobj::find_functions): New function.
9057         * target-reloc.h: Include "object.h".
9058         (relocate_section): Add reloc_symbol_changes parameter.  Change
9059         all callers.
9060         * target.h (class Target): Add calls_non_split method.  Declare
9061         do_calls_non_split virtual method.  Declare match_view and
9062         set_view_to_nop.
9063         * target.cc: Include "elfcpp.h".
9064         (Target::do_calls_non_split): New function.
9065         (Target::match_view): New function.
9066         (Target::set_view_to_nop): New function.
9067         * gold.cc (queue_middle_tasks): Give an error if mixing
9068         split-stack and non-split-stack objects with -r.
9069         * i386.cc (Target_i386::relocate_section): Add
9070         reloc_symbol_changes parameter.
9071         (Target_i386::do_calls_non_split): New function.
9072         * x86_64.cc (Target_x86_64::relocate_section): Add
9073         reloc_symbol_changes parameter.
9074         (Target_x86_64::do_calls_non_split): New function.
9075         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9076         parameter.
9077         * powerpc.cc (Target_powerpc::relocate_section): Add
9078         reloc_symbol_changes parameter.
9079         * sparc.cc (Target_sparc::relocate_section): Add
9080         reloc_symbol_changes parameter.
9081         * configure.ac: Call AM_CONDITIONAL for the default target.
9082         * configure: Rebuild.
9083         * testsuite/Makefile.am (TEST_AS): New variable.
9084         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9085         (check_DATA): Add split_i386 and split_x86_64 files.
9086         (SPLIT_DEFSYMS): Define.
9087         (split_i386_[1234n].o): New targets.
9088         (split_i386_[124]): New targets.
9089         (split_i386_[1234r].stdout): New targets.
9090         (split_x86_64_[1234n].o): New targets.
9091         (split_x86_64_[124]): New targets.
9092         (split_x86_64_[1234r].stdout): New targets.
9093         (MOSTLYCLEANFILES): Add new executables.
9094         * testsuite/split_i386.sh: New file.
9095         * testsuite/split_x86_64.sh: New file.
9096         * testsuite/split_i386_1.s: New file.
9097         * testsuite/split_i386_2.s: New file.
9098         * testsuite/split_i386_3.s: New file.
9099         * testsuite/split_i386_4.s: New file.
9100         * testsuite/split_i386_n.s: New file.
9101         * testsuite/split_x86_64_1.s: New file.
9102         * testsuite/split_x86_64_2.s: New file.
9103         * testsuite/split_x86_64_3.s: New file.
9104         * testsuite/split_x86_64_4.s: New file.
9105         * testsuite/split_x86_64_n.s: New file.
9106         * testsuite/testfile.cc (Target_test): Update relocation_section
9107         function.
9108         * testsuite/Makefile.in: Rebuild.
9109
9110 2009-10-06  Ian Lance Taylor  <iant@google.com>
9111
9112         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9113         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9114         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9115         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9116         the address on ldo_addrs_.
9117         (Target_i386::Relocate::fix_up_ldo): New function.
9118
9119 2009-10-06   Rafael Espindola  <espindola@google.com>
9120
9121         * plugin.cc (add_input_library): New.
9122         (Plugin::load): Add add_input_library to tv.
9123         (Plugin_manager::add_input_file): Add the is_lib argument.
9124         (add_input_file): Update call to Plugin_manager::add_input_file.
9125         (add_input_library): New.
9126         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9127
9128 2009-09-30  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9131         symbol and call Symbol::may_need_copy_reloc to determine if
9132         a copy reloc is needed.
9133         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9134         nocopyreloc is given in command line.
9135         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9136         given in command line.
9137         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9138         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9139         of the removed Target_i386::may_need_copy_reloc.
9140         * options.h (copyreloc): New option with default value false.
9141         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9142         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9143         instead of the removed Target_powerpc::may_need_copy_reloc.
9144         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9145         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9146         instead of the removed Target_sparc::may_need_copy_reloc.
9147         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9148         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9149         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9150         instead of the removed Target_x86_64::may_need_copy_reloc.
9151
9152 2009-09-30  Ian Lance Taylor  <iant@google.com>
9153
9154         * object.h (class Object): Remove target_ field, and target,
9155         sized_target, and set_target methods.
9156         (Object::sized_target): Remove.
9157         (class Sized_relobj): Update declarations.  Remove sized_target.
9158         * object.cc (Sized_relobj::setup): Remove target parameter.
9159         Change all callers.
9160         (Input_objects::add_object): Don't do anything with the target.
9161         (make_elf_sized_object): Add punconfigured parameter.  Change all
9162         callers.  Set or test parameter target.
9163         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9164         Change all callers.
9165         * parameters.cc (Parameters::set_target): Change parameter type to
9166         be non-const.
9167         (Parameters::default_target): Remove.
9168         (set_parameters_target): Change parameter type to be non-const.
9169         (parameters_force_valid_target): New function.
9170         (parameters_clear_target): New function.
9171         * parameters.h (class Parameters): Update declarations.  Remove
9172         default_target method.  Add sized_target and clear_target
9173         methods.  Change target_ to be non-const.
9174         (set_parameters_target): Update declaration.
9175         (parameters_force_valid_target): Declare.
9176         (parameters_clear_target): Declare.
9177         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9178         as NULL if we aren't searching.
9179         (Add_symbols::run): Don't check for compatible target.
9180         * fileread.cc (Input_file::open_binary): Call
9181         parameters_force_valid_target.
9182         * gold.cc (queue_middle_tasks): Likewise.
9183         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9184         set_target on object.
9185         * dynobj.h (class Sized_dynobj): Update declarations.
9186         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9187         make_elf_object returns NULL.
9188         (Archive::include_member): Don't check whether object target is
9189         compatible.
9190         * output.cc (Output_section::add_input_section): Get target from
9191         parameters.
9192         (Output_section::relax_input_section): Likewise.
9193         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9194         parameters.
9195         (Sized_relobj::do_scan_relocs): Likewise.
9196         (Sized_relobj::relocate_sections): Likewise.
9197         * resolve.cc (Symbol_table::resolve): Likewise.
9198         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9199         parameter.  Change all callers.
9200         (Symbol_table::add_from_object): Get target from parameters.
9201         (Symbol_table::add_from_relobj): Don't check object target.
9202         (Symbol_table::add_from_dynobj): Likewise.
9203         (Symbol_table::define_special_symbol): Get target from
9204         parameters.
9205         * symtab.h (class Symbol_table): Update declaration.
9206         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9207         parameter.  Change all callers.  Clear parameter target.
9208         (Binary_test): Test target here.
9209         * testsuite/object_unittest.cc (gold_testsuite): Remove
9210         target_test_pointer parameter.  Change all callers.
9211         (Object_test): Test target here.
9212
9213 2009-09-26  Ian Lance Taylor  <iant@google.com>
9214
9215         * testsuite/initpri1.c: Don't try to use constructor priorities if
9216         compiling with gcc before 4.3.
9217
9218 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9219
9220         * testsuite/retain_symbols_file_test.sh (check_present): Change
9221         output file name to retain_symbols_file_test.stdout.
9222         (check_absent): Likewise.
9223
9224 2009-09-18  Craig Silverstein  <csilvers@google.com>
9225
9226         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9227         * options.cc: Include <cerrno> and <fstream>.
9228         (General_options::finalize): Parse -retain-symbols-file tag.
9229         * options.h: New flag.
9230         (General_options): New method should_retain_symbol, new
9231         variable symbols_to_retain.
9232         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9233         should_retain_symbol map.
9234         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9235         * testsuite/Makefile.in: Regenerate.
9236         * testsuite/retain_symbols_file_test.sh: New file.
9237
9238 2009-09-18  Nick Clifton  <nickc@redhat.com>
9239
9240         * po/es.po: Updated Spanish translation.
9241
9242 2009-09-17  Doug Kwan  <dougkwan@google.com>
9243
9244         * debug.h (DEBUG_RELAXATION): New constant.
9245         (DEBUG_ALL): Add DEBUG_RELAXATION.
9246         (debug_string_to_enum): Add relaxation debug option.
9247         * layout.cc
9248         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9249         Layout::Relaxation_debug_check::read_sections,
9250         Layout::Relaxation_debug_check::read_sections): New method definitions.
9251         (Layout::Layout): Initialize data members
9252         record_output_section_data_from_scrips_,
9253         script_output_section_data_list_ and relaxation_debug_check_.
9254         (Layout::save_segments, Layout::restore_segments,
9255         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9256         Layout::relaxation_loop_body): New method definitions.
9257         (Layout::finalize): Support relaxation.  Move section layout code to
9258         Layout::relaxation_loop_body.
9259         (Layout::set_asection_address_from_script): Move code for orphan
9260         section placement out.
9261         (Layout::place_orphan_sections_in_script): New method definition.
9262         * layout.h (Output_segment_headers, Output_file_header):
9263         New forward class declarations.
9264         (Layout::~Layout): Define.
9265         (Layout::new_output_section_data_from_script): New method definition.
9266         (Layout::place_orphan_sections_in_script): New method declaration.
9267         (Layout::Segment_states): New type declaration.
9268         (Layout::save_segments, Layout::restore_segments,
9269         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9270         Layout::relaxation_loop_body): New method declarations.
9271         (Layout::Output_section_data_list): New type declaration.
9272         (Layout::Relaxation_debug_check): New class definition.
9273         (Layout::record_output_section_data_from_script_,
9274         Layout::script_output_section_data_list_, Layout::segment_states_,
9275         Layout::relaxation_debug_check_): New data members.
9276         * output.cc: (Output_section_headers::do_size): New method definition.
9277         (Output_section_headers::Output_section_headers): Move size
9278         computation to Output_section_headers::do_size.
9279         (Output_segment_headers::do_size): New method definition.
9280         (Output_file_header::Output_file_header): Move size computation to
9281         Output_file_header::do_size and call it.
9282         (Output_file_header::do_size): New method definition.
9283         (Output_data_group::Output_data_group): Adjust call to
9284         Output_section_data.
9285         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9286         (Output_symtab_xindex::do_write): Add array bound check.
9287         (Output_section::Input_section::print_to_mapfile): Handle
9288         RELAXED_INPUT_SECTION_CODE.
9289         (Output_section::Output_section): Initialize data member checkpoint_.
9290         (Output_section::~Output_section): Delete checkpoint object pointed
9291         by checkpoint_.
9292         (Output_section::add_input_section): Always add an Input_section if
9293         relaxing.
9294         (Output_section::add_merge_input_section): Add assert.
9295         (Output_section::relax_input_section): New method definition.
9296         (Output_section::set_final_data_size): Set load address to zero for
9297         an unallocated section.
9298         (Output_section::do_address_and_file_offset_have_reset_values):
9299         New method definition.
9300         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9301         Handle relaxed input section.
9302         (Output_section::sort_attached_input_sections): Checkpoint input
9303         section list lazily.
9304         (Output_section::get_input_sections): Change type of input_sections to
9305         list of Simple_input_section pointers.  Checkpoint input section list
9306         lazily.  Also handle relaxed input sections.
9307         (Output_section::add_input_section_for_script): Take a reference to
9308         a Simple_input_section object instead of Relobj pointer and section
9309         index as parameter.  Handle relaxed input sections.
9310         (Output_section::save_states, Output_section::restore_states): New
9311         method definitions.
9312         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9313         (Output_data::is_data_size_fixed): New method definition.
9314         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9315         if it is fixed.
9316         (Output_data::address_and_file_offset_have_reset_values): New method
9317         definition.
9318         (Output_data::do_address_and_file_offset_have_reset_values): New method
9319         definition.
9320         (Output_data::set_data_size): Check that data size is not fixed.
9321         (Output_data::fix_data_size): New method definition.
9322         (Output_data::is_data_size_fixed_): New data member.
9323         (Output_section_headers::set_final_data_size): New method definition.
9324         (Output_section_headers::do_size): New method declaration.
9325         (Output_segment_headers::set_final_data_size): New method definition.
9326         (Output_segment_headers::do_size): New method declaration.
9327         (Output_file_header::set_final_data_size)::New method definition.
9328         (Output_file_header::do_size)::New method declaration.
9329         (Output_section_data::Output_section_data): Add new parameter
9330         is_data_size_fixed and use it to fix data size.
9331         (Output_data_const::Output_data_const): Adjust call to base class
9332         constructor and fix data size.
9333         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9334         base class constructor and fix data size.
9335         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9336         base class constructor and fix data size.
9337         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9338         class constructor and fix data size.
9339         (Output_data_group::set_final_data_size): New method definition.
9340         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9341         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9342         class constructor and fix data size.
9343         (Output_relaxed_input_section): New class definition.
9344         (Output_section::Simple_input_section): New class definition.
9345         (Output_section::get_input_sections): Adjust parameter list.
9346         (Output_section::add_input_section_for_script): Same.
9347         (Output_section::save_states, Output_section::restore_states,
9348         Output_section::do_address_and_file_offset_have_reset_values,
9349         (Output_section::Input_section::Input_section): Handle
9350         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9351         Output_relaxed_input_section.
9352         (Output_section::Input_section::is_input_section,
9353         Output_section::Input_section::set_output_section): Handle relaxed
9354         input section.
9355         (Output_section::Input_section::is_relaxed_input_section,
9356         Output_section::Input_section::output_section_data,
9357         Output_section::Input_section::relaxed_input_section): New method
9358         definitions.
9359         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9360         value.
9361         (Output_section::Input_section::u1_): Update comments.
9362         (Output_section::Input_section::u2_): Add new union member poris.
9363         (Output_section::Checkpoint_output_section): New classs definition.
9364         (Output_section::relax_input_section): New method declaration.
9365         (Output_section::checkpoint_): New data member.
9366         (Output_segment): Update comments.
9367         (Output_segment::Output_segment): Un-privatize copy constructor.
9368         (Output_segment::operator=): Un-privatize.
9369         * script-sections.cc (Output_section_element::Input_section_list):
9370         Change element type to Output_section::Simple_input_section.
9371         (Output_section_element_dot_assignment::set_section_addresses):
9372         Register output section data for relaxation clean up.
9373         (Output_data_exression::Output_data_expression): Adjust call to base
9374         constructor to fix data size.
9375         (Output_section_element_data::set_section_addresses): Register
9376         Output_data_expression object for relaxation clean up.
9377         (struct Input_section_info): Replace Relobj pointer and section index
9378         pair with Output_section::Simple_input_section and Convert struct to a
9379         class.
9380         (Input_section_sorter::operator()): Adjust access to
9381         Input_section_info data member to use accessors.
9382         (Output_section_element_input::set_section_addresses): Use layout
9383         parameter.  Adjust code to use Output_section::Simple_input_section
9384         and Input_secction_info classes.  Register filler for relaxation
9385         clean up.
9386         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9387         and section index pair with Output_section::Simple_input_section
9388         class.  Adjust code accordingly.
9389         (Phdrs_element::release_segment): New method definition.
9390         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9391         segment list.
9392         (Script_sections::release_segments): New method definition.
9393         * gold/script-sections.h (Script_sections::release_segments): New
9394         method declaration.
9395         * gold/target.h (Target::may_relax, Target::relax,
9396         Target::do_may_relax, Target::do_relax): New method definitions.
9397
9398 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9399
9400         * arm.cc (has_signed_unsigned_overflow): New function.
9401         (Arm_relocate_functions::abs8): New function.
9402         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9403         (Target_arm::Scan::global): Likewise.
9404         (Target_arm::relocate::relocate): Likewise.
9405         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9406         Likewise.
9407
9408 2009-09-16  Cary Coutant  <ccoutant@google.com>
9409
9410         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9411         * testsuite/Makefile.in: Regenerate.
9412
9413 2009-09-11  Nick Clifton  <nickc@redhat.com>
9414
9415         * po/gold.pot: Updated by the Translation project.
9416
9417 2009-09-08  Cary Coutant  <ccoutant@google.com>
9418
9419         * output.cc (Output_file::open): Add execute permission to empty file.
9420         * testsuite/Makefile.am (permission_test): New test.
9421         * testsuite/Makefile.in: Regenerate.
9422
9423 2009-09-02  Ian Lance Taylor  <iant@google.com>
9424
9425         * output.cc (Output_file::resize): Call map_no_anonymous rather
9426         than map.
9427
9428 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9429
9430         * gold.cc: Include "incremental.h".
9431         (queue_initial_tasks): Call Incremental_checker methods.
9432         * incremental.cc: Include "output.h".
9433         (Incremental_checker::can_incrementally_link_output_file): New
9434         method.
9435         * incremental.h (Incremental_checker): New class.
9436
9437         * output.cc (Output_file::open_for_modification): New method.
9438         (Output_file::map_anonymous): Changed return type to bool.  Record
9439         map in base_ field.
9440         (Output_file::map_no_anonymous): New method, broken out of map.
9441         (Output_file::map): Use map_no_anonymous and map_anonymous.
9442         * output.h (class Output_file): Update declarations.
9443
9444 2009-08-24  Cary Coutant  <ccoutant@google.com>
9445
9446         * options.h (Command_line::Pre_options): New class.
9447         (Command_line::pre_options): New member.
9448         * options.cc (gold::options::ready_to_register): New variable.
9449         (One_option::register_option): Do nothing if not registering options.
9450         Assert if same short option registered twice.
9451         (General_options::General_options): Turn off option registration when
9452         done constructing.
9453         (Command_line::Pre_options::Pre_options): New constructor.
9454
9455 2009-08-24  Cary Coutant  <ccoutant@google.com>
9456
9457         * options.h (General_options::no_keep_memory): Remove incorrect
9458         short option.
9459
9460 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9461
9462         * Makefile.am (am__skiplex, am__skipyacc): New.
9463         * Makefile.in: Regenerate.
9464
9465 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9466
9467         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9468         (INCLUDES): ... this.
9469         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9470         (AM_CPPFLAGS): Renamed from ...
9471         (INCLUDE): ... this.
9472         * Makefile.in, testsuite/Makefile.in: Regenerate.
9473
9474         * Makefile.in: Regenerate.
9475         * aclocal.m4: Likewise.
9476         * config.in: Likewise.
9477         * configure: Likewise.
9478         * testsuite/Makefile.in: Likewise.
9479
9480         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9481         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9482         * Makefile.in: Regenerate.
9483         * testsuite/Makefile.in: Regenerate.
9484
9485 2009-08-19  Cary Coutant  <ccoutant@google.com>
9486
9487         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9488         symbols in shared libraries overridden by hidden or internal symbols
9489         in the main program.
9490
9491 2009-08-19  Chris Demetriou  <cgd@google.com>
9492
9493         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9494         checking source file names in error messages.
9495
9496 2009-08-18  Doug Kwan  <dougkwan@google.com>
9497
9498         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9499         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9500         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9501         an elfcpp::Ehdr as parameter.
9502         * object.cc (Object::set_target): Remove the version that looks up
9503         a target and sets it.
9504         (Sized_relobj::setup): Take a Target object instead of
9505         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9506         (make_elf_sized_object): Find target and ask target to
9507         make an ELF object.
9508         * object.h: (Object::set_target): Remove the version that looks up
9509         a target and sets it.
9510         (Sized_relobj::setup): Take a Target object instead of
9511         an elfcpp:Ehdr as parameter.
9512         * target.cc: Include dynobj.h.
9513         (Target::do_make_elf_object_implementation): New.
9514         (Target::do_make_elf_object): New.
9515         * target.h (Target::make_elf_object): New template declaration.
9516         (Target::do_make_elf_object): New method declarations.
9517         (Target::do_make_elf_object_implementation): New template declaration.
9518
9519 2009-08-14  Ian Lance Taylor  <iant@google.com>
9520
9521         * gold.h (FUNCTION_NAME): Define.
9522         (gold_unreachable): Use FUNCTION_NAME.
9523
9524 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9525
9526         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9527         symbol in the --keep-unique list is not found.
9528
9529 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9530
9531         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9532         been maked as --keep-unique.
9533         (Icf::unfold_section): New function.
9534         * icf.h (Icf::unfold_section): New function.
9535         * options.h (General_options::keep_unique): New option.
9536         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9537         * testsuite/Makefile.in: Regenerate.
9538         * testsuite/icf_keep_unique_test.sh: New file.
9539         * testsuite/icf_keep_unique_test.cc: New file.
9540
9541 2009-08-12  Cary Coutant  <ccoutant@google.com>
9542
9543         PR 10471
9544         * resolve.cc (Symbol_table::resolve): Check for references from
9545         dynamic objects to hidden and internal symbols.
9546         * testsuite/Makefile.am (hidden_test.sh): New test.
9547         * testsuite/Makefile.in: Regenerate.
9548         * testsuite/hidden_test.sh: New script.
9549         * testsuite/hidden_test_1.c: New test source.
9550         * testsuite/hidden_test_main.c: New test source.
9551
9552 2009-08-11  Doug Kwan  <dougkwan@google.com>
9553
9554         * arm.cc: Update comments.
9555         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9556         segment to locate the .ARM.exidx section if present.
9557
9558 2009-08-09  Doug Kwan  <dougkwan@google.com>
9559
9560         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9561         patch.
9562
9563 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9564         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9565         compiler warnings.
9566
9567 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9568
9569         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9570         valid tls_segment only for non-debug-section relocations.
9571         * testsuite/Makefile.am: Add gc_tls_test.
9572         * testsuite/Makefile.in: Regenerate.
9573         * testsuite/gc_tls_test.cc: New file.
9574         * testsuite/gc_tls_test.sh: New file.
9575
9576 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9577
9578         * icf.cc: New file.
9579         * icf.h: New file.
9580         * Makefile.am (CCFILES): Add icf.cc.
9581         (HFILES): Add icf.h
9582         * Makefile.in: Regenerate.
9583         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9584         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9585         section, symbol and addend information for the relocs.
9586         * gold.cc (queue_middle_tasks): Call identical code folding.
9587         * gold.h: Add defines for multimap.
9588         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9589         to the call of finalize_local_symbols.
9590         * main.cc (main): Create object of class Icf.
9591         * object.cc (Sized_relobj::do_layout): Allow this function to be
9592         called twice during icf.
9593         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9594         to sections marked as identical by icf.
9595         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9596         when available.
9597         (Sized_relobj::do_section_entsize): New function.
9598         * object.h (Object::section_entsize): New function.
9599         (Object::do_section_entsize): New pure virtual function.
9600         (Relobj::finalize_local_symbols): Add new parameter.
9601         (Relobj::do_section_entsize): New function.
9602         * options.h (General_options::icf): New option.
9603         (General_options::icf_iterations): New option.
9604         (General_options::print_icf_sections): New option.
9605         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9606         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9607         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9608         icf.
9609         * symtab.cc (Symbol_table::is_section_folded): New function.
9610         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9611         to sections marked as identical by icf.
9612         * symtab.h (Symbol_table::set_icf): New function.
9613         (Symbol_table::icf): New function.
9614         (Symbol_table::is_section_folded): New function.
9615         (Symbol_table::icf_): New data member.
9616         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9617         * testsuite/Makefile.am: Add commands to build icf_test.
9618         * testsuite/Makefile.in: Regenerate.
9619         * testsuite/icf_test.sh: New file.
9620         * testsuite/icf_test.cc: New file.
9621
9622 2009-07-24  Chris Demetriou  <cgd@google.com>
9623
9624         * layout.cc (is_compressible_debug_section): Fix incorrect
9625         comment about compressed section names.
9626
9627 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9628
9629         PR 10419
9630         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9631
9632 2009-07-16  Ian Lance Taylor  <iant@google.com>
9633
9634         PR 10400
9635         * layout.h: #include <map>.
9636         (class Kept_section): Change from struct to class.  Add accessors
9637         and setters.  Add section size to Comdat_group mapping.  Change
9638         Comdat_group to std::map.  Add is_comdat_ field.  Add
9639         linkonce_size field in union.
9640         (class Layout): Update declaration of find_or_add_kept_section.
9641         Don't declare find_kept_object.
9642         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9643         parameter.  Add object, shndx, is_comdat, and is_group_name
9644         parameters.  Change all callers.  Adjust for new Kept_section.
9645         (Layout::find_kept_object): Remove.
9646         * object.cc (Sized_relobj::include_section_group): Update use of
9647         Kept_section.  Rename secnum to shndx.  Only record
9648         Kept_comdat_section if sections are the same size.
9649         (Sized_relobj::include_linkonce_section): Update use of
9650         Kept_section.  Only record Kept_comdat_section if sections are the
9651         same size.  Set size of linkonce section.
9652         (Sized_relobj::map_to_kept_section): Update call to
9653         get_kept_comdat_section.
9654         * object.h (class Sized_relobj): Rename fields in
9655         Kept_comdat_section to drop trailing underscores; change object
9656         field to Relobj*.  Change Kept_comdat_section_table to store
9657         struct rather than pointer.
9658         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9659         Add kept_object and kept_shndx parameters.  Change all callers.
9660         (Sized_relobj::get_kept_comdat_section): Change return type to
9661         bool.  Add kept_object and kept_shndx parameters.  Change all
9662         callers.
9663         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9664         Layout::find_or_add_kept_section.
9665
9666 2009-07-09  Ian Lance Taylor  <iant@google.com>
9667
9668         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9669         Reserve space in the hash table.
9670
9671 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9672
9673         * fileread.cc (File_read::get_mtime): New method.
9674         * fileread.h (Timespec): New structure.
9675         (File_read::get_mtime): New method.
9676         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9677         Renamed from timestamp_nsec.
9678         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9679         Elf_Xword.
9680         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9681         timestamp_nsec.
9682         (Incremental_inputs::report_archive): Save mtime; style fix.
9683         (Incremental_inputs::report_obejct): Save mtime; style fix.
9684         (Incremental_inputs::report_script): Save mtime; style fix.
9685         (Incremental_inputs::finalize_inputs): Style fix.
9686         (Incremental_inputs::finalize): Style fix.
9687         (Incremental_inputs::create_input_section_data): Store inputs
9688         mtime.
9689         * incremental.h (Incremental_inputs::report_script): Add mtime
9690         argument.
9691         (Incremental_inputs::Input_info::Input_info): Intialize only one
9692         union member.
9693         (Incremental_inputs::Input_info::archive): Move to nameless
9694         union.
9695         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9696         (Incremental_inputs::Input_info::script): Move to nameless union.
9697         (Incremental_inputs::mtime): New field.
9698         * script.cc (read_input_script): Pass file mtime to
9699         Incremental_input.
9700         * script.h (Script_info::inputs): Style fix.
9701
9702 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9703
9704         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9705         instead of 32.
9706
9707 2009-06-24  Ian Lance Taylor  <iant@google.com>
9708
9709         PR 10156
9710         * layout.cc (Layout::choose_output_section): If we find an
9711         existing section, update the flags.
9712         (Layout::create_notes): New function, broken out of
9713         Layout::finalize.
9714         (Layout::finalize): Don't create note sections.
9715         (Layout::create_note): Don't crash if linker script discards
9716         section.
9717         (Layout::create_gold_note): Likewise.
9718         (Layout::create_build_id): Likewise.  Don't set
9719         after_input_sections on the section.
9720         (Layout::create_executable_stack_info): Remove target parameter.
9721         Change caller.
9722         * layout.h (class Layout): Declare create_notes.  Update
9723         declaration of create_executable_stack_info.
9724         * gold.cc (queue_middle_tasks): Call create_notes.
9725         * output.cc (Output_section::update_flags_for_input_section): Move
9726         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9727         invalid.
9728         * output.h (Output_data::mark_address_invalid): New function.
9729         (class Output_section): Only declare, not define,
9730         update_flags_for_input_section.  Remove set_flags.
9731
9732 2009-06-24  Ian Lance Taylor  <iant@google.com>
9733
9734         * script-sections.cc (Output_section_definition::
9735         set_section_addresses): Rename shadowing local load_address to
9736         laddr.
9737
9738 2009-06-24  Ian Lance Taylor  <iant@google.com>
9739
9740         PR 10244
9741         * reloc.cc (relocate_sections): Skip empty relocation sections.
9742
9743 2009-06-23  Ian Lance Taylor  <iant@google.com>
9744
9745         PR 10156
9746         * layout.cc (Layout::create_note): Use choose_output_section
9747         rather than make_output_section.
9748
9749 2009-06-23  Ian Lance Taylor  <iant@google.com>
9750
9751         PR 10237
9752         * options.cc (General_options::parse_V): Set printed_version_.
9753         (General_options::General_options): Initialize printed_version_.
9754         * options.h (class General_options): Add printed_version_ field.
9755         * gold.cc (queue_initial_tasks): If there are no input files,
9756         don't give a fatal error if we printed the version information.
9757         (queue_middle_tasks): If using -r with a shared object, give a
9758         fatal error rather than an ordinary error.
9759
9760 2009-06-23  Ian Lance Taylor  <iant@google.com>
9761
9762         PR 10219
9763         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9764         (Layout::make_output_section): Set have_stabstr_section_ if we see
9765         a .stab*str section.
9766         (Layout::finalize): Call link_stabs_sections.
9767         (Layout::link_stabs_sections): New file.
9768         * layout.h (class Layout): Add have_stabstr_section_ field.
9769         Declare link_stabs_sections.
9770
9771 2009-06-23  Doug Kwan  <dougkwan@google.com>
9772
9773         * Makefile.am (libgold_a_LIBADD): New.
9774         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9775         * Makefile.in: Regenerate.
9776         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9777         * configure: Regenerate.
9778         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9779         * fileread.cc: Include sys/state.h
9780         * gold.h: Declare memmem and strndup if found missing.
9781         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9782
9783 2009-06-23  Ian Lance Taylor  <iant@google.com>
9784
9785         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9786         * configure: Rebuild.
9787
9788 2009-06-23  Ian Lance Taylor  <iant@google.com>
9789
9790         PR 10147
9791         * object.cc (Object::section_contents): Don't try to get a view if
9792         the section has length zero.
9793         (Object::handle_gnu_warning_section): If the section is empty, use
9794         the name of the section as the warning.
9795
9796 2009-06-23  Ian Lance Taylor  <iant@google.com>
9797
9798         PR 10133
9799         * stringpool.h (class Stringpool_template): Add optimize_ field.
9800         (Stringpool_template::set_optimize): New function.
9801         * stringpool.cc (Stringpool_template::Stringpool_template):
9802         Initialize optimize_ field.
9803         (Stringpool_template::set_string_offsets): Test local optimize
9804         fild rather than parameter.
9805         * layout.cc (Layout::Layout): Call set_optimize on the section
9806         name stringpool.
9807
9808 2009-06-22  Ian Lance Taylor  <iant@google.com>
9809
9810         PR 10030
9811         * yyscript.y: Parse TARGET.
9812         * script.cc (script_set_target): New function.
9813         * script-c.h (script_set_target): Declare.
9814         * options.cc (General_options::string_to_object_format): Rename
9815         from string_to_object_format in anonymous namespace.  Change
9816         callers.
9817         * options.h (class General_options): Declare
9818         string_to_object_format.
9819
9820 2009-06-22  Ian Lance Taylor  <iant@google.com>
9821
9822         * script-sections.cc (Script_sections::create_segments): Don't put
9823         program headers in a PT_LOAD segment if -n or -N.
9824
9825 2009-06-22  Ian Lance Taylor  <iant@google.com>
9826
9827         PR 10141
9828         * options.h (class General_options): Add -z lazy and -z now.  Sort
9829         -z options into alphabetical order.
9830         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9831
9832 2009-06-21  Ian Lance Taylor  <iant@google.com>
9833
9834         * layout.cc (Layout::make_output_section): Call
9835         Target::new_output_section.
9836         (Layout::attach_allocated_section_to_segment): Put large section
9837         sections in a separate load segment with the large segment flag
9838         set.
9839         (Layout::segment_precedes): Sort large data segments after other
9840         load segments.
9841         (align_file_offset): New static function.
9842         (Layout::set_segment_offsets): Use align_file_offset.
9843         * output.h (class Output_section): Add is_small_section_ and
9844         is_large_section_ fields.
9845         (Output_section::is_small_section): New function.
9846         (Output_section::set_is_small_section):  New function.
9847         (Output_section::is_large_section): New function.
9848         (Output_section::set_is_large_section): New function.
9849         (Output_section::is_large_data_section): New function.
9850         (class Output_segment): Add is_large_data_segment_ field.
9851         (Output_segment::is_large_data_segment): New function.
9852         (Output_segment::set_is_large_data_segment): New function.
9853         * output.cc (Output_section::Output_section): Initialize new
9854         fields.
9855         (Output_segment::Output_segment): Likewise.
9856         (Output_segment::add_output_section): Add assertion that large
9857         data sections always go in large data segments.  Force small data
9858         sections to the end of the list of data sections.  Force small BSS
9859         sections to the start of the list of BSS sections.  For large BSS
9860         sections to the end of the list of BSS sections.
9861         * symtab.h (class Symbol): Declare is_common_shndx.
9862         (Symbol::is_defined): Check Symbol::is_common_shndx.
9863         (Symbol::is_common): Likewise.
9864         (class Symbol_table): Define enum Commons_section_type.  Update
9865         declarations.  Add small_commons_ and large_commons_ fields.
9866         * symtab.cc (Symbol::is_common_shndx): New function.
9867         (Symbol_table::Symbol_table): Initialize new fields.
9868         (Symbol_table::add_from_object): Put small and large common
9869         symbols in the right list.
9870         (Symbol_table::sized_finalized_symbol): Check
9871         Symbol::is_common_shndx.
9872         (Symbol_table::sized_write_globals): Likewise.
9873         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9874         common symbol lists.  Don't call do_allocate_commons_list if the
9875         list is empty.
9876         (Symbol_table::do_allocate_commons_list): Remove is_tls
9877         parameter.  Add comons_section_type parameter.  Change all
9878         callers.  Handle small and large common symbols.
9879         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9880         Symbol::is_common_shndx.
9881         * resolve.cc (symbol_to_bits): Likewise.
9882         * target.h (Target::small_common_shndx): New function.
9883         (Target::small_common_section_flags): New function.
9884         (Target::large_common_shndx): New function.
9885         (Target::large_common_section_flags): New function.
9886         (Target::new_output_section): New function.
9887         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9888         small_common_section_flags, and large_common_section_flags
9889         fields.
9890         (Target::do_new_output_section): New virtual function.
9891         * arm.cc (Target_arm::arm_info): Initialize new fields.
9892         * i386.cc (Target_i386::i386_info): Likewise.
9893         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9894         Likewise.
9895         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9896         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9897         (Target_x86_64::do_new_output_section): New function.
9898         * configure.ac: Define conditional MCMODEL_MEDIUM.
9899         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9900         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9901         (large_LDFLAGS): Define.
9902         * testsuite/large.c: New file.
9903         * testsuite/testfile.cc (Target_test::test_target_info):
9904         Initialize new fields.
9905         * configure, testsuite/Makefile.in: Rebuild.
9906
9907 2009-06-05  Doug Kwan  <dougkwan@google.com>
9908
9909         * Makefile.am (CCFILES): Add target.cc.
9910         * Makefile.in: Regenerate.
9911         * i386.cc (class Target_i386): Define new virtual method to
9912         override do_is_local_label_name in parent.
9913         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9914         local symbols if --discard-locals or -X is given.
9915         * options.h (class General_options): Declare new options
9916         '--discard-locals' and '-X' for discarding locals.
9917         * target.h (class Target): Define new methods is_local_label_name.
9918         Declare new virtual method do_is_local_label_name.
9919         * target.cc: New file.
9920         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9921         (check_SCRIPTS): Add discard_locals_test.sh.
9922         (check_DATA): Add discard_local_tests.syms.
9923         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9924         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9925         * testsuite/Makefile.in: Regenerate.
9926         * testsuite/discard_locals_test.c: New file.
9927         * testsuite/discard_locals_test.sh: Same.
9928
9929 2009-06-05  Doug Kwan  <dougkwan@google.com>
9930
9931         * object.cc (Sized_relobj::Sized_relobj): Initialize
9932         discarded_eh_frame_shndx_ to -1U.
9933         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9934         section.
9935         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9936         a discarded .eh_frame section.
9937         (Sized_relobj::do_finalize_local_symbols): Ditto.
9938         * object.h (class Sized_relobj): Declare new member
9939         discarded_eh_frame_shndx_.
9940         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9941         (local_labels_test.o, local_labels_test): New rules.
9942         * testsuite/Makefile.in: Regenerate.
9943
9944 2009-06-04  Doug Kwan  <dougkwan@google.com>
9945
9946         * layout.cc (Layout::section_name_mapping): Add mapping for
9947         special ARM sections.
9948
9949 2009-06-03  Doug Kwan  <dougkwan@google.com>
9950
9951         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9952         (utils::has_overflow): Same.
9953
9954 2009-06-03  Ian Lance Taylor  <iant@google.com>
9955
9956         * layout.cc (Layout::section_name_mapping): New array, replacing
9957         Layout::linkonce_mapping.
9958         (Layout::section_name_mapping_count): New variable, replacing
9959         Layout::linkonce_mapping_count.
9960         (Layout::linkonce_output_name): Remove.
9961         (Layout::output_section_name): Rewrite.
9962         * layout.h (class Layout): Rename Linkonce_mapping to
9963         Section_name_mapping, linkonce_mapping to section_name_mapping,
9964         linkonce_mapping_count to section_name_mapping_count.  Don't
9965         declare linkonce_output_name.
9966
9967 2009-06-03  Doug Kwan  <dougkwan@google.com>
9968
9969         * gold/arm.cc (namespace utils): New.
9970         (Target_arm::reloc_is_non_pic): Define new method.
9971         (class Arm_relocate_functions): New.
9972         (Target_arm::Relocate::relocate): Handle relocation types used by
9973         Android.
9974
9975 2009-06-03  Ian Lance Taylor  <iant@google.com>
9976
9977         * arm.cc (Target_arm::scan::global): Use || instead of |.
9978
9979 2009-06-02  Doug Kwan  <dougkwan@google.com>
9980
9981         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9982         issued_non_pic_error_.
9983         (class Target_arm::Scan): Declare new method check_non_pic.
9984         Define new method symbol_needs_plt_entry.
9985         Declare new data member issued_non_pic_error_.
9986         (class Target_arm::Relocate): Declare new method
9987         should_apply_static_reloc.
9988         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9989         (Target_arm::Scan::check_non_pic): Define new method.
9990         (Target_arm::Scan::local): Handle a small subset of reloc types used
9991         by Android.
9992         (Target_arm::Scan::local): Same.
9993         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9994
9995 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9996
9997         * incremental.cc (Incremental_inputs::report_command_line): Filter
9998         out --incremental-* options.
9999
10000 2009-05-29  Doug Kwan  <dougkwan@google.com>
10001
10002         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10003         template class.
10004         (class Target_arm): Update comment.
10005         (Target_arm::Target_arm): Initialize new data members GOT_,
10006         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10007         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10008         and Target_arm::rel_dyn_section.
10009         Declare new_enum Target_arm::Got_type.
10010         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10011         and DYNBSS_.
10012         Update commments for member do_dynsym_value.
10013         (Target_arm::got_size, Target_arm::plt_section,
10014         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10015         new methods inside class defintion.
10016         (Target_arm::got_section): Define new method.
10017         (Target_arm::rel_dyn_section): Same.
10018         (Output_data_plt_arm): New template class.
10019         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10020         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10021         (Output_data_plt_arm::add_entry): Same.
10022         (Output_data_plt_arm::first_plt_entry): Define new
10023         static data member for PLT instruction template.
10024         (Output_data_plt_arm::plt_entry): Same.
10025         (Output_data_plt_arm::do_write): Define new method.
10026         (Target_arm::make_plt_entry): Same.
10027         (Target_arm::do_finalize_sections): Same.
10028         (Target_arm::do_dynsym_value): Same.
10029
10030 2009-05-28  Doug Kwan  <dougkwan@google.com>
10031
10032         * Makefile.am (TARGETSOURCES): Add arm.cc.
10033         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10034         * Makefile.in: Regenerate.
10035         * arm.cc: New file.
10036         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10037
10038 2009-05-26  Doug Kwan  <dougkwan@google.com>
10039
10040         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10041         (General_options::check_excluded_libs): Strip off directories in
10042         archive name before matching like GNU ld does.
10043         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10044         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10045         (exclude_libs_test_LDFLAGS): Add linker option
10046         -Wl,--exclude-libs,libexclude_libs_test_3
10047         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10048         an explicit archive without using -l.
10049         (alt/libexclude_libs_test_3.a): New make rule.
10050         * testsuite/Makefile.in: Regenerate.
10051         * testsuite/exclude_libs_test.c : Declare lib3_default().
10052         (main): Call it.
10053         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10054         * exclude_libs_test_3.c: New file.
10055
10056 2009-05-26  Nick Clifton  <nickc@redhat.com>
10057
10058         * po/id.po: New Indonesian translation.
10059         * po/gold.pot: Updated template file.
10060
10061 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10062
10063         * testsuite/Makefile.am: Add -ffunction-sections to compile
10064         gc_comdat_test files.  Add -Wl,--gc-sections to build
10065         gc_comdat_test.
10066         * testsuite/Makefile.in: Regenerate.
10067         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10068
10069 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10070
10071         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10072         kept comdat section was garbage collected.
10073         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10074         * testsuite/Makefile.in: Regenerate.
10075         * testsuite/gc_comdat_test.sh: New file.
10076         * testsuite/gc_comdat_test_1.cc: New file.
10077         * testsuite/gc_comdat_test_2.cc: New file.
10078
10079 2009-05-19  Doug Kwan  <dougkwan@google.com>
10080
10081         * archive.cc (Archive::Archive): Move constructor from archive.h
10082         to here.  Initialize no_export_.
10083         (Archive::get_elf_object_for_member): Set no_export flag of object.
10084         * archive.h (Archive::Archive): Move constructor body to
10085         archive.cc.
10086         (Archive::no_export): New method.
10087         (Archive::no_export_): New field.
10088         * object.h (Object::Object): Initialize no_export_ to false.
10089         (Object::no_export, Object::set_no_export): New methods.
10090         (Object::no_export_): New field.
10091         * options.cc (General_options::parse_exclude_libs): New method.
10092         (General_options::check_excluded_libs) Same.
10093         * options.h (exclude_libs): New option.
10094         (General_options::check_excluded_libs): New method declaration.
10095         (General_options::excluded_libs_): New field.
10096         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10097         default or protected visibility if an object has no-export flag set.
10098         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10099         (check_SCRIPTS): Add exclude_libs_test.sh.
10100         (check_DATA): Add exclude_libs_test.syms.
10101         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10102         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10103         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10104         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10105         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10106         libexclude_libs_test_2.a): New rules.
10107         * testsuite/Makefile.in: Regenerate.
10108         * testsuite/exclude_libs_test.c: New file.
10109         * testsuite/exclude_libs_test.sh: Ditto.
10110         * testsuite/exclude_libs_test_1.c: Ditto.
10111         * testsuite/exclude_libs_test_2.c: Ditto.
10112
10113 2009-05-15  Ian Lance Taylor  <iant@google.com>
10114
10115         * configure.ac: Check for declarations for cases where libiberty.h
10116         checks HAVE_DECL_xxx.
10117         * configure, config.in: Rebuild.
10118
10119 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10120
10121         * gold.h (Incremental_argument_list): Remove (invalid) forward
10122         declaration.
10123         * incremental.cc (Incremental_inputs::report_achive): New method.
10124         (Incremental_inputs::report_object): New method.
10125         (Incremental_inputs::report_script): New method.
10126         (Incremental_inputs::finalize_inputs): New method.
10127         (Incremental_inputs::finalize): Call finalize_inputs().
10128         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10129         Create inputs entries.
10130         * incremental.h (Incremental_input_type): New enum.
10131         (Incremental_inputs::Incremental_input): Initialize new fields.
10132         (Incremental_inputs::report_inputs): New method.
10133         (Incremental_inputs::report_achive): New method.
10134         (Incremental_inputs::report_object): New method.
10135         (Incremental_inputs::report_script): New method.
10136         (Incremental_inputs::finalize_inputs): New method.
10137         (Incremental_inputs::Input_info): New struct.
10138         (Incremental_inputs::Input_info_map): New typedef.
10139         (Incremental_inputs::lock_): New field.
10140         (Incremental_inputs::Inputs_): New field.
10141         (Incremental_inputs::Inputs_map): New field.
10142         * main.cc (main): Call Incremental_input::report_inputs.
10143         * options.h (Input_argument_list): Typedef moved from
10144         Input_arguments.
10145         (Input_file_group::Files): Remove, use ::Input_argument_list.
10146         (Input_file_group::Input_argument_list): Remove, use
10147         ::Input_argument_list.
10148         * plugin.cc (Plugin_manager::add_input_file): Add error in
10149         incremental build.
10150         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10151         functions.
10152         * script.cc (read_input_script): Call
10153         Incremental_input::report_script.
10154         * script.h (Script_info): New class.
10155
10156 2009-04-27  Ian Lance Taylor  <iant@google.com>
10157
10158         * x86_64.cc (do_adjust_output_section): Set entsize to
10159         plt_entry_size.
10160
10161 2009-04-23  Elliott Hughes  <enh@google.com>
10162
10163         * output.cc (Output_file::close): After short writes, continue
10164         writing from the correct offset in the buffer being written.
10165
10166 2009-04-23  Chris Demetriou  <cgd@google.com>
10167
10168         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10169         * configure: Regenerate.
10170         * config.in: Regenerate.
10171         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10172         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10173
10174 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10175
10176         * incremental.cc (Incremental_inputs_header_data): Renamed from
10177         Incremental_input_header_data.
10178         (Incremental_inputs_header_data::data_size): New field.
10179         (Incremental_inputs_header_data::put_input_file_count): Renamed
10180         from input_file_count.
10181         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10182         from command_line_offset.
10183         (Incremental_inputs_header_data::put_reserved): Renamed from
10184         put_reserved.
10185         (Incremental_inputs_entry_data): Renamed from
10186         Incremental_input_entry_data.
10187         (Incremental_inputs_entry_data::data_size): New field.
10188         (Incremental_inputs::report_command_line): New method.
10189         (Incremental_inputs::finalize): New method.
10190         (Incremental_inputs::create_incremental_inputs_data): New method.
10191         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10192         * incremental.h: New file.
10193         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10194        (Layout::finalize): Create incremental inputs section in
10195         incremental builds.
10196        (Layout::create_incremental_info_sections): New method.
10197         * layout.h (Layout::incremental_inputs): New method.
10198        (Layout::create_incremental_info_sections): New method.
10199        (Layout::incremental_inputs_): New field.
10200         * main.cc (main): Notify Incremental_input of the command line.
10201
10202 2009-04-01  Ian Lance Taylor  <iant@google.com>
10203             Mikolaj Zalewski  <mikolajz@google.com>
10204
10205         * gold.h (reserve_unordered_map): Define, three versions, one for
10206         each version of Unordered_map.
10207         * layout.cc (Layout::Layout): Remove options parameter.  Add
10208         number_of_input_files parameter.  Don't initialize options_.
10209         Initialize number_of_input_files_ and resized_signatures_.  Move
10210         sections_are_attached_.
10211         (Layout::layout_group): Reserve space for group_signatures_.
10212         (Layout::find_or_add_kept_section): Change name parameter to be a
10213         reference.  Resize signatures_ map when it gets large enough.
10214         (Layout::layout_eh_frame): Use parameters->options() instead of
10215         this->options_.
10216         (Layout::make_output_section): Likewise.
10217         (Layout::attach_allocated_section_to_segment): Likewise.
10218         (Layout::finalize, Layout::create_executable_stack): Likewise.
10219         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10220         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10221         * layout.h (class Layout): Update declarations.  Remove options_
10222         field.  Add number_of_input_files_ and resized_signatures_
10223         fields.  Move sections_are_attached_ field.
10224         * main.cc (main): Pass number of input files to Layout
10225         constructor.  Don't pass options.
10226
10227 2009-03-30  Ian Lance Taylor  <iant@google.com>
10228
10229         * ffsll.c (ffsll): Correct implementation.
10230
10231 2009-03-27  Ian Lance Taylor  <iant@google.com>
10232
10233         * ffsll.c: New file.
10234         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10235         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10236         * ftruncate.c (ftruncate): Declare before definition.
10237         * mremap.c (mremap): Likewise.
10238         * pread.c (pread): Likewise.
10239         * configure, Makefile.in, config.in: Rebuild.
10240
10241         * mremap.c: New file.
10242         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10243         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10244         (mremap): Declare if HAVE_MREMAP is not defined.
10245         * configure, Makefile.in, config.in: Rebuild.
10246
10247 2009-03-27  Cary Coutant  <ccoutant@google.com>
10248
10249         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10250         position independent.
10251         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10252         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10253
10254 2009-03-24  Cary Coutant  <ccoutant@google.com>
10255
10256         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10257         an executable.
10258         (needs_dynamic_reloc): Likewise.
10259
10260 2009-03-24  Ian Lance Taylor  <iant@google.com>
10261
10262         * yyscript.y (file_cmd): Recognize EXTERN.
10263         (extern_name_list, extern_name_list_body): New nonterminals.
10264         * script.cc (script_add_extern): Define.
10265         * script-c.h (script_add_extern): Declare.
10266
10267 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10268
10269         * object.cc (is_elf_object): Define.
10270         * object.h (is_elf_object): Declare.
10271         * archive.cc (Archive::get_elf_object_for_member): Call
10272         is_elf_object.
10273         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10274
10275 2009-03-24  Elliott Hughes  <enh@google.com>
10276
10277         * output.cc (Output_file::map_anonymous): Define.
10278         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10279         try an anonymous one.  Report the size if the mmap fails.
10280         * output.h (class Output_file): Declare map_anonymous.
10281
10282 2009-03-24  Ian Lance Taylor  <iant@google.com>
10283
10284         * target-select.cc (instantiate_target): Don't acquire the lock if
10285         the instantiated_target_ field has already been set.
10286
10287 2009-03-23  Ian Lance Taylor  <iant@google.com>
10288
10289         * gold-threads.h (class Initialize_lock): Define.
10290         * gold-threads.cc (class Initialize_lock_once): Define.
10291         (initialize_lock_control): New static variable.
10292         (initialize_lock_pointer): New static variable.
10293         (initialize_lock_once): New static function.
10294         (Initialize_lock::Initialize_lock): Define.
10295         (Initialize_lock::initialize): Define.
10296         * target-select.h: Include "gold-threads.h".
10297         (class Target_selector): Add lock_ and initialize_lock_ fields.
10298         Don't define instantiate_target, just declare it.
10299         * target-select.cc (Target_selector::Target_selector): Initialize
10300         new fields.
10301         (Target_selector::instantiate_target): Define.
10302         * descriptors.h: Include "gold-threads.h".
10303         (class Descriptors): Add initialize_lock_ field.
10304         * descriptors.cc (Descriptors::Descriptors): Initialize new
10305         field.
10306         (Descriptors::open): Use initialize_lock_ field
10307         * errors.h (class Errors): Add initialize_lock_ field.
10308         * errors.cc (Errors::Errors): Initialize new field.
10309         (Errors::initialize_lock): Use initialize_lock_ field.
10310         * powerpc.cc (class Target_selector_powerpc): Remove
10311         instantiated_target_ field.  In do_recognize call
10312         instantiate_target rather than do_instantiate_target.  In
10313         do_instantiate_target just allocate a new target.
10314         * sparc.cc (class Target_selector_sparc): Likewise.
10315
10316         * freebsd.h: New file.
10317         * i386.cc: Include "freebsd.h".
10318         (Target_i386): Derive from Target_freebsd rather than
10319         Sized_target.
10320         (Target_selector_i386): Derive from Target_selector_freebsd rather
10321         than Target_selector.
10322         * x86_64.cc: Include "freebsd.h".
10323         (Target_x86_64): Derive from Target_freebsd rather than
10324         Sized_target.
10325         (Target_selector_x86_64): Derive from Target_selector_freebsd
10326         rather than Target_selector.
10327         * target.h (class Target): Add adjust_elf_header and
10328         do_adjust_elf_header.
10329         * output.cc (Output_file_header:: do_sized_write): Call target
10330         adjust_elf_header routine.
10331         * configure.tgt: Set targ_osabi.
10332         * configure.ac: Define GOLD_DEFAULT_OSABI.
10333         * parameters.cc (Parameters::default_target): Pass
10334         GOLD_DEFAULT_OSABI to select_target.
10335         * target-select.h (class Target_selector): Make instantiate_target
10336         protected rather than private.
10337         * Makefile.am (HFILES): Add freebsd.h.
10338         * configure, Makefile.in, config.in: Rebuild.
10339
10340         * merge.cc (do_add_input_section): Correct pend value.  Change
10341         message about last entry not being null terminated from error to
10342         warning.
10343
10344 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10345
10346         * incremental.cc: New file.
10347         * Makefile.am (CCFILES): Add incremental.cc.
10348         * Makefile.in: Rebuild.
10349
10350 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10351
10352         * layout.cc (Layout::output_section_name): Preserve names
10353         of '.note.' sections.
10354
10355 2009-03-19  Ian Lance Taylor  <iant@google.com>
10356
10357         * descriptors.cc (Descriptors::open): Check that the options are
10358         valid before using them.
10359
10360 2009-03-18  Ian Lance Taylor  <iant@google.com>
10361
10362         * script-sections.h: Include <list>.
10363         (class Script_sections): Change Sections_elements from std::vector
10364         to std::list.  Typedef public Elements_iterator.  Add
10365         orphan_section_placement_, data_segment_align_start_, and
10366         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10367         field.
10368         * script-sections.cc (class Orphan_section_placement): New class.
10369         (class Sections_element): Add virtual functions is_relro and
10370         orphan_section_init.  Remove virtual function place_orphan_here.
10371         (class Output_section_definition): Add is_relro and
10372         orphan_section_init.  Remove place_orphan_here.
10373         (class Orphan_output_section): Likewise.
10374         (Script_sections::Script_sections): Update for field changes.
10375         (Script_sections::data_segment_align): Set saw_data_segment_align_
10376         and data_segment_align_start_, not data_segment_align_index.
10377         (Script_sections::data_segment_relro_end): Check
10378         saw_data_segment_align_.  Use data_segment_align_start_ rather
10379         than data_segment_align_index_.
10380         (Script_sections::place_orphan): Rewrite to use
10381         Orphan_section_placement.
10382
10383 2009-03-17  Ian Lance Taylor  <iant@google.com>
10384
10385         * archive.cc (Archive::add_symbols): Check for a version attached
10386         to the symbol name in the archive map.
10387         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10388         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10389         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10390         (ver_test_11.a): New target.
10391         * testsuite/Makefile.in: Rebuild.
10392
10393         * configure.ac: Check for chsize and posix_fallocate.  Replace
10394         ftruncate.
10395         * ftruncate.c: New file, from gnulib.
10396         * output.cc (posix_fallocate): Define dummy version if not
10397         HAVE_POSIX_FALLOCATE.
10398         (Output_file::map): Call posix_fallocate rather than lseek and
10399         write.
10400         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10401         * configure, Makefile.in, config.in: Rebuild.
10402
10403 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10404
10405         * layout.h (Layout::create_note): Add section_name parameter.
10406         * layout.cc (Layout::create_note): Likewise.
10407         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10408
10409 2009-03-17  Ian Lance Taylor  <iant@google.com>
10410
10411         * descriptors.cc: Include "options.h".
10412         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10413         (Descriptors::open): Always use O_CLOEXEC when opening a new
10414         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10415         then set FD_CLOEXEC.
10416
10417         * sparc.cc (class Target_sparc): Add has_got_section.
10418         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10419         make sure we have a GOT section.
10420
10421         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10422         (Target_sparc::Scan::local): Likewise.
10423         (Target_sparc::Scan::global): Likewise.
10424         (Target_sparc::Relocate::relocate): Likewise.
10425         (Target_sparc::Relocate::relocate_tls): Likewise.
10426
10427         * symtab.cc (Symbol_table::define_default_version): New function,
10428         broken out of add_from_object.
10429         (Symbol_table::add_from_object): Call define_default_version.
10430         (Symbol_table::define_special_symbol): Add resolve_oldsym
10431         parameter.  Change all callers.  If the version for a symbol comes
10432         from a version script, resolve it with the symbol with the same
10433         name with no version.  Also add the symbol without a version if
10434         appropriate.
10435         (do_define_in_output_data): If resolving with oldsym, don't delete
10436         sym.
10437         (do_define_in_output_segment): Likewise.
10438         (do_define_as_constant): Likewise.
10439         * symtab.h (class Symbol_table): Update declarations.
10440
10441 2009-03-13  Ian Lance Taylor  <iant@google.com>
10442
10443         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10444         (Read_symbols::requeue): New function.
10445         (Read_symbols::do_read_symbols): If make_elf_object fails because
10446         the target type is not configured, and the file was searched for,
10447         issue a warning and retry with the next directory.
10448         (Add_symbols::run): If the file has an incompatible format, and
10449         it was searched for, requeue the Read_symbols task.  On error,
10450         release the object.
10451         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10452         dirindex parameter to constructor.  Change all callers.  Declare
10453         incompatible_warning and requeue.
10454         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10455         input_argument_ and input_group_ fields.  Add them to
10456         constructor.  Change all callers.
10457         (class Read_script): Add dirindex_ field.  Add it to constructor.
10458         Change all callers.
10459         * archive.cc (Archive::setup): Remove input_objects parameter.
10460         Change all callers.
10461         (Archive::get_file_and_offset): Likewise.
10462         (Archive::read_all_symbols): Likewise.
10463         (Archive::read_symbols): Likewise.
10464         (Archive::get_elf_object_for_member): Remove input_objects
10465         parameter.  Add punconfigured parameter.  Change all callers.
10466         (Archive::add_symbols): Change return type to bool.  Check return
10467         value of include_member.
10468         (Archive::include_all_members): Likewise.
10469         (Archive::include_member): Change return type to bool.  Return
10470         false if first included object has incompatible target.  Set
10471         included_member_ field.
10472         (Add_archive_symbols::run): If add_symbols returns false, requeue
10473         Read_symbols task.
10474         * archive.h (class Archive): Add included_member_ field.
10475         Initialize it in constructor.  Add input_file and searched_for
10476         methods.  Update declarations.
10477         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10478         input_argument_ fields.  Add them to constructor.  Change all
10479         callers.
10480         * script.cc: Include "target-select.h".
10481         (class Parser_closure): Add skip_on_incompatible_target_ and
10482         found_incompatible_target_ fields.  Add
10483         skip_on_incompatible_target parameter to constructor.  Change all
10484         callers.  Add methods skip_on_incompatible_target,
10485         clear_skip_on_incompatible_target, found_incompatible_target, and
10486         set_found_incompatible_target.
10487         (read_input_script): Add dirindex parameter.  Change all callers.
10488         If parser finds an incompatible target, requeue Read_symbols
10489         task.
10490         (script_set_symbol): Clear skip_on_incompatible_target in
10491         closure.
10492         (script_add_assertion, script_parse_option): Likewise.
10493         (script_start_sections, script_add_phdr): Likewise.
10494         (script_check_output_format): New function.
10495         * script.h (read_input_script): Update declaration.
10496         * script-c.h (script_check_output_format): Declare.
10497         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10498         (ignore_cmd): Remove OUTPUT_FORMAT.
10499         * fileread.cc (Input_file::Input_file): Add explicit this.
10500         (Input_file::will_search_for): New function.
10501         (Input_file::open): Add pindex parameter.  Change all callers.
10502         * fileread.h (class Input_file): Add input_file_argument method.
10503         Declare will_search_for.  Update declarations.
10504         * object.cc (make_elf_object): Add punconfigured parameter.
10505         Change all callers.
10506         * object.h (class Object): Make input_file public.  Add
10507         searched_for method.
10508         (make_elf_object): Update declaration.
10509         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10510         restart search.
10511         * dirsearch.h (class Dirsearch): Update declaration.
10512         * options.h (class General_options): Add --warn-search-mismatch.
10513         * parameters.cc (Parameters::is_compatible_target): New function.
10514         * parameters.h (class Parameters): Declare is_compatible_target.
10515         * workqueue.cc (Workqueue::add_blocker): New function.
10516         * workqueue.h (class Workqueue): Declare add_blocker.
10517
10518         * fileread.cc (Input_file::open): Remove options parameter.
10519         Change all callers.
10520         (Input_file::open_binary): Likewise.
10521         * script.cc (read_input_script): Likewise.
10522         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10523         options parameter from constructor.  Change all callers.
10524         (class Read_script): Likewise.
10525         * fileread.h (class Input_file): Update declarations.
10526         * script.h (read_input_script): Update declaration.
10527
10528 2009-03-10  Nick Clifton  <nickc@redhat.com>
10529
10530         * po/es.po: New Spanish translation.
10531
10532 2009-03-06  Cary Coutant  <ccoutant@google.com>
10533
10534         * options.cc (parse_short_option): Keep dash_z from registering itself.
10535
10536 2009-03-03  Ian Lance Taylor  <iant@google.com>
10537
10538         PR 9918
10539         * target-reloc.h (relocate_section): Pass output_section to
10540         relocate.
10541         * i386.cc (Target_i386::should_apply_static_reloc): Add
10542         output_section parameter.  Change all callers.
10543         (Target_i386::Relocate::relocate): Add output_section parameter.
10544         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10545         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10546         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10547         * testsuite/two_file_shared.sh: New script.
10548         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10549         (check_DATA): Add two_file_shared.dbg.
10550         (two_file_shared.dbg): New target.
10551         * testsuite/Makefile.in: Rebuild.
10552
10553 2009-03-01  Ian Lance Taylor  <iant@google.com>
10554
10555         * configure.ac: Check for byteswap.h.
10556         * configure: Rebuild.
10557         * config.in: Rebuild.
10558
10559 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10560
10561         * layout.cc (Layout::find_or_add_kept_section): New function.
10562         (Layout::add_comdat): Removed.
10563         * layout.h (struct Kept_section): Move out of class Layout.
10564         Remove trailing underscores from field names.  Add group_sections
10565         field.  Rename group_ field to is_group.  Change all uses.
10566         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10567         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10568         comdat_groups_ field.
10569         (Sized_relobj::include_section_group): Use
10570         find_or_add_kept_section and Kept_section::group_sections.
10571         (Sized_relobj::include_linkonce_section): Likewise.
10572         * object.cc (class Sized_relobj): Don't define Comdat_group or
10573         Comdat_group_table.  Remove find_comdat_group and
10574         add_comdat_group.  Remove comdat_groups_ field.
10575         * plugin.cc (include_comdat_group): Use
10576         Layout::find_or_add_kept_section.
10577
10578 2009-02-28  Ian Lance Taylor  <iant@google.com>
10579
10580         * README: --gc-sections and map files are now supported.  Document
10581         some build requirements.
10582
10583         PR 6992
10584         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10585         relocatable link set the value of the section symbol to zero.
10586         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10587         relocatable link don't include the section address in the local
10588         symbol value.
10589
10590 2009-02-27  Ian Lance Taylor  <iant@google.com>
10591
10592         PR 6811
10593         * options.h (class Search_directory): Add is_system_directory.
10594         (class General_options): Declare is_in_system_directory.
10595         * options.cc (get_relative_sysroot): Make static.
10596         (get_default_sysroot): Make static.
10597         (General_optoins::is_in_system_directory): New function.
10598         * fileread.cc (Input_file::is_in_system_directory): New function.
10599         * fileread.h (class Input_file): Declare is_in_system_directory.
10600         * object.h (class Object): Add is_in_system_directory.
10601         (class Input_objects): Remove system_library_directory_ field.
10602         * object.cc (Input_objects::add_object): Don't set
10603         system_library_directory_.
10604         (input_objects::found_in_system_library_directory): Remove.
10605         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10606         parameter.  Change all callers.
10607         (Symbol_table::sized_write_globals): Likewise.
10608         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10609         Call Object::is_in_system_directory.
10610         * symtab.h (class Symbol_table): Update declarations.
10611
10612         PR 5990
10613         * descriptors.h (Open_descriptor): Add is_on_stack field.
10614         * descriptors.cc (Descriptors::open): If the descriptor is on the
10615         top of the stack, remove it.  Initialize is_on_stack field.
10616         (Descriptors::release): Only add pod to stack if it is not on the
10617         stack already.
10618         (Descriptors::close_some_descriptor): Clear stack_next and
10619         is_on_stack fields.
10620
10621         PR 7091
10622         * output.cc (Output_section::find_starting_output_address): Rename
10623         from starting_output_address; add PADDR parameter; change return
10624         type.
10625         * output.h (class Output_section): Declare
10626         find_starting_output_address instead of starting_output_address.
10627         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10628         section symbol for which we can't find a merge section.
10629
10630         PR 9836
10631         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10632         hidden or internal, force the symbol to be local.
10633         * resolve.cc (Symbol::override_visibility): Define.
10634         (Symbol::override_base): Use override_visibility.
10635         (Symbol_table::resolve): Likewise.
10636         (Symbol::override_base_with_special): Likewise.
10637         (Symbol_table::override_with_special): If the visibility is hidden
10638         or internal, force the symbol to be local.
10639         * symtab.h (class Symbol): Add set_visibility and
10640         override_visibility.
10641         * testsuite/ver_test_1.sh: New file.
10642         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10643         (check_DATA): Add ver_test_1.syms.
10644         (ver_test_1.syms): New target.
10645         * testsuite/Makefile.in: Rebuild.
10646
10647 2009-02-25  Cary Coutant  <ccoutant@google.com>
10648
10649         * layout.cc (Layout::choose_output_section): Don't rename sections
10650         when using a linker script that has a SECTIONS clause.
10651         * Makefile.in: Regenerate.
10652
10653         * testsuite/Makefile.am (script_test_5.sh): New test case.
10654         * testsuite/Makefile.in: Regenerate.
10655         * testsuite/script_test_5.cc: New file.
10656         * testsuite/script_test_5.sh: New file.
10657         * testsuite/script_test_5.t: New file.
10658
10659 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10660
10661         * archive.cc (Archive::include_member): Update calls to add_symbols.
10662         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10663         the Layout argument.
10664         * dynobj.h (do_add_symbols): Add the Layout argument.
10665         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10666         Layout argument.
10667         * object.h (Object::add_symbols): Add the Layout argument.
10668         (Object::do_add_symbols): Add the Layout argument.
10669         (Sized_relobj::do_add_symbols): Add the Layout argument.
10670         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10671         Unify the two versions.
10672         (Add_plugin_symbols): Remove.
10673         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10674         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10675         (Add_plugin_symbols): Remove.
10676         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10677         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10678         (Add_symbols::run): Make it work with Pulginobj.
10679
10680 2009-02-06  Ian Lance Taylor  <iant@google.com>
10681
10682         * object.cc (Sized_relobj::do_layout): Make info message start
10683         with lower case letter.
10684
10685 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10686
10687         * binary.cc: Fix file comment.
10688
10689         * options.h (enum Incremental_disposition): Define.
10690         (class General_options): Add new options: --incremental,
10691         --incremental_changed, --incremental_unchanged,
10692         --incremental_unknown.  Add incremental_disposition_ and
10693         implicit_incremental_ fields.
10694         (General_options::incremental_disposition): New function.
10695         (class Position_dependent_options): Add incremental_disposition
10696         option.
10697         (Position_dependent_options::copy_from_options): Set incremental
10698         dispositions.
10699         * options.cc (General_options::parse_incremental_changed): New
10700         function.
10701         (General_options::parse_incremental_unchanged): New function.
10702         (General_options::parse_incremental_unknown): New function.
10703         (General_options::General_options): Initialize new fields
10704         incremental_disposition_ and implicit_incremental_.
10705         (General_options::finalize): Check for uasge of --incremental-*
10706         without --incremental.
10707
10708 2009-02-06  Chris Demetriou  <cgd@google.com>
10709
10710         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10711         pointer and to report location as the file name associated with
10712         the symbol.
10713         (gold_undefined_symbol_at_location): New function to replace the
10714         old gold_undefined_symbol functionality.
10715         * target-reloc.h (relocate_section): Update to use
10716         gold_undefined_symbol_at_location.
10717         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10718         Call gold_undefined_symbol function rather than gold_error.
10719         * errors.h (Errors::undefined_symbol): Take location as a
10720         string, rather than calculating it from a relocation.
10721         * errors.cc (Errors::fatal): Print "fatal error:" before the
10722         formatted message.
10723         (Errors::error, Errors::error_at_location): Print "error: "
10724         before the formatted message.
10725         (Errors::undefined_symbol): Take location as a string, rather
10726         than calculating it from a relocation.
10727         (gold_undefined_symbol_at_location): New function akin to
10728         old gold_undefined_symbol, calculates location from relocation.
10729         (gold_undefined_symbol): Change to take only a Symbol pointer
10730         and to report location as the file name associated with the symbol.
10731         * testsuite/debug_msg.sh: Update for changed error messages.
10732         * testsuite/undef_symbol.sh: Likewise.
10733
10734 2009-02-04  Duncan Sands  <baldrick@free.fr>
10735
10736         PR 9812
10737         * reduced_debug_output.h
10738         (Output_reduced_debug_abbrev_section::failed): Use format for
10739         gold_warning.
10740         (Output_reduced_debug_info_section::faild): Likewise.
10741
10742 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10743
10744         * script.cc (Lazy_demangler): New class.
10745         (Version_script_info::get_symbol_version_helper): Demangle a
10746         symbol only once.
10747
10748 2009-01-29  Cary Coutant  <ccoutant@google.com>
10749
10750         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10751         to __tls_get_addr.
10752         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10753
10754 2009-01-28  Ian Lance Taylor  <iant@google.com>
10755
10756         * version.cc (version_string): Bump to 1.9.
10757
10758         * gold.h: Include <cstring> and <stdint.h>.
10759         * version.cc: Include <cstdio>.
10760         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10761         warning.
10762         * reduced_debug_output.cc (insert_into_vector): Rename from
10763         Insert_into_vector; change all callers.  Use Swap_unaligned to
10764         avoid aliasing issue; remove union since it is unnecessary.
10765
10766 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10767
10768         * Makefile.am (CCFILES): Add gc.cc.
10769         (HFILES): Add gc.h.
10770         * Makefile.in: Regenerate.
10771         * gold.cc (Gc_runner): New class.
10772         (queue_initial_tasks): Call garbage collection related tasks
10773         when corresponding options are invoked.
10774         (queue_middle_gc_tasks): New function.
10775         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10776         processed early before laying out sections during garbage collection.
10777         * gold.h (queue_middle_gc_tasks): New function.
10778         (is_prefix_of): Move from "layout.cc".
10779         * i386.cc (Target_i386::gc_process_relocs): New function.
10780         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10781         * main.cc (main): Create object of class "Garbage_collection".
10782         * object.cc (Relobj::copy_symbols_data): New function.
10783         (Relobj::is_section_name_included): New function.
10784         (Sized_relobj::do_layout): Allow this function to be called twice
10785         during garbage collection and defer layout of section during the
10786         first call.
10787         * object.h (Relobj::get_symbols_data): New function.
10788         (Relobj::is_section_name_included): New function.
10789         (Relobj::copy_symbols_data): New function.
10790         (Relobj::set_symbols_data): New function.
10791         (Relobj::get_relocs_data): New function.
10792         (Relobj::set_relocs_data): New function.
10793         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10794         (Relobj::gc_process_relocs): New function.
10795         (Relobj::do_gc_process_relocs): New pure virtual function.
10796         (Relobj::sd_): New data member.
10797         (Sized_relobj::is_output_section_offset_invalid): New function.
10798         (Sized_relobj::do_gc_process_relocs): New function.
10799         * options.h (General_options::gc_sections): Modify to not be a no-op.
10800         (General_options::print_gc_sections): New option.
10801         * plugin.cc (Plugin_finish::run): Remove function call to
10802         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10803         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10804         * reloc.cc (Read_relocs::run): Add task to process relocs and
10805         determine unreferenced sections when doing garbage collection.
10806         (Gc_process_relocs): New class.
10807         (Sized_relobj::do_gc_process_relocs): New function.
10808         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10809         sections that are garbage collected.
10810         * reloc.h (Gc_process_relocs): New class.
10811         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10812         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10813         symbols whose corresponding sections are garbage collected.
10814         (Symbol_table::Symbol_table): Add new parameter for the garbage
10815         collection object.
10816         (Symbol_table::gc_mark_undef_symbols): New function.
10817         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10818         (Symbol_table::gc_mark_dyn_syms): New function.
10819         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10820         as garbage.
10821         (Symbol_table::add_from_object): Likewise.
10822         (Symbol_table::add_from_relobj): When building shared objects, do not
10823         treat externally visible symbols as garbage.
10824         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10825         table information for static and relocatable links.
10826         * symtab.h (Symbol_table::set_gc): New function.
10827         (Symbol_table::gc): New function.
10828         (Symbol_table::gc_mark_undef_symbols): New function.
10829         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10830         (Symbol_table::gc_mark_dyn_syms): New function.
10831         (Symbol_table::gc_): New data member.
10832         * target.h (Sized_target::gc_process_relocs): New pure virtual
10833         function.
10834         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10835         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10836
10837 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10838
10839         * options.h (General_options::gc_sections): Define as a no-op for now.
10840         (General_options::no_keep_memory): Ditto.
10841         (General_options::Bshareable): Define.
10842         * options.cc (General_options::finalize): Honor -Bshareable.
10843
10844 2009-01-20  Andreas Schwab  <schwab@suse.de>
10845
10846         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10847         read the value in the contents, since we don't use it.  Use the
10848         template endianness when writing.
10849         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10850
10851 2009-01-19  Andreas Schwab  <schwab@suse.de>
10852
10853         * configure.tgt (powerpc64-*): Fix targ_obj.
10854
10855 2009-01-15  Ian Lance Taylor  <iant@google.com>
10856
10857         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10858         local symbols when stripping all symbols.
10859
10860 2009-01-14  Cary Coutant  <ccoutant@google.com>
10861
10862         * output.cc (Output_reloc): Add explicit instantiations.
10863
10864 2009-01-14  Cary Coutant  <ccoutant@google.com>
10865
10866         * archive.cc (Archive::get_elf_object_for_member): Remove call
10867         to File_read::claim_for_plugin.
10868         * descriptors.cc (Descriptors::open): Remove reference to
10869         is_claimed.
10870         (Descriptors::claim_for_plugin): Remove.
10871         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10872         (Descriptors::is_claimed): Remove.
10873         (claim_descriptor_for_plugin): Remove.
10874         * fileread.cc (File_read::claim_for_plugin): Remove.
10875         * fileread.h (File_read::claim_for_plugin): Remove.
10876         (File_read::descriptor): Reopen descriptor if necessary.
10877         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10878         (Plugin_manager::all_symbols_read): Add task parameter. Change
10879         all callers.
10880         (Plugin_manager::get_input_file): New function.
10881         (Plugin_manager::release_input_file): New function.
10882         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10883         corresponding data member.
10884         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10885         and pass to base constructor. Change all callers.
10886         (get_input_file, release_input_file): New functions.
10887         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10888         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10889         (Plugin_manager::all_symbols_read): Add task parameter.
10890         (Plugin_manager::get_input_file): New function.
10891         (Plugin_manager::release_input_file): New function.
10892         (Plugin_manager::task_): New data member.
10893         (Pluginobj::Pluginobj): Add filesize parameter.
10894         (Pluginobj::filename): New function.
10895         (Pluginobj::descriptor): New function.
10896         (Pluginobj::filesize): New function.
10897         (Pluginobj::filesize_): New data member.
10898         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10899         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10900         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10901
10902         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10903         with archive libraries.
10904         * testsuite/Makefile.in: Regenerate.
10905         * testsuite/plugin_test.c (struct sym_info): New type.
10906         (get_input_file, release_input_file): New static variables.
10907         (onload): Capture new transfer vector entries.
10908         (claim_file_hook): Stop reading at end of file according to filesize.
10909         Factor out parsing of readelf output into separate function.
10910         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10911         APIs and get the source file name from the symbol table.  Convert
10912         source file name to corresponding object file name.  Print info
10913         message when adding new input files.
10914         (parse_readelf_line): New function.
10915         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10916         * testsuite/plugin_test_2.sh: Likewise.
10917         * testsuite/plugin_test_3.sh: Likewise.
10918         * testsuite/plugin_test_4.sh: New test case.
10919
10920 2009-01-07  Ian Lance Taylor  <iant@google.com>
10921
10922         * version.cc (version_string): Bump to 1.8.
10923
10924 2008-12-23  Cary Coutant  <ccoutant@google.com>
10925
10926         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10927         * plugin.cc (Plugin_manager::finish): Rename as
10928         layout_deferred_objects.  Move cleanup to separate function.
10929         (Plugin_manager::cleanup): New function.
10930         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10931         separately.
10932         * plugin.h (Plugin_manager::finish): Rename as
10933         layout_deferred_objects.
10934         (Plugin_manager::cleanup): New function.
10935         (Plugin_manager::cleanup_done): New field.
10936
10937 2008-12-23  Cary Coutant  <ccoutant@google.com>
10938
10939         * plugin.cc (is_visible_from_outside): New function.
10940         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10941         so we don't return "IR only" status for exported symbols or -r links.
10942
10943         * testsuite/Makefile.am (plugin_test_3): New test case.
10944         * testsuite/Makefile.in: Regenerate.
10945         * testsuite/plugin_test_3.sh: New file.
10946
10947 2008-12-22  Cary Coutant  <ccoutant@google.com>
10948
10949         * object.cc (Sized_relobj::layout_section): New function.
10950         (Sized_relobj::do_layout): Defer layout of input sections until after
10951         plugin has provided replacement files.
10952         (Sized_relobj::do_layout_deferred_sections): New function.
10953         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10954         (Relobj::layout_deferred_sections): New function.
10955         (Relobj::do_layout_deferred_sections): New function.
10956         (Sized_relobj::do_layout_deferred_sections): New function.
10957         (Sized_relobj::layout_section): New function.
10958         (Sized_relobj::Deferred_layout): New structure.
10959         (Sized_relobj::deferred_layout_): New field.
10960         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10961         Change all callers.  Layout deferred sections.
10962         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10963         references.
10964         (Plugin_hook::run): Move code from do_plugin_hook inline.
10965         (Plugin_hook::do_plugin_hook): Remove.
10966         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10967         (Plugin_manager::finish): Renamed, was cleanup.
10968         (Plugin_manager::should_defer_layout): New function.
10969         (Plugin_manager::add_deferred_layout_object): New function.
10970         (Plugin_manager::Deferred_layout_list): New type.
10971         (Plugin_manager::deferred_layout_objects_): New field.
10972         (Plugin_hook::do_plugin_hook): Remove.
10973
10974 2008-12-17  Ian Lance Taylor  <iant@google.com>
10975
10976         * options.h (class General_options): Add --no case for
10977         --export-dynamic.
10978
10979 2008-12-16  Cary Coutant  <ccoutant@google.com>
10980
10981         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10982         vector.
10983         (Plugin_manager::claim_file): Create plugin object even if
10984         plugin did not call the add_symbols callback.
10985         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10986         asking for more symbols than were added.
10987         * testsuite/Makefile.am (plugin_test_1): Add test case with
10988         no global symbols.
10989         (empty.syms): New target.
10990         * testsuite/Makefile.in: Regenerate.
10991         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10992         message. Don't call add_symbols if no globals.
10993         (all_symbols_read_hook): Don't provide replacement for empty
10994         claimed file.
10995
10996 2008-12-12  Ian Lance Taylor  <iant@google.com>
10997
10998         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10999         r_type == 0 for a local symbol with r_sym == 0.
11000         (scan_relocatable_relocs): Pass r_sym to
11001         local_non_section_strategy.
11002         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11003         r_sym parameter.
11004
11005         * configure.ac: Update test for TLS descriptors: they are
11006         supported as of glibc 2.9.
11007         * configure: Rebuild.
11008
11009 2008-12-11  Ian Lance Taylor  <iant@google.com>
11010
11011         PR 7091
11012         * target-reloc.h (Default_scan_relocatable_relocs): For each
11013         function, map r_type == 0 to RELOC_DISCARD.
11014
11015 2008-12-10  Cary Coutant  <ccoutant@google.com>
11016
11017         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11018         object to override a kept COMDAT group from a plugin object.
11019
11020 2008-12-09  Ian Lance Taylor  <iant@google.com>
11021
11022         PR 7088
11023         * yyscript.y (file_cmd): Handle INPUT.
11024
11025         * testsuite/initpri1.c: Change all declarations to be full
11026         prototypes by adding void, to avoid compiler warnings.
11027
11028 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11029
11030         * options.cc (General_options::parse_plugin_opt): New.
11031         (General_options::add_plugin): The argument now is just the filename.
11032         (General_options::add_plugin_option): New.
11033         * options.h (plugin_opt): New.
11034         (add_plugin): Change argument name.
11035         (add_plugin_option): New.
11036         * plugin.cc (Plugin::load): Don't parse the plugin option.
11037         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11038         (Plugin::add_option): New.
11039         (Plugin::args_): Change type.
11040         (Plugin::filename_): New.
11041         (Plugin_manager::add_plugin_option): New.
11042         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11043         * testsuite/Makefile.in: Regenerate.
11044
11045 2008-12-05  Cary Coutant  <ccoutant@google.com>
11046
11047         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11048         Handle --strip-lto-sections option.
11049         * options.h (strip_lto_sections): New option.
11050
11051 2008-12-01  Cary Coutant  <ccoutant@google.com>
11052
11053         * plugin.cc (ld_plugin_message): Change format parameter to const.
11054         Fix mismatch between new[] and delete.
11055
11056 2008-11-14  Cary Coutant  <ccoutant@google.com>
11057
11058         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11059         instead of -1U.
11060
11061 2008-11-05  Craig Silverstein  <csilvers@google.com>
11062
11063         * options.cc (General_options::parse_dynamic_list): New function.
11064         * options.h (General_options): New flags dynamic_list,
11065         dynamic_list_data, dynamic_list_cpp_new, and
11066         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11067         (General_options::in_dynamic_list): New function.
11068         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11069         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11070         (Lex::can_continue_name): Likewise.
11071         (yylex): Likewise.
11072         (read_script_file): New parameter script_options.
11073         (read_dynamic_list): New function.
11074         (Script_options::define_dynamic_list): New function.
11075         (dynamic_list_keyword_parsecodes): New variable.
11076         (dynamic_list_keywords): New variable.
11077         * script.h (Script_options::define_dynamic_list): New function
11078         prototype.
11079         (read_dynamic_list): New function prototype.
11080         * symtab.cc (strprefix): New macro.
11081         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11082         dynamic_list_data, dynamic_list_cpp_new, and
11083         dynamic_list_cpp_typeinfo.
11084         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11085         (dynamic_list_expr): New rule.
11086         (dynamic_list_nodes): Likewise.
11087         (dynamic_list_node): Likewise.
11088         * testsuite/Makefile.am (dynamic_list): New test.
11089         * testsuite/Makefile.in: Regenerated.
11090         * testsuite/dynamic_list.t: New file.
11091         * testsuite/dynamic_list.sh: New file.
11092
11093 2008-11-05  Craig Silverstein  <csilvers@google.com>
11094
11095         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11096         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11097         (t11_last): Likewise.
11098         * testsuite/ver_test_6.c (main): Likewise.
11099
11100 2008-10-07  Cary Coutant  <ccoutant@google.com>
11101
11102         * options.c (General_options::finalize): Add check for -static and
11103         -shared.
11104         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11105         is not empty.
11106
11107 2008-10-02  Cary Coutant  <ccoutant@google.com>
11108
11109         * plugin.cc (make_sized_plugin_object): Fix conditional
11110         compilation to work when not all targets are enabled.
11111
11112 2008-09-29  Cary Coutant  <ccoutant@google.com>
11113
11114         * archive.cc (Archive::get_file_and_offset): Use filename instead
11115         of name to get library path.
11116         (Archive::include_member): Unlock external member of a thin archive.
11117
11118         * testsuite/Makefile.am (TEST_AR): New variable.
11119         (thin_archive_test_1): New test.
11120         (thin_archive_test_2): New test.
11121         * testsuite/Makefile.in: Regenerate.
11122         * testsuite/thin_archive_main.cc: New file.
11123         * testsuite/thin_archive_test_1.cc: New file.
11124         * testsuite/thin_archive_test_2.cc: New file.
11125         * testsuite/thin_archive_test_3.cc: New file.
11126         * testsuite/thin_archive_test_4.cc: New file.
11127
11128 2008-09-29  Cary Coutant  <ccoutant@google.com>
11129
11130         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11131         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11132         instead of -1U.
11133         (Sized_relobj::do_finalize_local_symbols): Likewise.
11134         (Sized_relobj::map_to_kept_section): Likewise.
11135         * object.h (Sized_relobj::invalid_address): New constant.
11136         (Sized_relobj::do_output_section_offset): Check for invalid_address
11137         and return -1ULL.
11138         * output.cc (Output_reloc::local_section_offset): Use constant
11139         invalid_address instead of -1U.
11140         (Output_reloc::get_address): Likewise.
11141         (Output_section::output_address): Change -1U to -1ULL.
11142         * output.h (Output_reloc::invalid_address): New constant.
11143         * reloc.cc (Sized_relobj::write_sections): Use constant
11144         invalid_address instead of -1U.
11145         (Sized_relobj::relocate_sections): Likewise.
11146         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11147         values for merge sections.
11148         * target-reloc.h (relocate_for_relocatable): Use constant
11149         invalid_address instead of -1U.
11150
11151 2008-09-19  Cary Coutant  <ccoutant@google.com>
11152
11153         Add plugin functionality for link-time optimization (LTO).
11154         * configure.ac (plugins): Add --enable-plugins option.
11155         * configure: Regenerate.
11156         * config.in: Regenerate.
11157         * Makefile.am (LIBDL): New variable.
11158         (CCFILES): Add plugin.cc.
11159         (HFILES): Add plugin.h.
11160         (ldadd_var): Add LIBDL.
11161         * Makefile.in: Regenerate.
11162
11163         * archive.cc: Include "plugin.h".
11164         (Archive::setup): Don't preread archive symbols when using a plugin.
11165         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11166         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11167         files.
11168         (Archive::include_member): Add symbols from plugin objects.
11169         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11170         * descriptors.cc (Descriptors::open): Check for file descriptors
11171         abandoned by plugins.
11172         (Descriptors::claim_for_plugin): New function.
11173         * descriptors.h (Descriptors::claim_for_plugin): New function.
11174         (Open_descriptor::is_claimed): New field.
11175         (claim_descriptor_for_plugin): New function.
11176         * fileread.cc (File_read::claim_for_plugin): New function.
11177         * fileread.h (File_read::claim_for_plugin): New function.
11178         (File_read::descriptor): New function.
11179         * gold.cc: Include "plugin.h".
11180         (queue_initial_tasks): Add task to call plugin hooks for generating
11181         new object files.
11182         * main.cc: Include "plugin.h".
11183         (main): Load plugin libraries.
11184         * object.h (Pluginobj): Declare.
11185         (Object::pluginobj): New function.
11186         (Object::do_pluginobj): New function.
11187         (Object::set_target): New function.
11188         * options.cc: Include "plugin.h".
11189         (General_options::parse_plugin): New function.
11190         (General_options::General_options): Initialize plugins_ field.
11191         (General_options::add_plugin): New function.
11192         * options.h (Plugin_manager): Declare.
11193         (General_options): Add --plugin option.
11194         (General_options::has_plugins): New function.
11195         (General_options::plugins): New function.
11196         (General_options::add_plugin): New function.
11197         (General_options::plugins_): New field.
11198         * plugin.cc: New file.
11199         * plugin.h: New file.
11200         * readsyms.cc: Include "plugin.h".
11201         (Read_symbols::do_read_symbols): Check for archive before checking
11202         for ELF file.  Call plugin hooks to claim files.
11203         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11204         from a real object file; force override when processing replacement
11205         files.
11206         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11207         (Symbol::init_base_object): Likewise.
11208         (Symbol::init_base_output_data): Likewise.
11209         (Symbol::init_base_output_segment): Likewise.
11210         (Symbol::init_base_constant): Likewise.
11211         (Symbol::init_base_undefined): Likewise.
11212         (Symbol::output_section): Assert that object is not a plugin.
11213         (Symbol_table::add_from_pluginobj): New function.
11214         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11215         undefined.
11216         (Symbol_table::sized_write_globals): Likewise.
11217         (Symbol_table::add_from_pluginobj): Instantiate template.
11218         * symtab.h (Sized_pluginobj): Declare.
11219         (Symbol::in_real_elf): New function.
11220         (Symbol::set_in_real_elf): New function.
11221         (Symbol::in_real_elf_): New field.
11222         (Symbol_table::add_from_pluginobj): New function.
11223
11224         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11225         (LIBDL): New variable.
11226         (LDADD): Add LIBDL.
11227         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11228         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11229         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11230         (MOSTLYCLEANFILES): Likewise.
11231         * testsuite/Makefile.in: Regenerate.
11232         * testsuite/plugin_test.c: New file.
11233         * testsuite/plugin_test_1.sh: New file.
11234         * testsuite/plugin_test_2.sh: New file.
11235
11236 2008-09-16  Ian Lance Taylor  <iant@google.com>
11237
11238         * target-reloc.h (relocate_section): Check whether a symbol is
11239         defined by the ABI before reporting an undefined symbol error.
11240         * target.h (Target::is_defined_by_abi): Make parameter const.
11241         (Target::do_is_defined_by_abi): Likewise.
11242         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11243         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11244         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11245         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11246         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11247         * testsuite/Makefile.in: Rebuild.
11248
11249         * fileread.cc (make_view): Add casts to avoid warning.
11250
11251 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11252
11253         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11254         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11255
11256 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11257
11258         * options.h (General_options::output_is_executable): New.
11259         (General_options::output_is_pie): New.
11260         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11261         for shared libraries.
11262         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11263
11264 2008-09-11  Chris Demetriou  <cgd@google.com>
11265
11266         * options.h (origin): New -z option.
11267         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11268         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11269         in DT_FLAGS_1.
11270
11271 2008-09-05  Cary Coutant  <ccoutant@google.com>
11272
11273         * fileread.cc (File_read::make_view): Add check for attempt to map
11274         beyond end of file.
11275
11276 2008-09-05  Cary Coutant  <ccoutant@google.com>
11277
11278         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11279         explicit instantiations.
11280
11281 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11282
11283         PR gold/6858
11284         * options.cc (General_options::finalize): Allow undefined symbols
11285         in shlibs if linking -shared.
11286
11287         PR gold/6859
11288         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11289         symbols as not needing a dynsym entry.
11290
11291 2008-08-20  Craig Silverstein  <csilvers@google.com>
11292
11293         * fileread.cc (File_read::open): Do not lock the file unless it
11294         was successfully opened.
11295
11296 2008-08-14  Cary Coutant  <ccoutant@google.com>
11297
11298         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11299         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11300         * testsuite/tls_test.cc (struct int128): 128-bit struct
11301         for testing TLS relocs with non-zero addend.
11302         (v12): New TLS variable.
11303         (t12): New test.
11304         (t_last): Add check for v12.
11305         * testsuite/tls_test.h (t12): New function.
11306         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11307
11308 2008-08-13  Ian Lance Taylor  <iant@google.com>
11309
11310         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11311         set tls_segment_ or relro_segment_.
11312         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11313         when appropriate.
11314         * output.h (Output_section::clear_is_relro): New function.
11315         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11316         sections specially even when output_data_ is empty.
11317         (Output_segment::maximum_alignment): When first section is relro,
11318         only force alignment for PT_LOAD segments.
11319         * script.cc (script_data_segment_align): New function.
11320         (script_data_segment_relro_end): New function.
11321         * script-c.h (script_data_segment_align): Declare.
11322         (script_data_segment_relro_end): Declare.
11323         * script-sections.h (class Script_sections): Declare
11324         data_segment_align and data_segment_relro_end.  Add fields
11325         segment_align_index_ and saw_relro_end_.
11326         * script-sections.cc (class Sections_element): Add set_is_relro
11327         virtual function.  Add new bool* parameter to place_orphan_here.
11328         Add get_output_section virtual function.
11329         (class Output_section_definition): Add set_is_relro.  Add new
11330         bool* parameter to place_orphan_here.  Add get_output_section.
11331         Add is_relro_ field.
11332         (Output_section_definition::Output_section_definition): Initialize
11333         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11334         and is_relro_ fields.
11335         (Output_section_definition::place_orphan_here): Add is_relro
11336         parameter.
11337         (Output_section_definition::set_section_addresses): Set relro for
11338         output section.
11339         (Output_section_definition::alternate_constraint): Likewise.
11340         (class Orphan_output_section): Add new bool* parameter to
11341         place_orphan_here.  Add get_output_section.
11342         (Orphan_output_section::place_orphan_here): Add is_relro
11343         parameter.
11344         (Script_sections::Script_sections): Initialize
11345         data_segment_align_index_ and saw_relro_end_.
11346         (Script_sections::data_segment_align): New function.
11347         (Script_sections::data_segment_relro_end): New function.
11348         (Script_sections::place_orphan): Set or clear is_relro.
11349         (Script_sections::set_section_addresses): Force alignment of first
11350         TLS section.
11351         * yyscript.y (exp): Call script_data_segment_align and
11352         script_data_segment_relro_end.
11353         * testsuite/relro_script_test.t: New file.
11354         * testsuite/relro_test.cc (using_script): Declare.
11355         (t1, t2): Test using_script.
11356         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11357         (relro_script_test_SOURCES): Define.
11358         (relro_script_test_DEPENDENCIES): Define.
11359         (relro_script_test_LDFLAGS): Define.
11360         (relro_script_test_LDADD): Define.
11361         (relro_script_test.so): New target.
11362         * testsuite/Makefile.in: Rebuild.
11363
11364 2008-08-06  Cary Coutant <ccoutant@google.com>
11365
11366         * archive.cc (Archive::total_archives, Archive::total_members)
11367         (Archive::total_members_loaded): New variables.
11368         (Archive::setup): Add parameter.  Add option to preread
11369         archive symbols.
11370         (Archive::read_armap): Add counter.
11371         (Archive::get_file_and_offset): New function.
11372         (Archive::get_elf_object_for_member): New function.
11373         (Archive::read_all_symbols): New function.
11374         (Archive::read_symbols): New function.
11375         (Archive::add_symbols): Add counters.
11376         (Archive::include_all_members): Use armap to find members if it's
11377         already built.
11378         (Archive::include_member): Skip reading symbols if already read.
11379         Factored code into Archive::get_file_and_offset and
11380         Archive::get_elf_object_for_member.  Changed call to
11381         Mapfile::report_include_archive_member.
11382         (Archive::print_stats): New function.
11383         * archive.h: Declare Object and Read_symbols_data classes.
11384         (Archive::Archive): Add initializers for new members.
11385         (Archive::setup): Add parameter.
11386         (Archive::print_stats): New function.
11387         (Archive::total_archives, Archive::total_members)
11388         (Archive::total_members_loaded): New variables.
11389         (Archive::get_file_and_offset): New function.
11390         (Archive::get_elf_object_for_member): New function.
11391         (Archive::read_all_symbols): New function.
11392         (Archive::read_symbols): New function.
11393         (Archive::Archive_member): New class.
11394         (Archive::members_): New member.
11395         (Archive::num_members_): New member.
11396         * main.cc: Include archive.h.
11397         (main): Call Archive::print_stats.
11398         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11399         archive parameter; member_name is now the fully-decorated name.
11400         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11401         * options.h: (General_options): Add --preread-archive-symbols option.
11402         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11403         Archive::setup.
11404
11405 2008-08-04  Ian Lance Taylor  <iant@google.com>
11406
11407         * symtab.h (Symbol::use_plt_offset): New function.
11408         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11409         * powerpc.cc (Relocate::relocate): Likewise.
11410         * sparc.cc (Relocate::relocate): Likewise.
11411         * x86_64.cc (Relocate::relocate): Likewise.
11412         * testsuite/weak_plt.sh: New test.
11413         * testsuite/weak_plt_main.cc: New test.
11414         * testsuite/weak_plt_shared.cc: New test.
11415         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11416         (check_PROGRAMS): Add weak_plt.
11417         (check_DATA): Add weak_plt_shared.so.
11418         (weak_plt_main_pic.o, weak_plt): New targets.
11419         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11420         * testsuite/Makefile.in: Rebuild.
11421
11422         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11423         gcctestdir/ld.
11424         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11425         * testsuite/Makefile.in: Rebuild.
11426
11427 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11428
11429         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11430         * Makefile.in: Regenerate.
11431         * po/POTFILES.in: Regenerate.
11432
11433 2008-07-29  Ian Lance Taylor  <iant@google.com>
11434
11435         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11436         symbols before other symbols.
11437         * testsuite/script_test_2.cc (test_addr): Declare.
11438         (test_addr_alias): Declare.
11439         (main): Check that test_addr and test_addr_alias have the right
11440         values.
11441         * testsuite/script_test_2.t: Define test_addr_alias and
11442         test_addr.
11443
11444 2008-07-24  Ian Lance Taylor  <iant@google.com>
11445
11446         PR 5990
11447         * descriptors.cc: New file.
11448         * descriptors.h: New file.
11449         * gold-threads.h (class Hold_optional_lock): New class.
11450         * fileread.cc: Include "descriptors.h".
11451         (File_read::~File_read): Release descriptor rather than closing
11452         it.
11453         (File_read::open) [file]: Call open_descriptor rather than open.
11454         Set is_descriptor_opened_.
11455         (File_read::open) [memory]: Assert that descriptor is not open.
11456         (File_read::reopen_descriptor): New function.
11457         (File_read::release): Release descriptor.
11458         (File_read::do_read): Make non-const.  Reopen descriptor.
11459         (File_read::read): Make non-const.
11460         (File_read::make_view): Reopen descriptor.
11461         (File_read::do_readv): Likewise.
11462         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11463         Update declarations.
11464         * layout.cc: Include "descriptors.h".
11465         (Layout::create_build_id): Use open_descriptor rather than open.
11466         * output.cc: Include "descriptors.h".
11467         (Output_file::open): Use open_descriptor rather than open.
11468         * archive.cc (Archive::const_iterator): Change Archive to be
11469         non-const.
11470         (Archive::begin, Archive::end): Make non-const.
11471         (Archive::count_members): Likewise.
11472         * archive.h (class Archive): Update declarations.
11473         * object.h (Object::read): Make non-const.
11474         * Makefile.am (CCFILES): Add descriptors.cc.
11475         (HFILES): Add descriptors.h.
11476         * Makefile.in: Rebuild.
11477
11478         PR 6716
11479         * gold.h: Always include <clocale>.  Add Solaris workarounds
11480         following code in binutils/sysdep.h.
11481
11482         PR 6048
11483         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11484         this->eh_frame_hdr_ is NULL before using it.
11485
11486         * dynobj.cc (Versions::Versions): Update comment.
11487
11488         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11489         the base version name.
11490
11491         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11492         array size plus one.
11493         (Stringpool_template::set_string_offsets): Subtract one from key
11494         before using it as an array index.
11495         (Stringpool_template::get_offset_with_length): Likewise.
11496         (Stringpool_template::write_to_buffer): Likewise.
11497         * stringpool.h (Stringpool_template::get_offset_from_key):
11498         Likewise.
11499
11500 2008-07-23  Ian Lance Taylor  <iant@google.com>
11501
11502         PR 6658
11503         * object.h (Merged_symbol_value::value): Do our best to handle a
11504         negative addend.
11505
11506         PR 6647
11507         * script.cc (Version_script_info::get_versions): Don't add empty
11508         version tag to return value.
11509         (Version_script_info::get_symbol_version_helper): Change return
11510         type to bool.  Add pversion parameter.  Change all callers.
11511         (script_register_vers_node): Don't require a non-NULL tag.
11512         * script.h (class Version_script_info): Update declarations.
11513         (Version_script_info::get_symbol_version): Change return type to
11514         bool.  Add version parameter.  Change all callers.
11515         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11516         handling.  Handle an empty version from a version script.
11517         (Symbol_table::define_special_symbol): Likewise.
11518         * testsuite/ver_test_10.script: New file.
11519         * testsuite/ver_test_10.sh: New file.
11520         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11521         (check_DATA): Add ver_test_10.syms.
11522         (ver_test_10.syms, ver_test_10.so): New target.
11523         * testsuite/Makefile.in: Rebuild.
11524
11525 2008-07-23  Simon Baldwin  <simonb@google.com>
11526
11527         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11528         to zero for undefined symbols from dynamic libraries.
11529
11530 2008-07-23  Ian Lance Taylor  <iant@google.com>
11531
11532         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11533         Change all callers.
11534         * symtab.h (class Symbol_table): Update declaration.
11535         * testsuite/ver_test_9.cc: New file.
11536         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11537         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11538         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11539         (ver_test_9.so, ver_test_9.o): New targets.
11540         * testsuite/Makefile.in: Rebuild.
11541
11542 2008-07-22  Ian Lance Taylor  <iant@google.com>
11543
11544         * options.h (class General_options): Define --check-sections.
11545         * layout.cc (Layout::set_segment_offsets): Handle
11546         --check-sections.
11547
11548         * options.h (class General_options): Define -n/--nmagic and
11549         -N/--omagic.
11550         * options.cc (General_options::finalize): For -n/--nmagic or
11551         -N/--omagic, set -static.
11552         * layout.cc (Layout::attach_allocated_section_to_segment): If
11553         -N/--omagic, don't put read-only and read-write sections in
11554         different segments.
11555         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11556         finding a read-only segment.
11557         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11558         don't set the minimum segment alignment to the common page size,
11559         and don't set the file offset to the address modulo the page size.
11560         * script-sections.cc (Script_sections::create_segments): If
11561         -n/--omagic, don't put read-only and read-write sections in
11562         different segments.
11563
11564         * cref.cc: New file.
11565         * cref.h: New file.
11566         * options.h (class General_options): Add --print-symbol-counts.
11567         * main.cc (main): Issue defined symbol report if requested.
11568         * archive.cc (Archive::interpret_header): Make into a const member
11569         function.
11570         (Archive::add_symbols): Call Input_objects::archive_start and
11571         archive_stop.
11572         (Archive::const_iterator): Define new class.
11573         (Archive::begin, Archive::end): New functions.
11574         (Archive::include_all_members): Rewrite to use iterator.
11575         (Archive::count_members): New function.
11576         * archive.h (class Archive): Update declarations.
11577         (Archive::filename): New function.
11578         * object.cc: Include "cref.h".
11579         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11580         (Sized_relobj::do_get_global_symbol_counts): New function.
11581         (Input_objects::add_object): Add object to cross-referencer.
11582         (Input_objects::archive_start): New function.
11583         (Input_objects::archive_stop): New function.
11584         (Input_objects::print_symbol_counts): New function.
11585         * object.h: Declare Cref and Archive.
11586         (Object::get_global_symbol_counts): New function.
11587         (Object::do_get_global_symbol_counts): New pure virtual function.
11588         (class Sized_relobj): Add defined_count_ field.  Update
11589         declarations.
11590         (class Input_objects): Add cref_ field.  Update constructor.
11591         Update declarations.
11592         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11593         defined_count_.
11594         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11595         symbol counts.
11596         (Sized_dynobj::do_get_global_symbol_counts): New function.
11597         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11598         defined_count_.  Update declarations.  Define Symbols typedef.
11599         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11600         parameter.  Change all callers.
11601         (Symbol_table::add_from_dynobj): Add sympointers and defined
11602         parameters.  Change all callers.
11603         * symtab.h (class Symbol_table): Update declarations.
11604         * Makefile.am (CCFILES): Add cref.cc.
11605         (HFILES): Add cref.h.
11606         * Makefile.in: Rebuild.
11607
11608 2008-07-22  Simon Baldwin  <simonb@google.com>
11609
11610         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11611         to zero when writing undefined symbols.
11612
11613 2008-07-22  Ian Lance Taylor  <iant@google.com>
11614
11615         * output.cc (Output_section::add_input_section): Don't try to
11616         merge empty merge sections.
11617
11618 2008-07-21  Craig Silverstein  <csilvers@google.com>
11619
11620         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11621         Include symbol version in error message.
11622
11623 2008-07-20  Chris Demetriou  <cgd@google.com>
11624
11625         * configure.ac (gold_cv_c_random_seed): New configured variable.
11626         (RANDOM_SEED_CFLAGS): New substituted variable.
11627         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11628         * configure: Rebuild.
11629         * Makefile.in: Likewise.
11630         * testsuite/Makefile.in: Likewise.
11631
11632 2008-07-18  Ian Lance Taylor  <iant@google.com>
11633
11634         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11635         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11636         * testsuite/ver_test_main.cc (main): Call t4.
11637         (t4, t4_2a): Define.
11638         * testsuite/ver_test_2.cc (t4_2): Define.
11639         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11640         * testsuite/ver_test_4.cc (t4_2a): Define.
11641         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11642         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11643
11644 2008-07-17  Ian Lance Taylor  <iant@google.com>
11645
11646         * dynobj.cc (Versions::add_def): If we give an error about a
11647         missing version, go ahead and create the version anyhow.
11648
11649 2008-07-10  Ian Lance Taylor  <iant@google.com>
11650
11651         Handle output sections with more than 0x7fffffff bytes.
11652         * object.h (class Relobj): Change map_to_output_ to
11653         output_sections_, and just keep a section pointer.  Change all
11654         uses.  Move comdat group support to Sized_relobj.
11655         (Relobj::is_section_specially_mapped): Remove.
11656         (Relobj::output_section): Remove poff parameter.  Change all
11657         callers.
11658         (Relobj::output_section_offset): New function.
11659         (Relobj::set_section_offset): Rewrite.
11660         (Relobj::map_to_output): Remove.
11661         (Relobj::output_sections): New function.
11662         (Relobj::do_output_section_offset): New pure virtual function.
11663         (Relobj::do_set_section_offset): Likewise.
11664         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11665         group support from Relobj.  Update declarations.
11666         (Sized_relobj::get_output_section_offset): New function.
11667         (Sized_relobj::do_output_section_offset): New function.
11668         (Sized_relobj::do_set_section_offset): New function.
11669         * object.cc (Relobj::output_section_address): Remove.
11670         (Sized_relobj::Sized_relobj): Initialize new fields.
11671         (Sized_relobj::include_section_group): Cast find_kept_object to
11672         Sized_relobj.
11673         (Sized_relobj::include_linkonce_section): Likewise.
11674         (Sized_relobj::do_layout): Use separate arrays for output section
11675         and output offset.
11676         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11677         output_sections.
11678         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11679         output_sections and section_offsets.
11680         (Sized_relobj::write_local_symbols): Likewise.
11681         (map_to_kept_section): Compute output address directly.
11682         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11683         output_sections and section_offsets.
11684         (Sized_relobj::write_sections): Likewise.
11685         (Sized_relobj::relocate_sections): Likewise.
11686         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11687         * output.h (class Output_reloc): Update declarations.  Change
11688         u2_.relobj to Sized_relobj*.
11689         (class Output_data_reloc): Change add functions to use
11690         Sized_relobj*.
11691         * output.cc (Output_reloc::Output_reloc): Change relobj to
11692         Sized_relobj*.
11693         (Output_reloc::local_section_offset): Change return type to
11694         Elf_Addr.  Use get_output_section_offset.
11695         (Output_reloc::get_address): Likewise.
11696         (Output_section::is_input_address_mapped): Don't call
11697         is_section_specially_mapped.
11698         (Output_section::output_offset): Likewise.
11699         (Output_section::output_address): Likewise.
11700         (Output_section::starting_output_address): Likewise.
11701         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11702         parameter to Sized_relobj*.
11703         (Copy_relocs::need_copy_reloc): Likewise.
11704         (Copy_relocs::save): Likewise.
11705         * copy-relocs.h (class Copy_relocs): Update declarations.
11706         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11707         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11708         * target-reloc.h (relocate_for_relocatable): Change
11709         offset_in_output_section type to Elf_Addr.  Change code that uses
11710         it as well.
11711         * layout.cc (Layout::layout): Always set *off.
11712         * mapfile.cc (Mapfile::print_input_section): Use
11713         output_section_offset.
11714         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11715         Sized_relobj*.
11716         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11717         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11718         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11719
11720 2008-07-03  Ian Lance Taylor  <iant@google.com>
11721
11722         * layout.cc (Layout::include_section): Do not discard unrecognized
11723         SHT_STRTAB sections.
11724
11725 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11726
11727         * script.cc (Lex::can_continue_name): Make '?' allowable in
11728         version-script names.
11729         * testsuite/version_script.map: Change glob pattern to use '?'
11730
11731 2008-06-30  Manish Singh  <yosh@gimp.org>
11732
11733         PR 6585
11734         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11735         Correct typo.
11736
11737 2008-06-30  Ian Lance Taylor  <iant@google.com>
11738
11739         PR 6660
11740         PR 6682
11741         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11742         versions]: Don't try to read the value in the contents, since we
11743         don't use it.  Use the template endianness when writing.
11744
11745 2008-06-25  Cary Coutant  <ccoutant@google.com>
11746
11747         * fileread.cc (File_read::make_view): Assert on zero-length view.
11748         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11749         symbol table when there are no symbols to read.
11750
11751 2008-06-23  Craig Silverstein  <csilvers@google.com>
11752
11753         * version.cc (version_string): Bump to 1.7
11754
11755 2008-06-18  Craig Silverstein  <csilvers@google.com>
11756
11757         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11758         constant 0xFFFF to type Valtype.
11759         (Powerpc_relocate_functions::rel16_ha): Likewise.
11760
11761 2008-06-17  Ian Lance Taylor  <iant@google.com>
11762
11763         * output.h (Output_section::Input_section): Initialize p2align_ to
11764         zero for Output_section_data constructors.
11765         (Output_section::Input_section::addralign): If not an input
11766         section, return the alignment of the Output_section_data.
11767         * testsuite/copy_test.cc: New file.
11768         * testsuite/copy_test_1.cc: New file.
11769         * testsuite/copy_test_2.cc: New file.
11770         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11771         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11772         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11773         (copy_test_1_pic.o, copy_test_1.so): New targets.
11774         (copy_test_2_pic.o, copy_test_2.so): New targets.
11775         * testsuite/Makefile.in: Rebuild.
11776
11777         * script-sections.cc (Script_sections::place_orphan): Initialize
11778         local variable exact.
11779
11780 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11781
11782         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11783
11784 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11785             David S. Miller  <davem@davemloft.net>
11786
11787         * powerpc.cc: New file.
11788         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11789         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11790         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11791         * Makefile.in: Rebuild.
11792
11793 2008-06-09  Ian Lance Taylor  <iant@google.com>
11794
11795         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11796         <exception>.
11797         (throwing, orig_terminate): New static variables.
11798         (terminate_handler): New static function.
11799         (t2): Set terminate handler.
11800
11801 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11802
11803         PR 6584
11804         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11805         alignment.
11806
11807 2008-05-30  Cary Coutant  <ccoutant@google.com>
11808
11809         * archive.cc (Archive::include_all_members) Correct to step
11810         over symbol table and extended name table in thin archives.
11811
11812 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11813
11814         PR 6407
11815         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11816         calculation.
11817
11818 2008-05-28  Caleb Howe  <cshowe@google.com>
11819
11820         * reduced_debug_output.cc: New file.
11821         * reduced_debug_output.h: New file.
11822         * options.h (class General_options): Add --strip-debug-non-line.
11823         * options.cc (General_options::finalize): Add strip_debug_non_line
11824         to the strip heirarchy.
11825         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11826         fields.
11827         * layout.cc: Include "reduced_debug_output.h".
11828         (Layout::Layout): Initialize new fields.
11829         (line_only_debug_sections): New static array.
11830         (is_lines_only_debug_sections): New static inline function.
11831         (Layout::include_section): Handle --strip-debug-non-line.
11832         (Layout::make_output_section): If --strip-debug-non-line, build
11833         new output sections for .debug_abbrev and .debug_info.
11834         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11835         gold.  Warn about possible overflow.
11836         (read_signed_LEB_128): Likewise.
11837         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11838         (read_signed_LEB_128): Declare.
11839         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11840         (HFILES): Add reduced_debug_output.h.
11841         * Makefile.in: Rebuild.
11842
11843 2008-05-21  Ian Lance Taylor  <iant@google.com>
11844
11845         * mapfile.cc: New file.
11846         * mapfile.h: New file.
11847         * options.h (class General_options): Add -M/--print-map and -Map.
11848         * options.cc (General_options::finalize): Make -M equivalent to
11849         -Map -.
11850         * main.cc: Include <cstdio> and "mapfile.h".
11851         (main): Open mapfile if requested.
11852         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11853         constructor.  Change caller.
11854         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11855         (queue_middle_tasks): Likewise.
11856         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11857         declarations.
11858         * archive.cc: Include "mapfile.h".
11859         (Archive::add_symbols): Add mapfile parameter.  Change all
11860         callers.  Pass mapfile, symbol, and reason to include_member.
11861         (Archive::include_all_members): Add mapfile parameter.  Change all
11862         callers.
11863         (Archive::include_member): Add mapfile, sym, and why parameters.
11864         Change all callers.  Report inclusion to map file.
11865         * archive.h: Include "fileread.h".
11866         (class Archive): Update declarations.
11867         (Archive::file): New const method.
11868         (class Add_archive_symbols): Add mapfile_ field.  Update
11869         constructor.  Change all callers.
11870         * readsyms.h (class Read_symbols): Likewise.
11871         (class Finish_group): Likewise.
11872         (class Read_script): Likewise.
11873         * common.cc: Include "mapfile.h".
11874         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11875         all callers.
11876         (Symbol_table::do_allocate_commons): Likewise.
11877         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11878         symbol allocation to mapfile.
11879         * common.h (class Allocate_commons_task): Add mapfile_ field.
11880         Update constructor.  Change all callers.
11881         * symtab.h (class Symbol_table): Update declarations.
11882         * layout.cc: Include "mapfile.h".
11883         (Layout_task_runner::run): Print information to mapfile.
11884         (Layout::create_gold_note): Change Output_data_fixed_space to
11885         Output_data_zero_fill.
11886         (Layout::create_build_id): Likewise.
11887         (Layout::print_to_mapfile): New function.
11888         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11889         constructor.  Change caller.
11890         (class Layout): Declare print_to_mapfile.
11891         * output.cc (Output_section::Input_section::print_to_mapfile): New
11892         function.
11893         (Output_section::add_input_section): If producing a map, always
11894         add to input_sections_ list.
11895         (Output_section::do_print_to_mapfile): New function.
11896         (Output_segment::print_sections_to_mapfile): New function.
11897         (Output_segment::print_section_list_to_mapfile): New function.
11898         * output.h: Include "mapfile.h".
11899         (Output_data::print_to_mapfile): New function.
11900         (Output_data::do_print_to_mapfile): New virtual function.
11901         (Output_segment_headers::do_print_to_mapfile): New function.
11902         (Output_file_header::do_print_to_mapfile): New function.
11903         (Output_data_const::do_print_to_mapfile): New function.
11904         (class Output_data_const_buffer): Add map_name_ field.  Update
11905         constructor.  Change all callers.  Add do_print_to_mapfile
11906         function.
11907         (class Output_data_fixed_space): Likewise.
11908         (class Output_data_space): Likewise.
11909         (class Output_data_zero_fill): New class.
11910         (Output_data_strtab::do_print_to_mapfile): New function.
11911         (Output_data_reloc_base::do_print_to_mapfile): New function.
11912         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11913         (Output_data_group::do_print_to_mapfile): New function.
11914         (Output_data_got::do_print_to_mapfile): New function.
11915         (Output_data_dynamic::do_print_to_mapfile): New function.
11916         (Output_symtab_xindex::do_print_to_mapfile): New function.
11917         (class Output_section): Declare do_print_to_mapflie.  Declare
11918         print_to_mapfile in Input_section.
11919         (class Output_segment): Declare new functions.
11920         * object.h (Sized_relobj::symbol_count): New function.
11921         * script-sections.cc
11922         (Output_section_element_dot_assignment::set_section_addresses):
11923         Change Output_data_fixed_space to Output_data_zero_fill.
11924         (Output_data_expression::do_print_to_mapfile): New function.
11925         * script.cc (read_input_script): Add mapfile parameter.  Change
11926         all callers.
11927         * script.h (read_input_script): Update declaration.
11928         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11929         (Eh_frame::do_print_to_mapfile): New function.
11930         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11931         (Output_merge_string::do_print_to_mapfile): New function.
11932         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11933         function.
11934         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11935         function.
11936         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11937         function.
11938         * Makefile.am (CCFILES): Add mapfile.cc.
11939         (HFILES): Add mapfile.h.
11940         * Makefile.in: Rebuild.
11941
11942 2008-05-19  Ian Lance Taylor  <iant@google.com>
11943
11944         * options.h (class General_options): Add -z relro.
11945         * layout.cc (Layout::Layout): Initialize relro_segment_.
11946         (Layout::add_output_section_data): Return the output section.
11947         (Layout::make_output_section): Rcognize relro sections and mark
11948         them appropriately.
11949         (Layout::attach_allocated_section_to_segment): Put relro sections
11950         in a PT_GNU_RELRO segment.
11951         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11952         section as relro.
11953         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11954         PT_TLS segments.
11955         (Layout::linkonce_mapping): Map d.rel.ro.local to
11956         .data.rel.ro.local.
11957         (Layout::output_section_name): Us .data.rel.ro.local for any
11958         section which begins with that.
11959         * layout.h (class Layout): Update add_output_section_data
11960         declaration.  Add relro_segment_ field.
11961         * output.cc (Output_section::Output_section): Initialize is_relro_
11962         and is_relro_local_ fields.
11963         (Output_segment::add_output_section): Group relro sections.
11964         (Output_segment::is_first_section_relro): New function.
11965         (Output_segment::maximum_alignment): If there is a relro section,
11966         align the segment to the common page size.
11967         (Output_segment::set_section_addresses): Track whether we are
11968         looking at relro sections.  If the last section is a relro
11969         section, align to the common page size.
11970         (Output_segment::set_section_list_addresses): Add in_relro
11971         parameter.  Change all callers.  Align to the page size when
11972         moving from relro to non-relro section.
11973         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11974         segment.
11975         * output.h (class Output_section): Add is_relro_ and
11976         is_relro_local_ fields.
11977         (Output_section::is_relro): New function.
11978         (Output_section::set_is_relro): New function.
11979         (Output_section::is_relro_local): New function.
11980         (Output_section::set_is_relro_local): New function.
11981         (class Output_segment): Update declarations.
11982         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11983         * sparc.cc (Target_sparc::got_section): Likewise.
11984         * x86_64.cc (Target_x86_64::got_section): Likewise.
11985         * testsuite/relro_test_main.cc: New file.
11986         * testsuite/relro_test.cc: New file.
11987         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11988         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11989         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11990         (relro_test.so, relro_test_pic.o): New targets.
11991         * testsuite/Makefile.in: Rebuild.
11992
11993 2008-05-16  Ian Lance Taylor  <iant@google.com>
11994
11995         * output.cc (Output_segment::add_output_section): Remove front
11996         parameter.
11997         * output.h (class Output_segment): Remove
11998         add_initial_output_section and overloaded add_output_section.
11999         Update declaration of remaining add_output_section.
12000         * layout.cc (Layout::create_interp): Call add_output_section
12001         rather than add_initial_output_section.
12002         (Layout::finish_dynamic_section): Likewise.
12003
12004         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12005         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12006         know the dynamic type.
12007         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12008         field.  Initialize it in constructor.
12009         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12010         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12011         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12012         reloc.
12013
12014         * output.cc (Output_reloc::get_address): Change return type to
12015         Elf_Addr.
12016         * output.h (class Output_reloc): Update get_address declaration.
12017         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12018         for section addresses.
12019
12020 2008-05-09  Ian Lance Taylor  <iant@google.com>
12021
12022         PR 6493
12023         * gold.cc (gold_nomem): Use return value of write.
12024
12025 2008-05-08  Ian Lance Taylor  <iant@google.com>
12026
12027         * symtab.c (Symbol::init_base_output_data): Add version
12028         parameter.  Change all callers.
12029         (Symbol::init_base_output_segment): Likewise.
12030         (Symbol::init_base_constant): Likewise.
12031         (Symbol::init_base_undefined): Likewise.
12032         (Sized_symbol::init_output_data): Likewise.
12033         (Sized_symbol::init_output_segment): Likewise.
12034         (Sized_symbol::init_constant): Likewise.
12035         (Sized_symbol::init_undefined): Likewise.
12036         (Symbol_table::do_define_in_output_data): If the new symbol has a
12037         version, mark it as the default.
12038         (Symbol_table::do_define_in_output_segment): Likewise.
12039         (Symbol_table::do_define_as_constant): Likewise.
12040         * symtab.h (class Symbol): Update declarations.
12041         (class Sized_symbol): Likewise.
12042         * resolve.cc (Symbol::override_version): New function.
12043         (Symbol::override_base): Call override_version.
12044         (Symbol::override_base_with_special): Likewise.
12045         * testsuite/ver_script_8.script: New file.
12046         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12047         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12048         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12049         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12050
12051 2008-05-06  Ian Lance Taylor  <iant@google.com>
12052
12053         PR 6049
12054         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12055         functions.
12056         (class General_options): Remove existing --undefined, and add
12057         --no-undefined instead.  Add new --undefined as synonym for -u.
12058         * archive.cc (Archive::add_symbols): Check whether symbol was
12059         named with -u.
12060         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12061         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12062         all uses.  Add IS_UNDEFINED.  Update declarations to split
12063         different versions of init_base.  Declare init_base_undefined.
12064         (Symbol::is_defined): Handle IS_UNDEFINED.
12065         (Symbol::is_undefined): Likewise.
12066         (Symbol::is_weak_undefined): Call is_undefined.
12067         (Symbol::is_absolute): Handle IS_CONSTANT.
12068         (class Sized_symbol): Update declarations to split different
12069         versions of init.  Declare init_undefined.
12070         (class Symbol_table): Declare new functions.
12071         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12072         Change all callers.
12073         (Symbol::init_base_output_data): Likewise.
12074         (Symbol::init_base_output_segment): Likewise.
12075         (Symbol::init_base_constant): Likewise.
12076         (Symbol::init_base_undefined): New function.
12077         (Sized_symbol::init_object): Rename from init.  Change all
12078         callers.
12079         (Sized_symbol::init_output_data): Likewise.
12080         (Sized_symbol::init_output_segment): Likewise.
12081         (Sized_symbol::init_constant): Likewise.
12082         (Sized_symbol::init_undefined): New function.
12083         (Symbol_table::add_undefined_symbols_from_command_line): New
12084         function.
12085         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12086         function.
12087         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12088         (Symbol::output_section): Likewise.
12089         (Symbol::set_output_section): Likewise.
12090         (Symbol_table::sized_finalize_symbol): Likewise.
12091         (Symbol_table::sized_write_globals): Likewise.
12092         * resolve.cc (Symbol_table::should_override): Likewise.
12093         (Symbol::override_base_with_special): Likewise.
12094
12095         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12096         symbol, change it to have default visibility.
12097         * testsuite/protected_1.cc: New file.
12098         * testsuite/protected_2.cc: New file.
12099         * testsuite/protected_3.cc: New file.
12100         * testsuite/protected_main_1.cc: New file.
12101         * testsuite/protected_main_2.cc: New file.
12102         * testsuite/protected_main_3.cc: New file.
12103         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12104         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12105         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12106         (protected_1.so): New target.
12107         (protected_1_pic.o, protected_2_pic.o): New targets.
12108         (protected_3_pic.o): New target.
12109         (check_PROGRAMS): Add protected_2.
12110         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12111         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12112         * testsuite/Makefile.in: Rebuild.
12113
12114         * options.h (DEFINE_var): Add set_user_set_##varname__.
12115         (DEFINE_bool_alias): New macro.
12116         (class General_options): Define -Bstatic using DEFINE_bool_alias
12117         rather than DEFINE_special.  Add --undefined as an alias for -z
12118         defs.
12119         * options.cc (General_options::parse_Bstatic): Remove.
12120
12121         * options.h (class General_options): Add --fatal-warnings.
12122         * main.cc (main): Implement --fatal-warnings.
12123         * errors.h (Errors::warning_count): New function.
12124
12125         * options.h (class General_options): Add -Bsymbolic-functions.
12126         * symtab.h (Symbol::is_preemptible): Check for
12127         -Bsymbolic-functions.
12128
12129 2008-05-05  Ian Lance Taylor  <iant@google.com>
12130
12131         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12132         as noVARNAME rather than no-VARNAME.
12133         (class General_options): Add option -z combreloc.
12134         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12135         get_address.
12136         (Output_reloc::sort_before) [SHT_REL]: New function.
12137         (Output_reloc::sort_before) [SHT_RELA]: New function.
12138         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12139         Sort_relocs_comparison.
12140         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12141         parameter.  Change all callers.
12142         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12143         sort_relocs parameter.  Change all callers.
12144         * output.cc (Output_reloc::get_address): New function, broken out
12145         of write_rel.
12146         (Output_reloc::write_rel): Call it.
12147         (Output_reloc::compare): New function.
12148         (Output_data_reloc_base::do_write): Optionally sort relocs.
12149
12150         * configure.ac: If targ_extra_obj is set, link it in.
12151         * configure.tgt: Initialize all variables.
12152         (x86_64*): Set targ_extra_obj and targ_extra_size.
12153         * configure: Rebuild.
12154
12155         * object.cc (Sized_relobj::include_section_group): Adjust section
12156         indexes read from group data.  Build vector to pass to
12157         layout_group.
12158         * layout.cc (Layout::layout_group): Add flags and shndxes
12159         parameters.  Remove contents parameter.  Change caller.  Update
12160         explicit instantiations.
12161         * layout.h (class Layout): Update layout_group declaration.
12162         * output.cc (Output_data_group::Output_data_group): Add flags and
12163         input_shndxes parameters.  Remove contents parameter.  Change
12164         caller.
12165         (Output_data_group::do_write): Change input_sections_ to
12166         input_shndxes_.
12167         * output.h (class Output_data_group): Update constructor
12168         declaration.  Rename input_sections_ to input_shndxes_.
12169         * testsuite/many_sections_test.cc: Add template.
12170
12171 2008-04-30  Cary Coutant  <ccoutant@google.com>
12172
12173         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12174
12175         * layout.cc (Layout::include_section): Refactored check for debug
12176         info section.
12177         (Layout::add_comdat): Add new parameters.  Change type
12178         of signature parameter.  Add object and shndx to signatures table.
12179         (Layout::find_kept_object): New function.
12180         * layout.h: Include <cstring>.
12181         (Layout::is_debug_info_section): New function.
12182         (Layout::add_comdat): Add new parameters.
12183         (Layout::find_kept_object): New function.
12184         (Layout::Kept_section): New struct.
12185         (Layout::Signatures): Change type of map range.
12186         * object.cc (Relobj::output_section_address): New function.
12187         (Sized_relobj::include_section_group): Add new parameters.  Change
12188         calls to Layout::add_comdat.  Change to build table of kept comdat
12189         groups and table mapping discarded sections to kept sections.
12190         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12191         (Sized_relobj::do_layout): Change calls to include_section_group and
12192         include_linkonce_section.
12193         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12194         value to zero when section is discarded.
12195         (Sized_relobj::map_to_kept_section): New function.
12196         * object.h (Relobj::output_section_address): New function.
12197         (Relobj::Comdat_group): New type.
12198         (Relobj::find_comdat_group): New function.
12199         (Relobj::Comdat_group_table): New type.
12200         (Relobj::Kept_comdat_section): New type.
12201         (Relobj::Kept_comdat_section_table): New type.
12202         (Relobj::add_comdat_group): New function.
12203         (Relobj::set_kept_comdat_section): New function.
12204         (Relobj::get_kept_comdat_section): New function.
12205         (Relobj::comdat_groups_): New field.
12206         (Relobj::kept_comdat_sections_): New field.
12207         (Symbol_value::input_value): Update comment.
12208         (Sized_relobj::map_to_kept_section) New function.
12209         (Sized_relobj::include_linkonce_section): Add new parameter.
12210         * target-reloc.h (Comdat_behavior): New type.
12211         (get_comdat_behavior): New function.
12212         (relocate_section): Add code to map a discarded section to the
12213         corresponding kept section when applying a relocation.
12214
12215 2008-04-30  Craig Silverstein  <csilvers@google.com>
12216
12217         * dwarf_reader.cc (next_generation_count): New static var.
12218         (Addr2line_cache_entry): New struct.
12219         (addr2line_cache): New static var.
12220         (Dwarf_line_info::one_addr2line): Added caching.
12221         (Dwarf_line_info::clear_addr2line_cache): New function.
12222         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12223         cache-size parameter.
12224         (Dwarf_line_info::one_addr2line_cache): New function.
12225         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12226         new cache-size argument to one_addr2line(), and clear cache.
12227
12228 2008-04-28  Cary Coutant  <ccoutant@google.com>
12229
12230         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12231         R_386_PC8 relocations.
12232
12233 2008-04-23  Ian Lance Taylor  <iant@google.com>
12234
12235         * object.cc (Sized_relobj::include_section_group): Check for
12236         invalid section group.
12237
12238         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12239         header size.
12240
12241         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12242         than read for file header.
12243         * archive.cc (Archive::include_member): Likewise.
12244
12245 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12246
12247         * aclocal.m4: Regenerate.
12248         * configure: Regenerate.
12249
12250 2008-04-19  Ian Lance Taylor  <iant@google.com>
12251
12252         * version.cc (version_string): Bump to 1.6.
12253
12254         * testsuite/Makefile.am (many_sections_r_test): New target.
12255         (many_sections_r_test_SOURCES): Remove.
12256         (many_sections_r_test_DEPENDENCIES): Remove.
12257         (many_sections_r_test_LDFLAGS): Remove.
12258         (many_sections_r_test_LDADD): Remove.
12259
12260         * object.cc (Sized_relobj::do_add_symbols): Always pass
12261         local_symbol_count_ to add_from_relobj.
12262
12263         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12264         every thousand variables.
12265         * testsuite/Makefile.in: Rebuild.
12266
12267         * object.cc (Xindex::initialize_symtab_xindex): New function.
12268         (Xindex::read_symtab_xindex): New function.
12269         (Xindex::sym_xindex_to_shndx): New function.
12270         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12271         available.
12272         (Sized_relobj::do_initialize_xindex): New function.
12273         (Sized_relobj::do_read_symbols): Adjust section links.
12274         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12275         parameter.  Change all callers.
12276         (Sized_relobj::include_section_group): Adjust section links and
12277         symbol section indexes.
12278         (Sized_relobj::do_layout): Adjust section links.
12279         (Sized_relobj::do_count_local_symbols): Adjust section links and
12280         symbol section indexes.
12281         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12282         ordinary and special symbols.
12283         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12284         dynsym_xindex parameters.  Change all callers.  Adjust section
12285         links.  Use SHN_XINDEX when needed.
12286         (Sized_relobj::get_symbol_location_info): Adjust section links.
12287         Don't get fooled by special symbols.
12288         * object.h (class Xindex): Define.
12289         (class Object): Add xindex_ parameter.  Declare virtual functoin
12290         do_initialize_xindex.
12291         (Object::adjust_sym_shndx): New function.
12292         (Object::set_xindex): New protected function.
12293         (class Symbol_value): Add is_ordinary_shndx_ field.
12294         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12295         (Symbol_value::value): Assert ordinary section.
12296         (Symbol_value::initialize_input_to_output_map): Likewise.
12297         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12298         Change all callers.
12299         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12300         all callers.
12301         (class Sized_relobj): Update declarations.
12302         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12303         parameter.  Change all callers.
12304         (Sized_relobj::adjust_shndx): New function.
12305         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12306         field.
12307         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12308         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12309         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12310         (Sized_dynobj::read_dynsym_section): Adjust section links.
12311         (Sized_dynobj::read_dynamic): Likewise.
12312         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12313         section links.
12314         (Sized_dynobj::do_initialize_xindex): New function.
12315         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12316         do_initialize_xindex.
12317         (Sized_dynobj::adjust_shndx): New function.
12318         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12319         dynsym_xindex_ fields.
12320         (Layout::finalize): Add a call to set_section_indexes before
12321         creating the symtab sections.
12322         (Layout::set_section_indexes): Don't do anything if the section
12323         already has a section index.
12324         (Layout::create_symtab_sections): Add shnum parameter.  Change
12325         caller.  Create .symtab_shndx section if needed.
12326         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12327         caller.
12328         (Layout::allocated_output_section_count): New function.
12329         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12330         needed.
12331         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12332         fields.  Update declarations.
12333         (Layout::symtab_xindex): New function.
12334         (Layout::dynsym_xindex): New function.
12335         (class Write_symbols_task): Add layout_ field.
12336         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12337         Change caller.
12338         * output.cc (Output_section_headers::Output_section_headers): Add
12339         shstrtab_section parameter.  Change all callers.
12340         (Output_section_headers::do_sized_write): Store overflow values
12341         for section count and section string table section index in
12342         section header zero.
12343         (Output_file_header::do_sized_write): Check for overflow of
12344         section count and section string table section index.
12345         (Output_symtab_xindex::do_write): New function.
12346         (Output_symtab_xindex::endian_do_write): New function.
12347         * output.h (class Output_section_headers): Add shstrtab_section_.
12348         Update declarations.
12349         (class Output_symtab_xindex): Define.
12350         (Output_section::has_out_shndx): New function.
12351         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12352         field.
12353         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12354         Change all callers.
12355         (Sized_symbol::init): Likewise.
12356         (Symbol::output_section): Check for ordinary symbol.
12357         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12358         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12359         callers.
12360         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12361         Change all callers.  Simplify handling of symbols from sections
12362         not included in the link.
12363         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12364         distinction.
12365         (Weak_alias_sorter::operator()): Assert that symbols are
12366         ordinary.
12367         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12368         distinction.
12369         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12370         parameters.  Change all callers.
12371         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12372         symbol distinction.  Use SHN_XINDEX when needed.
12373         (Symbol_table::write_section_symbol): Add symtab_xindex
12374         parameter.  Change all callers.
12375         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12376         SHN_XINDEX when needed.
12377         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12378         declarations.
12379         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12380         (Symbol::is_defined): Check is_ordinary.
12381         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12382         (Symbol::is_absolute, Symbol::is_common): Likewise.
12383         (class Sized_symbol): Update declarations.
12384         (class Symbol_table): Update declarations.
12385         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12386         parameters.  Change all callers.
12387         (Sized_symbol::override): Likewise.
12388         (Symbol_table::override): Likewise.
12389         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12390         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12391         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12392         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12393         to be in an ordinary section.
12394         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12395         object and is_ordinary parameters.  Change all callers.
12396         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12397         Change all callers.  Don't add undefined or non-ordinary symbols
12398         to reloc_map_.
12399         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12400         Change all callers.
12401         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12402         declarations.
12403         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12404         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12405         (Sized_relobj::relocate_sections): Likewise.
12406         * target-reloc.h (scan_relocs): Adjust section symbol index.
12407         (scan_relocatable_relocs): Likewise.
12408         * i386.cc (Scan::local): Check for ordinary symbols.
12409         * sparc.cc (Scan::local): Likewise.
12410         * x86_64.cc (Scan::local): Likewise.
12411         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12412         to symbol_section_and_value.
12413         * testsuite/many_sections_test.cc: New file.
12414         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12415         (check_PROGRAMS): Add many_sections_test.
12416         (many_sections_test_SOURCES): Define.
12417         (many_sections_test_DEPENDENCIES): Define.
12418         (many_sections_test_LDFLAGS): Define.
12419         (BUILT_SOURCES): Add many_sections_define.h.
12420         (many_sections_define.h): New target.
12421         (BUILT_SOURCES): Add many_sections_check.h.
12422         (many_sections_check.h): New target.
12423         (check_PROGRAMS): Add many_sections_r_test.
12424         (many_sections_r_test_SOURCES): Define.
12425         (many_sections_r_test_DEPENDENCIES): Define.
12426         (many_sections_r_test_LDFLAGS): Define.
12427         (many_sections_r_test_LDADD): Define.
12428         (many_sections_r_test.o): New target.
12429         * testsuite/Makefile.in: Rebuild.
12430
12431 2008-04-17  Cary Coutant  <ccoutant@google.com>
12432
12433         * errors.cc (Errors::info): New function.
12434         (gold_info): New function.
12435         * errors.h (Errors::info): New function.
12436         * gold.h (gold_info): New function.
12437         * object.cc (Input_objects::add_object): Print trace output.
12438         * options.cc (options::parse_set): New function.
12439         (General_options::parse_wrap): Deleted.
12440         (General_options::General_options): Deleted initializer.
12441         * options.h (options::String_set): New typedef.
12442         (options::parse_set): New function.
12443         (DEFINE_set): New macro.
12444         (General_options::wrap): Changed to use DEFINE_set. Changed
12445         callers of any_wrap_symbols and is_wrap_symbol.
12446         (General_options::trace, General_options::trace_symbol):
12447         New options.
12448         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12449         (General_options::wrap_symbols_): Deleted.
12450         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12451
12452 2008-04-17  David S. Miller  <davem@davemloft.net>
12453
12454         * options.cc (General_options::parse_V): New function.
12455         * options.h: Add entries for -V and -Qy.
12456
12457 2008-04-17  Ian Lance Taylor  <iant@google.com>
12458
12459         * common.cc (Symbol_table::allocate_commons): Remove options
12460         parameter.  Change caller.
12461         (Symbol_table::do_allocate_commons): Remove options parameter.
12462         Change caller.  Just call do_allocate_commons_list twice.
12463         (Symbol_table::do_allocate_commons_list): New function, broken out
12464         of do_allocate_commons.
12465         * common.h (class Allocate_commons_task): Remove options_ field.
12466         Update constructor.
12467         * symtab.cc (Symbol_table::Symbol_table): Initialize
12468         tls_commons_.
12469         (Symbol_table::add_from_object): Put TLS common symbols on
12470         tls_commons_ list.
12471         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12472         which are IN_OUTPUT_DATA.
12473         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12474         allocate_commons and do_allocate_commons declarations.  Declare
12475         do_allocate_commons_list.
12476         * gold.cc (queue_middle_tasks): Update creation of
12477         Allocate_commons_task to not pass options.
12478         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12479         (TLS_TEST_C_FLAGS): New variable.
12480         (tls_test_c_pic.o): New target.
12481         (tls_test_shared.so): Link in tls_test_c_pic.o.
12482         (tls_test_c_pic_ie.o): New target.
12483         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12484         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12485         (tls_test_c.o): New target.
12486         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12487         (tls_pic_test_LDADD): Likewise.
12488         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12489         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12490         (tls_test_c_gnu2.o): New target.
12491         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12492         tls_test_c_gnu2.o.
12493         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12494         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12495         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12496         * testsuite/tls_test.cc: Include "config.h".
12497         (t_last): Call t11_last.
12498         * testsuite/tls_test.h (t11, t11_last): Declare.
12499         * testsuite/tls_test_c.c: New file.
12500         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12501         * configure.ac: Check for OpenMP support.
12502         * configure, config.in, Makefile.in: Rebuild.
12503         * testsuite/Makefile.in: Rebuild.
12504
12505 2008-04-16  Cary Coutant  <ccoutant@google.com>
12506
12507         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12508         (Target_i386::tls_base_symbol_defined_): New field.
12509         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12510         (Target_i386::Scan::global): Likewise.
12511         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12512         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12513         (Target_x86_64::tls_base_symbol_defined_): New field.
12514         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12515         (Target_x86_64::Scan::global): Likewise.
12516
12517 2008-04-16  Cary Coutant  <ccoutant@google.com>
12518
12519         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12520         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12521         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12522         building shared libraries.
12523         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12524         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12525         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12526         * testsuite/Makefile.in: Rebuild.
12527         * testsuite/weak_undef.h: New file.
12528         * testsuite/weak_undef_file1.cc: Add extra test cases.
12529         * testsuite/weak_undef_file2.cc: Likewise.
12530         * testsuite/weak_undef_test.cc: Likewise.
12531
12532 2008-04-16  David S. Miller  <davem@davemloft.net>
12533
12534         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12535         Add issued_non_pic_error_ field.  Declare check_non_pic.
12536         (Target_sparc::Scan::check_non_pic): New function.
12537         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12538         (Target_sparc::Scan::global): Likewise.
12539
12540         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12541         * configure: Rebuild.
12542
12543         * options.h (DEFINE_enable): New macro.
12544         (new_dtags): New enable option.
12545         (initfirst, interpose, loadfltr, nodefaultlib,
12546         nodelete, nodlopen, nodump): New -z options.
12547         * layout.cc (Layout:finish_dynamic_section): If new
12548         dtags enabled, emit DT_RUNPATH.  Also, emit a
12549         DT_FLAGS_1 containing any specified -z flags.
12550
12551 2008-04-16  Ian Lance Taylor  <iant@google.com>
12552
12553         * copy-relocs.cc: New file.
12554         * copy-relocs.h: New file.
12555         * reloc.cc: Remove Copy_relocs code.
12556         * reloc.h: Likewise.
12557         * reloc-types.h (struct Reloc_types) [both versions]: Add
12558         get_reloc_addend_noerror.
12559         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12560         variants of add_global which take an addend which must be zero.
12561         * i386.cc: Include "copy-relocs.h".
12562         (class Target_i386): Change type of copy_relocs_ to variable,
12563         update initializer.
12564         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12565         Change all callers.
12566         (Target_i386::do_finalize_sections): Change handling of
12567         copy_relocs_.
12568         * sparc.cc: Include "copy-relocs.h".
12569         (class Target_sparc): Change type of copy_relocs_ to variable,
12570         update initializer.
12571         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12572         Change all callers.
12573         (Target_sparc::do_finalize_sections): Change handling of
12574         copy_relocs_.
12575         * x86_64.cc: Include "copy-relocs.h".
12576         (class Target_x86_64): Change type of copy_relocs_ to variable,
12577         update initializer.
12578         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12579         class.  Change all callers.
12580         (Target_x86_64::do_finalize_sections): Change handling of
12581         copy_relocs_.
12582         * Makefile.am (CCFILES): Add copy-relocs.cc.
12583         (HFILES): Add copy-relocs.h.
12584
12585         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12586
12587         * testsuite/script_test_4.sh: Permit leading zeroes.
12588
12589 2008-04-15  Ian Lance Taylor  <iant@google.com>
12590
12591         * script-sections.cc (Script_sections::create_segments): Use
12592         header_size_adjustment even when there is enough room for the
12593         headers.
12594         * testsuite/script_test_4.sh: New file.
12595         * testsuite/script_test_4.t: New file.
12596         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12597         (check_DATA): Add script_test_4.stdout.
12598         (MOSTLYCLEANFILES): Likewise.
12599         (script_test_4): New target.
12600         (script_test_4.stdout): New target.
12601         * testsuite/Makefile.in: Rebuild.
12602
12603         * sparc.cc: Add definitions for Output_data_plt_sparc class
12604         constants.
12605
12606 2008-04-14  David S. Miller  <davem@davemloft.net>
12607
12608         * sparc.cc: New file.
12609         * Makefile.am (TARGETSOURCES): Add sparc.cc
12610         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12611         * configure.tgt: Document targ_extra_size and
12612         targ_extra_big_endian.  Add entries for sparc-* and
12613         sparc64-*.
12614         * configure.ac: Handle targ_extra_size and
12615         targ_extra_big_endian.
12616         * Makefile.in: Rebuild.
12617         * configure: Likewise.
12618         * po/POTFILES.in: Likewise.
12619         * po/gold.pot: Likewise.
12620
12621 2008-04-14  Ian Lance Taylor  <iant@google.com>
12622
12623         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12624         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12625         in the name/type/flags to section mapping.  Don't call
12626         allocate_output_section.
12627         (Layout::choose_output_section): Change parameter from adjust_name
12628         to is_input_section.  Don't permit input sections after sections
12629         are attached to segments.  Don't call allocate_output_section.
12630         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12631         not write_enable_output_section.
12632         (Layout::make_output_section): Don't push to
12633         unattached_section_list_ nor call attach_to_segment.  Call
12634         attach_section_to_segment if sections are attached.
12635         (Layout::attach_sections_to_segments): New function.
12636         (Layout::attach_section_to_segment): New function.
12637         (Layout::attach_allocated_section_to_segment): Rename from
12638         attach_to_segment.  Remove flags parameter.
12639         (Layout::allocate_output_section): Remove function.
12640         (Layout::write_enable_output_section): Remove function.
12641         * layout.h (class Layout): Update for above changes.  Add new
12642         field sections_are_attached_.
12643         * output.h (Output_section::update_flags_for_input_section): New
12644         function.
12645         * output.cc (Output_section::add_input_section): Call
12646         update_flags_for_input_section.
12647         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12648
12649 2008-04-11  Cary Coutant  <ccoutant@google.com>
12650
12651         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12652         thought unnecessary.
12653         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12654
12655 2008-04-11  Ian Lance Taylor  <iant@google.com>
12656
12657         * output.h (class Output_section_data): Remove inline definition
12658         of set_addralign.
12659         * output.cc (Output_section_data::set_addralign): New function.
12660
12661 2008-04-11  Cary Coutant  <ccoutant@google.com>
12662
12663         Add support for TLS descriptors for i386 and x86_64.
12664         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12665         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12666         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12667         GOT_TYPE_TLS_DESC.
12668         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12669         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12670         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12671         relocations.
12672         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12673         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12674         Fix problem with initial-exec relocations.
12675         (Target_i386::Relocate::relocate_tls): Likewise.
12676         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12677         relaxation.
12678         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12679         support for section-plus-offset dynamic table entries.
12680         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12681         (Output_data_dynamic::Dynamic_entry): Add support for
12682         section-plus-offset dynamic table entries.
12683         (Output_data_dynamic::Classification): Likewise.
12684         (Output_data_dynamic::classification_): Renamed offset_.
12685         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12686         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12687         (Target_x86_64::make_plt_section): New function.
12688         (Target_x86_64::reserve_tlsdesc_entries): New function.
12689         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12690         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12691         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12692         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12693         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12694         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12695         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12696         add extra PLT entry for TLS descriptors.
12697         (Output_data_plt_x86_64::got_): New field.
12698         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12699         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12700         fields.
12701         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12702         descriptors.
12703         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12704         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12705         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12706         R_386_TLS_DESC_CALL relocations.
12707         (Target_x86_64::Scan::global): Likewise.
12708         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12709         for TLS descriptors.
12710         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12711         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12712         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12713         GD-to-IE relaxation.
12714         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12715         and TLS_DESCRIPTORS.
12716         * Makefile.in: Rebuild.
12717         * configure: Rebuild.
12718         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12719         (tls_test_shared2.so): New target.
12720         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12721         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12722         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12723         (tls_shared_gd_to_ie_test_LDADD): New variable.
12724         (tls_shared_gnu2_gd_to_ie_test): New target.
12725         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12726         New targets.
12727         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12728         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12729         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12730         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12731         (tls_shared_gnu2_test): New target.
12732         (tls_test_gnu2_shared.so): New target.
12733         (tls_shared_gnu2_test_SOURCES): New variable.
12734         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12735         (tls_shared_gnu2_test_LDFLAGS): New variable.
12736         (tls_shared_gnu2_test_LDADD): New variable.
12737         * testsuite/Makefile.in: Rebuild.
12738         * testsuite/Makefile.
12739
12740 2008-04-11  Ian Lance Taylor  <iant@google.com>
12741
12742         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12743         justsyms.t.
12744         * testsuite/Makefile.in: Rebuild.
12745
12746         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12747         long.
12748         * testsuite/script_test_2.cc (main): Adjust test.
12749
12750 2008-04-11  David S. Miller  <davem@davemloft.net>
12751             Ian Lance Taylor  <iant@google.com>
12752
12753         * options.h (General_options): Add entries for '-Y' and
12754         '-relax'.
12755         * options.cc (General_options:finalize): If -Y was used, add those
12756         entries to the library path instead of the default "/lib" and
12757         "/usr/lib".
12758
12759 2008-04-11  David S. Miller  <davem@davemloft.net>
12760
12761         * testsuite/justsyms.t: Start at 0x100.
12762         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12763         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12764         long.
12765         * testsuite/script_test_2.cc: Adjust string and section length
12766         checks.
12767
12768 2008-04-09  Ian Lance Taylor  <iant@google.com>
12769
12770         PR gold/5996
12771         * script-sections.cc (Sections_element::allocate_to_segment): Add
12772         orphan parameter.
12773         (Output_section_definition::allocate_to_segment): Likewise.
12774         (Orphan_output_section::allocate_to_segment): Likewise.
12775         (Script_sections::attach_sections_using_phdrs_clause): Don't
12776         propagate non-PT_LOAD segments to orphan sections.
12777         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12778         readelf rather than objdump.
12779         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12780         .interp section and PT_INTERP segment are the same size.
12781         * testsuite/Makefile.in: Rebuild.
12782
12783         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12784         aliases for symbols defined in the same object.
12785         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12786         (weak_alias_test_SOURCES): New variable.
12787         (weak_alias_test_DEPENDENCIES): New variable.
12788         (weak_alias_test_LDFLAGS): New variable.
12789         (weak_alias_test_LDADD): New variable.
12790         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12791         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12792         (weak_alias_test_3.o): New target.
12793         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12794         * testsuite/weak_alias_test_main.cc: New file.
12795         * testsuite/weak_alias_test_1.cc: New file.
12796         * testsuite/weak_alias_test_2.cc: New file.
12797         * testsuite/weak_alias_test_3.cc: New file.
12798
12799 2008-04-08  Ian Lance Taylor  <iant@google.com>
12800
12801         * options.h (class General_options): Add --noinhibit-exec option.
12802         * main.cc (main): Check --noinhibit-exec.
12803
12804         * options.h (class General_options): Define --wrap as a special
12805         option.  Add wrap_symbols_ field.
12806         (General_options::any_wrap_symbols): New function.
12807         (General_options::is_wrap_symbol): New function.
12808         * options.cc (General_options::parse_wrap): New function.
12809         (General_options::General_options): Initialize wrap_symbols_.
12810         * symtab.cc (Symbol_table::wrap_symbol): New function.
12811         (Symbol_table::add_from_object): Handle --wrap.
12812         * symtab.h (class Symbol_table): Declare wrap_symbol.
12813         * target.h (Target::wrap_char): New function.
12814         (Target::Target_info): Add wrap_char field.
12815         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12816         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12817         * testsuite/testfile.cc (Target_test::test_target_info):
12818         Likewise.
12819
12820         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12821         there is one.
12822
12823         * layout.h (class Layout): Add added_eh_frame_data_ field.
12824         * layout.cc (Layout::Layout): Initialize new field.
12825         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12826         output section until we find a section we merged successfully.
12827         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12828         that the size be non-zero.
12829
12830         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12831         qualifier.
12832
12833 2008-04-08  Craig Silverstein  <csilvers@google.com>
12834
12835         * configure.ac: Export new conditional variable HAVE_ZLIB.
12836         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12837         on HAVE_ZLIB.
12838         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12839         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12840
12841 2008-04-07  Ian Lance Taylor  <iant@google.com>
12842
12843         * version.cc (version_string): Set to "1.5".
12844
12845         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12846         Add issued_non_pic_error_ field.  Declare check_non_pic.
12847         (Target_x86_64::Scan::check_non_pic): New function.
12848         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12849         (Target_x86_64::Scan::global): Likewise.
12850
12851         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12852         addend parameter.  Change caller.  Handle merge sections.
12853         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12854         Address to Addend.  Don't add in the result of
12855         local_section_offset, pass down the addend and use the returned
12856         value.
12857         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12858         Update declarations of local_section_offset and symbol_value.
12859         * testsuite/two_file_test_1.cc (t18): New function.
12860         * testsuite/two_file_test_2.cc (f18): New function.
12861         * testsuite/two_file_test_main.cc (main): Call t18.
12862         * testsuite/two_file_test.h (t18, f18): Declare.
12863
12864         * configure.ac: Don't test for objdump, c++filt, or readelf.
12865         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12866         conditionals.
12867         (TEST_READELF): New variable.
12868         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12869         (check_PROGRAMS): Add two_file_strip_test.
12870         (two_file_strip_test): New target.
12871         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12872         (two_file_same_shared_strip_test_SOURCES): New variable.
12873         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12874         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12875         (two_file_same_shared_strip_test_LDADD): New variable.
12876         (two_file_shared_strip.so): New target.
12877         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12878         (ver_test_5.syms, ver_test_7.syms): Likewise.
12879         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12880         (strip_test_3.stdout): Use TEST_OBJDUMP.
12881         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12882
12883 2008-04-04  Cary Coutant  <ccoutant@google.com>
12884
12885         * symtab.h (Symbol::is_weak_undefined): New function.
12886         (Symbol::is_strong_undefined): New function.
12887         (Symbol::is_absolute): New function.
12888         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12889         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12890         absolute symbols.
12891         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12892         (weak_undef_test): New target.
12893         * testsuite/Makefile.in: Rebuild.
12894         * testsuite/weak_undef_file1.cc: New file.
12895         * testsuite/weak_undef_file2.cc: New file.
12896         * testsuite/weak_undef_test.cc: New file.
12897
12898 2008-04-03  Craig Silverstein  <csilvers@google.com>
12899
12900         * compressed_output.h (class Output_compressed_section): Use
12901         unsigned buffer.
12902         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12903         add zlib header.
12904         (zlib_compressed_suffix): Removed.
12905         (Output_compressed_section::set_final_data_size): Use unsigned
12906         buffers.
12907         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12908         Fix linker invocation.
12909         (flagstest_o_specialfile_and_compress_debug_sections):
12910         Likewise.
12911         * testsuite/Makefile.in: Regenerated.
12912
12913 2008-04-02  David S. Miller  <davem@davemloft.net>
12914
12915         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12916         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12917
12918 2008-04-02  Craig Silverstein  <csilvers@google.com>
12919
12920         * TODO: New file.
12921
12922 2008-04-02  Ian Lance Taylor  <iant@google.com>
12923
12924         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12925         parameters.  Update for new key type to views_.  Change all
12926         callers.
12927         (File_read::read): Adjust for byteshift in returned view.
12928         (File_read::add_view): New function, broken out of
12929         find_and_make_view.
12930         (File_read::make_view): New function, broken out of
12931         find_and_make_view.
12932         (File_read::find_or_make_view): Add offset and aligned
12933         parameters.  Rewrite accordingly.  Change all callers.
12934         (File_read::get_view): Add offset and aligned parameters.  Adjust
12935         for byteshift in return value.
12936         (File_read::get_lasting_view): Likewise.
12937         * fileread.h (class File_read): Update declarations.
12938         (class File_read::View): Add byteshift_ field.  Add byteshift to
12939         constructor.  Add byteshift method.
12940         * archive.h (Archive::clear_uncached_views): New function.
12941         (Archive::get_view): Add aligned parameter.  Change all callers.
12942         * object.h (Object::get_view): Add aligned parameter.  Change all
12943         callers.
12944         (Object::get_lasting_view): Likewise.
12945
12946         * fileread.cc (File_read::release): Don't call clear_views if
12947         there are multiple objects.
12948         * fileread.h (File_read::clear_uncached_views): New function.
12949         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12950         on the archive.
12951
12952 2008-03-31  Cary Coutant  <ccoutant@google.com>
12953
12954         Add thin archive support.
12955         * archive.cc (Archive::armagt): New const.
12956         (Archive::setup): Remove task parameter and calls to unlock.
12957         (Archive::unlock_nested_archives): New function.
12958         (Archive::read_header): Add nested_off parameter. Change
12959         all callers.
12960         (Archive::interpret_header): Likewise.
12961         (Archive::include_all_members): Change to handle thin
12962         archives.
12963         (Archive::include_member): Likewise.
12964         * archive.h (Archive::Archive): Add new parameters and
12965         initializers.
12966         (Archive::armagt): New const.
12967         (Archive::setup): Remove task parameter.
12968         (Archive::unlock_nested_archives): New function.
12969         (Archive::read_header): Add nested_off parameter.
12970         (Archive::interpret_header): Likewise.
12971         (Archive::Nested_archive_table): New typedef.
12972         (Archive::is_thin_archive_): New field.
12973         (Archive::nested_archives_): New field.
12974         (Archive::options_): New field.
12975         (Archive::dirpath_): New field.
12976         (Archive::task_): New field.
12977         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12978         for thin archives.  Pass additional parameters to
12979         Archive::Archive.  Unlock the archive file after calling
12980         Archive::setup.
12981
12982 2008-03-29  Ian Lance Taylor  <iant@google.com>
12983
12984         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12985         version symbol to be local.
12986         * testsuite/ver_test_4.sh: New file.
12987         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12988         (check_DATA): Add ver_test_4.syms.
12989         (ver_test_4.syms): New target.
12990         * testsuite/Makefile.in: Rebuild.
12991
12992         * output.cc
12993         (Output_section::Input_section_sort_entry::has_priority): New
12994         function.
12995         (Output_section::Input_section_sort_entry::match_file_name): New
12996         function.
12997         (Output_section::Input_section_sort_entry::match_section_name):
12998         Remove.
12999         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13000         Remove.
13001         (Output_section::Input_section_sort_entry::match_section_file):
13002         Remove.
13003         (Output_section::Input_section_sort_compare::operator()): Rewrite
13004         using new Input_section_sort_entry functions.  Sort crtbegin and
13005         crtend first.  Sort sections with no priority before sections with
13006         a priority.
13007         * testsuite/initpri1.c (d3): Check j != 4.
13008         (cd5): New constructor/destructor function.
13009         (main): Check j != 2.
13010
13011         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13012         new symbol when resolving, don't call set_is_default.
13013         * testsuite/ver_test_7.cc: New file.
13014         * testsuite/ver_test_7.sh: New file.
13015         * testsuite/Makefile.am (ver_test_7.so): New target.
13016         (ver_test_7.o): New target.
13017         (check_SCRIPTS): Add ver_test_7.sh.
13018         (check_DATA): Add ver_test_7.syms.
13019         (ver_test_7.syms): New target.
13020
13021 2008-03-28  Ian Lance Taylor  <iant@google.com>
13022
13023         * layout.cc (Layout::layout): If we see an input section with a
13024         name that needs sorting, set the must_sort flag for the output
13025         section.
13026         (Layout::make_output_section): If the name of the output section
13027         indicates that it might require sorting, set the may_sort flag.
13028         * output.h (Output_section::may_sort_attached_input_sections): New
13029         function.
13030         (Output_section::set_may_sort_attached_input_sections): New
13031         function.
13032         (Output_section::must_sort_attached_input_sections): New
13033         function.
13034         (Output_section::set_must_sort_attached_input_sections): New
13035         function.
13036         (class Output_section): Declare Input_section_sort_entry.  Define
13037         Input_section_sort_compare.  Declare
13038         sort_attached_input_sections.  Add new fields:
13039         may_sort_attached_input_sections_,
13040         must_sort_attached_input_sections_,
13041         attached_input_sections_are_sorted_.
13042         * output.cc (Output_section::Output_section): Initialize new
13043         fields.
13044         (Output_section::add_input_section): Add an entry to
13045         input_sections_ if may_sort or must_sort are true.
13046         (Output_section::set_final_data_size): Call
13047         sort_attached_input_sections if necessary.
13048         (Output_section::Input_section_sort_entry): Define new class.
13049         (Output_section::Input_section_sort_compare::operator()): New
13050         function.
13051         (Output_section::sort_attached_input_sections): New function.
13052         * configure.ac: Check whether the compiler supports constructor
13053         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13054         * testsuite/initpri1.c: New file.
13055         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13056         CONSTRUCTOR_PRIORITY.
13057         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13058         (initpri1_LDFLAGS): New variable.
13059         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13060
13061 2008-03-27  Ian Lance Taylor  <iant@google.com>
13062
13063         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13064         * testsuite/common_test_1.c: New file.
13065         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13066         (common_test_1_SOURCES): New variable.
13067         (common_test_1_DEPENDENCIES): New variable.
13068         (common_test_1_LDFLAGS): New variable.
13069
13070         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13071         and commons_ correctly when NAME/VERSION does not override
13072         NAME/NULL.
13073         * testsuite/ver_test_6.c: New file.
13074         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13075         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13076         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13077
13078 2008-03-26  Ian Lance Taylor  <iant@google.com>
13079
13080         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13081         of an undefined symbol from a version script.
13082         * testsuite/Makefile.am (ver_test_5.so): New target.
13083         (ver_test_5.o): New target.
13084         (check_SCRIPTS): Add ver_test_5.sh.
13085         (check_DATA): Add ver_test_5.syms.
13086         (ver_test_5.syms): New target.
13087         * testsuite/ver_test_5.cc: New file.
13088         * testsuite/ver_test_5.script: New file.
13089         * testsuite/ver_test_5.sh: New file.
13090         * Makefile.in, testsuite/Makefile.in: Rebuild.
13091
13092         PR gold/5986
13093         Fix problems building gold with gcc 4.3.0.
13094         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13095         (gold_error_at_location, gold_warning_at_location): Use it.
13096         * configure.ac: Check whether we can compile and use a template
13097         function with a printf attribute.
13098         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13099         when jumping over bytes.
13100         * object.cc: Instantiate Object::read_section_data.
13101         * debug.h: Include <cstring>
13102         * dwarf_reader.cc: Include <algorithm>
13103         * main.cc: Include <cstring>.
13104         * options.cc: Include <cstring>.
13105         * output.cc: Include <cstring>.
13106         * script.cc: Include <cstring>.
13107         * script.h: Include <string>.
13108         * symtab.cc: Include <cstring> and <algorithm>.
13109         * target-select.cc: Include <cstring>.
13110         * version.cc: Include <string>.
13111         * testsuite/testmain.cc: Include <cstdlib>.
13112         * configure, config.in: Rebuild.
13113
13114 2008-03-25  Ian Lance Taylor  <iant@google.com>
13115
13116         * options.cc: Include "../bfd/bfdver.h".
13117         (options::help): Print bug reporting address.
13118
13119         * version.cc (print_version): Adjust output for current value of
13120         BFD_VERSION_STRING.
13121
13122         * NEWS: New file.
13123
13124         * options.cc (options::help): Print list of supported targets.
13125         * target-select.h: Include <vector>.
13126         (class Target_selector): Make machine_, size_, and is_big_endian_
13127         fields const.  Add bfd_name_ and instantiated_target_ fields.
13128         (Target_selector::Target_selector): Add bfd_name parameter.
13129         (Target_selector::recognize): Make non-virtual, call
13130         do_recognize.
13131         (Target_selector::recognize_by_name): Make non-virtual, call
13132         do_recognize_by_name.
13133         (Target_selector::supported_names): New function.
13134         (Target_selector::bfd_name): New function.
13135         (Target_selector::do_instantiate_target): New pure virtual
13136         function.
13137         (Target_selector::do_recognize): New virtual function.
13138         (Target_selector::do_recognize_by_name): New virtual function.
13139         (Target_selector::instantiate_target): New private function.
13140         (supported_target_names): Declare.
13141         * target-select.cc (Target_selector::Target_selector): Update for
13142         new parameter and fields.
13143         (select_target_by_name): Check that the name matches before
13144         calling recognize_by_name.
13145         (supported_target_names): New function.
13146         * i386.cc (class Target_selector_i386): Update Target_selector
13147         constructor call.  Remove recognize and recognize_by_name.  Add
13148         do_instantiate_target.
13149         * x86_64.cc (class Target_selector_x86_64): Likewise.
13150         * testsuite/testfile.cc (class Target_selector_test): Update for
13151         changes to Target_selector.
13152
13153         * README: Rewrite, with some notes on unsupported features.
13154
13155 2008-03-24  Cary Coutant  <ccoutant@google.com>
13156
13157         * i386.cc (Target_i386::Got_type): New enum declaration.
13158         (Target_i386::Scan::local): Updated callers of Output_data_got
13159         member functions.
13160         (Target_i386::Scan::global): Likewise.
13161         (Target_i386::Relocate::relocate): Likewise.
13162         (Target_i386::Relocate::relocate_tls): Likewise.
13163         * object.h (Got_offset_list): New class.
13164         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13165         (Sized_relobj::local_got_offset): Likewise.
13166         (Sized_relobj::set_local_got_offset): Likewise.
13167         (Sized_relobj::local_has_tls_got_offset): Removed.
13168         (Sized_relobj::local_tls_got_offset): Removed.
13169         (Sized_relobj::set_local_tls_got_offset): Removed.
13170         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13171         * output.cc (Output_data_got::add_global): Added got_type parameter.
13172         (Output_data_got::add_global_with_rel): Likewise.
13173         (Output_data_got::add_global_with_rela): Likewise.
13174         (Output_data_got::add_global_pair_with_rel): New function.
13175         (Output_data_got::add_global_pair_with_rela): New function.
13176         (Output_data_got::add_local): Added got_type parameter.
13177         (Output_data_got::add_local_with_rel): Likewise.
13178         (Output_data_got::add_local_with_rela): Likewise.
13179         (Output_data_got::add_local_pair_with_rel): New function.
13180         (Output_data_got::add_local_pair_with_rela): New function.
13181         (Output_data_got::add_global_tls): Removed.
13182         (Output_data_got::add_global_tls_with_rel): Removed.
13183         (Output_data_got::add_global_tls_with_rela): Removed.
13184         (Output_data_got::add_local_tls): Removed.
13185         (Output_data_got::add_local_tls_with_rel): Removed.
13186         (Output_data_got::add_local_tls_with_rela): Removed.
13187         * output.h (Output_data_got::add_global): Added got_type parameter.
13188         (Output_data_got::add_global_with_rel): Likewise.
13189         (Output_data_got::add_global_with_rela): Likewise.
13190         (Output_data_got::add_global_pair_with_rel): New function.
13191         (Output_data_got::add_global_pair_with_rela): New function.
13192         (Output_data_got::add_local): Added got_type parameter.
13193         (Output_data_got::add_local_with_rel): Likewise.
13194         (Output_data_got::add_local_with_rela): Likewise.
13195         (Output_data_got::add_local_pair_with_rel): New function.
13196         (Output_data_got::add_local_pair_with_rela): New function.
13197         (Output_data_got::add_global_tls): Removed.
13198         (Output_data_got::add_global_tls_with_rel): Removed.
13199         (Output_data_got::add_global_tls_with_rela): Removed.
13200         (Output_data_got::add_local_tls): Removed.
13201         (Output_data_got::add_local_tls_with_rel): Removed.
13202         (Output_data_got::add_local_tls_with_rela): Removed.
13203         * resolve.cc (Symbol::override_base_with_special): Removed
13204         reference to has_got_offset_ field.
13205         * symtab.cc (Symbol::init_fields): Replaced initialization
13206         of got_offset_ with got_offsets_.  Removed initialization
13207         of has_got_offset_
13208         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13209         (Symbol::got_offset): Likewise.
13210         (Symbol::set_got_offset): Likewise.
13211         (Symbol::has_tls_got_offset): Removed.
13212         (Symbol::tls_got_offset): Removed.
13213         (Symbol::set_tls_got_offset): Removed.
13214         (Symbol::got_offset_): Removed.
13215         (Symbol::tls_mod_got_offset_): Removed.
13216         (Symbol::tls_pair_got_offset_): Removed.
13217         (Symbol::got_offsets_): New field.
13218         (Symbol::has_got_offset): Removed.
13219         (Symbol::has_tls_mod_got_offset): Removed.
13220         (Symbol::has_tls_pair_got_offset): Removed.
13221         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13222         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13223         member functions.
13224         (Target_x86_64::Scan::global): Likewise.
13225         (Target_x86_64::Relocate::relocate): Likewise.
13226         (Target_x86_64::Relocate::relocate_tls): Likewise.
13227
13228 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13229
13230         * yyscript.y: Fix spelling error in comment.
13231
13232 2008-03-24  Ian Lance Taylor  <iant@google.com>
13233
13234         * options.h (class General_options): Define build_id option.
13235         * layout.h (class Layout): Declare write_build_id, create_note,
13236         create_build_id.  Add build_id_note_ member.
13237         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13238         "libiberty.h", "md5.h", "sha1.h".
13239         (Layout::Layout): Initialize eh_frame_data_,
13240         eh_frame_hdr_section_, and build_id_note_.
13241         (Layout::finalize): Call create_build_id.
13242         (Layout::create_note): New function, broken out of
13243         Layout::create_gold_note.
13244         (Layout::create_gold_note): Call create_note.
13245         (Layout::create_build_id): New function.
13246         (Layout::write_build_id): New function.
13247         (Close_task_runner::run): Call write_build_id.
13248
13249         * x86_64.cc: Correct license to GPLv3.
13250
13251 2008-03-23  Ian Lance Taylor  <iant@google.com>
13252
13253         * options.cc: Include "demangle.h".
13254         (parse_optional_string): New function.
13255         (parse_long_option): Handle takes_optional_argument.
13256         (parse_short_option): Update dash_z initializer.  Handle
13257         takes_optional_argument.
13258         (General_options::General_options): Initialize do_demangle_.
13259         (General_options::finalize): Set do_demangle_.  Handle demangling
13260         style.
13261         * options.h (parse_optional_string): Declare.
13262         (struct One_option): Add optional_arg field.  Update constructor.
13263         Update call constructor calls.  Add takes_optional_argument
13264         function.
13265         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13266         (DEFINE_optional_string): Define.
13267         (General_options::demangle): Change from DEFINE_bool to
13268         DEFINE_optional_string.
13269         (General_options::no_demangle): New function.
13270         (General_options::do_demangle): New function.
13271         (General_options::set_do_demangle): New function.
13272         (General_options::execstack_status_): Move definition to end of
13273         class definition.
13274         (General_options::static_): Likewise.
13275         (General_options::do_demangle_): New field.
13276         * object.cc (big_endian>::get_symbol_location_info): Call
13277         Options::do_demangle, not Options::demangle.
13278         * symtab.cc (demangle): Likewise.
13279
13280 2008-03-22  Ian Lance Taylor  <iant@google.com>
13281
13282         * gold.h: Include <cstddef> and <sys/types.h>
13283         * options.h: Include <cstring>.
13284
13285 2008-03-21  Ian Lance Taylor  <iant@google.com>
13286
13287         * Added source code to GNU binutils.