gold/
[external/binutils.git] / gold / ChangeLog
1 2012-05-23  Cary Coutant  <ccoutant@google.com>
2
3         * layout.cc (Layout::section_name_mapping): Add rules to handle
4         exact match on .data.rel.ro.local or .data.rel.ro.
5         (Layout::output_section_name): Check for exact matches.
6
7 2012-05-23  Cary Coutant  <ccoutant@google.com>
8
9         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
10         more carefully.
11
12 2012-05-22  Cary Coutant  <ccoutant@google.com>
13
14         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
15         object before exporting symbol.
16
17 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
18
19         * testsuite/tls_test.cc: Include "config.h" first.
20         * testsuite/tls_test_c.c: Likewise.
21
22 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
23             Nick Clifton  <nickc@redhat.com>
24
25         PR 14072
26         * configure.in: Add check that sysdep.h has been included before
27         any system header files.
28         * configure: Regenerate.
29         * config.in: Regenerate.
30
31 2012-05-14  Cary Coutant  <ccoutant@google.com>
32
33         * layout.cc (Layout::make_output_section): Mark .tdata section
34         as RELRO.
35         * testsuite/relro_test.cc: Add a TLS variable.
36
37 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
38
39         PR gold/14091
40         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
41         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
42         R_X86_64_64.
43
44 2012-05-08  Cary Coutant  <ccoutant@google.com>
45
46         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
47         (lines_only_debug_sections): Likewise.
48
49 2012-05-02  Roland McGrath  <mcgrathr@google.com>
50
51         * nacl.cc: New file.
52         * nacl.h: New file.
53         * Makefile.am (CCFILES, HFILES): Add them.
54         * Makefile.in: Regenerate.
55         * i386.cc (Output_data_plt_i386_nacl): New class.
56         (Output_data_plt_i386_nacl_exec): New class.
57         (Output_data_plt_i386_nacl_dyn): New class.
58         (Target_i386_nacl): New class.
59         (Target_selector_i386_nacl): New class.
60         (target_selector_i386): Use it instead of Target_selector_i386.
61         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
62         (Target_x86_64_nacl): New class.
63         (Target_selector_x86_64_nacl): New class.
64         (target_selector_x86_64, target_selector_x32): Use it instead of
65         Target_selector_x86_64.
66         * arm.cc (Output_data_plt_arm_nacl): New class.
67         (Target_arm_nacl): New class.
68         (Target_selector_arm_nacl): New class.
69         (target_selector_arm, target_selector_armbe): Use it instead of
70         Target_selector_arm.
71
72         * target-select.cc (select_target): Take new Input_file* and off_t
73         arguments, pass them on to recognize method of selector.
74         * object.cc (make_elf_sized_object): Update caller.
75         * parameters.cc (parameters_force_valid_target): Likewise.
76         * incremental.cc (make_sized_incremental_binary): Likewise.
77         * target-select.h: Update decl.
78         (Target_selector::recognize): Take new Input_file* argument,
79         pass it on to do_recognize.
80         (Target_selector::do_recognize): Take new Input_file* argument.
81         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
82         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
83         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
84         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
85
86         * target.h (Target::Target_info): New members isolate_execinstr
87         and rosegment_gap.
88         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
89         * arm.cc (Target_arm::arm_info): Update initializer.
90         * i386.cc (Target_i386::i386_info): Likewise.
91         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
92         * sparc.cc (Target_sparc::sparc_info): Likewise.
93         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
94         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
95         * layout.cc (Layout::attach_allocated_section_to_segment):
96         Take new const Target* argument.  If target->isolate_execinstr(), act
97         like --rosegment.
98         (Layout::find_first_load_seg): Take new const Target* argument;
99         if target->isolate_execinstr(), reject PF_X segments.
100         (Layout::relaxation_loop_body): Update caller.
101         (Layout::set_segment_offsets): If target->isolate_execinstr(),
102         reset file offset to zero when we hit LOAD_SEG, and then do a second
103         loop over the segments before LOAD_SEG to reassign offsets after
104         addresses have been determined.  Handle target->rosegment_gap().
105         (Layout::attach_section_to_segment): Take new const Target* argument;
106         pass it to attach_allocated_section_to_segment.
107         (Layout::make_output_section): Update caller.
108         (Layout::attach_sections_to_segments): Take new const Target* argument;
109         pass it to attach_section_to_segment.
110         * gold.cc (queue_middle_tasks): Update caller.
111         * layout.h (Layout): Update method decls with new arguments.
112
113         * arm.cc (Target_arm::Target_arm): Take optional argument for the
114         Target_info pointer to use.
115         (Target_arm::do_make_data_plt): New virtual method.
116         (Target_arm::make_data_plt): New method that calls it.
117         (Target_arm::make_plt_entry): Use it.
118         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
119         for the section alignment.
120         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
121         method.
122         (Output_data_plt_arm::first_plt_entry_offset): Call it.
123         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
124         method.
125         (Output_data_plt_arm::get_plt_entry_size): Call it.
126         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
127         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
128         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
129         method.
130         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
131         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
132         method instead of sizeof(plt_entry).
133         (Output_data_plt_arm::add_entry): Likewise.
134         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
135         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
136         than static method.
137         (Target_arm::plt_entry_size): Likewise.
138         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
139         Move to ...
140         (Output_data_plt_arm_standard): ... here, new class.
141         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
142         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
143         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
144
145         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
146         Take additional argument for the PLT entry size.
147         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
148         Use get_plt_entry_size method rather than plt_entry_size variable.
149         (Output_data_plt_x86_64::reserve_slot): Likewise.
150         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
151         (Output_data_plt_x86_64::add_entry): Likewise.
152         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
153         (Output_data_plt_x86_64::address_for_global): Likewise.
154         (Output_data_plt_x86_64::address_for_local): Likewise.
155         (Output_data_plt_x86_64::set_final_data_size): Likewise.
156         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
157         Make method non-static.
158         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
159         method.
160         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
161         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
162         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
163         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
164         virtual method.
165         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
166         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
167         virtual method.
168         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
169         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
170         virtual method.
171         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
172         (Output_data_plt_x86_64::plt_entry_size)
173         (Output_data_plt_x86_64::first_plt_entry)
174         (Output_data_plt_x86_64::plt_entry)
175         (Output_data_plt_x86_64::tlsdesc_plt_entry)
176         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
177         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
178         (Output_data_plt_x86_64_standard): ... here, new class.
179         (Target_x86_64::Target_x86_64): Take optional argument for the
180         Target_info pointer to use.
181         (Target_x86_64::do_make_data_plt): New virtual method.
182         (Target_x86_64::make_data_plt): New method to call it.
183         (Target_x86_64::init_got_plt_for_update): Use that.
184         Call this->plt_->add_eh_frame method here.
185         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
186         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
187         rather than static method.
188         (Target_x86_64::plt_entry_size): Likewise.
189         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
190         rather than plt_entry_size variable.  Move guts of PLT filling to...
191         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
192         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
193         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
194
195         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
196         additional argument for the section alignment.
197         Don't do add_eh_frame_for_plt here.
198         (Output_data_plt_i386::first_plt_entry_offset): Make the method
199         non-static.  Use get_plt_entry_size method rather than plt_entry_size
200         variable.
201         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
202         method.
203         (Output_data_plt_i386::get_plt_entry_size): Call it.
204         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
205         (Output_data_plt_i386::add_eh_frame): New method to call it.
206         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
207         method.
208         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
209         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
210         method.
211         (Output_data_plt_i386::fill_plt_entry): New method to call it.
212         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
213         method instead of plt_entry_size.
214         (Output_data_plt_i386::plt_entry_size)
215         (Output_data_plt_i386::plt_eh_frame_fde_size)
216         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
217         (Output_data_plt_i386_standard): ... here, new class.
218         (Output_data_plt_i386_exec): New class.
219         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
220         (Output_data_plt_i386_exec::first_plt_entry): ... here.
221         (Output_data_plt_i386::exec_plt_entry): Move to ...
222         (Output_data_plt_i386_exec::plt_entry): ... here.
223         (Output_data_plt_i386_dyn): New class.
224         (Output_data_plt_i386::first_plt_entry): Move to ...
225         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
226         (Output_data_plt_i386::dyn_plt_entry): Move to ...
227         (Output_data_plt_i386_dyn::plt_entry): ... here.
228         (Target_i386::Target_i386): Take optional argument for the Target_info
229         pointer to use.
230         (Target_i386::do_make_data_plt): New virtual method.
231         (Target_i386::make_data_plt): New method to call it.
232         (Target_i386::make_plt_section): Use that.
233         Call this->plt_->add_eh_frame method here.
234         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
235         rather than plt_entry_size variable.
236         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
237         (Output_data_plt_i386::address_for_local): Likewise.
238         (Output_data_plt_i386::do_write): Likewise.
239         Move guts of PLT filling to...
240         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
241         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
242         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
243         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
244
245 2012-05-01  Cary Coutant  <ccoutant@google.com>
246
247         * dwarf_reader.cc (Dwarf_die::read_attributes)
248         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
249         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
250         * reduced_debug_output.cc
251         (Output_reduced_debug_info_section::get_die_end): Remove
252         DW_FORM_GNU_ref_index.  Add default case.
253
254 2012-04-26  Mark Wielaard  <mjw@redhat.com>
255
256         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
257         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
258         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
259         DW_AT_high_pc as offset from DW_AT_low_pc.
260
261         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
262         * testsuite/Makefile.in: Regenerate.
263         * testsuite/gdb_index_test_3.c: New test source file.
264         * testsuite/gdb_index_test_3.sh: New test source file.
265
266 2012-04-25  Ian Lance Taylor  <iant@google.com>
267
268         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
269         pointer.
270         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
271         as a class, not a struct.
272         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
273         (Target_arm::apply_cortex_a8_workaround): Likewise.
274         * gc.h: Declare Reloc_types as a struct, not a class.
275         * object.h: Declare Symbols_data as a struct.
276         * reloc.h: Declare Read_relocs_data as a struct.
277         * target.h: Declare Relocate_info as a struct.
278
279 2012-04-24  David S. Miller  <davem@davemloft.net>
280
281         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
282         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
283         and R_SPARC_WPLT30.
284
285 2012-04-24  Cary Coutant  <ccoutant@google.com>
286
287         * incremental-dump.cc (find_input_containing_global): Replace
288         magic number with symbolic constant.
289         (dump_incremental_inputs): Update version number.
290         * incremental.cc (Output_section_incremental_inputs): Update version
291         number; import symbolic constants from Incremental_inputs_reader.
292         (Incremental_inputs::create_data_sections): Align relocations
293         section correctly for 64-bit targets.
294         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
295         constants; add padding.
296         (Output_section_incremental_inputs::write_header): Add assert for
297         header_size.
298         (Output_section_incremental_inputs::write_input_files): Add assert
299         for input_entry_size.
300         (Output_section_incremental_inputs::write_info_blocks): Add padding;
301         add assert for object_info_size, input_section_entry_size,
302         global_sym_entry_size.
303         * incremental.h (Incremental_inputs_reader): Add symbolic constants
304         for data structure sizes; use them.
305         (Incremental_input_entry_reader): Import symbolic constants from
306         Incremental_inputs_reader; use them.
307
308 2012-04-23  David S. Miller  <davem@davemloft.net>
309
310         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
311         and elf_flags_set_.
312         (Target_sparc::Target_sparc): Initialize new fields.
313         (Target_sparc::do_make_elf_object): New function.
314         (Target_sparc::do_adjust_elf_header): New function.
315
316 2012-04-23  Cary Coutant  <ccoutant@google.com>
317
318         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
319         CU range table of gdb index.
320
321 2012-04-20  David S. Miller  <davem@davemloft.net>
322
323         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
324         instead of false.
325
326 2012-04-16  David S. Miller  <davem@davemloft.net>
327
328         * sparc.cc (Target_sparc::got_address): New function.
329         (Sparc_relocate_functions::gdop_hix22): New function.
330         (Sparc_relocate_functions::gdop_lox10): New function.
331         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
332         relocs.
333         (Target_sparc::Scan::local): Likewise if the global symbol is not
334         preemptible and is not IFUNC.
335         (Target_sparc::Relocate::relocate): Perform GOTDATA code
336         transformations for local and non-preemptible non-IFUNC global
337         symbols.
338
339         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
340         writing out 64-bit part of ranges.
341
342         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
343         -fpic and -fpie respectively.
344         * Makefile.in: Regenerate.
345
346         * sparc.cc (class Target_sparc): Add rela_ifunc_.
347         (Target_sparc::Target_sparc): Initialize new field.
348         (Target_sparc::do_plt_section_for_global): New function.
349         (Target_sparc::do_plt_section_for_local): New function.
350         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
351         (Target_sparc::make_plt_section): New function, broken out of
352         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
353         (Target_sparc::make_plt_entry): Call make_plt_section.
354         (Target_sparc::make_local_ifunc_plt_entry): New function.
355         (Target_sparc::rela_ifunc_section): New function.
356         (Target_sparc::plt_section): Remove const.
357         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
358         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
359         and ifunc_count_ fields.
360         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
361         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
362         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
363         (Output_data_plt_sparc::rela_ifunc): New function.
364         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
365         (Output_data_plt_sparc::has_ifunc_section): New function.
366         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
367         (Output_data_plt_sparc::address_for_global): New function.
368         (Output_data_plt_sparc::address_for_local): New function.
369         (Output_data_plt_sparc::plt_index_to_offset): New function.
370         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
371         and entry_count.
372         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
373         entry_count.
374         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
375         R_SPARC_JMP_IREL to switch.
376         (Target_sparc::Scan::check_non_pic): Likewise.
377         (Target_sparc::Scan::local): Handle IFUNC symbols.
378         (Target_sparc::Scan::local): Likewise.
379         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
380         and plt_address_for_local.
381         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
382         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
383
384         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
385         (class Output_data_reloc): Adjust calls to Output_reloc_type.
386         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
387         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
388         global relocs too.
389         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
390         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
391         calls.
392         * sparc.cc (Target_sparc::Scan::global): Likewise.
393         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
394
395 2012-04-16  Cary Coutant  <ccoutant@google.com>
396
397         * archive.cc (Library_base::should_include_member): Check for
398         --export-dynamic-symbol.
399         * options.h (class General_options): Add --export-dynamic-symbol.
400         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
401         --export-dynamic-symbol.
402         (Symbol_table::gc_mark_undef_symbols): Likewise.
403         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
404
405 2012-04-12  David S. Miller  <davem@davemloft.net>
406
407         * sparc.cc (Reloc::wdisp10): New relocation method.
408         (Reloc::h34): Likewise.
409         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
410         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
411         R_SPARC_WDISP10.
412         (Target_sparc::Scan::local): Likewise.
413         (Target_sparc::Scan::global): Likewise.
414         (Target_sparc::Relocate::relocate): Likewise.
415
416 2012-04-09  Cary Coutant  <ccoutant@google.com>
417
418         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
419         low_pc == 0.
420
421 2012-04-06  Ian Lance Taylor  <iant@google.com>
422
423         * timer.cc: #include <unistd.h>.
424
425 2012-04-06  Roland McGrath  <mcgrathr@google.com>
426
427         * configure.in (AC_CHECK_HEADERS): Add locale.h.
428         * config.in: Regenerate.
429         * configure: Regenerate.
430
431 2012-04-05  Nick Clifton  <nickc@redhat.com>
432
433         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
434         (AM_LC_MESSAGES): Add.
435         * aclocal.m4: Regenerate.
436         * config.in: Regenerate.
437         * configure: Regenerate.
438
439 2012-03-21  Cary Coutant  <ccoutant@google.com>
440
441         * Makefile.am: Add gdb-index.cc, gdb-index.h.
442         * Makefile.in: Regenerate.
443         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
444         (Sized_elf_reloc_mapper::symbol_section): New function.
445         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
446         (make_elf_reloc_mapper): New function.
447         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
448         (Dwarf_abbrev_table::do_read_abbrevs): New function.
449         (Dwarf_abbrev_table::do_get_abbrev): New function.
450         (Dwarf_ranges_table::read_ranges_table): New function.
451         (Dwarf_ranges_table::read_range_list): New function.
452         (Dwarf_pubnames_table::read_section): New function.
453         (Dwarf_pubnames_table::read_header): New function.
454         (Dwarf_pubnames_table::next_name): New function.
455         (Dwarf_die::Dwarf_die): New function.
456         (Dwarf_die::read_attributes): New function.
457         (Dwarf_die::skip_attributes): New function.
458         (Dwarf_die::set_name): New function.
459         (Dwarf_die::set_linkage_name): New function.
460         (Dwarf_die::attribute): New function.
461         (Dwarf_die::string_attribute): New function.
462         (Dwarf_die::int_attribute): New function.
463         (Dwarf_die::uint_attribute): New function.
464         (Dwarf_die::ref_attribute): New function.
465         (Dwarf_die::child_offset): New function.
466         (Dwarf_die::sibling_offset): New function.
467         (Dwarf_info_reader::check_buffer): New function.
468         (Dwarf_info_reader::parse): New function.
469         (Dwarf_info_reader::do_parse): New function.
470         (Dwarf_info_reader::do_read_string_table): New function.
471         (Dwarf_info_reader::lookup_reloc): New function.
472         (Dwarf_info_reader::get_string): New function.
473         (Dwarf_info_reader::visit_compilation_unit): New function.
474         (Dwarf_info_reader::visit_type_unit): New function.
475         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
476         Sized_elf_reloc_mapper.
477         (Sized_dwarf_line_info::symbol_section): Remove function.
478         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
479         (Sized_dwarf_line_info::read_line_mappings): Remove object
480         parameter, adjust callers.
481         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
482         * dwarf_reader.h: Include <sys/types.h>.
483         (class Track_relocs): Remove forward declaration.
484         (class Elf_reloc_mapper): New class.
485         (class Sized_elf_reloc_mapper): New class.
486         (class Dwarf_abbrev_table): New class.
487         (class Dwarf_range_list): New class.
488         (class Dwarf_ranges_table): New class.
489         (class Dwarf_pubnames_table): New class.
490         (class Dwarf_die): New class.
491         (class Dwarf_info_reader): New class.
492         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
493         (Sized_dwarf_line_info::symbol_section): Remove member function.
494         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
495         base class.
496         * gdb-index.cc: New source file.
497         * gdb-index.h: New source file.
498         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
499         and .debug_types sections, call Layout::add_to_gdb_index.
500         (Sized_relobj_incr::do_section_name): Implement.
501         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
502         return type; Implement.
503         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
504         return type.
505         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
506         parameter list and return type.
507         (Sized_incr_dynobj::do_section_contents): Likewise.
508         * layout.cc: Include gdb-index.h.
509         (Layout::Layout): Initialize gdb_index_data_.
510         (Layout::init_fixed_output_section): Check for .gdb_index section.
511         (Layout::add_to_gdb_index): New function. Instantiate.
512         * layout.h: Add forward declaration for class Gdb_index.
513         (Layout::add_to_gdb_index): New member function.
514         (Layout::gdb_index_data_): New data member.
515         * main.cc: Include gdb-index.h.
516         (main): Print statistics for gdb index.
517         * object.cc (Object::section_contents): Move code into
518         do_section_contents.
519         (need_decompressed_section): Check for sections needed when building
520         gdb index.
521         (build_compressed_section_map): Likewise.
522         (Sized_relobj_file::do_read_symbols): Need local symbols when building
523         gdb index.
524         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
525         sections; call Layout::add_to_gdb_index.
526         (Sized_relobj_file::do_decompressed_section_contents): Call
527         do_section_contents directly.
528         * object.h (Object::do_section_contents): Adjust parameter list and
529         return type.
530         (Object::do_decompressed_section_contents): Call do_section_contents
531         directly.
532         (Sized_relobj_file::do_section_contents): Adjust parameter list and
533         return type.
534         * options.h (class General_options): Add --gdb-index option.
535         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
536         list and return type.
537         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
538         * reloc.h (Track_relocs::checkpoint): New function.
539         (Track_relocs::reset): New function.
540
541         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
542         New test cases.
543         * testsuite/Makefile.in: Regenerate.
544         * testsuite/gdb_index_test.cc: New test source file.
545         * testsuite/gdb_index_test_1.sh: New test source file.
546         * testsuite/gdb_index_test_2.sh: New test source file.
547
548 2012-03-19  Doug Kwan  <dougkwan@google.com>
549
550         * arm.cc (Target_arm::do_define_standard_symbols): New method.
551         (Target_arm::do_finalize_sections): Remove code which defines
552         __exidx_start and __exidx_end.  Make symbol table parameter
553         anonymous as it is not used.
554         * gold.cc (queue_middle_tasks): Call target hook to define any
555         target-specific symbols.
556         * target.h (Target::define_standard_symbols): New method.
557         (Target::do_define_standard_symbols): Same.
558         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
559         * testsuite/Makefile.in: Regenerate.
560         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
561         and __exidx_end.
562         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
563         relocations are generated for __exidx_start and __exidx_end.
564
565 2012-03-16  Doug Kwan  <dougkwan@google.com>
566
567         * testsuite/Makefile.am: Disable test initpri3b.
568         * testsuite/Makefile.in: Regenerate.
569
570 2012-03-15  Doug Kwan  <dougkwan@google.com>
571
572         * arm.cc (Target_arm::got_section): Make .got section read-only
573         if -z now is given.
574
575 2012-03-15  Ian Lance Taylor  <iant@google.com>
576
577         PR gold/13850
578         * layout.cc (Layout::make_output_section): Correctly mark
579         SHT_INIT_ARRAY, et. al., as relro.
580
581 2012-03-14  Doug Kwan  <dougkwan@google.com>
582
583         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
584         dynamic relocations for protected symbols in shared objects.
585
586 2012-03-13  Ian Lance Taylor  <iant@google.com>
587
588         * resolve.cc (Symbol_table::resolve): When merging common symbols,
589         keep the larger alignment.
590
591 2012-03-12  Cary Coutant  <ccoutant@google.com>
592
593         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
594         handling of DW_LNE_define_file.
595
596 2012-03-12  Cary Coutant  <ccoutant@google.com>
597
598         * reduced_debug_output.cc
599         (Output_reduced_debug_info_section::get_die_end): Add new FORM
600         codes to switch.
601
602 2012-02-29  Cary Coutant  <ccoutant@google.com>
603
604         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
605
606 2012-02-29  Cary Coutant  <ccoutant@google.com>
607
608         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
609         Call Object::decompressed_section_contents.
610         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
611         New dtor.
612         (Sized_dwarf_line_info::buffer_start_): New data member.
613         * merge.cc (Output_merge_data::do_add_input_section): Call
614         Object::decompressed_section_contents.
615         (Output_merge_string::do_add_input_section): Likewise.
616         * object.cc (need_decompressed_section): New function.
617         (build_compressed_section_map): Decompress sections needed later.
618         (Sized_relobj_file::do_decompressed_section_contents): New function.
619         (Sized_relobj_file::do_discard_decompressed_sections): New function.
620         * object.h (Object::decompressed_section_contents): New function.
621         (Object::discard_decompressed_sections): New function.
622         (Object::do_decompressed_section_contents): New function.
623         (Object::do_discard_decompressed_sections): New function.
624         (Compressed_section_info): New type.
625         (Compressed_section_map): Include decompressed section contents.
626         (Sized_relobj_file::do_decompressed_section_contents): New function.
627         (Sized_relobj_file::do_discard_decompressed_sections): New function.
628
629 2012-02-16  Cary Coutant  <ccoutant@google.com>
630
631         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
632         * testsuite/Makefile.in: Regenerate.
633
634 2012-02-14  Cary Coutant  <ccoutant@google.com>
635
636         * options.cc (General_options::finalize): Disallow -pie and -static.
637
638 2012-02-03  Doug Kwan  <dougkwan@google.com>
639
640         * arm.cc (Arm_relocate_functions::abs8,
641         Arm_relocate_functions::abs16): Use
642         Bits::has_signed_unsigned_overflow32.
643         (Arm_relocate_functions::thm_abs8): Correct range of
644         overflow check.
645         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
646         in assertions.
647
648 2012-02-02  Doug Kwan  <dougkwan@google.com>
649
650         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
651         position independent outputs, not just shared objects.
652
653 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
654
655         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
656         * configure: Regenerated.
657
658 2012-01-27  Ian Lance Taylor  <iant@google.com>
659
660         * reloc.h (Bits): New class with static functions, copied from
661         namespace utils in arm.cc.
662         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
663         instead.
664
665 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
666
667         * incremental.cc (write_info_blocks): Correct relocation offset.
668
669 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
670
671         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
672         (Relocate::tls_gd_to_le): Likewise.
673
674 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
675
676         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
677
678 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
679
680         * configure.ac: Check if -mcmodel=medium works.
681         * configure: Regenerated.
682
683 2012-01-24  Cary Coutant  <ccoutant@google.com>
684
685         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
686         definition and ...
687         (read_unsigned_LEB_128_x): ... this new function.
688         (read_signed_LEB_128): Replaced with inline definition and ...
689         (read_signed_LEB_128_x): ... this new function.
690         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
691         (read_unsigned_LEB_128): Add inline definition.
692         (read_signed_LEB_128_x): New function.
693         (read_signed_LEB_128): Add inline definition.
694         * testsuite/Makefile.am (leb128_unittest): New unit test.
695         * testsuite/Makefile.in: Regenerate.
696         * testsuite/leb128_unittest.cc: New unit test.
697
698 2012-01-23  Ian Lance Taylor  <iant@google.com>
699
700         PR gold/13617
701         * i386.cc (Target_i386::do_code_fill): When using a jmp
702         instruction, pad with nop instructions.
703         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
704
705 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
706
707         * x86_64.cc (gc_process_relocs): Add typename on types used in
708         template.
709         (scan_relocs): Likewise.
710         (relocate_section): Likewise.
711         (apply_relocation): Likewise.
712
713 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
714
715         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
716         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
717         under x32.
718
719 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
720
721         * x86_64.cc: Initial support for x32.
722
723 2012-01-03  Cary Coutant  <ccoutant@google.com>
724
725         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
726         Use abstract base class for GOT.
727         * gold/output.h (class Output_data_got_base): New abstract base class.
728         (class Output_data_got): Derive from new base class, adjust ctors.
729         (Output_data_got::reserve_slot): Make virtual; rename to
730         do_reserve_slot; Adjust callers.
731         * gold/target.h (Sized_target::init_got_plt_for_update): Return
732         pointer to abstract base class.
733         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
734
735 2011-12-18  Ian Lance Taylor  <iant@google.com>
736
737         * object.h (Relobj::local_symbol_value): New function.
738         (Relobj::local_plt_offset): New function.
739         (Relobj::local_has_got_offset): New function.
740         (Relobj::local_got_offset): New function.
741         (Relobj::set_local_got_offset): New function.
742         (Relobj::do_local_symbol_value): New pure virtual function.
743         (Relobj::do_local_plt_offset): Likewise.
744         (Relobj::do_local_has_got_offset): Likewise.
745         (Relobj::do_local_got_offset): Likewise.
746         (Relobj::do_set_local_got_offset): Likewise.
747         (Sized_relobj::do_local_has_got_offset): Rename from
748         local_has_got_offset.
749         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
750         (Sized_relobj::do_set_local_got_offset): Rename from
751         set_local_got_offset.
752         (Sized_relobj_file::do_local_plt_offset): Rename from
753         local_plt_offset.
754         (Sized_relobj_file::do_local_symbol_value): New function.
755         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
756         local_plt_offset.
757         * output.cc (Output_data_got::Got_entry::write): Change object to
758         Relobj.  Use local_symbol_value.
759         (Output_data_got::add_global_with_rel): Change rel_dyn to
760         Output_data_reloc_generic*.  Use add_global_generic.
761         (Output_data_got::add_global_with_rela): Remove.  Change all
762         callers to use add_global_with_rel.
763         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
764         Output_data_reloc_generic*.  Use add_global_generic.
765         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
766         callers to use add_global_pair_with_rel.
767         (Output_data_got::add_local): Change object to Relobj*.
768         (Output_data_got::add_local_plt): Likewise.
769         (Output_data_got::add_local_with_rel): Change object to Relobj*,
770         change rel_dyn to Output_data_reloc_generic*.  Use
771         add_local_generic.
772         (Output_data_got::add_local_with_rela): Remove.  Change all
773         callers to use all_local_with_rel.
774         (Output_data_got::add_local_pair_with_rel): Change object to
775         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
776         add_output_section_generic.
777         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
778         callers to use add_local_pair_with_rel.
779         (Output_data_got::reserve_local): Change object to Relobj*.
780         * output.h: (class Output_data_reloc_generic): Add pure virtual
781         declarations for add_global_generic, add_local_generic,
782         add_output_section_generic.
783         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
784         functions for Output_data_reloc_generic.  Update declarations for
785         changes listed in output.cc.
786         (class Output_data_got): Change template parameter to got_size.
787         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
788         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
789         function.
790         (Sized_relobj_incr::do_local_plt_offset): New function.
791         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
792         add_global_generic.
793
794 2011-12-17  Cary Coutant  <ccoutant@google.com>
795
796         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
797         * resolve.cc (Symbol_table::resolve): Likewise.
798         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
799         arrays.
800         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
801
802 2011-12-16  Ian Lance Taylor  <iant@google.com>
803
804         * output.h (Output_data_reloc_generic::add): Only call
805         add_dynamic_reloc if this is a dynamic reloc section.
806
807 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
808
809         PR gold/13505
810         * target-reloc.h (apply_relocation): Replace <64, false> with
811         <size, big_endian>.
812
813 2011-11-25  Nick Clifton  <nickc@redhat.com>
814
815         * po/it.po: New Italian translation.
816
817 2011-11-17  Sterling Augustine  <saugustine@google.com>
818
819         * script.cc (script_include_directive): Implement.
820         (read_script_file): New local variables name and search_path. Update
821         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
822         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
823         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
824
825 2011-11-11  Sterling Augustine  <saugustine@google.com>
826
827         * yyscript.y (section_cmd): Add support for INCLUDE directive.
828         (file_or_sections_cmd): Likewise.
829
830 2011-11-11  Doug Kwan  <dougkwan@google.com>
831
832         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
833         if --just-symbols is given.
834
835 2011-11-10  Doug Kwan  <dougkwan@google.com>
836
837         PR gold/13362
838         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
839         when processing data relocs.
840         * reloc.h (Relocate_functions::rel_unaligned): New method.
841         (Relocate_functions::pcrel_unaligned): Ditto.
842         (Relocate_functions::rel32_unaligned): Ditto.
843         (Relocate_functions::pcrel32_unaligned): Ditto.
844
845 2011-11-09  Doug Kwan  <dougkwan@google.com>
846
847         PR gold/13362
848         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
849         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
850         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
851         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
852         (Relocate_functions::rel_unaligned): New.
853         (Relocate_functions::rel32_unaligned): New.
854         * target-reloc.h (relocate_for_relocatable): Add code to handle
855         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
856         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
857         arm_unaligned_reloc_r): New targets.
858         * testsuite/Makefile.in: Regenerate.
859         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
860         linking.
861
862 2011-11-02  Ian Lance Taylor  <iant@google.com>
863
864         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
865         NATIVE_LINKER.
866         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
867         * options.cc (General_options::finalize): Use library search path
868         from configure script if specified.  If not native and no sysroot,
869         only search TOOLLIBDIR.
870         * options.h (Search_directory::Search_directory): Change name to
871         const std::string&.
872         (General_options::add_to_library_path_with_sysroot): Change arg to
873         const std::string&.
874         * configure, Makefile.in, config.in: Rebuild.
875
876 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
877
878         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
879         we are working around the ARM1176 Erratum.
880         * options.h (General_options::fix_arm1176): Add option.
881         * testsuite/Makefile.am: Add testcases, and keep current ones
882         working.
883         * testsuite/Makefile.in: Regenerate.
884         * testsuite/arm_fix_1176.s: New file.
885         * testsuite/arm_fix_1176.sh: Likewise.
886
887 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
888
889         * arm.cc (Target_arm::Target_arm): Remove initialisation of
890         may_use_blx_.
891         (Target_arm::may_use_blx): Remove method.
892         (Target_arm::set_may_use_blx): Likewise.
893         (Target_arm::may_use_v4t_interworking): New method.
894         (Target_arm::may_use_v5t_interworking): Likewise.
895         (Target_arm::may_use_blx_): Remove member variable.
896         (Arm_relocate_functions::arm_branch_common): Check for v5T
897         interworking.
898         (Arm_relocate_functions::thumb_branch_common): Likewise.
899         (Reloc_stub::stub_type_for_reloc): Likewise.
900         (Target_arm::do_finalize_sections): Correct interworking checks.
901         * testsuite/Makefile.am: Add new tests.
902         * testsuite/Makefile.in: Regenerate.
903         * testsuite/arm_farcall_arm_arm.s: New test.
904         * testsuite/arm_farcall_arm_arm.sh: Likewise.
905         * testsuite/arm_farcall_arm_thumb.s: Likewise.
906         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
907         * testsuite/arm_farcall_thumb_arm.s: Likewise.
908         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
909         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
910         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
911
912 2011-10-31  Cary Coutant  <ccoutant@google.com>
913
914         PR gold/13023
915         * expression.cc (Expression::eval_with_dot): Add
916         is_section_dot_assignment parameter.
917         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
918         absolute and assigning to dot within a section.
919         * script-sections.cc
920         (Output_section_element_assignment::set_section_addresses): Pass
921         dot_section to set_if_absolute.
922         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
923         as is_section_dot_assignment flag to eval_with_dot.
924         (Output_section_element_dot_assignment::set_section_addresses):
925         Likewise.
926         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
927         parameter.  Also set value if relative to dot_section; set the
928         symbol's output_section.
929         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
930         parameter.  Adjust all callers.
931         (Expression::eval_maybe_dot): Likewise.
932         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
933         Adjust all callers.
934         * testsuite/script_test_2.t: Test assignment of an absolute value
935         to dot within an output section element.
936
937 2011-10-31  Cary Coutant  <ccoutant@google.com>
938
939         * options.h (class General_options): Add --[no-]gnu-unique options.
940         * symtab.cc (Symbol_table::sized_write_globals): Convert
941         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
942
943 2011-10-31  Cary Coutant  <ccoutant@google.com>
944
945         PR gold/13359
946         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
947         unnecessary assertion.
948         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
949
950 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
951
952         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
953         gc_mark_symbol.
954         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
955         gc_mark_symbol.
956         Change to just keep the section associated with symbol.
957         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
958         they are externally visible and --export-dynamic is turned on.
959         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
960
961 2011-10-19  Ian Lance Taylor  <iant@google.com>
962
963         PR gold/13163
964         * script-sections.cc
965         (Output_section_element_dot_assignment::needs_output_section): New
966         function.
967
968 2011-10-19  Ian Lance Taylor  <iant@google.com>
969
970         PR gold/13204
971         * layout.cc (Layout::segment_precedes): Don't assert failure if a
972         --section-start option was seen.
973         * options.h (General_options::any_section_start): New function.
974
975 2011-10-18  David S. Miller  <davem@davemloft.net>
976
977         PR binutils/13301
978         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
979         member to track relocation locations that have moved during TLS
980         reloc optimizations.
981         (Target_sparc::Relocate::Relocate): Initialize to NULL.
982         (Target_sparc::Relocate::relocate): Adjust view down by 4
983         bytes if it matches reloc_adjust_addr_.
984         (Target_sparc::Relocate::relocate_tls): Always move the
985         __tls_get_addr call delay slot instruction forward 4 bytes when
986         performing relaxation.
987
988 2011-10-18  Cary Coutant  <ccoutant@google.com>
989
990         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
991         (Output_file::map_no_anonymous): Check for non-zero
992         return code from posix_fallocate.
993
994 2011-10-17  Cary Coutant  <ccoutant@google.com>
995
996         PR gold/13245
997         * plugin.cc (is_visible_from_outside): Check for symbols
998         referenced from dynamic objects.
999         * resolve.cc (Symbol_table::resolve): Don't count references
1000         from dynamic objects as references from real ELF files.
1001         * testsuite/plugin_test_2.sh: Adjust expected result.
1002
1003 2011-10-17  Cary Coutant  <ccoutant@google.com>
1004
1005         * gold.cc: Include timer.h.
1006         (queue_middle_tasks): Stamp time.
1007         (queue_final_tasks): Likewise.
1008         * main.cc (main): Store timer in parameters.  Print timers
1009         for each pass.
1010         * parameters.cc (Parameters::Parameters): Initialize timer_.
1011         (Parameters::set_timer): New function.
1012         (set_parameters_timer): New function.
1013         * parameters.h (Parameters::set_timer): New function.
1014         (Parameters::timer): New function.
1015         (Parameters::timer_): New data member.
1016         (set_parameters_timer): New function.
1017         * timer.cc (Timer::stamp): New function.
1018         (Timer::get_pass_time): New function.
1019         * timer.h (Timer::stamp): New function.
1020         (Timer::get_pass_time): New function.
1021         (Timer::pass_times_): New data member.
1022
1023 2011-10-17  Cary Coutant  <ccoutant@google.com>
1024
1025         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1026         task for members of lib groups.
1027
1028 2011-10-17  Cary Coutant  <ccoutant@google.com>
1029
1030         PR gold/13288
1031         * fileread.cc (File_read::find_view): Add assert.
1032         (File_read::make_view): Move bounds check (replace with assert)...
1033         (File_read::find_or_make_view): ... to here.
1034
1035 2011-10-12  Cary Coutant  <ccoutant@google.com>
1036
1037         * output.cc (Output_file::open_base_file): Handle case where
1038         ::read returns less than requested size.
1039
1040 2011-10-10  Cary Coutant  <ccoutant@google.com>
1041
1042         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1043         Initialize defined_count_.
1044         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1045         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1046         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1047         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1048         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1049         * incremental.h (Sized_relobj_incr::defined_count_): New data
1050         member.
1051         (Sized_incr_dynobj::defined_count_): New data member.
1052         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1053         Return zeroes instead of internal error.
1054
1055 2011-10-10  Cary Coutant  <ccoutant@google.com>
1056
1057         PR gold/13249
1058         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1059         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1060         * output.h (class Output_reloc): Add use_plt_offset flag.
1061         (Output_reloc::type_): Adjust size of bit field.
1062         (Output_reloc::use_plt_offset_): New bit field.
1063         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1064         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1065         flag.  Adjust all callers.
1066         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1067         creating RELATIVE relocations.
1068
1069 2011-10-10  Nick Clifton  <nickc@redhat.com>
1070
1071         * po/es.po: Updated Spanish translation.
1072         * po/fi.po: Updated Finnish translation.
1073
1074 2011-10-03   Diego Novillo  <dnovillo@google.com>
1075
1076         * options.cc (parse_uint): Fix dereference of RETVAL.
1077
1078 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1079
1080         * layout.h (section_order_map_): New member.
1081         (get_section_order_map): New member function.
1082         * output.cc (Output_section::add_input_section): Check for patterns
1083         only when --section-ordering-file is specified.
1084         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1085         output_sections have been formed.
1086         * layout.cc (Layout_Layout): Initialize section_order_map_.
1087         * plugin.cc (update_section_order): Store order in order_map. Do not
1088         update the order.
1089         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1090         * testsuite/Makefile.in: Regenerate.
1091         * testsuite/plugin_section_order.c: New file.
1092         * testsuite/plugin_final_layout.cc: New file.
1093         * testsuite/plugin_final_layout.sh: New file.
1094
1095 2011-09-29  Cary Coutant  <ccoutant@google.com>
1096
1097         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1098         Check for NULL.
1099         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1100         symbols during incremental update.
1101         (Symbol_table::add_from_dynobj): Likewise.
1102
1103 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1104             Ian Lance Taylor  <iant@google.com>
1105
1106         * symtab.cc (Symbol_table::define_special_symbol): Always
1107         canonicalize version string.
1108
1109 2011-09-26  Cary Coutant  <ccoutant@google.com>
1110
1111         * gold.cc (queue_initial_tasks): Move option checks ...
1112         * options.cc (General_options::finalize): ... to here. Disable
1113         some options; make others fatal.
1114
1115 2011-09-26  Cary Coutant  <ccoutant@google.com>
1116
1117         gcc PR lto/47247
1118         * plugin.cc (get_symbols_v2): New function.
1119         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1120         (is_referenced_from_outside): New function.
1121         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1122         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1123         (get_symbols): Pass version parameter.
1124         (get_symbols_v2): New function.
1125         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1126         parameter.
1127         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1128         (onload): Add LDPT_GET_SYMBOLS_V2.
1129         (all_symbols_read_hook): Use get_symbols_v2; check for
1130         LDPR_PREVAILING_DEF_IRONLY_EXP.
1131         * testsuite/plugin_test_3.sh: Update expected results.
1132
1133 2011-09-23  Simon Baldwin  <simonb@google.com>
1134
1135         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1136         configuration options.
1137         * configure: Regenerate.
1138         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1139         * Makefile.in: Regenerate.
1140         * testsuite/Makefile.in: Regenerate.
1141
1142 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1143
1144         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1145
1146 2011-09-19  Cary Coutant  <ccoutant@google.com>
1147
1148         * incremental.cc (can_incremental_update): Fix typo in comment.
1149         * incremental.h (can_incremental_update): Likewise.
1150
1151 2011-09-18  Cary Coutant  <ccoutant@google.com>
1152
1153         * incremental.cc (can_incremental_update): New function.
1154         * incremental.h (can_incremental_update): New function.
1155         * layout.cc (Layout::init_fixed_output_section): Call it.
1156         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1157         * object.cc (Sized_relobj_file::do_layout): Call
1158         can_incremental_update.
1159
1160 2011-09-13  Cary Coutant  <ccoutant@google.com>
1161
1162         * configure.ac: Check for glibc support for gnu_indirect_function
1163         support with static linking, setting automake conditional
1164         IFUNC_STATIC.
1165         * Makefile.in: Regenerate.
1166         * configure: Regenerate.
1167
1168         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1169         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1170         for IFUNC_STATIC.
1171         * testsuite/Makefile.in: Regenerate.
1172
1173 2011-09-13  Cary Coutant  <ccoutant@google.com>
1174
1175         * incremental.cc (Sized_relobj_incr::do_layout): Call
1176         report_comdat_group for kept comdat sections.
1177         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1178         * testsuite/Makefile.in: Regenerate.
1179         * testsuite/incr_comdat_test_1.cc: New source file.
1180         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1181         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1182         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1183
1184 2011-09-13  Ian Lance Taylor  <iant@google.com>
1185
1186         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1187         variable external_symbols_offset.
1188
1189 2011-09-12  Ian Lance Taylor  <iant@google.com>
1190
1191         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1192         triggered if object has no symbols.
1193
1194 2011-09-09  David S. Miller  <davem@davemloft.net>
1195
1196         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1197         (Output_fill_debug_line::do_write): Likewise.
1198
1199 2011-08-29  Cary Coutant  <ccoutant@google.com>
1200
1201         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1202         casts to match formatting specs.
1203         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1204
1205 2011-08-26  Cary Coutant  <ccoutant@google.com>
1206
1207         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1208         remaining hole size when allocating.
1209         (Layout::make_output_section): Set fill methods for debug sections.
1210         * layout.h (Free_list::Free_list_node): Move from private to
1211         public.
1212         (Free_list::set_min_hole_size): New function.
1213         (Free_list::begin, Free_list::end): New functions.
1214         (Free_list::min_hole_): New data member.
1215         * output.cc: Include dwarf.h.
1216         (Output_fill_debug_info::do_minimum_hole_size): New function.
1217         (Output_fill_debug_info::do_write): New function.
1218         (Output_fill_debug_line::do_minimum_hole_size): New function.
1219         (Output_fill_debug_line::do_write): New function.
1220         (Output_section::Output_section): Initialize new data member.
1221         (Output_section::set_final_data_size): Ensure patch space is larger
1222         than minimum hole size.
1223         (Output_section::do_write): Fill holes in debug sections.
1224         * output.h (Output_fill): New class.
1225         (Output_fill_debug_info): New class.
1226         (Output_fill_debug_line): New class.
1227         (Output_section::set_free_space_fill): New function.
1228         (Output_section::free_space_fill_): New data member.
1229         * testsuite/Makefile.am (incremental_test_3): Add
1230         --incremental-patch option.
1231         (incremental_test_4): Likewise.
1232         (incremental_test_5): Likewise.
1233         (incremental_test_6): Likewise.
1234         (incremental_copy_test): Likewise.
1235         (incremental_common_test_1): Likewise.
1236         * testsuite/Makefile.in: Regenerate.
1237
1238 2011-08-26  Nick Clifton  <nickc@redhat.com>
1239
1240         * po/es.po: Updated Spanish translation.
1241
1242 2011-08-01  Cary Coutant  <ccoutant@google.com>
1243
1244         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1245         * gold/testsuite/Makefile.in: Regenerate.
1246         * gold/testsuite/justsyms_exec.c: New source file.
1247         * gold/testsuite/justsyms_lib.c: New source file.
1248
1249 2011-08-01  Cary Coutant  <ccoutant@google.com>
1250
1251         * layout.cc (Layout::set_segment_offsets): Don't realign text
1252         segment if -Ttext was specified.
1253         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1254         file type.
1255         * object.h (Sized_relobj_file::e_type): New function.
1256         (Sized_relobj_file::e_type_): New data member.
1257         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1258         base address for ET_EXEC files.
1259         * target.cc (Target::do_make_elf_object_implementation): Allow
1260         ET_EXEC files with --just-symbols option.
1261
1262 2011-07-28  Cary Coutant  <ccoutant@google.com>
1263
1264         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1265         Add thread_number parameter.
1266         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1267         * workqueue-threads.cc
1268         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1269         current thread if its thread number is greater than desired thread
1270         count.
1271         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1272         Add thread_number parameter.
1273         (Workqueue::should_cancel_thread): Likewise.
1274         (Workqueue::find_runnable_or_wait): Pass thread_number to
1275         should_cancel_thread.
1276         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1277         parameter.
1278
1279 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1280
1281         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1282         only after checking if it cannot be forced local.
1283         * symtab.h (is_externally_visible): Check if the symbol is not forced
1284         local.
1285
1286 2011-07-15  Ian Lance Taylor  <iant@google.com>
1287
1288         * options.h (class General_options): Add --print-output-format.
1289         Move -EL next to -EB, for  better --help output.
1290         * target-select.cc: Include <cstdio>, "options.h", and
1291         "parameters.h".
1292         (Target_selector::do_target_bfd_name): New function.
1293         (print_output_format): New function.
1294         * target-select.h (class Target_selector): Update declarations.
1295         (Target_selector::target_bfd_name): New function.
1296         (print_output_format): Declare.
1297         * main.cc: Include "target-select.h".
1298         (main): Handle --print-output-format.
1299         * gold.cc: Include "target-select.h".
1300         (queue_initial_tasks): Handle --print-output-format when there are
1301         no input files.
1302         * parameters.cc (parameters_force_valid_target): Give a better
1303         error message if -EB/-EL does not match target.
1304         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1305         function.
1306
1307 2011-07-15  Ian Lance Taylor  <iant@google.com>
1308
1309         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1310         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1311         (Output_data_plt_i386::do_write): Write address of .dynamic
1312         section to first entry in .got.plt section.
1313         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1314         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1315         Initialize layout_.
1316         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1317         section to first entry in .got.plt section.
1318         * layout.h (Layout::dynamic_section): New function.
1319
1320 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1321
1322         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1323         to claim_file call.
1324         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1325         input_section_position_, and input_section_glob_.
1326         (read_layout_from_file): Call function section_ordering_specified.
1327         * layout.h (is_section_ordering_specified): New function.
1328         (section_ordering_specified): New function.
1329         (section_ordering_specified_): New boolean member.
1330         * main.cc(main): Call load_plugins after layout object is defined.
1331         * output.cc (Output_section::add_input_section): Use
1332         function section_ordering_specified to check if section ordering is
1333         needed.
1334         * output.cc (Output_section::add_relaxed_input_section): Use
1335         function section_ordering_specified to check if section ordering is
1336         needed.
1337         (Output_section::update_section_layout): New function.
1338         (Output_section::sort_attached_input_sections): Check if input section
1339         must be reordered.
1340         * output.h (Output_section::update_section_layout): New function.
1341         * plugin.cc (get_section_count): New function.
1342         (get_section_type): New function.
1343         (get_section_name): New function.
1344         (get_section_contents): New function.
1345         (update_section_order): New function.
1346         (allow_section_ordering): New function.
1347         (Plugin::load): Add the new interfaces to the transfer vector.
1348         (Plugin_manager::load_plugins): New parameter.
1349         (Plugin_manager::all_symbols_read): New parameter.
1350         (Plugin_manager::claim_file): New parameter. Save the elf object for
1351         unclaimed objects.
1352         (Plugin_manager::get_elf_object): New function.
1353         (Plugin_manager::get_view): Change to directly use the bool to check
1354         if get_view is called from claim_file_hook.
1355         * plugin.h (input_objects): New function
1356         (Plugin__manager::load_plugins): New parameter.
1357         (Plugin_manager::claim_file): New parameter.
1358         (Plugin_manager::get_elf_object): New function.
1359         (Plugin_manager::in_claim_file_handler): New function.
1360         (Plugin_manager::in_claim_file_handler_): New member.
1361         (layout): New function.
1362         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1363         handler with an extra parameter. Make the elf object before calling
1364         claim_file handler.
1365         * testsuite/plugin_test.c (get_section_count): New function pointer.
1366         (get_section_type): New function pointer.
1367         (get_section_name): New function pointer.
1368         (get_section_contents): New function pointer.
1369         (update_section_order): New function pointer.
1370         (allow_section_ordering): New function pointer.
1371         (onload): Check if the new interfaces exist.
1372
1373 2011-07-13  Ian Lance Taylor  <iant@google.com>
1374
1375         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1376         relro section.
1377         * x86_64.cc (Target_x86_64::got_section): Likewise.
1378         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1379         (relro_now_test_SOURCES): New variable.
1380         (relro_now_test_DEPENDENCIES): New variable.
1381         (relro_now_test_LDFLAGS): New variable.
1382         (relro_now_test_LDADD): New variable.
1383         (relro_now_test.so): New target.
1384         * testsuite/Makefile.in: Rebuild.
1385
1386 2011-07-12  Ian Lance Taylor  <iant@google.com>
1387
1388         PR gold/12980
1389         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1390         GLOB_DAT relocation rather than a RELATIVE relocation for a
1391         protected symbol when creating a shared library.
1392         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1393         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1394         * testsuite/protected_main_1.cc (main): Test that protected
1395         function has same address.
1396
1397 2011-07-11  Ian Lance Taylor  <iant@google.com>
1398
1399         PR gold/12979
1400         * options.h (class General_options): Add -Bgroup.
1401         * options.cc (General_options::finalize): If -Bgroup is set,
1402         default to --unresolved-symbols=report-all.
1403         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1404         * target-reloc.h (issue_undefined_symbol_error): Handle
1405         --unresolved-symbols=report-all.
1406
1407 2011-07-08  Ian Lance Taylor  <iant@google.com>
1408
1409         PR gold/11985
1410         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1411         if linker script discards key sections.
1412         (Layout::create_dynamic_symtab): Likewise.
1413         (Layout::assign_local_dynsym_offsets): Likewise.
1414         (Layout::sized_create_version_sections): Likewise.
1415         (Layout::create_interp): Likewise.
1416         (Layout::finish_dynamic_section): Likewise.
1417         (Layout::set_dynamic_symbol_size): Likewise.
1418
1419 2011-07-08  Ian Lance Taylor  <iant@google.com>
1420
1421         PR gold/12386
1422         * options.h (class General_options): Add --unresolved-symbols.
1423         * target-reloc.h (issue_undefined_symbol_error): Check
1424         --unresolved-symbols.  Add comments.
1425
1426 2011-07-08  Ian Lance Taylor  <iant@google.com>
1427
1428         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1429         expression more complex.
1430
1431 2011-07-08  Ian Lance Taylor  <iant@google.com>
1432
1433         PR gold/11317
1434         * target-reloc.h (issue_undefined_symbol_error): New inline
1435         function, broken out of relocate_section.
1436         (relocate_section): Call issue_undefined_symbol_error.
1437         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1438         there is no TLS segment if we are about to issue an undefined
1439         symbol error.
1440         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1441
1442 2011-07-08  Ian Lance Taylor  <iant@google.com>
1443
1444         PR gold/12279
1445         * resolve.cc (Symbol_table::should_override): Add fromtype
1446         parameter.  Change all callers.  Give error when linking together
1447         TLS and non-TLS symbol.
1448         (Symbol_table::should_override_with_special): Add fromtype
1449         parameter.  Change all callers.
1450         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1451         there is no TLS segment if we have reported some errors.
1452         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1453
1454 2011-07-08  Ian Lance Taylor  <iant@google.com>
1455
1456         PR gold/12372
1457         * target.h (Target::plt_address_for_global): New function.
1458         (Target::plt_address_for_local): New function.
1459         (Target::plt_section_for_global): Remove.
1460         (Target::plt_section_for_local): Remove.
1461         (Target::do_plt_address_for_global): New virtual function.
1462         (Target::do_plt_address_for_local): New virtual function.
1463         (Target::do_plt_section_for_global): Remove.
1464         (Target::do_plt_section_for_local): Remove.
1465         (Target::register_global_plt_entry): Add Symbol_table and Layout
1466         parameters.
1467         * output.cc (Output_data_got::Got_entry::write): Use
1468         plt_address_for_global and plt_address_for_local.
1469         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1470         address of output section.
1471         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1472         got_irelative_, and irelative_count_ fields.  Update
1473         declarations.
1474         (Output_data_plt_i386::has_irelative_section): New function.
1475         (Output_data_plt_i386::entry_count): Add irelative_count_.
1476         (Output_data_plt_i386::set_final_data_size): Likewise.
1477         (class Target_i386): Add got_irelative_ and rel_irelative_
1478         fields.  Update declarations.
1479         (Target_i386::Target_i386): Initialize new fields.
1480         (Target_i386::do_plt_address_for_global): New function replacing
1481         do_plt_section_for_global.
1482         (Target_i386::do_plt_address_for_local): New function replacing
1483         do_plt_section_for_local.
1484         (Target_i386::got_section): Create got_irelative_.
1485         (Target_i386::rel_irelative_section): New function.
1486         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1487         fields.  Don't define __rel_iplt_{start,end}.
1488         (Output_data_plt_i386::add_entry): Add symtab and layout
1489         parameters.  Change all callers.  Use different PLT and GOT for
1490         IFUNC symbols.
1491         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1492         layout parameters.  Change all callers.  Use different PLT and
1493         GOT.
1494         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1495         (Output_data_plt_i386::rel_irelative): New function.
1496         (Output_data_plt_i386::address_for_global): New function.
1497         (Output_data_plt_i386::address_for_local): New function.
1498         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1499         IRELATIVE GOT when changing IFUNC GOT entries.
1500         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1501         reloc.
1502         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1503         if we didn't create an IRELATIVE GOT.
1504         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1505         plt_address_for_local.
1506         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1507         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1508         got_irelative_, and irelative_count_ fields.  Update
1509         declarations.
1510         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1511         Initialize new fields.  Remove symtab parameter.  Change all
1512         callers.
1513         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1514         irelative_count_.
1515         (Output_data_plt_x86_64::has_irelative_section): New function.
1516         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1517         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1518         fields.  Update declarations.
1519         (Target_x86_64::Target_x86_64): Initialize new fields.
1520         (Target_x86_64::do_plt_address_for_global): New function replacing
1521         do_plt_section_for_global.
1522         (Target_x86_64::do_plt_address_for_local): New function replacing
1523         do_plt_section_for_local.
1524         (Target_x86_64::got_section): Create got_irelative_.
1525         (Target_x86_64::rela_irelative_section): New function.
1526         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1527         all callers.  Don't create __rel_iplt_{start,end}.
1528         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1529         parameters.  Change all callers.  Use different PLT and GOT for
1530         IFUNC symbols.
1531         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1532         layout parameters.  Change all callers.  Use different PLT and
1533         GOT.
1534         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1535         parameters.  Change all callers.  Use different PLT and GOT for
1536         IFUNC symbols.
1537         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1538         (Output_data_plt_x86_64::rela_irelative): New function.
1539         (Output_data_plt_x86_64::address_for_global): New function.
1540         (Output_data_plt_x86_64::address_for_local): New function.
1541         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1542         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1543         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1544         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1545         parameters.
1546         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1547         reloc.
1548         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1549         symbols if we didn't create an IRELATIVE GOT.
1550         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1551         plt_address_for_local.
1552         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1553         * testsuite/ifuncvar1.c: New test file.
1554         * testsuite/ifuncvar2.c: New test file.
1555         * testsuite/ifuncvar3.c: New test file.
1556         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1557         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1558         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1559         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1560         * testsuite/Makefile.in: Rebuild.
1561
1562 2011-07-07  Cary Coutant  <ccoutant@google.com>
1563
1564         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1565         (two_file_test_1_ndebug.o): Likewise.
1566         (two_file_test_1b_ndebug.o): Likewise.
1567         (two_file_test_2_ndebug.o): Likewise.
1568         (two_file_test_main_ndebug.o): Likewise.
1569         (incremental_test_2): Link with no-debug versions.
1570
1571 2011-07-06  Cary Coutant  <ccoutant@google.com>
1572
1573         * gold/incremental.cc
1574         (Output_section_incremental_inputs::write_info_blocks): Check for
1575         hidden and internal symbols.
1576
1577 2011-07-06  Cary Coutant  <ccoutant@google.com>
1578
1579         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1580         Check disposition for startup file.
1581         (Incremental_inputs::report_command_line): Ignore
1582         --incremental-startup-unchanged option.
1583         * options.cc (General_options::parse_incremental_startup_unchanged):
1584         New function.
1585         (General_options::General_options): Initialize new data member.
1586         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1587         (General_options): Add --incremental-startup-unchanged option.
1588         (General_options::incremental_startup_disposition): New function.
1589         (General_options::incremental_startup_disposition_): New data member.
1590
1591 2011-07-06  Cary Coutant  <ccoutant@google.com>
1592
1593         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1594         input file index to Script_info ctor.
1595         (Sized_incremental_binary::do_file_has_changed): Find the
1596         command-line argument for files named in scripts.
1597         * incremental.h (Script_info::Script_info): New ctor
1598         with input file index.
1599         (Script_info::input_file_index): New function.
1600         (Script_info::input_file_index_): New data member.
1601         (Incremental_binary::get_library): Add const.
1602         (Incremental_binary::get_script_info): Add const.
1603         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1604         * testsuite/Makefile.am (incremental_test_5): New test case.
1605         (incremental_test_6): New test case.
1606         * testsuite/Makefile.in: Regenerate.
1607
1608 2011-07-06  Cary Coutant  <ccoutant@google.com>
1609
1610         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1611         debug output when command lines differ.
1612
1613 2011-07-06  Cary Coutant  <ccoutant@google.com>
1614
1615         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1616         --incremental-patch option.
1617         * layout.cc (Free_list::allocate): Extend allocation beyond original
1618         end if enabled.
1619         (Layout::make_output_section): Mark sections that should get
1620         patch space.
1621         * options.cc (parse_percent): New function.
1622         * options.h (parse_percent): New function.
1623         (DEFINE_percent): New macro.
1624         (General_options): Add --incremental-patch option.
1625         * output.cc (Output_section::Output_section): Initialize new data
1626         members.
1627         (Output_section::add_input_section): Print section name when out
1628         of patch space.
1629         (Output_section::add_output_section_data): Likewise.
1630         (Output_section::set_final_data_size): Add patch space when
1631         doing --incremental-full.
1632         (Output_section::do_reset_address_and_file_offset): Remove patch
1633         space.
1634         (Output_segment::set_section_list_addresses): Print debug output
1635         only if --incremental-update.
1636         * output.h (Output_section::set_is_patch_space_allowed): New function.
1637         (Output_section::is_patch_space_allowed_): New data member.
1638         (Output_section::patch_space_): New data member.
1639         * parameters.cc (Parameters::incremental_full): New function.
1640         * parameters.h (Parameters::incremental_full): New function
1641         * testsuite/Makefile.am (incremental_test_2): Add test for
1642         --incremental-patch option.
1643         * testsuite/Makefile.in: Regenerate.
1644         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1645         (t18): Remove function body.
1646
1647 2011-07-05  Doug Kwan  <dougkwan@google.com>
1648
1649         PR gold/12771
1650         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1651         Arm_Address type for relocation result.
1652         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1653         overflow check.
1654         (Arm_relocate_functions::abs32): Use unaligned access.
1655         (Arm_relocate_functions::rel32): Ditto.
1656         (Arm_relocate_functions::prel31): Ditto.
1657         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1658         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1659         static data relocations.
1660         * testsuite/Makefile.in: Regnerate.
1661         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1662
1663 2011-07-05  Ian Lance Taylor  <iant@google.com>
1664
1665         PR gold/12392
1666         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1667         symbols if necessary.
1668         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1669
1670 2011-07-05  Ian Lance Taylor  <iant@google.com>
1671
1672         PR gold/12952
1673         * resolve.cc (Symbol::override_base_with_special): Simply override
1674         version with special symbol version, ignoring previous version.
1675
1676 2011-07-05  Ian Lance Taylor  <iant@google.com>
1677
1678         * object.cc (Sized_relobj_file::include_section_group): Add
1679         information to comment about signature location.
1680
1681 2011-07-02  Ian Lance Taylor  <iant@google.com>
1682
1683         PR gold/12957
1684         * options.h (class General_options): Add -f and -F.
1685         * options.cc (General_options::finalize): Fatal error if -f/-F
1686         are used without -shared.
1687         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1688
1689 2011-07-02  Ian Lance Taylor  <iant@google.com>
1690
1691         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1692
1693 2011-07-01  Ian Lance Taylor  <iant@google.com>
1694
1695         PR gold/12525
1696         PR gold/12952
1697         * resolve.cc (Symbol::override_base_with_special): Don't override
1698         the version if the overriding symbol has a different name.
1699         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1700         all callers.  If we give an error about an undefined version,
1701         define the base version if necessary.
1702         * dynobj.h (class Versions): Update declaration.
1703         * testsuite/weak_alias_test_5.cc: New file.
1704         * testsuite/weak_alias_test.script: New file.
1705         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1706         and versioned_alias have the right value, and call t2.
1707         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1708         weak_alias_test_5.so.
1709         (weak_alias_test_LDADD): Likewise.
1710         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1711         * testsuite/Makefile.in: Rebuild.
1712
1713 2011-07-01  Ian Lance Taylor  <iant@google.com>
1714
1715         PR gold/12525
1716         * options.h (class General_options): Support -z notext.
1717         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1718         -Wl,-z,notext.
1719         (two_file_shared_nonpic.so): Likewise.
1720         (two_file_shared_mixed.so): Likewise.
1721         (two_file_shared_mixed_1.so): Likewise.
1722         (weak_undef_lib_nonpic.so): Likewise.
1723         (alt/weak_undef_lib_nonpic.so): Likewise.
1724         (tls_test_shared_nonpic.so): Likewise.
1725         * testsuite/Makefile.in: Rebuild.
1726
1727 2011-07-01  Ian Lance Taylor  <iant@google.com>
1728
1729         PR gold/12525
1730         * configure.ac: Test whether static linking works, setting
1731         the automake conditional HAVE_STATIC.
1732         * testsuite/Makefile.am: Disable tests using -static if
1733         HAVE_STATIC is not true.
1734         * configure, testsuite/Makefile.in: Rebuild.
1735
1736 2011-07-01  Ian Lance Taylor  <iant@google.com>
1737
1738         PR gold/12525
1739         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1740         Assert if we see DW_EH_PE_indirect.
1741         * target.h (Target::ehframe_datarel_base): New function.
1742         (Target::do_ehframe_datarel_base): New target function.
1743         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1744         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1745         function.
1746
1747 2011-07-01  Ian Lance Taylor  <iant@google.com>
1748
1749         PR gold/12571
1750         * options.h (class General_options): Add
1751         --ld-generated-unwind-info.
1752         * ehframe.cc (Fde::write): Add address parameter.  Change all
1753         callers.  If associated with PLT, fill in address and size.
1754         (Cie::set_output_offset): Only add merge mapping if there is an
1755         object.
1756         (Cie::write): Add address parameter.  Change all callers.
1757         (Eh_frame::add_ehframe_for_plt): New function.
1758         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1759         input_offset_ fields into union u_, with new plt field.
1760         (Fde::Fde): Adjust for new union field.
1761         (Fde::Fde) [Output_data version]: New constructor.
1762         (Fde::add_mapping): Only add merge mapping if there is an object.
1763         (class Cie): Update declarations.
1764         (class Eh_frame): Declare add_ehframe_for_plt.
1765         * layout.cc (Layout::layout_eh_frame): Break out code into
1766         make_eh_frame_section, and call it.
1767         (Layout::make_eh_frame_section): New function.
1768         (Layout::add_eh_frame_for_plt): New function.
1769         * layout.h (class Layout): Update declarations.
1770         * merge.cc (Merge_map::add_mapping): Add assertion.
1771         * i386.cc: Include "dwarf.h".
1772         (class Output_data_plt_i386): Make first_plt_entry,
1773         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1774         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1775         and plt_eh_frame_fde.
1776         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1777         boundary.  Call add_eh_frame_for_plt if appropriate.
1778         * x86_64.cc: Include "dwarf.h".
1779         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1780         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1781         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1782         and plt_eh_frame_fde.
1783         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1784         appropriate.
1785
1786 2011-06-29  Ian Lance Taylor  <iant@google.com>
1787
1788         PR gold/12629
1789         * object.cc (Sized_relobj_file::layout_section): Change shdr
1790         parameter to be const.
1791         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1792         out of do_layout.
1793         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1794         appropriate.  Call layout_eh_frame_section.
1795         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1796         sections.
1797         * object.h (class Sized_relobj_file): Update declarations.
1798
1799 2011-06-29  Ian Lance Taylor  <iant@google.com>
1800
1801         PR gold/12652
1802         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1803         modifier.
1804         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1805
1806 2011-06-29  Ian Lance Taylor  <iant@google.com>
1807
1808         PR gold/12675
1809         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1810         SHT_X86_64_UNWIND.
1811         * layout.cc (Layout::layout_eh_frame): Likewise.
1812
1813 2011-06-29  Ian Lance Taylor  <iant@google.com>
1814
1815         PR gold/12695
1816         * layout.cc (Layout::symtab_section_shndx): New function.
1817         * layout.h (class Layout): Declare symtab_section_shndx.
1818         * output.cc (Output_section::write_header): Call it.
1819
1820 2011-06-29  Ian Lance Taylor  <iant@google.com>
1821
1822         PR gold/12818
1823         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1824         symbols which are not used in a relocation.
1825
1826 2011-06-28  Ian Lance Taylor  <iant@google.com>
1827
1828         PR gold/12898
1829         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1830         script create indistinguishable segments.
1831         (Layout::set_segment_offsets): Use stable_sort when sorting
1832         segments.  Pass this to Compare_segments constructor.
1833         * layout.h (class Layout): Make segment_precedes non-static.
1834         (class Compare_segments): Change from struct to class.  Add
1835         layout_ field.  Add constructor.
1836         * script-sections.cc
1837         (Script_sections::attach_sections_using_phdrs_clause): Rename
1838         local orphan to is_orphan.  Don't report failure to put empty
1839         section in segment.  On attachment failure, report name of
1840         section, and attach to first PT_LOAD segment.
1841
1842 2011-06-28  Ian Lance Taylor  <iant@google.com>
1843
1844         PR gold/12934
1845         * target-select.cc (Target_selector::Target_selector): Add
1846         emulation parameter.  Change all callers.
1847         (select_target_by_bfd_name): Rename from select_target_by_name.
1848         Change all callers.
1849         (select_target_by_emulation): New function.
1850         (supported_emulation_names): New function.
1851         * target-select.h (class Target_selector): Add emulation_ field.
1852         Update declarations.
1853         (Target_selector::recognize_by_bfd_name): Rename from
1854         recognize_by_name.  Change all callers.
1855         (Target_selector::supported_bfd_names): Rename from
1856         supported_names.  Change all callers.
1857         (Target_selector::recognize_by_emulation): New function.
1858         (Target_selector::supported_emulations): New function.
1859         (Target_selector::emulation): New function.
1860         (Target_selector::do_recognize_by_bfd_name): Rename from
1861         do_recognize_by_name.  Change all callers.
1862         (Target_selector::do_supported_bfd_names): Rename from
1863         do_supported_names.  Change all callers.
1864         (Target_selector::do_recognize_by_emulation): New function.
1865         (Target_selector::do_supported_emulations): New function.
1866         (select_target_by_bfd_name): Change name in declaration.
1867         (select_target_by_emulation): Declare.
1868         (supported_emulation_names): Declare.
1869         * parameters.cc (parameters_force_valid_target): Try to find
1870         target based on emulation from -m option.
1871         * options.h (class General_options): Change doc string for -m.
1872         * options.cc (help): Print emulations.
1873         (General_options::parse_V): Likewise.
1874         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1875         Add emulation parameter.  Change all callers.
1876
1877 2011-06-28  Ian Lance Taylor  <iant@google.com>
1878
1879         * target.h (class Target): Add osabi_ field.
1880         (Target::osabi): New function.
1881         (Target::set_osabi): New function.
1882         (Target::Target): Initialize osabi_.
1883         (Target::do_adjust_elf_header): Make pure virtual.
1884         (Sized_target::do_adjust_elf_header): Declare.
1885         * target.cc (Sized_target::do_adjust_elf_header): New function.
1886         (class Sized_target): Instantiate all versions.
1887         * freebsd.h (class Target_freebsd): Remove.
1888         (Target_selector_freebsd::do_recognize): Call set_osabi on
1889         Target.
1890         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1891         (Target_selector_freebsd::set_osabi): Remove.
1892         * i386.cc (class Target_i386): Inherit from Sized_target rather
1893         than Target_freebsd.
1894         * x86_64.cc (class Target_x86_64): Likewise.
1895
1896 2011-06-28  Ian Lance Taylor  <iant@google.com>
1897
1898         * target.h (Target::can_check_for_function_pointers): Rewrite.
1899         Make non-virtual.
1900         (Target::can_icf_inline_merge_sections): Likewise.
1901         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1902         (Target::Target_info): Add can_icf_inline_merge_sections field.
1903         (Target::do_can_check_for_function_pointers): New virtual
1904         function.
1905         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1906         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1907         from can_check_for_function_pointers, move in file.
1908         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1909         section_may_have_icf_unsafe_poineters, move in file.
1910         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1911         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1912         Rename from can_check_for_function_pointers, move in file.
1913         (Target_i386::can_icf_inline_merge_sections): Remove.
1914         (Target_i386::i386_info): Initialize
1915         can_icf_inline_merge_sections.
1916         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1917         Initialize can_icf_inline_merge_sections.
1918         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1919         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1920         Rename from can_check_for_function_pointers, move in file.
1921         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1922         (Target_x86_64::x86_64_info): Initialize
1923         can_icf_inline_merge_sections.
1924         * testsuite/testfile.cc (Target_test::test_target_info):
1925         Likewise.
1926         * icf.cc (get_section_contents): Correct formatting.
1927
1928 2011-06-27  Ian Lance Taylor  <iant@google.com>
1929
1930         * symtab.cc (Symbol::versioned_name): New function.
1931         (Symbol_table::add_to_final_symtab): Use versioned_name when
1932         appropriate.
1933         (Symbol_table::sized_write_symbol): Likewise.
1934         * symtab.h (class Symbol): Declare versioned_name.
1935         * stringpool.h (class Stringpool_template): Add variant of add
1936         which takes a std::basic_string.
1937         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1938         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1939         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1940         (ver_test_12.o): New target.
1941         * testsuite/Makefile.in: Rebuild.
1942
1943 2011-06-27  Doug Kwan  <dougkwan@google.com>
1944
1945         * arm.cc (Arm_relocate_functions::thm_jump8,
1946         Arm_relocate_functions::thm_jump11): Use a wider signed
1947         type to compute offset.
1948         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1949         arm_thm_jump8.
1950         * testsuite/Makefile.in: Regenerate.
1951         * testsuite/arm_branch_in_range.sh: Check test results of
1952         arm_thm_jump11 and arm_thm_jump8.
1953         * testsuite/arm_thm_jump11.s: New test source file.
1954         * testsuite/arm_thm_jump11.t: New linker script.
1955         * testsuite/arm_thm_jump8.s: New test source file.
1956         * testsuite/arm_thm_jump8.t: New linker script.
1957
1958 2011-06-24  Ian Lance Taylor  <iant@google.com>
1959
1960         * layout.cc: Include "object.h".
1961         (ctors_sections_in_init_array): New static variable.
1962         (Layout::is_ctors_in_init_array): New function.
1963         (Layout::layout): Add entry to ctors_sections_in_init_array if
1964         appropriate.
1965         * layout.h (class Layout): Declare is_ctors_in_init_array.
1966         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1967         is_ctors_reverse_view is set.
1968         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1969         all callers.  Set is_ctors_reverse_view field of View_size.
1970         (Sized_relobj_file::reverse_words): New function.
1971         * object.h (Sized_relobj_file::View_size): Add
1972         is_ctors_reverse_view field.
1973         (class Sized_relobj_file): Update declarations.
1974         * testsuite/initpri3.c: New test.
1975         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1976         initpri3b.
1977         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1978         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1979         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1980         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1981         * testsuite/Makefile.in: Rebuild.
1982
1983 2011-06-24  Cary Coutant  <ccoutant@google.com>
1984
1985         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1986         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1987         (debug_msg_cdebug.err): New targets.
1988         * testsuite/Makefile.in: Regenerate.
1989         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1990         Fix checks for link with shared library.
1991
1992 2011-06-24  Doug Kwan  <dougkwan@google.com>
1993
1994         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1995         skip empty text sections.
1996         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1997
1998 2011-06-22  Ian Lance Taylor  <iant@google.com>
1999
2000         PR gold/12910
2001         * options.h (class General_options): Add --ctors-in-init-array.
2002         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2003         friends as SHT_PROGBITS for merging sections.
2004         (Layout::layout): Remove special handling of .init_array and
2005         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2006         and .dtors if ctors_in_init_array.
2007         (Layout::make_output_section): Force correct section types for
2008         .init_array and friends.  Don't sort if doing relocatable link,
2009         Don't sort .ctors and .dtors if ctors_in_init_array.
2010         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2011         (Layout::output_section_name): Add relobj parameter.  Change all
2012         callers.  Handle .ctors. and .dtors. in code rather than table.
2013         Handle .ctors and .dtors if ctors_in_init_array.
2014         (Layout::match_file_name): New function, moved from output.cc.
2015         * layout.h (class Layout): Update declarations.
2016         * output.cc: Include "layout.h".
2017         (Input_section_sort_entry::get_priority): New function.
2018         (Input_section_sort_entry::match_file_name): Just call
2019         Layout::match_file_name.
2020         (Output_section::Input_section_sort_init_fini_compare::operator()):
2021         Handle .ctors and .dtors.  Sort by explicit priority rather than
2022         by name.
2023         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2024         * testsuite/initpri2.c: New test.
2025         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2026         (check_PROGRAMS): Add initpri2.
2027         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2028         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2029         * configure, testsuite/Makefile.in: Rebuild.
2030
2031 2011-06-19  Ian Lance Taylor  <iant@google.com>
2032
2033         PR gold/12880
2034         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2035         .interp section to a PT_INTERP segment even if we have seen a
2036         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2037         clause in a linker script.
2038         (Layout::finalize): Don't create a .interp section if we've
2039         already create a PT_INTERP segment.
2040         (Layout::create_interp): Always call choose_output_section (revert
2041         patch of 2011-06-17).  Don't create PT_INTERP segment.
2042         * script-sections.cc
2043         (Script_sections::create_note_and_tls_segments): Add a .interp
2044         section to a PT_INTERP segment even if we have seen a
2045         --dynamic-linker option.
2046
2047 2011-06-18  Ian Lance Taylor  <iant@google.com>
2048
2049         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2050         merely because a non-PT_LOAD segment has a dynamic reloc.
2051
2052 2011-06-18  Ian Lance Taylor  <iant@google.com>
2053
2054         * layout.cc (Layout::finish_dynamic_section): Don't create
2055         DT_FLAGS entry if not needed.
2056
2057 2011-06-18  Ian Lance Taylor  <iant@google.com>
2058
2059         PR gold/12745
2060         * layout.cc (Layout::layout_eh_frame): Correct handling of
2061         writable .eh_frame section.
2062
2063 2011-06-17  Ian Lance Taylor  <iant@google.com>
2064
2065         PR gold/12893
2066         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2067         symbol is redefined with the exact same object and value.
2068
2069 2011-06-17  Ian Lance Taylor  <iant@google.com>
2070
2071         PR gold/12880
2072         * layout.h (class Layout): Add interp_segment_ field.
2073         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2074         (Layout::attach_allocated_section_to_segment): If making shared
2075         library, put .interp section in PT_INTERP segment.
2076         (Layout::finalize): Also call create_interp if -dynamic-linker
2077         option was used.
2078         (Layout::create_interp): Assert that there is no PT_INTERP
2079         segment.  If not using a SECTIONS clause, use make_output_section.
2080         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2081         * script-sections.cc
2082         (Script_sections::create_note_and_tls_segments): If making shared
2083         library, put .interp section in PT_INTERP segment.
2084
2085 2011-06-17  Ian Lance Taylor  <iant@google.com>
2086
2087         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2088         when making a shared library.
2089
2090 2011-06-17  Ian Lance Taylor  <iant@google.com>
2091
2092         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2093         parameter.  Change all callers.  Don't issue warning about PC32
2094         against locally defined symbol.
2095
2096 2011-06-16  Ian Lance Taylor  <iant@google.com>
2097
2098         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2099         occurs in same object.
2100
2101 2011-06-14  Alan Modra  <amodra@gmail.com>
2102
2103         * po/POTFILES.in: Regenerate.
2104
2105 2011-06-09  Ian Lance Taylor  <iant@google.com>
2106
2107         * script-sections.cc
2108         (Orphan_output_section::set_section_addresses): For a relocatable
2109         link set address to 0.
2110
2111 2011-06-09  Cary Coutant  <ccoutant@google.com>
2112
2113         PR gold/12804
2114         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2115         used with --compress-debug-sections.
2116         * gold/object.cc (Sized_relobj_file::do_layout): Report
2117         uncompressed size of compressed input sections.
2118
2119 2011-06-08  Cary Coutant  <ccoutant@google.com>
2120
2121         PR gold/12804
2122         * testsuite/two_file_test_2_v1.cc: Change initialization of
2123         v2 to keep it in .data.
2124
2125 2011-06-07  Cary Coutant  <ccoutant@google.com>
2126
2127         * common.cc (Symbol_table::do_allocate_commons_list): Call
2128         gold_fallback.
2129         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2130         (Errors::fallback): New function.
2131         (gold_fallback): New function.
2132         * errors.h (Errors::fallback): New function.
2133         * gold.cc (gold_exit): Change status parameter to enum; adjust
2134         all callers.
2135         (queue_initial_tasks): Call gold_fallback.
2136         * gold.h: Include cstdlib.
2137         (Exit_status): New enum type.
2138         (gold_exit): Change status parameter to enum.
2139         (gold_fallback): New function.
2140         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2141         (Layout::create_symtab_sections): Likewise.
2142         (Layout::create_shdrs): Likewise.
2143         * main.cc (main): Adjust call to gold_exit.
2144         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2145         (Output_data_got::add_got_entry_pair): Likewise.
2146         (Output_section::add_input_section): Likewise.
2147         (Output_section::add_output_section_data): Likewise.
2148         (Output_segment::set_section_list_addresses): Likewise.
2149         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2150
2151 2011-06-07  Cary Coutant  <ccoutant@google.com>
2152
2153         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2154         for incremental links.
2155         * output.cc (Output_segment::set_section_list_addresses): Remove
2156         FIXME and test for TLS or BSS.
2157
2158 2011-06-07  Cary Coutant  <ccoutant@google.com>
2159
2160         * testsuite/Makefile.am: Add incremental_copy_test,
2161         incremental_common_test_1.
2162         * testsuite/Makefile.in: Regenerate.
2163         * testsuite/common_test_1_v1.c: New source file.
2164         * testsuite/common_test_1_v2.c: New source file.
2165         * testsuite/copy_test_v1.cc: New source file.
2166
2167 2011-06-07  Cary Coutant  <ccoutant@google.com>
2168
2169         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2170         update, allocate common from bss section's free list.
2171         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2172         linker-defined symbols.
2173         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2174         Skip GOT and PLT entries that are no longer referenced.
2175         (Output_section_incremental_inputs::write_info_blocks): Mark
2176         linker-defined symbols.
2177         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2178         * output.cc (Output_section::allocate): New function.
2179         * output.h (Output_section::allocate): New function.
2180         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2181         linker-defined symbols.
2182         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2183         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2184         (Symbol::init_base_output_data): Likewise.
2185         (Symbol::init_base_output_segment): Likewise.
2186         (Symbol::init_base_constant): Likewise.
2187         (Sized_symbol::init_output_data): Likewise.
2188         (Sized_symbol::init_output_segment): Likewise.
2189         (Sized_symbol::init_constant): Likewise.
2190         (Symbol_table::do_define_in_output_data): Likewise.
2191         (Symbol_table::do_define_in_output_segment): Likewise.
2192         (Symbol_table::do_define_as_constant): Likewise.
2193         * symtab.h (Symbol::is_predefined): New function.
2194         (Symbol::init_base_output_data): Add is_predefined parameter.
2195         (Symbol::init_base_output_segment): Likewise.
2196         (Symbol::init_base_constant): Likewise.
2197         (Symbol::is_predefined_): New data member.
2198         (Sized_symbol::init_output_data): Add is_predefined parameter.
2199         (Sized_symbol::init_output_segment): Likewise.
2200         (Sized_symbol::init_constant): Likewise.
2201         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2202
2203 2011-06-07  Cary Coutant  <ccoutant@google.com>
2204
2205         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2206         instead of emit_copy_reloc.
2207         (Copy_relocs::emit_copy_reloc): Refactor.
2208         (Copy_relocs::make_copy_reloc): New function.
2209         (Copy_relocs::add_copy_reloc): Remove.
2210         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2211         section.
2212         (Copy_relocs::make_copy_reloc): New function.
2213         (Copy_relocs::add_copy_reloc): Remove.
2214         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2215         unchanged input files.
2216         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2217         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2218         Reserve BSS space for COPY relocations.
2219         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2220         (Output_section_incremental_inputs::write_info_blocks): Record
2221         whether a symbol is copied from a shared object.
2222         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2223         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2224         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2225         (Incremental_input_entry_reader::get_output_symbol_index): Add
2226         is_copy parameter.
2227         (Incremental_binary::emit_copy_relocs): New function.
2228         (Incremental_binary::do_emit_copy_relocs): New function.
2229         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2230         new data member.
2231         (Sized_incremental_binary::add_copy_reloc): New function.
2232         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2233         (Sized_incremental_binary::Copy_reloc): New struct.
2234         (Sized_incremental_binary::Copy_relocs): New typedef.
2235         (Sized_incremental_binary::copy_relocs_): New data member.
2236         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2237         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2238         * target.h (Sized_target::emit_copy_reloc): New function.
2239         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2240
2241 2011-06-02  Cary Coutant  <ccoutant@google.com>
2242
2243         PR gold/12163
2244         * gold/archive.cc (Archive::Archive): Initialize new data member.
2245         (Archive::include_all_members): Return if archive has already been
2246         included.
2247         * gold/archive.h (Archive::include_all_members_): New data member.
2248
2249 2011-06-02  Nick Clifton  <nickc@redhat.com>
2250
2251         * dynobj.h: Fix spelling mistake in comment.
2252         * output.cc: Likewise.
2253
2254 2011-05-31  Doug Kwan  <dougkwan@google.com>
2255             Asier Llano
2256
2257         PR gold/12826
2258         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2259         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2260         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2261         redundant arm_exidx_test.so.
2262         * testsuite/Makefile.in: Regenerate.
2263         (check_SCRIPTS): Add pr12826.sh
2264         (check_DATA): Add pr12826.stdout
2265         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2266         * testsuite/pr12826.sh: New file.
2267         * testsuite/pr12826_1.s: Ditto.
2268         * testsuite/pr12826_1.s: Ditto.
2269
2270 2011-05-30  Ian Lance Taylor  <iant@google.com>
2271
2272         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2273         sections.
2274
2275 2011-05-29  Ian Lance Taylor  <iant@google.com>
2276
2277         PR gold/12804
2278         * testsuite/Makefile.am: Use different file name for two_file_test
2279         temporary file for each incremental test.
2280         * testsuite/Makefile.in: Rebuild.
2281
2282 2011-05-29  Ian Lance Taylor  <iant@google.com>
2283
2284         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2285         binary input file is empty.
2286
2287 2011-05-27  Ian Lance Taylor  <iant@google.com>
2288
2289         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2290         (ver_test_9.so): Likewise.
2291         * testsuite/Makefile.in: Rebuild.
2292
2293 2011-05-26 Cary Coutant  <ccoutant@google.com>
2294
2295         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2296         * incremental.cc (Incremental_inputs::report_input_section): Fix
2297         comment, indentation.
2298         (Incremental_inputs::report_comdat_group): New function.
2299         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2300         of data for incremental input file entry.
2301         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2302         group count, COMDAT group signatures.
2303         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2304         an unchanged input file.
2305         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2306         Initialize new data member.
2307         (Incremental_object_entry::add_comdat_group): New function.
2308         (Incremental_object_entry::get_comdat_group_count): New function.
2309         (Incremental_object_entry::get_comdat_signature_key): New function.
2310         (Incremental_object_entry::groups_): New data member.
2311         (Incremental_inputs::report_comdat_group): New function.
2312         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2313         data for incremental input file entry.
2314         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2315         (Incremental_input_entry_reader::get_input_section): Adjust size of
2316         data for incremental input file entry.
2317         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2318         (Incremental_input_entry_reader::get_comdat_group_signature): New
2319         function.
2320         * object.cc (Sized_relobj::include_section_group): Report kept
2321         COMDAT groups for incremental links.
2322
2323 2011-05-24  David Meyer  <pdox@google.com>
2324
2325         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2326         with name parameter.  Add found_name parameter.
2327         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2328         * dirsearch.h (class Dirsearch): Update declaration.
2329
2330 2011-05-24  Ian Lance Taylor  <iant@google.com>
2331
2332         * archive.cc (Library_base::should_include_member): Pull in object
2333         from archive if it defines the entry symbol.
2334         * parameters.cc (Parameters::entry): New function.
2335         * parameters.h (class Parameters): Declare entry.
2336         * output.h (class Output_file_header): Remove entry_ field.
2337         * output.cc (Output_file_header::Output_file_header): Remove entry
2338         parameter.  Change all callers.
2339         (Output_file_header::entry): Use parameters->entry.
2340         * gold.cc (queue_middle_tasks): Likewise.
2341         * plugin.cc (Plugin_hook::run): Likewise.
2342
2343 2011-05-24 Cary Coutant  <ccoutant@google.com>
2344
2345         * gold.cc (queue_initial_tasks): Pass incremental base filename
2346         to Output_file::open_base_file; don't print error message.
2347         * incremental-dump.cc (main): Adjust call to
2348         Output_file::open_for_modification.
2349         * incremental-dump.cc (main): Likewise.
2350         * incremental.cc (Incremental_inputs::report_command_line):
2351         Ignore --incremental-base option when comparing command lines.
2352         Ignore parameter when given as separate argument.
2353         * options.h (class General_options): Add --incremental-base.
2354         * output.cc (Output_file::Output_file):
2355         (Output_file::open_base_file): Add base_name and writable parameters;
2356         read base file into new file; print error message here.
2357         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2358         callers.
2359         * output.h (Output_file::open_for_modification): Rename to...
2360         (Output_file::open_base_file): ...this; add base_name and
2361         writable parameters; adjust all callers.
2362         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2363         callers.
2364         * testsuite/Makefile.am (incremental_test_4): Test
2365         --incremental-base.
2366         * testsuite/Makefile.in: Regenerate.
2367
2368 2011-05-24 Cary Coutant  <ccoutant@google.com>
2369
2370         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2371         incremental_test_4.
2372         * testsuite/Makefile.in: Regenerate.
2373         * testsuite/two_file_test_1_v1.cc: New test source file.
2374         * testsuite/two_file_test_1b_v1.cc: New test source file.
2375         * testsuite/two_file_test_2_v1.cc: New test source file.
2376
2377 2011-05-24 Cary Coutant  <ccoutant@google.com>
2378
2379         * dynobj.h (Dynobj::do_dynobj): New function.
2380         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2381         flag and soname for shared objects.
2382         * incremental.cc (Incremental_inputs::report_object): Make
2383         either Incremental_object_entry or Incremental_dynobj_entry; add
2384         soname to string table.
2385         (Incremental_inputs::report_input_section): Add assertion.
2386         (Output_section_incremental_inputs::set_final_data_size): Adjust
2387         type of input file entry for shared libraries; adjust size of
2388         shared library info entry.
2389         (Output_section_incremental_inputs::write_input_files): Write
2390         as_needed flag for shared libraries.
2391         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2392         of input file entry for shared libraries; write soname.
2393         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2394         soname from incremental info.
2395         * incremental.h (enum Incremental_input_flags): Add
2396         INCREMENTAL_INPUT_AS_NEEDED.
2397         (Incremental_input_entry::Incremental_input_entry): Initialize new
2398         data member.
2399         (Incremental_input_entry::set_as_needed): New function.
2400         (Incremental_input_entry::as_needed): New function.
2401         (Incremental_input_entry::do_dynobj_entry): New function.
2402         (Incremental_input_entry::as_needed_): New data member.
2403         (Incremental_object_entry::Incremental_object_entry): Don't check
2404         for shared library.
2405         (Incremental_object_entry::do_type): Likewise.
2406         (class Incremental_dynobj_entry): New class.
2407         (Incremental_input_entry_reader::as_needed): New function.
2408         (Incremental_input_entry_reader::get_soname): New function.
2409         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2410         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2411         size of shared library info entry.
2412         * layout.cc (Layout::finish_dynamic_section): Don't test for
2413         incremental link when adding DT_NEEDED entries.
2414         * object.h (Object::Object): Initialize new data member.
2415         (Object::dynobj): New function.
2416         (Object::set_as_needed): New function.
2417         (Object::as_needed): New function.
2418         (Object::do_dynobj): New function.
2419         (Object::as_needed_): New data member.
2420
2421 2011-05-24 Cary Coutant  <ccoutant@google.com>
2422
2423         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2424         info; adjust display of GOT entries.
2425         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2426         vector of input objects; remove file_status_.
2427         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2428         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2429         got_plt reader; call target hooks to reserve GOT entries.
2430         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2431         of input file info header and GOT info entry.
2432         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2433         relocation info.
2434         (Got_plt_view_info::got_descriptor): Remove.
2435         (Got_plt_view_info::sym_index): New data member.
2436         (Got_plt_view_info::input_index): New data member.
2437         (Local_got_offset_visitor::visit): Write input file index.
2438         (Global_got_offset_visitor::visit): Write 0 for input file index.
2439         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2440         with sym_index and input_index.
2441         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2442         incremental info GOT entry; replace got_descriptor with input_index.
2443         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2444         map from input file index to object.
2445         (Sized_relobj_incr::do_layout): Replace direct data member reference
2446         with accessor function.
2447         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2448         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2449         Adjust size of input file info header.
2450         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2451         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2452         (Incremental_input_entry_reader::get_input_section): Adjust size of
2453         input file info header.
2454         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2455         of incremental info GOT entry.
2456         (Incremental_got_plt_reader::get_got_desc): Remove.
2457         (Incremental_got_plt_reader::get_got_symndx): New function.
2458         (Incremental_got_plt_reader::get_got_input_index): New function.
2459         (Sized_incremental_binary::Sized_incremental_binary): Remove
2460         file_status_; add input_objects_.
2461         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2462         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2463         (Sized_incremental_binary::file_is_unchanged): Remove.
2464         (Sized_incremental_binary::set_input_object): New function.
2465         (Sized_incremental_binary::input_object): New function.
2466         (Sized_incremental_binary::file_status_): Remove.
2467         (Sized_incremental_binary::input_objects_): New data member.
2468         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2469         references.
2470         (Sized_relobj_incr::invalid_address): Move to base class.
2471         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2472         class.
2473         (Sized_relobj_incr::do_output_section_offset): Likewise.
2474         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2475         (Sized_relobj_incr::section_offsets_): Likewise.
2476         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2477         function.
2478         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2479         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2480         with accessor function.
2481         (Sized_relobj_file::do_layout): Likewise.
2482         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2483         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2484         (Sized_relobj_file::compute_final_local_value): Replace refs to
2485         section_offsets_ with accessor function.
2486         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2487         * object.h (Relobj::Relobj): Initialize new data members.
2488         (Relobj::add_dyn_reloc): New function.
2489         (Relobj::first_dyn_reloc): New function.
2490         (Relobj::dyn_reloc_count): New function.
2491         (Relobj::first_dyn_reloc_): New data member.
2492         (Relobj::dyn_reloc_count_): New data member.
2493         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2494         references.
2495         (Sized_relobj::Address): New typedef.
2496         (Sized_relobj::invalid_address): Move here from child class.
2497         (Sized_relobj::Sized_relobj): Initialize new data members.
2498         (Sized_relobj::sized_relobj): New function.
2499         (Sized_relobj::is_output_section_offset_invalid): Move here from
2500         child class.
2501         (Sized_relobj::get_output_section_offset): Likewise.
2502         (Sized_relobj::local_has_got_offset): Likewise.
2503         (Sized_relobj::local_got_offset): Likewise.
2504         (Sized_relobj::set_local_got_offset): Likewise.
2505         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2506         (Sized_relobj::clear_got_offsets): New function.
2507         (Sized_relobj::section_offsets): Move here from child class.
2508         (Sized_relobj::do_output_section_offset): Likewise.
2509         (Sized_relobj::do_set_section_offset): Likewise.
2510         (Sized_relobj::Local_got_offsets): Likewise.
2511         (Sized_relobj::local_got_offsets_): Likewise.
2512         (Sized_relobj::section_offsets_): Likewise.
2513         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2514         references.
2515         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2516         class.
2517         (Sized_relobj_file::sized_relobj): New function
2518         (Sized_relobj_file::local_has_got_offset): Move to base class.
2519         (Sized_relobj_file::local_got_offset): Likewise.
2520         (Sized_relobj_file::set_local_got_offset): Likewise.
2521         (Sized_relobj_file::get_output_section_offset): Likewise.
2522         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2523         (Sized_relobj_file::do_output_section_offset): Likewise.
2524         (Sized_relobj_file::do_set_section_offset): Likewise.
2525         (Sized_relobj_file::Local_got_offsets): Likewise.
2526         (Sized_relobj_file::local_got_offsets_): Likewise.
2527         (Sized_relobj_file::section_offsets_): Likewise.
2528         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2529         (all constructors).
2530         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2531         (Output_reloc::get_symbol_index): Likewise.
2532         (Output_reloc::local_section_offset): Likewise.
2533         (Output_reloc::get_address): Likewise.
2534         (Output_reloc::symbol_value): Likewise.
2535         (Output_data_got::reserve_slot): Move to class definition.
2536         (Output_data_got::reserve_local): New function.
2537         (Output_data_got::reserve_slot_for_global): Remove.
2538         (Output_data_got::reserve_global): New function.
2539         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2540         (all constructors, two instantiations).
2541         (Output_reloc::get_relobj): New function (two instantiations).
2542         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2543         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2544         (Output_data_reloc::add_global): Adjust type of relobj.
2545         (Output_data_reloc::add_global_relative): Likewise.
2546         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2547         (Output_data_reloc::add_local): Likewise.
2548         (Output_data_reloc::add_local_relative): Likewise.
2549         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2550         (Output_data_reloc::add_local_section): Likewise.
2551         (Output_data_reloc::add_output_section): Likewise.
2552         (Output_data_reloc::add_absolute): Likewise.
2553         (Output_data_reloc::add_target_specific): Likewise.
2554         (Output_data_got::reserve_slot): Move definition here.
2555         (Output_data_got::reserve_local): New function.
2556         (Output_data_got::reserve_global): New function.
2557         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2558         section_offsets_ with accessor function.
2559         (Sized_relobj_file::write_sections): Likewise.
2560         (Sized_relobj_file::do_relocate_sections): Likewise.
2561         * target.h (Sized_target::reserve_local_got_entry): New function.
2562         (Sized_target::reserve_global_got_entry): New function.
2563         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2564         (Target_x86_64::reserve_global_got_entry): New function.
2565         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2566
2567 2011-05-23 Cary Coutant  <ccoutant@google.com>
2568
2569         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2570         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2571         bit when checking got_type.
2572         * incremental.cc (Sized_incremental_binary::setup_readers):
2573         Store symbol table and string table locations; initialize bit vector
2574         of file status flags.
2575         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2576         unchanged files.
2577         (Sized_incremental_binary::do_process_got_plt): New function.
2578         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2579         (Output_section_incremental_inputs::set_final_data_size): Record
2580         file index for each input file.
2581         (Output_section_incremental_inputs::write_got_plt): Store file index
2582         instead of input entry offset for each GOT entry.
2583         * incremental.h
2584         (Incremental_input_entry::Incremental_input_entry): Initialize new
2585         data member.
2586         (Incremental_input_entry::set_offset): Store file index.
2587         (Incremental_input_entry::get_file_index): New function.
2588         (Incremental_input_entry::file_index_): New data member.
2589         (Incremental_binary::process_got_plt): New function.
2590         (Incremental_binary::do_process_got_plt): New function.
2591         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2592         data members.
2593         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2594         (Sized_incremental_binary::set_file_is_unchanged): New function.
2595         (Sized_incremental_binary::file_is_unchanged): New function.
2596         (Sized_incremental_binary::do_process_got_plt): New function.
2597         (Sized_incremental_binary::file_status_): New data member.
2598         (Sized_incremental_binary::main_symtab_loc_): New data member.
2599         (Sized_incremental_binary::main_strtab_loc_): New data member.
2600         * output.cc (Output_data_got::Got_entry::write): Add case
2601         RESERVED_CODE.
2602         (Output_data_got::add_global): Call add_got_entry.
2603         (Output_data_got::add_global_plt): Likewise.
2604         (Output_data_got::add_global_with_rel): Likewise.
2605         (Output_data_got::add_global_with_rela): Likewise.
2606         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2607         (Output_data_got::add_global_pair_with_rela): Likewise.
2608         (Output_data_got::add_local): Call add_got_entry.
2609         (Output_data_got::add_local_plt): Likewise.
2610         (Output_data_got::add_local_with_rel): Likewise.
2611         (Output_data_got::add_local_with_rela): Likewise.
2612         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2613         (Output_data_got::add_local_pair_with_rela): Likewise.
2614         (Output_data_got::reserve_slot): New function.
2615         (Output_data_got::reserve_slot_for_global): New function.
2616         (Output_data_got::add_got_entry): New function.
2617         (Output_data_got::add_got_entry_pair): New function.
2618         (Output_section::add_output_section_data): Edit FIXME.
2619         * output.h
2620         (Output_section_data_build::Output_section_data_build): New
2621         constructor with size parameter.
2622         (Output_data_space::Output_data_space): Likewise.
2623         (Output_data_got::Output_data_got): Initialize new data member; new
2624         constructor with size parameter.
2625         (Output_data_got::add_constant): Call add_got_entry.
2626         (Output_data_got::reserve_slot): New function.
2627         (Output_data_got::reserve_slot_for_global): New function.
2628         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2629         (Output_data_got::add_got_entry): New function.
2630         (Output_data_got::add_got_entry_pair): New function.
2631         (Output_data_got::free_list_): New data member.
2632         * target.h (Sized_target::init_got_plt_for_update): New function.
2633         (Sized_target::register_global_plt_entry): New function.
2634         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2635         Initialize new data member; call init; add constructor with PLT count.
2636         (Output_data_plt_x86_64::init): New function.
2637         (Output_data_plt_x86_64::add_relocation): New function.
2638         (Output_data_plt_x86_64::reserve_slot): New function.
2639         (Output_data_plt_x86_64::free_list_): New data member.
2640         (Target_x86_64::init_got_plt_for_update): New function.
2641         (Target_x86_64::register_global_plt_entry): New function.
2642         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2643         incremental updates.
2644         (Output_data_plt_x86_64::add_relocation): New function.
2645         * testsuite/object_unittest.cc (Object_test): Set default options.
2646
2647 2011-05-16  Ian Lance Taylor  <iant@google.com>
2648
2649         * options.h (class General_options): Make -i a synonym for -r.
2650
2651 2011-05-16  Ian Lance Taylor  <iant@google.com>
2652
2653         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2654
2655 2011-05-10 Cary Coutant  <ccoutant@google.com>
2656
2657         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2658         strip_all (-s).
2659
2660 2011-05-06  Ian Lance Taylor  <iant@google.com>
2661
2662         * layout.cc (Layout::layout): If the output section flags change,
2663         update the ordering.
2664
2665 2011-04-25 Cary Coutant  <ccoutant@google.com>
2666
2667         * incremental-dump.cc (dump_incremental_inputs): Print local
2668         symbol info for each input file.
2669         * incremental.cc
2670         (Output_section_incremental_inputs::set_final_data_size): Add local
2671         symbol info to input file entries in incremental info.
2672         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2673         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2674         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2675         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2676         implementation.
2677         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2678         (Sized_incr_relobj::do_relocate): Write the local symbols.
2679         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2680         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2681         Adjust size of input file header.
2682         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2683         (Incremental_inputs_reader::get_local_symbol_count): New function.
2684         (Incremental_inputs_reader::get_input_section): Adjust size of input
2685         file header.
2686         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2687         (Sized_incr_relobj::This): New typedef.
2688         (Sized_incr_relobj::sym_size): New const data member.
2689         (Sized_incr_relobj::Local_symbol): New struct.
2690         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2691         (Sized_incr_relobj::do_local_symbol_offset): New function.
2692         (Sized_incr_relobj::local_symbol_count_): New data member.
2693         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2694         (Sized_incr_relobj::local_symbol_index_): New data member.
2695         (Sized_incr_relobj::local_symbol_offset_): New data member.
2696         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2697         (Sized_incr_relobj::local_symbols_): New data member.
2698         * object.h (Relobj::output_local_symbol_count): New function.
2699         (Relobj::local_symbol_offset): New function.
2700         (Relobj::do_output_local_symbol_count): New function.
2701         (Relobj::do_local_symbol_offset): New function.
2702         (Sized_relobj::do_output_local_symbol_count): New function.
2703         (Sized_relobj::do_local_symbol_offset): New function.
2704
2705 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2706
2707         * descriptors.cc (set_close_on_exec): New function.
2708         (Descriptors::open): Use set_close_on_exec.
2709         * output.cc (S_ISLNK): Define if not defined.
2710
2711 2011-04-22 Cary Coutant  <ccoutant@google.com>
2712
2713         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2714         global symbol map.
2715         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2716         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2717         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2718         relocations.
2719         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2720         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2721         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2722         * incremental.h
2723         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2724         function.
2725         (Incremental_binary::apply_incremental_relocs): New function.
2726         (Incremental_binary::do_apply_incremental_relocs): New function.
2727         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2728         data member.
2729         (Sized_incremental_binary::add_global_symbol): New function.
2730         (Sized_incremental_binary::global_symbol): New function.
2731         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2732         (Sized_incremental_binary::symbol_map_): New data member.
2733         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2734         * target.h (Sized_target::apply_relocation): New function.
2735         * target-reloc.h (apply_relocation): New function.
2736         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2737
2738 2011-04-22  Doug Kwan  <dougkwan@google.com>
2739
2740         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2741         flag of a SHT_ARM_EXIDX section.
2742         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2743         * testsuite/Makefile.in: Regenerate.
2744         * testsuite/arm_exidx_test.s: New file.
2745         * testsuite/arm_exidx_test.sh: Same.
2746
2747 2011-04-20 Cary Coutant  <ccoutant@google.com>
2748
2749         PR gold/12689
2750         * archive.h (Incremental_archive_entry::Archive_member):
2751         Initialize arg_serial_ (second constructor).
2752
2753 2011-04-17  Ian Lance Taylor  <iant@google.com>
2754
2755         * object.cc (Relocate_info::location): Simplify location string.
2756         * errors.cc (Errors::error_at_location): Don't print program
2757         name.
2758         (Errors::warning_at_location): Likewise.
2759         (Errors::undefined_symbol): Likewise.
2760         * testsuite/debug_msg.sh: Update accordingly.
2761
2762 2011-04-14 Cary Coutant  <ccoutant@google.com>
2763
2764         * gold/layout.cc (Layout::symtab_section_offset): New function.
2765         * gold/layout.h (Layout::symtab_section_offset): New function.
2766         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2767
2768 2011-04-12  Ian Lance Taylor  <iant@google.com>
2769
2770         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2771         with MREMAP_MAYMOVE.
2772         * output.h (class Output_file): Add map_is_allocated_ field.
2773         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2774         not available, provide stubs.  If mremap is not available, #define
2775         it to gold_mremap.
2776         (MREMAP_MAYMOVE): Define if not defined.
2777         (Output_file::Output_file): Initialize map_is_allocated_.
2778         (Output_file::resize): Check map_is_allocated_.
2779         (Output_file::map_anonymous): If mmap fails, use malloc.
2780         (Output_file::unmap): Don't do anything for an anonymous map.
2781         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2782         is not available, provide stubs.
2783         (File_read::View::~View): Use free rather than delete[].
2784         (File_read::make_view): Use malloc rather than new[].  If mmap
2785         fails, use malloc.
2786         (File_read::find_or_make_view): Use malloc rather than new[].
2787         * gold.h: Remove HAVE_REMAP code.
2788         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2789         exists.  Rename mremap to gold_mremap.  If mmap is not available
2790         don't do anything.
2791         * configure, config.in: Rebuild.
2792
2793 2011-04-11  Ian Lance Taylor  <iant@google.com>
2794
2795         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2796         initialize local variable v.
2797
2798 2011-04-11  Cary Coutant  <ccoutant@google.com>
2799
2800         * archive.cc (Archive::include_member): Adjust call to
2801         report_object.
2802         (Add_archive_symbols::run): Track argument serial numbers.
2803         (Lib_group::include_member): Likewise.
2804         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2805         * archive.h (Incremental_archive_entry::Archive_member):
2806         Initialize arg_serial_.
2807         (Archive_member::arg_serial_): New data member.
2808         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2809         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2810         incremental link.
2811         (Sized_dynobj::do_for_all_local_got_entries): New function.
2812         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2813         function.
2814         * fileread.cc (get_mtime): New function.
2815         * fileread.h (get_mtime): New function.
2816         * gold.cc (queue_initial_tasks): Check for incremental update.
2817         (process_incremental_input): New function.
2818         (queue_middle_tasks): Don't force valid target for incremental
2819         update.
2820         * incremental-dump.cc (find_input_containing_global): Adjust
2821         size of symbol info entry.
2822         (dump_incremental_inputs): Dump argument serial number and
2823         in_system_directory flag; bias shndx by 1; print symbol names
2824         when dumping per-file symbol lists; use new symbol info readers.
2825         * incremental.cc
2826         (Output_section_incremental_inputs:update_data_size): New function.
2827         (Sized_incremental_binary::setup_readers): Setup input readers
2828         for each input file; build maps for files added from libraries
2829         and scripts.
2830         (Sized_incremental_binary::check_input_args): New function.
2831         (Sized_incremental_binary::do_check_inputs): Build map of argument
2832         serial numbers to input arguments.
2833         (Sized_incremental_binary::do_file_has_changed): Rename
2834         do_file_is_unchanged to this; compare file modification times.
2835         (Sized_incremental_binary::do_init_layout): New function.
2836         (Sized_incremental_binary::do_reserve_layout): New function.
2837         (Sized_incremental_binary::do_get_input_reader): Remove.
2838         (Sized_incremental_binary::get_symtab_view): New function.
2839         (Incremental_checker::can_incrementally_link_output_file): Remove.
2840         (Incremental_inputs::report_command_line): Exclude --debug options.
2841         (Incremental_inputs::report_archive_begin): Add parameter; track
2842         argument serial numbers; don't put input file entry for archive
2843         before archive members.
2844         (Incremental_inputs::report_archive_end): Put input file entry
2845         for archive after archive members.
2846         (Incremental_inputs::report_object): Add parameter; track argument
2847         serial numbers and in_system_directory flag.
2848         (Incremental_inputs::report_script): Add parameter; track argument
2849         serial numbers.
2850         (Output_section_incremental_inputs::set_final_data_size): Adjust
2851         size of symbol info entry; check for forwarding symbols.
2852         (Output_section_incremental_inputs::write_input_files): Write
2853         in_system_directory flag and argument serial number.
2854         (Output_section_incremental_inputs::write_info_blocks): Map section
2855         indices between incremental info and original input file; store
2856         input section index for each symbol.
2857         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2858         change operator() to visit().
2859         (class Global_got_offset_visitor): Likewise.
2860         (class Global_symbol_visitor_got_plt):
2861         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2862         classes.
2863         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2864         (Sized_incr_relobj::do_read_symbols): New function.
2865         (Sized_incr_relobj::do_layout): New function.
2866         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2867         (Sized_incr_relobj::do_add_symbols): New function.
2868         (Sized_incr_relobj::do_should_include_member): New function.
2869         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2870         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2871         (Sized_incr_relobj::do_section_size): New function.
2872         (Sized_incr_relobj::do_section_name): New function.
2873         (Sized_incr_relobj::do_section_contents): New function.
2874         (Sized_incr_relobj::do_section_flags): New function.
2875         (Sized_incr_relobj::do_section_entsize): New function.
2876         (Sized_incr_relobj::do_section_address): New function.
2877         (Sized_incr_relobj::do_section_type): New function.
2878         (Sized_incr_relobj::do_section_link): New function.
2879         (Sized_incr_relobj::do_section_info): New function.
2880         (Sized_incr_relobj::do_section_addralign): New function.
2881         (Sized_incr_relobj::do_initialize_xindex): New function.
2882         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2883         (Sized_incr_relobj::do_read_relocs): New function.
2884         (Sized_incr_relobj::do_gc_process_relocs): New function.
2885         (Sized_incr_relobj::do_scan_relocs): New function.
2886         (Sized_incr_relobj::do_count_local_symbols): New function.
2887         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2888         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2889         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2890         (Sized_incr_relobj::do_relocate): New function.
2891         (Sized_incr_relobj::do_set_section_offset): New function.
2892         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2893         (Sized_incr_dynobj::do_read_symbols): New function.
2894         (Sized_incr_dynobj::do_layout): New function.
2895         (Sized_incr_dynobj::do_add_symbols): New function.
2896         (Sized_incr_dynobj::do_should_include_member): New function.
2897         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2898         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2899         (Sized_incr_dynobj::do_section_size): New function.
2900         (Sized_incr_dynobj::do_section_name): New function.
2901         (Sized_incr_dynobj::do_section_contents): New function.
2902         (Sized_incr_dynobj::do_section_flags): New function.
2903         (Sized_incr_dynobj::do_section_entsize): New function.
2904         (Sized_incr_dynobj::do_section_address): New function.
2905         (Sized_incr_dynobj::do_section_type): New function.
2906         (Sized_incr_dynobj::do_section_link): New function.
2907         (Sized_incr_dynobj::do_section_info): New function.
2908         (Sized_incr_dynobj::do_section_addralign): New function.
2909         (Sized_incr_dynobj::do_initialize_xindex): New function.
2910         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2911         (make_sized_incremental_object): New function.
2912         (Incremental_library::copy_unused_symbols): New function.
2913         (Incremental_library::do_for_all_unused_symbols): New function.
2914         * incremental.h (enum Incremental_input_flags): New type.
2915         (class Incremental_checker): Remove.
2916         (Incremental_input_entry::Incremental_input_entry): Add argument
2917         serial number.
2918         (Incremental_input_entry::arg_serial): New function.
2919         (Incremental_input_entry::set_is_in_system_directory): New function.
2920         (Incremental_input_entry::is_in_system_directory): New function.
2921         (Incremental_input_entry::arg_serial_): New data member.
2922         (Incremental_input_entry::is_in_system_directory_): New data member.
2923         (class Script_info): Move here from script.h.
2924         (Script_info::Script_info): Add filename parameter.
2925         (Script_info::filename): New function.
2926         (Script_info::filename_): New data member.
2927         (Incremental_script_entry::Incremental_script_entry): Add argument
2928         serial number.
2929         (Incremental_object_entry::Incremental_object_entry): Likewise.
2930         (Incremental_object_entry::add_input_section): Build list of input
2931         sections with map to original shndx.
2932         (Incremental_object_entry::get_input_section_index): New function.
2933         (Incremental_object_entry::shndx_): New data member.
2934         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2935         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2936         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2937         serial number.
2938         (Incremental_inputs::report_archive_begin): Likewise.
2939         (Incremental_inputs::report_object): Likewise.
2940         (Incremental_inputs::report_script): Likewise.
2941         (class Incremental_global_symbol_reader): New class.
2942         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2943         and store flags and input file type.
2944         (Incremental_input_entry_reader::arg_serial): New function.
2945         (Incremental_input_entry_reader::type): Extract type from flags.
2946         (Incremental_input_entry_reader::is_in_system_directory): New function.
2947         (Incremental_input_entry_reader::get_input_section_count): Call
2948         accessor function for type.
2949         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2950         function for type; adjust size of global symbol entry.
2951         (Incremental_input_entry_reader::get_global_symbol_count): Call
2952         accessor function for type.
2953         (Incremental_input_entry_reader::get_object_count): Likewise.
2954         (Incremental_input_entry_reader::get_object_offset): Likewise.
2955         (Incremental_input_entry_reader::get_member_count): Likewise.
2956         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2957         (Incremental_input_entry_reader::get_member_offset): Likewise.
2958         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2959         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2960         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2961         (Incremental_input_entry_reader::get_global_symbol_reader): New
2962         function.
2963         (Incremental_input_entry_reader::get_output_symbol_index): New
2964         function.
2965         (Incremental_input_entry_reader::type_): Remove.
2966         (Incremental_input_entry_reader::flags_): New data member.
2967         (Incremental_inputs_reader::input_file_offset): New function.
2968         (Incremental_inputs_reader::input_file_index): New function.
2969         (Incremental_inputs_reader::input_file): Call input_file_offset.
2970         (Incremental_inputs_reader::input_file_at_offset): New function.
2971         (Incremental_relocs_reader::get_r_type): Reformat.
2972         (Incremental_relocs_reader::get_r_shndx): Reformat.
2973         (Incremental_relocs_reader::get_r_offset): Reformat.
2974         (Incremental_relocs_reader::data): New function.
2975         (Incremental_binary::Incremental_binary): Initialize new data members.
2976         (Incremental_binary::check_inputs): Add cmdline parameter.
2977         (Incremental_binary::file_is_unchanged): Remove.
2978         (Input_reader::arg_serial): New function.
2979         (Input_reader::get_unused_symbol_count): New function.
2980         (Input_reader::get_unused_symbol): New function.
2981         (Input_reader::do_arg_serial): New function.
2982         (Input_reader::do_get_unused_symbol_count): New function.
2983         (Input_reader::do_get_unused_symbol): New function.
2984         (Incremental_binary::input_file_count): New function.
2985         (Incremental_binary::get_input_reader): Change signature to use
2986         index instead of filename.
2987         (Incremental_binary::file_has_changed): New function.
2988         (Incremental_binary::get_input_argument): New function.
2989         (Incremental_binary::get_library): New function.
2990         (Incremental_binary::get_script_info): New function.
2991         (Incremental_binary::init_layout): New function.
2992         (Incremental_binary::reserve_layout): New function.
2993         (Incremental_binary::output_file): New function.
2994         (Incremental_binary::do_check_inputs): New function.
2995         (Incremental_binary::do_file_is_unchanged): Remove.
2996         (Incremental_binary::do_file_has_changed): New function.
2997         (Incremental_binary::do_init_layout): New function.
2998         (Incremental_binary::do_reserve_layout): New function.
2999         (Incremental_binary::do_input_file_count): New function.
3000         (Incremental_binary::do_get_input_reader): Change signature.
3001         (Incremental_binary::input_args_map_): New data member.
3002         (Incremental_binary::library_map_): New data member.
3003         (Incremental_binary::script_map_): New data member.
3004         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3005         new data members.
3006         (Sized_incremental_binary::output_section): New function.
3007         (Sized_incremental_binary::inputs_reader): Add const.
3008         (Sized_incremental_binary::symtab_reader): Add const.
3009         (Sized_incremental_binary::relocs_reader): Add const.
3010         (Sized_incremental_binary::got_plt_reader): Add const.
3011         (Sized_incremental_binary::get_symtab_view): New function.
3012         (Sized_incremental_binary::Inputs_reader): New typedef.
3013         (Sized_incremental_binary::Input_entry_reader): New typedef.
3014         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3015         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3016         (Sized_incremental_binary::do_file_has_changed): New function.
3017         (Sized_incremental_binary::do_init_layout): New function.
3018         (Sized_incremental_binary::do_reserve_layout): New function.
3019         (Sized_input_reader::Inputs_reader): Remove.
3020         (Sized_input_reader::Input_entry_reader): Remove.
3021         (Sized_input_reader::do_arg_serial): New function.
3022         (Sized_input_reader::do_get_unused_symbol_count): New function.
3023         (Sized_input_reader::do_get_unused_symbol): New function.
3024         (Sized_incremental_binary::do_input_file_count): New function.
3025         (Sized_incremental_binary::do_get_input_reader): Change signature;
3026         use index instead of filename.
3027         (Sized_incremental_binary::section_map_): New data member.
3028         (Sized_incremental_binary::input_entry_readers_): New data member.
3029         (class Sized_incr_relobj): New class.
3030         (class Sized_incr_dynobj): New class.
3031         (make_sized_incremental_object): New function.
3032         (class Incremental_library): New class.
3033         * layout.cc (Free_list::num_lists): New static data member.
3034         (Free_list::num_nodes): New static data member.
3035         (Free_list::num_removes): New static data member.
3036         (Free_list::num_remove_visits): New static data member.
3037         (Free_list::num_allocates): New static data member.
3038         (Free_list::num_allocate_visits): New static data member.
3039         (Free_list::init): New function.
3040         (Free_list::remove): New function.
3041         (Free_list::allocate): New function.
3042         (Free_list::dump): New function.
3043         (Free_list::print_stats): New function.
3044         (Layout_task_runner::run): Resize output file for incremental updates.
3045         (Layout::Layout): Initialize new data members.
3046         (Layout::set_incremental_base): New function.
3047         (Layout::init_fixed_output_section): New function.
3048         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3049         incremental updates.
3050         (Layout::create_gold_note): Do not create gold note section for
3051         incremental updates.
3052         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3053         for incremental updates.
3054         (Layout::set_section_offsets): For incremental updates, allocate space
3055         from free list.
3056         (Layout::create_symtab_sections): Layout with offsets relative to
3057         start of section; for incremental updates, allocate space from free
3058         list.
3059         (Layout::create_shdrs): For incremental updates, allocate space from
3060         free list.
3061         (Layout::finish_dynamic_section): For incremental updates, do not
3062         check --as-needed (fixed in subsequent patch).
3063         * layout.h (class Free_list): New class.
3064         (Layout::set_incremental_base): New function.
3065         (Layout::incremental_base): New function.
3066         (Layout::init_fixed_output_section): New function.
3067         (Layout::allocate): New function.
3068         (Layout::incremental_base_): New data member.
3069         (Layout::free_list_): New data member.
3070         * main.cc (main): Print Free_list statistics.
3071         * object.cc (Relobj::finalize_incremental_relocs): Add
3072         clear_counts parameter; clear counts only when clear_counts is set.
3073         (Sized_relobj::Sized_relobj): Initialize new base class.
3074         (Sized_relobj::do_layout): Don't report special sections.
3075         (Sized_relobj::do_for_all_local_got_entries): New function.
3076         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3077         symtab_off to all symbol table offsets.
3078         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3079         * object.h (class Got_offset_list): Move to top of file.
3080         (Object::Object): Allow case where input_file == NULL.
3081         (Object::~Object): Likewise.
3082         (Object::input_file): Assert that input_file != NULL.
3083         (Object::lock): Allow case where input_file == NULL.
3084         (Object::unlock): Likewise.
3085         (Object::is_locked): Likewise.
3086         (Object::token): Likewise.
3087         (Object::release): Likewise.
3088         (Object::is_incremental): New function.
3089         (Object::get_mtime): New function.
3090         (Object::for_all_local_got_entries): New function.
3091         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3092         (Object::set_is_in_system_directory): New function.
3093         (Object::is_in_system_directory): New function.
3094         (Object::do_is_incremental): New function.
3095         (Object::do_get_mtime): New function.
3096         (Object::do_for_all_local_got_entries): New function.
3097         (Object::is_in_system_directory_): New data member.
3098         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3099         (class Sized_relobj_base): New class.
3100         (class Sized_relobj): Derive from Sized_relobj_base.
3101         (class Sized_relobj::Symbols): Redeclare from base class.
3102         (class Sized_relobj::local_got_offset_list): Remove.
3103         (class Sized_relobj::Output_sections): Redeclare from base class.
3104         (class Sized_relobj::do_for_all_local_got_entries): New function.
3105         (class Sized_relobj::write_local_symbols): Add offset parameter.
3106         (class Sized_relobj::local_symbol_offset_): Update comment.
3107         (class Sized_relobj::local_dynsym_offset_): Update comment.
3108         * options.cc (Input_arguments::add_file): Remove const.
3109         * options.h (Input_file_argument::Input_file_argument):
3110         Initialize arg_serial_ (all constructors).
3111         (Input_file_argument::set_arg_serial): New function.
3112         (Input_file_argument::arg_serial): New function.
3113         (Input_file_argument::arg_serial_): New data member.
3114         (Input_arguments::Input_arguments): Initialize file_count_.
3115         (Input_arguments::add_file): Remove const.
3116         (Input_arguments::number_of_input_files): New function.
3117         (Input_arguments::file_count_): New data member.
3118         (Command_line::number_of_input_files): Call
3119         Input_arguments::number_of_input_files.
3120         * output.cc (Output_segment_headers::Output_segment_headers):
3121         Set current size.
3122         (Output_section::Input_section::current_data_size): New function.
3123         (Output_section::Output_section): Initialize new data members.
3124         (Output_section::add_input_section): Don't do merge sections for
3125         an incremental link; allocate space from free list for an
3126         incremental update.
3127         (Output_section::add_output_section_data): Allocate space from
3128         free list for an incremental update.
3129         (Output_section::update_data_size): New function.
3130         (Output_section::set_fixed_layout): New function.
3131         (Output_section::reserve): New function.
3132         (Output_segment::set_section_addresses): Remove const.
3133         (Output_segment::set_section_list_addresses): Remove const; allocate
3134         space from free list for an incremental update.
3135         (Output_segment::set_offset): Adjust size of RELRO segment for an
3136         incremental update.
3137         * output.h (Output_data::current_data_size): Move here from
3138         child classes.
3139         (Output_data::pre_finalize_data_size): New function.
3140         (Output_data::update_data_size): New function.
3141         (Output_section_headers::update_data_size): new function.
3142         (Output_section_data_build::current_data_size): Move to Output_data.
3143         (Output_data_strtab::update_data_size): New function.
3144         (Output_section::current_data_size): Move to Output_data.
3145         (Output_section::set_fixed_layout): New function.
3146         (Output_section::has_fixed_layout): New function.
3147         (Output_section::reserve): New function.
3148         (Output_section::update_data_size): New function.
3149         (Output_section::has_fixed_layout_): New data member.
3150         (Output_section::free_list_): New data member.
3151         (Output_segment::set_section_addresses): Remove const.
3152         (Output_segment::set_section_list_addresses): Remove const.
3153         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3154         New function.
3155         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3156         New function.
3157         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3158         parameter when calling Add_symbols constructor; store argument
3159         serial number for members of a lib group.
3160         (Add_symbols::locks): Allow case where token == NULL.
3161         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3162         (Read_member::~Read_member): New function.
3163         (Read_member::is_runnable): New function.
3164         (Read_member::locks): New function.
3165         (Read_member::run): New function.
3166         (Check_script::~Check_script): New function.
3167         (Check_script::is_runnable): New function.
3168         (Check_script::locks): New function.
3169         (Check_script::run): New function.
3170         (Check_library::~Check_library): New function.
3171         (Check_library::is_runnable): New function.
3172         (Check_library::locks): New function.
3173         (Check_library::run): New function.
3174         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3175         (Add_symbols::library_): New data member.
3176         (class Read_member): New class.
3177         (class Check_script): New class.
3178         (class Check_library): New class.
3179         * reloc.cc (Read_relocs::is_runnable): Allow case where
3180         token == NULL.
3181         (Read_relocs::locks): Likewise.
3182         (Scan_relocs::locks): Likewise.
3183         (Relocate_task::locks): Likewise.
3184         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3185         to clear counters.
3186         (Sized_relobj::incremental_relocs_scan): Fix comment.
3187         (Sized_relobj::do_relocate): Pass output file offset to
3188         write_local_symbols.
3189         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3190         from class declaration.
3191         * script.cc (read_input_script): Allocate Script_info; pass
3192         argument serial number to report_script.
3193         * script.h (class Script_info): Move to incremental.h.
3194         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3195         * symtab.h (Symbol_table::add_from_incrobj): New function.
3196         (Symbol_table::set_file_offset): New function.
3197
3198 2011-04-05  Cary Coutant  <ccoutant@google.com>
3199
3200         * incremental-dump.cc (dump_incremental_inputs): Change signature
3201         to take a Sized_incremental_binary; change caller.  Use readers
3202         in Sized_incremental_binary.
3203         * incremental.cc
3204         (Sized_incremental_binary::find_incremental_inputs_sections):
3205         Rename do_find_incremental_inputs_sections to this.
3206         (Sized_incremental_binary::setup_readers): New function.
3207         (Sized_incremental_binary::do_check_inputs): Check
3208         has_incremental_info_ flag; move setup code to setup_readers;
3209         use input readers.
3210         (Sized_incremental_binary::do_file_is_unchanged): New function.
3211         (Sized_incremental_binary::do_get_input_reader): New function.
3212         * incremental.h (class Incremental_binary): Move to end of file.
3213         (Incremental_binary::file_is_unchanged): New function.
3214         (Incremental_binary::do_file_is_unchanged): New function.
3215         (Incremental_binary::Input_reader): New class.
3216         (Incremental_binary::get_input_reader): New function.
3217         (class Sized_incremental_binary): Move to end of file.
3218         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3219         input section reader classes.
3220         (Sized_incremental_binary::has_incremental_info): New function.
3221         (Sized_incremental_binary::inputs_reader): New function.
3222         (Sized_incremental_binary::symtab_reader): New function.
3223         (Sized_incremental_binary::relocs_reader): New function.
3224         (Sized_incremental_binary::got_plt_reader): New function.
3225         (Sized_incremental_binary::do_file_is_unchanged): New function.
3226         (Sized_incremental_binary::Sized_input_reader): New class.
3227         (Sized_incremental_binary::get_input_reader): New function.
3228         (Sized_incremental_binary::find_incremental_inputs_sections):
3229         Rename do_find_incremental_inputs_sections to this.
3230         (Sized_incremental_binary::setup_readers): New function.
3231         (Sized_incremental_binary::has_incremental_info_): New data member.
3232         (Sized_incremental_binary::inputs_reader_): New data member.
3233         (Sized_incremental_binary::symtab_reader_): New data member.
3234         (Sized_incremental_binary::relocs_reader_): New data member.
3235         (Sized_incremental_binary::got_plt_reader_): New data member.
3236         (Sized_incremental_binary::current_input_file_): New data member.
3237
3238 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3239
3240         PR gold/12640
3241         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3242         violation.
3243
3244 2011-03-30  Cary Coutant  <ccoutant@google.com>
3245
3246         * archive.cc (Archive::include_member): Adjust call to report_object.
3247         (Add_archive_symbols::run): Add script_info to call to
3248         report_archive_begin.
3249         (Lib_group::include_member): Adjust call to report_object.
3250         (Add_lib_group_symbols::run): Adjust call to report_object.
3251         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3252         blocks.  Add object count for script input files.
3253         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3254         script_info parameter; change all callers.
3255         (Incremental_inputs::report_object): Add script_info parameter;
3256         change all callers.
3257         (Incremental_inputs::report_script): Store backpointer to
3258         incremental info entry.
3259         (Output_section_incremental_inputs::set_final_data_size): Record
3260         additional information for scripts.
3261         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3262         * incremental.h (Incremental_script_entry::add_object): New function.
3263         (Incremental_script_entry::get_object_count): New function.
3264         (Incremental_script_entry::get_object): New function.
3265         (Incremental_script_entry::objects_): New data member; adjust
3266         constructor.
3267         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3268         (Incremental_inputs::report_object): Add script_info parameter.
3269         (Incremental_inputs_reader::get_object_count): New function.
3270         (Incremental_inputs_reader::get_object_offset): New function.
3271         * options.cc (Input_arguments::add_file): Return reference to
3272         new input argument.
3273         * options.h (Input_argument::set_script_info): New function.
3274         (Input_argument::script_info): New function.
3275         (Input_argument::script_info_): New data member; adjust all
3276         constructors.
3277         (Input_file_group::add_file): Return reference to new input argument.
3278         (Input_file_lib::add_file): Likewise.
3279         (Input_arguments::add_file): Likewise.
3280         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3281         * script.cc (Parser_closure::Parser_closure): Add script_info
3282         parameter; adjust all callers.
3283         (Parser_closure::script_info): New function.
3284         (Parser_closure::script_info_): New data member.
3285         (read_input_script): Report scripts earlier to incremental info.
3286         (script_add_file): Set script_info in Input_argument.
3287         (script_add_library): Likewise.
3288         * script.h (Script_options::Script_info): Rewrite class.
3289
3290 2011-03-29  Cary Coutant  <ccoutant@google.com>
3291
3292         * archive.cc (Library_base::should_include_member): Move
3293         method here from class Archive.
3294         (Archive::Archive): Initialize base class.
3295         (Archive::should_include_member): Move to base class.
3296         (Archive::do_for_all_unused_symbols): New function.
3297         (Add_archive_symbols::run): Remove redundant access to
3298         incremental_inputs.
3299         (Lib_group::Lib_group): Initialize base class.
3300         (Lib_group::do_filename): New function.
3301         (Lib_group::include_member): Pass pointer to Lib_group to
3302         report_object.
3303         (Lib_group::do_for_all_unused_symbols): New function.
3304         (Add_lib_group_symbols::run): Report archive information for
3305         incremental links.
3306         * archive.h (class Library_base): New base class.
3307         (class Archive): Derive from Library_base.
3308         (Archive::filename): Move to base class.
3309         (Archive::set_incremental_info): Likewise.
3310         (Archive::incremental_info): Likewise.
3311         (Archive::Should_include): Likewise.
3312         (Archive::should_include_member): Likewise.
3313         (Archive::Armap_entry): Remove.
3314         (Archive::Unused_symbol_iterator): Remove.
3315         (Archive::unused_symbols_begin): Remove.
3316         (Archive::unused_symbols_end): Remove.
3317         (Archive::do_filename): New function.
3318         (Archive::do_get_mtime): New function.
3319         (Archive::do_for_all_unused_symbols): New function.
3320         (Archive::task_): Move to base class.
3321         (Archive::incremental_info_): Likewise.
3322         (class Lib_group): Derive from Library_base.
3323         (Lib_group::do_filename): New function.
3324         (Lib_group::do_get_mtime): New function.
3325         (Lib_group::do_for_all_unused_symbols): New function.
3326         (Lib_group::task_): Move to base class.
3327         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3328         function.
3329         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3330         function.
3331         * incremental.cc (Incremental_inputs::report_archive_begin):
3332         Use Library_base; call library's get_mtime; add incremental inputs
3333         entry before members.
3334         (class Unused_symbol_visitor): New class.
3335         (Incremental_inputs::report_archive_end): Use Library_base; use
3336         visitor class to record unused symbols; don't add incremental inputs
3337         entry after members.
3338         (Incremental_inputs::report_object): Use Library_base.
3339         * incremental.h
3340         (Incremental_archive_entry::Incremental_archive_entry): Remove
3341         unused Archive parameter.
3342         (Incremental_inputs::report_archive_begin): Use Library_base.
3343         (Incremental_inputs::report_archive_end): Likewise.
3344         (Incremental_inputs::report_object): Likewise.
3345         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3346         function.
3347         * object.h (Object::for_all_global_symbols): New function.
3348         (Object::do_for_all_global_symbols): New function.
3349         (Sized_relobj::do_for_all_global_symbols): New function.
3350         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3351         function.
3352         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3353         function.
3354
3355 2011-03-27  Ian Lance Taylor  <iant@google.com>
3356
3357         * archive.cc (Archive::interpret_header): Return -1 if something
3358         goes wrong.  Change callers accordingly.
3359
3360 2011-03-25  Cary Coutant  <ccoutant@google.com>
3361
3362         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3363         * testsuite/Makefile.in: Regenerate.
3364
3365 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3366
3367         * plugin.cc (get_view): New.
3368         (Plugin::load): Pass get_view to the plugin.
3369         (Plugin_manager::get_view): New.
3370
3371 2011-03-21  Ian Lance Taylor  <iant@google.com>
3372
3373         * testsuite/final_layout.sh: Rewrite to not use dc.
3374         * testsuite/relro_test.sh: Fail if dc is not present.
3375
3376 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3377
3378         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3379         Change == to -eq.
3380         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3381         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3382         Change == to -eq.
3383         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3384         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3385
3386 2011-03-14  Ian Lance Taylor  <iant@google.com>
3387
3388         * script-sections.cc (Sort_output_sections::script_compare):
3389         Rename from is_before, change return type.
3390         (Sort_output_sections::operator()): Adjust accordingly.
3391
3392 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3393
3394         PR gold/12572
3395         * testsuite/odr_violation2.cc: Add comment to make all error line
3396         numbers double digits.
3397         * testsuite/debug_msg.sh: Adjust expected errors.
3398
3399 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3400
3401         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3402         but mark earlier ones as non-canonical
3403         (offset_to_iterator): Update search target and example
3404         (do_addr2line): Return extra lines in a vector*
3405         (format_file_lineno): Extract from do_addr2line
3406         (one_addr2line): Add vector* out-param
3407         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3408         when a lineno entry appeared last for its instruction
3409         (Dwarf_line_info): Add vector* out-param
3410         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3411         * symtab.cc (Odr_violation_compare): Include the lineno in the
3412         comparison again.
3413         (linenos_from_loc): New. Combine the canonical line for an
3414         address with its other lines.
3415         (True_if_intersect): New. Helper functor to make
3416         std::set_intersection a query.
3417         (detect_odr_violations): Compare sets of lines instead of just
3418         one line for each function. This became less deterministic, but
3419         has fewer false positives.
3420         * symtab.h: Declarations.
3421         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3422         mix an optimized and non-optimized object in the same binary
3423         (odr_violation2.so): Same.
3424         * testsuite/Makefile.in: Regenerate from Makefile.am.
3425         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3426         * testsuite/debug_msg.sh: Update line numbers and add
3427         assertions.
3428         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3429         non-optimized context.
3430         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3431         isn't inlined, and use OdrDerived in an optimized context.
3432         * testsuite/odr_header1.h: Defines OdrDerived, where
3433         optimization will change the
3434         first-instruction-in-the-destructor's file and line number.
3435         * testsuite/odr_header2.h: Defines OdrBase.
3436
3437 2011-03-09  Ian Lance Taylor  <iant@google.com>
3438
3439         * fileread.cc (File_read::clear_views): Don't delete the whole
3440         file view.
3441
3442 2011-03-08  Ian Lance Taylor  <iant@google.com>
3443
3444         PR gold/12525
3445         * fileread.cc: #include <climits>.
3446         (GOLD_IOV_MAX): Define.
3447         (File_read::read_multiple): Limit number of entries by iov_max.
3448         * fileread.h (class File_read): Always set max_readv_entries to
3449         128.
3450
3451 2011-03-07  Ian Lance Taylor  <iant@google.com>
3452
3453         PR gold/12525
3454         * options.h (class General_options): Add -dy and -dn.
3455
3456 2011-03-02  Cary Coutant  <ccoutant@google.com>
3457
3458         * testsuite/script_test_9.t: Add TLS segment.
3459
3460 2011-03-02  Simon Baldwin  <simonb@google.com>
3461
3462         * configure.ac: Add check for gnu_indirect_function support in
3463         the toolchain building binutils.
3464         * configure: Rebuild.
3465
3466 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3467
3468         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3469         plugin only symbols.
3470         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3471         in plugin files as not needed in the symbol table.
3472
3473 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3474
3475         * output.cc (Output_section::add_input_section): Delay fill
3476         generation for section ordering.
3477
3478 2011-02-09  Ian Lance Taylor  <iant@google.com>
3479
3480         PR gold/12316
3481         * object.h (class Sized_relobj): Remove clear_local_symbols.
3482         * reloc.cc (Sized_relobj::do_relocate): Don't call
3483         clear_local_symbols.
3484
3485 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3486
3487         * plugin.cc (is_visible_from_outside): Return true for symbols
3488         in the -u option.
3489
3490 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3491
3492         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3493         filename.
3494
3495 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3496
3497         * icf.h (is_section_foldable_candidate): Change type of parameter
3498         to std::string.
3499         * icf.cc (Icf::find_identical_sections): Change type of local variable
3500         section_name to be std::string.
3501         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3502
3503 2011-01-25  Ian Lance Taylor  <iant@google.com>
3504
3505         * script.cc (script_add_extern): Rewrite to use
3506         add_symbol_reference.
3507
3508 2011-01-25  Doug Kwan  <dougkwan@google.com>
3509
3510         * icf.cc (get_section_contents): Always lock section's object.
3511
3512 2011-01-24  Ian Lance Taylor  <iant@google.com>
3513
3514         * options.h (class General_options): Accept
3515         --no-detect-odr-violations.
3516
3517 2011-01-24  Ian Lance Taylor  <iant@google.com>
3518
3519         * version.cc (version_string): Bump to 1.11.
3520
3521 2011-01-24  Ian Lance Taylor  <iant@google.com>
3522
3523         * plugin.cc (class Plugin_rescan): Define new class.
3524         (Plugin_manager::claim_file): Set any_claimed_.
3525         (Plugin_manager::save_archive): New function.
3526         (Plugin_manager::save_input_group): New function.
3527         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3528         necessary.
3529         (Plugin_manager::new_undefined_symbol): New function.
3530         (Plugin_manager::rescan): New function.
3531         (Plugin_manager::rescannable_defines): New function.
3532         (Plugin_manager::add_input_file): Set any_added_.
3533         * plugin.h (class Plugin_manager): define new fields rescannable_,
3534         undefined_symbols_, any_claimed_, and any_added_.  Declare
3535         Plugin_rescan as friend.  Declare new functions.
3536         (Plugin_manager::Rescannable): Define type.
3537         (Plugin_manager::Rescannable_list): Define type.
3538         (Plugin_manager::Undefined_symbol_list): Define type.
3539         (Plugin_manager::Plugin_manager): Initialize new fields.
3540         * archive.cc (Archive::defines_symbol): New function.
3541         (Add_archive_symbols::run): Pass archive to plugins if any.
3542         * archive.h (class Archive): Declare defines_symbol.
3543         * readsyms.cc (Input_group::~Input_group): New function.
3544         (Finish_group::run): Pass input_group to plugins if any.
3545         * readsyms.h (class Input_group): Declare destructor.
3546         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3547         any.
3548
3549 2011-01-10  Ian Lance Taylor  <iant@google.com>
3550
3551         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3552         section as relro.
3553         (Layout::set_segment_offsets): Reset increase_relro before calling
3554         set_section_addresses a second time.
3555
3556 2011-01-04  Cary Coutant  <ccoutant@google.com>
3557
3558         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3559         sections before NOBITS sections.
3560
3561 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3562
3563         * version.cc (print_version): Update copyright to 2011.
3564
3565 2010-12-23  Cary Coutant  <ccoutant@google.com>
3566
3567         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3568         of OS to this->add.  Add OD parameter to second form of the function.
3569
3570 2010-12-20  Ian Lance Taylor  <iant@google.com>
3571
3572         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3573         second of two consecutive entries with same offset.
3574
3575 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3576
3577         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3578         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3579         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3580         to avoid unneeded links against $(LDADD).
3581         * testsuite/Makefile.in: Regenerate.
3582
3583 2010-12-15  Ian Lance Taylor  <iant@google.com>
3584
3585         PR gold/12324
3586         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3587         for R_X86_64_32 and R_X86_64_PC32.
3588         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3589         ver_matching_def_pic.o.
3590         (ver_matching_def_pic.o): New target.
3591
3592 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3593
3594         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3595         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3596         Move definition before File_read::View member definitions.
3597         (File_read::View::~View): Initialize and hold lock before
3598         updating current_mapped_bytes.
3599
3600 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3601
3602         * dwarf_reader.cc: Remove outdated comment.
3603         * gold-threads.cc: Fix typo in error message.
3604         * archive.cc: Fix typos in comments.
3605         * archive.h: Likewise.
3606         * arm-reloc-property.cc: Likewise.
3607         * arm-reloc-property.h: Likewise.
3608         * arm-reloc.def: Likewise.
3609         * arm.cc: Likewise.
3610         * attributes.h: Likewise.
3611         * cref.cc: Likewise.
3612         * ehframe.cc: Likewise.
3613         * fileread.h: Likewise.
3614         * gold.h: Likewise.
3615         * i386.cc: Likewise.
3616         * icf.cc: Likewise.
3617         * incremental.h: Likewise.
3618         * int_encoding.cc: Likewise.
3619         * layout.h: Likewise.
3620         * main.cc: Likewise.
3621         * merge.h: Likewise.
3622         * object.cc: Likewise.
3623         * object.h: Likewise.
3624         * options.cc: Likewise.
3625         * readsyms.cc: Likewise.
3626         * reduced_debug_output.cc: Likewise.
3627         * reloc.cc: Likewise.
3628         * script-sections.cc: Likewise.
3629         * sparc.cc: Likewise.
3630         * symtab.h: Likewise.
3631         * target-reloc.h: Likewise.
3632         * target.cc: Likewise.
3633         * target.h: Likewise.
3634         * timer.cc: Likewise.
3635         * timer.h: Likewise.
3636         * x86_64.cc: Likewise.
3637
3638 2010-12-09  Cary Coutant  <ccoutant@google.com>
3639
3640         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3641         stack.
3642         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3643         parameter; change all callers.
3644         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3645         * options.h (warn_execstack): New option.
3646
3647 2010-12-07  Doug Kwan  <dougkwan@google.com>
3648
3649         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3650         like function call relocations.
3651
3652 2010-12-07  Ian Lance Taylor  <iant@google.com>
3653
3654         * archive.cc (Archive::get_elf_object_for_member): Permit
3655         punconfigured to be NULL.
3656         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3657         (Archive::include_member): Pass NULL to get_elf_object_for_member
3658         if we searched for the archive and this is the first included
3659         object.
3660
3661 2010-12-01  Ian Lance Taylor  <iant@google.com>
3662
3663         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3664         track_relocs_type_ field.
3665         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3666         Set track_relocs_type_.
3667         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3668         contents when using RELA relocs.
3669         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3670         reloc_map_.
3671         * reloc.cc (Track_relocs::next_addend): New function.
3672         * reloc.h (class Track_relocs): Declare next_addend.
3673
3674 2010-12-01  Ian Lance Taylor  <iant@google.com>
3675
3676         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3677         virtual destructor.
3678
3679 2010-12-01  Ian Lance Taylor  <iant@google.com>
3680
3681         * README: Update compilers known to work and fail.
3682
3683 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3684
3685         * configure.in: For --enable-gold, handle value `default' instead of
3686         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3687         not the default.
3688         * configure: Regenerate.
3689
3690 2010-11-18  Doug Kwan  <dougkwan@google.com>
3691
3692         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3693         and right_alignment to be zero.  Store result alignment only if it is
3694         greater than existing alignment.
3695
3696 2010-11-16  Cary Coutant  <ccoutant@google.com>
3697
3698         PR gold/12220
3699         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3700         Check for ".zdebug_line".
3701
3702 2010-11-16  Doug Kwan  <dougkwan@google.com>
3703             Cary Coutant  <ccoutant@google.com>
3704
3705         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3706         by reference; adjust all callers.
3707         * output.cc (Output_segment::set_section_addresses): Adjust references
3708         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3709         list is empty.
3710         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3711         end at page boundary.
3712
3713 2010-11-16  Cary Coutant  <ccoutant@google.com>
3714
3715         PR gold/12220
3716         * layout.cc (Layout::choose_output_section): Transform names of
3717         compressed sections even when using a script with a SECTIONS clause.
3718         (Layout::output_section_name): Remove code to transform
3719         compressed debug section names.
3720         * output.cc (Output_section::add_input_section): Use uncompressed
3721         section size when tracking input sections.
3722
3723 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3724
3725         * symtab.h (Symbol::NON_PIC_REF): Remove.
3726         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3727         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3728         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3729         (Symbol::use_plt_offset): Take a flags argument and pass it
3730         directly to needs_dynamic_reloc.  Restrict check for undefined
3731         weak symbols to function calls.
3732         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3733         (Target_arm::Scan::global): Use it.
3734         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3735         (Target_arm::Relocate::relocate): Likewise.
3736         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3737         parameter with an r_type parameter.  Use get_reference_flags
3738         to get the flags.
3739         (Target_arm::Relocate::relocate): Update accordingly.
3740         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3741         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3742         (Target_i386::Scan::global): Likewise.
3743         (Target_i386::Relocate::relocate): Likewise.
3744         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3745         parameter with an r_type parameter.  Use get_reference_flags
3746         to get the flags.
3747         (Target_i386::Relocate::relocate): Update accordingly.
3748         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3749         (Target_powerpc::Scan::global): Use it.
3750         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3751         (Target_powerpc::Relocate::relocate): Likewise.
3752         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3753         (Target_sparc::Scan::global): Use it.
3754         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3755         (Target_sparc::Relocate::relocate): Likewise.
3756         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3757         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3758         (Target_x86_64::Scan::global): Likewise.
3759         (Target_x86_64::Relocate::relocate): Likewise.
3760
3761 2010-11-08  Doug Kwan  <dougkwan@google.com>
3762             Cary Coutant  <ccoutant@google.com>
3763
3764         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3765         (Arm_exidx_merge_section::section_contents_): New data member.
3766         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3767         (Arm_input_section::~Arm_input_section): De-allocate memory.
3768         (Arm_input_section::original_contents_): New data member.
3769         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3770         in parameters instead of calling Object::section_contents without
3771         locking.
3772         (Arm_output_section::group_section): New parameter TASK.  Pass it
3773         to callees that need locking objects.
3774         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3775         to lock EXIDX input sections.  Fix a formatting issue.  Call
3776         Arm_exidx_merged_section::build_contents to create merged section
3777         contents.
3778         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3779         to lock object of stub table owner.
3780         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3781         TEXT_SIZE to initialize data member TEXT_SIZE_.
3782         (Arm_exidx_input_section::addralign): Fix typo in comment.
3783         (Arm_exidx_input_section::text_size): New method.
3784         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3785         that require locking objects.  Lock objects before scanning for stubs
3786         and updating local symbols.
3787         (Arm_input_section<big_endian>::init): Copy contents of original
3788         input section.
3789         (Arm_input_section<big_endian>::do_write): Use saved contents of
3790         original input section instead of calling Object::section_contents
3791         without locking.
3792         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3793         size without calling Object::section_size().
3794         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3795         for size.  Allocate a buffer for merged EXIDX entries.
3796         (Arm_exidx_merged_section::build_contents): New method.
3797         (Arm_exidx_merged_section::do_write): Move merge section contents
3798         building code to Arm_exidx_merged_section::build_contetns.  Write
3799         out contetns in buffer instead of building it on the fly.
3800         (Arm_relobj::make_exidx_input_section): Also pass text section size
3801         to Arm_exidx_input_section constructor.
3802         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3803         (Arm_dynobj::do_read_symbols): Fix memory leak.
3804         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3805         * target.h: (class Task): Add forward declaration.
3806         (Target::relax): Add new parameter TASK and pass it to
3807         Target::do_relax().
3808         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3809
3810 2010-11-05  Cary Coutant  <ccoutant@google.com>
3811
3812         PR gold/10708
3813         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3814         object when reading from the file.
3815         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3816         second layout pass.
3817         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3818         when reading section contents.
3819         (get_section_contents): Likewise.
3820         (icf::find_identical_sections): Likewise.
3821         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3822         object when reading from the file.
3823         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3824         the object when doing deferred section layout.
3825
3826 2010-11-03  Nick Clifton  <nickc@redhat.com>
3827
3828         PR gold/12001
3829         * script.h (class Symbol_assignment: name): New member.  Returns
3830         the name of the symbol.
3831         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3832         Returns true if the given symbol name is on the list of
3833         assignments wating to be processed.
3834         * archive.cc (should_incldue_member): If the symbol is undefined,
3835         check to see if it is on the list of symbols pending assignment.
3836
3837 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3838
3839         * script-sections.cc (Script_sections::find_memory_region): Check
3840         for a NULL output section pointer.
3841
3842 2010-10-29  Doug Kwan  <dougkwan@google.com>
3843
3844         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3845         Output_section::add_relaxed_input_section.
3846         * output.cc (Output_section::add_relaxed_input_section): Add new
3847         arguments LAYOUT and NAME.  Set section order index.
3848         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3849         Copy section order index.
3850         * output.h (Output_section::add_relaxed_input_section): Add new
3851         arguments LAYOUT and NAME.
3852
3853 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3854
3855         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3856         NATIVE_OR_CROSS_LINKER.
3857         * testsuite/Makefile.in: Regenerate.
3858
3859 2010-10-20  Doug Kwan  <dougkwan@google.com>
3860
3861         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3862         without SHF_LINK_ORDER flags.
3863         * layout.cc (Layout::choose_output_section): Do not filter
3864         SHF_LINK_ORDER flag in a relocatable link.
3865
3866 2010-10-17  Cary Coutant  <ccoutant@google.com>
3867
3868         * output.h (Output_segment::set_section_addresses): Change function
3869         signature.  Update all callers.
3870         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3871         sections.
3872         (Output_segment::set_section_addresses): Align after last TLS
3873         section.  Add padding before last relro section instead of after.
3874
3875 2010-10-17  Doug Kwan  <dougkwan@google.com>
3876
3877         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3878         GOT output section to be writable.
3879
3880 2010-10-14  Cary Coutant  <ccoutant@google.com>
3881
3882         * debug.h (DEBUG_INCREMENTAL): New flag.
3883         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3884         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3885         mode.
3886         * incremental.cc (report_command_line): Ignore all forms of
3887         --incremental.
3888         * layout.cc (Layout::Layout): Check parameters for incremental link
3889         mode.
3890         * options.cc (General_options::parse_incremental): New function.
3891         (General_options::parse_no_incremental): New function.
3892         (General_options::parse_incremental_full): New function.
3893         (General_options::parse_incremental_update): New function.
3894         (General_options::incremental_mode_): New data member.
3895         (General_options::finalize): Check incremental_mode_.
3896         * options.h (General_options): Update help text for --incremental.
3897         Add --no-incremental, --incremental-full, --incremental-update.
3898         (General_options::Incremental_mode): New enum type.
3899         (General_options::incremental_mode): New function.
3900         (General_options::incremental_mode_): New data member.
3901         * parameters.cc (Parameters::incremental_mode_): New data member.
3902         (Parameters::set_options): Set incremental_mode_.
3903         (Parameters::set_incremental_full): New function.
3904         (Parameters::incremental): New function.
3905         (Parameters::incremental_update): New function.
3906         (set_parameters_incremental_full): New function.
3907         * parameters.h (Parameters::set_incremental_full): New function.
3908         (Parameters::incremental): New function.
3909         (Parameters::incremental_update): New function.
3910         (Parameters::incremental_mode_): New data member.
3911         (set_parameters_incremental_full): New function.
3912         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3913         incremental link mode.
3914         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3915         (Sized_relobj::do_relocate_sections): Likewise.
3916         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3917         option.
3918         * testsuite/Makefile.in: Regenerate.
3919         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3920
3921 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3922
3923         * script-sections.h (class Script_sections): Make
3924         Sections_elements typedef public.
3925         * script-sections.cc (class Sort_output_sections): Add elements_
3926         field.  Add constructor which sets it; change all callers.
3927         (Sort_output_sections::is_before): New function.
3928         (Sort_output_sections::operator()): Call is_before.
3929         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3930         conditional.
3931         * testsuite/script_test_10.sh: New test. Test script section
3932         order.
3933         * testsuite/script_test_10.t: Likewise.
3934         * testsuite/script_test_10.s: Likewise.
3935         * testsuite/Makefile.am: Wrap the cross linker tests and the
3936         common tests into NATIVE_OR_CROSS_LINKER.
3937         (check_SCRIPTS): Add script_test_10.sh.
3938         (check_DATA): Add script_test_10.stdout.
3939         (script_test_10.o, script_test_10): New targets.
3940         (script_test_10.stdout): New target.
3941         * configure, testsuite/Makefile.in: Regenerate.
3942
3943 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3944
3945         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3946         error for the deprecated relocations.
3947         (Target_arm::Scan::global): Likewise.
3948         (Target_arm::Relocate::relocate): Likewise.
3949
3950 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3951
3952         * fileread.cc (Input_file::find_file): Initialize *found_name
3953         and *namep when using the fallback search for case 4.
3954
3955 2010-10-11  Cary Coutant  <ccoutant@google.com>
3956
3957         * options.h (class General_options): Redefine -z lazy as an alias for
3958         the negation of -z now.
3959
3960 2010-10-11  Ian Lance Taylor  <iant@google.com>
3961
3962         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3963         binding.
3964
3965 2010-10-06  Nick Clifton  <nickc@redhat.com>
3966
3967         * script-sections.cc(class Memory_region): Remove
3968         current_lma_offset_ field.  Rename current_vma_offset_ to
3969         current_offset_.  Add last_section_ field.
3970         (Memory_region::get_current_vma_address): Rename to
3971         get_current_address.
3972         (Memory_region::get_current_lma_address): Delete.
3973         (Memory_region::increment_vma_offset): Rename to
3974         increment_offset.
3975         (Memory_region::increment_lma_offset): Delete.
3976         (Memory_region::attributes_compatible): New method.  Returns
3977         true if the provided section is compatible with the region.
3978         (Memory_region::get_last_section): New method.  Returns the last
3979         section to use the region.
3980         (Memory_region::set_last_section): New method.  Stores the last
3981         section to use the region.
3982         (Script_sections::block_in_region): New method.  Returns true if
3983         a block of memory is contained within a region.
3984         (Script_sections::find_memory_region): New method.  Locates a
3985         memory region to be used to set a VMA or LMA address.
3986         (Output_section_definition::set_section_addresses): Add code to
3987         check for addresses set by memory regions.
3988         (Output_segment::set_section_addresses): Remove memory region
3989         walking code.
3990         (Script_sections::create_segment): Add a warning if a header
3991         segment is created outside of any region.
3992         * script-sections.h (class Script_sections): Add prototypes for
3993         find_memory_region and block_in_region methods.
3994         * testsuite/memory_test.s: Use .long instead of .word.
3995         * testsuite/memory_test.t: Add some more output sections.
3996         * testsuite/memory_test.sh: Update expected output.
3997
3998 2010-10-02  Doug Kwan  <dougkwan@google.com>
3999
4000         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4001         defintion to symtab.h
4002         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4003         declaration to defintion.
4004
4005 2010-10-01  Nick Clifton  <nickc@redhat.com>
4006
4007         * expression.cc (eval): Replace dummy argument with NULL.
4008         (eval_maybe_dot): Check for a NULL result section pointer.
4009         (Symbol_expression::value): Likewise.
4010         (Dot_expression::value): Likewise.
4011         (BINARY_EXPRESSION): Likewise.
4012         (Max_expression::value): Likewise.
4013         (Min_expression::value): Likewise.
4014         (Absolute_expression::value): Likewise.
4015         (Addr_expression::value_from_output_section): Likewise.
4016         (Loaddddr_expression::value_from_output_section): Likewise.
4017         (Segment_start_expression::value): Likewise.
4018         * script-sections.cc
4019         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4020         argument with NULL.
4021         (Sections_elememt_dot_assignment::set_section_addresses):
4022         Likewise.
4023         (Output_data_expression::do_write_to_buffer): Likewise.
4024         (Output_section_definition::finalize_symbols): Likewise.
4025         (Output_section_definition::set_section_addresses): Likewise.
4026
4027 2010-09-30  Doug Kwan  <dougkwan@google.com>
4028
4029         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4030
4031 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4032
4033         * target.h (Target::can_icf_inline_merge_sections): New virtual
4034         function.
4035         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4036         virtual function.
4037         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4038         virtual function.
4039         * icf.cc (get_section_contents): Inline merge sections only when
4040         target allows it.
4041
4042 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4043
4044         * configure: Regenerate.
4045
4046 2010-09-17  Ian Lance Taylor  <iant@google.com>
4047
4048         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4049         * testsuite/Makefile.am (memory_test.o): New target.
4050         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4051         memory_test.t.
4052         * testsuite/Makefile.in: Rebuild.
4053
4054 2010-09-17  Doug Kwan  <dougkwan@google.com>
4055
4056         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4057         defintion if relocation uses GOT entries of the symbol.
4058         * testsuite/icf_safe_test.sh: Fix test.
4059         * testsuite/icf_safe_so_test.sh: Fix test.
4060
4061 2010-09-16  Cary Coutant  <ccoutant@google.com>
4062
4063         * script_sections.cc (class Memory_region): Remove "NULL" from
4064         vector initializations.
4065
4066 2010-09-15  Cary Coutant  <ccoutant@google.com>
4067
4068         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4069         Resolve forwarding symbols.
4070
4071 2010-09-15  Doug Kwan  <dougkwan@google.com>
4072
4073         * gold/testsuite/script_test_3.t: Add ARM special sections.
4074         * gold/testsuite/script_test_4.t: Same.
4075         * gold/testsuite/script_test_5.t: Same.
4076         * gold/testsuite/script_test_6.t: Same.
4077         * gold/testsuite/script_test_7.t: Same.
4078         * gold/testsuite/script_test_7.t: Same.
4079         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4080
4081 2010-09-14  Cary Coutant  <ccoutant@google.com>
4082
4083         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4084         (Target_x86_64::Relocate::relocate_tls): Replace check for
4085         saw_tls_block_reloc_ with test for executable section.
4086
4087 2010-09-12  Cary Coutant  <ccoutant@google.com>
4088
4089         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4090         position-independent executables to shared libraries need dynamic
4091         relocations.
4092         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4093         position-independent executables.
4094         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4095         * testsuite/Makefile.in: Regenerate.
4096
4097 2010-09-10  Nick Clifton  <nickc@redhat.com>
4098
4099         PR gold/11997
4100         * testsuite/memory_test.t: Discard any sections that are not
4101         needed.
4102
4103 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4104
4105         PR gold/11996
4106         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4107         "This::" to work around a bug in gcc 4.2.
4108
4109         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4110
4111 2010-09-09  Rafael Espindola  <espindola@google.com>
4112
4113         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4114         sections with different PF_X flags in the same segment.
4115         (Layout::find_first_load_seg): Search all segments to find the first
4116         one.
4117         * options.h (rosegment): New.
4118
4119 2010-09-08  Rafael Espindola  <espindola@google.com>
4120
4121         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4122
4123 2010-09-08  Doug Kwan  <dougkwan@google.com>
4124
4125         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4126         (Arm_relobj::do_relocate_sections): Add new parameter for output
4127         file to match the parent.
4128         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4129         of local symbols instead of input values.  Update code to track
4130         changes in gold::relocate_section.
4131         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4132         (Sized_relobj::compute_final_local_value_internal): New methods.
4133         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4134         body into private version of Sized_relobj::compute_final_local_value.
4135         Call the inline method.
4136         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4137         merged symbol value if there is one.
4138         (Symbol_value::has_output_value): New method defintiion.
4139         (Sized_relobj::Compute_final_local_value_status): New enum type.
4140         (Sized_relobj::compute_final_local_value): New methods.
4141         (Sized_relobj::compute_final_local_value_internal): New methods.
4142         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4143         and arm_cortex_a8.sh.
4144         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4145         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4146         New tests.
4147         * Makefile.in: Regenerate.
4148         * testsuite/arm_bl_out_of_range.s: Update test.
4149         * testsuite/thumb_bl_out_of_range.s: Ditto.
4150         * testsuite/thumb_blx_out_of_range.s: Ditto.
4151         * testsuite/arm_branch_out_of_range.sh: New file.
4152         * testsuite/arm_cortex_a8.sh: Ditto.
4153         * testsuite/arm_cortex_a8_b.s: Ditto.
4154         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4155         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4156         * testsuite/arm_cortex_a8_bl.s: Ditto.
4157         * testsuite/arm_cortex_a8_blx.s: Ditto.
4158         * testsuite/arm_cortex_a8_local.s: Ditto.
4159         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4160         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4161
4162 2010-09-08  Rafael Espindola  <espindola@google.com>
4163
4164         * Makefile.am (memory_test.stdout): Run readelf with -W.
4165         * Makefile.in: Regenerate.
4166         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4167         64 bit output.
4168
4169 2010-09-08  Rafael Espindola  <espindola@google.com>
4170
4171         * script-sections.cc (Script_sections::add_memory_region): Convert
4172         field precision to int.
4173         * script.cc (script_set_section_region, script_set_section_region):
4174         Convert field precision to int.
4175
4176 2010-09-08  Rafael Espindola  <espindola@google.com>
4177
4178         * arm.cc (do_finalize_sections): Create the __exidx_start and
4179         __exdix_end symbols even when the section is missing.
4180
4181 2010-09-08  Nick Clifton  <nickc@redhat.com>
4182
4183         * README: Remove claim that MEMORY is not supported.
4184         * expression.cc (script_exp_function_origin)
4185         (script_exp_function_length): Move from here to ...
4186         * script.cc: ... here.
4187         (script_set_section_region, script_add_memory)
4188         (script_parse_memory_attr, script_include_directive): New
4189         functions.
4190         * script-sections.cc
4191         (class Memory_region): New class.
4192         (class Output_section_definition): Add set_memory_region,
4193         set_section_vma, set_section_lma and get_section_name methods.
4194         (class Script_Sections): Add add_memory_region,
4195         find_memory_region, find_memory_region_origin,
4196         find_memory_region_length and set_memory_region methods.
4197         Have set_section_addresses method walk the list of set memory
4198         regions.
4199         Extend the print methos to display memory regions.
4200         * script-sections.h: Add prototypes for new methods.
4201         Add enum for MEMORY region attributes.
4202         * yyscript.y: Add support for parsing MEMORY regions.
4203         * script-c.h: Add prototypes for new functions.
4204         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4205         * testsuite/Makefile.in: Regenerate.
4206         * testsuite/memory_test.sh: New script.
4207         * testsuite/memory_test.s: New assembler source file.
4208         * testsuite/memory_test.t: New linker script.
4209
4210 2010-08-27  Doug Kwan  <dougkwan@google.com>
4211
4212         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4213         reference override an existing dynamic weak reference.
4214         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4215         * testsuite/Makefile.in: Regenerate.
4216         * testsuite/dyn_weak_ref.sh: New file.
4217         * testsuite/dyn_weak_ref_1.c: Ditto.
4218         * testsuite/dyn_weak_ref_2.c: Ditto.
4219
4220 2010-08-27  Ian Lance Taylor  <iant@google.com>
4221
4222         * incremental.h (class Incremental_input_entry): Add virtual
4223         destructor.
4224
4225 2010-08-27  Ian Lance Taylor  <iant@google.com>
4226
4227         * testsuite/start_lib_test_3.c: Mark t3 as used.
4228
4229 2010-08-27  Nick Clifton  <nickc@redhat.com>
4230
4231         * options.cc (version_script): Fix small typo in previous
4232         whitespace tidyup.
4233
4234 2010-08-25  Nick Clifton  <nickc@redhat.com>
4235
4236         * archive.cc: Formatting fixes: Remove whitespace between
4237         typename and following asterisk.  Remove whitespace between
4238         function name and opening parenthesis.
4239         * archive.h: Likewise.
4240         * arm.cc: Likewise.
4241         * attributes.cc: Likewise.
4242         * attributes.h: Likewise.
4243         * common.cc: Likewise.
4244         * copy-relocs.cc: Likewise.
4245         * dirsearch.h: Likewise.
4246         * dynobj.cc: Likewise.
4247         * ehframe.cc: Likewise.
4248         * ehframe.h: Likewise.
4249         * expression.cc: Likewise.
4250         * fileread.cc: Likewise.
4251         * fileread.h: Likewise.
4252         * gc.h: Likewise.
4253         * gold-threads.cc: Likewise.
4254         * gold.cc: Likewise.
4255         * i386.cc: Likewise.
4256         * icf.h: Likewise.
4257         * incremental-dump.cc: Likewise.
4258         * incremental.cc: Likewise.
4259         * layout.cc: Likewise.
4260         * layout.h: Likewise.
4261         * main.cc: Likewise.
4262         * merge.cc: Likewise.
4263         * merge.h: Likewise.
4264         * object.cc: Likewise.
4265         * object.h: Likewise.
4266         * options.cc: Likewise.
4267         * options.h: Likewise.
4268         * output.cc: Likewise.
4269         * output.h: Likewise.
4270         * plugin.cc: Likewise.
4271         * plugin.h: Likewise.
4272         * powerpc.cc: Likewise.
4273         * reloc.cc: Likewise.
4274         * script-c.h: Likewise.
4275         * script-sections.cc: Likewise.
4276         * script.cc: Likewise.
4277         * stringpool.cc: Likewise.
4278         * symtab.cc: Likewise.
4279         * symtab.h: Likewise.
4280         * target.cc: Likewise.
4281         * timer.cc: Likewise.
4282         * timer.h: Likewise.
4283         * version.cc: Likewise.
4284         * x86_64.cc: Likewise.
4285
4286 2010-08-24  Nick Clifton  <nickc@redhat.com>
4287
4288         PR 11899
4289         * layout.cc (segment_precedes): Sort segments by their physical
4290         addresses, if they have been set.
4291
4292 2010-08-23  Cary Coutant  <ccoutant@google.com>
4293
4294         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4295         symbols data.
4296         (Lib_group::include_member): Unlock object after deleting its
4297         symbols data.
4298         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4299         the bug fixed here.
4300
4301 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4302             Cary Coutant  <ccoutant@google.com>
4303
4304         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4305         constructor, and set_blocker.
4306         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4307         readsyms_blocker_.
4308         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4309         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4310         * testsuite/Makefile.am (start_lib_test): New test case.
4311         * testsuite/Makefile.in: Regenerate.
4312         * testsuite/start_lib_test_main.c: New file.
4313         * testsuite/start_lib_test_1.c: New file.
4314         * testsuite/start_lib_test_2.c: New file.
4315         * testsuite/start_lib_test_3.c: New file.
4316
4317 2010-08-19  Ian Lance Taylor  <iant@google.com>
4318
4319         * Makefile.in: Rebuild with automake 1.11.1.
4320         * aclocal.m4: Likewise.
4321         * testsuite/Makefile.in: Likewise.
4322
4323 2010-08-19  Ian Lance Taylor  <iant@google.com>
4324
4325         PR 10893
4326         * i386.cc (class Output_data_plt_i386): Update declarations.
4327         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4328         local_ifuncs_ fields.
4329         (Target_i386::do_plt_section_for_global): New function.
4330         (Target_i386::do_plt_section_for_local): New function.
4331         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4332         parameter; change all callers.  Initialize global_ifuncs_ and
4333         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4334         __rel_iplt_end.
4335         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4336         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4337         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4338         symbols.
4339         (Target_i386::make_plt_section): New function, broken out of
4340         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4341         (Target_i386::make_plt_entry): Call make_plt_section.
4342         (Target_i386::make_local_ifunc_plt_entry): New function.
4343         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4344         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4345         R_386_IRELATIVE to switch.
4346         (Target_i386::Scan::global): Likewise.
4347         (Target_i386::Relocate::relocate): Likewise.
4348         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4349         switch.
4350         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4351         (Target_x86_64::do_plt_section_for_global): New function.
4352         (Target_x86_64::do_plt_section_for_local): New function.
4353         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4354         parameter; change all callers.  If doing a static link define
4355         __rela_iplt_start and __rela_iplt_end.
4356         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4357         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4358         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4359         to point to .plt.
4360         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4361         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4362         switch.
4363         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4364         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4365         R_X86_64_IRELATIVE to switch.
4366         (Target_x86_64::Scan::global): Likewise.
4367         (Target_x86_64::Relocate::relocate): Likewise.
4368         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4369         switch.
4370         * target.h (class Target): Add plt_section_for_global and
4371         plt_section_for_local functions.  Add do_plt_section_for_global
4372         and do_plt_section_for_local virtual functions.
4373         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4374         clarifying comments.
4375         (Symbol::use_plt_offset): Handle IFUNC symbol.
4376         * object.cc (Sized_relobj::Sized_relobj): Initialize
4377         local_plt_offsets_.
4378         (Sized_relobj::local_has_plt_offset): New function.
4379         (Sized_relobj::local_plt_offset): New function.
4380         (Sized_relobj::set_local_plt_offset): New function.
4381         (Sized_relobj::do_count): Handle IFUNC symbol.
4382         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4383         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4384         is_ifunc_symbol functions.
4385         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4386         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4387         local_plt_offsets_ field.
4388         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4389         * output.h (class Output_section_data): Add non-const
4390         output_section function.
4391         (class Output_data_got): Update declarations.
4392         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4393         Add use_plt_offset parameter to global and local constructors.
4394         Change all callers.  Change local_sym_index_ field to 31 bits.
4395         Change GSYM_CODE and CONSTANT_CODE accordingly.
4396         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4397         doing a static link don't set sh_link field.
4398         (Output_data_got::Got_entry::write): Use PLT offset if
4399         appropriate.
4400         (Output_data_got::add_global_plt): New function.
4401         (Output_data_got::add_local_plt): New function.
4402         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4403         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4404         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4405         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4406         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4407         IFUNC conditional.
4408         * testsuite/ifunc-sel.h: New file.
4409         * testsuite/ifuncmain1.c: New file.
4410         * testsuite/ifuncmain1vis.c: New file.
4411         * testsuite/ifuncmod1.c: New file.
4412         * testsuite/ifuncdep2.c: New file.
4413         * testsuite/ifuncmain2.c: New file.
4414         * testsuite/ifuncmain3.c: New file.
4415         * testsuite/ifuncmod3.c: New file.
4416         * testsuite/ifuncmain4.c: New file.
4417         * testsuite/ifuncmain5.c: New file.
4418         * testsuite/ifuncmod5.c: New file.
4419         * testsuite/ifuncmain6pie.c: New file.
4420         * testsuite/ifuncmod6.c: New file.
4421         * testsuite/ifuncmain7.c: New file.
4422         * configure, testsuite/Makefile.in: Rebuild.
4423
4424 2010-08-18  Ian Lance Taylor  <iant@google.com>
4425
4426         * incremental.cc
4427         (Output_section_incremental_inputs::write_input_files): Add cast
4428         to avoid signed/unsigned comparison warning.
4429         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4430
4431 2010-08-12  Cary Coutant  <ccoutant@google.com>
4432
4433         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4434
4435 2010-08-13  Ian Lance Taylor  <iant@google.com>
4436
4437         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4438
4439 2010-08-12  Cary Coutant  <ccoutant@google.com>
4440             Doug Kwan  <dougkwan@google.com>
4441
4442         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4443         defintion overrides non-weak undef, remember that the original undef
4444         is not weak.
4445         * symtab.cc (Symbol_table::sized_write_global): For undef without
4446         an original weak binding, set binding to global in output.
4447         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4448         * testsuite/Makefile.in: Regenerate.
4449         * testsuite/strong_ref_weak_def.sh: New file.
4450         * testsuite/strong_ref_weak_def_1.c: Ditto.
4451         * testsuite/strong_ref_weak_def_2.c: Ditto.
4452
4453 2010-08-12  Cary Coutant  <ccoutant@google.com>
4454
4455         * testsuite/incremental_test.sh: Rewrite.
4456         * testsuite/incremental_test_1.c: Rewrite.
4457         * testsuite/incremental_test_2.c: Rewrite.
4458
4459 2010-08-12  Cary Coutant  <ccoutant@google.com>
4460
4461         * arm.cc (Target_arm::got_size): Add const.
4462         (Target_arm::got_entry_count): New function.
4463         (Target_arm::plt_entry_count): New function.
4464         (Target_arm::first_plt_entry_offset): New function.
4465         (Target_arm::plt_entry_size): New function.
4466         (Output_data_plt_arm::entry_count): New function.
4467         (Output_data_plt_arm::first_plt_entry_offset): New function.
4468         (Output_data_plt_arm::get_plt_entry_size): New function.
4469         * i386.cc (Target_i386::got_size): Add const.
4470         (Target_i386::got_entry_count): New function.
4471         (Target_i386::plt_entry_count): New function.
4472         (Target_i386::first_plt_entry_offset): New function.
4473         (Target_i386::plt_entry_size): New function.
4474         (Output_data_plt_i386::entry_count): New function.
4475         (Output_data_plt_i386::first_plt_entry_offset): New function.
4476         (Output_data_plt_i386::get_plt_entry_size): New function.
4477         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4478         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4479         * incremental.cc: Include target.h.
4480         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4481         parameter.  Adjust all callers.  Find incremental_got_plt section.
4482         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4483         section.
4484         (Output_section_incremental_inputs::set_final_data_size): Calculate
4485         size of incremental_got_plt section.
4486         (Output_section_incremental_inputs::do_write): Write the
4487         incremental_got_plt section.
4488         (Got_plt_view_info): New struct.
4489         (Local_got_offset_visitor): New class.
4490         (Global_got_offset_visitor): New class.
4491         (Global_symbol_visitor_got_plt): New class.
4492         (Output_section_incremental_inputs::write_got_plt): New function.
4493         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4494         Add parameter.  Adjust all callers.
4495         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4496         (Incremental_inputs::got_plt_section): New function.
4497         (Incremental_inputs::got_plt_section_): New data member.
4498         (Incremental_got_plt_reader): New class.
4499         * layout.cc (Layout::create_incremental_info_sections): Add the
4500         incremental_got_plt section.
4501         * object.h (Got_offset_list::get_list): New function.
4502         (Got offset_list::for_all_got_offsets): New function.
4503         (Sized_relobj::local_got_offset_list): New function.
4504         * powerpc.cc (Target_powerpc::got_size): Add const.
4505         (Target_powerpc::got_entry_count): New function.
4506         (Target_powerpc::plt_entry_count): New function.
4507         (Target_powerpc::first_plt_entry_offset): New function.
4508         (Target_powerpc::plt_entry_size): New function.
4509         (Output_data_plt_powerpc::entry_count): New function.
4510         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4511         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4512         * sparc.cc (Target_sparc::got_size): Add const.
4513         (Target_sparc::got_entry_count): New function.
4514         (Target_sparc::plt_entry_count): New function.
4515         (Target_sparc::first_plt_entry_offset): New function.
4516         (Target_sparc::plt_entry_size): New function.
4517         (Output_data_plt_sparc::entry_count): New function.
4518         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4519         (Output_data_plt_sparc::get_plt_entry_size): New function.
4520         * symtab.h (Symbol::got_offset_list): New function.
4521         (Symbol_table::for_all_symbols): New function.
4522         * target.h (Sized_target::got_entry_count): New function.
4523         (Sized_target::plt_entry_count): New function.
4524         (Sized_target::plt_entry_size): New function.
4525         * x86_64.cc (Target_x86_64::got_size): Add const.
4526         (Target_x86_64::got_entry_count): New function.
4527         (Target_x86_64::plt_entry_count): New function.
4528         (Target_x86_64::first_plt_entry_offset): New function.
4529         (Target_x86_64::plt_entry_size): New function.
4530         (Output_data_plt_x86_64::entry_count): New function.
4531         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4532         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4533
4534 2010-08-12  Cary Coutant  <ccoutant@google.com>
4535
4536         * archive.cc: Include incremental.h.
4537         (Archive::Archive): Initialize incremental_info_.
4538         (Archive::include_member): Record archive members in incremental info.
4539         (Add_archive_symbols::run): Record begin and end of an archive in
4540         incremental info.
4541         (Lib_group::include_member): Record objects in incremental info.
4542         * archive.h (Incremental_archive_entry): Forward declaration.
4543         (Archive::set_incremental_info): New member function.
4544         (Archive::incremental_info): New member function.
4545         (Archive::Unused_symbol_iterator): New class.
4546         (Archive::unused_symbols_begin): New member function.
4547         (Archive::unused_symbols_end): New member function.
4548         (Archive::incremental_info_): New data member.
4549         * incremental-dump.cc (find_input_containing_global): New function.
4550         (dump_incremental_inputs): Dump new incremental info sections.
4551         * incremental.cc: Include symtab.h.
4552         (Output_section_incremental_inputs): New class.
4553         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4554         new incremental info sections.
4555         (Sized_incremental_binary::do_check_inputs): Likewise.
4556         (Incremental_inputs::report_archive): Remove.
4557         (Incremental_inputs::report_archive_begin): New function.
4558         (Incremental_inputs::report_archive_end): New function.
4559         (Incremental_inputs::report_object): New function.
4560         (Incremental_inputs::finalize_inputs): Remove.
4561         (Incremental_inputs::report_input_section): New function.
4562         (Incremental_inputs::report_script): Rewrite.
4563         (Incremental_inputs::finalize): Do nothing but finalize string table.
4564         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4565         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4566         (Incremental_inputs::create_data_sections): New function.
4567         (Incremental_inputs::relocs_entsize): New function.
4568         (Output_section_incremental_inputs::set_final_data_size): New function.
4569         (Output_section_incremental_inputs::do_write): New function.
4570         (Output_section_incremental_inputs::write_header): New function.
4571         (Output_section_incremental_inputs::write_input_files): New function.
4572         (Output_section_incremental_inputs::write_info_blocks): New function.
4573         (Output_section_incremental_inputs::write_symtab): New function.
4574         * incremental.h (Incremental_script_entry): Forward declaration.
4575         (Incremental_object_entry): Forward declaration.
4576         (Incremental_archive_entry): Forward declaration.
4577         (Incremental_inputs): Forward declaration.
4578         (Incremental_inputs_header_data): Remove.
4579         (Incremental_inputs_header): Remove.
4580         (Incremental_inputs_header_write): Remove.
4581         (Incremental_inputs_entry_data): Remove.
4582         (Incremental_inputs_entry): Remove.
4583         (Incremental_inputs_entry_write): Remove.
4584         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4585         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4586         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4587         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4588         Likewise.
4589         (Incremental_input_entry): New class.
4590         (Incremental_script_entry): New class.
4591         (Incremental_object_entry): New class.
4592         (Incremental_archive_entry): New class.
4593         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4594         (Incremental_inputs::report_inputs): Remove.
4595         (Incremental_inputs::report_archive): Remove.
4596         (Incremental_inputs::report_archive_begin): New function.
4597         (Incremental_inputs::report_archive_end): New function.
4598         (Incremental_inputs::report_object): Change prototype.
4599         (Incremental_inputs::report_input_section): New function.
4600         (Incremental_inputs::report_script): Change prototype.
4601         (Incremental_inputs::get_reloc_count): New function.
4602         (Incremental_inputs::set_reloc_count): New function.
4603         (Incremental_inputs::create_data_sections): New function.
4604         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4605         (Incremental_inputs::inputs_section): New function.
4606         (Incremental_inputs::symtab_section): New function.
4607         (Incremental_inputs::relocs_section): New function.
4608         (Incremental_inputs::get_stringpool): Add const.
4609         (Incremental_inputs::command_line): Add const.
4610         (Incremental_inputs::inputs): Remove.
4611         (Incremental_inputs::command_line_key): New function.
4612         (Incremental_inputs::input_file_count): New function.
4613         (Incremental_inputs::input_files): New function.
4614         (Incremental_inputs::relocs_entsize): New function.
4615         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4616         (Incremental_inputs::finalize_inputs): Remove.
4617         (Incremental_inputs::Input_info): Remove.
4618         (Incremental_inputs::lock_): Remove.
4619         (Incremental_inputs::inputs_): Change type.
4620         (Incremental_inputs::inputs_map_): Remove.
4621         (Incremental_inputs::current_object_entry_): New data member.
4622         (Incremental_inputs::inputs_section_): New data member.
4623         (Incremental_inputs::symtab_section_): New data member.
4624         (Incremental_inputs::relocs_section_): New data member.
4625         (Incremental_inputs::reloc_count_): New data member.
4626         (Incremental_inputs_reader): New class.
4627         (Incremental_symtab_reader): New class.
4628         (Incremental_relocs_reader): New class.
4629         * layout.cc (Layout::finalize): Move finalization of incremental info
4630         and creation of incremental info sections to follow finalization of
4631         symbol table.  Set offsets for postprocessing sections.
4632         (Layout::create_incremental_info_sections): Call
4633         Incremental_inputs::create_data_sections.  Add incremental symtab
4634         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4635         sections to layout after input sections.
4636         * layout.h (struct Timespec): Forward declaration.
4637         (Layout::incremental_inputs): Add const.
4638         (Layout::create_incremental_info_sections): Add parameter.
4639         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4640         * object.cc: Include incremental.h.
4641         (Relobj::finalize_incremental_relocs): New function.
4642         (Sized_relobj::do_layout): Record input sections in incremental info.
4643         * object.h (Object::output_section): New function.
4644         (Object::output_section_offset): Moved from Relobj.
4645         (Object::get_incremental_reloc_base): New function.
4646         (Object::get_incremental_reloc_count): New function.
4647         (Object::do_output_section): New function.
4648         (Object::do_output_section_offset): Moved from Relobj.
4649         (Object::do_get_incremental_reloc_base): New function.
4650         (Object::do_get_incremental_reloc_count): New function.
4651         (Object::Object): Initialize new data members.
4652         (Relobj::output_section): Renamed do_output_section and moved to
4653         protected.
4654         (Relobj::output_section_offset): Moved to Object.
4655         (Relobj::do_get_incremental_reloc_base): New function.
4656         (Relobj::do_get_incremental_reloc_count): New function.
4657         (Relobj::allocate_incremental_reloc_counts): New function.
4658         (Relobj::count_incremental_reloc): New function.
4659         (Relobj::finalize_incremental_relocs): New function.
4660         (Relobj::next_incremental_reloc_index): New function.
4661         (Relobj::reloc_counts_): New data member.
4662         (Relobj::reloc_bases_): New data member.
4663         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4664         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4665         (Sized_relobj::incremental_relocs_scan): New function.
4666         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4667         (Sized_relobj::incremental_relocs_write): New function.
4668         (Sized_relobj::incremental_relocs_write_reltype): New function.
4669         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4670         incremental link.
4671         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4672         archives and object files elsewhere.
4673         (Add_symbols::run): Report object files here.
4674         (Finish_group::run): Report end of archive at end of group.
4675         * reloc.cc: Include layout.h, incremental.h.
4676         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4677         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4678         (Sized_relobj::incremental_relocs_scan): New function.
4679         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4680         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4681         (Sized_relobj::incremental_relocs_write): New function.
4682         (Sized_relobj::incremental_relocs_write_reltype): New function.
4683         * script.cc (read_input_script): Rewrite test for incremental link.
4684         Change call to Incremental_inputs::report_script.
4685         * symtab.h (Symbol_table::first_global_index): New function.
4686         (Symbol_table::output_count): New function.
4687
4688 2010-08-12  Doug Kwan  <dougkwan@google.com>
4689
4690         * arm.cc (Target_arm::merge_object_attributes): Check command line
4691         options --no-wchar-size-warning and --no-enum-size-warning.
4692         * options.h (General_options): Add ld-compatible options
4693         --no-enum-size-warning and --no-wchar-size-warning.
4694
4695 2010-08-04  Ian Lance Taylor  <iant@google.com>
4696
4697         * x86_64.cc (Target_x86_64::Scan::local): Use
4698         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4699         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4700         (Target_x86_64::Scan::global): Likewise.
4701         (Target_x86_64::Relocate::relocate): Likewise.
4702         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4703         Likewise.
4704
4705 2010-08-03  Cary Coutant  <ccoutant@google.com>
4706
4707         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4708         to reserve space in merged_strings vector. Keep total input size
4709         for stats.
4710         (Output_merge_string::do_print_merge_stats): Print total input size.
4711         * merge.h (Output_merge_string): Add input_size_ field.
4712         * stringpool.cc (Stringpool_template::string_length): Move
4713         implementations out of Stringpool_template class and place in
4714         stringpool.h.
4715         * stringpool.h (string_length): Move out of Stringpool_template.
4716
4717 2010-08-03  Ian Lance Taylor  <iant@google.com>
4718
4719         PR 11712
4720         * layout.cc (relaxation_loop_body): If address of load segment is
4721         set, adjust address to include headers if possible.
4722
4723 2010-08-03  Ian Lance Taylor  <iant@google.com>
4724
4725         * version.cc (version_string): Bump to 1.10.
4726
4727 2010-08-03  Ian Lance Taylor  <iant@google.com>
4728
4729         PR 11805
4730         * layout.h (enum Output_section_order): Define.
4731         (class Layout): Update declarations.
4732         * layout.cc (Layout::get_output_section): Add order parameter.
4733         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4734         is_first_non_relro parameters.  Change all callers.
4735         (Layout::choose_output_section): Likewise.
4736         (Layout::add_output_section_data): Likewise.
4737         (Layout::make_output_section): Likewise.  Set order.
4738         (Layout::default_section_order): New function.
4739         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4740         * output.cc (Output_section::Output_section): Initialize order_.
4741         Don't initialize deleted fields.
4742         (Output_segment::Output_segment): Don't initialize deleted
4743         fields.
4744         (Output_segment::add_output_section_to_load): New function
4745         replacing add_output_section.  Change all callers to call this or
4746         add_output_section_to_nonload.
4747         (Output_segment::add_output_section_to_nonload): New function.
4748         (Output_segment::remove_output_section): Rewrite.
4749         (Output_segment::add_initial_output_data): Likewise.
4750         (Output_segment::has_any_data_sections): Likewise.
4751         (Output_segment::is_first_section_relro): Likewise.
4752         (Output_segment::maximum_alignment): Likewise.
4753         (Output_segment::has_dynamic_reloc): New function replacing
4754         dynamic_reloc_count.  Change all callers.
4755         (Output_segment::has_dynamic_reloc_list): New function replacing
4756         dynamic_reloc_count_list.  Change all callers.
4757         (Output_segment::set_section_addresses): Rewrite.
4758         (Output_segment::set_offset): Rewrite.
4759         (Output_segment::find_first_and_last_list): Remove.
4760         (Output_segment::set_tls_offsets): Rewrite.
4761         (Output_segment::first_section_load_address): Likewise.
4762         (Output_segment::output_section_count): Likewise.
4763         (Output_segment::section_with_lowest_load_address): Likewise.
4764         (Output_segment::write_section_headers): Likewise.
4765         (Output_segment::print_sections_to_map): Likewise.
4766         * output.h (class Output_data): Remove dynamic_reloc_count_
4767         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4768         (Output_data::add_dynamic_reloc): Rewrite.
4769         (Output_data::has_dynamic_reloc): New function.
4770         (Output_data::dynamic_reloc_count): Remove.
4771         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4772         is_last_relro_, is_first_non_relro_, is_interp_,
4773         is_dynamic_linker_section_ fields.  Add order and set_order
4774         functions.  Remove is_relro_local, set_is_relro_local,
4775         is_last_relro, set_is_last_relro, is_first_non_relro,
4776         set_is_first_non_relro functions, is_interp, set_is_interp,
4777         is_dynamic_linker_section, and set_is_dynamic_linker_section
4778         functions.
4779         (class Output_segment): Change Output_data_list from std::list to
4780         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4781         output_bss_ fields.  Update declarations.
4782
4783 2010-08-02  Ian Lance Taylor  <iant@google.com>
4784
4785         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4786         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4787         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4788
4789 2010-08-02  Ian Lance Taylor  <iant@google.com>
4790
4791         PR 11855
4792         * script.cc (Script_options::Script_options): Initialize
4793         symbol_definitions_ and symbol_references_.
4794         (Script_options::add_symbol_assignment): Update
4795         symbol_definitions_ and symbol_references_.
4796         (Script_options::add_symbol_reference): New function.
4797         (script_symbol): New function.
4798         * script.h (class Script_options): Add symbol_definitions_ and
4799         symbol_references_ fields.
4800         (Script_options::referenced_const_iterator): New type.
4801         (Script_options::referenced_begin): New function.
4802         (Script_options::referenced_end): New function.
4803         (Script_options::is_referenced): New function.
4804         (Script_options::any_unreferenced): New function.
4805         * script-c.h (script_symbol): Declare.
4806         * yyscript.y (exp): Call script_symbol.
4807         * symtab.cc: Include "script.h".
4808         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4809         Change all callers.  Check symbols referenced by scripts.
4810         (Symbol_table::add_undefined_symbols_from_command_line): Add
4811         layout parameter.  Change all callers.
4812         (Symbol_table::do_add_undefined_symbols_from_command_line):
4813         Likewise.  Break out loop body.  Check symbols referenced by
4814         scripts.
4815         (Symbol_table::add_undefined_symbol_from_command_line): New
4816         function broken out of
4817         do_add_undefined_symbols_from_command_line.
4818         * symtab.h (class Symbol_table): Update declarations.
4819         * archive.cc: Include "layout.h".
4820         (Archive::should_include_member): Add layout parameter.  Change
4821         all callers.  Check for symbol mentioned in expression.
4822         * archive.h (class Archive): Update declaration.
4823         * object.cc (Sized_relobj::do_should_include_member): Add layout
4824         parameter.
4825         * object.h (Object::should_include_member): Add layout parameter.
4826         Change all callers.
4827         (Object::do_should_include_member): Add layout parameter.
4828         (class Sized_relobj): Update declaration.
4829         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4830         parameter.
4831         * dynobj.h (class Sized_dynobj): Update declaration.
4832         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4833         layout parameter.
4834         * plugin.h (class Sized_pluginobj): Update declaration.
4835
4836 2010-08-02  Ian Lance Taylor  <iant@google.com>
4837
4838         PR 11866
4839         * output.cc (Output_segment::set_offset): Search for the first and
4840         last sections rather than assuming that the list is in order.
4841         (Output_segment::find_first_and_last_list): New function.
4842         * output.h (class Output_segment): Update declarations.
4843         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4844         (relro_strip_test_SOURCES): New variable.
4845         (relro_strip_test_DEPENDENCIES): New variable.
4846         (relro_strip_test_LDFLAGS): New variable.
4847         (relro_strip_test_LDADD): New variable.
4848         (relro_strip_test.so): New target.
4849
4850 2010-08-02  Ian Lance Taylor  <iant@google.com>
4851
4852         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4853         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4854         (Target_i386::got_tlsdesc_section): New function.
4855         (Target_i386::got_section): Create space for GOT entries for
4856         TLSDESC relocations.
4857         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4858         R_386_TLS_GOTDESC.
4859         (Target_i386::Scan::global): Likewise.
4860         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4861         using TLSDESC GOT.
4862         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4863         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4864         (Target_x86_64::got_tlsdesc_section): New function.
4865         (Target_x86_64::got_section): Create space for GOT entries for
4866         TLSDESC relocations.
4867         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4868         R_386_TLS_GOTDESC.
4869         (Target_x86_64::Scan::global): Likewise.
4870         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4871         using TLSDESC GOT.
4872
4873 2010-08-02  Ian Lance Taylor  <iant@google.com>
4874
4875         * testsuite/final_layout.sh: Use dc to convert from hex to
4876         decimal.
4877
4878 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4879
4880         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4881         paramter to the call to gold::gc_process_relocs.
4882         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4883         paramter to the call to gold::gc_process_relocs.
4884         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4885         parameter to the call to gold::gc_process_relocs.
4886         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4887         template parameter to the call to gold::gc_process_relocs.
4888         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4889         paramter to the call to gold::gc_process_relocs.
4890         * gc.h (get_embedded_addend_size): New function.
4891         (gc_process_relocs): Save the size of the reloc for use by ICF.
4892         * icf.cc (get_section_contents): Get the addend from the text section
4893         for SHT_REL relocation sections.
4894         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4895         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4896         * int_encoding.h (read_from_pointer): New overloaded function.
4897         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4898         * testsuite/icf_sht_rel_addend_test.sh: New file.
4899         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4900         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4901
4902 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4903
4904         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4905         * Makefile.in: Regenerate.
4906         * testsuite/Makefile.in: Regenerate.
4907
4908 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4909
4910         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4911         * gold/testsuite/debug_msg.cc: Likewise.
4912         * gold/testsuite/odr_violation1.cc
4913         * gold/testsuite/odr_violation2.cc
4914
4915 2010-07-21  Cary Coutant  <ccoutant@google.com>
4916
4917         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4918         string, and length fields.
4919         (Output_merge_string::Merged_strings_list): New type.
4920         (Output_merge_string::Merged_strings_lists): New typedef.
4921         (Output_merge_string): Replace merged_strings_ with
4922         merged_strings_lists_.
4923         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4924         Merged_strings_list per input object and section.  Don't store pointer
4925         to the string.  Don't store length with each merged string entry.
4926         (Output_merge_string::finalize_merged_data): Loop over list of merged
4927         strings lists.  Recompute length of each merged string.
4928
4929 2010-07-15  Cary Coutant  <ccoutant@google.com>
4930
4931         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4932         here.
4933
4934 2010-07-14  Ian Lance Taylor  <iant@google.com>
4935
4936         * descriptors.cc (Descriptors::open): Report correct name in error
4937         message.
4938
4939 2010-07-13  Doug Kwan  <dougkwan@google.com>
4940
4941         * arm.cc (Arm_input_section::Arm_input_section): For a
4942         SHT_ARM_EXIDX section, always keeps the input sections.
4943         (Arm_input_section::set_exidx_section_link): New method.
4944         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4945         has_errors_ to false.
4946         (Arm_exidx_input_section::has_errors,
4947         Arm_exidx_input_section::set_has_errors): New methods.
4948         (Arm_exidx_input_section::has_errors_): New data member.
4949         (Arm_relobj::get_exidx_shndx_list): New method.
4950         (Arm_output_section::append_text_sections_to_list): Do not skip
4951         section without SHF_EXECINSTR.
4952         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4953         errors.
4954         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4955         section header.  Make error messages more verbose.  Check for
4956         a non-executable section linked to an EXIDX section.
4957         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4958         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4959         check that there is no deferred EXIDX section if we exit early.
4960         Instead of not making an EXIDX section in case of an error, make one
4961         and set the has_errors flag of it.
4962         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4963         in a relocatable link.
4964         (Target_arm::do_relax): Look for the EXIDX output section instead of
4965         assuming that it is called .ARM.exidx.
4966         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4967         section list.  Do not check for SHF_EXECINSTR section flags but
4968         skip any input section with errors.
4969         * output.cc (Output_section::Output_section): Initialize
4970         always_keeps_input_sections_ to false.
4971         (Output_section::add_input_section): Check for
4972         always_keeps_input_sections_.
4973         *  output.h (Output_section::always_keeps_input_sections,
4974         Output_section::set_always_keeps_input_sections): New methods.
4975         (Output_section::always_keeps_input_sections): New data member.
4976
4977 2010-07-13  Rafael Espindola  <espindola@google.com>
4978
4979         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4980         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4981
4982 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4983             Ian Lance Taylor  <iant@google.com>
4984
4985         * output.h (Output_section_lookup_maps::add_merge_section):
4986         Correct check of whether value was inserted.
4987         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4988         (Output_section_lookup_maps::add_relaxed_input_section):
4989         Likewise.
4990         * arm.cc (Target_arm::got_section): Remove used local os.
4991         * i386.cc (Target_i386::got_section): Likewise.
4992         * x86_64.cc (Target_x86_64::got_section): Likewise.
4993         * sparc.cc (Target_sparc::got_section): Likewise.
4994         (Target_sparc::relocate): Remove unused local have_got_offset.
4995         * powerpc.cc (Target_powerpc::relocate): Likewise.
4996
4997 2010-07-13  Ian Lance Taylor  <iant@google.com>
4998
4999         * compressed_output.cc (zlib_decompress): Fix signature in
5000         !HAVE_ZLIB_H case.
5001
5002         * archive.cc (Archive::include_member): Unlock an external member
5003         of a thin archive.  Don't bother to delete an object we know is
5004         NULL.
5005
5006 2010-07-12  Cary Coutant  <ccoutant@google.com>
5007
5008         * compressed_output.cc (zlib_decompress): New function.
5009         (get_uncompressed_size): New function.
5010         (decompress_input_section): New function.
5011         * compressed_output.h (get_uncompressed_size): New function.
5012         (decompress_input_section): New function.
5013         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5014         Handle compressed debug sections.
5015         * layout.cc (is_compressed_debug_section): New function.
5016         (Layout::output_section_name): Map compressed section names to
5017         canonical names.
5018         * layout.h (is_compressed_debug_section): New function.
5019         (is_debug_info_section): Recognize compressed debug sections.
5020         * merge.cc: Include compressed_output.h.
5021         (Output_merge_data::do_add_input_section): Handle compressed
5022         debug sections.
5023         (Output_merge_string::do_add_input_section): Handle compressed
5024         debug sections.
5025         * object.cc: Include compressed_output.h.
5026         (Sized_relobj::Sized_relobj): Initialize new data members.
5027         (build_compressed_section_map): New function.
5028         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5029         * object.h (Object::section_is_compressed): New method.
5030         (Object::do_section_is_compressed): New method.
5031         (Sized_relobj::Compressed_section_map): New type.
5032         (Sized_relobj::do_section_is_compressed): New method.
5033         (Sized_relobj::compressed_sections_): New data member.
5034         * output.cc (Output_section::add_input_section): Handle compressed
5035         debug sections.
5036         * reloc.cc: Include compressed_output.h.
5037         (Sized_relobj::write_sections): Handle compressed debug sections.
5038
5039 2010-07-08  Cary Coutant  <ccoutant@google.com>
5040
5041         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5042         weak when resolving to a dynamic def.
5043         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5044         for weak undef/dynamic def cases. Adjust callers.
5045         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5046         undef_binding_weak_.
5047         (Symbol_table::sized_write_globals): Adjust symbol binding.
5048         (Symbol_table::sized_write_symbol): Add binding parameter.
5049         * symtab.h (Symbol::set_undef_binding): New method.
5050         (Symbol::is_undef_binding_weak): New method.
5051         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5052         (Symbol_table::should_override): Add new parameter.
5053         (Symbol_table::sized_write_symbol): Add new parameter.
5054
5055         * testsuite/weak_undef_file1.cc: Add new test case.
5056         * testsuite/weak_undef_file2.cc: Fix header comment.
5057         * testsuite/weak_undef_test.cc: Add new test case.
5058
5059 2010-06-29  Doug Kwan  <dougkwan@google.com>
5060
5061         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5062         Initialize USE_SYMBOL_.
5063         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5064         definition.
5065         (Arm_reloc_property::uses_symbol_): New data member declaration.
5066         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5067         uses symbol value and symbol is undefined but not weakly undefined.
5068
5069 2010-06-28  Rafael Espindola  <espindola@google.com>
5070
5071         * plugin.cc (Plugin::load): Use dlerror.
5072
5073 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5074
5075         * symtab.cc (detect_odr_violations): When reporting an ODR
5076         violation, report an object where the symbol is defined.
5077
5078 2010-06-25  Doug Kwan  <dougkwan@google.com>
5079
5080         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5081         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5082         definition.
5083         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5084         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5085         target hook to detect function points.
5086         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5087         * icf.h (Icf::check_section_for_function_pointers): Change type of
5088         parameter SECTION_NAME to const reference to std::string.  Use
5089         target hook to determine if section may have unsafe pointers.
5090         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5091         method definition.
5092
5093 2010-06-21  Rafael Espindola  <espindola@google.com>
5094
5095         * fileread.cc (Input_file::find_fie): New
5096         (Input_file::open): Use Input_file::find_fie.
5097         * fileread.h (Input_file::find_fie): New
5098         * plugin.cc (set_extra_library_path): New.
5099         (Plugin::load): Add set_extra_library_path to the transfer vector.
5100         (Plugin_manager::set_extra_library_path): New.
5101         (Plugin_manager::add_input_file): Use the extra search path if set.
5102         (set_extra_library_path(): New.
5103         * plugin.h (Plugin_manager): Add set_extra_library_path and
5104         extra_search_path_.
5105
5106 2010-06-19  Cary Coutant  <ccoutant@google.com>
5107
5108         * layout.cc (gdb_sections): Add .debug_types.
5109         (lines_only_debug_sections): Likewise.
5110
5111 2010-06-18  Rafael Espindola  <espindola@google.com>
5112
5113         * plugin.cc (add_input_file,add_input_library)
5114         (Plugin_manager::add_input_file): Make filename arguments const.
5115         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5116         const.
5117
5118 2010-06-16  Doug Kwan  <dougkwan@google.com>
5119
5120         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5121         .ARM.attributes section if we have not merged any input
5122         attributes sections.
5123
5124 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5125
5126         * arm.cc: Allow combining objects with no EABI version
5127         information.
5128
5129 2010-06-15  Rafael Espindola  <espindola@google.com>
5130
5131         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5132
5133 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5134
5135         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5136         (struct iovec): Correct !HAVE_READV definition.
5137
5138 2010-06-10  Cary Coutant  <ccoutant@google.com>
5139
5140         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5141         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5142         reloc sections.
5143         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5144
5145         PR 11683
5146         * symtab.h (Symbol::is_placeholder): New member function.
5147         * target-reloc.h (relocate_section): Check for placeholder symbols.
5148
5149         * testsuite/Makefile.am (plugin_test_8): New test.
5150         (plugin_test_9): New test.
5151         * testsuite/Makefile.in: Regenerate.
5152
5153 2010-06-09  Nick Clifton  <nickc@redhat.com>
5154
5155         * yyscript.y (input_list_element): Allow strings prefixed with
5156         the '-' character.  Treat these as libraries.
5157         * script.cc (script_add_library): New function.  Adds a library
5158         specified by "-l<name>" found in an input script.
5159         * script-c.h: Add prototype for script_add_library.
5160
5161 2010-06-07  Doug Kwan  <dougkwan@google.com>
5162
5163         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5164         Restrict stub-group size to be within long conditional branch
5165         range when working around cortex-A8 erratum.
5166
5167 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5168
5169         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5170         #ifdef typo.
5171
5172 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5173
5174         PR gold/11658
5175         * output.cc
5176         (Output_section::Input_section_sort_entry::compare_section_ordering):
5177         Change to return non-zero correctly.
5178         (Output_section::Input_section_sort_section_order_index_compare
5179         ::operator()): Change to fix ambiguity in comparisons.
5180
5181 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5182
5183         * gold.h (is_wildcard_string): New function.
5184         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5185         (Layout::layout_eh_frame): Ditto.
5186         (Layout::find_section_order_index): New method.
5187         (Layout::read_layout_from_file): New method.
5188         * layout.h (Layout::find_section_order_index): New method.
5189         (Layout::read_layout_from_file): New method.
5190         (Layout::input_section_position_): New private member.
5191         (Layout::input_section_glob_): New private member.
5192         * main.cc (main): Call read_layout_from_file here.
5193         * options.h (--section-ordering-file): New option.
5194         * output.cc (Output_section::input_section_order_specified_): New
5195         member.
5196         (Output_section::Output_section): Initialize new member.
5197         (Output_section::add_input_section): Add new parameter.
5198         Keep input sections when --section-ordering-file is used.
5199         (Output_section::set_final_data_size): Sort input sections when
5200         section ordering file is specified.
5201         (Output_section::Input_section_sort_entry): Add new parameter.
5202         Check sorting type.
5203         (Output_section::Input_section_sort_entry::compare_section_ordering):
5204         New method.
5205         (Output_section::Input_section_sort_compare::operator()): Change to
5206         consider section_order_index.
5207         (Output_section::Input_section_sort_init_fini_compare::operator()):
5208         Change to consider section_order_index.
5209         (Output_section::Input_section_sort_section_order_index_compare
5210         ::operator()): New method.
5211         (Output_section::sort_attached_input_sections): Change to sort
5212         according to section order when specified.
5213         (Output_section::add_input_section<32, true>): Add new parameter.
5214         (Output_section::add_input_section<64, true>): Add new parameter.
5215         (Output_section::add_input_section<32, false>): Add new parameter.
5216         (Output_section::add_input_section<64, false>): Add new parameter.
5217         * output.h (Output_section::add_input_section): Add new parameter.
5218         (Output_section::input_section_order_specified): New
5219         method.
5220         (Output_section::set_input_section_order_specified): New method.
5221         (Input_section::Input_section): Initialize section_order_index_.
5222         (Input_section::section_order_index): New method.
5223         (Input_section::set_section_order_index): New method.
5224         (Input_section::section_order_index_): New member.
5225         (Input_section::Input_section_sort_section_order_index_compare): New
5226         struct.
5227         (Output_section::input_section_order_specified_): New member.
5228         * script-sections.cc (is_wildcard_string): Delete and move modified
5229         method to gold.h.
5230         (Output_section_element_input::Output_section_element_input): Modify
5231         call to is_wildcard_string.
5232         (Output_section_element_input::Input_section_pattern
5233         ::Input_section_pattern): Ditto.
5234         (Output_section_element_input::Output_section_element_input): Ditto.
5235         * testsuite/Makefile.am (final_layout): New test case.
5236         * testsuite/Makefile.in: Regenerate.
5237         * testsuite/final_layout.cc: New file.
5238         * testsuite/final_layout.sh: New file.
5239
5240 2010-06-01  Rafael Espindola  <espindola@google.com>
5241
5242         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5243
5244 2010-06-01  Rafael Espindola  <espindola@google.com>
5245
5246         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5247         visibility of symbols.
5248
5249 2010-05-27  Doug Kwan  <dougkwan@google.com>
5250
5251         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5252         from start of output section instead of address for a local symbol
5253         in a merged or relaxed section when doing a relocatable link.
5254
5255 2010-05-26  Rafael Espindola  <espindola@google.com>
5256
5257        PR 11604
5258         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5259         adding sections the garbage collector removed.
5260         * gold/testsuite/Makefile.am: Add test.
5261         * gold/testsuite/Makefile.in: Regenerate.
5262         * gold/testsuite/plugin_test_7.sh: New.
5263         * gold/testsuite/plugin_test_7_1.c: New.
5264         * gold/testsuite/plugin_test_7_2.c: New.
5265
5266 2010-05-26  Rafael Espindola  <espindola@google.com>
5267
5268         * script-sections.cc (Output_section_definition::set_section_addresses):
5269         Check for --section-start.
5270
5271 2010-05-26  Doug Kwan  <dougkwan@google.com>
5272
5273         * arm.cc (Arm_scan_relocatable_relocs): New class.
5274         (Target_arm::relocate_special_relocatable): New method.
5275         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5276         (Arm_relocate_functions::thumb_branch_common): Same.
5277         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5278         instead of Default_scan_relocatable_relocs.
5279         * target-reloc.h (relocate_for_relocatable): Let target handle
5280         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5281         * target.h (Sized_target::relocate_special_relocatable): New method.
5282
5283 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5284
5285         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5286
5287 2010-05-23  Doug Kwan  <dougkwan@google.com>
5288
5289         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5290         instead of a cast.
5291         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5292         with a direct branch, not a conditional branch, to a stub.
5293         * merge.cc (Output_merge_base::record_input_section): New method
5294         defintion.
5295         (Output_merge_data::do_add_input_section): Record input section if
5296         keeps-input-sections flag is set.
5297         (Output_merge_string::do_add_input_section): Ditto.
5298         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5299         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5300         INPUT_SECTIONS_.
5301         (Output_merge_base::keeps_input_sections,
5302         Output_merge_base::set_keeps_input_sections,
5303         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5304         method definitions.
5305         (Output_merge_base::Input_sections): New type declaration.
5306         (Output_merge_base::input_sections_begin,
5307         Output_merge_base::input_sections_end,
5308         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5309         (Output_merge_base::bool keeps_input_sections_,
5310         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5311         Output_merge_base::input_sections_): New data members.
5312         (Output_merge_data::do_set_keeps_input_sections): New method
5313         defintion.
5314         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5315         * output.cc (Output_section::Input_section::relobj): Move method
5316         defintion from class declaration to here and handle merge sections.
5317         (Output_section::Input_section::shndx): Ditto.
5318         (Output_section::Output_section): Remove initializations of removed
5319         data members and initialize new data member LOOKUP_MAPS_.
5320         (Output_section::add_input_section): Set keeps-input-sections flag
5321         for a newly created merge output section as appropriate.  Adjust code
5322         to use Output_section_lookup_maps class.
5323         (Output_section::add_relaxed_input_section): Adjst code for lookup
5324         maps code refactoring.
5325         (Output_section::add_merge_input_section): Add a new parameter
5326         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5327         class.  If adding input section to a newly created merge output
5328         section fails, remove the new merge section.
5329         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5330         Adjust code for use of the Output_section_lookup_maps class.
5331         (Output_section::find_merge_section): Ditto.
5332         (Output_section::build_lookup_maps): New method defintion.
5333         (Output_section::find_relaxed_input_section): Adjust code to use
5334         Output_section_lookup_maps class.
5335         (Output_section::get_input_sections): Export merge sections.  Adjust
5336         code to use Output_section_lookup_maps class.
5337         (Output_section:::add_script_input_section): Adjust code to use
5338         Output_section_lookup_maps class.  Update lookup maps for merge
5339         sections also.
5340         (Output_section::discard_states): Use Output_section_lookup_maps.
5341         (Output_section::restore_states): Same.
5342         * output.h (Merge_section_properties): Move class defintion out of
5343         Output_section.
5344         (Output_section_lookup_maps): New class.
5345         (Output_section::Input_section::is_merge_section): New method
5346         defintion.
5347         (Output_section::Input_section::relobj): Move defintion out of class
5348         defintion.  Declare method only.
5349         (Output_section::Input_section::shndx): Ditto.
5350         (Output_section::Input_section::output_merge_base): New method defintion.
5351         (Output_section::Input_section::u2_.pomb): New union field.
5352         (Output_section::Merge_section_by_properties_map,
5353         Output_section::Output_section_data_by_input_section_map,
5354         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5355         Remove types.
5356         (Output_section::add_merge_input_section): Add new parameter
5357         KEEPS_INPUT_SECTIONS.
5358         (Output_section::build_lookup_maps): New method declaration.
5359         (Output_section::merge_section_map_,
5360         Output_section::merge_section_by_properties_map_,
5361         Output_section::relaxed_input_section_map_,
5362         Output_section::is_relaxed_input_section_map_valid_): Remove data
5363         members.
5364         (Output_section::lookup_maps_): New data member.
5365
5366 2010-05-21  Doug Kwan  <dougkwan@google.com>
5367
5368         PR gold/11619
5369         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5370         avoid a compilation error.
5371
5372 2010-05-19  Rafael Espindola  <espindola@google.com>
5373
5374         * script-sections.cc (Output_section_definition::allocate_to_segment):
5375         Update the phdrs_list even when the output section is NULL.
5376         * testsuite/Makefile.am: Add test.
5377         * testsuite/Makefile.in: Regenerate.
5378         * testsuite/script_test_9.cc: New.
5379         * testsuite/script_test_9.sh: New.
5380         * testsuite/script_test_9.t: New.
5381
5382 2010-05-19  Doug Kwan  <dougkwan@google.com>
5383
5384         * arm.cc (Arm_input_section::original_size): New method.
5385         (Arm_input_section::do_addralign): Add a cast.
5386         (Arm_input_section::do_output_offset): Remove static cast.
5387         (Arm_input_section::original_addralign,
5388          Arm_input_section::original_size_): Change type to uint32_t.
5389         (Arm_input_section::init): Add safe casts for section alignment
5390         and size.
5391         (Arm_input_section::set_final_data_size): Do not set address and
5392         offset of stub table.
5393         (Arm_output_section::fix_exidx_coverage): Change use of of
5394         Output_section::Simple_input_section to that of
5395         Output_section::Input_section.
5396         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5397         except for the first pass.
5398         * output.cc (Output_section::get_input_sections): Change type of
5399         input_sections to std::list<Input_section>.
5400         (Output_section::add_script_input_section): Rename from
5401         Output_section::add_simple_input_section.  Change type of SIS
5402         parameter from Simple_input_section to Input_section.
5403         * output.h (Output_section::Simple_input_section): Remove class.
5404         (Output_section::Input_section): Change class visibility to public.
5405         (Output_section::Input_section::addralign): Use stored alignments
5406         for special input sections if set.
5407         (Output_section::Input_section::set_addralign): New method.
5408         (Output_section::get_input_sections): Change parameter type from
5409         list of Simple_input_section to list of Input_section.
5410         (Output_section::add_script_input_section): Rename from
5411         Output_section::add_simple_input_section. Change first parameter's
5412         type from Simple_input_section to Input_section and remove the
5413         second and third parameters.
5414         * script-sections.cc (Input_section::Input_section_list): Change
5415         type to list of Output_section::Input_section/
5416         (Input_section_info::Input_section_info): Change parameter type of
5417         INPUT_SECTION to Output_section::Input_section.
5418         (Input_section_info::input_section): Change return type.
5419         (Input_section_info::input_section_): Change type to
5420         Output_section::Input_section.
5421         (Output_section_element_input::set_section_addresses): Adjust code
5422         to use Output_section::Input_section instead of
5423         Output_section::Simple_input_section.  Adjust code for renaming
5424         of Output_section::add_simple_input_section.
5425         (Orphan_output_section::set_section_addresses): Ditto.
5426
5427 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5428
5429         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5430         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5431
5432 2010-05-18  Rafael Espindola  <espindola@google.com>
5433
5434         * options.cc (General_options::finalize): Handle -nostdlib.
5435         * options.h (nostdlib): New option.
5436         * script.cc (script_add_search_dir): Handle -nostdlib.
5437
5438 2010-05-12  Doug Kwan  <dougkwan@google.com>
5439
5440         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5441         attributes section only if there no attributes section after merging.
5442         (Target_arm::merge_object_attributes): Move value of
5443         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5444         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5445         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5446         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5447         and arm_attr_merge_7.stdout.
5448         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5449         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5450         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5451         arm_attr_merge_7b.o): New rules.
5452         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5453         arm_attr_merge_7
5454         * testsuite/Makefile.in: Regenerate.
5455         * testsuite/arm_attr_merge.sh: New file.
5456         * testsuite/arm_attr_merge_[67][ab].s: Same.
5457
5458 2010-05-05  Nick Clifton  <nickc@redhat.com>
5459
5460         * po/es.po: Updated Spanish translation.
5461
5462 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5463
5464         * Makefile.am (install-exec-local): Properly install gold as
5465         default cross linker.
5466         * Makefile.in: Regenerated.
5467
5468 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5469             Nick Clifton  <nickc@redhat.com>
5470
5471         * configure.ac (install_as_default): Define and set to false
5472         unless --enable-gold or --enable-gold=both/gold has been
5473         specified.
5474         * configure: Regenerate.
5475
5476         * Makefile.am (install-exec-local): Install the executable as
5477         'ld.gold'.  If install_as_default is true then also install it as
5478         'ld'.
5479         * Makefile.in: Regenerated.
5480
5481 2010-04-24  Ian Lance Taylor  <iant@google.com>
5482
5483         * layout.cc (Layout::layout_reloc): In relocatable link don't
5484         combine reloc sections for grouped sections.
5485
5486 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5487
5488         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5489         sections that are not ordinary to icf.
5490         * icf.cc (get_section_contents): Handle relocation pointing to section
5491         with no object or shndx information.
5492         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5493         * testsuite/Makefile.in: Regenerate.
5494         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5495         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5496
5497 2010-04-22  Ian Lance Taylor  <iant@google.com>
5498
5499         * expression.cc (Expression::Expression_eval_info): Add
5500         result_alignment_pointer field.
5501         (Expression::eval_with_dot): Add result_alignment_pointer
5502         parameter.  Change all callers.
5503         (Expression::eval_maybe_dot): Likewise.
5504         (class Binary_expression): Add alignment_pointer parameter to
5505         left_value and right_value.  Change all callers.
5506         (BINARY_EXPRESSION): Set result alignment.
5507         (class Trinary_expression): Add alignment_pointer parameter to
5508         arg2_value and arg3_value.  Change all callers.
5509         (Trinary_cond::value): Set result alignment.
5510         (Max_expression::value, Min_expression::value): Likewise.
5511         (Align_expression::value): Likewise.
5512         * script-sections.cc (class Sections_element): Add dot_alignment
5513         parameter to set_section_addresses virtual function.  Update
5514         instantiations.
5515         (class Output_section_element): Likewise.
5516         (Script_sections::create_segments): Add dot_alignment parameter.
5517         Change all callers.
5518         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5519         (Script_sections::set_phdrs_clause_addresses): Likewise.
5520         * script-sections.h: Update declarations.
5521         * script.h: Update declarations.
5522         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5523         min_p_align.
5524         * testsuite/script_test_3.t: Set large alignment.
5525         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5526         segment has expected alignment.
5527
5528 2010-04-22  Nick Clifton  <nickc@redhat.com>
5529
5530         * po/gold.pot: Updated by the Translation project.
5531         * po/vi.po: Updated Vietnamese translation.
5532
5533 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5534
5535         * testsuite/Makefile.am (check_PROGRAMS): Add
5536         icf_virtual_function_folding_test.
5537         * testsuite/Makefile.in: Regenerated.
5538
5539 2010-04-15  Andrew Haley  <aph@redhat.com>
5540
5541         * options.h (merge_exidx_entries): New option.
5542         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5543         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5544         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5545         (Target_arm::merge_exidx_entries): New function.
5546         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5547         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5548         to Arm_exidx_fixup constructor.
5549         Add new arg, merge_exidx_entries.
5550         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5551         Arm_output_section::fix_exidx_coverage.
5552
5553 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5554
5555         * icf.cc (get_section_contents): Check for preemptible functions.
5556         Ignore addend when appropriate.
5557         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5558         section folded.
5559         (add_from_relobj): Check for section folded.
5560         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5561         * symtab.h (should_add_dynsym_entry): Add new parameter.
5562         * target-reloc.h (scan_relocs): Check for section folded.
5563         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5564         Check reloc types for function pointers in shared objects.
5565         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5566         case.
5567         (icf_preemptible_functions_test): New test case.
5568         (icf_string_merge_test): New test case.
5569         * testsuite.Makefile.in: Regenerate.
5570         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5571         bar_glob.  Refactor code.
5572         * testsuite/icf_preemptible_functions_test.cc: New file.
5573         * testsuite/icf_preemptible_functions_test.sh: New file.
5574         * testsuite/icf_string_merge_test.cc: New file.
5575         * testsuite/icf_string_merge_test.sh: New file.
5576         * testsuite/icf_virtual_function_folding_test.cc: New file.
5577         * testsuite/icf_virtual_function_folding_test.sh: New file.
5578
5579 2010-04-14  Doug Kwan  <dougkwan@google.com>
5580
5581         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5582         for local symbol recounting if we remove a section due to ICF.
5583         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5584         there are no regular objects in input.
5585
5586 2010-04-13  Doug Kwan  <dougkwan@google.com>
5587
5588         * arm.cc (Arm_input_section::set_final_data_size): Compute
5589         accurate final data size instead of using current data size.
5590
5591 2010-04-09  Doug Kwan  <dougkwan@google.com>
5592
5593         * layout.cc (Layout::choose_output_section): Handle script section
5594         types.
5595         (Layout::make_output_section_for_script): Add section type parameter.
5596         Handle script section types.
5597         * layout.h (Layout::make_output_section_for_script): Add section
5598         type parameter.
5599         * output.cc (Output_section::Output_section): Initialize data member
5600         is_noload_.
5601         (Output_section::do_reset_address_and_file_offset): Do not set address
5602         to 0 if section is a NOLOAD section.
5603         * output.h (Output_section::is_noload): New method.
5604         (Output_section::set_is_noload): Ditto.
5605         (Output_section::is_noload_): New data member.
5606         * script-c.h (Script_section_type): New enum type.
5607         (struct Parser_output_section_header): Add new file section_type.
5608         * script-sections.cc (Sections_element::output_section_name): Add
5609         parameter for returning script section type.
5610         (Output_section_definition::output_section_name): Ditto.
5611         (Output_section_definition::section_type)P; New method.
5612         (Output_section_definiton::script_section_type_name): Ditto.
5613         (Output_section_definition::script_section_type_): New data member.
5614         (Output_section_definition::Output_section_definition): Initialize
5615         data member Output_section_definition::script_section_type_.
5616         (Output_section_definition::create_sections): Pass script section type
5617         to Layout::make_output_section_for_script.
5618         (Output_section_definition::output_section_name): Return script
5619         section type to caller.
5620         (Output_section_definition::set_section_address): Do not advance
5621         dot value and load address if section type is NOLOAD.  Set address
5622         of NOLOAD sections regardless of section flags.
5623         (Output_section_definition::print): Print section type if it is
5624         not SCRIPT_SECTION_TYPE_NONE.
5625         (Output_section_definition::section_type): New method.
5626         (Output_section_definition::script_section_type_name): Ditto.
5627         (Script_sections::output_section_name): Add new parameter
5628         PSECTION_TYPE for returning script section type.  Pass it to
5629         section elements.  Handle discard sections.
5630         (Sort_output_sections::operator()): Handle NOLOAD sections.
5631         * script-sections.h (Script_sections::Section_type): New enum type.
5632         (Script_sections::output_section_name): Add a new parameter for
5633         returning script section type.
5634         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5635         INFO and NOLOAD.
5636         * yyscript.y (union): Add new field SECTION_TYPE.
5637         (COPY, DSECT, INFO, NOLOAD): New tokens.
5638         (opt_address_and_section_type): Change type to output_section_header.
5639         (section_type): New non-terminal
5640         (section_header): Handle section type.
5641         (opt_address_and_section_type): Return section type value.
5642
5643 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5644
5645         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5646         * testsuite/plugin_common_test_2.c (foo): Likewise.
5647
5648 2010-04-08  Doug Kwan  <dougkwan@google.com>
5649
5650         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5651         Output_merge_data.
5652         * output.cc (Output_section::add_merge_input_section): Simplify
5653         code and return status of Output_merge_base::add_input_section.
5654         Update merge section map only if Output_merge_base::add_input_section
5655         returns true.
5656
5657 2010-04-07  Doug Kwan  <dougkwan@google.com>
5658
5659         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5660         if section is marked as containing instructions but has no mapping
5661         symbols.
5662         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5663         correct section index.
5664         (Arm_relobj::find_linked_text_section): Ditto.
5665
5666 2010-04-07  Cary Coutant  <ccoutant@google.com>
5667
5668         * archive.cc (include_member): Destroy Read_symbols_data object before
5669         releasing file.
5670         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5671         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5672         (Read_symbols_data::~Read_symbols_data) New destructor.
5673         (Section_relocs::Section_relocs) New constructor.
5674         (Section_relocs::~Section_relocs) New destructor.
5675         (Read_relocs_data::Read_relocs_data) New constructor.
5676         (Read_relocs_data::~Read_relocs_data) New destructor.
5677         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5678         pointers to NULL after deleting.
5679
5680 2010-04-07  Doug Kwan  <dougkwan@google.com>
5681
5682         * arm.cc: Replace "endianity" with "endianness" in comments.
5683         (Arm_exidx_cantunwind): Ditto.
5684         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5685         (Arm_relobj::merge_flags_and_attributes): New method.
5686         (Arm_relobj::merge_flags_and_attributes_): New data member.
5687         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5688         (Arm_relobj::scan_sections_for_stubs): Ditto.
5689         (Arm_relobj::do_read_symbols): Check to see if we really want to
5690         merge processor-specific flags and attributes.  Exit early if
5691         an object is empty except for section names and the undefined symbol.
5692         (Target_arm::do_finalize_sections): Move check for ELF format to
5693         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5694         attributes from a regular object only when we have determined that
5695         it is aapropriate.  Do not create an .ARM.attributes section in
5696         output if there is no regular input object.
5697         (Target_arm::merge_processor_specific_flags): Check
5698         --warn-mismatch before printing any error.
5699         (Target_arm::merge_object_attributes): Ditto.
5700         * gold.cc (queue_middle_tasks): Handle the case in which there is
5701         no regular object in input.
5702         * options.cc (General_options::parse_EB): New method.
5703         (General_options::parse_EL): Same.
5704         (General_options::General_options): Initialize endianness_.
5705         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5706         New options.
5707         (General_options::Endianness): New enum.
5708         (General_options::endianness): New method.
5709         (General_options::endianness_): New data member.
5710         * parameters.cc (Parameters::set_options): Check target endianness.
5711         (Parameters::set_target_once): Ditto.
5712         (Parameters::check_target_endianness): New method.
5713         (parameters_force_valid_target): If either -EL or -EB is specified,
5714         use it to define endianness of default target.
5715         * parameters.h (Parameters::check_target_endianness): New method
5716         declaration.
5717         * target.h (class Target): Change "endianity" to "endianness"
5718         in comments.
5719
5720 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5721
5722         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5723         * configure: Regenerate.
5724         * Makefile.in: Regenerate.
5725         * testsuite/Makefile.in: Regenerate.
5726
5727 2010-04-06  Cary Coutant  <ccoutant@google.com>
5728
5729         gcc PR lto/42757
5730         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5731         prevailing definitions of common symbols.
5732         * testsuite/plugin_test_6.sh: New test case.
5733         * testsuite/plugin_common_test_1.c: New test case.
5734         * testsuite/plugin_common_test_2.c: New test case.
5735         * testsuite/Makefile.am (plugin_test_6): New test case.
5736         * testsuite/Makefile.in: Regenerate.
5737
5738 2010-04-06  Nick Clifton  <nickc@redhat.com>
5739
5740         * po/vi.po: New Vietnamese translation.
5741
5742 2010-03-30  Doug Kwan  <dougkwan@google.com>
5743
5744         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5745
5746 2010-03-25  Doug Kwan  <dougkwan@google.com>
5747
5748         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5749         to avoid a conversion warning on a 32-bit host.
5750
5751 2010-03-24  Ian Lance Taylor  <iant@google.com>
5752
5753         * testsuite/script_test_3.t: Add a TLS segment.
5754         * testsuite/Makefile.am (check_PROGRAMS): Add
5755         tls_phdrs_script_test.
5756         (tls_phdrs_script_test_SOURCES): Define.
5757         (tls_phdrs_script_test_DEPENDENCIES): Define.
5758         (tls_phdrs_script_test_LDFLAGS): Define.
5759         (tls_phdrs_script_test_LDADD): Define.
5760         * testsuite/Makefile.in: Rebuild.
5761
5762 2010-03-23  Cary Coutant  <ccoutant@google.com>
5763
5764         * fileread.cc (find_or_make_view): Fix comment.
5765
5766 2010-03-23  Ian Lance Taylor  <iant@google.com>
5767
5768         * script-sections.cc (class Orphan_section_placement): Define
5769         PLACE_TLS and PLACE_TLS_BSS.
5770         (Orphan_section_placement::Orphan_section_placement): Initialize
5771         new places.
5772         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5773         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5774         (tls_script_test_SOURCES): Define.
5775         (tls_script_test_DEPENDENCIES): Define.
5776         (tls_script_test_LDFLAGS): Define.
5777         (tls_script_test_LDADD): Define.
5778         * testsuite/Makefile.in: Rebuild.
5779
5780 2010-03-22  Doug Kwan  <dougkwan@google.com>
5781
5782         * arm.cc (Arm_relocate_functions::abs8,
5783         Arm_relocate_functions::abs16): Use correct check for overflow
5784         specified in the ARM ELF specs.
5785         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5786         target of a BLX instruction specially.
5787         (Reloc_stub::stub_type_for_reloc): Ditto.
5788         (Relocate::relocate): Use symbolic names instead of numeric relocation
5789         codes to report error.
5790         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5791         workaround.
5792         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5793         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5794         thumb2_blx_out_of_range.stdout
5795         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5796         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5797         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5798         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5799         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5800         thumb2_blx_in_range, thumb2_blx_in_range.o,
5801         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5802         thumb2_blx_out_of_range.o): New rules.
5803         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5804         thumb2_blx_in_range and thumb2_blx_out_of_range.
5805         * testsuite/Makefile.in: Regenerate.
5806         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5807         * testsuite/thumb_blx_in_range.s: New file.
5808         * testsuite/thumb_blx_out_of_range.s: New file.
5809
5810 2010-03-22  Rafael Espindola  <espindola@google.com>
5811
5812         * archive.cc (Should_include): Move to archive.h.
5813         (should_include_member): Make it a member of Archive.
5814         (Lib_group): New.
5815         (Add_lib_group_symbols): New.
5816         * archive.h: Include options.h.
5817         (Archive_member): Moved from Archive.
5818         (Should_include): Moved from archive.cc.
5819         (Lib_group): New.
5820         (Add_lib_group_symbols): New.
5821         * dynobj.cc (do_should_include_member): New.
5822         * dynobj.h (do_should_include_member): New.
5823         * gold.cc (queue_initial_tasks): Update call to queue.
5824         * main.cc (main): Print lib group stats.
5825         * object.cc (do_should_include_member): New.
5826         * object.h: Include archive.h.
5827         (Object::should_include_member): New.
5828         (Object::do_should_include_member): New.
5829         (Sized_relobj::do_should_include_member): New.
5830         * options.cc (General_options::parse_start_lib): New.
5831         (General_options::parse_end_lib): New.
5832         (Input_arguments::add_file): Handle lib groups.
5833         (Input_arguments::start_group): Check we are not in a lib.
5834         (Input_arguments::start_lib): New.
5835         (Input_arguments::end_lib): New.
5836         * options.h (General_options): Add start_lib and end_lib.
5837         (Input_argument::lib_): New.
5838         (Input_argument::lib): New.
5839         (Input_argument::is_lib): New.
5840         (Input_file_lib): New.
5841         (Input_arguments::in_lib_): New.
5842         (Input_arguments::in_lib): New.
5843         (Input_arguments::start_lib): New.
5844         (Input_arguments::end_lib_): New.
5845         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5846         in unused members as preempted.
5847         (Sized_pluginobj::do_should_include_member): New.
5848         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5849         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5850         return the blocker.
5851         (Read_symbols::do_whole_lib_group): New.
5852         (Read_symbols::do_lib_group): New.
5853         (Read_symbols::do_read_symbols): Handle lib groups.
5854         (Read_symbols::get_name): Handle lib groups.
5855         * readsyms.h (Read_symbols): Add an archive member pointer.
5856         (Read_symbols::do_whole_lib_group): New.
5857         (Read_symbols::do_lib_group): New.
5858         (Read_symbols::member_): New.
5859         * script.cc (read_input_script): Update call to queue_soon.
5860
5861 2010-03-19  Doug Kwan  <dougkwan@google.com>
5862
5863         * arm.cc (Stub_table::Stub_table): Initialize new data members
5864         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5865         (Stub_table::add_reloc_stub): Assign stub offset and update
5866         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5867         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5868         New data members.
5869         (Stub_table::update_data_size_and_addralign): Use
5870         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5871         instead of going over all reloc stubs.
5872         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5873         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5874         Stringpool_template::offset_ to size of Stringpool_char.
5875         (Stringpool_template::new_key_offset): Remove code to initialize
5876         Stringpool_template::offset_.
5877         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5878         Stringpool_template::offset_ to zero.
5879
5880 2010-03-15  Doug Kwan  <dougkwan@google.com>
5881
5882         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5883         offset_.
5884         (Stringpool_template::new_key_offset): New method.
5885         (Stringpool_template::add_string): Assign offsets when adding new
5886         strings.
5887         (Stringpool_template::set_string_offsets): Do not set string offsets
5888         when not optimizing.
5889         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5890         member size_.
5891         (Chunked_vector::clear): Clear size_.
5892         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5893         (Chunked_vector::size): Return size_.
5894         (Chunked_vector::push_back): Use size_ to find insert position.
5895         (Chunked_vector::size_): New data member.
5896         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5897         (Stringpool_template::new_key_offset): New method declaration.
5898         (Stringpool_template::offset_): New data member.
5899
5900 2010-03-15   Rafael Espindola  <espindola@google.com>
5901
5902         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5903         Add_symbols' constructor.
5904         * readsyms.h (Add_symbols): Remove the input_group member.
5905
5906 2010-03-10  Ian Lance Taylor  <iant@google.com>
5907
5908         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5909         target to ask whether a reference to a symbol requires a stack
5910         split.
5911         * target.h (Target::is_call_to_non_split): New function.
5912         (Target::do_is_call_to_non_split): Declare virtual function.
5913         * target.cc: Include "symtab.h".
5914         (Target::do_is_call_to_non_split): New function.
5915         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5916
5917 2010-03-10  Cary Coutant  <ccoutant@google.com>
5918
5919         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5920         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5921         (File_read::open[2]): Add whole_file_view_ to list of views.
5922         (File_read::make_view): Remove test of whole_file_view_.
5923         (File_read::find_or_make_view): Create whole_file_view_ if
5924         necessary.
5925         (File_read::clear_views): Replace bool parameter with enum;
5926         adjust all callers.  Don't delete views with permanent data;
5927         do delete cached views and views from archives if
5928         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5929         if clearing the corresponding view.
5930         * fileread.h (File_read::Clear_views_mode): New enum.
5931         (File_read::View::is_permanent_view): New method.
5932         (File_read::clear_views): Replace bool parameter
5933         with enum; adjust all callers.
5934         * options.h (General_options): Change keep_files_mapped option;
5935         add map_whole_files.
5936         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5937         releasing the file.
5938         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5939         the file.
5940
5941 2010-03-10  David S. Miller  <davem@davemloft.net>
5942
5943         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5944
5945 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5946
5947         * icf.cc (get_section_contents): Add '@' marker after processing the
5948         merge reloc.
5949
5950 2010-03-08  Doug Kwan  <dougkwan@google.com>
5951
5952         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5953         due to a conversion warning.
5954         (Arm_relobj::update_output_local_symbol_count): Check for local
5955         symbol with unset output index.
5956
5957 2010-03-05  Ian Lance Taylor  <iant@google.com>
5958
5959         * options.h (class General_options): Add --spare-dynamic-tags.
5960         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5961         --spare-dynamic-tags.
5962
5963 2010-03-05  Ian Lance Taylor  <iant@google.com>
5964
5965         * incremental.cc: Include "libiberty.h".
5966
5967 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5968
5969         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5970         function, is_info_ member.
5971         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5972         (Versions::Versions): Update caller.
5973         (Versions::define_base_version): Likewise.
5974         (Versions::add_def): Likewise.
5975
5976 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5977
5978         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5979         (Scan::possible_function_pointer_reloc): New function.
5980         (Scan::local_reloc_may_be_function_pointer): Change to call
5981         possible_function_pointer_reloc.
5982         (Scan::global_reloc_may_be_function_pointer): Ditto.
5983         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5984         relocations in ".data.rel.ro._ZTV" section.
5985         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5986         * testsuite/icf_safe_so_test.cc: Ditto.
5987         * testsuite/icf_safe_test.cc: Ditto.
5988         * testsuite/icf_safe_test.sh: Ditto.
5989
5990 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5991             Ian Lance Taylor  <iant@google.com>
5992
5993         * target-reloc.h (relocate_section): Check the symbol table index
5994         for -1U before setting the local symbol index.
5995         (scan_relocatable_relocs): If copying the relocation, record that
5996         the local symbol is required.
5997         * object.h (Symbol_value::is_output_symtab_index_set): New
5998         function.
5999         (Symbol_value::may_be_discarded_from_output_symtab): New
6000         function.
6001         (Symbol_value::has_output_symtab_entry): New function.
6002         (Symbol_value::needs_output_symtab_entry): Remove.
6003         (Symbol_value::output_symtab_index): Make sure the symbol index is
6004         set.
6005         (Symbol_value::set_output_symtab_index): Make sure the symbol
6006         index is not set.  Make sure the new index is valid.
6007         (Symbol_value::set_must_have_output_symtab_entry): New function.
6008         (Symbol_value::has_output_dynsym_entry): New function.
6009         (Symbol_value::set_output_dynsym_index): Make sure the new index
6010         is valid.
6011         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6012         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6013         local symbol if permitted.
6014         (Sized_relobj::do_finalize_local_symbols): Call
6015         is_output_symtab_index_set rather than needs_output_symtab_entry.
6016         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6017         rather than needs_output_symtab_entry.  Call
6018         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6019         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6020         is_output_symtab_index_set rather than needs_output_symtab_entry.
6021         * testsuite/discard_locals_relocatable_test.c: New file.
6022         * testsuite/discard_locals_test.sh: Test -r.
6023         * testsuite/Makefile.am (check_DATA): Add
6024         discard_locals_relocatable_test1.syms,
6025         discard_local_relocatable_test2.syms.
6026         (MOSTLYCLEANFILES): Likewise.  Also add
6027         discard_locals_relocatable_test1.lout and
6028         discard_locals_relocatable_test2.out.
6029         (discard_locals_relocatable_test1.syms): New target.
6030         (discard_locals_relocatable_test.o): New target.
6031         (discard_locals_relocatable_test1.out): New target.
6032         (discard_locals_relocatable_test2.syms): New target.
6033         (discard_locals_relocatable_test2.out): New target.
6034         (various): Add missing ../ld-new dependencies.
6035         * testsuite/Makefile.in: Rebuild.
6036
6037 2010-03-03  Nick Clifton  <nickc@redhat.com>
6038
6039         * po/fi.po: New Finnish translation.
6040
6041 2010-03-01  Doug Kwan  <dougkwan@google.com>
6042
6043         * layout.cc (Layout::Layout): Force section types of .init_array*,
6044         .preinit_array* and .fini_array* sections.
6045         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6046         Fix check of return value of std::string::find.().
6047         (Output_section::Input_section_sort_compare::operator()): Remove
6048         comment about .init_array.
6049         (Output_section::Input_section_sort_init_fini_compare::operator()):
6050         New method.
6051         (Output_section::sort_attached_input_sections): Handle .init_array
6052         and .fini_array specially.
6053         * output.h (Output_section::Inut_section_sort_compare): Update
6054         comment.
6055         (Output_section::Input_section_sort_init_fini_compare): New struct.
6056
6057 2010-02-26  Doug Kwan  <dougkwan@google.com>
6058
6059         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6060         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6061         * testsuite/debug_msg.sh: Avoid matching source line number for
6062         use of global variable undef_int.
6063
6064 2010-02-26  Doug Kwan  <dougkwan@google.com>
6065
6066         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6067         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6068         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6069         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6070         * options.cc (General_options::General_options): Initialize member
6071         fix_v4bx_.
6072         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6073         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6074         and rm_no_fix_v4bx.stdout
6075         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6076         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6077         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6078         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6079         and arm_no_fix_v4bx.
6080         * Makefile.in: Regenerate.
6081         * testsuite/arm_fix_v4bx.s: New file.
6082         * testsuite/arm_fix_v4bx.sh: Ditto.
6083
6084 2010-02-24  Doug Kwan  <dougkwan@google.com>
6085
6086         * arm.cc (Target_arm::got_section): Make the .got section the first
6087         non RELRO section in the data segment.
6088         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6089         suffixes of section names.
6090
6091 2010-02-24  Doug Kwan  <dougkwan@google.com>
6092
6093         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6094         flags and attributes merging if an input file is a binary file.
6095         * fileread.cc (Input_file::open): Record format of original file.
6096         * fileread.h (Input_file::Format): New enum type.
6097         (Input_file::Input_file): Initialize data member format_.
6098         (Input_file::format): New method definition.
6099         (Input_file::format_):: New data member.
6100
6101 2010-02-24  Doug Kwan  <dougkwan@google.com>
6102
6103         * arm.cc (Arm_output_data_got): New class.
6104         (ARM_TCB_SIZE): New constant
6105         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6106         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6107         If user uses a script with a SECTIONS clause, issue only a warning
6108         for a misplaced EXIDX input section.  Otherwise, issue an error.
6109         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6110         garbage collection.
6111         (Target_arm::got_mode_index_entry): Handle static linking.
6112         (Target_arm::Scan::local): Ditto.
6113         (Target_arm::Scan::global): Ditto.
6114         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6115         all incorrectly implemented relocations.
6116         (Target_arm::fix_exidx_coverage): Pass layout to
6117         Arm_output_section::fix_exidx_coverage.
6118         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6119         from ".ARM.exidx." and ".ARM.extab.".
6120
6121 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6122
6123         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6124         section if it does not already exist.
6125         * attributes.cc (Attributes_section_data::Attributes_section_data):
6126         Don't crash if size is zero.
6127
6128 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6129             Ian Lance Taylor  <iant@google.com>
6130
6131         * gold.cc (queue_middle_tasks): If no input files were opened,
6132         exit.
6133         * workqueue.h (Task_function::Task_function): Assert that there is
6134         a blocker.
6135
6136 2010-02-22  Doug Kwan  <dougkwan@google.com>
6137
6138         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6139         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6140         types to avoid warnings due to different uint64_t implementations
6141         on different hosts.
6142
6143 2010-02-21  Doug Kwan  <dougkwan@google.com>
6144
6145         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6146         handling of the maximum backward branch offset.
6147         (Arm_relocate_functions::thumb_branch_common): Ditto.
6148         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6149         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6150         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6151         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6152         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6153         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6154         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6155         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6156         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6157         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6158         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6159         thumb2_bl_out_of_range.o): New rules.
6160         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6161         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6162         thumb2_bl_out_of_range
6163         * testsuite/Makefile.in: Regenerate.
6164         * testsuite/arm_bl_in_range.s: New file.
6165         * testsuite/arm_bl_out_of_range.s: Ditto.
6166         * testsuite/arm_branch_in_range.sh: Ditto.
6167         * testsuite/arm_branch_range.t: Ditto.
6168         * testsuite/thumb2_branch_range.t: Ditto.
6169         * testsuite/thumb_bl_in_range.s: Ditto.
6170         * testsuite/thumb_bl_out_of_range.s: Ditto.
6171         * testsuite/thumb_branch_range.t: Ditto.
6172
6173 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6174
6175         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6176         Add reloc offset information.
6177         * icf.cc (get_section_contents): Change iterators to point to the new
6178         vectors. Add reloc offset information to the contents.
6179         * icf.h (Icf::Sections_reachable_info): New typedef.
6180         (Icf::Sections_reachable_list): New typedef.
6181         (Icf::Offset_info): New typedef.
6182         (Icf::Reloc_info): New struct typedef.
6183         (Icf::Reloc_info_list): New typedef.
6184         (Icf::symbol_reloc_list): Delete method.
6185         (Icf::addend_reloc_list): Delete method.
6186         (Icf::section_reloc_list): Delete method.
6187         (Icf::reloc_info_list): New method.
6188         (Icf::reloc_info_list_): New member.
6189
6190 2010-02-19  Doug Kwan  <dougkwan@google.com>
6191
6192         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6193         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6194         * arm.cc (Arm_relocation_functions): New forward declaration.
6195         (Target_arm::Target_arm): Initialize new data members
6196         got_mod_index_offset_ and tls_base_symbol_defined_.
6197         (Target_arm::Relocate::relocate_tls): New method.
6198         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6199          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6200         New methods.
6201         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6202         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6203         (Target_arm::got_mod_index_offset_,
6204         Target_arm::tls_base_symbol_defined_): New data members.
6205         (Target_arm::Scan::local, Target::Scan::global,
6206         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6207         relocations.
6208
6209 2010-02-18  Doug Kwan  <dougkwan@google.com>
6210
6211         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6212         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6213         text section as a parameter becuase some broken tools may not set
6214         the link in section header.
6215         (Target_arm::has_got_section): New method.
6216         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6217         without any mapping symbol as data only.  Remove warning.
6218         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6219         link in its section header, try to discover the link by inspecting the
6220         REL31 relocation at the beginning of the section.
6221         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6222         in error message.
6223         (Target_arm::Scan::global): Treat any reference to the symbol
6224         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6225
6226 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6227
6228         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6229         (Scan::global_reloc_may_be_function_pointer): New function.
6230         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6231         (Scan::global_reloc_may_be_function_pointer): New function.
6232         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6233         (Scan::global_reloc_may_be_function_pointer): New function.
6234         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6235         (Scan::global_reloc_may_be_function_pointer): New function.
6236         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6237         (Scan::global_reloc_may_be_function_pointer): New function.
6238         (Scan::possible_function_pointer_reloc): New function.
6239         (Target_x86_64::can_check_for_function_pointers): New function.
6240         * gc.h (gc_process_relocs): Scan relocation types to determine if
6241         function pointers were taken for targets that support it.
6242         * icf.cc (Icf::find_identical_sections): Include functions for
6243         folding in safe ICF whose pointer is not taken.
6244         * icf.h (Secn_fptr_taken_set): New typedef.
6245         (fptr_section_id_): New member.
6246         (section_has_function_pointers): New function.
6247         (set_section_has_function_pointers): New function.
6248         (check_section_for_function_pointers): New function.
6249         * options.h: Fix comment for safe ICF option.
6250         * target.h (can_check_for_function_pointers): New function.
6251         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6252         Modify icf_safe_test for X86-64.
6253         * testsuite/Makefile.in: Regenerate.
6254         * testsuite/icf_safe_so_test.cc: New file.
6255         * testsuite/icf_safe_so_test.sh: New file.
6256         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6257         (main): Change to take pointer to function kept_func_3.
6258         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6259         folding is done correctly for X86-64.
6260
6261 2010-02-12  David S. Miller  <davem@davemloft.net>
6262
6263         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6264         is_symbolless parameter.
6265         (Output_reloc<SHT_REL>::is_symbolless): New.
6266         (Output_reloc<SHT_REL>::is_symbolless_): New.
6267         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6268         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6269         (Output_reloc<SHT_RELA>::is_symbolless): New.
6270         (Output_data_reloc::add_global): Handle is_symbolless.
6271         (Output_data_reloc::add_global_relative): Likewise.
6272         (Output_data_reloc::add_local): Likewise.
6273         (Output_data_reloc::add_local_relative): Likewise.
6274         (Output_data_reloc::add_symbolless_global_addend): New.
6275         (Output_data_reloc::add_symbolless_local_addend): New.
6276         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6277         is_symbolless.
6278         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6279         instead of ->is_relative_
6280         (Output_reloc::write): Likewise.
6281         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6282         (Output_reloc::write_rel): Simplify.
6283
6284         * sparc.cc (Target_sparc::Scan::local): Use
6285         ->add_symbolless_local_addend as needed.
6286         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6287         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6288         based upon relocation offset.
6289
6290 2010-02-11  Doug Kwan  <dougkwan@google.com>
6291
6292         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6293         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6294         beginning of function.
6295         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6296         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6297         parameter is_32bit in calls to should_apply_static_reloc.
6298         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6299         (check_DATA): Add arm_abs_global.stdout.
6300         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6301         arm_abs_global.stdout): New rules.
6302         (MOSTLLYCLEANFILES): Add arm_abs_global
6303         * Makefile.in: Regenerate.
6304         * testsuite/arm_abs_global.s: New file.
6305         * testsuite/arm_abs_global.sh: Ditto.
6306         * testsuite/arm_abs_lib.s: Ditto.
6307
6308 2010-02-11  Ian Lance Taylor  <iant@google.com>
6309
6310         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6311         Read_relocs task.
6312         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6313         Allocate_commons_task first.
6314         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6315         task, rather than symtab_lock_.
6316         (Gc_process_relocs::~Gc_process_relocs): New function.
6317         (Gc_process_relocs::is_runnable): Check this_blocker_.
6318         (Gc_process_relocs::locks): Use next_blocker_ rather than
6319         blocker_.
6320         (Scan_relocs::~Scan_relocs): New function.
6321         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6322         symtab_lock_.
6323         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6324         next_blocker_.
6325         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6326         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6327         constructor accordingly.
6328         (class Gc_process_relocs): Likewise.
6329         (class Scan_relocs): Likewise.
6330         * common.h (class Allocate_commons_task): Remove symtab_lock_
6331         field, and corresponding constructor parameter.
6332         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6333         symtab_lock_.
6334         (Allocate_commons_task::locks): Likewise.
6335
6336 2010-02-11  Ian Lance Taylor  <iant@google.com>
6337
6338         * gold-threads.h (class Once): Define.
6339         (class Initialize_lock): Rewrite as child of Once.
6340         * gold-threads.cc (class Once_initialize): Define.
6341         (once_pointer_control): New static variable.
6342         (once_pointer, once_arg): New static variables.
6343         (c_run_once): New static function.
6344         (Once::Once, Once::run_once, Once::internal_run): New functions.
6345         (class Initialize_lock_once): Remove.
6346         (initialize_lock_control): Remove.
6347         (initialize_lock_pointer): Remove.
6348         (initialize_lock_once): Remove.
6349         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6350         (Initialize_lock::initialize): Rewrite.
6351         (Initialize_lock::do_run_once): New function.
6352         * archive.cc (Archive::interpret_header): Only clear name if it is
6353         not already empty.
6354         * fileread.cc: Include "gold-threads.h"
6355         (file_counts_lock): New static variable.
6356         (file_counts_initialize_lock): Likewise.
6357         (File_read::release): Only increment counts when using --stats.
6358         Use a lock around the increment.
6359         * parameters.cc (class Set_parameters_target_once): Define.
6360         (set_parameters_target_once): New static variable.
6361         (Parameters::Parameters): Move here from parameters.h.
6362         (Parameters::set_target): Rewrite.
6363         (Parameters::set_target_once): New function.
6364         (Parameters::clear_target): Move here and rewrite.
6365         * parameters.h (class Parameters): Update declarations.  Add
6366         set_parameters_target_once_ field.
6367         (Parameters::Parameters): Move to parameters.cc.
6368         (Parameters::clear_target): Likewise.
6369         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6370         task.
6371         (Start_group::~Start_group): New function.
6372         (Start_group::is_runnable): New function.
6373         (Start_group::locks, Start_group::run): New functions.
6374         (Finish_group::run): Change saw_undefined to size_t.
6375         * readsyms.h (class Start_group): Define.
6376         (class Finish_group): Change saw_undefined_ field to size_t.
6377         (Finish_group::Finish_group): Remove saw_undefined and
6378         this_blocker parameters.  Change all callers.
6379         (Finish_group::set_saw_undefined): New function.
6380         (Finish_group::set_blocker): New function.
6381         * symtab.h (class Symbol_table): Change saw_undefined to return
6382         size_t.  Change saw_undefined_ field to size_t.
6383         * target-select.cc (Set_target_once::do_run_once): New function.
6384         (Target_selector::Target_selector): Initialize set_target_once_
6385         field.  Don't initialize lock_ and initialize_lock_ fields.
6386         (Target_selector::instantiate_target): Rewrite.
6387         (Target_selector::set_target): New function.
6388         * target-select.h (class Set_target_once): Define.
6389         (class Target_selector): Update declarations.  Make
6390         Set_target_once a friend.  Remove lock_ and initialize_lock_
6391         fields.  Add set_target_once_ field.
6392
6393 2010-02-10  Ian Lance Taylor  <iant@google.com>
6394
6395         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6396         queueing any tasks.
6397         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6398         (queue_middle_tasks): Add all blockers before queueing any tasks.
6399         (queue_final_tasks): Likewise.
6400         * token.h (Task_token::add_blockers): New function.
6401         * object.h (Input_objects::number_of_relobjs): New function.
6402
6403 2010-02-10  Ian Lance Taylor  <iant@google.com>
6404
6405         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6406         shared, not if not position independent.
6407         * x86_64.cc (Relocate::relocate_tls): Likewise.
6408         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6409         (tls_pie_pic_test): New target.
6410         * testsuite/Makefile.in: Rebuild.
6411
6412         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6413         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6414         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6415         * testsuite/Makefile.in: Rebuild.
6416
6417 2010-02-09  David S. Miller  <davem@davemloft.net>
6418
6419         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6420         R_SPARC_RELATIVE using ->add_local_relative().
6421         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6422
6423         * output.h (Output_data_dynamic::add_section_size): New method
6424         that takes two Output_data objects.
6425         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6426         entry param.  Handle it in initializers.
6427         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6428         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6429         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6430         arg.
6431         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6432         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6433         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6434         for dynrel_includes_plt.
6435         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6436         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6437         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6438         before .rela.plt
6439         (Target_sparc::do_finalize_sections): Update to pass true for
6440         dynrel_includes_plt.
6441         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6442         output before .rela.plt
6443         (Target_powerpc::do_finalize_sections): Update to pass true for
6444         dynrel_includes_plt when 32-bit.
6445
6446 2010-02-08  Doug Kwan  <dougkwan@google.com>
6447
6448         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6449         method.
6450         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6451         Arm_relobj::scan_section_for_cortex_a8_stubs,
6452         Arm_relobj::do_relocation_section): Instead of calling
6453         Output_section::output_address, use faster
6454         Arm_relobj::simple_input_section_output_address.
6455
6456 2010-02-08  David S. Miller  <davem@davemloft.net>
6457
6458         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6459         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6460         relocation helper function.
6461
6462         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6463         just like R_SPARC_GOT{10,13,22}.
6464         (Target_sparc::Scan::local): Likewise.
6465         (Target_sparc::Relocate:relocate): Likewise.
6466
6467 2010-02-06  Ian Lance Taylor  <iant@google.com>
6468
6469         * configure.ac: Rewrite targetobjs duplicate removal code to use
6470         only shell constructs.
6471         * configure: Rebuild.
6472
6473 2010-02-05  Doug Kwan  <dougkwan@google.com>
6474
6475         PR 11247
6476         * arm.cc (Arm_relobj::section_is_scannable): New method.
6477         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6478         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6479
6480 2010-02-04  Doug Kwan  <dougkwan@google.com>
6481
6482         PR 11247
6483         * arm-reloc-property.cc (cstdio): Include.
6484         * configure.ac (targetobjs): Remove duplicates.
6485         * configure: Regenerate.
6486         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6487         big and little endian version for a given address size.
6488
6489 2010-02-03  Doug Kwan  <dougkwan@google.com>
6490
6491         * arm-reloc-property.cc
6492         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6493         definition.
6494         * arm-reloc-property.h
6495         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6496         New method definition.
6497         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6498         declaration.
6499         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6500         overflow to N.
6501         (GOT_PREL): Change implemented to Y.
6502         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6503         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6504         (Arm_relocate_functions::movw_abs_nc): Remove method.
6505         (Arm_relocate_functions::movt_abs): Ditto.
6506         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6507         (Arm_relocate_functions::thm_movt_abs): Ditto.
6508         (Arm_relocate_functions::movw_rel_nc): Ditto.
6509         (Arm_relocate_functions::movw_rel): Ditto.
6510         (Arm_relocate_functions::movt_rel): Ditto.
6511         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6512         (Arm_relocate_functions:thm_movw_rel): Ditto.
6513         (Arm_relocate_functions:thm_movt_rel): Ditto.
6514         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6515         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6516         New method definitions.
6517         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6518         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6519         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6520         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6521         (Target_arm::Relocate::relocate): Check for non-static or
6522         unimplemented relocation code and exit early.  Change calls to
6523         Target_arm::reloc_uses_thumb_bit and
6524         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6525         instead.  Refactor code to handle similar relocations to increase
6526         code sharing.  Remove check for unsupported relocation code in switch
6527         statement.
6528         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6529         relocation property table to find out size.  Change error message to
6530         print out the name of a relocation code instead of the numeric value.
6531         (Target_arm::scan_reloc_for_stub): Use relocation property table
6532         instead of calling Target_arm::reloc_uses_thumb_bit().
6533
6534 2010-02-02  Doug Kwan  <dougkwan@google.com>
6535
6536         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6537         types of relaxed input section.
6538
6539 2010-02-02  Doug Kwan  <dougkwan@google.com>
6540
6541         * Makefile.am (HFILES): Add arm-reloc-property.h.
6542         (DEFFILES): New.
6543         (TARGETSOURCES): Add arm-reloc-property.cc
6544         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6545         (libgold_a_SOURCES): $(DEFFILES)
6546         * Makefile.in: Regenerate.
6547         * arm-reloc-property.cc: New file.
6548         * arm-reloc-property.h: New file.
6549         * arm-reloc.def: New file.
6550         * arm.cc: Update comments.
6551         (arm-reloc-property.h): New included header.
6552         (arm_reloc_property_table): New global variable.
6553         (Target_arm::do_select_as_default_target): New method definition.
6554         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6555         arm-reloc-property to targ_extra_obj.
6556         * parameters.cc (set_parameters_target): Call
6557         Target::select_as_default_target().
6558         * target.h (Target::select_as_default_target): New method definition.
6559         (Target::do_select_as_default_target): Same.
6560
6561 2010-02-01  Doug Kwan  <dougkwan@google.com>
6562
6563         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6564         first_output_text_section_.
6565         (Arm_exidx_fixup::first_output_text_section): New method definition.
6566         (Arm_exidx_fixup::first_output_text_section_): New data member.
6567         (Arm_exidx_fixup::process_exidx_section): Record the first text
6568         output section seen.
6569         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6570         and entsize in output section header.
6571
6572 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6573
6574         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6575         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6576         (Arm_relocate_functions::thm_alu11): New Method.
6577         (Arm_relocate_functions::thm_pc8): New Method.
6578         (Arm_relocate_functions::thm_pc12): New Method.
6579         (Target_arm::Scan::local): Handle the relocations.
6580         (Target_arm::Scan::global): Likewise.
6581         (Target_arm::Relocate::relocate): Likewise.
6582         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6583
6584 2010-01-29  Doug Kwan  <dougkwan@google.com>
6585
6586         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6587         of relocation types as ld.
6588
6589 2010-01-29  Doug Kwan  <dougkwan@google.com>
6590
6591         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6592         to public.
6593         (Arm_relocate_functions::thumb_branch_common): Ditto.
6594         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6595         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6596         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6597         Arm_relocate_functions::jump24): Remove.
6598         (Target_arm::Relocate::relocate): Adjust code to call
6599         Arm_relocation_functions::arm_branch_common and
6600         Arm_relocation_functions::thumb_branch_common instead of their removed
6601         wrappers.  Merge switch-cases together to reduce source code size.
6602
6603 2010-01-29  Doug Kwan  <dougkwan@google.com>
6604
6605         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6606         output_local_symbol_count_needs_update_.
6607         (Arm_relobj::output_local_symbol_count_needs_update,
6608          Arm_relobj::set_output_local_symbol_count_needs_update,
6609          Arm_relobj::update_output_local_symbol_count): New methods.
6610         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6611         member.
6612         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6613         of pointed function as in a R_ARM_PREL31 relocation.
6614         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6615         for output local symbol count updating.
6616         (Target_arm::do_relax): Update output local symbol counts in objects
6617         if necessary.
6618         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6619
6620 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6621
6622         * arm.cc: Added support for the ARM relocations:
6623         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6624         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6625         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6626         movw_prel_nc).
6627         (Arm_relocate_functions::movw_rel): New method.
6628         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6629         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6630         thm_movw_prel_nc).
6631         (Arm_relocate_functions::thm_movw_rel): New method.
6632         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6633         thm_movt_prel).
6634         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6635         relocations.
6636         (Target_arm::Scan::global): Likewise.
6637         (Target_arm::Relocate::relocate): Likewise.
6638         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6639         Likewise.
6640
6641 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6642
6643         * arm.cc: Added support for ARM group relocations.
6644         (Target_arm::reloc_needs_sym_origin): New method.
6645         (Arm_relocate_functions::calc_grp_kn): New method.
6646         (Arm_relocate_functions::calc_grp_residual): New method.
6647         (Arm_relocate_functions::calc_grp_gn): New method.
6648         (Arm_relocate_functions::arm_grp_alu): New Method.
6649         (Arm_relocate_functions::arm_grp_ldr): New Method.
6650         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6651         (Arm_relocate_functions::arm_grp_ldc): New Method.
6652         (Target_arm::Scan::local): Handle the ARM group relocations.
6653         (Target_arm::Scan::global): Likewise.
6654         (Target_arm::Relocate::relocate): Likewise.
6655         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6656         Likewise.
6657
6658 2010-01-26  Doug Kwan  <dougkwan@google.com>
6659
6660         * arm.cc (set): Include.
6661         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6662         pointer type.
6663         (Arm_output_section::Text_section_list): New type.
6664         (Arm_output_section::append_text_sections_to_list): New method.
6665         (Arm_output_section::fix_exidx_coverage): Ditto.
6666         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6667         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6668         Relobj::set_section_offset() instead of
6669         Sized_relobj::invalidate_section_offset().
6670         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6671         parameter for section headers. Ignore relocation sections for
6672         unallocated sections and EXIDX sections.
6673         (Target_arm::fix_exidx_coverage): New method.
6674         (Target_arm::output_section_address_less_than): New type.
6675         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6676         linked text section instead of the EXIDX section.
6677         (Arm_output_section::create_stub_group): Add an assertion to check
6678         that this is not an EXIDX output section.
6679         (Arm_output_section::append_text_sections_to_list): New method.
6680         (Arm_output_section::fix_exidx_coverage): Ditto.
6681         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6682         Arm_relobj::section_needs_reloc_stub_scanning.
6683         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6684         first pass.
6685         (Target_arm::fix_exidx_coverage): New method.
6686         * object.h (Relobj::set_output_section): New method.
6687         (Sized_relobj::invalidate_section_offset): Remove method.
6688         (Sized_relobj::do_invalidate_section_offset): Remove method.
6689         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6690
6691 2010-01-25  Doug Kwan  <dougkwan@google.com>
6692
6693         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6694         Fix warning due to signed and unsigned comparison on a 32-bit host.
6695
6696 2010-01-22  Doug Kwan  <dougkwan@google.com>
6697
6698         * arm.cc (Target_arm::do_relax): Record an output section for section
6699         offset adjustment it contains any stub table that has changed.
6700         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6701         offsets in an output section if necessary.
6702         * output.cc (Output_section::Output_section): Initialize
6703         section_offsets_need_adjustments_.
6704         (Output_section::add_input_section_for_script): Renamed to
6705         Output_section::add_simple_input_section.
6706         (Output_section::save_states): Add a comment.
6707         (Output_section::discard_states): New method defintion.
6708         (Output_section::adjust_section_offsets): Same.
6709         * output.h (Output_section::add_input_section_for_script): Renamed to
6710         Output_section::add_simple_input_section.
6711         (Output_section::discard_states): New method declaration.
6712         (Output_section::adjust_section_offsets): Same.
6713         (Output_section::section_offsets_need_adjustment,
6714         Output_section::set_section_offsets_need_adjustment): New method
6715         definitions.
6716         (Output_section::section_offsets_need_adjustment_): New data member.
6717         * script-sections.cc
6718         (Output_section_element_input::set_section_address): Adjust code for
6719         renaming of Output_section::add_input_section_for_script.
6720         (Orphan_output_section::set_section_address): Same.
6721
6722 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6723
6724         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6725         Fix_v4bx enum values .
6726         * gold/options.h (General_options): New option definitions.
6727         (General_options::fix_v4bx): New method.
6728         (General_options::Fix_v4bx): New enum.
6729         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6730         (General_options::parse_fix_v4bx_interworking): New method.
6731
6732 2010-01-22  Doug Kwan  <dougkwan@google.com>
6733
6734         * arm.cc (Arm_exidx_fixup): New class.
6735
6736 2010-01-21  Doug Kwan  <dougkwan@google.com>
6737
6738         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6739         classes.
6740         (Arm_exidx_section_offset_map): New type.
6741
6742 2010-01-21  Doug Kwan  <dougkwan@google.com>
6743
6744         * arm.cc (Arm_exidx_input_section): New class.
6745         (Arm_relobj::exidx_input_section_by_link,
6746         Arm_relobj::exidx_input_section_by_shndx,
6747         Arm_relobj::make_exidx_input_section): New methods.
6748         (read_arm_attributes_section): Remove.
6749         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6750         information about them.
6751         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6752         to here.
6753
6754 2010-01-20  Doug Kwan  <dougkwan@google.com>
6755
6756         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6757         Input_section_specifier to Section_id.
6758         (Target_arm::new_arm_input_section: Adjust code for change of key
6759         type.
6760         (Target_arm::find_arm_input_section): Ditto.
6761         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6762         (Section_id): Remove.
6763         (Garbage_collection::Section_id_hash): Remove.
6764         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6765         (Section_id): Remove.
6766         (Icf::Section_id_hash): Remove.
6767         * object.h (Section_id, Const_section_id, Section_id_hash,
6768         Const_section_id_hash): New type definitions.
6769         * output.cc (Output_section::add_relaxed_input_section): Change to
6770         use Const_section_id instead of Input_section_specifier as key type.
6771         (Output_section::add_merge_input_section): Ditto.
6772         (Output_section::build_relaxation_map): Change to use Section_id
6773         instead of Input_section_specifier as key type.
6774         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6775         Ditto.
6776         (Output_section::convert_input_sections_to_relaxed_sections): Change
6777         to use Const_section_id instead of Input_section_specifier as key type.
6778         (Output_section::find_merge_section): Ditto.
6779         (Output_section::find_relaxed_input_section): Ditto.
6780         * output.h (Input_section_specifier): Remove class.
6781         (Output_section::Output_section_data_by_input_section_map): Change
6782         key type to Const_section_id.
6783         (Output_section::Output_relaxed_input_section_by_input_section_map):
6784         Ditto.
6785         (Output_section::Relaxation_map): Change key type to Section_id.
6786
6787 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6788
6789         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6790         (class Arm_v4bx_stub): New class.
6791         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6792         (Stub_factory::make_arm_v4bx_stub): New method.
6793         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6794         (Stub_table::empty): Handle v4bx stubs.
6795         (Stub_table::add_arm_v4bx_stub): New method.
6796         (Stub_table::find_arm_v4bx_stub): New method.
6797         (Arm_relocate_functions::v4bx): New method.
6798         (Target_arm::fix_v4bx): New method.
6799         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6800         (Stub_table::relocate_stubs): Likewise.
6801         (Stub_table::do_write): Likewise.
6802         (Stub_table::update_data_size_and_addralign): Likewise.
6803         (Stub_table::finalize_stubs):  Likewise.
6804         (Target_arm::Scan::local): Likewise.
6805         (Target_arm::Scan::global): Likewise.
6806         (Target_arm::do_finalize_sections): Likewise.
6807         (Target_arm::Relocate::relocate): Likewise.
6808         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6809         Likewise.
6810         (Target_arm::scan_reloc_for_stub): Likewise.
6811         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6812
6813 2010-01-19  Ian Lance Taylor  <iant@google.com>
6814
6815         * output.cc (Output_section_headers::do_sized_write): Write large
6816         segment count to sh_info field.
6817         (Output_file_header::do_sized_write): For large segment count,
6818         write PN_XNUM to e_phnum field.
6819
6820 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6821
6822         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6823         (Arm_relocate_functions::thm_jump8): New function.
6824         (Arm_relocate_functions::thm_jump11): New function.
6825         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6826         R_ARM_THM_JUMP11.
6827         (Target_arm::Scan::global): Likewise.
6828         (Target_arm::Relocate::relocate): Likewise.
6829         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6830         Likewise.
6831
6832 2010-01-14  Doug Kwan  <dougkwan@google.com>
6833
6834         * arm.cc (map, utility): Include headers.
6835         (Target_arm::apply_cortex_a8_workaround): New method.
6836         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6837         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6838         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6839         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6840         the --[no-]fix-cortex-a8 command line options.
6841         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6842         (Target_arm::relocate_stub): Use addend in instruction template.
6843         * options.h (DEFINE_bool): Set the user-set flag.
6844         (General_options): Add --[no-]-fix-cortex options.
6845         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6846         : Update fast look-up map after conversion.
6847
6848 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6849
6850         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6851         in the first pass of do_layout.
6852
6853 2010-01-13  Doug Kwan  <dougkwan@google.com>
6854
6855         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6856         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6857         apparent compiler problem of not folding static constant integral
6858         data members of elfcpp::Elf_sizes<32>.
6859
6860 2010-01-13  Doug Kwan  <dougkwan@google.com>
6861
6862         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6863         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6864         Arm_relobj::scan_section_for_cortex_a8_erratum,
6865         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6866         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6867         sections to scan for relocation stubs into a new method
6868         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6869         relocation and Cortex-A8 stub scanning.
6870         (Target_arm::do_relax): Force stubs to be after stubbed sections
6871         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6872         the beginning of a new relaxation pass.  Update a comment.
6873         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6874
6875 2010-01-12  Ian Lance Taylor  <iant@google.com>
6876
6877         * target-reloc.h (visibility_error): New inline function.
6878         (relocate_section): Call visibility_error.
6879         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6880         (MOSTLYCLEANFILES): Likewise.
6881         (protected_4_pic.o, protected_3.err): New targets.
6882         * testsuite/protected_4.cc: New file.
6883
6884 2010-01-12  Doug Kwan  <dougkwan@google.com>
6885
6886         * arm.cc (Cortex_a8_reloc): New class.
6887         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6888         and cortex_a8_relocs_info_.
6889         (Target_arm::fix_cortex_a8): New method definition.
6890         (Target_arm::Cortex_a8_relocs_info): New type.
6891         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6892         New data member declarations.
6893         (Target_arm::scan_reloc_for_stub): Record information about
6894         relocations for THUMB branches that might be exempted from the
6895         Cortex-A8 workaround.
6896         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6897         at the beginning of a relaxation pass.
6898
6899 2010-01-12  Doug Kwan  <dougkwan@google.com>
6900
6901         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6902         (Arm_relobj::Mapping_symbol_position,
6903          Arm_reloj::Mapping_symbol_position_less,
6904          Arm_relobj::Mapping_symbols_info): New types.
6905         (Target_arm::is_mapping_symbol_name): New method definition.
6906         (Arm_relobj::do_count_local_symbols): Save information about mapping
6907         symbols.
6908
6909 2010-01-11  Doug Kwan  <dougkwan@google.com>
6910
6911         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6912         Arm_relocate_functions::thumb32_branch_upper,
6913         Arm_relocate_functions::thumb32_branch_lower,
6914         Arm_relocate_functions::thumb32_cond_branch_offset,
6915         Arm_relocate_functions::thumb32_cond_branch_upper,
6916         Arm_relocate_functions::thumb32_cond_branch_lower,
6917         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6918         branch offset encoding.
6919         (Arm_relocate_functions::thumb_branch_common): Use new branch
6920         offset encoding methods to avoid code duplication.
6921         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6922         (Stub_addend_reader::operator()): Use new branch encoding method
6923         to avoid code duplication.
6924
6925 2010-01-11  Doug Kwan  <dougkwan@google.com>
6926
6927         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6928         (Target_arm::do_finalize_sections): Define special EXIDX section
6929         symbols only if referenced.
6930         * gc.h (Garbage_collection::add_reference): New method.
6931         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6932         code duplication.
6933
6934 2010-01-11  Ian Lance Taylor  <iant@google.com>
6935
6936         * script.cc (Version_script_info::build_expression_list_lookup):
6937         Change complaing about duplicate wildcard match from error to
6938         warning.
6939
6940         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6941         of 2009-12-30.
6942         (Version_script_info::Version_script_info): Initialize globs_,
6943         default_version_, default_is_global_, and exact_.  Don't
6944         initialize globals_ or locals_.
6945         (Version_script_info::build_lookup_tables): Build local symbols
6946         first.
6947         (Version_script_info::unquote): New function.
6948         (Version_script_info::add_exact_match): New function.
6949         (Version_script_info::build_expression_list_lookup): Remove lookup
6950         parameter.  Add is_global parameter.  Change all callers.  Handle
6951         wildcard pattern specially.  Unquote pattern.  Call
6952         add_exact_match.
6953         (Version_script_info::get_name_to_match): New function.
6954         (Version_script_info::get_symbol_version): New function.
6955         (Version_script_info::get_symbol_version_helper): Remove.
6956         (Version_script_info::check_unmatched_names): Call unquote.
6957         * script.h (class Version_script_info): Change get_symbol_version
6958         to be non-inline and add is_global parameter; change all callers.
6959         Rewrite symbol_is_local.  Update declarations.  Define struct
6960         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6961         Remove globals_ and locals_ members.  Add exact_, globs_,
6962         default_version_, is_global_.
6963         (Version_script_info::Glob): Remove pattern, add expression and
6964         is_global.  Update constructor.  Change all callers.
6965         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6966         default version.
6967         (Versions::symbol_section_contents): If a symbol is undefined, or
6968         defined in a dynamic object, set the version index to
6969         VER_NDX_LOCAL.
6970         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6971         symbol_is_local.
6972         (Symbol_table::add_from_pluginobj): Likewise.
6973         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6974
6975 2010-01-11  Doug Kwan  <dougkwan@google.com>
6976
6977         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6978         (incremental_dump_LDADD): Add linking option for libintl.
6979         * Makefile.in: Regenerate.
6980
6981 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6982
6983         PR gold/11144
6984         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6985         instead of -Ds.
6986         * testsuite/Makefile.in: Regenerated.
6987
6988 2010-01-10  Doug Kwan  <dougkwan@google.com>
6989
6990         * options.h (DEFINE_var): Use parentheses around argument varname__
6991         in macro body to avoid any unintended subsequent substitutions.
6992
6993 2010-01-10  Ian Lance Taylor  <iant@google.com>
6994
6995         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6996         candidates before doing symbol resolution.
6997
6998         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6999         ODR candidates if only one is weak.
7000
7001 2010-01-08  Ian Lance Taylor  <iant@google.com>
7002
7003         * script.cc (Version_script_info::build_expression_list_lookup):
7004         Don't warn about ambiguous version, just record the ambiguity.
7005         (Version_script_info::get_symbol_version_helper): Give error if
7006         version is ambiguous.
7007
7008 2010-01-08  Doug Kwan  <dougkwan@google.com>
7009
7010         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7011           prev_data_size_ and prev_addralign_.  Remove initializer for
7012           deleted data member has_been_changed_.
7013           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7014           to determine if the table is empty.
7015           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7016           Remove.
7017           (Stub_table::add_reloc_stub): Define method in class definition
7018           instead of just declaring it there.
7019           (Stub_table::add_cortex_a8_stub): New method definition.
7020           (Stub_table::update_data_size_and_addralign): Ditto.
7021           (Stub_table::finalize_stubs): Ditto.
7022           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7023           (Stub_table::do_addralign_): Return address alignment in the
7024           (Stub_table::do_reset_address_and_file_offset): Define method in
7025           class definition instead of declaring it there.  Set current data
7026           size to be the data size of the previous pass.
7027           (Stub_table::set_final_data_size): Use current data size as the
7028           final data size.
7029           (Stub_table::relocate_stub): Change parameter type of stub from
7030           Reloc_stub pointer to Stub pointer.
7031           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7032           (Stub_table::Cortex_a8_stub_list): New typedef.
7033           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7034            Stub_table::prev_addralign_): New data member.
7035           (Arm_relobj::Arm_relobj): Initialize data member
7036           section_has_cortex_a8_workaround_.
7037           (Arm_relobj::section_has_cortex_a8_workaround,
7038            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7039            definitions.
7040           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7041           declarations.
7042           (Target_arm::relocate_stub): Change parameter type of stub from
7043           Reloc_stub pointer to Stub pointer.
7044           (Insn_template::size, Insn_template::alignment): Handle
7045           THUMB16_SPECIAL_TYPE.
7046           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7047            Stub_table::update_data_size_and_addralign,
7048            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7049           definitions.
7050           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7051           (Stub_table::do_write): Ditto.
7052           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7053
7054 2010-01-08  Ian Lance Taylor  <iant@google.com>
7055
7056         PR 11108
7057         * symtab.h (class Symbol): Remove fields is_target_special_ and
7058         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7059         (Symbol::is_defined_in_discarded_section): New function.
7060         (Symbol::set_is_defined_in_discarded_section): New function.
7061         (Symbol::has_plt_offset): Rewrite.
7062         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7063         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7064         Don't initialize is_target_special_ or has_plt_offset_.
7065         Initialize is_defined_in_discarded_section_.
7066         (Symbol_table::add_from_relobj): If appropriate, set
7067         is_defined_in_discarded_section.
7068         * resolve.cc (Symbol::override_base_with_special): Don't test
7069         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7070         * target-reloc.h (relocate_section): Do special handling for
7071         symbols defined in discarded sections for global symbols as well
7072         as local symbols.
7073
7074 2010-01-08  Ian Lance Taylor  <iant@google.com>
7075
7076         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7077         the SHT_SYMTAB case.
7078
7079 2010-01-08  Ian Lance Taylor  <iant@google.com>
7080
7081         * object.cc (Sized_relobj::do_layout): Don't get confused if
7082         layout_eh_frame returns NULL.
7083
7084 2010-01-08  Ian Lance Taylor  <iant@google.com>
7085
7086         PR 11084
7087         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7088         dynamic symbol table, use the normal symbol table.
7089         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7090         symbol table.
7091
7092 2010-01-08  Ian Lance Taylor  <iant@google.com>
7093
7094         PR 11072
7095         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7096         sections.
7097
7098 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7099
7100         * version.cc (print_version): Change to "Copyright 2010".
7101
7102 2010-01-08  Ian Lance Taylor  <iant@google.com>
7103
7104         PR 10287
7105         PR 11063
7106         * i386.cc (class Target_i386): Change return type of plt_section
7107         to be non-const.
7108         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7109         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7110         tls_desc_rel_ field.
7111         (Output_data_plt_i386::rel_tls_desc): New function.
7112         (Target_i386::rel_tls_desc_section): New function.
7113         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7114         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7115         R_386_TLS_DESC reloc in rel_tls_desc_section.
7116         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7117         Define struct Tlsdesc_info.
7118         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7119         (Target_x86_64::do_reloc_symbol_index): New function.
7120         (Target_x86_64::add_tlsdesc_info): New function.
7121         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7122         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7123         tlsdesc_rel_ field.
7124         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7125         all callers.
7126         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7127         (Target_x86_64::rela_tlsdesc_section): New function.
7128         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7129         handling.
7130         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7131         (Target_x86_64::do_reloc_addend): New function.
7132         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7133         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7134         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7135         (Output_reloc::type): New function.
7136         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7137         (Output_reloc::is_target_specific): New function.
7138         (Output_reloc::target_arg): New function.
7139         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7140         absolute relocs and target specific relocs.
7141         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7142         add_target_specific.
7143         (class Output_data_reloc) [SHT_RELA]: Likewise.
7144         * output.cc (Output_reloc::Output_reloc): Add four new versions
7145         for absolute relocs and target specific relocs.
7146         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7147         (Output_reloc::get_symbol_index): Likewise.
7148         (Output_reloc::local_section_offset): Check that local_sym_index_
7149         is not TARGET_CODE or 0.
7150         (Output_reloc::symbol_value): Likewise.
7151         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7152         reloc.
7153         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7154         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7155         functions.
7156         * layout.cc (add_target_dynamic_tags): Use output section for
7157         DT_PLTRELSZ and DT_JMPREL.
7158
7159 2010-01-07  Ian Lance Taylor  <iant@google.com>
7160
7161         PR 11061
7162         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7163         function.
7164         (class Output_data_reloc_generic): Define.
7165         (class Output_data_reloc_base): Change base class to
7166         Output_data_reloc_generic.  Change add() method to call
7167         bump_relative_reloc_count for a relative reloc.  Remove
7168         sort_relocs_ field.
7169         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7170         to sort_relocs().
7171         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7172         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7173         appropriate.
7174         * layout.h (class Layout): Update declaration.
7175
7176 2010-01-07  Ian Lance Taylor  <iant@google.com>
7177
7178         * output.h (class Output_data): Add const version of
7179         output_section and do_output_section.
7180         (class Output_section_data): Add const version of
7181         do_output_section.
7182         (class Output_section): Likewise.
7183         * layout.cc (Layout::add_target_dynamic_tags): New function.
7184         * layout.h (class Layout): Update declarations.
7185         * arm.cc (Target_arm::do_finalize_sections): Use
7186         add_target_dynamic_tags.
7187         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7188         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7189         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7190         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7191
7192 2010-01-07  Ian Lance Taylor  <iant@google.com>
7193
7194         PR 11042
7195         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7196         object as needed.
7197
7198 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7199             Ian Lance Taylor  <iant@google.com>
7200
7201         PR 11019
7202         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7203         Xindex::read_symtab_xindex.
7204
7205 2010-01-07  Doug Kwan  <dougkwan@google.com>
7206
7207         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7208         (Insn_template::thumb16_bcond_insn): New method declaration.
7209         (Insn_template): Fix spelling.
7210         (Stub::thumb16_special): New method declaration.
7211         (Stub::do_write): Define virtual method which was previously pure
7212         virtual.
7213         (Stub::do_thumb16_special): New method declaration.
7214         (Stub::do_fixed_endian_write): New template member.
7215         (Reloc_stub::do_write): Remove.
7216         (Reloc_stub::do_fixed_endian_write): Remove.
7217         (Cortex_a8_stub): New class definition.
7218         (Stub_factory::make_cortex_a8_stub): New method definition.
7219         (Stub_factory::Stub_factory): Add missing static storage class
7220         qualifier for elf32_arm_stub_a8_veneer_blx.
7221
7222 2010-01-07  Ian Lance Taylor  <iant@google.com>
7223
7224         PR 10980
7225         * options.h (class General_options): Add --warn-unresolved-symbols
7226         and --error-unresolved-symbols.
7227         * errors.cc (Errors::undefined_symbol): Implement
7228         --warn-unresolved-symbols.
7229
7230         * options.h (class General_options): Add -z text and -z textoff.
7231         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7232
7233 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7234
7235         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7236         (Garbage_collection::cident_sections): New function.
7237         (Garbage_collection::add_cident_section): New function.
7238         (Garbage_collection::cident_sections_): New member.
7239         (gc_process_relocs): Add references to sections whose names are C
7240         identifiers.
7241         * gold.h (cident_section_start_prefix): New constant.
7242         (cident_section_stop_prefix): New constant.
7243         (is_cident): New function.
7244         * layout.cc (Layout::define_section_symbols): Replace string constants
7245         with the newly defined constants.
7246         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7247         C identifiers.
7248         * testsuite/Makefile.am: Add gc_orphan_section_test.
7249         * testsuite/Makefile.in: Regenerate.
7250         * testsuite/gc_orphan_section_test.cc: New file.
7251         * testsuite/gc_orphan_section_test.sh: New file.
7252
7253 2010-01-06  Ian Lance Taylor  <iant@google.com>
7254
7255         PR 10980
7256         * options.h (class General_options): Add --warn-shared-textrel.
7257         * layout.cc (Layout::finish_dynamic_section): Implement
7258         --warn-shared-textrel.
7259
7260         PR 10980
7261         * options.h (class General_options): Add --warn-multiple-gp.
7262
7263 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7264
7265         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7266         $(THREADSLIB) and $(LIBDL).
7267         * Makefile.in: Rebuild.
7268
7269 2010-01-06  Ian Lance Taylor  <iant@google.com>
7270
7271         PR 10980
7272         * options.cc (General_options::parse_section_start): New function.
7273         (General_options::section_start): New function.
7274         (General_options::General_options): Initialize all members.
7275         * options.h: Include <map>
7276         (class General_options): Add --section-start.  Add section_starts_
7277         member.
7278         * layout.cc (Layout::attach_allocated_section_to_segment): If
7279         --section-start was used, set the address of the segment.  Remove
7280         local sort_sections.
7281         (Layout::relaxation_loop_body): If the address of the load segment
7282         has been set by --section-start, don't use it.
7283         * output.h (Output_segment::update_flags_for_output_section): New
7284         function.
7285         * output.cc (Output_segment::add_output_section): Call
7286         update_flags_for_output_section.
7287
7288 2010-01-05  Ian Lance Taylor  <iant@google.com>
7289
7290         PR 10980
7291         * options.h (class General_options): Add --undefined-version.
7292         * script.cc (struct Version_expression): Add was_matched_by_symbol
7293         field.
7294         (Version_script_info::matched_symbol): New function.
7295         (Version_script_info::get_symbol_version_helper): Call
7296         matched_symbol.
7297         (Version_script_info::check_unmatched_names): New function.
7298         * script.h (class Version_script_info): Update declarations.
7299         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7300
7301         * options.h (class General_options): Use DEFINE_bool_alias for
7302         allow_multiple_definition.
7303         * resolve.cc (Symbol_table::should_override): Don't test
7304         allow_multiple_definition.
7305
7306         PR 10980
7307         * options.h (class General_options): Add --cref.
7308         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7309         until after printing cref table.
7310         * cref.cc: Include "symtab.h".
7311         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7312         (Cref_table_compare::operator()): New function.
7313         (Cref_inputs::gather_cref): New function.
7314         (filecol): New static const.
7315         (Cref_inputs::print_cref): New function.
7316         (Cref::print_cref): New function.
7317         * cref.h: Include <cstdio>.
7318         (class Cref): Update declarations.
7319         * mapfile.h (Mapfile::file): New function.
7320         * object.h (class Object): Define Symbols.  Declare virtual
7321         do_get_global_symbols.
7322         (Object::get_global_symbols): New function.
7323         * object.cc (Input_objects::add_object): Pass object to cref_ if
7324         --cref.
7325         (Input_objects::archive_start): Likewise.
7326         (Input_objects::archive_stop): Likewise.
7327         (Input_objects::print_cref): New function.
7328         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7329         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7330         --cref.
7331         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7332         function.
7333         * plugin.h (class Sized_pluginobj): Update declarations.
7334
7335 2010-01-05  Ian Lance Taylor  <iant@google.com>
7336
7337         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7338         to is_default_version.  Rename insdef to insdefault.
7339         (Symbol_table::add_from_relobj): Rename def to is_default_version
7340         and local to is_forced_local.
7341         (Symbol_table::add_from_pluginobj): Likewise.
7342         (Symbol_table::add_from_dynobj): Likewise.
7343         (Symbol_table::define_special_symbol): Rename insdef to
7344         insdefault.
7345
7346 2010-01-04  Ian Lance Taylor  <iant@google.com>
7347
7348         PR 10980
7349         * options.h (class General_options): Add
7350         --allow-multiple-definition and -z muldefs.
7351         * resolve.cc (Symbol_table::should_override): Don't warn about a
7352         multiple symbol definition if --allow-multiple-definition or -z
7353         muldefs.
7354
7355         PR 10980
7356         * options.h (class General_options): Add --add-needed and
7357         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7358         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7359         error if --copy-dt-needed-entries aka --add-needed is used and
7360         would cause a change in behaviour.
7361
7362         PR 10980
7363         * options.h (class General_options): Add -G as a short version of
7364         --shared.  Add no-op options -assert, -g, and -i.
7365
7366 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7367
7368         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7369         check for .text or .gnu.linkonce.t sections.
7370         * icf.cc (Icf::find_identical_sections): Ditto.
7371         Change the detection for mangled function name within the section
7372         name.
7373         * icf.h (is_section_foldable_candidate): New function.
7374
7375 2009-12-30  Ian Lance Taylor  <iant@google.com>
7376
7377         PR 10980
7378         * options.h (class General_options): Permit two dashes with
7379         --retain-symbols-file.
7380
7381 2009-12-30  Ian Lance Taylor  <iant@google.com>
7382
7383         PR 10979
7384         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7385         don't put the file header and segment headers in the text
7386         segment.
7387
7388         PR 10979
7389         * common.cc (Sort_commons::operator()): Stabilize sort when both
7390         entries are NULL.
7391         (Symbol_table::do_allocate_commons_list): When allocating common
7392         symbols, skip a symbol which is no longer common.
7393         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7394         an object before checking its type.
7395         * testsuite/common_test_2.c: New file.
7396         * testsuite/common_test_3.c: New file.
7397         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7398         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7399         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7400         (common_test_2_pic.o, common_test_2.so): New targets.
7401         (common_test_3_pic.o, common_test_3.so): New targets.
7402         * testsuite/Makefile.in: Rebuild.
7403
7404         PR 10979
7405         * script.cc (read_input_script): If we see a new SECTIONS clause,
7406         and we have added an input section, give an error.
7407         * layout.h (class Layout): Add have_added_input_section function.
7408         Add have_added_input_section_ field.
7409         * layout.cc (Layout::Layout): Initialize
7410         have_added_input_section_.
7411         (Layout::layout): Set have_added_input_section_.
7412         (Layout::layout_eh_frame): Likewise.
7413
7414 2009-12-30  Ian Lance Taylor  <iant@google.com>
7415
7416         PR 10931
7417         * options.h (class General_options): Add --sort-common option.
7418         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7419         * common.cc (Sort_common): Add sort_order parameter to
7420         constructor.  Add sort_order_ field.
7421         (Sort_commons::operator): Check sort_order_.
7422         (Symbol_table::allocate_commons): Determine the sort order.
7423         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7424         Change all callers.
7425         (Symbol_table::do_allocate_commons_list): Likewise.
7426
7427 2009-12-30  Ian Lance Taylor  <iant@google.com>
7428
7429         PR 10916
7430         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7431         symbols from this object, don't change the visibility of an
7432         undefined symbol.
7433         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7434
7435 2009-12-30  Ian Lance Taylor  <iant@google.com>
7436
7437         PR 10861
7438         * script.h (class Version_script_info): Define Language enum.
7439         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7440         new fields globals_, locals_, and is_finalized_.
7441         * script.cc: Various formatting fixes.
7442         (class Parser_closure): Change language_stack_ from a vector of
7443         std::string to one of Version_script_info::Language.  Adjust all
7444         uses accordingly.
7445         (class Lazy_demangler): Remove.
7446         (struct Version_expression): Change language from std::string to
7447         Version_script_info::Language.
7448         (Version_script_info::Version_script_info): New function.
7449         (Version_script_info::~Version_script_info): Don't call clear.
7450         (Version_script_info::finalize): New function.
7451         (Version_script_info::build_lookup_tables): New function.
7452         (Version_script_info::build_expression_list_lookup): New
7453         function.
7454         (Version_script_info::get_symbol_version_helper): Rewrite to use
7455         lookup tables.
7456         (Version_script_info::print_expression_list): Adjust to use
7457         Version_script_info::Language.
7458         (script_push_lex_into_version_mode): Check that the version script
7459         has not been finalized.
7460         (version_script_push_lang): Change language string to
7461         Version_script_info::Language.
7462         * options.cc (Command_line::version_script): New function.
7463         * options.h (class General_options): Add finalize_dynamic_list
7464         function.  Change version_script from declaration to definition.
7465         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7466         * testsuite/version_script.map: Remove duplicate def of foo.
7467         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7468         version_script.map.
7469         * testsuite/Makefile.in: Rebuild.
7470
7471 2009-12-30  Ian Lance Taylor  <iant@google.com>
7472
7473         PR 10843
7474         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7475         if the input symbol index is 0, make the output symbol index 0.
7476
7477 2009-12-30  Ian Lance Taylor  <iant@google.com>
7478
7479         PR 10670
7480         * options.h (class General_options): Add -x/--discard-all.
7481         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7482         --discard-all.  If the local symbol needs a dynamic entry, check
7483         that before handling --discard-locals.
7484
7485 2009-12-30  Ian Lance Taylor  <iant@google.com>
7486
7487         PR 10450
7488         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7489         flags to PF_R.
7490         (Output_segment::add_output_section): Don't change the flags if
7491         the type is PT_TLS.
7492
7493         PR 10450
7494         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7495         GNU hash table if they need a dynamic value.  Otherwise, don't add
7496         them if they are defined in a dynamic object or are forced local.
7497
7498 2009-12-29  Ian Lance Taylor  <iant@google.com>
7499
7500         PR 10450
7501         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7502         .gnu.hash table for a 32-bit target.
7503
7504         PR 10450
7505         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7506         regular and a dynamic object only needs a dynamic symbol table
7507         entry if it is externally visible.
7508
7509         PR 10450
7510         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7511         constructor.  Add global_offset_table_ field.
7512         (Target_i386::got_section): Set global_offset_table_.
7513         (Target_i386::do_finalize_sections): Set global_offset_table_
7514         size.
7515         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7516         in constructor.  Add global_offset_table_ field.
7517         (Target_x86_64::got_section): Set global_offset_table_.
7518         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7519         size.
7520
7521         * layout.cc (Layout::Layout): Initialize increase_relro_.
7522         (Layout::get_output_section): Add is_relro, is_last_relro, and
7523         is_first_non_relro parameters.  Change all callers.
7524         (Layout::choose_output_section): Likewise.
7525         (Layout::add_output_section_data): Likewise.
7526         (Layout::make_output_section): Likewise.
7527         (Layout::set_segment_offsets): Clear increase_relro when using a
7528         linker script.
7529         * layout.h (class Layout): Add increase_relro method.  Add
7530         increase_relro_ field.  Update declarations.
7531         * output.cc (Output_section::Output_section): Initialize
7532         is_last_relro_ and is_first_non_relro_.
7533         (Output_segment::add_output_section): Group relro sections is
7534         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7535         (Output_segment::maximum_alignment): Remove relro handling.
7536         (Output_segment::set_section_addresses): Add increase_relro
7537         parameter.  Change all callers.  Add initial alignment to align
7538         relro sections on separate page.  Remove old relro handling.
7539         (Output_segment::set_section_list_addresses): Remove in_relro
7540         parameter.  Change all callers.
7541         (Output_segment::set_offset): Add increase parameter.  Change all
7542         callers.  Remove old relro handling.
7543         * output.h (class Output_section): Add new methods: is_last_relro,
7544         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7545         Add is_last_relro_ and is_first_non_relro_ fields.
7546         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7547         Create separate .got.plt section.  Call increase_relro.
7548         * x86_64.cc (Target_x86_64::got_section): Likewise.
7549         * testsuite/relro_script_test.t: Add .got.plt.
7550
7551         PR 10450
7552         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7553         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7554         (Layout::finalize): Call set_dynamic_symbol_size.
7555         (Layout::set_dynamic_symbol_size): New function.
7556         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7557         set_dynamic_symbol_size.
7558
7559         PR 10450
7560         * output.h (class Output_section): Add is_entsize_zero_ field.
7561         * output.cc (Output_section::Output_section): Initialize
7562         is_entsize_zero_.
7563         (Output_section::set_entsize): If two different entsizes are
7564         requested, force it to zero.
7565         (Output_section::add_input_section): Set flags for .debug_str
7566         before updating section flags.  Set entsize.
7567         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7568         and SHF_STRING if all input sections have those flags.
7569
7570 2009-12-29   Rafael Espindola  <espindola@google.com>
7571
7572         * main.cc (main): Fix the sys time reporting.
7573         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7574         reporting.
7575
7576 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7577
7578         * options.cc (General_options::parse_version): Allow -v to exit
7579         without an error if there is nothing to link.
7580
7581 2009-12-29  Ian Lance Taylor  <iant@google.com>
7582
7583         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7584         using a version of gcc before 4.1.
7585         * configure: Rebuild.
7586
7587 2009-12-28  Chris Demetriou  <cgd@google.com>
7588
7589         * attributes.cc (Output_attributes_section_data::do_write): Use
7590         std::vector::front rather than std::vector::data.
7591
7592 2009-12-28  Ian Lance Taylor  <iant@google.com>
7593
7594         * symtab.h (class Symbol_table): Add enum Defined.
7595         * resolve.cc (Symbol_table::should_override): Add defined
7596         parameter.  Change all callers.  Test whether object is NULL
7597         before calling a method on it.
7598         (Symbol_table::report_resolve_problem): Add defined parameter.
7599         Change all callers.
7600         (Symbol_table::should_override_with_special): Likewise.
7601         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7602         parameter.  Change all callers.
7603         (Symbol_table::do_define_in_output_data): Likewise.
7604         (Symbol_table::define_in_output_segment): Likewise.
7605         (Symbol_table::do_define_in_output_segment): Likewise.
7606         (Symbol_table::define_as_constant): Likewise.
7607         (Symbol_table::do_define_as_constant): Likewise.
7608         * script.h (class Symbol_assignment): Add is_defsym parameter to
7609         constructor; change all callers.
7610         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7611         parameter.  Change all callers.  Add is_defsym_ field.
7612         (class Parser_closure): Add parsing_defsym parameter to
7613         constructor; change all callers.  Add parsing_defsym accessor
7614         function.  Add parsing_defsym_ field.
7615
7616 2009-12-28  Ian Lance Taylor  <iant@google.com>
7617
7618         * gold.cc (queue_middle_tasks): Fix formatting.
7619         * object.cc (Relobj::is_section_name_included): Likewise.
7620
7621 2009-12-23  Ian Lance Taylor  <iant@google.com>
7622
7623         * i386.cc (Target_i386::do_calls_non_split): Recognize
7624         -fsplit-stack prologue for a function with a static chain.
7625         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7626         -fsplit-stack prologue when using %r11.
7627
7628 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7629
7630         * options.cc (General_options::parse_version): Make -v continue and do
7631         the link like GNU ld does.
7632
7633 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7634
7635         * Makefile.am (CCFILES): Add timer.cc.
7636         (HFILES): Add timer.h.
7637         * configure.ac: Check for sysconf and times.
7638         * main.cc: include timer.h.
7639         (main): Use Timer instead of get_run_time.
7640         * timer.cc: New.
7641         * timer.h: New.
7642         * workqueue.cc: include timer.h.
7643         (Workqueue::find_and_run_task):
7644         Report user, sys and wall time.
7645         * Makefile.in: Regenerate.
7646         * config.in: Regenerate.
7647         * configure: Regenerate.
7648
7649 2009-12-16  Doug Kwan  <dougkwan@google.com>
7650
7651         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7652         sections.
7653         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7654         relaxed input sections.
7655         * output.cc (Output_section::find_relaxed_input_section): Change
7656         return type to Output_relaxed_input_section pointer.  Adjust code
7657         for new type of relaxed_input_section_map_.
7658         * output.h (Output_section::find_relaxed_input_section): Change
7659         return type to Output_relaxed_input_section pointer.
7660         (Output_section::Output_relaxed_input_section_by_input_section_map):
7661         New type.
7662         (Output_section::relaxed_input_section_map_): Change type to
7663         Output_section::Output_relaxed_input_section_by_input_section_map.
7664         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7665         input section.
7666
7667 2009-12-15  Ian Lance Taylor  <iant@google.com>
7668
7669         * layout.cc (Layout::create_shstrtab): Only write out after input
7670         sections if we are compressing debug sections.
7671
7672 2009-12-15  Ian Lance Taylor  <iant@google.com>
7673
7674         * archive.cc (Archive::add_symbols): Only look up a symbol without
7675         a version if there is, in fact, a version.
7676
7677 2009-12-14  Ian Lance Taylor  <iant@google.com>
7678
7679         Revert -Wshadow changes, all changes from:
7680         2009-12-11  Doug Kwan  <dougkwan@google.com>
7681         2009-12-11  Nick Clifton  <nickc@redhat.com>
7682         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7683
7684 2009-12-11  Doug Kwan  <dougkwan@google.com>
7685
7686         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7687         due to -Wshadow.
7688         * attributes.cc (Object_attribute::size): Ditto.
7689         (Attributes_section_data::size): Ditto.
7690         (Attributes_section_data::Attributes_section_data): Ditto.
7691         (Output_attributes_section_data::do_write): Ditto.
7692         * attributes.h (Object_attribute::set_type): Ditto.
7693         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7694
7695 2009-12-11  Nick Clifton  <nickc@redhat.com>
7696
7697         * archive.cc: Fix shadowed variable warnings.
7698         * arm.cc: Likewise.
7699         * compressed_output.cc: Likewise.
7700         * compressed_output.h: Likewise.
7701         * configure: Likewise.
7702         * dwarf_reader.cc: Likewise.
7703         * dynobj.cc: Likewise.
7704         * dynobj.h: Likewise.
7705         * ehframe.cc: Likewise.
7706         * ehframe.h: Likewise.
7707         * errors.cc: Likewise.
7708         * expression.cc: Likewise.
7709         * fileread.cc: Likewise.
7710         * fileread.h: Likewise.
7711         * freebsd.h: Likewise.
7712         * i386.cc: Likewise.
7713         * icf.cc: Likewise.
7714         * incremental.h: Likewise.
7715         * layout.cc: Likewise.
7716         * layout.h: Likewise.
7717         * mapfile.cc: Likewise.
7718         * merge.cc: Likewise.
7719         * merge.h: Likewise.
7720         * object.cc: Likewise.
7721         * object.h: Likewise.
7722         * options.h: Likewise.
7723         * output.cc: Likewise.
7724         * output.h: Likewise.
7725         * parameters.cc: Likewise.
7726         * plugin.cc: Likewise.
7727         * powerpc.cc: Likewise.
7728         * reduced_debug_output.cc: Likewise.
7729         * reduced_debug_output.h: Likewise.
7730         * reloc.cc: Likewise.
7731         * reloc.h: Likewise.
7732         * resolve.cc: Likewise.
7733         * script-sections.cc: Likewise.
7734         * script.cc: Likewise.
7735         * script.h: Likewise.
7736         * sparc.cc: Likewise.
7737         * symtab.cc: Likewise.
7738         * symtab.h: Likewise.
7739         * target-select.cc: Likewise.
7740         * target-select.h: Likewise.
7741         * token.h: Likewise.
7742         * workqueue.cc: Likewise.
7743         * workqueue.h: Likewise.
7744         * x86_64.cc: Likewise.
7745
7746 2009-12-10  Doug Kwan  <dougkwan@google.com>
7747
7748         * arm.cc (attributes.h): New include.
7749         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7750         (Arm_relobj::~Arm_relobj): Delete object pointed by
7751         attributes_section_data_.
7752         (Arm_relobj::attributes_section_data): New method definition.
7753         (Arm_relobj::attributes_section_data_): New data member declaration.
7754         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7755         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7756         attributes_section_data_.
7757         (Arm_dynobj::attributes_section_data): New method definition.
7758         (Arm_dynobj::attributes_section_data_): New data member declaration.
7759         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7760         initialization value of may_use_blx_ to false.
7761         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7762         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7763         object attributes to compute results instead of hard-coding.
7764         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7765         Target_arm::get_secondary_compatible_arch,
7766         Target_arm::set_secondary_compatible_arch
7767         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7768         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7769         New method declarations.
7770         (Target_arm::get_aeabi_object_attribute): New method definition.
7771         (Target_arm::attributes_section_data_): New data member declaration.
7772         (read_arm_attributes_section): New template definition.
7773         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7774         (Arm_dynobj::do_read_symbols): Ditto.
7775         (Target_arm::do_finalize_sections): Merge attributes sections from
7776         input.  Check for BLX use after attributes section merging.
7777         Fix __exidx_start and __exidx_end visibility.  Create an
7778         .ARM.attributes section if necessary.
7779         (Target_arm::get_secondary_compatible_arch,
7780         Target_arm::set_secondary_compatible_arch,
7781         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7782         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7783         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7784         New method definitions.
7785
7786 2009-12-09  Ian Lance Taylor  <iant@google.com>
7787
7788         * plugin.cc (Plugin::load): Don't cast from void* to a function
7789         pointer.
7790
7791 2009-12-09  Ian Lance Taylor  <iant@google.com>
7792
7793         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7794         information fields.
7795
7796 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7797
7798         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7799         Replace two_file_shared_1.so with two_file_shared_2.so.
7800         * testsuite/Makefile.in: Regenerated.
7801
7802 2009-12-08  Doug Kwan  <dougkwan@google.com>
7803
7804         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7805         (HFILES): Add attributes.h and int_encoding.h.
7806         * Makefile.in: Regenerate.
7807         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7808         function definitions to int_encoding.cc
7809         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7810         prototypes to int_encoding.h
7811         * reduced_debug_output.cc (int_encoding.h): New include.
7812         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7813         function definitions to int_encoding.cc
7814         (insert_into_vector, read_from_pointer): Move template definitions to
7815         int_encoding.h
7816         * attributes.cc: New file.
7817         * attributes.h: New file.
7818         * int_encoding.cc: New file.
7819         * int_encoding.h: New file.
7820
7821 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7822
7823         PR gold/11055
7824         * incremental-dump.cc (dump_incremental_inputs): New.
7825         (main): Use dump_incremental_inputs.
7826
7827 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7828
7829         PR gold/10893
7830         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7831         checking elfcpp::STT_FUNC.
7832         (Target_i386::Relocate::relocate): Likewise.
7833         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7834
7835         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7836         symbols from shared libraries into normal FUNC symbols.
7837
7838         * symtab.h (Symbol): Add is_func and use it.
7839
7840 2009-12-05  Doug Kwan  <dougkwan@google.com>
7841
7842         * arm.cc (Target_arm::arm_info): Initialize new fields
7843         attributes_section and attributes_vendor.
7844         * i386.cc (Target_i386::i386_info): Same.
7845         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7846         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7847         fields attributes_section and attributes_vendor.
7848         * sparc.cc (Target_sparc::sparc_info): Same.
7849         * target.h (Target::attributes_section, Target::attributes_vendor,
7850         Target::is_attributes_section, Target::attribute_arg_type,
7851         Target::attributes_order): New method definitions.
7852         (Target::Target_info::attributes_section,
7853         Target::Target_info::attributes_vendor): New fields.
7854         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7855         virtual method definitions.
7856         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7857         attributes_section and attributes_vendor.
7858         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7859
7860 2009-12-05  Doug Kwan  <dougkwan@google.com>
7861
7862         * arm.cc: Update comments about interworking and stub generation.
7863         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7864         considered as non-PIC.
7865         (Arm_relocate_functions::base_abs): Fix formatting.
7866         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7867         of function to use GOT entry address instead of offset.
7868         (Target_arm::Scan::global): Issue an error if a symbol would need a
7869         PLT does not get one because it is untyped.  Remove code to create
7870         dynamic symbols for relative branches.
7871         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7872         takes unsigned integer instead of boolean.
7873
7874 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7875
7876         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7877         (two_file_test_LDADD): Likewise.
7878         (common_test_1_LDADD): Likewise.
7879         (exception_test_LDADD) Likewise.
7880         (weak_test_LDADD): Likewise.
7881         (many_sections_test_LDADD): Likewise.
7882         (initpri1_LDADD): Likewise.
7883         (script_test_1_LDADD): Likewise.
7884         (script_test_2_LDADD): Likewise.
7885         (justsyms_LDADD): Likewise.
7886         (binary_test_LDADD): Likewise.
7887         (large_LDADD): Likewise.
7888         * testsuite/Makefile.in: Regenerated.
7889
7890 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7891
7892         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7893         (Symbol_table::override_with_special): Likewise.
7894         (Symbol_table::add_from_object): Likewise.
7895
7896 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7897
7898         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7899         Don't set the data_offset twice.
7900
7901 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7902
7903         * testsuite/Makefile.in: Regenerate.
7904
7905 2009-12-03  Doug Kwan  <dougkwan@google.com>
7906
7907         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7908         (Target_arm::do_finalize_sections): Add parameter for symbol table
7909         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7910         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7911         parameter for symbol table pointer.
7912         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7913         an additional parameter for a pointer to symbol table.
7914         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7915         parameter for a symbol table pointer.
7916         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7917         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7918         Ditto.
7919         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7920         parameter for a symbol table pointer.
7921
7922 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7923
7924         * incremental.cc (Incremental_inputs_header)
7925         (Incremental_inputs_header_write, Incremental_inputs_entry)
7926         (Incremental_inputs_entry_write): Move ...
7927         * incremental.h (Incremental_inputs_header)
7928         (Incremental_inputs_header_write, Incremental_inputs_entry)
7929         (Incremental_inputs_entry_write): here.
7930
7931 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7932
7933         * incremental.cc (make_sized_incremental_binary): Set the target.
7934         Error if it is incompatible.
7935         * output.h (Output_file): Add filename method.
7936
7937 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7938
7939         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7940         from the get_* methods.
7941
7942 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7943
7944         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7945         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7946         Write 0 for the data_offset of scripts.
7947
7948 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7949
7950         * testsuite/Makefile.am: Add the incremental_test.sh test.
7951         * testsuite/incremental_test.sh: New.
7952         * testsuite/incremental_test_1.c: New.
7953         * testsuite/incremental_test_2.c: New.
7954
7955 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7956
7957        * incremental-dump.cc (main): Fix typos.
7958
7959 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7960
7961         PR gold/11025
7962         * incremental-dump.cc (main): Use llu to print 64 bit values.
7963
7964 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7965             H.J. Lu  <hongjiu.lu@intel.com>
7966
7967         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7968         $(LIBDL).
7969         (incremental_dump_LDADD): Likewise.
7970         * Makefile.in: Regenerated.
7971
7972 2009-11-25  Doug Kwan  <dougkwan@google.com>
7973
7974         Revert:
7975
7976         2009-11-25  Doug Kwan  <dougkwan@google.com>
7977
7978                 * arm.cc (Target_arm::Target_arm): Move method definition
7979                 outside of class definition.  Add code to handle
7980                 --target1-rel, --target1-abs and --target2= options.
7981                 (Target_arm::get_reloc_reloc_type): Change method to be
7982                 non-static and const.
7983                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7984                 New data member declaration.
7985                 (Target_arm::Scan::local, Target_arm::Scan::global,
7986                 Target_arm::Relocate::relocate,
7987                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7988                 Adjust call to Target_arm::get_real_reloc_type.
7989                 (Target_arm::get_real_reloc_type): Use command line options
7990                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7991                 * options.h (--target1-rel, --target1-abs, --target2): New
7992                 ARM-only options.
7993
7994 2009-11-25  Doug Kwan  <dougkwan@google.com>
7995
7996         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7997         class definition.  Add code to handle --target1-rel, --target1-abs
7998         and --target2= options.
7999         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8000         and const.
8001         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8002         member declaration.
8003         (Target_arm::Scan::local, Target_arm::Scan::global,
8004         Target_arm::Relocate::relocate,
8005         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8006         call to Target_arm::get_real_reloc_type.
8007         (Target_arm::get_real_reloc_type): Use command line options to
8008         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8009         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8010         options.
8011
8012 2009-11-25  Doug Kwan  <dougkwan@google.com>
8013
8014         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8015         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8016         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8017         formatting.
8018         (Arm_relocate_functions::thm_call): Replace body with a call to
8019         Arm_relocate_functions::thumb_branch_common.
8020         (Arm_relocate_functions::thm_jump24,
8021         Arm_relocate_functions::thm_xpc22): New method definitions.
8022         (Arm_relocate_functions::thumb_branch_common): New method definition.
8023         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8024         operator.
8025         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8026         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8027
8028 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8029
8030         * Makefile.am: Build incremental-dump
8031         * Makefile.in: Regenerate.
8032         * incremental-dump.cc: New.
8033         * incremental.cc (Incremental_inputs_header_data,
8034         Incremental_inputs_entry_data): Move to incremental.h
8035         * incremental.h: (Incremental_inputs_header_data,
8036         Incremental_inputs_entry_data): Move from incremental.cc
8037
8038 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8039
8040         * incremental.cc (Incremental_inputs_header,
8041         Incremental_inputs_header_write, Incremental_inputs_entry,
8042         Incremental_inputs_entry_write): Add a typedef with the data type.
8043
8044 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8045
8046         * incremental.cc (Incremental_inputs_header,
8047         Incremental_inputs_header_write, Incremental_inputs_entry,
8048         Incremental_inputs_entry_write): Update comment about which
8049         type has the filed descriptions.
8050
8051 2009-11-15  Doug Kwan  <dougkwan@google.com>
8052
8053         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8054         (Arm_relocate_functions::arm_branch_common): Change method defintion
8055         in class definition to a method declaration and update list of formal
8056         parameters.
8057         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8058         Arm_relocation_functions::jump24): Adjust call to
8059         Arm_relocate_functions::arm_branch_common.  Update list of formal
8060         parameters.
8061         (Arm_relocate_functions::xpc25): New method definition.
8062         (Arm_relocate_functions::arm_branch_common): Move method defintion
8063         out from class definition.  Use stubs for mode-switching and extending
8064         branch ranges.
8065         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8066         specially.  Change code to enable use of stubs in ARM branches.
8067
8068 2009-11-10  Doug Kwan  <dougkwan@google.com>
8069
8070         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8071         in method declaration.
8072         (Target_arm::relocate_stub): New method declaration.
8073         (Target_arm::default_target): Change to return a pointer instead of
8074         a const reference.
8075         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8076         Target_arm::default_target.
8077         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8078         method definition.
8079         (Target_arm::relocate_section): Adjust view.
8080         (Target_arm::relocate_stub): New method definition.
8081
8082 2009-11-10  Doug Kwan  <dougkwan@google.com>
8083
8084         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8085         a format warning.
8086         * incremental.cc (open_incremental_binary): Initialized local
8087         variables to avoid warnings.
8088         * object.cc (make_elf_object): Ditto.
8089         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8090         a format warning.
8091
8092 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8093
8094         PR gold/10930
8095         * testsuite/plugin_test.c: Include "config.h".
8096
8097 2009-11-09  Doug Kwan  <dougkwan@google.com>
8098
8099         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8100         (arm_symbol_value): Remove.
8101         (Arm_relocate_functions::arm_branch_common,
8102         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8103         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8104         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8105         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8106         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8107         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8108         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8109         Arm_relocate_functions::thm_mobw_abs_nc,
8110         Arm_relocate_functions::thm_mov_abs,
8111         Arm_relocate_functions::movw_prel_nc,
8112         Arm_relocate_functions::thm_movt_abs,
8113         Arm_relocate_functions::movt_prel,
8114         Arm_relocate_functions::thm_movw_prel_nc,
8115         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8116         (Target_arm::Relocate::relocate): Only decompose address into two
8117         parts if relocation type uses the thumb-bit and pass the actual
8118         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8119         calls to methods in Arm_relocate_functions for this change.
8120
8121 2009-11-08  Ian Lance Taylor  <iant@google.com>
8122
8123         PR 10925
8124         * reloc.cc: Instantiate
8125         Sized_relobj::initialize_input_to_output_maps and
8126         Sized_relobj:free_input_to_output_maps.
8127
8128 2009-11-06  Ian Lance Taylor  <iant@google.com>
8129
8130         PR 10876
8131         * defstd.cc (in_segment): Set only_if_ref true for "end".
8132
8133 2009-11-06  Doug Kwan  <dougkwan@google.com>
8134
8135         * arm.cc (class Reloc_stub): Correct a comment.
8136         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8137         (Target_arm::scan_section_for_stubs): New method declaration.
8138         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8139         Change methods from private to protected.
8140         (Target_arm::do_may_relax): New method definition.
8141         (Target_arm::do_relax, Target_arm::group_sections,
8142         Target_arm::scan_reloc_for_stub,
8143         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8144         (Target_arm::arm_input_section_map_): New data member declaration.
8145         (Target_arm::scan_reloc_for_stub,
8146         Target_arm::scan_reloc_section_for_stubs,
8147         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8148         Target_arm::do_relax): New method definitions.
8149
8150 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8151
8152         * configure.ac: Check for (struct stat)::st_mtim
8153         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8154         * config.in: Regenerate.
8155         * configure: Regenerate.
8156
8157 2009-11-05  Ian Lance Taylor  <iant@google.com>
8158
8159         PR 10910
8160         * output.cc (Output_segment::add_output_section): Add missing
8161         return statement.
8162
8163 2009-11-04  Ian Lance Taylor  <iant@google.com>
8164
8165         PR 10880
8166         * object.h (class Object): Add is_needed and set_is_needed
8167         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8168         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8169         defined in a dynamic object and referenced by a regular object,
8170         set is_needed for the dynamic object.
8171         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8172         if the file is marked with as_needed and it is not needed.
8173
8174 2009-11-04  Ian Lance Taylor  <iant@google.com>
8175
8176         PR 10887
8177         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8178         tags if data is discarded by linker script.
8179         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8180         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8181         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8182         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8183
8184 2009-11-04  Ian Lance Taylor  <iant@google.com>
8185
8186         * layout.cc (Layout::get_output_section): Add is_interp and
8187         is_dynamic_linker_section parameters.  Change all callers.
8188         (Layout::choose_output_section): Likewise.
8189         (Layout::make_output_section): Likewise.
8190         (Layout::add_output_section_data): Add is_dynamic_linker_section
8191         parameter.  Change all callers.
8192         * layout.h (class Layout): Update declarations.
8193         * output.h (class Output_section): Add is_interp, set_is_interp,
8194         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8195         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8196         generate_code_fills_at_write_ to a bitfield.
8197         * output.cc (Output_section::Output_sections): Initialize new
8198         fields.
8199         (Output_segment::add_output_section): Add do_sort parameter.
8200         Change all callers.
8201
8202 2009-11-03  Ian Lance Taylor  <iant@google.com>
8203
8204         PR 10860
8205         * options.h (class General_options): Add --warn-common.
8206         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8207         merging two common symbols.
8208         (Symbol_table::should_override): Handle --warn-common when merging
8209         a common symbol with a defined symbol.  Use report_resolve_problem
8210         for multiple definitions.
8211         (Symbol_table::report_resolve_problem): New function.
8212         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8213
8214 2009-11-03  Doug Kwan  <dougkwan@google.com>
8215
8216         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8217         stub_factory_.
8218         (Target_arm::stub_factory): New method definition.
8219         (Target_arm::new_arm_input_section,
8220         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8221         Target_arm::reloc_uses_thumb_bit): New method declarations.
8222         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8223         New type definitions.
8224         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8225         member declarations.
8226         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8227         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8228         New method definitions.
8229
8230 2009-11-03  Ian Lance Taylor  <iant@google.com>
8231
8232         * options.h (class General_options): Add --warn_constructors.
8233
8234 2009-11-03  Ian Lance Taylor  <iant@google.com>
8235
8236         PR 10893
8237         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8238         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8239
8240 2009-11-03  Ian Lance Taylor  <iant@google.com>
8241
8242         PR 10895
8243         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8244         --msgid-bugs-address.
8245         (install-pdf): New target.
8246         (install-data_yes): Look up one directory to find mkinstalldirs.
8247
8248 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8249
8250         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8251         tree.
8252
8253 2009-10-30  Doug Kwan  <dougkwan@google.com>
8254
8255         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8256
8257 2009-10-30  Doug Kwan  <dougkwan@google.com>
8258
8259         * arm.cc (Stub_addend_reader): New struct template definition
8260         and partial specializations.
8261         (Stub_addend_reader::operator()): New method definition for a
8262         partially specialized template.
8263
8264 2009-10-30  Doug Kwan  <dougkwan@google.com>
8265
8266         * arm.cc (Arm_relobj::processor_specific_flags): New method
8267         definition.
8268         (Arm_relobj::do_read_symbols): New method declaration.
8269         (Arm_relobj::processor_specific_flags_): New data member declaration.
8270         (Arm_dynobj): New class definition.
8271         (Target_arm::do_finalize_sections): Add input_objects parameter.
8272         (Target_arm::do_adjust_elf_header): New method declaration.
8273         (Target_arm::are_eabi_versions_compatible,
8274         (Target_arm::merge_processor_specific_flags): New method declaration.
8275         (Target_arm::do_make_elf_object): New overloaded method definitions
8276         and declaration.
8277         (Arm_relobj::do_read_symbols): New method definition.
8278         (Arm_dynobj::do_read_symbols): Ditto.
8279         (Target_arm::do_finalize_sections): Add input_objects parameters.
8280         Merge processor-specific flags from all input objects.
8281         (Target_arm::are_eabi_versions_compatible,
8282         Target_arm::merge_processor_specific_flags,
8283         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8284         New method definitions.
8285         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8286         Input_objects pointer type parameter.
8287         * layout.cc (Layout::finalize): Pass input objects to target's.
8288         finalize_sections function.
8289         * output.cc (Output_file_header::do_sized_write): Set ELF file
8290         header's processor-specific flags.
8291         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8292         Input_objects pointer type parameter.
8293         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8294         * target.h (Input_objects): New forward class declaration.
8295         (Target::processor_specific_flags,
8296         Target::are_processor_specific_flags_sect): New method definitions.
8297         (Target::finalize_sections): Add input_objects parameter.
8298         (Target::Target): Initialize processor_specific_flags_ and
8299         are_processor_specific_flags_set_.
8300         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8301         parameter.
8302         (Target::set_processor_specific_flags): New method definition.
8303         (Target::processor_specific_flags_,
8304         Target::are_processor_specific_flags_set_): New data member
8305         declarations.
8306         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8307         Input_objects pointer type parameter.
8308
8309 2009-10-30  Doug Kwan  <dougkwan@google.com>
8310
8311         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8312
8313 2009-10-28  Ian Lance Taylor  <iant@google.com>
8314
8315         * object.h (class Relobj): Drop options parameter from
8316         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8317         do_scan_relocs, do_relocate.  Change all callers.
8318         (class Sized_relobj): Drop options parameters from
8319         do_gc_process_relocs, do_scan_relocs, do_relocate,
8320         do_relocate_sections, relocate_sections, emit_relocs_scan,
8321         emit_relocs_scan_reltype.  Change all callers.
8322         (struct Relocate_info): Remove options field and all references to
8323         it.
8324         * reloc.h (class Read_relocs): Remove options constructor
8325         parameter and options_ field.  Change all callers.
8326         (class Gc_process_relocs, class Scan_relocs): Likewise.
8327         (class Relocate_task): Likewise.
8328         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8329         all callers.
8330         (scan_relocatable_relocs): Likewise.
8331         * target.h (class Sized_target): Remove options parameter from
8332         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8333         all callers.
8334         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8335         callers.
8336         * arm.cc: Update functions to remove options parameters.
8337         * i386.cc: Likewise.
8338         * powerpc.cc: Likewise.
8339         * sparc.cc: Likewise.
8340         * x86_64.cc: Likewise.
8341         * testsuite/testfile.cc: Likewise.
8342
8343 2009-10-28  Doug Kwan  <dougkwan@google.com>
8344
8345         * arm.cc (Arm_relobj): New class definition.
8346         (Arm_relobj::scan_sections_for_stubs,
8347         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8348         New method definitions.
8349
8350 2009-10-28  Cary Coutant  <ccoutant@google.com>
8351
8352         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8353         (Plugin::cleanup_done_): New member.
8354         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8355         (Plugin_manager::cleanup_done_): Remove.
8356         (Plugin_manager::add_input_file): Edit error message.
8357         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8358         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8359
8360 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8361
8362         * fileread.cc: (File_read::View::~View): Use the new
8363         data_ownership_ filed.
8364         (File_read::~File_read): Dispose the new whole_file_view_.
8365         (File_read::open): Mmap the whole file if needed.
8366         (File_read::open): Use whole_file_view_ instead of contents_.
8367         (File_read::find_view): Use whole_file_view_ if applicable.
8368         (File_read::do_read): Use whole_file_view_ instead of contents_.
8369         (File_read::make_view): Use whole_file_view_ instead of contents_,
8370         update File_read::View::View call.
8371         (File_read::find_or_make_view): Update File_read::View::View
8372         call.
8373         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8374         remove contents_
8375         (File_read::View::Data_ownership): New enum.
8376         (File_read::View::View): Replace bool mapped_ with Data_ownership
8377         argument.
8378         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8379         (File_read::View::data_ownership_): New field.
8380         (File_read::contents_): Remove (replaced by whole_file_view_).
8381         (File_read::whole_file_view_): New field.
8382         * options.h (class General_options): Add --keep-files-mapped.
8383
8384 2009-10-27  Cary Coutant  <ccoutant@google.com>
8385
8386         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8387         * testsuite/Makefile.am (plugin_test_5): New test case.
8388         * testsuite/Makefile.in: Regenerate.
8389
8390 2009-10-25  Doug Kwan  <dougkwan@google.com>
8391
8392         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8393         from private to protected to allow access by child class.
8394         (Sized_relobj::do_relocate_sections): New method declaration.
8395         (Sized_relobj::relocate_sections): Virtualize.
8396         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8397         Sized_relobj::relocate_sections.  Instantiate template explicitly
8398         for different target sizes and endianity.
8399
8400 2009-10-24  Doug Kwan  <dougkwan@google.com>
8401
8402         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8403         (Arm_input_section::as_arm_input_section): New method.
8404         (Arm_output_section): New class definition.
8405         (Arm_output_section::create_stub_group,
8406         Arm_output_section::group_sections): New method definitions.
8407
8408 2009-10-22  Doug Kwan  <dougkwan@google.com>
8409
8410         * arm.cc (Arm_input_section): New class definition.
8411         (Arm_input_section::init, Arm_input_section:do_write,
8412         Arm_input_section::set_final_data_size,
8413         Arm_input_section::do_reset_address_and_file_offset): New method
8414         definitions.
8415
8416 2009-10-21  Doug Kwan  <dougkwan@google.com>
8417
8418         * arm.cc (Stub_table, Arm_input_section): New forward class
8419         declarations.
8420         (Stub_table): New class defintion.
8421         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8422         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8423         New method definition.
8424
8425 2009-10-21  Doug Kwan  <dougkwan@google.com>
8426
8427         * arm.cc: Update copyright comments.
8428         (Target_arm): New forward class template declaration.
8429         (Arm_address): New type.
8430         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8431         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8432         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8433         constants.
8434         (Insn_template): Same.
8435         (DEF_STUBS): New macro.
8436         (Stub_type): New enum type.
8437         (Stub_template): New class definition.
8438         (Stub): Same.
8439         (Reloc_stub): Same.
8440         (Stub_factory): Same.
8441         (Target_arm::Target_arm): Initialize may_use_blx_ and
8442         should_force_pic_veneer_.
8443         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8444         Target_arm::should_force_pic_veneer,
8445         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8446         Target_arm::using_thumb_only, Target_arm:;default_target): New
8447         method defintions.
8448         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8449         New data member declarations.
8450         (Insn_template::size, Insn_template::alignment): New method defintions.
8451         (Stub_template::Stub_template): New method definition.
8452         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8453         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8454         (Stub_factory::Stub_factory): New method definition.
8455         * gold.h (string_hash): New template.
8456         * output.h (Input_section_specifier::hash_value): Use
8457         gold::string_hash.
8458         (Input_section_specifier::string_hash): Remove.
8459         * stringpool.cc (Stringpool_template::string_hash): Use
8460         gold::string_hash.
8461
8462 2009-10-20  Doug Kwan  <dougkwan@google.com>
8463
8464         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8465         symbols of relaxed input sections.
8466         * output.h (Output_section::find_relaxed_input_section): Make
8467         method public.
8468
8469 2009-10-16  Doug Kwan  <dougkwan@google.com>
8470
8471         * dynobj.cc (Versions::Versions): Initialize version_script_.
8472         Only insert base version symbol definition for a shared object
8473         if version script defines any version versions.
8474         (Versions::define_base_version): New method definition.
8475         (Versions::add_def): Check that base version is not needed.
8476         (Versions::add_need): Define base version lazily.
8477         * dynobj.h (Versions::define_base_version): New method declaration.
8478         (Versions::needs_base_version_): New data member declaration.
8479         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8480         (check_DATA): Add no_version_test.stdout.
8481         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8482         New make rules.
8483         * testsuite/Makefile.in: Regenerate.
8484         * testsuite/no_version_test.c: New file.
8485         * testsuite/no_version_test.sh: Ditto.
8486
8487 2009-10-16  Doug Kwan  <dougkwan@google.com>
8488
8489         * expression.cc (class Segment_start_expression): New class definition.
8490         (Segment_start_expression::value): New method definition.
8491         (script_exp_function_segment_start): Return a new
8492         Segment_start_expression.
8493         * gold/script-c.h (script_saw_segment_start_expression): New function
8494         prototype.
8495         * script-sections.cc (Script_sections::Script_sections): Initialize
8496         SAW_SEGMENT_START_EXPRESSION_ to false.
8497         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8498         and -Tbbs options to specify section addresses if given in
8499         command line and no SEGMENT_START expression is seen in a script.
8500         * script-sections.h (Script_sections::saw_segment_start_expression,
8501         Script_sections::set_saw_segment_start_expression): New method
8502         definition.
8503         (Script_sections::saw_segment_start_expression_): New data member
8504         declaration.
8505         * script.cc (script_saw_segment_start_expression): New function.
8506         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8507         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8508         script_test_7.sh and script_test_8.sh.
8509         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8510         script_test_8.stdout.
8511         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8512         (script_test_6, script_test_6.stdout, script_test_7,
8513         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8514         * Makefile.in: Regenerate.
8515         * testsuite/script_test_6.sh: New file.
8516         * testsuite/script_test_6.t: Same.
8517         * testsuite/script_test_7.sh: Same.
8518         * testsuite/script_test_7.t: Same.
8519         * testsuite/script_test_8.sh: Same.
8520
8521 2009-10-16  Doug Kwan  <dougkwan@google.com>
8522
8523         * output.cc (Output_segment::set_section_list_address): Cast
8524         expressions to unsigned long long type to avoid format warnings.
8525
8526 2009-10-15  Ian Lance Taylor  <iant@google.com>
8527
8528         * script.cc (Script_options::add_symbol_assignment): Always add a
8529         dot assignment to script_sections_.
8530         * script-sections.cc (Script_sections::add_dot_assignment):
8531         Initialize if necessary.
8532
8533         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8534         program headers with no load segment if there is a linker script.
8535
8536         * layout.cc (Layout::set_segment_offsets): Align the file offset
8537         to the segment aligment for -N or -n with no load segment.
8538         * output.cc (Output_segment::add_output_section): Don't crash if
8539         the first section is a TLS section.
8540         (Output_segment::set_section_list_addresses): Print an error
8541         message if the address moves backward in a linker script.
8542         * script-sections.cc
8543         (Output_section_element_input::set_section_addresses): Don't
8544         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8545         (Orphan_output_section::set_section_addresses): Likewise.
8546
8547 2009-10-15  Doug Kwan  <dougkwan@google.com>
8548
8549         * layout.cc (Layout::finish_dynamic_section): Generate tags
8550         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8551         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8552         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8553
8554 2009-10-14  Ian Lance Taylor  <iant@google.com>
8555
8556         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8557         fields.
8558         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8559         data_shdr fields of relinfo.
8560         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8561         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8562         R_386_TLS_LDO_32, adjust based on section flags.
8563         (Target_i386::Relocate::fix_up_ldo): Remove.
8564
8565 2009-10-13  Ian Lance Taylor  <iant@google.com>
8566
8567         Add support for -pie.
8568         * options.h (class General_options): Add -pie and
8569         --pic-executable.
8570         (General_options::output_is_position_independent): Test -pie.
8571         (General_options::output_is_executable): Return true if not shared
8572         and not relocatable.
8573         (General_options::output_is_pie): Remove.
8574         * options.cc (General_options::finalize): Reject incompatible uses
8575         of -pie.
8576         * gold.cc (queue_middle_tasks): A -pie link is not static.
8577         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8578         * symtab.cc (Symbol::final_value_is_known): Return false if
8579         output_is_position_independent.
8580         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8581         output_is_position_independent.
8582         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8583         output_is_position_independent.
8584         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8585         output_is_position_independent.
8586         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8587         two_file_pie_test.
8588         (basic_pie_test.o, basic_pie_test): New targets.
8589         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8590         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8591         (two_file_pie_test): New target.
8592         * testsuite/Makefile.in: Rebuild.
8593         * README: Remove note saying that -pie is not supported.
8594
8595 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8596
8597         * options.h (class General_options): Add -init and -fini.
8598         * layout.cc (Layout::finish_dynamic_section): Emit
8599         given init and fini functions.
8600
8601 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8602
8603         * gc.h (gc_process_relocs): Check if icf is enabled using new
8604         function.
8605         * gold.cc (queue_initial_tasks): Likewise.
8606         (queue_middle_tasks): Likewise.
8607         * object.cc (do_layout): Likewise.
8608         * symtab.cc (is_section_folded): Likewise.
8609         * main.cc (main): Likewise.
8610         * reloc.cc (Read_relocs::run): Likewise.
8611         (Sized_relobj::do_scan_relocs): Likewise.
8612         * icf.cc (is_function_ctor_or_dtor): New function.
8613         (Icf::find_identical_sections): Check if function is ctor or dtor when
8614         safe icf is chosen.
8615         * options.h (General_options::icf): Change option to be an enum.
8616         (Icf_status): New enum.
8617         (icf_enabled): New method.
8618         (icf_safe_folding): New method.
8619         (set_icf_status): New method.
8620         (icf_status_): New variable.
8621         * (options.cc) (General_options::finalize): Set icf_status_.
8622         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8623         icf_test and icf_keep_unique_test to use the --icf enum flag.
8624         * testsuite/icf_safe_test.sh: New file.
8625         * testsuite/icf_safe_test.cc: New file.
8626
8627 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8628
8629         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8630         includes to gc.h and icf.h.
8631         * arm.cc: Include gc.h.
8632         * gold.cc: Likewise.
8633         * i386.cc: Likewise.
8634         * powerpc.cc: Likewise.
8635         * sparc.cc: Likewise.
8636         * x86_64.cc: Likewise.
8637         * gc.h: Include icf.h.
8638
8639 2009-10-11  Ian Lance Taylor  <iant@google.com>
8640
8641         * plugin.cc: Include "gold.h" before other header files.
8642
8643 2009-10-10  Chris Demetriou  <cgd@google.com>
8644
8645         * options.h (Input_file_argument::Input_file_type): New enum.
8646         (Input_file_argument::is_lib_): Replace with...
8647         (Input_file_argument::type_): New member.
8648         (Input_file_argument::Input_file_argument): Take Input_file_type
8649         'type' rather than boolean 'is_lib' as second argument.
8650         (Input_file_argument::is_lib): Use type_.
8651         (Input_file_argument::is_searched_file): New function.
8652         (Input_file_argument::may_need_search): Handle is_searched_file.
8653         * options.cc (General_options::parse_library): Support -l:filename.
8654         (General_options::parse_just_symbols): Update for Input_file_argument
8655         changes.
8656         (Command_line::process): Likewise.
8657         * archive.cc (Archive::get_file_and_offset): Likewise.
8658         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8659         * script.cc (read_script_file, script_add_file): Likewise.
8660         * fileread.cc (Input_file::Input_file): Likewise.
8661         (Input_file::will_search_for): Handle is_searched_file.
8662         (Input_file::open): Likewise.
8663         * readsyms.cc (Read_symbols::get_name): Likewise.
8664         * testsuite/Makefile.am (searched_file_test): New test.
8665         * testsuite/Makefile.in: Regenerate.
8666         * testsuite/searched_file_test.cc: New file.
8667         * testsuite/searched_file_test_lib.cc: New file.
8668
8669 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8670             Ian Lance Taylor  <iant@google.com>
8671
8672         * descriptor.cc: Include <cstdio> and "binary-io.h".
8673         (Descriptors::open): Open the files in binary mode always.
8674         * script.cc (Lex::get_token): Treat \r as whitespace.
8675
8676 2009-10-09  Ian Lance Taylor  <iant@google.com>
8677
8678         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8679
8680 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8681             Ian Lance Taylor  <iant@google.com>
8682
8683         * configure.ac: Check for readv function also.
8684         * fileread.cc (readv): Define if not HAVE_READV.
8685         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8686         does not exist.
8687         * config.in: Regenerate.
8688         * configure: Regenerate.
8689
8690 2009-10-09  Doug Kwan  <dougkwan@google.com>
8691
8692         * layout.cc (Layout::make_output_section): Call target hook to make
8693         ordinary output section.
8694         (Layout::finalize): Adjust parameter list of call the
8695         Target::may_relax().
8696         * layout.h (class Layout::section_list): New method.
8697         * merge.h (Output_merge_base::entsize): Change visibility to public.
8698         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8699         New methods.
8700         (Output_merge_string::do_is_string): New method.
8701         * object.cc (Sized_relobj::do_setup): renamed from
8702         Sized_relobj::set_up.
8703         * object.h (Sized_relobj::adjust_shndx,
8704         Sized_relobj::initializ_input_to_output_maps,
8705         Sized_relobj::free_input_to_output_maps): Change visibilities to
8706         protected.
8707         (Sized_relobj::setup): Virtualize.
8708         (Sized_relobj::do_setup): New method declaration.
8709         (Sized_relobj::invalidate_section_offset,
8710         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8711         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8712         * options.cc (parse_int): New function.
8713         * options.h (parse_int): New declaration.
8714         (DEFINE_int): New macro.
8715         (stub_group_size): New option.
8716         * output.cc (Output_section::Output_section): Initialize memebers
8717         merge_section_map_, merge_section_by_properties_map_,
8718         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8719         (Output_section::add_input_section): Handled deferred code-fill
8720         generation and remove an old comment.
8721         (Output_section::add_relaxed_input_section): New method definition.
8722         (Output_section::add_merge_input_section): Use merge section by
8723         properties map to speed to search.  Update merge section maps
8724         as appropriate.
8725         (Output_section::build_relaxation_map): New method definition.
8726         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8727         Same.
8728         (Output_section::relax_input_section): Renamed to
8729         Output_section::convert_input_sections_to_relaxed_sections and change
8730         interface to take a vector of pointers to relaxed sections.
8731         (Output_section::find_merge_section,
8732         Output_section::find_relaxed_input_section): New method definitions.
8733         (Output_section::is_input_address_mapped,
8734         Output_section::output_offset, Output_section::output_address):
8735         Use output section data maps to speed up searching.
8736         (Output_section::find_starting_output_address): Add comments.
8737         (Output_section::do_write,
8738         Output_section::write_to_postprocessing_buffer): Do code-fill
8739         generation as appropriate.
8740         (Output_section::get_input_sections): Invalidate relaxed input section
8741         map.
8742         (Output_section::restore_states): Adjust type of checkpoint .
8743         Invalidate relaxed input section map.
8744         * output.h (Output_merge_base): New class declaration.
8745         (Input_section_specifier): New class defintion.
8746         (class Output_relaxed_input_section) Change base class to
8747         Output_section_data_build.
8748         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8749         base class initializer.
8750         (Output_section::add_relaxed_input_section): New method declaration.
8751         (Output_section::Input_section): Change visibility to protected.
8752         (Output_section::Input_section::relobj,
8753         Output_section::Input_section::shndx): Handle relaxed input sections.
8754         Output_section::input_sections) Change visibility to protected.  Also
8755         define overload to return a non-const pointer.
8756         (Output_section::Merge_section_properties): New class defintion.
8757         (Output_section::Merge_section_by_properties_map,
8758         Output_section::Output_section_data_by_input_section_map,
8759         Output_section::Relaxation_map): New types.
8760         (Output_section::relax_input_section): Rename method to
8761         Output_section::convert_input_sections_to_relaxed_sections and change
8762         interface to take a vector of relaxed section pointers.
8763         (Output_section::find_merge_section,
8764         Output_section::find_relaxed_input_section,
8765         Output_section::build_relaxation_map,
8766         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8767         New method declarations.
8768         (Output_section::merge_section_map_
8769         Output_section::merge_section_by_properties_map_,
8770         Output_section::relaxed_input_section_map_,
8771         Output_section::is_relaxed_input_section_map_valid_,
8772         Output_section::generate_code_fills_at_write_): New data members.
8773         * script-sections.cc
8774         (Output_section_element_input::set_section_addresses): Call
8775         current_data_size and addralign methods of relaxed input sections.
8776         (Orphan_output_section::set_section_addresses): Call current_data_size
8777         and addralign methods of relaxed input sections.
8778         * symtab.cc (Symbol_table::compute_final_value): Extract template
8779         from the body of Symbol_table::sized_finalize_symbol.
8780         (Symbol_table::sized_finalized_symbol): Call
8781         Symbol_table::compute_final_value.
8782         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8783         (Symbol_table::compute_final_value): New templated method declaration.
8784         * target.cc (Target::do_make_output_section): New method defintion.
8785         * target.h (Target::make_output_section): New method declaration.
8786         (Target::relax): Add more parameters for input objects, symbol table
8787         and layout.  Adjust call to do_relax.
8788         (Target::do_make_output_section): New method declaration.
8789         (Target::do_relax): Add parameters for input objects, symbol table
8790         and layout.
8791
8792 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8793
8794         * pread.c: Include stdio.h.
8795
8796 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8797
8798         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8799         defined.
8800
8801 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8802
8803         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8804         Change read_shndx type to unsigned int.
8805         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8806         int.
8807         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8808         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8809         Change read_shndx type to unsigned int.
8810         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8811         int.
8812         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8813         * layout.cc (Layout::create_symtab_sections): Cast the result of
8814         local_symcount * symsize to off_t in the gold_assert.
8815
8816 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8817
8818         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8819         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8820         R_ARM_BASE_ABS.
8821         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8822         (Arm_relocate_functions::thm_abs5): New function.
8823         (Arm_relocate_functions::abs12): New function.
8824         (Arm_relocate_functions::abs16): New function.
8825         (Arm_relocate_functions::base_abs): New function.
8826         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8827         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8828         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8829         R_ARM_BASE_ABS.
8830         (Scan::global): Likewise.
8831         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8832         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8833         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8834         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8835         R_ARM_BASE_ABS.
8836
8837 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8838
8839         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8840         (Arm_relocate_functions::movt_prel): New function.
8841         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8842         (Arm_relocate_functions::thm_movt_prel): New function.
8843         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8844         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8845         (Scan::global, Relocate::relocate): Likewise.
8846         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8847
8848 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8849
8850         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8851         Incremental_checker.
8852         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8853         unsigned int.
8854         (class Incremental_inputs_header): New class.
8855         (Incremental_inputs_header_writer): Edit comment.
8856         (Incremental_inputs_entry): New class.
8857         (Incremental_inputs_entry_writer): Edit comment.
8858         (Sized_incremental_binary::do_find_incremental_inputs_section):
8859         Add *strtab_shndx parameter, fill it.
8860         (Sized_incremental_binary::do_check_inputs): New method.
8861         (Incremental_checker::can_incrementally_link_output_file): Use
8862         Sized_incremental_binary::check_inputs.
8863         (Incremental_inputs::report_command_line): Save command line in
8864         command_line_.
8865         * incremental.h:
8866         (Incremental_binary::find_incremental_inputs_section): New
8867         method.
8868         (Incremental_binary::do_find_incremental_inputs_section): Add
8869         strtab_shndx parameter.
8870         (Incremental_binary::do_check_inputs): New pure virtual method.
8871         (Sized_incremental_binary::do_check_inputs): Declare.
8872         (Incremental_checker::Incremental_checker): Add incremental_inputs
8873         parameter, use it to initialize incremental_inputs_.
8874         (Incremental_checker::incremental_inputs_): New field.
8875         (Incremental_checker::command_line): New method.
8876         (Incremental_checker::inputs): New method.
8877         (Incremental_checker::command_line_): New field.
8878
8879 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8880
8881         * incremental.cc: Include <cstdarg> and "target-select.h".
8882         (vexplain_no_incremental): New function.
8883         (explain_no_incremental): New function.
8884         (Incremental_binary::error): New method.
8885         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8886         method.
8887         (make_sized_incremental_binary): New function.
8888         (open_incremental_binary): New function.
8889         (can_incrementally_link_file): Add checks if output is ELF and has
8890         inputs section.
8891         * incremental.h: Include "elfcpp_file.h" and "output.h".
8892         (Incremental_binary): New class.
8893         (Sized_incremental_binary): New class.
8894         (open_incremental_binary): Declare.
8895         * object.cc (is_elf_object): Use
8896         elfcpp::Elf_recognizer::is_elf_file.
8897         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8898         * output.h (Output_file::filesize): New method.
8899
8900 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8901
8902         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8903         New function.
8904         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8905         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8906         function.
8907         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8908         function.
8909         (Arm_relocate_functions::movw_abs_nc): New function.
8910         (Arm_relocate_functions::movt_abs): New function.
8911         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8912         (Arm_relocate_functions::thm_movt_abs): New function.
8913         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8914         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8915         (Scan::global): Likewise.
8916         (Relocate::relocate): Likewise.
8917         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8918
8919 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8920
8921         * arm.cc (Arm_relocate_functions::got_prel) New function.
8922         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8923         (Relocate::relocate): Likewise.
8924         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8925
8926 2009-10-06  Ian Lance Taylor  <iant@google.com>
8927
8928         * options.h (class General_options): Define
8929         split_stack_adjust_size parameter.
8930         * object.h (class Object): Add uses_split_stack_ and
8931         has_no_split_stack_ fields.  Add uses_split_stack and
8932         has_no_split_stack accessor functions.  Declare
8933         handle_split_stack_section.
8934         (class Reloc_symbol_changes): Define.
8935         (class Sized_relobj): Define Function_offsets.  Declare
8936         split_stack_adjust, split_stack_adjust_reltype, and
8937         find_functions.
8938         * object.cc (Object::handle_split_stack_section): New function.
8939         (Sized_relobj::do_layout): Call handle_split_stack_section.
8940         * dynobj.cc (Sized_dynobj::do_layout): Call
8941         handle_split_stack_section.
8942         * reloc.cc (Sized_relobj::relocate_sections): Call
8943         split_stack_adjust for executable sections in split_stack
8944         objects.  Pass reloc_map to relocate_section.
8945         (Sized_relobj::split_stack_adjust): New function.
8946         (Sized_relobj::split_stack_adjust_reltype): New function.
8947         (Sized_relobj::find_functions): New function.
8948         * target-reloc.h: Include "object.h".
8949         (relocate_section): Add reloc_symbol_changes parameter.  Change
8950         all callers.
8951         * target.h (class Target): Add calls_non_split method.  Declare
8952         do_calls_non_split virtual method.  Declare match_view and
8953         set_view_to_nop.
8954         * target.cc: Include "elfcpp.h".
8955         (Target::do_calls_non_split): New function.
8956         (Target::match_view): New function.
8957         (Target::set_view_to_nop): New function.
8958         * gold.cc (queue_middle_tasks): Give an error if mixing
8959         split-stack and non-split-stack objects with -r.
8960         * i386.cc (Target_i386::relocate_section): Add
8961         reloc_symbol_changes parameter.
8962         (Target_i386::do_calls_non_split): New function.
8963         * x86_64.cc (Target_x86_64::relocate_section): Add
8964         reloc_symbol_changes parameter.
8965         (Target_x86_64::do_calls_non_split): New function.
8966         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8967         parameter.
8968         * powerpc.cc (Target_powerpc::relocate_section): Add
8969         reloc_symbol_changes parameter.
8970         * sparc.cc (Target_sparc::relocate_section): Add
8971         reloc_symbol_changes parameter.
8972         * configure.ac: Call AM_CONDITIONAL for the default target.
8973         * configure: Rebuild.
8974         * testsuite/Makefile.am (TEST_AS): New variable.
8975         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8976         (check_DATA): Add split_i386 and split_x86_64 files.
8977         (SPLIT_DEFSYMS): Define.
8978         (split_i386_[1234n].o): New targets.
8979         (split_i386_[124]): New targets.
8980         (split_i386_[1234r].stdout): New targets.
8981         (split_x86_64_[1234n].o): New targets.
8982         (split_x86_64_[124]): New targets.
8983         (split_x86_64_[1234r].stdout): New targets.
8984         (MOSTLYCLEANFILES): Add new executables.
8985         * testsuite/split_i386.sh: New file.
8986         * testsuite/split_x86_64.sh: New file.
8987         * testsuite/split_i386_1.s: New file.
8988         * testsuite/split_i386_2.s: New file.
8989         * testsuite/split_i386_3.s: New file.
8990         * testsuite/split_i386_4.s: New file.
8991         * testsuite/split_i386_n.s: New file.
8992         * testsuite/split_x86_64_1.s: New file.
8993         * testsuite/split_x86_64_2.s: New file.
8994         * testsuite/split_x86_64_3.s: New file.
8995         * testsuite/split_x86_64_4.s: New file.
8996         * testsuite/split_x86_64_n.s: New file.
8997         * testsuite/testfile.cc (Target_test): Update relocation_section
8998         function.
8999         * testsuite/Makefile.in: Rebuild.
9000
9001 2009-10-06  Ian Lance Taylor  <iant@google.com>
9002
9003         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9004         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9005         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9006         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9007         the address on ldo_addrs_.
9008         (Target_i386::Relocate::fix_up_ldo): New function.
9009
9010 2009-10-06   Rafael Espindola  <espindola@google.com>
9011
9012         * plugin.cc (add_input_library): New.
9013         (Plugin::load): Add add_input_library to tv.
9014         (Plugin_manager::add_input_file): Add the is_lib argument.
9015         (add_input_file): Update call to Plugin_manager::add_input_file.
9016         (add_input_library): New.
9017         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9018
9019 2009-09-30  Doug Kwan  <dougkwan@google.com>
9020
9021         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9022         symbol and call Symbol::may_need_copy_reloc to determine if
9023         a copy reloc is needed.
9024         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9025         nocopyreloc is given in command line.
9026         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9027         given in command line.
9028         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9029         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9030         of the removed Target_i386::may_need_copy_reloc.
9031         * options.h (copyreloc): New option with default value false.
9032         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9033         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9034         instead of the removed Target_powerpc::may_need_copy_reloc.
9035         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9036         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9037         instead of the removed Target_sparc::may_need_copy_reloc.
9038         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9039         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9040         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9041         instead of the removed Target_x86_64::may_need_copy_reloc.
9042
9043 2009-09-30  Ian Lance Taylor  <iant@google.com>
9044
9045         * object.h (class Object): Remove target_ field, and target,
9046         sized_target, and set_target methods.
9047         (Object::sized_target): Remove.
9048         (class Sized_relobj): Update declarations.  Remove sized_target.
9049         * object.cc (Sized_relobj::setup): Remove target parameter.
9050         Change all callers.
9051         (Input_objects::add_object): Don't do anything with the target.
9052         (make_elf_sized_object): Add punconfigured parameter.  Change all
9053         callers.  Set or test parameter target.
9054         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9055         Change all callers.
9056         * parameters.cc (Parameters::set_target): Change parameter type to
9057         be non-const.
9058         (Parameters::default_target): Remove.
9059         (set_parameters_target): Change parameter type to be non-const.
9060         (parameters_force_valid_target): New function.
9061         (parameters_clear_target): New function.
9062         * parameters.h (class Parameters): Update declarations.  Remove
9063         default_target method.  Add sized_target and clear_target
9064         methods.  Change target_ to be non-const.
9065         (set_parameters_target): Update declaration.
9066         (parameters_force_valid_target): Declare.
9067         (parameters_clear_target): Declare.
9068         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9069         as NULL if we aren't searching.
9070         (Add_symbols::run): Don't check for compatible target.
9071         * fileread.cc (Input_file::open_binary): Call
9072         parameters_force_valid_target.
9073         * gold.cc (queue_middle_tasks): Likewise.
9074         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9075         set_target on object.
9076         * dynobj.h (class Sized_dynobj): Update declarations.
9077         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9078         make_elf_object returns NULL.
9079         (Archive::include_member): Don't check whether object target is
9080         compatible.
9081         * output.cc (Output_section::add_input_section): Get target from
9082         parameters.
9083         (Output_section::relax_input_section): Likewise.
9084         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9085         parameters.
9086         (Sized_relobj::do_scan_relocs): Likewise.
9087         (Sized_relobj::relocate_sections): Likewise.
9088         * resolve.cc (Symbol_table::resolve): Likewise.
9089         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9090         parameter.  Change all callers.
9091         (Symbol_table::add_from_object): Get target from parameters.
9092         (Symbol_table::add_from_relobj): Don't check object target.
9093         (Symbol_table::add_from_dynobj): Likewise.
9094         (Symbol_table::define_special_symbol): Get target from
9095         parameters.
9096         * symtab.h (class Symbol_table): Update declaration.
9097         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9098         parameter.  Change all callers.  Clear parameter target.
9099         (Binary_test): Test target here.
9100         * testsuite/object_unittest.cc (gold_testsuite): Remove
9101         target_test_pointer parameter.  Change all callers.
9102         (Object_test): Test target here.
9103
9104 2009-09-26  Ian Lance Taylor  <iant@google.com>
9105
9106         * testsuite/initpri1.c: Don't try to use constructor priorities if
9107         compiling with gcc before 4.3.
9108
9109 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9110
9111         * testsuite/retain_symbols_file_test.sh (check_present): Change
9112         output file name to retain_symbols_file_test.stdout.
9113         (check_absent): Likewise.
9114
9115 2009-09-18  Craig Silverstein  <csilvers@google.com>
9116
9117         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9118         * options.cc: Include <cerrno> and <fstream>.
9119         (General_options::finalize): Parse -retain-symbols-file tag.
9120         * options.h: New flag.
9121         (General_options): New method should_retain_symbol, new
9122         variable symbols_to_retain.
9123         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9124         should_retain_symbol map.
9125         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9126         * testsuite/Makefile.in: Regenerate.
9127         * testsuite/retain_symbols_file_test.sh: New file.
9128
9129 2009-09-18  Nick Clifton  <nickc@redhat.com>
9130
9131         * po/es.po: Updated Spanish translation.
9132
9133 2009-09-17  Doug Kwan  <dougkwan@google.com>
9134
9135         * debug.h (DEBUG_RELAXATION): New constant.
9136         (DEBUG_ALL): Add DEBUG_RELAXATION.
9137         (debug_string_to_enum): Add relaxation debug option.
9138         * layout.cc
9139         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9140         Layout::Relaxation_debug_check::read_sections,
9141         Layout::Relaxation_debug_check::read_sections): New method definitions.
9142         (Layout::Layout): Initialize data members
9143         record_output_section_data_from_scrips_,
9144         script_output_section_data_list_ and relaxation_debug_check_.
9145         (Layout::save_segments, Layout::restore_segments,
9146         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9147         Layout::relaxation_loop_body): New method definitions.
9148         (Layout::finalize): Support relaxation.  Move section layout code to
9149         Layout::relaxation_loop_body.
9150         (Layout::set_asection_address_from_script): Move code for orphan
9151         section placement out.
9152         (Layout::place_orphan_sections_in_script): New method definition.
9153         * layout.h (Output_segment_headers, Output_file_header):
9154         New forward class declarations.
9155         (Layout::~Layout): Define.
9156         (Layout::new_output_section_data_from_script): New method definition.
9157         (Layout::place_orphan_sections_in_script): New method declaration.
9158         (Layout::Segment_states): New type declaration.
9159         (Layout::save_segments, Layout::restore_segments,
9160         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9161         Layout::relaxation_loop_body): New method declarations.
9162         (Layout::Output_section_data_list): New type declaration.
9163         (Layout::Relaxation_debug_check): New class definition.
9164         (Layout::record_output_section_data_from_script_,
9165         Layout::script_output_section_data_list_, Layout::segment_states_,
9166         Layout::relaxation_debug_check_): New data members.
9167         * output.cc: (Output_section_headers::do_size): New method definition.
9168         (Output_section_headers::Output_section_headers): Move size
9169         computation to Output_section_headers::do_size.
9170         (Output_segment_headers::do_size): New method definition.
9171         (Output_file_header::Output_file_header): Move size computation to
9172         Output_file_header::do_size and call it.
9173         (Output_file_header::do_size): New method definition.
9174         (Output_data_group::Output_data_group): Adjust call to
9175         Output_section_data.
9176         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9177         (Output_symtab_xindex::do_write): Add array bound check.
9178         (Output_section::Input_section::print_to_mapfile): Handle
9179         RELAXED_INPUT_SECTION_CODE.
9180         (Output_section::Output_section): Initialize data member checkpoint_.
9181         (Output_section::~Output_section): Delete checkpoint object pointed
9182         by checkpoint_.
9183         (Output_section::add_input_section): Always add an Input_section if
9184         relaxing.
9185         (Output_section::add_merge_input_section): Add assert.
9186         (Output_section::relax_input_section): New method definition.
9187         (Output_section::set_final_data_size): Set load address to zero for
9188         an unallocated section.
9189         (Output_section::do_address_and_file_offset_have_reset_values):
9190         New method definition.
9191         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9192         Handle relaxed input section.
9193         (Output_section::sort_attached_input_sections): Checkpoint input
9194         section list lazily.
9195         (Output_section::get_input_sections): Change type of input_sections to
9196         list of Simple_input_section pointers.  Checkpoint input section list
9197         lazily.  Also handle relaxed input sections.
9198         (Output_section::add_input_section_for_script): Take a reference to
9199         a Simple_input_section object instead of Relobj pointer and section
9200         index as parameter.  Handle relaxed input sections.
9201         (Output_section::save_states, Output_section::restore_states): New
9202         method definitions.
9203         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9204         (Output_data::is_data_size_fixed): New method definition.
9205         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9206         if it is fixed.
9207         (Output_data::address_and_file_offset_have_reset_values): New method
9208         definition.
9209         (Output_data::do_address_and_file_offset_have_reset_values): New method
9210         definition.
9211         (Output_data::set_data_size): Check that data size is not fixed.
9212         (Output_data::fix_data_size): New method definition.
9213         (Output_data::is_data_size_fixed_): New data member.
9214         (Output_section_headers::set_final_data_size): New method definition.
9215         (Output_section_headers::do_size): New method declaration.
9216         (Output_segment_headers::set_final_data_size): New method definition.
9217         (Output_segment_headers::do_size): New method declaration.
9218         (Output_file_header::set_final_data_size)::New method definition.
9219         (Output_file_header::do_size)::New method declaration.
9220         (Output_section_data::Output_section_data): Add new parameter
9221         is_data_size_fixed and use it to fix data size.
9222         (Output_data_const::Output_data_const): Adjust call to base class
9223         constructor and fix data size.
9224         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9225         base class constructor and fix data size.
9226         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9227         base class constructor and fix data size.
9228         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9229         class constructor and fix data size.
9230         (Output_data_group::set_final_data_size): New method definition.
9231         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9232         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9233         class constructor and fix data size.
9234         (Output_relaxed_input_section): New class definition.
9235         (Output_section::Simple_input_section): New class definition.
9236         (Output_section::get_input_sections): Adjust parameter list.
9237         (Output_section::add_input_section_for_script): Same.
9238         (Output_section::save_states, Output_section::restore_states,
9239         Output_section::do_address_and_file_offset_have_reset_values,
9240         (Output_section::Input_section::Input_section): Handle
9241         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9242         Output_relaxed_input_section.
9243         (Output_section::Input_section::is_input_section,
9244         Output_section::Input_section::set_output_section): Handle relaxed
9245         input section.
9246         (Output_section::Input_section::is_relaxed_input_section,
9247         Output_section::Input_section::output_section_data,
9248         Output_section::Input_section::relaxed_input_section): New method
9249         definitions.
9250         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9251         value.
9252         (Output_section::Input_section::u1_): Update comments.
9253         (Output_section::Input_section::u2_): Add new union member poris.
9254         (Output_section::Checkpoint_output_section): New classs definition.
9255         (Output_section::relax_input_section): New method declaration.
9256         (Output_section::checkpoint_): New data member.
9257         (Output_segment): Update comments.
9258         (Output_segment::Output_segment): Un-privatize copy constructor.
9259         (Output_segment::operator=): Un-privatize.
9260         * script-sections.cc (Output_section_element::Input_section_list):
9261         Change element type to Output_section::Simple_input_section.
9262         (Output_section_element_dot_assignment::set_section_addresses):
9263         Register output section data for relaxation clean up.
9264         (Output_data_exression::Output_data_expression): Adjust call to base
9265         constructor to fix data size.
9266         (Output_section_element_data::set_section_addresses): Register
9267         Output_data_expression object for relaxation clean up.
9268         (struct Input_section_info): Replace Relobj pointer and section index
9269         pair with Output_section::Simple_input_section and Convert struct to a
9270         class.
9271         (Input_section_sorter::operator()): Adjust access to
9272         Input_section_info data member to use accessors.
9273         (Output_section_element_input::set_section_addresses): Use layout
9274         parameter.  Adjust code to use Output_section::Simple_input_section
9275         and Input_secction_info classes.  Register filler for relaxation
9276         clean up.
9277         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9278         and section index pair with Output_section::Simple_input_section
9279         class.  Adjust code accordingly.
9280         (Phdrs_element::release_segment): New method definition.
9281         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9282         segment list.
9283         (Script_sections::release_segments): New method definition.
9284         * gold/script-sections.h (Script_sections::release_segments): New
9285         method declaration.
9286         * gold/target.h (Target::may_relax, Target::relax,
9287         Target::do_may_relax, Target::do_relax): New method definitions.
9288
9289 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9290
9291         * arm.cc (has_signed_unsigned_overflow): New function.
9292         (Arm_relocate_functions::abs8): New function.
9293         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9294         (Target_arm::Scan::global): Likewise.
9295         (Target_arm::relocate::relocate): Likewise.
9296         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9297         Likewise.
9298
9299 2009-09-16  Cary Coutant  <ccoutant@google.com>
9300
9301         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9302         * testsuite/Makefile.in: Regenerate.
9303
9304 2009-09-11  Nick Clifton  <nickc@redhat.com>
9305
9306         * po/gold.pot: Updated by the Translation project.
9307
9308 2009-09-08  Cary Coutant  <ccoutant@google.com>
9309
9310         * output.cc (Output_file::open): Add execute permission to empty file.
9311         * testsuite/Makefile.am (permission_test): New test.
9312         * testsuite/Makefile.in: Regenerate.
9313
9314 2009-09-02  Ian Lance Taylor  <iant@google.com>
9315
9316         * output.cc (Output_file::resize): Call map_no_anonymous rather
9317         than map.
9318
9319 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9320
9321         * gold.cc: Include "incremental.h".
9322         (queue_initial_tasks): Call Incremental_checker methods.
9323         * incremental.cc: Include "output.h".
9324         (Incremental_checker::can_incrementally_link_output_file): New
9325         method.
9326         * incremental.h (Incremental_checker): New class.
9327
9328         * output.cc (Output_file::open_for_modification): New method.
9329         (Output_file::map_anonymous): Changed return type to bool.  Record
9330         map in base_ field.
9331         (Output_file::map_no_anonymous): New method, broken out of map.
9332         (Output_file::map): Use map_no_anonymous and map_anonymous.
9333         * output.h (class Output_file): Update declarations.
9334
9335 2009-08-24  Cary Coutant  <ccoutant@google.com>
9336
9337         * options.h (Command_line::Pre_options): New class.
9338         (Command_line::pre_options): New member.
9339         * options.cc (gold::options::ready_to_register): New variable.
9340         (One_option::register_option): Do nothing if not registering options.
9341         Assert if same short option registered twice.
9342         (General_options::General_options): Turn off option registration when
9343         done constructing.
9344         (Command_line::Pre_options::Pre_options): New constructor.
9345
9346 2009-08-24  Cary Coutant  <ccoutant@google.com>
9347
9348         * options.h (General_options::no_keep_memory): Remove incorrect
9349         short option.
9350
9351 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9352
9353         * Makefile.am (am__skiplex, am__skipyacc): New.
9354         * Makefile.in: Regenerate.
9355
9356 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9357
9358         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9359         (INCLUDES): ... this.
9360         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9361         (AM_CPPFLAGS): Renamed from ...
9362         (INCLUDE): ... this.
9363         * Makefile.in, testsuite/Makefile.in: Regenerate.
9364
9365         * Makefile.in: Regenerate.
9366         * aclocal.m4: Likewise.
9367         * config.in: Likewise.
9368         * configure: Likewise.
9369         * testsuite/Makefile.in: Likewise.
9370
9371         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9372         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9373         * Makefile.in: Regenerate.
9374         * testsuite/Makefile.in: Regenerate.
9375
9376 2009-08-19  Cary Coutant  <ccoutant@google.com>
9377
9378         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9379         symbols in shared libraries overridden by hidden or internal symbols
9380         in the main program.
9381
9382 2009-08-19  Chris Demetriou  <cgd@google.com>
9383
9384         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9385         checking source file names in error messages.
9386
9387 2009-08-18  Doug Kwan  <dougkwan@google.com>
9388
9389         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9390         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9391         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9392         an elfcpp::Ehdr as parameter.
9393         * object.cc (Object::set_target): Remove the version that looks up
9394         a target and sets it.
9395         (Sized_relobj::setup): Take a Target object instead of
9396         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9397         (make_elf_sized_object): Find target and ask target to
9398         make an ELF object.
9399         * object.h: (Object::set_target): Remove the version that looks up
9400         a target and sets it.
9401         (Sized_relobj::setup): Take a Target object instead of
9402         an elfcpp:Ehdr as parameter.
9403         * target.cc: Include dynobj.h.
9404         (Target::do_make_elf_object_implementation): New.
9405         (Target::do_make_elf_object): New.
9406         * target.h (Target::make_elf_object): New template declaration.
9407         (Target::do_make_elf_object): New method declarations.
9408         (Target::do_make_elf_object_implementation): New template declaration.
9409
9410 2009-08-14  Ian Lance Taylor  <iant@google.com>
9411
9412         * gold.h (FUNCTION_NAME): Define.
9413         (gold_unreachable): Use FUNCTION_NAME.
9414
9415 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9416
9417         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9418         symbol in the --keep-unique list is not found.
9419
9420 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9421
9422         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9423         been maked as --keep-unique.
9424         (Icf::unfold_section): New function.
9425         * icf.h (Icf::unfold_section): New function.
9426         * options.h (General_options::keep_unique): New option.
9427         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9428         * testsuite/Makefile.in: Regenerate.
9429         * testsuite/icf_keep_unique_test.sh: New file.
9430         * testsuite/icf_keep_unique_test.cc: New file.
9431
9432 2009-08-12  Cary Coutant  <ccoutant@google.com>
9433
9434         PR 10471
9435         * resolve.cc (Symbol_table::resolve): Check for references from
9436         dynamic objects to hidden and internal symbols.
9437         * testsuite/Makefile.am (hidden_test.sh): New test.
9438         * testsuite/Makefile.in: Regenerate.
9439         * testsuite/hidden_test.sh: New script.
9440         * testsuite/hidden_test_1.c: New test source.
9441         * testsuite/hidden_test_main.c: New test source.
9442
9443 2009-08-11  Doug Kwan  <dougkwan@google.com>
9444
9445         * arm.cc: Update comments.
9446         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9447         segment to locate the .ARM.exidx section if present.
9448
9449 2009-08-09  Doug Kwan  <dougkwan@google.com>
9450
9451         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9452         patch.
9453
9454 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9455         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9456         compiler warnings.
9457
9458 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9459
9460         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9461         valid tls_segment only for non-debug-section relocations.
9462         * testsuite/Makefile.am: Add gc_tls_test.
9463         * testsuite/Makefile.in: Regenerate.
9464         * testsuite/gc_tls_test.cc: New file.
9465         * testsuite/gc_tls_test.sh: New file.
9466
9467 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9468
9469         * icf.cc: New file.
9470         * icf.h: New file.
9471         * Makefile.am (CCFILES): Add icf.cc.
9472         (HFILES): Add icf.h
9473         * Makefile.in: Regenerate.
9474         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9475         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9476         section, symbol and addend information for the relocs.
9477         * gold.cc (queue_middle_tasks): Call identical code folding.
9478         * gold.h: Add defines for multimap.
9479         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9480         to the call of finalize_local_symbols.
9481         * main.cc (main): Create object of class Icf.
9482         * object.cc (Sized_relobj::do_layout): Allow this function to be
9483         called twice during icf.
9484         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9485         to sections marked as identical by icf.
9486         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9487         when available.
9488         (Sized_relobj::do_section_entsize): New function.
9489         * object.h (Object::section_entsize): New function.
9490         (Object::do_section_entsize): New pure virtual function.
9491         (Relobj::finalize_local_symbols): Add new parameter.
9492         (Relobj::do_section_entsize): New function.
9493         * options.h (General_options::icf): New option.
9494         (General_options::icf_iterations): New option.
9495         (General_options::print_icf_sections): New option.
9496         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9497         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9498         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9499         icf.
9500         * symtab.cc (Symbol_table::is_section_folded): New function.
9501         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9502         to sections marked as identical by icf.
9503         * symtab.h (Symbol_table::set_icf): New function.
9504         (Symbol_table::icf): New function.
9505         (Symbol_table::is_section_folded): New function.
9506         (Symbol_table::icf_): New data member.
9507         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9508         * testsuite/Makefile.am: Add commands to build icf_test.
9509         * testsuite/Makefile.in: Regenerate.
9510         * testsuite/icf_test.sh: New file.
9511         * testsuite/icf_test.cc: New file.
9512
9513 2009-07-24  Chris Demetriou  <cgd@google.com>
9514
9515         * layout.cc (is_compressible_debug_section): Fix incorrect
9516         comment about compressed section names.
9517
9518 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9519
9520         PR 10419
9521         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9522
9523 2009-07-16  Ian Lance Taylor  <iant@google.com>
9524
9525         PR 10400
9526         * layout.h: #include <map>.
9527         (class Kept_section): Change from struct to class.  Add accessors
9528         and setters.  Add section size to Comdat_group mapping.  Change
9529         Comdat_group to std::map.  Add is_comdat_ field.  Add
9530         linkonce_size field in union.
9531         (class Layout): Update declaration of find_or_add_kept_section.
9532         Don't declare find_kept_object.
9533         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9534         parameter.  Add object, shndx, is_comdat, and is_group_name
9535         parameters.  Change all callers.  Adjust for new Kept_section.
9536         (Layout::find_kept_object): Remove.
9537         * object.cc (Sized_relobj::include_section_group): Update use of
9538         Kept_section.  Rename secnum to shndx.  Only record
9539         Kept_comdat_section if sections are the same size.
9540         (Sized_relobj::include_linkonce_section): Update use of
9541         Kept_section.  Only record Kept_comdat_section if sections are the
9542         same size.  Set size of linkonce section.
9543         (Sized_relobj::map_to_kept_section): Update call to
9544         get_kept_comdat_section.
9545         * object.h (class Sized_relobj): Rename fields in
9546         Kept_comdat_section to drop trailing underscores; change object
9547         field to Relobj*.  Change Kept_comdat_section_table to store
9548         struct rather than pointer.
9549         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9550         Add kept_object and kept_shndx parameters.  Change all callers.
9551         (Sized_relobj::get_kept_comdat_section): Change return type to
9552         bool.  Add kept_object and kept_shndx parameters.  Change all
9553         callers.
9554         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9555         Layout::find_or_add_kept_section.
9556
9557 2009-07-09  Ian Lance Taylor  <iant@google.com>
9558
9559         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9560         Reserve space in the hash table.
9561
9562 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9563
9564         * fileread.cc (File_read::get_mtime): New method.
9565         * fileread.h (Timespec): New structure.
9566         (File_read::get_mtime): New method.
9567         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9568         Renamed from timestamp_nsec.
9569         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9570         Elf_Xword.
9571         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9572         timestamp_nsec.
9573         (Incremental_inputs::report_archive): Save mtime; style fix.
9574         (Incremental_inputs::report_obejct): Save mtime; style fix.
9575         (Incremental_inputs::report_script): Save mtime; style fix.
9576         (Incremental_inputs::finalize_inputs): Style fix.
9577         (Incremental_inputs::finalize): Style fix.
9578         (Incremental_inputs::create_input_section_data): Store inputs
9579         mtime.
9580         * incremental.h (Incremental_inputs::report_script): Add mtime
9581         argument.
9582         (Incremental_inputs::Input_info::Input_info): Intialize only one
9583         union member.
9584         (Incremental_inputs::Input_info::archive): Move to nameless
9585         union.
9586         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9587         (Incremental_inputs::Input_info::script): Move to nameless union.
9588         (Incremental_inputs::mtime): New field.
9589         * script.cc (read_input_script): Pass file mtime to
9590         Incremental_input.
9591         * script.h (Script_info::inputs): Style fix.
9592
9593 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9594
9595         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9596         instead of 32.
9597
9598 2009-06-24  Ian Lance Taylor  <iant@google.com>
9599
9600         PR 10156
9601         * layout.cc (Layout::choose_output_section): If we find an
9602         existing section, update the flags.
9603         (Layout::create_notes): New function, broken out of
9604         Layout::finalize.
9605         (Layout::finalize): Don't create note sections.
9606         (Layout::create_note): Don't crash if linker script discards
9607         section.
9608         (Layout::create_gold_note): Likewise.
9609         (Layout::create_build_id): Likewise.  Don't set
9610         after_input_sections on the section.
9611         (Layout::create_executable_stack_info): Remove target parameter.
9612         Change caller.
9613         * layout.h (class Layout): Declare create_notes.  Update
9614         declaration of create_executable_stack_info.
9615         * gold.cc (queue_middle_tasks): Call create_notes.
9616         * output.cc (Output_section::update_flags_for_input_section): Move
9617         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9618         invalid.
9619         * output.h (Output_data::mark_address_invalid): New function.
9620         (class Output_section): Only declare, not define,
9621         update_flags_for_input_section.  Remove set_flags.
9622
9623 2009-06-24  Ian Lance Taylor  <iant@google.com>
9624
9625         * script-sections.cc (Output_section_definition::
9626         set_section_addresses): Rename shadowing local load_address to
9627         laddr.
9628
9629 2009-06-24  Ian Lance Taylor  <iant@google.com>
9630
9631         PR 10244
9632         * reloc.cc (relocate_sections): Skip empty relocation sections.
9633
9634 2009-06-23  Ian Lance Taylor  <iant@google.com>
9635
9636         PR 10156
9637         * layout.cc (Layout::create_note): Use choose_output_section
9638         rather than make_output_section.
9639
9640 2009-06-23  Ian Lance Taylor  <iant@google.com>
9641
9642         PR 10237
9643         * options.cc (General_options::parse_V): Set printed_version_.
9644         (General_options::General_options): Initialize printed_version_.
9645         * options.h (class General_options): Add printed_version_ field.
9646         * gold.cc (queue_initial_tasks): If there are no input files,
9647         don't give a fatal error if we printed the version information.
9648         (queue_middle_tasks): If using -r with a shared object, give a
9649         fatal error rather than an ordinary error.
9650
9651 2009-06-23  Ian Lance Taylor  <iant@google.com>
9652
9653         PR 10219
9654         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9655         (Layout::make_output_section): Set have_stabstr_section_ if we see
9656         a .stab*str section.
9657         (Layout::finalize): Call link_stabs_sections.
9658         (Layout::link_stabs_sections): New file.
9659         * layout.h (class Layout): Add have_stabstr_section_ field.
9660         Declare link_stabs_sections.
9661
9662 2009-06-23  Doug Kwan  <dougkwan@google.com>
9663
9664         * Makefile.am (libgold_a_LIBADD): New.
9665         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9666         * Makefile.in: Regenerate.
9667         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9668         * configure: Regenerate.
9669         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9670         * fileread.cc: Include sys/state.h
9671         * gold.h: Declare memmem and strndup if found missing.
9672         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9673
9674 2009-06-23  Ian Lance Taylor  <iant@google.com>
9675
9676         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9677         * configure: Rebuild.
9678
9679 2009-06-23  Ian Lance Taylor  <iant@google.com>
9680
9681         PR 10147
9682         * object.cc (Object::section_contents): Don't try to get a view if
9683         the section has length zero.
9684         (Object::handle_gnu_warning_section): If the section is empty, use
9685         the name of the section as the warning.
9686
9687 2009-06-23  Ian Lance Taylor  <iant@google.com>
9688
9689         PR 10133
9690         * stringpool.h (class Stringpool_template): Add optimize_ field.
9691         (Stringpool_template::set_optimize): New function.
9692         * stringpool.cc (Stringpool_template::Stringpool_template):
9693         Initialize optimize_ field.
9694         (Stringpool_template::set_string_offsets): Test local optimize
9695         fild rather than parameter.
9696         * layout.cc (Layout::Layout): Call set_optimize on the section
9697         name stringpool.
9698
9699 2009-06-22  Ian Lance Taylor  <iant@google.com>
9700
9701         PR 10030
9702         * yyscript.y: Parse TARGET.
9703         * script.cc (script_set_target): New function.
9704         * script-c.h (script_set_target): Declare.
9705         * options.cc (General_options::string_to_object_format): Rename
9706         from string_to_object_format in anonymous namespace.  Change
9707         callers.
9708         * options.h (class General_options): Declare
9709         string_to_object_format.
9710
9711 2009-06-22  Ian Lance Taylor  <iant@google.com>
9712
9713         * script-sections.cc (Script_sections::create_segments): Don't put
9714         program headers in a PT_LOAD segment if -n or -N.
9715
9716 2009-06-22  Ian Lance Taylor  <iant@google.com>
9717
9718         PR 10141
9719         * options.h (class General_options): Add -z lazy and -z now.  Sort
9720         -z options into alphabetical order.
9721         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9722
9723 2009-06-21  Ian Lance Taylor  <iant@google.com>
9724
9725         * layout.cc (Layout::make_output_section): Call
9726         Target::new_output_section.
9727         (Layout::attach_allocated_section_to_segment): Put large section
9728         sections in a separate load segment with the large segment flag
9729         set.
9730         (Layout::segment_precedes): Sort large data segments after other
9731         load segments.
9732         (align_file_offset): New static function.
9733         (Layout::set_segment_offsets): Use align_file_offset.
9734         * output.h (class Output_section): Add is_small_section_ and
9735         is_large_section_ fields.
9736         (Output_section::is_small_section): New function.
9737         (Output_section::set_is_small_section):  New function.
9738         (Output_section::is_large_section): New function.
9739         (Output_section::set_is_large_section): New function.
9740         (Output_section::is_large_data_section): New function.
9741         (class Output_segment): Add is_large_data_segment_ field.
9742         (Output_segment::is_large_data_segment): New function.
9743         (Output_segment::set_is_large_data_segment): New function.
9744         * output.cc (Output_section::Output_section): Initialize new
9745         fields.
9746         (Output_segment::Output_segment): Likewise.
9747         (Output_segment::add_output_section): Add assertion that large
9748         data sections always go in large data segments.  Force small data
9749         sections to the end of the list of data sections.  Force small BSS
9750         sections to the start of the list of BSS sections.  For large BSS
9751         sections to the end of the list of BSS sections.
9752         * symtab.h (class Symbol): Declare is_common_shndx.
9753         (Symbol::is_defined): Check Symbol::is_common_shndx.
9754         (Symbol::is_common): Likewise.
9755         (class Symbol_table): Define enum Commons_section_type.  Update
9756         declarations.  Add small_commons_ and large_commons_ fields.
9757         * symtab.cc (Symbol::is_common_shndx): New function.
9758         (Symbol_table::Symbol_table): Initialize new fields.
9759         (Symbol_table::add_from_object): Put small and large common
9760         symbols in the right list.
9761         (Symbol_table::sized_finalized_symbol): Check
9762         Symbol::is_common_shndx.
9763         (Symbol_table::sized_write_globals): Likewise.
9764         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9765         common symbol lists.  Don't call do_allocate_commons_list if the
9766         list is empty.
9767         (Symbol_table::do_allocate_commons_list): Remove is_tls
9768         parameter.  Add comons_section_type parameter.  Change all
9769         callers.  Handle small and large common symbols.
9770         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9771         Symbol::is_common_shndx.
9772         * resolve.cc (symbol_to_bits): Likewise.
9773         * target.h (Target::small_common_shndx): New function.
9774         (Target::small_common_section_flags): New function.
9775         (Target::large_common_shndx): New function.
9776         (Target::large_common_section_flags): New function.
9777         (Target::new_output_section): New function.
9778         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9779         small_common_section_flags, and large_common_section_flags
9780         fields.
9781         (Target::do_new_output_section): New virtual function.
9782         * arm.cc (Target_arm::arm_info): Initialize new fields.
9783         * i386.cc (Target_i386::i386_info): Likewise.
9784         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9785         Likewise.
9786         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9787         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9788         (Target_x86_64::do_new_output_section): New function.
9789         * configure.ac: Define conditional MCMODEL_MEDIUM.
9790         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9791         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9792         (large_LDFLAGS): Define.
9793         * testsuite/large.c: New file.
9794         * testsuite/testfile.cc (Target_test::test_target_info):
9795         Initialize new fields.
9796         * configure, testsuite/Makefile.in: Rebuild.
9797
9798 2009-06-05  Doug Kwan  <dougkwan@google.com>
9799
9800         * Makefile.am (CCFILES): Add target.cc.
9801         * Makefile.in: Regenerate.
9802         * i386.cc (class Target_i386): Define new virtual method to
9803         override do_is_local_label_name in parent.
9804         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9805         local symbols if --discard-locals or -X is given.
9806         * options.h (class General_options): Declare new options
9807         '--discard-locals' and '-X' for discarding locals.
9808         * target.h (class Target): Define new methods is_local_label_name.
9809         Declare new virtual method do_is_local_label_name.
9810         * target.cc: New file.
9811         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9812         (check_SCRIPTS): Add discard_locals_test.sh.
9813         (check_DATA): Add discard_local_tests.syms.
9814         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9815         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9816         * testsuite/Makefile.in: Regenerate.
9817         * testsuite/discard_locals_test.c: New file.
9818         * testsuite/discard_locals_test.sh: Same.
9819
9820 2009-06-05  Doug Kwan  <dougkwan@google.com>
9821
9822         * object.cc (Sized_relobj::Sized_relobj): Initialize
9823         discarded_eh_frame_shndx_ to -1U.
9824         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9825         section.
9826         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9827         a discarded .eh_frame section.
9828         (Sized_relobj::do_finalize_local_symbols): Ditto.
9829         * object.h (class Sized_relobj): Declare new member
9830         discarded_eh_frame_shndx_.
9831         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9832         (local_labels_test.o, local_labels_test): New rules.
9833         * testsuite/Makefile.in: Regenerate.
9834
9835 2009-06-04  Doug Kwan  <dougkwan@google.com>
9836
9837         * layout.cc (Layout::section_name_mapping): Add mapping for
9838         special ARM sections.
9839
9840 2009-06-03  Doug Kwan  <dougkwan@google.com>
9841
9842         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9843         (utils::has_overflow): Same.
9844
9845 2009-06-03  Ian Lance Taylor  <iant@google.com>
9846
9847         * layout.cc (Layout::section_name_mapping): New array, replacing
9848         Layout::linkonce_mapping.
9849         (Layout::section_name_mapping_count): New variable, replacing
9850         Layout::linkonce_mapping_count.
9851         (Layout::linkonce_output_name): Remove.
9852         (Layout::output_section_name): Rewrite.
9853         * layout.h (class Layout): Rename Linkonce_mapping to
9854         Section_name_mapping, linkonce_mapping to section_name_mapping,
9855         linkonce_mapping_count to section_name_mapping_count.  Don't
9856         declare linkonce_output_name.
9857
9858 2009-06-03  Doug Kwan  <dougkwan@google.com>
9859
9860         * gold/arm.cc (namespace utils): New.
9861         (Target_arm::reloc_is_non_pic): Define new method.
9862         (class Arm_relocate_functions): New.
9863         (Target_arm::Relocate::relocate): Handle relocation types used by
9864         Android.
9865
9866 2009-06-03  Ian Lance Taylor  <iant@google.com>
9867
9868         * arm.cc (Target_arm::scan::global): Use || instead of |.
9869
9870 2009-06-02  Doug Kwan  <dougkwan@google.com>
9871
9872         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9873         issued_non_pic_error_.
9874         (class Target_arm::Scan): Declare new method check_non_pic.
9875         Define new method symbol_needs_plt_entry.
9876         Declare new data member issued_non_pic_error_.
9877         (class Target_arm::Relocate): Declare new method
9878         should_apply_static_reloc.
9879         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9880         (Target_arm::Scan::check_non_pic): Define new method.
9881         (Target_arm::Scan::local): Handle a small subset of reloc types used
9882         by Android.
9883         (Target_arm::Scan::local): Same.
9884         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9885
9886 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9887
9888         * incremental.cc (Incremental_inputs::report_command_line): Filter
9889         out --incremental-* options.
9890
9891 2009-05-29  Doug Kwan  <dougkwan@google.com>
9892
9893         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9894         template class.
9895         (class Target_arm): Update comment.
9896         (Target_arm::Target_arm): Initialize new data members GOT_,
9897         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9898         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9899         and Target_arm::rel_dyn_section.
9900         Declare new_enum Target_arm::Got_type.
9901         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9902         and DYNBSS_.
9903         Update commments for member do_dynsym_value.
9904         (Target_arm::got_size, Target_arm::plt_section,
9905         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9906         new methods inside class defintion.
9907         (Target_arm::got_section): Define new method.
9908         (Target_arm::rel_dyn_section): Same.
9909         (Output_data_plt_arm): New template class.
9910         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9911         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9912         (Output_data_plt_arm::add_entry): Same.
9913         (Output_data_plt_arm::first_plt_entry): Define new
9914         static data member for PLT instruction template.
9915         (Output_data_plt_arm::plt_entry): Same.
9916         (Output_data_plt_arm::do_write): Define new method.
9917         (Target_arm::make_plt_entry): Same.
9918         (Target_arm::do_finalize_sections): Same.
9919         (Target_arm::do_dynsym_value): Same.
9920
9921 2009-05-28  Doug Kwan  <dougkwan@google.com>
9922
9923         * Makefile.am (TARGETSOURCES): Add arm.cc.
9924         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9925         * Makefile.in: Regenerate.
9926         * arm.cc: New file.
9927         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9928
9929 2009-05-26  Doug Kwan  <dougkwan@google.com>
9930
9931         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9932         (General_options::check_excluded_libs): Strip off directories in
9933         archive name before matching like GNU ld does.
9934         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9935         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9936         (exclude_libs_test_LDFLAGS): Add linker option
9937         -Wl,--exclude-libs,libexclude_libs_test_3
9938         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9939         an explicit archive without using -l.
9940         (alt/libexclude_libs_test_3.a): New make rule.
9941         * testsuite/Makefile.in: Regenerate.
9942         * testsuite/exclude_libs_test.c : Declare lib3_default().
9943         (main): Call it.
9944         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9945         * exclude_libs_test_3.c: New file.
9946
9947 2009-05-26  Nick Clifton  <nickc@redhat.com>
9948
9949         * po/id.po: New Indonesian translation.
9950         * po/gold.pot: Updated template file.
9951
9952 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9953
9954         * testsuite/Makefile.am: Add -ffunction-sections to compile
9955         gc_comdat_test files.  Add -Wl,--gc-sections to build
9956         gc_comdat_test.
9957         * testsuite/Makefile.in: Regenerate.
9958         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9959
9960 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9961
9962         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9963         kept comdat section was garbage collected.
9964         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9965         * testsuite/Makefile.in: Regenerate.
9966         * testsuite/gc_comdat_test.sh: New file.
9967         * testsuite/gc_comdat_test_1.cc: New file.
9968         * testsuite/gc_comdat_test_2.cc: New file.
9969
9970 2009-05-19  Doug Kwan  <dougkwan@google.com>
9971
9972         * archive.cc (Archive::Archive): Move constructor from archive.h
9973         to here.  Initialize no_export_.
9974         (Archive::get_elf_object_for_member): Set no_export flag of object.
9975         * archive.h (Archive::Archive): Move constructor body to
9976         archive.cc.
9977         (Archive::no_export): New method.
9978         (Archive::no_export_): New field.
9979         * object.h (Object::Object): Initialize no_export_ to false.
9980         (Object::no_export, Object::set_no_export): New methods.
9981         (Object::no_export_): New field.
9982         * options.cc (General_options::parse_exclude_libs): New method.
9983         (General_options::check_excluded_libs) Same.
9984         * options.h (exclude_libs): New option.
9985         (General_options::check_excluded_libs): New method declaration.
9986         (General_options::excluded_libs_): New field.
9987         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9988         default or protected visibility if an object has no-export flag set.
9989         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9990         (check_SCRIPTS): Add exclude_libs_test.sh.
9991         (check_DATA): Add exclude_libs_test.syms.
9992         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9993         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9994         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9995         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9996         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9997         libexclude_libs_test_2.a): New rules.
9998         * testsuite/Makefile.in: Regenerate.
9999         * testsuite/exclude_libs_test.c: New file.
10000         * testsuite/exclude_libs_test.sh: Ditto.
10001         * testsuite/exclude_libs_test_1.c: Ditto.
10002         * testsuite/exclude_libs_test_2.c: Ditto.
10003
10004 2009-05-15  Ian Lance Taylor  <iant@google.com>
10005
10006         * configure.ac: Check for declarations for cases where libiberty.h
10007         checks HAVE_DECL_xxx.
10008         * configure, config.in: Rebuild.
10009
10010 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10011
10012         * gold.h (Incremental_argument_list): Remove (invalid) forward
10013         declaration.
10014         * incremental.cc (Incremental_inputs::report_achive): New method.
10015         (Incremental_inputs::report_object): New method.
10016         (Incremental_inputs::report_script): New method.
10017         (Incremental_inputs::finalize_inputs): New method.
10018         (Incremental_inputs::finalize): Call finalize_inputs().
10019         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10020         Create inputs entries.
10021         * incremental.h (Incremental_input_type): New enum.
10022         (Incremental_inputs::Incremental_input): Initialize new fields.
10023         (Incremental_inputs::report_inputs): New method.
10024         (Incremental_inputs::report_achive): New method.
10025         (Incremental_inputs::report_object): New method.
10026         (Incremental_inputs::report_script): New method.
10027         (Incremental_inputs::finalize_inputs): New method.
10028         (Incremental_inputs::Input_info): New struct.
10029         (Incremental_inputs::Input_info_map): New typedef.
10030         (Incremental_inputs::lock_): New field.
10031         (Incremental_inputs::Inputs_): New field.
10032         (Incremental_inputs::Inputs_map): New field.
10033         * main.cc (main): Call Incremental_input::report_inputs.
10034         * options.h (Input_argument_list): Typedef moved from
10035         Input_arguments.
10036         (Input_file_group::Files): Remove, use ::Input_argument_list.
10037         (Input_file_group::Input_argument_list): Remove, use
10038         ::Input_argument_list.
10039         * plugin.cc (Plugin_manager::add_input_file): Add error in
10040         incremental build.
10041         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10042         functions.
10043         * script.cc (read_input_script): Call
10044         Incremental_input::report_script.
10045         * script.h (Script_info): New class.
10046
10047 2009-04-27  Ian Lance Taylor  <iant@google.com>
10048
10049         * x86_64.cc (do_adjust_output_section): Set entsize to
10050         plt_entry_size.
10051
10052 2009-04-23  Elliott Hughes  <enh@google.com>
10053
10054         * output.cc (Output_file::close): After short writes, continue
10055         writing from the correct offset in the buffer being written.
10056
10057 2009-04-23  Chris Demetriou  <cgd@google.com>
10058
10059         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10060         * configure: Regenerate.
10061         * config.in: Regenerate.
10062         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10063         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10064
10065 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10066
10067         * incremental.cc (Incremental_inputs_header_data): Renamed from
10068         Incremental_input_header_data.
10069         (Incremental_inputs_header_data::data_size): New field.
10070         (Incremental_inputs_header_data::put_input_file_count): Renamed
10071         from input_file_count.
10072         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10073         from command_line_offset.
10074         (Incremental_inputs_header_data::put_reserved): Renamed from
10075         put_reserved.
10076         (Incremental_inputs_entry_data): Renamed from
10077         Incremental_input_entry_data.
10078         (Incremental_inputs_entry_data::data_size): New field.
10079         (Incremental_inputs::report_command_line): New method.
10080         (Incremental_inputs::finalize): New method.
10081         (Incremental_inputs::create_incremental_inputs_data): New method.
10082         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10083         * incremental.h: New file.
10084         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10085        (Layout::finalize): Create incremental inputs section in
10086         incremental builds.
10087        (Layout::create_incremental_info_sections): New method.
10088         * layout.h (Layout::incremental_inputs): New method.
10089        (Layout::create_incremental_info_sections): New method.
10090        (Layout::incremental_inputs_): New field.
10091         * main.cc (main): Notify Incremental_input of the command line.
10092
10093 2009-04-01  Ian Lance Taylor  <iant@google.com>
10094             Mikolaj Zalewski  <mikolajz@google.com>
10095
10096         * gold.h (reserve_unordered_map): Define, three versions, one for
10097         each version of Unordered_map.
10098         * layout.cc (Layout::Layout): Remove options parameter.  Add
10099         number_of_input_files parameter.  Don't initialize options_.
10100         Initialize number_of_input_files_ and resized_signatures_.  Move
10101         sections_are_attached_.
10102         (Layout::layout_group): Reserve space for group_signatures_.
10103         (Layout::find_or_add_kept_section): Change name parameter to be a
10104         reference.  Resize signatures_ map when it gets large enough.
10105         (Layout::layout_eh_frame): Use parameters->options() instead of
10106         this->options_.
10107         (Layout::make_output_section): Likewise.
10108         (Layout::attach_allocated_section_to_segment): Likewise.
10109         (Layout::finalize, Layout::create_executable_stack): Likewise.
10110         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10111         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10112         * layout.h (class Layout): Update declarations.  Remove options_
10113         field.  Add number_of_input_files_ and resized_signatures_
10114         fields.  Move sections_are_attached_ field.
10115         * main.cc (main): Pass number of input files to Layout
10116         constructor.  Don't pass options.
10117
10118 2009-03-30  Ian Lance Taylor  <iant@google.com>
10119
10120         * ffsll.c (ffsll): Correct implementation.
10121
10122 2009-03-27  Ian Lance Taylor  <iant@google.com>
10123
10124         * ffsll.c: New file.
10125         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10126         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10127         * ftruncate.c (ftruncate): Declare before definition.
10128         * mremap.c (mremap): Likewise.
10129         * pread.c (pread): Likewise.
10130         * configure, Makefile.in, config.in: Rebuild.
10131
10132         * mremap.c: New file.
10133         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10134         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10135         (mremap): Declare if HAVE_MREMAP is not defined.
10136         * configure, Makefile.in, config.in: Rebuild.
10137
10138 2009-03-27  Cary Coutant  <ccoutant@google.com>
10139
10140         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10141         position independent.
10142         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10143         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10144
10145 2009-03-24  Cary Coutant  <ccoutant@google.com>
10146
10147         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10148         an executable.
10149         (needs_dynamic_reloc): Likewise.
10150
10151 2009-03-24  Ian Lance Taylor  <iant@google.com>
10152
10153         * yyscript.y (file_cmd): Recognize EXTERN.
10154         (extern_name_list, extern_name_list_body): New nonterminals.
10155         * script.cc (script_add_extern): Define.
10156         * script-c.h (script_add_extern): Declare.
10157
10158 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10159
10160         * object.cc (is_elf_object): Define.
10161         * object.h (is_elf_object): Declare.
10162         * archive.cc (Archive::get_elf_object_for_member): Call
10163         is_elf_object.
10164         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10165
10166 2009-03-24  Elliott Hughes  <enh@google.com>
10167
10168         * output.cc (Output_file::map_anonymous): Define.
10169         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10170         try an anonymous one.  Report the size if the mmap fails.
10171         * output.h (class Output_file): Declare map_anonymous.
10172
10173 2009-03-24  Ian Lance Taylor  <iant@google.com>
10174
10175         * target-select.cc (instantiate_target): Don't acquire the lock if
10176         the instantiated_target_ field has already been set.
10177
10178 2009-03-23  Ian Lance Taylor  <iant@google.com>
10179
10180         * gold-threads.h (class Initialize_lock): Define.
10181         * gold-threads.cc (class Initialize_lock_once): Define.
10182         (initialize_lock_control): New static variable.
10183         (initialize_lock_pointer): New static variable.
10184         (initialize_lock_once): New static function.
10185         (Initialize_lock::Initialize_lock): Define.
10186         (Initialize_lock::initialize): Define.
10187         * target-select.h: Include "gold-threads.h".
10188         (class Target_selector): Add lock_ and initialize_lock_ fields.
10189         Don't define instantiate_target, just declare it.
10190         * target-select.cc (Target_selector::Target_selector): Initialize
10191         new fields.
10192         (Target_selector::instantiate_target): Define.
10193         * descriptors.h: Include "gold-threads.h".
10194         (class Descriptors): Add initialize_lock_ field.
10195         * descriptors.cc (Descriptors::Descriptors): Initialize new
10196         field.
10197         (Descriptors::open): Use initialize_lock_ field
10198         * errors.h (class Errors): Add initialize_lock_ field.
10199         * errors.cc (Errors::Errors): Initialize new field.
10200         (Errors::initialize_lock): Use initialize_lock_ field.
10201         * powerpc.cc (class Target_selector_powerpc): Remove
10202         instantiated_target_ field.  In do_recognize call
10203         instantiate_target rather than do_instantiate_target.  In
10204         do_instantiate_target just allocate a new target.
10205         * sparc.cc (class Target_selector_sparc): Likewise.
10206
10207         * freebsd.h: New file.
10208         * i386.cc: Include "freebsd.h".
10209         (Target_i386): Derive from Target_freebsd rather than
10210         Sized_target.
10211         (Target_selector_i386): Derive from Target_selector_freebsd rather
10212         than Target_selector.
10213         * x86_64.cc: Include "freebsd.h".
10214         (Target_x86_64): Derive from Target_freebsd rather than
10215         Sized_target.
10216         (Target_selector_x86_64): Derive from Target_selector_freebsd
10217         rather than Target_selector.
10218         * target.h (class Target): Add adjust_elf_header and
10219         do_adjust_elf_header.
10220         * output.cc (Output_file_header:: do_sized_write): Call target
10221         adjust_elf_header routine.
10222         * configure.tgt: Set targ_osabi.
10223         * configure.ac: Define GOLD_DEFAULT_OSABI.
10224         * parameters.cc (Parameters::default_target): Pass
10225         GOLD_DEFAULT_OSABI to select_target.
10226         * target-select.h (class Target_selector): Make instantiate_target
10227         protected rather than private.
10228         * Makefile.am (HFILES): Add freebsd.h.
10229         * configure, Makefile.in, config.in: Rebuild.
10230
10231         * merge.cc (do_add_input_section): Correct pend value.  Change
10232         message about last entry not being null terminated from error to
10233         warning.
10234
10235 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10236
10237         * incremental.cc: New file.
10238         * Makefile.am (CCFILES): Add incremental.cc.
10239         * Makefile.in: Rebuild.
10240
10241 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10242
10243         * layout.cc (Layout::output_section_name): Preserve names
10244         of '.note.' sections.
10245
10246 2009-03-19  Ian Lance Taylor  <iant@google.com>
10247
10248         * descriptors.cc (Descriptors::open): Check that the options are
10249         valid before using them.
10250
10251 2009-03-18  Ian Lance Taylor  <iant@google.com>
10252
10253         * script-sections.h: Include <list>.
10254         (class Script_sections): Change Sections_elements from std::vector
10255         to std::list.  Typedef public Elements_iterator.  Add
10256         orphan_section_placement_, data_segment_align_start_, and
10257         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10258         field.
10259         * script-sections.cc (class Orphan_section_placement): New class.
10260         (class Sections_element): Add virtual functions is_relro and
10261         orphan_section_init.  Remove virtual function place_orphan_here.
10262         (class Output_section_definition): Add is_relro and
10263         orphan_section_init.  Remove place_orphan_here.
10264         (class Orphan_output_section): Likewise.
10265         (Script_sections::Script_sections): Update for field changes.
10266         (Script_sections::data_segment_align): Set saw_data_segment_align_
10267         and data_segment_align_start_, not data_segment_align_index.
10268         (Script_sections::data_segment_relro_end): Check
10269         saw_data_segment_align_.  Use data_segment_align_start_ rather
10270         than data_segment_align_index_.
10271         (Script_sections::place_orphan): Rewrite to use
10272         Orphan_section_placement.
10273
10274 2009-03-17  Ian Lance Taylor  <iant@google.com>
10275
10276         * archive.cc (Archive::add_symbols): Check for a version attached
10277         to the symbol name in the archive map.
10278         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10279         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10280         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10281         (ver_test_11.a): New target.
10282         * testsuite/Makefile.in: Rebuild.
10283
10284         * configure.ac: Check for chsize and posix_fallocate.  Replace
10285         ftruncate.
10286         * ftruncate.c: New file, from gnulib.
10287         * output.cc (posix_fallocate): Define dummy version if not
10288         HAVE_POSIX_FALLOCATE.
10289         (Output_file::map): Call posix_fallocate rather than lseek and
10290         write.
10291         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10292         * configure, Makefile.in, config.in: Rebuild.
10293
10294 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10295
10296         * layout.h (Layout::create_note): Add section_name parameter.
10297         * layout.cc (Layout::create_note): Likewise.
10298         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10299
10300 2009-03-17  Ian Lance Taylor  <iant@google.com>
10301
10302         * descriptors.cc: Include "options.h".
10303         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10304         (Descriptors::open): Always use O_CLOEXEC when opening a new
10305         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10306         then set FD_CLOEXEC.
10307
10308         * sparc.cc (class Target_sparc): Add has_got_section.
10309         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10310         make sure we have a GOT section.
10311
10312         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10313         (Target_sparc::Scan::local): Likewise.
10314         (Target_sparc::Scan::global): Likewise.
10315         (Target_sparc::Relocate::relocate): Likewise.
10316         (Target_sparc::Relocate::relocate_tls): Likewise.
10317
10318         * symtab.cc (Symbol_table::define_default_version): New function,
10319         broken out of add_from_object.
10320         (Symbol_table::add_from_object): Call define_default_version.
10321         (Symbol_table::define_special_symbol): Add resolve_oldsym
10322         parameter.  Change all callers.  If the version for a symbol comes
10323         from a version script, resolve it with the symbol with the same
10324         name with no version.  Also add the symbol without a version if
10325         appropriate.
10326         (do_define_in_output_data): If resolving with oldsym, don't delete
10327         sym.
10328         (do_define_in_output_segment): Likewise.
10329         (do_define_as_constant): Likewise.
10330         * symtab.h (class Symbol_table): Update declarations.
10331
10332 2009-03-13  Ian Lance Taylor  <iant@google.com>
10333
10334         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10335         (Read_symbols::requeue): New function.
10336         (Read_symbols::do_read_symbols): If make_elf_object fails because
10337         the target type is not configured, and the file was searched for,
10338         issue a warning and retry with the next directory.
10339         (Add_symbols::run): If the file has an incompatible format, and
10340         it was searched for, requeue the Read_symbols task.  On error,
10341         release the object.
10342         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10343         dirindex parameter to constructor.  Change all callers.  Declare
10344         incompatible_warning and requeue.
10345         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10346         input_argument_ and input_group_ fields.  Add them to
10347         constructor.  Change all callers.
10348         (class Read_script): Add dirindex_ field.  Add it to constructor.
10349         Change all callers.
10350         * archive.cc (Archive::setup): Remove input_objects parameter.
10351         Change all callers.
10352         (Archive::get_file_and_offset): Likewise.
10353         (Archive::read_all_symbols): Likewise.
10354         (Archive::read_symbols): Likewise.
10355         (Archive::get_elf_object_for_member): Remove input_objects
10356         parameter.  Add punconfigured parameter.  Change all callers.
10357         (Archive::add_symbols): Change return type to bool.  Check return
10358         value of include_member.
10359         (Archive::include_all_members): Likewise.
10360         (Archive::include_member): Change return type to bool.  Return
10361         false if first included object has incompatible target.  Set
10362         included_member_ field.
10363         (Add_archive_symbols::run): If add_symbols returns false, requeue
10364         Read_symbols task.
10365         * archive.h (class Archive): Add included_member_ field.
10366         Initialize it in constructor.  Add input_file and searched_for
10367         methods.  Update declarations.
10368         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10369         input_argument_ fields.  Add them to constructor.  Change all
10370         callers.
10371         * script.cc: Include "target-select.h".
10372         (class Parser_closure): Add skip_on_incompatible_target_ and
10373         found_incompatible_target_ fields.  Add
10374         skip_on_incompatible_target parameter to constructor.  Change all
10375         callers.  Add methods skip_on_incompatible_target,
10376         clear_skip_on_incompatible_target, found_incompatible_target, and
10377         set_found_incompatible_target.
10378         (read_input_script): Add dirindex parameter.  Change all callers.
10379         If parser finds an incompatible target, requeue Read_symbols
10380         task.
10381         (script_set_symbol): Clear skip_on_incompatible_target in
10382         closure.
10383         (script_add_assertion, script_parse_option): Likewise.
10384         (script_start_sections, script_add_phdr): Likewise.
10385         (script_check_output_format): New function.
10386         * script.h (read_input_script): Update declaration.
10387         * script-c.h (script_check_output_format): Declare.
10388         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10389         (ignore_cmd): Remove OUTPUT_FORMAT.
10390         * fileread.cc (Input_file::Input_file): Add explicit this.
10391         (Input_file::will_search_for): New function.
10392         (Input_file::open): Add pindex parameter.  Change all callers.
10393         * fileread.h (class Input_file): Add input_file_argument method.
10394         Declare will_search_for.  Update declarations.
10395         * object.cc (make_elf_object): Add punconfigured parameter.
10396         Change all callers.
10397         * object.h (class Object): Make input_file public.  Add
10398         searched_for method.
10399         (make_elf_object): Update declaration.
10400         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10401         restart search.
10402         * dirsearch.h (class Dirsearch): Update declaration.
10403         * options.h (class General_options): Add --warn-search-mismatch.
10404         * parameters.cc (Parameters::is_compatible_target): New function.
10405         * parameters.h (class Parameters): Declare is_compatible_target.
10406         * workqueue.cc (Workqueue::add_blocker): New function.
10407         * workqueue.h (class Workqueue): Declare add_blocker.
10408
10409         * fileread.cc (Input_file::open): Remove options parameter.
10410         Change all callers.
10411         (Input_file::open_binary): Likewise.
10412         * script.cc (read_input_script): Likewise.
10413         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10414         options parameter from constructor.  Change all callers.
10415         (class Read_script): Likewise.
10416         * fileread.h (class Input_file): Update declarations.
10417         * script.h (read_input_script): Update declaration.
10418
10419 2009-03-10  Nick Clifton  <nickc@redhat.com>
10420
10421         * po/es.po: New Spanish translation.
10422
10423 2009-03-06  Cary Coutant  <ccoutant@google.com>
10424
10425         * options.cc (parse_short_option): Keep dash_z from registering itself.
10426
10427 2009-03-03  Ian Lance Taylor  <iant@google.com>
10428
10429         PR 9918
10430         * target-reloc.h (relocate_section): Pass output_section to
10431         relocate.
10432         * i386.cc (Target_i386::should_apply_static_reloc): Add
10433         output_section parameter.  Change all callers.
10434         (Target_i386::Relocate::relocate): Add output_section parameter.
10435         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10436         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10437         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10438         * testsuite/two_file_shared.sh: New script.
10439         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10440         (check_DATA): Add two_file_shared.dbg.
10441         (two_file_shared.dbg): New target.
10442         * testsuite/Makefile.in: Rebuild.
10443
10444 2009-03-01  Ian Lance Taylor  <iant@google.com>
10445
10446         * configure.ac: Check for byteswap.h.
10447         * configure: Rebuild.
10448         * config.in: Rebuild.
10449
10450 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10451
10452         * layout.cc (Layout::find_or_add_kept_section): New function.
10453         (Layout::add_comdat): Removed.
10454         * layout.h (struct Kept_section): Move out of class Layout.
10455         Remove trailing underscores from field names.  Add group_sections
10456         field.  Rename group_ field to is_group.  Change all uses.
10457         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10458         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10459         comdat_groups_ field.
10460         (Sized_relobj::include_section_group): Use
10461         find_or_add_kept_section and Kept_section::group_sections.
10462         (Sized_relobj::include_linkonce_section): Likewise.
10463         * object.cc (class Sized_relobj): Don't define Comdat_group or
10464         Comdat_group_table.  Remove find_comdat_group and
10465         add_comdat_group.  Remove comdat_groups_ field.
10466         * plugin.cc (include_comdat_group): Use
10467         Layout::find_or_add_kept_section.
10468
10469 2009-02-28  Ian Lance Taylor  <iant@google.com>
10470
10471         * README: --gc-sections and map files are now supported.  Document
10472         some build requirements.
10473
10474         PR 6992
10475         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10476         relocatable link set the value of the section symbol to zero.
10477         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10478         relocatable link don't include the section address in the local
10479         symbol value.
10480
10481 2009-02-27  Ian Lance Taylor  <iant@google.com>
10482
10483         PR 6811
10484         * options.h (class Search_directory): Add is_system_directory.
10485         (class General_options): Declare is_in_system_directory.
10486         * options.cc (get_relative_sysroot): Make static.
10487         (get_default_sysroot): Make static.
10488         (General_optoins::is_in_system_directory): New function.
10489         * fileread.cc (Input_file::is_in_system_directory): New function.
10490         * fileread.h (class Input_file): Declare is_in_system_directory.
10491         * object.h (class Object): Add is_in_system_directory.
10492         (class Input_objects): Remove system_library_directory_ field.
10493         * object.cc (Input_objects::add_object): Don't set
10494         system_library_directory_.
10495         (input_objects::found_in_system_library_directory): Remove.
10496         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10497         parameter.  Change all callers.
10498         (Symbol_table::sized_write_globals): Likewise.
10499         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10500         Call Object::is_in_system_directory.
10501         * symtab.h (class Symbol_table): Update declarations.
10502
10503         PR 5990
10504         * descriptors.h (Open_descriptor): Add is_on_stack field.
10505         * descriptors.cc (Descriptors::open): If the descriptor is on the
10506         top of the stack, remove it.  Initialize is_on_stack field.
10507         (Descriptors::release): Only add pod to stack if it is not on the
10508         stack already.
10509         (Descriptors::close_some_descriptor): Clear stack_next and
10510         is_on_stack fields.
10511
10512         PR 7091
10513         * output.cc (Output_section::find_starting_output_address): Rename
10514         from starting_output_address; add PADDR parameter; change return
10515         type.
10516         * output.h (class Output_section): Declare
10517         find_starting_output_address instead of starting_output_address.
10518         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10519         section symbol for which we can't find a merge section.
10520
10521         PR 9836
10522         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10523         hidden or internal, force the symbol to be local.
10524         * resolve.cc (Symbol::override_visibility): Define.
10525         (Symbol::override_base): Use override_visibility.
10526         (Symbol_table::resolve): Likewise.
10527         (Symbol::override_base_with_special): Likewise.
10528         (Symbol_table::override_with_special): If the visibility is hidden
10529         or internal, force the symbol to be local.
10530         * symtab.h (class Symbol): Add set_visibility and
10531         override_visibility.
10532         * testsuite/ver_test_1.sh: New file.
10533         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10534         (check_DATA): Add ver_test_1.syms.
10535         (ver_test_1.syms): New target.
10536         * testsuite/Makefile.in: Rebuild.
10537
10538 2009-02-25  Cary Coutant  <ccoutant@google.com>
10539
10540         * layout.cc (Layout::choose_output_section): Don't rename sections
10541         when using a linker script that has a SECTIONS clause.
10542         * Makefile.in: Regenerate.
10543
10544         * testsuite/Makefile.am (script_test_5.sh): New test case.
10545         * testsuite/Makefile.in: Regenerate.
10546         * testsuite/script_test_5.cc: New file.
10547         * testsuite/script_test_5.sh: New file.
10548         * testsuite/script_test_5.t: New file.
10549
10550 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10551
10552         * archive.cc (Archive::include_member): Update calls to add_symbols.
10553         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10554         the Layout argument.
10555         * dynobj.h (do_add_symbols): Add the Layout argument.
10556         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10557         Layout argument.
10558         * object.h (Object::add_symbols): Add the Layout argument.
10559         (Object::do_add_symbols): Add the Layout argument.
10560         (Sized_relobj::do_add_symbols): Add the Layout argument.
10561         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10562         Unify the two versions.
10563         (Add_plugin_symbols): Remove.
10564         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10565         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10566         (Add_plugin_symbols): Remove.
10567         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10568         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10569         (Add_symbols::run): Make it work with Pulginobj.
10570
10571 2009-02-06  Ian Lance Taylor  <iant@google.com>
10572
10573         * object.cc (Sized_relobj::do_layout): Make info message start
10574         with lower case letter.
10575
10576 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10577
10578         * binary.cc: Fix file comment.
10579
10580         * options.h (enum Incremental_disposition): Define.
10581         (class General_options): Add new options: --incremental,
10582         --incremental_changed, --incremental_unchanged,
10583         --incremental_unknown.  Add incremental_disposition_ and
10584         implicit_incremental_ fields.
10585         (General_options::incremental_disposition): New function.
10586         (class Position_dependent_options): Add incremental_disposition
10587         option.
10588         (Position_dependent_options::copy_from_options): Set incremental
10589         dispositions.
10590         * options.cc (General_options::parse_incremental_changed): New
10591         function.
10592         (General_options::parse_incremental_unchanged): New function.
10593         (General_options::parse_incremental_unknown): New function.
10594         (General_options::General_options): Initialize new fields
10595         incremental_disposition_ and implicit_incremental_.
10596         (General_options::finalize): Check for uasge of --incremental-*
10597         without --incremental.
10598
10599 2009-02-06  Chris Demetriou  <cgd@google.com>
10600
10601         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10602         pointer and to report location as the file name associated with
10603         the symbol.
10604         (gold_undefined_symbol_at_location): New function to replace the
10605         old gold_undefined_symbol functionality.
10606         * target-reloc.h (relocate_section): Update to use
10607         gold_undefined_symbol_at_location.
10608         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10609         Call gold_undefined_symbol function rather than gold_error.
10610         * errors.h (Errors::undefined_symbol): Take location as a
10611         string, rather than calculating it from a relocation.
10612         * errors.cc (Errors::fatal): Print "fatal error:" before the
10613         formatted message.
10614         (Errors::error, Errors::error_at_location): Print "error: "
10615         before the formatted message.
10616         (Errors::undefined_symbol): Take location as a string, rather
10617         than calculating it from a relocation.
10618         (gold_undefined_symbol_at_location): New function akin to
10619         old gold_undefined_symbol, calculates location from relocation.
10620         (gold_undefined_symbol): Change to take only a Symbol pointer
10621         and to report location as the file name associated with the symbol.
10622         * testsuite/debug_msg.sh: Update for changed error messages.
10623         * testsuite/undef_symbol.sh: Likewise.
10624
10625 2009-02-04  Duncan Sands  <baldrick@free.fr>
10626
10627         PR 9812
10628         * reduced_debug_output.h
10629         (Output_reduced_debug_abbrev_section::failed): Use format for
10630         gold_warning.
10631         (Output_reduced_debug_info_section::faild): Likewise.
10632
10633 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10634
10635         * script.cc (Lazy_demangler): New class.
10636         (Version_script_info::get_symbol_version_helper): Demangle a
10637         symbol only once.
10638
10639 2009-01-29  Cary Coutant  <ccoutant@google.com>
10640
10641         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10642         to __tls_get_addr.
10643         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10644
10645 2009-01-28  Ian Lance Taylor  <iant@google.com>
10646
10647         * version.cc (version_string): Bump to 1.9.
10648
10649         * gold.h: Include <cstring> and <stdint.h>.
10650         * version.cc: Include <cstdio>.
10651         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10652         warning.
10653         * reduced_debug_output.cc (insert_into_vector): Rename from
10654         Insert_into_vector; change all callers.  Use Swap_unaligned to
10655         avoid aliasing issue; remove union since it is unnecessary.
10656
10657 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10658
10659         * Makefile.am (CCFILES): Add gc.cc.
10660         (HFILES): Add gc.h.
10661         * Makefile.in: Regenerate.
10662         * gold.cc (Gc_runner): New class.
10663         (queue_initial_tasks): Call garbage collection related tasks
10664         when corresponding options are invoked.
10665         (queue_middle_gc_tasks): New function.
10666         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10667         processed early before laying out sections during garbage collection.
10668         * gold.h (queue_middle_gc_tasks): New function.
10669         (is_prefix_of): Move from "layout.cc".
10670         * i386.cc (Target_i386::gc_process_relocs): New function.
10671         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10672         * main.cc (main): Create object of class "Garbage_collection".
10673         * object.cc (Relobj::copy_symbols_data): New function.
10674         (Relobj::is_section_name_included): New function.
10675         (Sized_relobj::do_layout): Allow this function to be called twice
10676         during garbage collection and defer layout of section during the
10677         first call.
10678         * object.h (Relobj::get_symbols_data): New function.
10679         (Relobj::is_section_name_included): New function.
10680         (Relobj::copy_symbols_data): New function.
10681         (Relobj::set_symbols_data): New function.
10682         (Relobj::get_relocs_data): New function.
10683         (Relobj::set_relocs_data): New function.
10684         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10685         (Relobj::gc_process_relocs): New function.
10686         (Relobj::do_gc_process_relocs): New pure virtual function.
10687         (Relobj::sd_): New data member.
10688         (Sized_relobj::is_output_section_offset_invalid): New function.
10689         (Sized_relobj::do_gc_process_relocs): New function.
10690         * options.h (General_options::gc_sections): Modify to not be a no-op.
10691         (General_options::print_gc_sections): New option.
10692         * plugin.cc (Plugin_finish::run): Remove function call to
10693         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10694         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10695         * reloc.cc (Read_relocs::run): Add task to process relocs and
10696         determine unreferenced sections when doing garbage collection.
10697         (Gc_process_relocs): New class.
10698         (Sized_relobj::do_gc_process_relocs): New function.
10699         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10700         sections that are garbage collected.
10701         * reloc.h (Gc_process_relocs): New class.
10702         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10703         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10704         symbols whose corresponding sections are garbage collected.
10705         (Symbol_table::Symbol_table): Add new parameter for the garbage
10706         collection object.
10707         (Symbol_table::gc_mark_undef_symbols): New function.
10708         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10709         (Symbol_table::gc_mark_dyn_syms): New function.
10710         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10711         as garbage.
10712         (Symbol_table::add_from_object): Likewise.
10713         (Symbol_table::add_from_relobj): When building shared objects, do not
10714         treat externally visible symbols as garbage.
10715         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10716         table information for static and relocatable links.
10717         * symtab.h (Symbol_table::set_gc): New function.
10718         (Symbol_table::gc): New function.
10719         (Symbol_table::gc_mark_undef_symbols): New function.
10720         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10721         (Symbol_table::gc_mark_dyn_syms): New function.
10722         (Symbol_table::gc_): New data member.
10723         * target.h (Sized_target::gc_process_relocs): New pure virtual
10724         function.
10725         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10726         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10727
10728 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10729
10730         * options.h (General_options::gc_sections): Define as a no-op for now.
10731         (General_options::no_keep_memory): Ditto.
10732         (General_options::Bshareable): Define.
10733         * options.cc (General_options::finalize): Honor -Bshareable.
10734
10735 2009-01-20  Andreas Schwab  <schwab@suse.de>
10736
10737         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10738         read the value in the contents, since we don't use it.  Use the
10739         template endianness when writing.
10740         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10741
10742 2009-01-19  Andreas Schwab  <schwab@suse.de>
10743
10744         * configure.tgt (powerpc64-*): Fix targ_obj.
10745
10746 2009-01-15  Ian Lance Taylor  <iant@google.com>
10747
10748         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10749         local symbols when stripping all symbols.
10750
10751 2009-01-14  Cary Coutant  <ccoutant@google.com>
10752
10753         * output.cc (Output_reloc): Add explicit instantiations.
10754
10755 2009-01-14  Cary Coutant  <ccoutant@google.com>
10756
10757         * archive.cc (Archive::get_elf_object_for_member): Remove call
10758         to File_read::claim_for_plugin.
10759         * descriptors.cc (Descriptors::open): Remove reference to
10760         is_claimed.
10761         (Descriptors::claim_for_plugin): Remove.
10762         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10763         (Descriptors::is_claimed): Remove.
10764         (claim_descriptor_for_plugin): Remove.
10765         * fileread.cc (File_read::claim_for_plugin): Remove.
10766         * fileread.h (File_read::claim_for_plugin): Remove.
10767         (File_read::descriptor): Reopen descriptor if necessary.
10768         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10769         (Plugin_manager::all_symbols_read): Add task parameter. Change
10770         all callers.
10771         (Plugin_manager::get_input_file): New function.
10772         (Plugin_manager::release_input_file): New function.
10773         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10774         corresponding data member.
10775         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10776         and pass to base constructor. Change all callers.
10777         (get_input_file, release_input_file): New functions.
10778         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10779         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10780         (Plugin_manager::all_symbols_read): Add task parameter.
10781         (Plugin_manager::get_input_file): New function.
10782         (Plugin_manager::release_input_file): New function.
10783         (Plugin_manager::task_): New data member.
10784         (Pluginobj::Pluginobj): Add filesize parameter.
10785         (Pluginobj::filename): New function.
10786         (Pluginobj::descriptor): New function.
10787         (Pluginobj::filesize): New function.
10788         (Pluginobj::filesize_): New data member.
10789         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10790         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10791         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10792
10793         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10794         with archive libraries.
10795         * testsuite/Makefile.in: Regenerate.
10796         * testsuite/plugin_test.c (struct sym_info): New type.
10797         (get_input_file, release_input_file): New static variables.
10798         (onload): Capture new transfer vector entries.
10799         (claim_file_hook): Stop reading at end of file according to filesize.
10800         Factor out parsing of readelf output into separate function.
10801         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10802         APIs and get the source file name from the symbol table.  Convert
10803         source file name to corresponding object file name.  Print info
10804         message when adding new input files.
10805         (parse_readelf_line): New function.
10806         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10807         * testsuite/plugin_test_2.sh: Likewise.
10808         * testsuite/plugin_test_3.sh: Likewise.
10809         * testsuite/plugin_test_4.sh: New test case.
10810
10811 2009-01-07  Ian Lance Taylor  <iant@google.com>
10812
10813         * version.cc (version_string): Bump to 1.8.
10814
10815 2008-12-23  Cary Coutant  <ccoutant@google.com>
10816
10817         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10818         * plugin.cc (Plugin_manager::finish): Rename as
10819         layout_deferred_objects.  Move cleanup to separate function.
10820         (Plugin_manager::cleanup): New function.
10821         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10822         separately.
10823         * plugin.h (Plugin_manager::finish): Rename as
10824         layout_deferred_objects.
10825         (Plugin_manager::cleanup): New function.
10826         (Plugin_manager::cleanup_done): New field.
10827
10828 2008-12-23  Cary Coutant  <ccoutant@google.com>
10829
10830         * plugin.cc (is_visible_from_outside): New function.
10831         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10832         so we don't return "IR only" status for exported symbols or -r links.
10833
10834         * testsuite/Makefile.am (plugin_test_3): New test case.
10835         * testsuite/Makefile.in: Regenerate.
10836         * testsuite/plugin_test_3.sh: New file.
10837
10838 2008-12-22  Cary Coutant  <ccoutant@google.com>
10839
10840         * object.cc (Sized_relobj::layout_section): New function.
10841         (Sized_relobj::do_layout): Defer layout of input sections until after
10842         plugin has provided replacement files.
10843         (Sized_relobj::do_layout_deferred_sections): New function.
10844         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10845         (Relobj::layout_deferred_sections): New function.
10846         (Relobj::do_layout_deferred_sections): New function.
10847         (Sized_relobj::do_layout_deferred_sections): New function.
10848         (Sized_relobj::layout_section): New function.
10849         (Sized_relobj::Deferred_layout): New structure.
10850         (Sized_relobj::deferred_layout_): New field.
10851         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10852         Change all callers.  Layout deferred sections.
10853         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10854         references.
10855         (Plugin_hook::run): Move code from do_plugin_hook inline.
10856         (Plugin_hook::do_plugin_hook): Remove.
10857         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10858         (Plugin_manager::finish): Renamed, was cleanup.
10859         (Plugin_manager::should_defer_layout): New function.
10860         (Plugin_manager::add_deferred_layout_object): New function.
10861         (Plugin_manager::Deferred_layout_list): New type.
10862         (Plugin_manager::deferred_layout_objects_): New field.
10863         (Plugin_hook::do_plugin_hook): Remove.
10864
10865 2008-12-17  Ian Lance Taylor  <iant@google.com>
10866
10867         * options.h (class General_options): Add --no case for
10868         --export-dynamic.
10869
10870 2008-12-16  Cary Coutant  <ccoutant@google.com>
10871
10872         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10873         vector.
10874         (Plugin_manager::claim_file): Create plugin object even if
10875         plugin did not call the add_symbols callback.
10876         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10877         asking for more symbols than were added.
10878         * testsuite/Makefile.am (plugin_test_1): Add test case with
10879         no global symbols.
10880         (empty.syms): New target.
10881         * testsuite/Makefile.in: Regenerate.
10882         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10883         message. Don't call add_symbols if no globals.
10884         (all_symbols_read_hook): Don't provide replacement for empty
10885         claimed file.
10886
10887 2008-12-12  Ian Lance Taylor  <iant@google.com>
10888
10889         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10890         r_type == 0 for a local symbol with r_sym == 0.
10891         (scan_relocatable_relocs): Pass r_sym to
10892         local_non_section_strategy.
10893         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10894         r_sym parameter.
10895
10896         * configure.ac: Update test for TLS descriptors: they are
10897         supported as of glibc 2.9.
10898         * configure: Rebuild.
10899
10900 2008-12-11  Ian Lance Taylor  <iant@google.com>
10901
10902         PR 7091
10903         * target-reloc.h (Default_scan_relocatable_relocs): For each
10904         function, map r_type == 0 to RELOC_DISCARD.
10905
10906 2008-12-10  Cary Coutant  <ccoutant@google.com>
10907
10908         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10909         object to override a kept COMDAT group from a plugin object.
10910
10911 2008-12-09  Ian Lance Taylor  <iant@google.com>
10912
10913         PR 7088
10914         * yyscript.y (file_cmd): Handle INPUT.
10915
10916         * testsuite/initpri1.c: Change all declarations to be full
10917         prototypes by adding void, to avoid compiler warnings.
10918
10919 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10920
10921         * options.cc (General_options::parse_plugin_opt): New.
10922         (General_options::add_plugin): The argument now is just the filename.
10923         (General_options::add_plugin_option): New.
10924         * options.h (plugin_opt): New.
10925         (add_plugin): Change argument name.
10926         (add_plugin_option): New.
10927         * plugin.cc (Plugin::load): Don't parse the plugin option.
10928         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10929         (Plugin::add_option): New.
10930         (Plugin::args_): Change type.
10931         (Plugin::filename_): New.
10932         (Plugin_manager::add_plugin_option): New.
10933         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10934         * testsuite/Makefile.in: Regenerate.
10935
10936 2008-12-05  Cary Coutant  <ccoutant@google.com>
10937
10938         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10939         Handle --strip-lto-sections option.
10940         * options.h (strip_lto_sections): New option.
10941
10942 2008-12-01  Cary Coutant  <ccoutant@google.com>
10943
10944         * plugin.cc (ld_plugin_message): Change format parameter to const.
10945         Fix mismatch between new[] and delete.
10946
10947 2008-11-14  Cary Coutant  <ccoutant@google.com>
10948
10949         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10950         instead of -1U.
10951
10952 2008-11-05  Craig Silverstein  <csilvers@google.com>
10953
10954         * options.cc (General_options::parse_dynamic_list): New function.
10955         * options.h (General_options): New flags dynamic_list,
10956         dynamic_list_data, dynamic_list_cpp_new, and
10957         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10958         (General_options::in_dynamic_list): New function.
10959         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10960         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10961         (Lex::can_continue_name): Likewise.
10962         (yylex): Likewise.
10963         (read_script_file): New parameter script_options.
10964         (read_dynamic_list): New function.
10965         (Script_options::define_dynamic_list): New function.
10966         (dynamic_list_keyword_parsecodes): New variable.
10967         (dynamic_list_keywords): New variable.
10968         * script.h (Script_options::define_dynamic_list): New function
10969         prototype.
10970         (read_dynamic_list): New function prototype.
10971         * symtab.cc (strprefix): New macro.
10972         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10973         dynamic_list_data, dynamic_list_cpp_new, and
10974         dynamic_list_cpp_typeinfo.
10975         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10976         (dynamic_list_expr): New rule.
10977         (dynamic_list_nodes): Likewise.
10978         (dynamic_list_node): Likewise.
10979         * testsuite/Makefile.am (dynamic_list): New test.
10980         * testsuite/Makefile.in: Regenerated.
10981         * testsuite/dynamic_list.t: New file.
10982         * testsuite/dynamic_list.sh: New file.
10983
10984 2008-11-05  Craig Silverstein  <csilvers@google.com>
10985
10986         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10987         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10988         (t11_last): Likewise.
10989         * testsuite/ver_test_6.c (main): Likewise.
10990
10991 2008-10-07  Cary Coutant  <ccoutant@google.com>
10992
10993         * options.c (General_options::finalize): Add check for -static and
10994         -shared.
10995         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10996         is not empty.
10997
10998 2008-10-02  Cary Coutant  <ccoutant@google.com>
10999
11000         * plugin.cc (make_sized_plugin_object): Fix conditional
11001         compilation to work when not all targets are enabled.
11002
11003 2008-09-29  Cary Coutant  <ccoutant@google.com>
11004
11005         * archive.cc (Archive::get_file_and_offset): Use filename instead
11006         of name to get library path.
11007         (Archive::include_member): Unlock external member of a thin archive.
11008
11009         * testsuite/Makefile.am (TEST_AR): New variable.
11010         (thin_archive_test_1): New test.
11011         (thin_archive_test_2): New test.
11012         * testsuite/Makefile.in: Regenerate.
11013         * testsuite/thin_archive_main.cc: New file.
11014         * testsuite/thin_archive_test_1.cc: New file.
11015         * testsuite/thin_archive_test_2.cc: New file.
11016         * testsuite/thin_archive_test_3.cc: New file.
11017         * testsuite/thin_archive_test_4.cc: New file.
11018
11019 2008-09-29  Cary Coutant  <ccoutant@google.com>
11020
11021         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11022         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11023         instead of -1U.
11024         (Sized_relobj::do_finalize_local_symbols): Likewise.
11025         (Sized_relobj::map_to_kept_section): Likewise.
11026         * object.h (Sized_relobj::invalid_address): New constant.
11027         (Sized_relobj::do_output_section_offset): Check for invalid_address
11028         and return -1ULL.
11029         * output.cc (Output_reloc::local_section_offset): Use constant
11030         invalid_address instead of -1U.
11031         (Output_reloc::get_address): Likewise.
11032         (Output_section::output_address): Change -1U to -1ULL.
11033         * output.h (Output_reloc::invalid_address): New constant.
11034         * reloc.cc (Sized_relobj::write_sections): Use constant
11035         invalid_address instead of -1U.
11036         (Sized_relobj::relocate_sections): Likewise.
11037         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11038         values for merge sections.
11039         * target-reloc.h (relocate_for_relocatable): Use constant
11040         invalid_address instead of -1U.
11041
11042 2008-09-19  Cary Coutant  <ccoutant@google.com>
11043
11044         Add plugin functionality for link-time optimization (LTO).
11045         * configure.ac (plugins): Add --enable-plugins option.
11046         * configure: Regenerate.
11047         * config.in: Regenerate.
11048         * Makefile.am (LIBDL): New variable.
11049         (CCFILES): Add plugin.cc.
11050         (HFILES): Add plugin.h.
11051         (ldadd_var): Add LIBDL.
11052         * Makefile.in: Regenerate.
11053
11054         * archive.cc: Include "plugin.h".
11055         (Archive::setup): Don't preread archive symbols when using a plugin.
11056         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11057         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11058         files.
11059         (Archive::include_member): Add symbols from plugin objects.
11060         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11061         * descriptors.cc (Descriptors::open): Check for file descriptors
11062         abandoned by plugins.
11063         (Descriptors::claim_for_plugin): New function.
11064         * descriptors.h (Descriptors::claim_for_plugin): New function.
11065         (Open_descriptor::is_claimed): New field.
11066         (claim_descriptor_for_plugin): New function.
11067         * fileread.cc (File_read::claim_for_plugin): New function.
11068         * fileread.h (File_read::claim_for_plugin): New function.
11069         (File_read::descriptor): New function.
11070         * gold.cc: Include "plugin.h".
11071         (queue_initial_tasks): Add task to call plugin hooks for generating
11072         new object files.
11073         * main.cc: Include "plugin.h".
11074         (main): Load plugin libraries.
11075         * object.h (Pluginobj): Declare.
11076         (Object::pluginobj): New function.
11077         (Object::do_pluginobj): New function.
11078         (Object::set_target): New function.
11079         * options.cc: Include "plugin.h".
11080         (General_options::parse_plugin): New function.
11081         (General_options::General_options): Initialize plugins_ field.
11082         (General_options::add_plugin): New function.
11083         * options.h (Plugin_manager): Declare.
11084         (General_options): Add --plugin option.
11085         (General_options::has_plugins): New function.
11086         (General_options::plugins): New function.
11087         (General_options::add_plugin): New function.
11088         (General_options::plugins_): New field.
11089         * plugin.cc: New file.
11090         * plugin.h: New file.
11091         * readsyms.cc: Include "plugin.h".
11092         (Read_symbols::do_read_symbols): Check for archive before checking
11093         for ELF file.  Call plugin hooks to claim files.
11094         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11095         from a real object file; force override when processing replacement
11096         files.
11097         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11098         (Symbol::init_base_object): Likewise.
11099         (Symbol::init_base_output_data): Likewise.
11100         (Symbol::init_base_output_segment): Likewise.
11101         (Symbol::init_base_constant): Likewise.
11102         (Symbol::init_base_undefined): Likewise.
11103         (Symbol::output_section): Assert that object is not a plugin.
11104         (Symbol_table::add_from_pluginobj): New function.
11105         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11106         undefined.
11107         (Symbol_table::sized_write_globals): Likewise.
11108         (Symbol_table::add_from_pluginobj): Instantiate template.
11109         * symtab.h (Sized_pluginobj): Declare.
11110         (Symbol::in_real_elf): New function.
11111         (Symbol::set_in_real_elf): New function.
11112         (Symbol::in_real_elf_): New field.
11113         (Symbol_table::add_from_pluginobj): New function.
11114
11115         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11116         (LIBDL): New variable.
11117         (LDADD): Add LIBDL.
11118         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11119         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11120         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11121         (MOSTLYCLEANFILES): Likewise.
11122         * testsuite/Makefile.in: Regenerate.
11123         * testsuite/plugin_test.c: New file.
11124         * testsuite/plugin_test_1.sh: New file.
11125         * testsuite/plugin_test_2.sh: New file.
11126
11127 2008-09-16  Ian Lance Taylor  <iant@google.com>
11128
11129         * target-reloc.h (relocate_section): Check whether a symbol is
11130         defined by the ABI before reporting an undefined symbol error.
11131         * target.h (Target::is_defined_by_abi): Make parameter const.
11132         (Target::do_is_defined_by_abi): Likewise.
11133         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11134         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11135         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11136         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11137         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11138         * testsuite/Makefile.in: Rebuild.
11139
11140         * fileread.cc (make_view): Add casts to avoid warning.
11141
11142 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11143
11144         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11145         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11146
11147 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11148
11149         * options.h (General_options::output_is_executable): New.
11150         (General_options::output_is_pie): New.
11151         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11152         for shared libraries.
11153         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11154
11155 2008-09-11  Chris Demetriou  <cgd@google.com>
11156
11157         * options.h (origin): New -z option.
11158         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11159         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11160         in DT_FLAGS_1.
11161
11162 2008-09-05  Cary Coutant  <ccoutant@google.com>
11163
11164         * fileread.cc (File_read::make_view): Add check for attempt to map
11165         beyond end of file.
11166
11167 2008-09-05  Cary Coutant  <ccoutant@google.com>
11168
11169         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11170         explicit instantiations.
11171
11172 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11173
11174         PR gold/6858
11175         * options.cc (General_options::finalize): Allow undefined symbols
11176         in shlibs if linking -shared.
11177
11178         PR gold/6859
11179         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11180         symbols as not needing a dynsym entry.
11181
11182 2008-08-20  Craig Silverstein  <csilvers@google.com>
11183
11184         * fileread.cc (File_read::open): Do not lock the file unless it
11185         was successfully opened.
11186
11187 2008-08-14  Cary Coutant  <ccoutant@google.com>
11188
11189         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11190         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11191         * testsuite/tls_test.cc (struct int128): 128-bit struct
11192         for testing TLS relocs with non-zero addend.
11193         (v12): New TLS variable.
11194         (t12): New test.
11195         (t_last): Add check for v12.
11196         * testsuite/tls_test.h (t12): New function.
11197         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11198
11199 2008-08-13  Ian Lance Taylor  <iant@google.com>
11200
11201         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11202         set tls_segment_ or relro_segment_.
11203         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11204         when appropriate.
11205         * output.h (Output_section::clear_is_relro): New function.
11206         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11207         sections specially even when output_data_ is empty.
11208         (Output_segment::maximum_alignment): When first section is relro,
11209         only force alignment for PT_LOAD segments.
11210         * script.cc (script_data_segment_align): New function.
11211         (script_data_segment_relro_end): New function.
11212         * script-c.h (script_data_segment_align): Declare.
11213         (script_data_segment_relro_end): Declare.
11214         * script-sections.h (class Script_sections): Declare
11215         data_segment_align and data_segment_relro_end.  Add fields
11216         segment_align_index_ and saw_relro_end_.
11217         * script-sections.cc (class Sections_element): Add set_is_relro
11218         virtual function.  Add new bool* parameter to place_orphan_here.
11219         Add get_output_section virtual function.
11220         (class Output_section_definition): Add set_is_relro.  Add new
11221         bool* parameter to place_orphan_here.  Add get_output_section.
11222         Add is_relro_ field.
11223         (Output_section_definition::Output_section_definition): Initialize
11224         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11225         and is_relro_ fields.
11226         (Output_section_definition::place_orphan_here): Add is_relro
11227         parameter.
11228         (Output_section_definition::set_section_addresses): Set relro for
11229         output section.
11230         (Output_section_definition::alternate_constraint): Likewise.
11231         (class Orphan_output_section): Add new bool* parameter to
11232         place_orphan_here.  Add get_output_section.
11233         (Orphan_output_section::place_orphan_here): Add is_relro
11234         parameter.
11235         (Script_sections::Script_sections): Initialize
11236         data_segment_align_index_ and saw_relro_end_.
11237         (Script_sections::data_segment_align): New function.
11238         (Script_sections::data_segment_relro_end): New function.
11239         (Script_sections::place_orphan): Set or clear is_relro.
11240         (Script_sections::set_section_addresses): Force alignment of first
11241         TLS section.
11242         * yyscript.y (exp): Call script_data_segment_align and
11243         script_data_segment_relro_end.
11244         * testsuite/relro_script_test.t: New file.
11245         * testsuite/relro_test.cc (using_script): Declare.
11246         (t1, t2): Test using_script.
11247         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11248         (relro_script_test_SOURCES): Define.
11249         (relro_script_test_DEPENDENCIES): Define.
11250         (relro_script_test_LDFLAGS): Define.
11251         (relro_script_test_LDADD): Define.
11252         (relro_script_test.so): New target.
11253         * testsuite/Makefile.in: Rebuild.
11254
11255 2008-08-06  Cary Coutant <ccoutant@google.com>
11256
11257         * archive.cc (Archive::total_archives, Archive::total_members)
11258         (Archive::total_members_loaded): New variables.
11259         (Archive::setup): Add parameter.  Add option to preread
11260         archive symbols.
11261         (Archive::read_armap): Add counter.
11262         (Archive::get_file_and_offset): New function.
11263         (Archive::get_elf_object_for_member): New function.
11264         (Archive::read_all_symbols): New function.
11265         (Archive::read_symbols): New function.
11266         (Archive::add_symbols): Add counters.
11267         (Archive::include_all_members): Use armap to find members if it's
11268         already built.
11269         (Archive::include_member): Skip reading symbols if already read.
11270         Factored code into Archive::get_file_and_offset and
11271         Archive::get_elf_object_for_member.  Changed call to
11272         Mapfile::report_include_archive_member.
11273         (Archive::print_stats): New function.
11274         * archive.h: Declare Object and Read_symbols_data classes.
11275         (Archive::Archive): Add initializers for new members.
11276         (Archive::setup): Add parameter.
11277         (Archive::print_stats): New function.
11278         (Archive::total_archives, Archive::total_members)
11279         (Archive::total_members_loaded): New variables.
11280         (Archive::get_file_and_offset): New function.
11281         (Archive::get_elf_object_for_member): New function.
11282         (Archive::read_all_symbols): New function.
11283         (Archive::read_symbols): New function.
11284         (Archive::Archive_member): New class.
11285         (Archive::members_): New member.
11286         (Archive::num_members_): New member.
11287         * main.cc: Include archive.h.
11288         (main): Call Archive::print_stats.
11289         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11290         archive parameter; member_name is now the fully-decorated name.
11291         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11292         * options.h: (General_options): Add --preread-archive-symbols option.
11293         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11294         Archive::setup.
11295
11296 2008-08-04  Ian Lance Taylor  <iant@google.com>
11297
11298         * symtab.h (Symbol::use_plt_offset): New function.
11299         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11300         * powerpc.cc (Relocate::relocate): Likewise.
11301         * sparc.cc (Relocate::relocate): Likewise.
11302         * x86_64.cc (Relocate::relocate): Likewise.
11303         * testsuite/weak_plt.sh: New test.
11304         * testsuite/weak_plt_main.cc: New test.
11305         * testsuite/weak_plt_shared.cc: New test.
11306         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11307         (check_PROGRAMS): Add weak_plt.
11308         (check_DATA): Add weak_plt_shared.so.
11309         (weak_plt_main_pic.o, weak_plt): New targets.
11310         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11311         * testsuite/Makefile.in: Rebuild.
11312
11313         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11314         gcctestdir/ld.
11315         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11316         * testsuite/Makefile.in: Rebuild.
11317
11318 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11319
11320         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11321         * Makefile.in: Regenerate.
11322         * po/POTFILES.in: Regenerate.
11323
11324 2008-07-29  Ian Lance Taylor  <iant@google.com>
11325
11326         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11327         symbols before other symbols.
11328         * testsuite/script_test_2.cc (test_addr): Declare.
11329         (test_addr_alias): Declare.
11330         (main): Check that test_addr and test_addr_alias have the right
11331         values.
11332         * testsuite/script_test_2.t: Define test_addr_alias and
11333         test_addr.
11334
11335 2008-07-24  Ian Lance Taylor  <iant@google.com>
11336
11337         PR 5990
11338         * descriptors.cc: New file.
11339         * descriptors.h: New file.
11340         * gold-threads.h (class Hold_optional_lock): New class.
11341         * fileread.cc: Include "descriptors.h".
11342         (File_read::~File_read): Release descriptor rather than closing
11343         it.
11344         (File_read::open) [file]: Call open_descriptor rather than open.
11345         Set is_descriptor_opened_.
11346         (File_read::open) [memory]: Assert that descriptor is not open.
11347         (File_read::reopen_descriptor): New function.
11348         (File_read::release): Release descriptor.
11349         (File_read::do_read): Make non-const.  Reopen descriptor.
11350         (File_read::read): Make non-const.
11351         (File_read::make_view): Reopen descriptor.
11352         (File_read::do_readv): Likewise.
11353         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11354         Update declarations.
11355         * layout.cc: Include "descriptors.h".
11356         (Layout::create_build_id): Use open_descriptor rather than open.
11357         * output.cc: Include "descriptors.h".
11358         (Output_file::open): Use open_descriptor rather than open.
11359         * archive.cc (Archive::const_iterator): Change Archive to be
11360         non-const.
11361         (Archive::begin, Archive::end): Make non-const.
11362         (Archive::count_members): Likewise.
11363         * archive.h (class Archive): Update declarations.
11364         * object.h (Object::read): Make non-const.
11365         * Makefile.am (CCFILES): Add descriptors.cc.
11366         (HFILES): Add descriptors.h.
11367         * Makefile.in: Rebuild.
11368
11369         PR 6716
11370         * gold.h: Always include <clocale>.  Add Solaris workarounds
11371         following code in binutils/sysdep.h.
11372
11373         PR 6048
11374         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11375         this->eh_frame_hdr_ is NULL before using it.
11376
11377         * dynobj.cc (Versions::Versions): Update comment.
11378
11379         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11380         the base version name.
11381
11382         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11383         array size plus one.
11384         (Stringpool_template::set_string_offsets): Subtract one from key
11385         before using it as an array index.
11386         (Stringpool_template::get_offset_with_length): Likewise.
11387         (Stringpool_template::write_to_buffer): Likewise.
11388         * stringpool.h (Stringpool_template::get_offset_from_key):
11389         Likewise.
11390
11391 2008-07-23  Ian Lance Taylor  <iant@google.com>
11392
11393         PR 6658
11394         * object.h (Merged_symbol_value::value): Do our best to handle a
11395         negative addend.
11396
11397         PR 6647
11398         * script.cc (Version_script_info::get_versions): Don't add empty
11399         version tag to return value.
11400         (Version_script_info::get_symbol_version_helper): Change return
11401         type to bool.  Add pversion parameter.  Change all callers.
11402         (script_register_vers_node): Don't require a non-NULL tag.
11403         * script.h (class Version_script_info): Update declarations.
11404         (Version_script_info::get_symbol_version): Change return type to
11405         bool.  Add version parameter.  Change all callers.
11406         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11407         handling.  Handle an empty version from a version script.
11408         (Symbol_table::define_special_symbol): Likewise.
11409         * testsuite/ver_test_10.script: New file.
11410         * testsuite/ver_test_10.sh: New file.
11411         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11412         (check_DATA): Add ver_test_10.syms.
11413         (ver_test_10.syms, ver_test_10.so): New target.
11414         * testsuite/Makefile.in: Rebuild.
11415
11416 2008-07-23  Simon Baldwin  <simonb@google.com>
11417
11418         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11419         to zero for undefined symbols from dynamic libraries.
11420
11421 2008-07-23  Ian Lance Taylor  <iant@google.com>
11422
11423         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11424         Change all callers.
11425         * symtab.h (class Symbol_table): Update declaration.
11426         * testsuite/ver_test_9.cc: New file.
11427         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11428         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11429         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11430         (ver_test_9.so, ver_test_9.o): New targets.
11431         * testsuite/Makefile.in: Rebuild.
11432
11433 2008-07-22  Ian Lance Taylor  <iant@google.com>
11434
11435         * options.h (class General_options): Define --check-sections.
11436         * layout.cc (Layout::set_segment_offsets): Handle
11437         --check-sections.
11438
11439         * options.h (class General_options): Define -n/--nmagic and
11440         -N/--omagic.
11441         * options.cc (General_options::finalize): For -n/--nmagic or
11442         -N/--omagic, set -static.
11443         * layout.cc (Layout::attach_allocated_section_to_segment): If
11444         -N/--omagic, don't put read-only and read-write sections in
11445         different segments.
11446         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11447         finding a read-only segment.
11448         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11449         don't set the minimum segment alignment to the common page size,
11450         and don't set the file offset to the address modulo the page size.
11451         * script-sections.cc (Script_sections::create_segments): If
11452         -n/--omagic, don't put read-only and read-write sections in
11453         different segments.
11454
11455         * cref.cc: New file.
11456         * cref.h: New file.
11457         * options.h (class General_options): Add --print-symbol-counts.
11458         * main.cc (main): Issue defined symbol report if requested.
11459         * archive.cc (Archive::interpret_header): Make into a const member
11460         function.
11461         (Archive::add_symbols): Call Input_objects::archive_start and
11462         archive_stop.
11463         (Archive::const_iterator): Define new class.
11464         (Archive::begin, Archive::end): New functions.
11465         (Archive::include_all_members): Rewrite to use iterator.
11466         (Archive::count_members): New function.
11467         * archive.h (class Archive): Update declarations.
11468         (Archive::filename): New function.
11469         * object.cc: Include "cref.h".
11470         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11471         (Sized_relobj::do_get_global_symbol_counts): New function.
11472         (Input_objects::add_object): Add object to cross-referencer.
11473         (Input_objects::archive_start): New function.
11474         (Input_objects::archive_stop): New function.
11475         (Input_objects::print_symbol_counts): New function.
11476         * object.h: Declare Cref and Archive.
11477         (Object::get_global_symbol_counts): New function.
11478         (Object::do_get_global_symbol_counts): New pure virtual function.
11479         (class Sized_relobj): Add defined_count_ field.  Update
11480         declarations.
11481         (class Input_objects): Add cref_ field.  Update constructor.
11482         Update declarations.
11483         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11484         defined_count_.
11485         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11486         symbol counts.
11487         (Sized_dynobj::do_get_global_symbol_counts): New function.
11488         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11489         defined_count_.  Update declarations.  Define Symbols typedef.
11490         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11491         parameter.  Change all callers.
11492         (Symbol_table::add_from_dynobj): Add sympointers and defined
11493         parameters.  Change all callers.
11494         * symtab.h (class Symbol_table): Update declarations.
11495         * Makefile.am (CCFILES): Add cref.cc.
11496         (HFILES): Add cref.h.
11497         * Makefile.in: Rebuild.
11498
11499 2008-07-22  Simon Baldwin  <simonb@google.com>
11500
11501         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11502         to zero when writing undefined symbols.
11503
11504 2008-07-22  Ian Lance Taylor  <iant@google.com>
11505
11506         * output.cc (Output_section::add_input_section): Don't try to
11507         merge empty merge sections.
11508
11509 2008-07-21  Craig Silverstein  <csilvers@google.com>
11510
11511         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11512         Include symbol version in error message.
11513
11514 2008-07-20  Chris Demetriou  <cgd@google.com>
11515
11516         * configure.ac (gold_cv_c_random_seed): New configured variable.
11517         (RANDOM_SEED_CFLAGS): New substituted variable.
11518         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11519         * configure: Rebuild.
11520         * Makefile.in: Likewise.
11521         * testsuite/Makefile.in: Likewise.
11522
11523 2008-07-18  Ian Lance Taylor  <iant@google.com>
11524
11525         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11526         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11527         * testsuite/ver_test_main.cc (main): Call t4.
11528         (t4, t4_2a): Define.
11529         * testsuite/ver_test_2.cc (t4_2): Define.
11530         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11531         * testsuite/ver_test_4.cc (t4_2a): Define.
11532         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11533         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11534
11535 2008-07-17  Ian Lance Taylor  <iant@google.com>
11536
11537         * dynobj.cc (Versions::add_def): If we give an error about a
11538         missing version, go ahead and create the version anyhow.
11539
11540 2008-07-10  Ian Lance Taylor  <iant@google.com>
11541
11542         Handle output sections with more than 0x7fffffff bytes.
11543         * object.h (class Relobj): Change map_to_output_ to
11544         output_sections_, and just keep a section pointer.  Change all
11545         uses.  Move comdat group support to Sized_relobj.
11546         (Relobj::is_section_specially_mapped): Remove.
11547         (Relobj::output_section): Remove poff parameter.  Change all
11548         callers.
11549         (Relobj::output_section_offset): New function.
11550         (Relobj::set_section_offset): Rewrite.
11551         (Relobj::map_to_output): Remove.
11552         (Relobj::output_sections): New function.
11553         (Relobj::do_output_section_offset): New pure virtual function.
11554         (Relobj::do_set_section_offset): Likewise.
11555         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11556         group support from Relobj.  Update declarations.
11557         (Sized_relobj::get_output_section_offset): New function.
11558         (Sized_relobj::do_output_section_offset): New function.
11559         (Sized_relobj::do_set_section_offset): New function.
11560         * object.cc (Relobj::output_section_address): Remove.
11561         (Sized_relobj::Sized_relobj): Initialize new fields.
11562         (Sized_relobj::include_section_group): Cast find_kept_object to
11563         Sized_relobj.
11564         (Sized_relobj::include_linkonce_section): Likewise.
11565         (Sized_relobj::do_layout): Use separate arrays for output section
11566         and output offset.
11567         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11568         output_sections.
11569         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11570         output_sections and section_offsets.
11571         (Sized_relobj::write_local_symbols): Likewise.
11572         (map_to_kept_section): Compute output address directly.
11573         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11574         output_sections and section_offsets.
11575         (Sized_relobj::write_sections): Likewise.
11576         (Sized_relobj::relocate_sections): Likewise.
11577         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11578         * output.h (class Output_reloc): Update declarations.  Change
11579         u2_.relobj to Sized_relobj*.
11580         (class Output_data_reloc): Change add functions to use
11581         Sized_relobj*.
11582         * output.cc (Output_reloc::Output_reloc): Change relobj to
11583         Sized_relobj*.
11584         (Output_reloc::local_section_offset): Change return type to
11585         Elf_Addr.  Use get_output_section_offset.
11586         (Output_reloc::get_address): Likewise.
11587         (Output_section::is_input_address_mapped): Don't call
11588         is_section_specially_mapped.
11589         (Output_section::output_offset): Likewise.
11590         (Output_section::output_address): Likewise.
11591         (Output_section::starting_output_address): Likewise.
11592         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11593         parameter to Sized_relobj*.
11594         (Copy_relocs::need_copy_reloc): Likewise.
11595         (Copy_relocs::save): Likewise.
11596         * copy-relocs.h (class Copy_relocs): Update declarations.
11597         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11598         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11599         * target-reloc.h (relocate_for_relocatable): Change
11600         offset_in_output_section type to Elf_Addr.  Change code that uses
11601         it as well.
11602         * layout.cc (Layout::layout): Always set *off.
11603         * mapfile.cc (Mapfile::print_input_section): Use
11604         output_section_offset.
11605         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11606         Sized_relobj*.
11607         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11608         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11609         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11610
11611 2008-07-03  Ian Lance Taylor  <iant@google.com>
11612
11613         * layout.cc (Layout::include_section): Do not discard unrecognized
11614         SHT_STRTAB sections.
11615
11616 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11617
11618         * script.cc (Lex::can_continue_name): Make '?' allowable in
11619         version-script names.
11620         * testsuite/version_script.map: Change glob pattern to use '?'
11621
11622 2008-06-30  Manish Singh  <yosh@gimp.org>
11623
11624         PR 6585
11625         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11626         Correct typo.
11627
11628 2008-06-30  Ian Lance Taylor  <iant@google.com>
11629
11630         PR 6660
11631         PR 6682
11632         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11633         versions]: Don't try to read the value in the contents, since we
11634         don't use it.  Use the template endianness when writing.
11635
11636 2008-06-25  Cary Coutant  <ccoutant@google.com>
11637
11638         * fileread.cc (File_read::make_view): Assert on zero-length view.
11639         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11640         symbol table when there are no symbols to read.
11641
11642 2008-06-23  Craig Silverstein  <csilvers@google.com>
11643
11644         * version.cc (version_string): Bump to 1.7
11645
11646 2008-06-18  Craig Silverstein  <csilvers@google.com>
11647
11648         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11649         constant 0xFFFF to type Valtype.
11650         (Powerpc_relocate_functions::rel16_ha): Likewise.
11651
11652 2008-06-17  Ian Lance Taylor  <iant@google.com>
11653
11654         * output.h (Output_section::Input_section): Initialize p2align_ to
11655         zero for Output_section_data constructors.
11656         (Output_section::Input_section::addralign): If not an input
11657         section, return the alignment of the Output_section_data.
11658         * testsuite/copy_test.cc: New file.
11659         * testsuite/copy_test_1.cc: New file.
11660         * testsuite/copy_test_2.cc: New file.
11661         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11662         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11663         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11664         (copy_test_1_pic.o, copy_test_1.so): New targets.
11665         (copy_test_2_pic.o, copy_test_2.so): New targets.
11666         * testsuite/Makefile.in: Rebuild.
11667
11668         * script-sections.cc (Script_sections::place_orphan): Initialize
11669         local variable exact.
11670
11671 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11672
11673         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11674
11675 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11676             David S. Miller  <davem@davemloft.net>
11677
11678         * powerpc.cc: New file.
11679         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11680         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11681         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11682         * Makefile.in: Rebuild.
11683
11684 2008-06-09  Ian Lance Taylor  <iant@google.com>
11685
11686         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11687         <exception>.
11688         (throwing, orig_terminate): New static variables.
11689         (terminate_handler): New static function.
11690         (t2): Set terminate handler.
11691
11692 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11693
11694         PR 6584
11695         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11696         alignment.
11697
11698 2008-05-30  Cary Coutant  <ccoutant@google.com>
11699
11700         * archive.cc (Archive::include_all_members) Correct to step
11701         over symbol table and extended name table in thin archives.
11702
11703 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11704
11705         PR 6407
11706         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11707         calculation.
11708
11709 2008-05-28  Caleb Howe  <cshowe@google.com>
11710
11711         * reduced_debug_output.cc: New file.
11712         * reduced_debug_output.h: New file.
11713         * options.h (class General_options): Add --strip-debug-non-line.
11714         * options.cc (General_options::finalize): Add strip_debug_non_line
11715         to the strip heirarchy.
11716         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11717         fields.
11718         * layout.cc: Include "reduced_debug_output.h".
11719         (Layout::Layout): Initialize new fields.
11720         (line_only_debug_sections): New static array.
11721         (is_lines_only_debug_sections): New static inline function.
11722         (Layout::include_section): Handle --strip-debug-non-line.
11723         (Layout::make_output_section): If --strip-debug-non-line, build
11724         new output sections for .debug_abbrev and .debug_info.
11725         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11726         gold.  Warn about possible overflow.
11727         (read_signed_LEB_128): Likewise.
11728         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11729         (read_signed_LEB_128): Declare.
11730         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11731         (HFILES): Add reduced_debug_output.h.
11732         * Makefile.in: Rebuild.
11733
11734 2008-05-21  Ian Lance Taylor  <iant@google.com>
11735
11736         * mapfile.cc: New file.
11737         * mapfile.h: New file.
11738         * options.h (class General_options): Add -M/--print-map and -Map.
11739         * options.cc (General_options::finalize): Make -M equivalent to
11740         -Map -.
11741         * main.cc: Include <cstdio> and "mapfile.h".
11742         (main): Open mapfile if requested.
11743         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11744         constructor.  Change caller.
11745         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11746         (queue_middle_tasks): Likewise.
11747         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11748         declarations.
11749         * archive.cc: Include "mapfile.h".
11750         (Archive::add_symbols): Add mapfile parameter.  Change all
11751         callers.  Pass mapfile, symbol, and reason to include_member.
11752         (Archive::include_all_members): Add mapfile parameter.  Change all
11753         callers.
11754         (Archive::include_member): Add mapfile, sym, and why parameters.
11755         Change all callers.  Report inclusion to map file.
11756         * archive.h: Include "fileread.h".
11757         (class Archive): Update declarations.
11758         (Archive::file): New const method.
11759         (class Add_archive_symbols): Add mapfile_ field.  Update
11760         constructor.  Change all callers.
11761         * readsyms.h (class Read_symbols): Likewise.
11762         (class Finish_group): Likewise.
11763         (class Read_script): Likewise.
11764         * common.cc: Include "mapfile.h".
11765         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11766         all callers.
11767         (Symbol_table::do_allocate_commons): Likewise.
11768         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11769         symbol allocation to mapfile.
11770         * common.h (class Allocate_commons_task): Add mapfile_ field.
11771         Update constructor.  Change all callers.
11772         * symtab.h (class Symbol_table): Update declarations.
11773         * layout.cc: Include "mapfile.h".
11774         (Layout_task_runner::run): Print information to mapfile.
11775         (Layout::create_gold_note): Change Output_data_fixed_space to
11776         Output_data_zero_fill.
11777         (Layout::create_build_id): Likewise.
11778         (Layout::print_to_mapfile): New function.
11779         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11780         constructor.  Change caller.
11781         (class Layout): Declare print_to_mapfile.
11782         * output.cc (Output_section::Input_section::print_to_mapfile): New
11783         function.
11784         (Output_section::add_input_section): If producing a map, always
11785         add to input_sections_ list.
11786         (Output_section::do_print_to_mapfile): New function.
11787         (Output_segment::print_sections_to_mapfile): New function.
11788         (Output_segment::print_section_list_to_mapfile): New function.
11789         * output.h: Include "mapfile.h".
11790         (Output_data::print_to_mapfile): New function.
11791         (Output_data::do_print_to_mapfile): New virtual function.
11792         (Output_segment_headers::do_print_to_mapfile): New function.
11793         (Output_file_header::do_print_to_mapfile): New function.
11794         (Output_data_const::do_print_to_mapfile): New function.
11795         (class Output_data_const_buffer): Add map_name_ field.  Update
11796         constructor.  Change all callers.  Add do_print_to_mapfile
11797         function.
11798         (class Output_data_fixed_space): Likewise.
11799         (class Output_data_space): Likewise.
11800         (class Output_data_zero_fill): New class.
11801         (Output_data_strtab::do_print_to_mapfile): New function.
11802         (Output_data_reloc_base::do_print_to_mapfile): New function.
11803         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11804         (Output_data_group::do_print_to_mapfile): New function.
11805         (Output_data_got::do_print_to_mapfile): New function.
11806         (Output_data_dynamic::do_print_to_mapfile): New function.
11807         (Output_symtab_xindex::do_print_to_mapfile): New function.
11808         (class Output_section): Declare do_print_to_mapflie.  Declare
11809         print_to_mapfile in Input_section.
11810         (class Output_segment): Declare new functions.
11811         * object.h (Sized_relobj::symbol_count): New function.
11812         * script-sections.cc
11813         (Output_section_element_dot_assignment::set_section_addresses):
11814         Change Output_data_fixed_space to Output_data_zero_fill.
11815         (Output_data_expression::do_print_to_mapfile): New function.
11816         * script.cc (read_input_script): Add mapfile parameter.  Change
11817         all callers.
11818         * script.h (read_input_script): Update declaration.
11819         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11820         (Eh_frame::do_print_to_mapfile): New function.
11821         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11822         (Output_merge_string::do_print_to_mapfile): New function.
11823         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11824         function.
11825         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11826         function.
11827         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11828         function.
11829         * Makefile.am (CCFILES): Add mapfile.cc.
11830         (HFILES): Add mapfile.h.
11831         * Makefile.in: Rebuild.
11832
11833 2008-05-19  Ian Lance Taylor  <iant@google.com>
11834
11835         * options.h (class General_options): Add -z relro.
11836         * layout.cc (Layout::Layout): Initialize relro_segment_.
11837         (Layout::add_output_section_data): Return the output section.
11838         (Layout::make_output_section): Rcognize relro sections and mark
11839         them appropriately.
11840         (Layout::attach_allocated_section_to_segment): Put relro sections
11841         in a PT_GNU_RELRO segment.
11842         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11843         section as relro.
11844         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11845         PT_TLS segments.
11846         (Layout::linkonce_mapping): Map d.rel.ro.local to
11847         .data.rel.ro.local.
11848         (Layout::output_section_name): Us .data.rel.ro.local for any
11849         section which begins with that.
11850         * layout.h (class Layout): Update add_output_section_data
11851         declaration.  Add relro_segment_ field.
11852         * output.cc (Output_section::Output_section): Initialize is_relro_
11853         and is_relro_local_ fields.
11854         (Output_segment::add_output_section): Group relro sections.
11855         (Output_segment::is_first_section_relro): New function.
11856         (Output_segment::maximum_alignment): If there is a relro section,
11857         align the segment to the common page size.
11858         (Output_segment::set_section_addresses): Track whether we are
11859         looking at relro sections.  If the last section is a relro
11860         section, align to the common page size.
11861         (Output_segment::set_section_list_addresses): Add in_relro
11862         parameter.  Change all callers.  Align to the page size when
11863         moving from relro to non-relro section.
11864         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11865         segment.
11866         * output.h (class Output_section): Add is_relro_ and
11867         is_relro_local_ fields.
11868         (Output_section::is_relro): New function.
11869         (Output_section::set_is_relro): New function.
11870         (Output_section::is_relro_local): New function.
11871         (Output_section::set_is_relro_local): New function.
11872         (class Output_segment): Update declarations.
11873         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11874         * sparc.cc (Target_sparc::got_section): Likewise.
11875         * x86_64.cc (Target_x86_64::got_section): Likewise.
11876         * testsuite/relro_test_main.cc: New file.
11877         * testsuite/relro_test.cc: New file.
11878         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11879         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11880         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11881         (relro_test.so, relro_test_pic.o): New targets.
11882         * testsuite/Makefile.in: Rebuild.
11883
11884 2008-05-16  Ian Lance Taylor  <iant@google.com>
11885
11886         * output.cc (Output_segment::add_output_section): Remove front
11887         parameter.
11888         * output.h (class Output_segment): Remove
11889         add_initial_output_section and overloaded add_output_section.
11890         Update declaration of remaining add_output_section.
11891         * layout.cc (Layout::create_interp): Call add_output_section
11892         rather than add_initial_output_section.
11893         (Layout::finish_dynamic_section): Likewise.
11894
11895         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11896         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11897         know the dynamic type.
11898         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11899         field.  Initialize it in constructor.
11900         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11901         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11902         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11903         reloc.
11904
11905         * output.cc (Output_reloc::get_address): Change return type to
11906         Elf_Addr.
11907         * output.h (class Output_reloc): Update get_address declaration.
11908         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11909         for section addresses.
11910
11911 2008-05-09  Ian Lance Taylor  <iant@google.com>
11912
11913         PR 6493
11914         * gold.cc (gold_nomem): Use return value of write.
11915
11916 2008-05-08  Ian Lance Taylor  <iant@google.com>
11917
11918         * symtab.c (Symbol::init_base_output_data): Add version
11919         parameter.  Change all callers.
11920         (Symbol::init_base_output_segment): Likewise.
11921         (Symbol::init_base_constant): Likewise.
11922         (Symbol::init_base_undefined): Likewise.
11923         (Sized_symbol::init_output_data): Likewise.
11924         (Sized_symbol::init_output_segment): Likewise.
11925         (Sized_symbol::init_constant): Likewise.
11926         (Sized_symbol::init_undefined): Likewise.
11927         (Symbol_table::do_define_in_output_data): If the new symbol has a
11928         version, mark it as the default.
11929         (Symbol_table::do_define_in_output_segment): Likewise.
11930         (Symbol_table::do_define_as_constant): Likewise.
11931         * symtab.h (class Symbol): Update declarations.
11932         (class Sized_symbol): Likewise.
11933         * resolve.cc (Symbol::override_version): New function.
11934         (Symbol::override_base): Call override_version.
11935         (Symbol::override_base_with_special): Likewise.
11936         * testsuite/ver_script_8.script: New file.
11937         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11938         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11939         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11940         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11941
11942 2008-05-06  Ian Lance Taylor  <iant@google.com>
11943
11944         PR 6049
11945         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11946         functions.
11947         (class General_options): Remove existing --undefined, and add
11948         --no-undefined instead.  Add new --undefined as synonym for -u.
11949         * archive.cc (Archive::add_symbols): Check whether symbol was
11950         named with -u.
11951         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11952         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11953         all uses.  Add IS_UNDEFINED.  Update declarations to split
11954         different versions of init_base.  Declare init_base_undefined.
11955         (Symbol::is_defined): Handle IS_UNDEFINED.
11956         (Symbol::is_undefined): Likewise.
11957         (Symbol::is_weak_undefined): Call is_undefined.
11958         (Symbol::is_absolute): Handle IS_CONSTANT.
11959         (class Sized_symbol): Update declarations to split different
11960         versions of init.  Declare init_undefined.
11961         (class Symbol_table): Declare new functions.
11962         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11963         Change all callers.
11964         (Symbol::init_base_output_data): Likewise.
11965         (Symbol::init_base_output_segment): Likewise.
11966         (Symbol::init_base_constant): Likewise.
11967         (Symbol::init_base_undefined): New function.
11968         (Sized_symbol::init_object): Rename from init.  Change all
11969         callers.
11970         (Sized_symbol::init_output_data): Likewise.
11971         (Sized_symbol::init_output_segment): Likewise.
11972         (Sized_symbol::init_constant): Likewise.
11973         (Sized_symbol::init_undefined): New function.
11974         (Symbol_table::add_undefined_symbols_from_command_line): New
11975         function.
11976         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11977         function.
11978         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11979         (Symbol::output_section): Likewise.
11980         (Symbol::set_output_section): Likewise.
11981         (Symbol_table::sized_finalize_symbol): Likewise.
11982         (Symbol_table::sized_write_globals): Likewise.
11983         * resolve.cc (Symbol_table::should_override): Likewise.
11984         (Symbol::override_base_with_special): Likewise.
11985
11986         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11987         symbol, change it to have default visibility.
11988         * testsuite/protected_1.cc: New file.
11989         * testsuite/protected_2.cc: New file.
11990         * testsuite/protected_3.cc: New file.
11991         * testsuite/protected_main_1.cc: New file.
11992         * testsuite/protected_main_2.cc: New file.
11993         * testsuite/protected_main_3.cc: New file.
11994         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11995         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11996         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11997         (protected_1.so): New target.
11998         (protected_1_pic.o, protected_2_pic.o): New targets.
11999         (protected_3_pic.o): New target.
12000         (check_PROGRAMS): Add protected_2.
12001         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12002         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12003         * testsuite/Makefile.in: Rebuild.
12004
12005         * options.h (DEFINE_var): Add set_user_set_##varname__.
12006         (DEFINE_bool_alias): New macro.
12007         (class General_options): Define -Bstatic using DEFINE_bool_alias
12008         rather than DEFINE_special.  Add --undefined as an alias for -z
12009         defs.
12010         * options.cc (General_options::parse_Bstatic): Remove.
12011
12012         * options.h (class General_options): Add --fatal-warnings.
12013         * main.cc (main): Implement --fatal-warnings.
12014         * errors.h (Errors::warning_count): New function.
12015
12016         * options.h (class General_options): Add -Bsymbolic-functions.
12017         * symtab.h (Symbol::is_preemptible): Check for
12018         -Bsymbolic-functions.
12019
12020 2008-05-05  Ian Lance Taylor  <iant@google.com>
12021
12022         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12023         as noVARNAME rather than no-VARNAME.
12024         (class General_options): Add option -z combreloc.
12025         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12026         get_address.
12027         (Output_reloc::sort_before) [SHT_REL]: New function.
12028         (Output_reloc::sort_before) [SHT_RELA]: New function.
12029         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12030         Sort_relocs_comparison.
12031         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12032         parameter.  Change all callers.
12033         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12034         sort_relocs parameter.  Change all callers.
12035         * output.cc (Output_reloc::get_address): New function, broken out
12036         of write_rel.
12037         (Output_reloc::write_rel): Call it.
12038         (Output_reloc::compare): New function.
12039         (Output_data_reloc_base::do_write): Optionally sort relocs.
12040
12041         * configure.ac: If targ_extra_obj is set, link it in.
12042         * configure.tgt: Initialize all variables.
12043         (x86_64*): Set targ_extra_obj and targ_extra_size.
12044         * configure: Rebuild.
12045
12046         * object.cc (Sized_relobj::include_section_group): Adjust section
12047         indexes read from group data.  Build vector to pass to
12048         layout_group.
12049         * layout.cc (Layout::layout_group): Add flags and shndxes
12050         parameters.  Remove contents parameter.  Change caller.  Update
12051         explicit instantiations.
12052         * layout.h (class Layout): Update layout_group declaration.
12053         * output.cc (Output_data_group::Output_data_group): Add flags and
12054         input_shndxes parameters.  Remove contents parameter.  Change
12055         caller.
12056         (Output_data_group::do_write): Change input_sections_ to
12057         input_shndxes_.
12058         * output.h (class Output_data_group): Update constructor
12059         declaration.  Rename input_sections_ to input_shndxes_.
12060         * testsuite/many_sections_test.cc: Add template.
12061
12062 2008-04-30  Cary Coutant  <ccoutant@google.com>
12063
12064         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12065
12066         * layout.cc (Layout::include_section): Refactored check for debug
12067         info section.
12068         (Layout::add_comdat): Add new parameters.  Change type
12069         of signature parameter.  Add object and shndx to signatures table.
12070         (Layout::find_kept_object): New function.
12071         * layout.h: Include <cstring>.
12072         (Layout::is_debug_info_section): New function.
12073         (Layout::add_comdat): Add new parameters.
12074         (Layout::find_kept_object): New function.
12075         (Layout::Kept_section): New struct.
12076         (Layout::Signatures): Change type of map range.
12077         * object.cc (Relobj::output_section_address): New function.
12078         (Sized_relobj::include_section_group): Add new parameters.  Change
12079         calls to Layout::add_comdat.  Change to build table of kept comdat
12080         groups and table mapping discarded sections to kept sections.
12081         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12082         (Sized_relobj::do_layout): Change calls to include_section_group and
12083         include_linkonce_section.
12084         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12085         value to zero when section is discarded.
12086         (Sized_relobj::map_to_kept_section): New function.
12087         * object.h (Relobj::output_section_address): New function.
12088         (Relobj::Comdat_group): New type.
12089         (Relobj::find_comdat_group): New function.
12090         (Relobj::Comdat_group_table): New type.
12091         (Relobj::Kept_comdat_section): New type.
12092         (Relobj::Kept_comdat_section_table): New type.
12093         (Relobj::add_comdat_group): New function.
12094         (Relobj::set_kept_comdat_section): New function.
12095         (Relobj::get_kept_comdat_section): New function.
12096         (Relobj::comdat_groups_): New field.
12097         (Relobj::kept_comdat_sections_): New field.
12098         (Symbol_value::input_value): Update comment.
12099         (Sized_relobj::map_to_kept_section) New function.
12100         (Sized_relobj::include_linkonce_section): Add new parameter.
12101         * target-reloc.h (Comdat_behavior): New type.
12102         (get_comdat_behavior): New function.
12103         (relocate_section): Add code to map a discarded section to the
12104         corresponding kept section when applying a relocation.
12105
12106 2008-04-30  Craig Silverstein  <csilvers@google.com>
12107
12108         * dwarf_reader.cc (next_generation_count): New static var.
12109         (Addr2line_cache_entry): New struct.
12110         (addr2line_cache): New static var.
12111         (Dwarf_line_info::one_addr2line): Added caching.
12112         (Dwarf_line_info::clear_addr2line_cache): New function.
12113         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12114         cache-size parameter.
12115         (Dwarf_line_info::one_addr2line_cache): New function.
12116         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12117         new cache-size argument to one_addr2line(), and clear cache.
12118
12119 2008-04-28  Cary Coutant  <ccoutant@google.com>
12120
12121         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12122         R_386_PC8 relocations.
12123
12124 2008-04-23  Ian Lance Taylor  <iant@google.com>
12125
12126         * object.cc (Sized_relobj::include_section_group): Check for
12127         invalid section group.
12128
12129         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12130         header size.
12131
12132         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12133         than read for file header.
12134         * archive.cc (Archive::include_member): Likewise.
12135
12136 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12137
12138         * aclocal.m4: Regenerate.
12139         * configure: Regenerate.
12140
12141 2008-04-19  Ian Lance Taylor  <iant@google.com>
12142
12143         * version.cc (version_string): Bump to 1.6.
12144
12145         * testsuite/Makefile.am (many_sections_r_test): New target.
12146         (many_sections_r_test_SOURCES): Remove.
12147         (many_sections_r_test_DEPENDENCIES): Remove.
12148         (many_sections_r_test_LDFLAGS): Remove.
12149         (many_sections_r_test_LDADD): Remove.
12150
12151         * object.cc (Sized_relobj::do_add_symbols): Always pass
12152         local_symbol_count_ to add_from_relobj.
12153
12154         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12155         every thousand variables.
12156         * testsuite/Makefile.in: Rebuild.
12157
12158         * object.cc (Xindex::initialize_symtab_xindex): New function.
12159         (Xindex::read_symtab_xindex): New function.
12160         (Xindex::sym_xindex_to_shndx): New function.
12161         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12162         available.
12163         (Sized_relobj::do_initialize_xindex): New function.
12164         (Sized_relobj::do_read_symbols): Adjust section links.
12165         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12166         parameter.  Change all callers.
12167         (Sized_relobj::include_section_group): Adjust section links and
12168         symbol section indexes.
12169         (Sized_relobj::do_layout): Adjust section links.
12170         (Sized_relobj::do_count_local_symbols): Adjust section links and
12171         symbol section indexes.
12172         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12173         ordinary and special symbols.
12174         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12175         dynsym_xindex parameters.  Change all callers.  Adjust section
12176         links.  Use SHN_XINDEX when needed.
12177         (Sized_relobj::get_symbol_location_info): Adjust section links.
12178         Don't get fooled by special symbols.
12179         * object.h (class Xindex): Define.
12180         (class Object): Add xindex_ parameter.  Declare virtual functoin
12181         do_initialize_xindex.
12182         (Object::adjust_sym_shndx): New function.
12183         (Object::set_xindex): New protected function.
12184         (class Symbol_value): Add is_ordinary_shndx_ field.
12185         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12186         (Symbol_value::value): Assert ordinary section.
12187         (Symbol_value::initialize_input_to_output_map): Likewise.
12188         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12189         Change all callers.
12190         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12191         all callers.
12192         (class Sized_relobj): Update declarations.
12193         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12194         parameter.  Change all callers.
12195         (Sized_relobj::adjust_shndx): New function.
12196         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12197         field.
12198         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12199         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12200         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12201         (Sized_dynobj::read_dynsym_section): Adjust section links.
12202         (Sized_dynobj::read_dynamic): Likewise.
12203         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12204         section links.
12205         (Sized_dynobj::do_initialize_xindex): New function.
12206         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12207         do_initialize_xindex.
12208         (Sized_dynobj::adjust_shndx): New function.
12209         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12210         dynsym_xindex_ fields.
12211         (Layout::finalize): Add a call to set_section_indexes before
12212         creating the symtab sections.
12213         (Layout::set_section_indexes): Don't do anything if the section
12214         already has a section index.
12215         (Layout::create_symtab_sections): Add shnum parameter.  Change
12216         caller.  Create .symtab_shndx section if needed.
12217         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12218         caller.
12219         (Layout::allocated_output_section_count): New function.
12220         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12221         needed.
12222         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12223         fields.  Update declarations.
12224         (Layout::symtab_xindex): New function.
12225         (Layout::dynsym_xindex): New function.
12226         (class Write_symbols_task): Add layout_ field.
12227         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12228         Change caller.
12229         * output.cc (Output_section_headers::Output_section_headers): Add
12230         shstrtab_section parameter.  Change all callers.
12231         (Output_section_headers::do_sized_write): Store overflow values
12232         for section count and section string table section index in
12233         section header zero.
12234         (Output_file_header::do_sized_write): Check for overflow of
12235         section count and section string table section index.
12236         (Output_symtab_xindex::do_write): New function.
12237         (Output_symtab_xindex::endian_do_write): New function.
12238         * output.h (class Output_section_headers): Add shstrtab_section_.
12239         Update declarations.
12240         (class Output_symtab_xindex): Define.
12241         (Output_section::has_out_shndx): New function.
12242         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12243         field.
12244         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12245         Change all callers.
12246         (Sized_symbol::init): Likewise.
12247         (Symbol::output_section): Check for ordinary symbol.
12248         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12249         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12250         callers.
12251         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12252         Change all callers.  Simplify handling of symbols from sections
12253         not included in the link.
12254         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12255         distinction.
12256         (Weak_alias_sorter::operator()): Assert that symbols are
12257         ordinary.
12258         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12259         distinction.
12260         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12261         parameters.  Change all callers.
12262         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12263         symbol distinction.  Use SHN_XINDEX when needed.
12264         (Symbol_table::write_section_symbol): Add symtab_xindex
12265         parameter.  Change all callers.
12266         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12267         SHN_XINDEX when needed.
12268         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12269         declarations.
12270         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12271         (Symbol::is_defined): Check is_ordinary.
12272         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12273         (Symbol::is_absolute, Symbol::is_common): Likewise.
12274         (class Sized_symbol): Update declarations.
12275         (class Symbol_table): Update declarations.
12276         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12277         parameters.  Change all callers.
12278         (Sized_symbol::override): Likewise.
12279         (Symbol_table::override): Likewise.
12280         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12281         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12282         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12283         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12284         to be in an ordinary section.
12285         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12286         object and is_ordinary parameters.  Change all callers.
12287         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12288         Change all callers.  Don't add undefined or non-ordinary symbols
12289         to reloc_map_.
12290         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12291         Change all callers.
12292         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12293         declarations.
12294         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12295         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12296         (Sized_relobj::relocate_sections): Likewise.
12297         * target-reloc.h (scan_relocs): Adjust section symbol index.
12298         (scan_relocatable_relocs): Likewise.
12299         * i386.cc (Scan::local): Check for ordinary symbols.
12300         * sparc.cc (Scan::local): Likewise.
12301         * x86_64.cc (Scan::local): Likewise.
12302         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12303         to symbol_section_and_value.
12304         * testsuite/many_sections_test.cc: New file.
12305         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12306         (check_PROGRAMS): Add many_sections_test.
12307         (many_sections_test_SOURCES): Define.
12308         (many_sections_test_DEPENDENCIES): Define.
12309         (many_sections_test_LDFLAGS): Define.
12310         (BUILT_SOURCES): Add many_sections_define.h.
12311         (many_sections_define.h): New target.
12312         (BUILT_SOURCES): Add many_sections_check.h.
12313         (many_sections_check.h): New target.
12314         (check_PROGRAMS): Add many_sections_r_test.
12315         (many_sections_r_test_SOURCES): Define.
12316         (many_sections_r_test_DEPENDENCIES): Define.
12317         (many_sections_r_test_LDFLAGS): Define.
12318         (many_sections_r_test_LDADD): Define.
12319         (many_sections_r_test.o): New target.
12320         * testsuite/Makefile.in: Rebuild.
12321
12322 2008-04-17  Cary Coutant  <ccoutant@google.com>
12323
12324         * errors.cc (Errors::info): New function.
12325         (gold_info): New function.
12326         * errors.h (Errors::info): New function.
12327         * gold.h (gold_info): New function.
12328         * object.cc (Input_objects::add_object): Print trace output.
12329         * options.cc (options::parse_set): New function.
12330         (General_options::parse_wrap): Deleted.
12331         (General_options::General_options): Deleted initializer.
12332         * options.h (options::String_set): New typedef.
12333         (options::parse_set): New function.
12334         (DEFINE_set): New macro.
12335         (General_options::wrap): Changed to use DEFINE_set. Changed
12336         callers of any_wrap_symbols and is_wrap_symbol.
12337         (General_options::trace, General_options::trace_symbol):
12338         New options.
12339         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12340         (General_options::wrap_symbols_): Deleted.
12341         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12342
12343 2008-04-17  David S. Miller  <davem@davemloft.net>
12344
12345         * options.cc (General_options::parse_V): New function.
12346         * options.h: Add entries for -V and -Qy.
12347
12348 2008-04-17  Ian Lance Taylor  <iant@google.com>
12349
12350         * common.cc (Symbol_table::allocate_commons): Remove options
12351         parameter.  Change caller.
12352         (Symbol_table::do_allocate_commons): Remove options parameter.
12353         Change caller.  Just call do_allocate_commons_list twice.
12354         (Symbol_table::do_allocate_commons_list): New function, broken out
12355         of do_allocate_commons.
12356         * common.h (class Allocate_commons_task): Remove options_ field.
12357         Update constructor.
12358         * symtab.cc (Symbol_table::Symbol_table): Initialize
12359         tls_commons_.
12360         (Symbol_table::add_from_object): Put TLS common symbols on
12361         tls_commons_ list.
12362         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12363         which are IN_OUTPUT_DATA.
12364         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12365         allocate_commons and do_allocate_commons declarations.  Declare
12366         do_allocate_commons_list.
12367         * gold.cc (queue_middle_tasks): Update creation of
12368         Allocate_commons_task to not pass options.
12369         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12370         (TLS_TEST_C_FLAGS): New variable.
12371         (tls_test_c_pic.o): New target.
12372         (tls_test_shared.so): Link in tls_test_c_pic.o.
12373         (tls_test_c_pic_ie.o): New target.
12374         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12375         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12376         (tls_test_c.o): New target.
12377         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12378         (tls_pic_test_LDADD): Likewise.
12379         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12380         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12381         (tls_test_c_gnu2.o): New target.
12382         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12383         tls_test_c_gnu2.o.
12384         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12385         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12386         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12387         * testsuite/tls_test.cc: Include "config.h".
12388         (t_last): Call t11_last.
12389         * testsuite/tls_test.h (t11, t11_last): Declare.
12390         * testsuite/tls_test_c.c: New file.
12391         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12392         * configure.ac: Check for OpenMP support.
12393         * configure, config.in, Makefile.in: Rebuild.
12394         * testsuite/Makefile.in: Rebuild.
12395
12396 2008-04-16  Cary Coutant  <ccoutant@google.com>
12397
12398         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12399         (Target_i386::tls_base_symbol_defined_): New field.
12400         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12401         (Target_i386::Scan::global): Likewise.
12402         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12403         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12404         (Target_x86_64::tls_base_symbol_defined_): New field.
12405         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12406         (Target_x86_64::Scan::global): Likewise.
12407
12408 2008-04-16  Cary Coutant  <ccoutant@google.com>
12409
12410         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12411         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12412         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12413         building shared libraries.
12414         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12415         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12416         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12417         * testsuite/Makefile.in: Rebuild.
12418         * testsuite/weak_undef.h: New file.
12419         * testsuite/weak_undef_file1.cc: Add extra test cases.
12420         * testsuite/weak_undef_file2.cc: Likewise.
12421         * testsuite/weak_undef_test.cc: Likewise.
12422
12423 2008-04-16  David S. Miller  <davem@davemloft.net>
12424
12425         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12426         Add issued_non_pic_error_ field.  Declare check_non_pic.
12427         (Target_sparc::Scan::check_non_pic): New function.
12428         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12429         (Target_sparc::Scan::global): Likewise.
12430
12431         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12432         * configure: Rebuild.
12433
12434         * options.h (DEFINE_enable): New macro.
12435         (new_dtags): New enable option.
12436         (initfirst, interpose, loadfltr, nodefaultlib,
12437         nodelete, nodlopen, nodump): New -z options.
12438         * layout.cc (Layout:finish_dynamic_section): If new
12439         dtags enabled, emit DT_RUNPATH.  Also, emit a
12440         DT_FLAGS_1 containing any specified -z flags.
12441
12442 2008-04-16  Ian Lance Taylor  <iant@google.com>
12443
12444         * copy-relocs.cc: New file.
12445         * copy-relocs.h: New file.
12446         * reloc.cc: Remove Copy_relocs code.
12447         * reloc.h: Likewise.
12448         * reloc-types.h (struct Reloc_types) [both versions]: Add
12449         get_reloc_addend_noerror.
12450         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12451         variants of add_global which take an addend which must be zero.
12452         * i386.cc: Include "copy-relocs.h".
12453         (class Target_i386): Change type of copy_relocs_ to variable,
12454         update initializer.
12455         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12456         Change all callers.
12457         (Target_i386::do_finalize_sections): Change handling of
12458         copy_relocs_.
12459         * sparc.cc: Include "copy-relocs.h".
12460         (class Target_sparc): Change type of copy_relocs_ to variable,
12461         update initializer.
12462         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12463         Change all callers.
12464         (Target_sparc::do_finalize_sections): Change handling of
12465         copy_relocs_.
12466         * x86_64.cc: Include "copy-relocs.h".
12467         (class Target_x86_64): Change type of copy_relocs_ to variable,
12468         update initializer.
12469         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12470         class.  Change all callers.
12471         (Target_x86_64::do_finalize_sections): Change handling of
12472         copy_relocs_.
12473         * Makefile.am (CCFILES): Add copy-relocs.cc.
12474         (HFILES): Add copy-relocs.h.
12475
12476         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12477
12478         * testsuite/script_test_4.sh: Permit leading zeroes.
12479
12480 2008-04-15  Ian Lance Taylor  <iant@google.com>
12481
12482         * script-sections.cc (Script_sections::create_segments): Use
12483         header_size_adjustment even when there is enough room for the
12484         headers.
12485         * testsuite/script_test_4.sh: New file.
12486         * testsuite/script_test_4.t: New file.
12487         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12488         (check_DATA): Add script_test_4.stdout.
12489         (MOSTLYCLEANFILES): Likewise.
12490         (script_test_4): New target.
12491         (script_test_4.stdout): New target.
12492         * testsuite/Makefile.in: Rebuild.
12493
12494         * sparc.cc: Add definitions for Output_data_plt_sparc class
12495         constants.
12496
12497 2008-04-14  David S. Miller  <davem@davemloft.net>
12498
12499         * sparc.cc: New file.
12500         * Makefile.am (TARGETSOURCES): Add sparc.cc
12501         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12502         * configure.tgt: Document targ_extra_size and
12503         targ_extra_big_endian.  Add entries for sparc-* and
12504         sparc64-*.
12505         * configure.ac: Handle targ_extra_size and
12506         targ_extra_big_endian.
12507         * Makefile.in: Rebuild.
12508         * configure: Likewise.
12509         * po/POTFILES.in: Likewise.
12510         * po/gold.pot: Likewise.
12511
12512 2008-04-14  Ian Lance Taylor  <iant@google.com>
12513
12514         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12515         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12516         in the name/type/flags to section mapping.  Don't call
12517         allocate_output_section.
12518         (Layout::choose_output_section): Change parameter from adjust_name
12519         to is_input_section.  Don't permit input sections after sections
12520         are attached to segments.  Don't call allocate_output_section.
12521         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12522         not write_enable_output_section.
12523         (Layout::make_output_section): Don't push to
12524         unattached_section_list_ nor call attach_to_segment.  Call
12525         attach_section_to_segment if sections are attached.
12526         (Layout::attach_sections_to_segments): New function.
12527         (Layout::attach_section_to_segment): New function.
12528         (Layout::attach_allocated_section_to_segment): Rename from
12529         attach_to_segment.  Remove flags parameter.
12530         (Layout::allocate_output_section): Remove function.
12531         (Layout::write_enable_output_section): Remove function.
12532         * layout.h (class Layout): Update for above changes.  Add new
12533         field sections_are_attached_.
12534         * output.h (Output_section::update_flags_for_input_section): New
12535         function.
12536         * output.cc (Output_section::add_input_section): Call
12537         update_flags_for_input_section.
12538         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12539
12540 2008-04-11  Cary Coutant  <ccoutant@google.com>
12541
12542         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12543         thought unnecessary.
12544         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12545
12546 2008-04-11  Ian Lance Taylor  <iant@google.com>
12547
12548         * output.h (class Output_section_data): Remove inline definition
12549         of set_addralign.
12550         * output.cc (Output_section_data::set_addralign): New function.
12551
12552 2008-04-11  Cary Coutant  <ccoutant@google.com>
12553
12554         Add support for TLS descriptors for i386 and x86_64.
12555         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12556         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12557         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12558         GOT_TYPE_TLS_DESC.
12559         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12560         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12561         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12562         relocations.
12563         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12564         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12565         Fix problem with initial-exec relocations.
12566         (Target_i386::Relocate::relocate_tls): Likewise.
12567         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12568         relaxation.
12569         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12570         support for section-plus-offset dynamic table entries.
12571         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12572         (Output_data_dynamic::Dynamic_entry): Add support for
12573         section-plus-offset dynamic table entries.
12574         (Output_data_dynamic::Classification): Likewise.
12575         (Output_data_dynamic::classification_): Renamed offset_.
12576         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12577         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12578         (Target_x86_64::make_plt_section): New function.
12579         (Target_x86_64::reserve_tlsdesc_entries): New function.
12580         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12581         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12582         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12583         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12584         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12585         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12586         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12587         add extra PLT entry for TLS descriptors.
12588         (Output_data_plt_x86_64::got_): New field.
12589         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12590         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12591         fields.
12592         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12593         descriptors.
12594         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12595         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12596         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12597         R_386_TLS_DESC_CALL relocations.
12598         (Target_x86_64::Scan::global): Likewise.
12599         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12600         for TLS descriptors.
12601         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12602         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12603         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12604         GD-to-IE relaxation.
12605         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12606         and TLS_DESCRIPTORS.
12607         * Makefile.in: Rebuild.
12608         * configure: Rebuild.
12609         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12610         (tls_test_shared2.so): New target.
12611         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12612         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12613         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12614         (tls_shared_gd_to_ie_test_LDADD): New variable.
12615         (tls_shared_gnu2_gd_to_ie_test): New target.
12616         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12617         New targets.
12618         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12619         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12620         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12621         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12622         (tls_shared_gnu2_test): New target.
12623         (tls_test_gnu2_shared.so): New target.
12624         (tls_shared_gnu2_test_SOURCES): New variable.
12625         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12626         (tls_shared_gnu2_test_LDFLAGS): New variable.
12627         (tls_shared_gnu2_test_LDADD): New variable.
12628         * testsuite/Makefile.in: Rebuild.
12629         * testsuite/Makefile.
12630
12631 2008-04-11  Ian Lance Taylor  <iant@google.com>
12632
12633         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12634         justsyms.t.
12635         * testsuite/Makefile.in: Rebuild.
12636
12637         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12638         long.
12639         * testsuite/script_test_2.cc (main): Adjust test.
12640
12641 2008-04-11  David S. Miller  <davem@davemloft.net>
12642             Ian Lance Taylor  <iant@google.com>
12643
12644         * options.h (General_options): Add entries for '-Y' and
12645         '-relax'.
12646         * options.cc (General_options:finalize): If -Y was used, add those
12647         entries to the library path instead of the default "/lib" and
12648         "/usr/lib".
12649
12650 2008-04-11  David S. Miller  <davem@davemloft.net>
12651
12652         * testsuite/justsyms.t: Start at 0x100.
12653         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12654         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12655         long.
12656         * testsuite/script_test_2.cc: Adjust string and section length
12657         checks.
12658
12659 2008-04-09  Ian Lance Taylor  <iant@google.com>
12660
12661         PR gold/5996
12662         * script-sections.cc (Sections_element::allocate_to_segment): Add
12663         orphan parameter.
12664         (Output_section_definition::allocate_to_segment): Likewise.
12665         (Orphan_output_section::allocate_to_segment): Likewise.
12666         (Script_sections::attach_sections_using_phdrs_clause): Don't
12667         propagate non-PT_LOAD segments to orphan sections.
12668         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12669         readelf rather than objdump.
12670         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12671         .interp section and PT_INTERP segment are the same size.
12672         * testsuite/Makefile.in: Rebuild.
12673
12674         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12675         aliases for symbols defined in the same object.
12676         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12677         (weak_alias_test_SOURCES): New variable.
12678         (weak_alias_test_DEPENDENCIES): New variable.
12679         (weak_alias_test_LDFLAGS): New variable.
12680         (weak_alias_test_LDADD): New variable.
12681         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12682         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12683         (weak_alias_test_3.o): New target.
12684         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12685         * testsuite/weak_alias_test_main.cc: New file.
12686         * testsuite/weak_alias_test_1.cc: New file.
12687         * testsuite/weak_alias_test_2.cc: New file.
12688         * testsuite/weak_alias_test_3.cc: New file.
12689
12690 2008-04-08  Ian Lance Taylor  <iant@google.com>
12691
12692         * options.h (class General_options): Add --noinhibit-exec option.
12693         * main.cc (main): Check --noinhibit-exec.
12694
12695         * options.h (class General_options): Define --wrap as a special
12696         option.  Add wrap_symbols_ field.
12697         (General_options::any_wrap_symbols): New function.
12698         (General_options::is_wrap_symbol): New function.
12699         * options.cc (General_options::parse_wrap): New function.
12700         (General_options::General_options): Initialize wrap_symbols_.
12701         * symtab.cc (Symbol_table::wrap_symbol): New function.
12702         (Symbol_table::add_from_object): Handle --wrap.
12703         * symtab.h (class Symbol_table): Declare wrap_symbol.
12704         * target.h (Target::wrap_char): New function.
12705         (Target::Target_info): Add wrap_char field.
12706         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12707         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12708         * testsuite/testfile.cc (Target_test::test_target_info):
12709         Likewise.
12710
12711         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12712         there is one.
12713
12714         * layout.h (class Layout): Add added_eh_frame_data_ field.
12715         * layout.cc (Layout::Layout): Initialize new field.
12716         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12717         output section until we find a section we merged successfully.
12718         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12719         that the size be non-zero.
12720
12721         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12722         qualifier.
12723
12724 2008-04-08  Craig Silverstein  <csilvers@google.com>
12725
12726         * configure.ac: Export new conditional variable HAVE_ZLIB.
12727         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12728         on HAVE_ZLIB.
12729         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12730         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12731
12732 2008-04-07  Ian Lance Taylor  <iant@google.com>
12733
12734         * version.cc (version_string): Set to "1.5".
12735
12736         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12737         Add issued_non_pic_error_ field.  Declare check_non_pic.
12738         (Target_x86_64::Scan::check_non_pic): New function.
12739         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12740         (Target_x86_64::Scan::global): Likewise.
12741
12742         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12743         addend parameter.  Change caller.  Handle merge sections.
12744         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12745         Address to Addend.  Don't add in the result of
12746         local_section_offset, pass down the addend and use the returned
12747         value.
12748         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12749         Update declarations of local_section_offset and symbol_value.
12750         * testsuite/two_file_test_1.cc (t18): New function.
12751         * testsuite/two_file_test_2.cc (f18): New function.
12752         * testsuite/two_file_test_main.cc (main): Call t18.
12753         * testsuite/two_file_test.h (t18, f18): Declare.
12754
12755         * configure.ac: Don't test for objdump, c++filt, or readelf.
12756         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12757         conditionals.
12758         (TEST_READELF): New variable.
12759         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12760         (check_PROGRAMS): Add two_file_strip_test.
12761         (two_file_strip_test): New target.
12762         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12763         (two_file_same_shared_strip_test_SOURCES): New variable.
12764         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12765         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12766         (two_file_same_shared_strip_test_LDADD): New variable.
12767         (two_file_shared_strip.so): New target.
12768         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12769         (ver_test_5.syms, ver_test_7.syms): Likewise.
12770         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12771         (strip_test_3.stdout): Use TEST_OBJDUMP.
12772         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12773
12774 2008-04-04  Cary Coutant  <ccoutant@google.com>
12775
12776         * symtab.h (Symbol::is_weak_undefined): New function.
12777         (Symbol::is_strong_undefined): New function.
12778         (Symbol::is_absolute): New function.
12779         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12780         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12781         absolute symbols.
12782         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12783         (weak_undef_test): New target.
12784         * testsuite/Makefile.in: Rebuild.
12785         * testsuite/weak_undef_file1.cc: New file.
12786         * testsuite/weak_undef_file2.cc: New file.
12787         * testsuite/weak_undef_test.cc: New file.
12788
12789 2008-04-03  Craig Silverstein  <csilvers@google.com>
12790
12791         * compressed_output.h (class Output_compressed_section): Use
12792         unsigned buffer.
12793         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12794         add zlib header.
12795         (zlib_compressed_suffix): Removed.
12796         (Output_compressed_section::set_final_data_size): Use unsigned
12797         buffers.
12798         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12799         Fix linker invocation.
12800         (flagstest_o_specialfile_and_compress_debug_sections):
12801         Likewise.
12802         * testsuite/Makefile.in: Regenerated.
12803
12804 2008-04-02  David S. Miller  <davem@davemloft.net>
12805
12806         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12807         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12808
12809 2008-04-02  Craig Silverstein  <csilvers@google.com>
12810
12811         * TODO: New file.
12812
12813 2008-04-02  Ian Lance Taylor  <iant@google.com>
12814
12815         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12816         parameters.  Update for new key type to views_.  Change all
12817         callers.
12818         (File_read::read): Adjust for byteshift in returned view.
12819         (File_read::add_view): New function, broken out of
12820         find_and_make_view.
12821         (File_read::make_view): New function, broken out of
12822         find_and_make_view.
12823         (File_read::find_or_make_view): Add offset and aligned
12824         parameters.  Rewrite accordingly.  Change all callers.
12825         (File_read::get_view): Add offset and aligned parameters.  Adjust
12826         for byteshift in return value.
12827         (File_read::get_lasting_view): Likewise.
12828         * fileread.h (class File_read): Update declarations.
12829         (class File_read::View): Add byteshift_ field.  Add byteshift to
12830         constructor.  Add byteshift method.
12831         * archive.h (Archive::clear_uncached_views): New function.
12832         (Archive::get_view): Add aligned parameter.  Change all callers.
12833         * object.h (Object::get_view): Add aligned parameter.  Change all
12834         callers.
12835         (Object::get_lasting_view): Likewise.
12836
12837         * fileread.cc (File_read::release): Don't call clear_views if
12838         there are multiple objects.
12839         * fileread.h (File_read::clear_uncached_views): New function.
12840         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12841         on the archive.
12842
12843 2008-03-31  Cary Coutant  <ccoutant@google.com>
12844
12845         Add thin archive support.
12846         * archive.cc (Archive::armagt): New const.
12847         (Archive::setup): Remove task parameter and calls to unlock.
12848         (Archive::unlock_nested_archives): New function.
12849         (Archive::read_header): Add nested_off parameter. Change
12850         all callers.
12851         (Archive::interpret_header): Likewise.
12852         (Archive::include_all_members): Change to handle thin
12853         archives.
12854         (Archive::include_member): Likewise.
12855         * archive.h (Archive::Archive): Add new parameters and
12856         initializers.
12857         (Archive::armagt): New const.
12858         (Archive::setup): Remove task parameter.
12859         (Archive::unlock_nested_archives): New function.
12860         (Archive::read_header): Add nested_off parameter.
12861         (Archive::interpret_header): Likewise.
12862         (Archive::Nested_archive_table): New typedef.
12863         (Archive::is_thin_archive_): New field.
12864         (Archive::nested_archives_): New field.
12865         (Archive::options_): New field.
12866         (Archive::dirpath_): New field.
12867         (Archive::task_): New field.
12868         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12869         for thin archives.  Pass additional parameters to
12870         Archive::Archive.  Unlock the archive file after calling
12871         Archive::setup.
12872
12873 2008-03-29  Ian Lance Taylor  <iant@google.com>
12874
12875         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12876         version symbol to be local.
12877         * testsuite/ver_test_4.sh: New file.
12878         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12879         (check_DATA): Add ver_test_4.syms.
12880         (ver_test_4.syms): New target.
12881         * testsuite/Makefile.in: Rebuild.
12882
12883         * output.cc
12884         (Output_section::Input_section_sort_entry::has_priority): New
12885         function.
12886         (Output_section::Input_section_sort_entry::match_file_name): New
12887         function.
12888         (Output_section::Input_section_sort_entry::match_section_name):
12889         Remove.
12890         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12891         Remove.
12892         (Output_section::Input_section_sort_entry::match_section_file):
12893         Remove.
12894         (Output_section::Input_section_sort_compare::operator()): Rewrite
12895         using new Input_section_sort_entry functions.  Sort crtbegin and
12896         crtend first.  Sort sections with no priority before sections with
12897         a priority.
12898         * testsuite/initpri1.c (d3): Check j != 4.
12899         (cd5): New constructor/destructor function.
12900         (main): Check j != 2.
12901
12902         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12903         new symbol when resolving, don't call set_is_default.
12904         * testsuite/ver_test_7.cc: New file.
12905         * testsuite/ver_test_7.sh: New file.
12906         * testsuite/Makefile.am (ver_test_7.so): New target.
12907         (ver_test_7.o): New target.
12908         (check_SCRIPTS): Add ver_test_7.sh.
12909         (check_DATA): Add ver_test_7.syms.
12910         (ver_test_7.syms): New target.
12911
12912 2008-03-28  Ian Lance Taylor  <iant@google.com>
12913
12914         * layout.cc (Layout::layout): If we see an input section with a
12915         name that needs sorting, set the must_sort flag for the output
12916         section.
12917         (Layout::make_output_section): If the name of the output section
12918         indicates that it might require sorting, set the may_sort flag.
12919         * output.h (Output_section::may_sort_attached_input_sections): New
12920         function.
12921         (Output_section::set_may_sort_attached_input_sections): New
12922         function.
12923         (Output_section::must_sort_attached_input_sections): New
12924         function.
12925         (Output_section::set_must_sort_attached_input_sections): New
12926         function.
12927         (class Output_section): Declare Input_section_sort_entry.  Define
12928         Input_section_sort_compare.  Declare
12929         sort_attached_input_sections.  Add new fields:
12930         may_sort_attached_input_sections_,
12931         must_sort_attached_input_sections_,
12932         attached_input_sections_are_sorted_.
12933         * output.cc (Output_section::Output_section): Initialize new
12934         fields.
12935         (Output_section::add_input_section): Add an entry to
12936         input_sections_ if may_sort or must_sort are true.
12937         (Output_section::set_final_data_size): Call
12938         sort_attached_input_sections if necessary.
12939         (Output_section::Input_section_sort_entry): Define new class.
12940         (Output_section::Input_section_sort_compare::operator()): New
12941         function.
12942         (Output_section::sort_attached_input_sections): New function.
12943         * configure.ac: Check whether the compiler supports constructor
12944         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12945         * testsuite/initpri1.c: New file.
12946         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12947         CONSTRUCTOR_PRIORITY.
12948         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12949         (initpri1_LDFLAGS): New variable.
12950         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12951
12952 2008-03-27  Ian Lance Taylor  <iant@google.com>
12953
12954         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12955         * testsuite/common_test_1.c: New file.
12956         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12957         (common_test_1_SOURCES): New variable.
12958         (common_test_1_DEPENDENCIES): New variable.
12959         (common_test_1_LDFLAGS): New variable.
12960
12961         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12962         and commons_ correctly when NAME/VERSION does not override
12963         NAME/NULL.
12964         * testsuite/ver_test_6.c: New file.
12965         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12966         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12967         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12968
12969 2008-03-26  Ian Lance Taylor  <iant@google.com>
12970
12971         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12972         of an undefined symbol from a version script.
12973         * testsuite/Makefile.am (ver_test_5.so): New target.
12974         (ver_test_5.o): New target.
12975         (check_SCRIPTS): Add ver_test_5.sh.
12976         (check_DATA): Add ver_test_5.syms.
12977         (ver_test_5.syms): New target.
12978         * testsuite/ver_test_5.cc: New file.
12979         * testsuite/ver_test_5.script: New file.
12980         * testsuite/ver_test_5.sh: New file.
12981         * Makefile.in, testsuite/Makefile.in: Rebuild.
12982
12983         PR gold/5986
12984         Fix problems building gold with gcc 4.3.0.
12985         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12986         (gold_error_at_location, gold_warning_at_location): Use it.
12987         * configure.ac: Check whether we can compile and use a template
12988         function with a printf attribute.
12989         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12990         when jumping over bytes.
12991         * object.cc: Instantiate Object::read_section_data.
12992         * debug.h: Include <cstring>
12993         * dwarf_reader.cc: Include <algorithm>
12994         * main.cc: Include <cstring>.
12995         * options.cc: Include <cstring>.
12996         * output.cc: Include <cstring>.
12997         * script.cc: Include <cstring>.
12998         * script.h: Include <string>.
12999         * symtab.cc: Include <cstring> and <algorithm>.
13000         * target-select.cc: Include <cstring>.
13001         * version.cc: Include <string>.
13002         * testsuite/testmain.cc: Include <cstdlib>.
13003         * configure, config.in: Rebuild.
13004
13005 2008-03-25  Ian Lance Taylor  <iant@google.com>
13006
13007         * options.cc: Include "../bfd/bfdver.h".
13008         (options::help): Print bug reporting address.
13009
13010         * version.cc (print_version): Adjust output for current value of
13011         BFD_VERSION_STRING.
13012
13013         * NEWS: New file.
13014
13015         * options.cc (options::help): Print list of supported targets.
13016         * target-select.h: Include <vector>.
13017         (class Target_selector): Make machine_, size_, and is_big_endian_
13018         fields const.  Add bfd_name_ and instantiated_target_ fields.
13019         (Target_selector::Target_selector): Add bfd_name parameter.
13020         (Target_selector::recognize): Make non-virtual, call
13021         do_recognize.
13022         (Target_selector::recognize_by_name): Make non-virtual, call
13023         do_recognize_by_name.
13024         (Target_selector::supported_names): New function.
13025         (Target_selector::bfd_name): New function.
13026         (Target_selector::do_instantiate_target): New pure virtual
13027         function.
13028         (Target_selector::do_recognize): New virtual function.
13029         (Target_selector::do_recognize_by_name): New virtual function.
13030         (Target_selector::instantiate_target): New private function.
13031         (supported_target_names): Declare.
13032         * target-select.cc (Target_selector::Target_selector): Update for
13033         new parameter and fields.
13034         (select_target_by_name): Check that the name matches before
13035         calling recognize_by_name.
13036         (supported_target_names): New function.
13037         * i386.cc (class Target_selector_i386): Update Target_selector
13038         constructor call.  Remove recognize and recognize_by_name.  Add
13039         do_instantiate_target.
13040         * x86_64.cc (class Target_selector_x86_64): Likewise.
13041         * testsuite/testfile.cc (class Target_selector_test): Update for
13042         changes to Target_selector.
13043
13044         * README: Rewrite, with some notes on unsupported features.
13045
13046 2008-03-24  Cary Coutant  <ccoutant@google.com>
13047
13048         * i386.cc (Target_i386::Got_type): New enum declaration.
13049         (Target_i386::Scan::local): Updated callers of Output_data_got
13050         member functions.
13051         (Target_i386::Scan::global): Likewise.
13052         (Target_i386::Relocate::relocate): Likewise.
13053         (Target_i386::Relocate::relocate_tls): Likewise.
13054         * object.h (Got_offset_list): New class.
13055         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13056         (Sized_relobj::local_got_offset): Likewise.
13057         (Sized_relobj::set_local_got_offset): Likewise.
13058         (Sized_relobj::local_has_tls_got_offset): Removed.
13059         (Sized_relobj::local_tls_got_offset): Removed.
13060         (Sized_relobj::set_local_tls_got_offset): Removed.
13061         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13062         * output.cc (Output_data_got::add_global): Added got_type parameter.
13063         (Output_data_got::add_global_with_rel): Likewise.
13064         (Output_data_got::add_global_with_rela): Likewise.
13065         (Output_data_got::add_global_pair_with_rel): New function.
13066         (Output_data_got::add_global_pair_with_rela): New function.
13067         (Output_data_got::add_local): Added got_type parameter.
13068         (Output_data_got::add_local_with_rel): Likewise.
13069         (Output_data_got::add_local_with_rela): Likewise.
13070         (Output_data_got::add_local_pair_with_rel): New function.
13071         (Output_data_got::add_local_pair_with_rela): New function.
13072         (Output_data_got::add_global_tls): Removed.
13073         (Output_data_got::add_global_tls_with_rel): Removed.
13074         (Output_data_got::add_global_tls_with_rela): Removed.
13075         (Output_data_got::add_local_tls): Removed.
13076         (Output_data_got::add_local_tls_with_rel): Removed.
13077         (Output_data_got::add_local_tls_with_rela): Removed.
13078         * output.h (Output_data_got::add_global): Added got_type parameter.
13079         (Output_data_got::add_global_with_rel): Likewise.
13080         (Output_data_got::add_global_with_rela): Likewise.
13081         (Output_data_got::add_global_pair_with_rel): New function.
13082         (Output_data_got::add_global_pair_with_rela): New function.
13083         (Output_data_got::add_local): Added got_type parameter.
13084         (Output_data_got::add_local_with_rel): Likewise.
13085         (Output_data_got::add_local_with_rela): Likewise.
13086         (Output_data_got::add_local_pair_with_rel): New function.
13087         (Output_data_got::add_local_pair_with_rela): New function.
13088         (Output_data_got::add_global_tls): Removed.
13089         (Output_data_got::add_global_tls_with_rel): Removed.
13090         (Output_data_got::add_global_tls_with_rela): Removed.
13091         (Output_data_got::add_local_tls): Removed.
13092         (Output_data_got::add_local_tls_with_rel): Removed.
13093         (Output_data_got::add_local_tls_with_rela): Removed.
13094         * resolve.cc (Symbol::override_base_with_special): Removed
13095         reference to has_got_offset_ field.
13096         * symtab.cc (Symbol::init_fields): Replaced initialization
13097         of got_offset_ with got_offsets_.  Removed initialization
13098         of has_got_offset_
13099         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13100         (Symbol::got_offset): Likewise.
13101         (Symbol::set_got_offset): Likewise.
13102         (Symbol::has_tls_got_offset): Removed.
13103         (Symbol::tls_got_offset): Removed.
13104         (Symbol::set_tls_got_offset): Removed.
13105         (Symbol::got_offset_): Removed.
13106         (Symbol::tls_mod_got_offset_): Removed.
13107         (Symbol::tls_pair_got_offset_): Removed.
13108         (Symbol::got_offsets_): New field.
13109         (Symbol::has_got_offset): Removed.
13110         (Symbol::has_tls_mod_got_offset): Removed.
13111         (Symbol::has_tls_pair_got_offset): Removed.
13112         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13113         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13114         member functions.
13115         (Target_x86_64::Scan::global): Likewise.
13116         (Target_x86_64::Relocate::relocate): Likewise.
13117         (Target_x86_64::Relocate::relocate_tls): Likewise.
13118
13119 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13120
13121         * yyscript.y: Fix spelling error in comment.
13122
13123 2008-03-24  Ian Lance Taylor  <iant@google.com>
13124
13125         * options.h (class General_options): Define build_id option.
13126         * layout.h (class Layout): Declare write_build_id, create_note,
13127         create_build_id.  Add build_id_note_ member.
13128         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13129         "libiberty.h", "md5.h", "sha1.h".
13130         (Layout::Layout): Initialize eh_frame_data_,
13131         eh_frame_hdr_section_, and build_id_note_.
13132         (Layout::finalize): Call create_build_id.
13133         (Layout::create_note): New function, broken out of
13134         Layout::create_gold_note.
13135         (Layout::create_gold_note): Call create_note.
13136         (Layout::create_build_id): New function.
13137         (Layout::write_build_id): New function.
13138         (Close_task_runner::run): Call write_build_id.
13139
13140         * x86_64.cc: Correct license to GPLv3.
13141
13142 2008-03-23  Ian Lance Taylor  <iant@google.com>
13143
13144         * options.cc: Include "demangle.h".
13145         (parse_optional_string): New function.
13146         (parse_long_option): Handle takes_optional_argument.
13147         (parse_short_option): Update dash_z initializer.  Handle
13148         takes_optional_argument.
13149         (General_options::General_options): Initialize do_demangle_.
13150         (General_options::finalize): Set do_demangle_.  Handle demangling
13151         style.
13152         * options.h (parse_optional_string): Declare.
13153         (struct One_option): Add optional_arg field.  Update constructor.
13154         Update call constructor calls.  Add takes_optional_argument
13155         function.
13156         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13157         (DEFINE_optional_string): Define.
13158         (General_options::demangle): Change from DEFINE_bool to
13159         DEFINE_optional_string.
13160         (General_options::no_demangle): New function.
13161         (General_options::do_demangle): New function.
13162         (General_options::set_do_demangle): New function.
13163         (General_options::execstack_status_): Move definition to end of
13164         class definition.
13165         (General_options::static_): Likewise.
13166         (General_options::do_demangle_): New field.
13167         * object.cc (big_endian>::get_symbol_location_info): Call
13168         Options::do_demangle, not Options::demangle.
13169         * symtab.cc (demangle): Likewise.
13170
13171 2008-03-22  Ian Lance Taylor  <iant@google.com>
13172
13173         * gold.h: Include <cstddef> and <sys/types.h>
13174         * options.h: Include <cstring>.
13175
13176 2008-03-21  Ian Lance Taylor  <iant@google.com>
13177
13178         * Added source code to GNU binutils.