* configure.ac (ENABLE_GOLD): Consider *-*-nacl* targets ELF.
[external/binutils.git] / gold / ChangeLog
1 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2
3         * nacl.cc: New file.
4         * nacl.h: New file.
5         * Makefile.am (CCFILES, HFILES): Add them.
6         * Makefile.in: Regenerate.
7         * i386.cc (Output_data_plt_i386_nacl): New class.
8         (Output_data_plt_i386_nacl_exec): New class.
9         (Output_data_plt_i386_nacl_dyn): New class.
10         (Target_i386_nacl): New class.
11         (Target_selector_i386_nacl): New class.
12         (target_selector_i386): Use it instead of Target_selector_i386.
13         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
14         (Target_x86_64_nacl): New class.
15         (Target_selector_x86_64_nacl): New class.
16         (target_selector_x86_64, target_selector_x32): Use it instead of
17         Target_selector_x86_64.
18         * arm.cc (Output_data_plt_arm_nacl): New class.
19         (Target_arm_nacl): New class.
20         (Target_selector_arm_nacl): New class.
21         (target_selector_arm, target_selector_armbe): Use it instead of
22         Target_selector_arm.
23
24         * target-select.cc (select_target): Take new Input_file* and off_t
25         arguments, pass them on to recognize method of selector.
26         * object.cc (make_elf_sized_object): Update caller.
27         * parameters.cc (parameters_force_valid_target): Likewise.
28         * incremental.cc (make_sized_incremental_binary): Likewise.
29         * target-select.h: Update decl.
30         (Target_selector::recognize): Take new Input_file* argument,
31         pass it on to do_recognize.
32         (Target_selector::do_recognize): Take new Input_file* argument.
33         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
34         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
35         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
36         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
37
38         * target.h (Target::Target_info): New members isolate_execinstr
39         and rosegment_gap.
40         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
41         * arm.cc (Target_arm::arm_info): Update initializer.
42         * i386.cc (Target_i386::i386_info): Likewise.
43         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
44         * sparc.cc (Target_sparc::sparc_info): Likewise.
45         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
46         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
47         * layout.cc (Layout::attach_allocated_section_to_segment):
48         Take new const Target* argument.  If target->isolate_execinstr(), act
49         like --rosegment.
50         (Layout::find_first_load_seg): Take new const Target* argument;
51         if target->isolate_execinstr(), reject PF_X segments.
52         (Layout::relaxation_loop_body): Update caller.
53         (Layout::set_segment_offsets): If target->isolate_execinstr(),
54         reset file offset to zero when we hit LOAD_SEG, and then do a second
55         loop over the segments before LOAD_SEG to reassign offsets after
56         addresses have been determined.  Handle target->rosegment_gap().
57         (Layout::attach_section_to_segment): Take new const Target* argument;
58         pass it to attach_allocated_section_to_segment.
59         (Layout::make_output_section): Update caller.
60         (Layout::attach_sections_to_segments): Take new const Target* argument;
61         pass it to attach_section_to_segment.
62         * gold.cc (queue_middle_tasks): Update caller.
63         * layout.h (Layout): Update method decls with new arguments.
64
65         * arm.cc (Target_arm::Target_arm): Take optional argument for the
66         Target_info pointer to use.
67         (Target_arm::do_make_data_plt): New virtual method.
68         (Target_arm::make_data_plt): New method that calls it.
69         (Target_arm::make_plt_entry): Use it.
70         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
71         for the section alignment.
72         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
73         method.
74         (Output_data_plt_arm::first_plt_entry_offset): Call it.
75         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
76         method.
77         (Output_data_plt_arm::get_plt_entry_size): Call it.
78         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
79         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
80         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
81         method.
82         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
83         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
84         method instead of sizeof(plt_entry).
85         (Output_data_plt_arm::add_entry): Likewise.
86         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
87         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
88         than static method.
89         (Target_arm::plt_entry_size): Likewise.
90         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
91         Move to ...
92         (Output_data_plt_arm_standard): ... here, new class.
93         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
94         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
95         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
96
97         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
98         Take additional argument for the PLT entry size.
99         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
100         Use get_plt_entry_size method rather than plt_entry_size variable.
101         (Output_data_plt_x86_64::reserve_slot): Likewise.
102         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
103         (Output_data_plt_x86_64::add_entry): Likewise.
104         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
105         (Output_data_plt_x86_64::address_for_global): Likewise.
106         (Output_data_plt_x86_64::address_for_local): Likewise.
107         (Output_data_plt_x86_64::set_final_data_size): Likewise.
108         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
109         Make method non-static.
110         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
111         method.
112         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
113         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
114         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
115         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
116         virtual method.
117         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
118         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
119         virtual method.
120         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
121         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
122         virtual method.
123         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
124         (Output_data_plt_x86_64::plt_entry_size)
125         (Output_data_plt_x86_64::first_plt_entry)
126         (Output_data_plt_x86_64::plt_entry)
127         (Output_data_plt_x86_64::tlsdesc_plt_entry)
128         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
129         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
130         (Output_data_plt_x86_64_standard): ... here, new class.
131         (Target_x86_64::Target_x86_64): Take optional argument for the
132         Target_info pointer to use.
133         (Target_x86_64::do_make_data_plt): New virtual method.
134         (Target_x86_64::make_data_plt): New method to call it.
135         (Target_x86_64::init_got_plt_for_update): Use that.
136         Call this->plt_->add_eh_frame method here.
137         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
138         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
139         rather than static method.
140         (Target_x86_64::plt_entry_size): Likewise.
141         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
142         rather than plt_entry_size variable.  Move guts of PLT filling to...
143         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
144         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
145         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
146
147         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
148         additional argument for the section alignment.
149         Don't do add_eh_frame_for_plt here.
150         (Output_data_plt_i386::first_plt_entry_offset): Make the method
151         non-static.  Use get_plt_entry_size method rather than plt_entry_size
152         variable.
153         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
154         method.
155         (Output_data_plt_i386::get_plt_entry_size): Call it.
156         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
157         (Output_data_plt_i386::add_eh_frame): New method to call it.
158         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
159         method.
160         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
161         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
162         method.
163         (Output_data_plt_i386::fill_plt_entry): New method to call it.
164         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
165         method instead of plt_entry_size.
166         (Output_data_plt_i386::plt_entry_size)
167         (Output_data_plt_i386::plt_eh_frame_fde_size)
168         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
169         (Output_data_plt_i386_standard): ... here, new class.
170         (Output_data_plt_i386_exec): New class.
171         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
172         (Output_data_plt_i386_exec::first_plt_entry): ... here.
173         (Output_data_plt_i386::exec_plt_entry): Move to ...
174         (Output_data_plt_i386_exec::plt_entry): ... here.
175         (Output_data_plt_i386_dyn): New class.
176         (Output_data_plt_i386::first_plt_entry): Move to ...
177         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
178         (Output_data_plt_i386::dyn_plt_entry): Move to ...
179         (Output_data_plt_i386_dyn::plt_entry): ... here.
180         (Target_i386::Target_i386): Take optional argument for the Target_info
181         pointer to use.
182         (Target_i386::do_make_data_plt): New virtual method.
183         (Target_i386::make_data_plt): New method to call it.
184         (Target_i386::make_plt_section): Use that.
185         Call this->plt_->add_eh_frame method here.
186         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
187         rather than plt_entry_size variable.
188         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
189         (Output_data_plt_i386::address_for_local): Likewise.
190         (Output_data_plt_i386::do_write): Likewise.
191         Move guts of PLT filling to...
192         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
193         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
194         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
195         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
196
197 2012-05-01  Cary Coutant  <ccoutant@google.com>
198
199         * dwarf_reader.cc (Dwarf_die::read_attributes)
200         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
201         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
202         * reduced_debug_output.cc
203         (Output_reduced_debug_info_section::get_die_end): Remove
204         DW_FORM_GNU_ref_index.  Add default case.
205
206 2012-04-26  Mark Wielaard  <mjw@redhat.com>
207
208         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
209         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
210         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
211         DW_AT_high_pc as offset from DW_AT_low_pc.
212
213         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
214         * testsuite/Makefile.in: Regenerate.
215         * testsuite/gdb_index_test_3.c: New test source file.
216         * testsuite/gdb_index_test_3.sh: New test source file.
217
218 2012-04-25  Ian Lance Taylor  <iant@google.com>
219
220         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
221         pointer.
222         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
223         as a class, not a struct.
224         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
225         (Target_arm::apply_cortex_a8_workaround): Likewise.
226         * gc.h: Declare Reloc_types as a struct, not a class.
227         * object.h: Declare Symbols_data as a struct.
228         * reloc.h: Declare Read_relocs_data as a struct.
229         * target.h: Declare Relocate_info as a struct.
230
231 2012-04-24  David S. Miller  <davem@davemloft.net>
232
233         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
234         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
235         and R_SPARC_WPLT30.
236
237 2012-04-24  Cary Coutant  <ccoutant@google.com>
238
239         * incremental-dump.cc (find_input_containing_global): Replace
240         magic number with symbolic constant.
241         (dump_incremental_inputs): Update version number.
242         * incremental.cc (Output_section_incremental_inputs): Update version
243         number; import symbolic constants from Incremental_inputs_reader.
244         (Incremental_inputs::create_data_sections): Align relocations
245         section correctly for 64-bit targets.
246         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
247         constants; add padding.
248         (Output_section_incremental_inputs::write_header): Add assert for
249         header_size.
250         (Output_section_incremental_inputs::write_input_files): Add assert
251         for input_entry_size.
252         (Output_section_incremental_inputs::write_info_blocks): Add padding;
253         add assert for object_info_size, input_section_entry_size,
254         global_sym_entry_size.
255         * incremental.h (Incremental_inputs_reader): Add symbolic constants
256         for data structure sizes; use them.
257         (Incremental_input_entry_reader): Import symbolic constants from
258         Incremental_inputs_reader; use them.
259
260 2012-04-23  David S. Miller  <davem@davemloft.net>
261
262         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
263         and elf_flags_set_.
264         (Target_sparc::Target_sparc): Initialize new fields.
265         (Target_sparc::do_make_elf_object): New function.
266         (Target_sparc::do_adjust_elf_header): New function.
267
268 2012-04-23  Cary Coutant  <ccoutant@google.com>
269
270         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
271         CU range table of gdb index.
272
273 2012-04-20  David S. Miller  <davem@davemloft.net>
274
275         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
276         instead of false.
277
278 2012-04-16  David S. Miller  <davem@davemloft.net>
279
280         * sparc.cc (Target_sparc::got_address): New function.
281         (Sparc_relocate_functions::gdop_hix22): New function.
282         (Sparc_relocate_functions::gdop_lox10): New function.
283         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
284         relocs.
285         (Target_sparc::Scan::local): Likewise if the global symbol is not
286         preemptible and is not IFUNC.
287         (Target_sparc::Relocate::relocate): Perform GOTDATA code
288         transformations for local and non-preemptible non-IFUNC global
289         symbols.
290
291         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
292         writing out 64-bit part of ranges.
293
294         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
295         -fpic and -fpie respectively.
296         * Makefile.in: Regenerate.
297
298         * sparc.cc (class Target_sparc): Add rela_ifunc_.
299         (Target_sparc::Target_sparc): Initialize new field.
300         (Target_sparc::do_plt_section_for_global): New function.
301         (Target_sparc::do_plt_section_for_local): New function.
302         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
303         (Target_sparc::make_plt_section): New function, broken out of
304         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
305         (Target_sparc::make_plt_entry): Call make_plt_section.
306         (Target_sparc::make_local_ifunc_plt_entry): New function.
307         (Target_sparc::rela_ifunc_section): New function.
308         (Target_sparc::plt_section): Remove const.
309         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
310         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
311         and ifunc_count_ fields.
312         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
313         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
314         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
315         (Output_data_plt_sparc::rela_ifunc): New function.
316         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
317         (Output_data_plt_sparc::has_ifunc_section): New function.
318         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
319         (Output_data_plt_sparc::address_for_global): New function.
320         (Output_data_plt_sparc::address_for_local): New function.
321         (Output_data_plt_sparc::plt_index_to_offset): New function.
322         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
323         and entry_count.
324         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
325         entry_count.
326         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
327         R_SPARC_JMP_IREL to switch.
328         (Target_sparc::Scan::check_non_pic): Likewise.
329         (Target_sparc::Scan::local): Handle IFUNC symbols.
330         (Target_sparc::Scan::local): Likewise.
331         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
332         and plt_address_for_local.
333         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
334         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
335
336         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
337         (class Output_data_reloc): Adjust calls to Output_reloc_type.
338         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
339         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
340         global relocs too.
341         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
342         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
343         calls.
344         * sparc.cc (Target_sparc::Scan::global): Likewise.
345         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
346
347 2012-04-16  Cary Coutant  <ccoutant@google.com>
348
349         * archive.cc (Library_base::should_include_member): Check for
350         --export-dynamic-symbol.
351         * options.h (class General_options): Add --export-dynamic-symbol.
352         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
353         --export-dynamic-symbol.
354         (Symbol_table::gc_mark_undef_symbols): Likewise.
355         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
356
357 2012-04-12  David S. Miller  <davem@davemloft.net>
358
359         * sparc.cc (Reloc::wdisp10): New relocation method.
360         (Reloc::h34): Likewise.
361         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
362         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
363         R_SPARC_WDISP10.
364         (Target_sparc::Scan::local): Likewise.
365         (Target_sparc::Scan::global): Likewise.
366         (Target_sparc::Relocate::relocate): Likewise.
367
368 2012-04-09  Cary Coutant  <ccoutant@google.com>
369
370         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
371         low_pc == 0.
372
373 2012-04-06  Ian Lance Taylor  <iant@google.com>
374
375         * timer.cc: #include <unistd.h>.
376
377 2012-04-06  Roland McGrath  <mcgrathr@google.com>
378
379         * configure.in (AC_CHECK_HEADERS): Add locale.h.
380         * config.in: Regenerate.
381         * configure: Regenerate.
382
383 2012-04-05  Nick Clifton  <nickc@redhat.com>
384
385         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
386         (AM_LC_MESSAGES): Add.
387         * aclocal.m4: Regenerate.
388         * config.in: Regenerate.
389         * configure: Regenerate.
390
391 2012-03-21  Cary Coutant  <ccoutant@google.com>
392
393         * Makefile.am: Add gdb-index.cc, gdb-index.h.
394         * Makefile.in: Regenerate.
395         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
396         (Sized_elf_reloc_mapper::symbol_section): New function.
397         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
398         (make_elf_reloc_mapper): New function.
399         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
400         (Dwarf_abbrev_table::do_read_abbrevs): New function.
401         (Dwarf_abbrev_table::do_get_abbrev): New function.
402         (Dwarf_ranges_table::read_ranges_table): New function.
403         (Dwarf_ranges_table::read_range_list): New function.
404         (Dwarf_pubnames_table::read_section): New function.
405         (Dwarf_pubnames_table::read_header): New function.
406         (Dwarf_pubnames_table::next_name): New function.
407         (Dwarf_die::Dwarf_die): New function.
408         (Dwarf_die::read_attributes): New function.
409         (Dwarf_die::skip_attributes): New function.
410         (Dwarf_die::set_name): New function.
411         (Dwarf_die::set_linkage_name): New function.
412         (Dwarf_die::attribute): New function.
413         (Dwarf_die::string_attribute): New function.
414         (Dwarf_die::int_attribute): New function.
415         (Dwarf_die::uint_attribute): New function.
416         (Dwarf_die::ref_attribute): New function.
417         (Dwarf_die::child_offset): New function.
418         (Dwarf_die::sibling_offset): New function.
419         (Dwarf_info_reader::check_buffer): New function.
420         (Dwarf_info_reader::parse): New function.
421         (Dwarf_info_reader::do_parse): New function.
422         (Dwarf_info_reader::do_read_string_table): New function.
423         (Dwarf_info_reader::lookup_reloc): New function.
424         (Dwarf_info_reader::get_string): New function.
425         (Dwarf_info_reader::visit_compilation_unit): New function.
426         (Dwarf_info_reader::visit_type_unit): New function.
427         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
428         Sized_elf_reloc_mapper.
429         (Sized_dwarf_line_info::symbol_section): Remove function.
430         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
431         (Sized_dwarf_line_info::read_line_mappings): Remove object
432         parameter, adjust callers.
433         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
434         * dwarf_reader.h: Include <sys/types.h>.
435         (class Track_relocs): Remove forward declaration.
436         (class Elf_reloc_mapper): New class.
437         (class Sized_elf_reloc_mapper): New class.
438         (class Dwarf_abbrev_table): New class.
439         (class Dwarf_range_list): New class.
440         (class Dwarf_ranges_table): New class.
441         (class Dwarf_pubnames_table): New class.
442         (class Dwarf_die): New class.
443         (class Dwarf_info_reader): New class.
444         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
445         (Sized_dwarf_line_info::symbol_section): Remove member function.
446         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
447         base class.
448         * gdb-index.cc: New source file.
449         * gdb-index.h: New source file.
450         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
451         and .debug_types sections, call Layout::add_to_gdb_index.
452         (Sized_relobj_incr::do_section_name): Implement.
453         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
454         return type; Implement.
455         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
456         return type.
457         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
458         parameter list and return type.
459         (Sized_incr_dynobj::do_section_contents): Likewise.
460         * layout.cc: Include gdb-index.h.
461         (Layout::Layout): Initialize gdb_index_data_.
462         (Layout::init_fixed_output_section): Check for .gdb_index section.
463         (Layout::add_to_gdb_index): New function. Instantiate.
464         * layout.h: Add forward declaration for class Gdb_index.
465         (Layout::add_to_gdb_index): New member function.
466         (Layout::gdb_index_data_): New data member.
467         * main.cc: Include gdb-index.h.
468         (main): Print statistics for gdb index.
469         * object.cc (Object::section_contents): Move code into
470         do_section_contents.
471         (need_decompressed_section): Check for sections needed when building
472         gdb index.
473         (build_compressed_section_map): Likewise.
474         (Sized_relobj_file::do_read_symbols): Need local symbols when building
475         gdb index.
476         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
477         sections; call Layout::add_to_gdb_index.
478         (Sized_relobj_file::do_decompressed_section_contents): Call
479         do_section_contents directly.
480         * object.h (Object::do_section_contents): Adjust parameter list and
481         return type.
482         (Object::do_decompressed_section_contents): Call do_section_contents
483         directly.
484         (Sized_relobj_file::do_section_contents): Adjust parameter list and
485         return type.
486         * options.h (class General_options): Add --gdb-index option.
487         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
488         list and return type.
489         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
490         * reloc.h (Track_relocs::checkpoint): New function.
491         (Track_relocs::reset): New function.
492
493         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
494         New test cases.
495         * testsuite/Makefile.in: Regenerate.
496         * testsuite/gdb_index_test.cc: New test source file.
497         * testsuite/gdb_index_test_1.sh: New test source file.
498         * testsuite/gdb_index_test_2.sh: New test source file.
499
500 2012-03-19  Doug Kwan  <dougkwan@google.com>
501
502         * arm.cc (Target_arm::do_define_standard_symbols): New method.
503         (Target_arm::do_finalize_sections): Remove code which defines
504         __exidx_start and __exidx_end.  Make symbol table parameter
505         anonymous as it is not used.
506         * gold.cc (queue_middle_tasks): Call target hook to define any
507         target-specific symbols.
508         * target.h (Target::define_standard_symbols): New method.
509         (Target::do_define_standard_symbols): Same.
510         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
511         * testsuite/Makefile.in: Regenerate.
512         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
513         and __exidx_end.
514         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
515         relocations are generated for __exidx_start and __exidx_end.
516
517 2012-03-16  Doug Kwan  <dougkwan@google.com>
518
519         * testsuite/Makefile.am: Disable test initpri3b.
520         * testsuite/Makefile.in: Regenerate.
521
522 2012-03-15  Doug Kwan  <dougkwan@google.com>
523
524         * arm.cc (Target_arm::got_section): Make .got section read-only
525         if -z now is given.
526
527 2012-03-15  Ian Lance Taylor  <iant@google.com>
528
529         PR gold/13850
530         * layout.cc (Layout::make_output_section): Correctly mark
531         SHT_INIT_ARRAY, et. al., as relro.
532
533 2012-03-14  Doug Kwan  <dougkwan@google.com>
534
535         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
536         dynamic relocations for protected symbols in shared objects.
537
538 2012-03-13  Ian Lance Taylor  <iant@google.com>
539
540         * resolve.cc (Symbol_table::resolve): When merging common symbols,
541         keep the larger alignment.
542
543 2012-03-12  Cary Coutant  <ccoutant@google.com>
544
545         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
546         handling of DW_LNE_define_file.
547
548 2012-03-12  Cary Coutant  <ccoutant@google.com>
549
550         * reduced_debug_output.cc
551         (Output_reduced_debug_info_section::get_die_end): Add new FORM
552         codes to switch.
553
554 2012-02-29  Cary Coutant  <ccoutant@google.com>
555
556         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
557
558 2012-02-29  Cary Coutant  <ccoutant@google.com>
559
560         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
561         Call Object::decompressed_section_contents.
562         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
563         New dtor.
564         (Sized_dwarf_line_info::buffer_start_): New data member.
565         * merge.cc (Output_merge_data::do_add_input_section): Call
566         Object::decompressed_section_contents.
567         (Output_merge_string::do_add_input_section): Likewise.
568         * object.cc (need_decompressed_section): New function.
569         (build_compressed_section_map): Decompress sections needed later.
570         (Sized_relobj_file::do_decompressed_section_contents): New function.
571         (Sized_relobj_file::do_discard_decompressed_sections): New function.
572         * object.h (Object::decompressed_section_contents): New function.
573         (Object::discard_decompressed_sections): New function.
574         (Object::do_decompressed_section_contents): New function.
575         (Object::do_discard_decompressed_sections): New function.
576         (Compressed_section_info): New type.
577         (Compressed_section_map): Include decompressed section contents.
578         (Sized_relobj_file::do_decompressed_section_contents): New function.
579         (Sized_relobj_file::do_discard_decompressed_sections): New function.
580
581 2012-02-16  Cary Coutant  <ccoutant@google.com>
582
583         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
584         * testsuite/Makefile.in: Regenerate.
585
586 2012-02-14  Cary Coutant  <ccoutant@google.com>
587
588         * options.cc (General_options::finalize): Disallow -pie and -static.
589
590 2012-02-03  Doug Kwan  <dougkwan@google.com>
591
592         * arm.cc (Arm_relocate_functions::abs8,
593         Arm_relocate_functions::abs16): Use
594         Bits::has_signed_unsigned_overflow32.
595         (Arm_relocate_functions::thm_abs8): Correct range of
596         overflow check.
597         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
598         in assertions.
599
600 2012-02-02  Doug Kwan  <dougkwan@google.com>
601
602         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
603         position independent outputs, not just shared objects.
604
605 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
606
607         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
608         * configure: Regenerated.
609
610 2012-01-27  Ian Lance Taylor  <iant@google.com>
611
612         * reloc.h (Bits): New class with static functions, copied from
613         namespace utils in arm.cc.
614         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
615         instead.
616
617 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
618
619         * incremental.cc (write_info_blocks): Correct relocation offset.
620
621 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
622
623         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
624         (Relocate::tls_gd_to_le): Likewise.
625
626 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
627
628         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
629
630 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
631
632         * configure.ac: Check if -mcmodel=medium works.
633         * configure: Regenerated.
634
635 2012-01-24  Cary Coutant  <ccoutant@google.com>
636
637         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
638         definition and ...
639         (read_unsigned_LEB_128_x): ... this new function.
640         (read_signed_LEB_128): Replaced with inline definition and ...
641         (read_signed_LEB_128_x): ... this new function.
642         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
643         (read_unsigned_LEB_128): Add inline definition.
644         (read_signed_LEB_128_x): New function.
645         (read_signed_LEB_128): Add inline definition.
646         * testsuite/Makefile.am (leb128_unittest): New unit test.
647         * testsuite/Makefile.in: Regenerate.
648         * testsuite/leb128_unittest.cc: New unit test.
649
650 2012-01-23  Ian Lance Taylor  <iant@google.com>
651
652         PR gold/13617
653         * i386.cc (Target_i386::do_code_fill): When using a jmp
654         instruction, pad with nop instructions.
655         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
656
657 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
658
659         * x86_64.cc (gc_process_relocs): Add typename on types used in
660         template.
661         (scan_relocs): Likewise.
662         (relocate_section): Likewise.
663         (apply_relocation): Likewise.
664
665 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
666
667         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
668         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
669         under x32.
670
671 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
672
673         * x86_64.cc: Initial support for x32.
674
675 2012-01-03  Cary Coutant  <ccoutant@google.com>
676
677         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
678         Use abstract base class for GOT.
679         * gold/output.h (class Output_data_got_base): New abstract base class.
680         (class Output_data_got): Derive from new base class, adjust ctors.
681         (Output_data_got::reserve_slot): Make virtual; rename to
682         do_reserve_slot; Adjust callers.
683         * gold/target.h (Sized_target::init_got_plt_for_update): Return
684         pointer to abstract base class.
685         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
686
687 2011-12-18  Ian Lance Taylor  <iant@google.com>
688
689         * object.h (Relobj::local_symbol_value): New function.
690         (Relobj::local_plt_offset): New function.
691         (Relobj::local_has_got_offset): New function.
692         (Relobj::local_got_offset): New function.
693         (Relobj::set_local_got_offset): New function.
694         (Relobj::do_local_symbol_value): New pure virtual function.
695         (Relobj::do_local_plt_offset): Likewise.
696         (Relobj::do_local_has_got_offset): Likewise.
697         (Relobj::do_local_got_offset): Likewise.
698         (Relobj::do_set_local_got_offset): Likewise.
699         (Sized_relobj::do_local_has_got_offset): Rename from
700         local_has_got_offset.
701         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
702         (Sized_relobj::do_set_local_got_offset): Rename from
703         set_local_got_offset.
704         (Sized_relobj_file::do_local_plt_offset): Rename from
705         local_plt_offset.
706         (Sized_relobj_file::do_local_symbol_value): New function.
707         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
708         local_plt_offset.
709         * output.cc (Output_data_got::Got_entry::write): Change object to
710         Relobj.  Use local_symbol_value.
711         (Output_data_got::add_global_with_rel): Change rel_dyn to
712         Output_data_reloc_generic*.  Use add_global_generic.
713         (Output_data_got::add_global_with_rela): Remove.  Change all
714         callers to use add_global_with_rel.
715         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
716         Output_data_reloc_generic*.  Use add_global_generic.
717         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
718         callers to use add_global_pair_with_rel.
719         (Output_data_got::add_local): Change object to Relobj*.
720         (Output_data_got::add_local_plt): Likewise.
721         (Output_data_got::add_local_with_rel): Change object to Relobj*,
722         change rel_dyn to Output_data_reloc_generic*.  Use
723         add_local_generic.
724         (Output_data_got::add_local_with_rela): Remove.  Change all
725         callers to use all_local_with_rel.
726         (Output_data_got::add_local_pair_with_rel): Change object to
727         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
728         add_output_section_generic.
729         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
730         callers to use add_local_pair_with_rel.
731         (Output_data_got::reserve_local): Change object to Relobj*.
732         * output.h: (class Output_data_reloc_generic): Add pure virtual
733         declarations for add_global_generic, add_local_generic,
734         add_output_section_generic.
735         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
736         functions for Output_data_reloc_generic.  Update declarations for
737         changes listed in output.cc.
738         (class Output_data_got): Change template parameter to got_size.
739         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
740         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
741         function.
742         (Sized_relobj_incr::do_local_plt_offset): New function.
743         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
744         add_global_generic.
745
746 2011-12-17  Cary Coutant  <ccoutant@google.com>
747
748         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
749         * resolve.cc (Symbol_table::resolve): Likewise.
750         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
751         arrays.
752         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
753
754 2011-12-16  Ian Lance Taylor  <iant@google.com>
755
756         * output.h (Output_data_reloc_generic::add): Only call
757         add_dynamic_reloc if this is a dynamic reloc section.
758
759 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
760
761         PR gold/13505
762         * target-reloc.h (apply_relocation): Replace <64, false> with
763         <size, big_endian>.
764
765 2011-11-25  Nick Clifton  <nickc@redhat.com>
766
767         * po/it.po: New Italian translation.
768
769 2011-11-17  Sterling Augustine  <saugustine@google.com>
770
771         * script.cc (script_include_directive): Implement.
772         (read_script_file): New local variables name and search_path. Update
773         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
774         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
775         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
776
777 2011-11-11  Sterling Augustine  <saugustine@google.com>
778
779         * yyscript.y (section_cmd): Add support for INCLUDE directive.
780         (file_or_sections_cmd): Likewise.
781
782 2011-11-11  Doug Kwan  <dougkwan@google.com>
783
784         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
785         if --just-symbols is given.
786
787 2011-11-10  Doug Kwan  <dougkwan@google.com>
788
789         PR gold/13362
790         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
791         when processing data relocs.
792         * reloc.h (Relocate_functions::rel_unaligned): New method.
793         (Relocate_functions::pcrel_unaligned): Ditto.
794         (Relocate_functions::rel32_unaligned): Ditto.
795         (Relocate_functions::pcrel32_unaligned): Ditto.
796
797 2011-11-09  Doug Kwan  <dougkwan@google.com>
798
799         PR gold/13362
800         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
801         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
802         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
803         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
804         (Relocate_functions::rel_unaligned): New.
805         (Relocate_functions::rel32_unaligned): New.
806         * target-reloc.h (relocate_for_relocatable): Add code to handle
807         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
808         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
809         arm_unaligned_reloc_r): New targets.
810         * testsuite/Makefile.in: Regenerate.
811         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
812         linking.
813
814 2011-11-02  Ian Lance Taylor  <iant@google.com>
815
816         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
817         NATIVE_LINKER.
818         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
819         * options.cc (General_options::finalize): Use library search path
820         from configure script if specified.  If not native and no sysroot,
821         only search TOOLLIBDIR.
822         * options.h (Search_directory::Search_directory): Change name to
823         const std::string&.
824         (General_options::add_to_library_path_with_sysroot): Change arg to
825         const std::string&.
826         * configure, Makefile.in, config.in: Rebuild.
827
828 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
829
830         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
831         we are working around the ARM1176 Erratum.
832         * options.h (General_options::fix_arm1176): Add option.
833         * testsuite/Makefile.am: Add testcases, and keep current ones
834         working.
835         * testsuite/Makefile.in: Regenerate.
836         * testsuite/arm_fix_1176.s: New file.
837         * testsuite/arm_fix_1176.sh: Likewise.
838
839 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
840
841         * arm.cc (Target_arm::Target_arm): Remove initialisation of
842         may_use_blx_.
843         (Target_arm::may_use_blx): Remove method.
844         (Target_arm::set_may_use_blx): Likewise.
845         (Target_arm::may_use_v4t_interworking): New method.
846         (Target_arm::may_use_v5t_interworking): Likewise.
847         (Target_arm::may_use_blx_): Remove member variable.
848         (Arm_relocate_functions::arm_branch_common): Check for v5T
849         interworking.
850         (Arm_relocate_functions::thumb_branch_common): Likewise.
851         (Reloc_stub::stub_type_for_reloc): Likewise.
852         (Target_arm::do_finalize_sections): Correct interworking checks.
853         * testsuite/Makefile.am: Add new tests.
854         * testsuite/Makefile.in: Regenerate.
855         * testsuite/arm_farcall_arm_arm.s: New test.
856         * testsuite/arm_farcall_arm_arm.sh: Likewise.
857         * testsuite/arm_farcall_arm_thumb.s: Likewise.
858         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
859         * testsuite/arm_farcall_thumb_arm.s: Likewise.
860         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
861         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
862         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
863
864 2011-10-31  Cary Coutant  <ccoutant@google.com>
865
866         PR gold/13023
867         * expression.cc (Expression::eval_with_dot): Add
868         is_section_dot_assignment parameter.
869         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
870         absolute and assigning to dot within a section.
871         * script-sections.cc
872         (Output_section_element_assignment::set_section_addresses): Pass
873         dot_section to set_if_absolute.
874         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
875         as is_section_dot_assignment flag to eval_with_dot.
876         (Output_section_element_dot_assignment::set_section_addresses):
877         Likewise.
878         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
879         parameter.  Also set value if relative to dot_section; set the
880         symbol's output_section.
881         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
882         parameter.  Adjust all callers.
883         (Expression::eval_maybe_dot): Likewise.
884         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
885         Adjust all callers.
886         * testsuite/script_test_2.t: Test assignment of an absolute value
887         to dot within an output section element.
888
889 2011-10-31  Cary Coutant  <ccoutant@google.com>
890
891         * options.h (class General_options): Add --[no-]gnu-unique options.
892         * symtab.cc (Symbol_table::sized_write_globals): Convert
893         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
894
895 2011-10-31  Cary Coutant  <ccoutant@google.com>
896
897         PR gold/13359
898         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
899         unnecessary assertion.
900         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
901
902 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
903
904         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
905         gc_mark_symbol.
906         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
907         gc_mark_symbol.
908         Change to just keep the section associated with symbol.
909         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
910         they are externally visible and --export-dynamic is turned on.
911         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
912
913 2011-10-19  Ian Lance Taylor  <iant@google.com>
914
915         PR gold/13163
916         * script-sections.cc
917         (Output_section_element_dot_assignment::needs_output_section): New
918         function.
919
920 2011-10-19  Ian Lance Taylor  <iant@google.com>
921
922         PR gold/13204
923         * layout.cc (Layout::segment_precedes): Don't assert failure if a
924         --section-start option was seen.
925         * options.h (General_options::any_section_start): New function.
926
927 2011-10-18  David S. Miller  <davem@davemloft.net>
928
929         PR binutils/13301
930         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
931         member to track relocation locations that have moved during TLS
932         reloc optimizations.
933         (Target_sparc::Relocate::Relocate): Initialize to NULL.
934         (Target_sparc::Relocate::relocate): Adjust view down by 4
935         bytes if it matches reloc_adjust_addr_.
936         (Target_sparc::Relocate::relocate_tls): Always move the
937         __tls_get_addr call delay slot instruction forward 4 bytes when
938         performing relaxation.
939
940 2011-10-18  Cary Coutant  <ccoutant@google.com>
941
942         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
943         (Output_file::map_no_anonymous): Check for non-zero
944         return code from posix_fallocate.
945
946 2011-10-17  Cary Coutant  <ccoutant@google.com>
947
948         PR gold/13245
949         * plugin.cc (is_visible_from_outside): Check for symbols
950         referenced from dynamic objects.
951         * resolve.cc (Symbol_table::resolve): Don't count references
952         from dynamic objects as references from real ELF files.
953         * testsuite/plugin_test_2.sh: Adjust expected result.
954
955 2011-10-17  Cary Coutant  <ccoutant@google.com>
956
957         * gold.cc: Include timer.h.
958         (queue_middle_tasks): Stamp time.
959         (queue_final_tasks): Likewise.
960         * main.cc (main): Store timer in parameters.  Print timers
961         for each pass.
962         * parameters.cc (Parameters::Parameters): Initialize timer_.
963         (Parameters::set_timer): New function.
964         (set_parameters_timer): New function.
965         * parameters.h (Parameters::set_timer): New function.
966         (Parameters::timer): New function.
967         (Parameters::timer_): New data member.
968         (set_parameters_timer): New function.
969         * timer.cc (Timer::stamp): New function.
970         (Timer::get_pass_time): New function.
971         * timer.h (Timer::stamp): New function.
972         (Timer::get_pass_time): New function.
973         (Timer::pass_times_): New data member.
974
975 2011-10-17  Cary Coutant  <ccoutant@google.com>
976
977         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
978         task for members of lib groups.
979
980 2011-10-17  Cary Coutant  <ccoutant@google.com>
981
982         PR gold/13288
983         * fileread.cc (File_read::find_view): Add assert.
984         (File_read::make_view): Move bounds check (replace with assert)...
985         (File_read::find_or_make_view): ... to here.
986
987 2011-10-12  Cary Coutant  <ccoutant@google.com>
988
989         * output.cc (Output_file::open_base_file): Handle case where
990         ::read returns less than requested size.
991
992 2011-10-10  Cary Coutant  <ccoutant@google.com>
993
994         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
995         Initialize defined_count_.
996         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
997         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
998         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
999         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1000         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1001         * incremental.h (Sized_relobj_incr::defined_count_): New data
1002         member.
1003         (Sized_incr_dynobj::defined_count_): New data member.
1004         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1005         Return zeroes instead of internal error.
1006
1007 2011-10-10  Cary Coutant  <ccoutant@google.com>
1008
1009         PR gold/13249
1010         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1011         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1012         * output.h (class Output_reloc): Add use_plt_offset flag.
1013         (Output_reloc::type_): Adjust size of bit field.
1014         (Output_reloc::use_plt_offset_): New bit field.
1015         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1016         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1017         flag.  Adjust all callers.
1018         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1019         creating RELATIVE relocations.
1020
1021 2011-10-10  Nick Clifton  <nickc@redhat.com>
1022
1023         * po/es.po: Updated Spanish translation.
1024         * po/fi.po: Updated Finnish translation.
1025
1026 2011-10-03   Diego Novillo  <dnovillo@google.com>
1027
1028         * options.cc (parse_uint): Fix dereference of RETVAL.
1029
1030 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1031
1032         * layout.h (section_order_map_): New member.
1033         (get_section_order_map): New member function.
1034         * output.cc (Output_section::add_input_section): Check for patterns
1035         only when --section-ordering-file is specified.
1036         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1037         output_sections have been formed.
1038         * layout.cc (Layout_Layout): Initialize section_order_map_.
1039         * plugin.cc (update_section_order): Store order in order_map. Do not
1040         update the order.
1041         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1042         * testsuite/Makefile.in: Regenerate.
1043         * testsuite/plugin_section_order.c: New file.
1044         * testsuite/plugin_final_layout.cc: New file.
1045         * testsuite/plugin_final_layout.sh: New file.
1046
1047 2011-09-29  Cary Coutant  <ccoutant@google.com>
1048
1049         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1050         Check for NULL.
1051         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1052         symbols during incremental update.
1053         (Symbol_table::add_from_dynobj): Likewise.
1054
1055 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1056             Ian Lance Taylor  <iant@google.com>
1057
1058         * symtab.cc (Symbol_table::define_special_symbol): Always
1059         canonicalize version string.
1060
1061 2011-09-26  Cary Coutant  <ccoutant@google.com>
1062
1063         * gold.cc (queue_initial_tasks): Move option checks ...
1064         * options.cc (General_options::finalize): ... to here. Disable
1065         some options; make others fatal.
1066
1067 2011-09-26  Cary Coutant  <ccoutant@google.com>
1068
1069         gcc PR lto/47247
1070         * plugin.cc (get_symbols_v2): New function.
1071         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1072         (is_referenced_from_outside): New function.
1073         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1074         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1075         (get_symbols): Pass version parameter.
1076         (get_symbols_v2): New function.
1077         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1078         parameter.
1079         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1080         (onload): Add LDPT_GET_SYMBOLS_V2.
1081         (all_symbols_read_hook): Use get_symbols_v2; check for
1082         LDPR_PREVAILING_DEF_IRONLY_EXP.
1083         * testsuite/plugin_test_3.sh: Update expected results.
1084
1085 2011-09-23  Simon Baldwin  <simonb@google.com>
1086
1087         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1088         configuration options.
1089         * configure: Regenerate.
1090         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1091         * Makefile.in: Regenerate.
1092         * testsuite/Makefile.in: Regenerate.
1093
1094 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1095
1096         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1097
1098 2011-09-19  Cary Coutant  <ccoutant@google.com>
1099
1100         * incremental.cc (can_incremental_update): Fix typo in comment.
1101         * incremental.h (can_incremental_update): Likewise.
1102
1103 2011-09-18  Cary Coutant  <ccoutant@google.com>
1104
1105         * incremental.cc (can_incremental_update): New function.
1106         * incremental.h (can_incremental_update): New function.
1107         * layout.cc (Layout::init_fixed_output_section): Call it.
1108         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1109         * object.cc (Sized_relobj_file::do_layout): Call
1110         can_incremental_update.
1111
1112 2011-09-13  Cary Coutant  <ccoutant@google.com>
1113
1114         * configure.ac: Check for glibc support for gnu_indirect_function
1115         support with static linking, setting automake conditional
1116         IFUNC_STATIC.
1117         * Makefile.in: Regenerate.
1118         * configure: Regenerate.
1119
1120         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1121         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1122         for IFUNC_STATIC.
1123         * testsuite/Makefile.in: Regenerate.
1124
1125 2011-09-13  Cary Coutant  <ccoutant@google.com>
1126
1127         * incremental.cc (Sized_relobj_incr::do_layout): Call
1128         report_comdat_group for kept comdat sections.
1129         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1130         * testsuite/Makefile.in: Regenerate.
1131         * testsuite/incr_comdat_test_1.cc: New source file.
1132         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1133         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1134         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1135
1136 2011-09-13  Ian Lance Taylor  <iant@google.com>
1137
1138         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1139         variable external_symbols_offset.
1140
1141 2011-09-12  Ian Lance Taylor  <iant@google.com>
1142
1143         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1144         triggered if object has no symbols.
1145
1146 2011-09-09  David S. Miller  <davem@davemloft.net>
1147
1148         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1149         (Output_fill_debug_line::do_write): Likewise.
1150
1151 2011-08-29  Cary Coutant  <ccoutant@google.com>
1152
1153         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1154         casts to match formatting specs.
1155         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1156
1157 2011-08-26  Cary Coutant  <ccoutant@google.com>
1158
1159         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1160         remaining hole size when allocating.
1161         (Layout::make_output_section): Set fill methods for debug sections.
1162         * layout.h (Free_list::Free_list_node): Move from private to
1163         public.
1164         (Free_list::set_min_hole_size): New function.
1165         (Free_list::begin, Free_list::end): New functions.
1166         (Free_list::min_hole_): New data member.
1167         * output.cc: Include dwarf.h.
1168         (Output_fill_debug_info::do_minimum_hole_size): New function.
1169         (Output_fill_debug_info::do_write): New function.
1170         (Output_fill_debug_line::do_minimum_hole_size): New function.
1171         (Output_fill_debug_line::do_write): New function.
1172         (Output_section::Output_section): Initialize new data member.
1173         (Output_section::set_final_data_size): Ensure patch space is larger
1174         than minimum hole size.
1175         (Output_section::do_write): Fill holes in debug sections.
1176         * output.h (Output_fill): New class.
1177         (Output_fill_debug_info): New class.
1178         (Output_fill_debug_line): New class.
1179         (Output_section::set_free_space_fill): New function.
1180         (Output_section::free_space_fill_): New data member.
1181         * testsuite/Makefile.am (incremental_test_3): Add
1182         --incremental-patch option.
1183         (incremental_test_4): Likewise.
1184         (incremental_test_5): Likewise.
1185         (incremental_test_6): Likewise.
1186         (incremental_copy_test): Likewise.
1187         (incremental_common_test_1): Likewise.
1188         * testsuite/Makefile.in: Regenerate.
1189
1190 2011-08-26  Nick Clifton  <nickc@redhat.com>
1191
1192         * po/es.po: Updated Spanish translation.
1193
1194 2011-08-01  Cary Coutant  <ccoutant@google.com>
1195
1196         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1197         * gold/testsuite/Makefile.in: Regenerate.
1198         * gold/testsuite/justsyms_exec.c: New source file.
1199         * gold/testsuite/justsyms_lib.c: New source file.
1200
1201 2011-08-01  Cary Coutant  <ccoutant@google.com>
1202
1203         * layout.cc (Layout::set_segment_offsets): Don't realign text
1204         segment if -Ttext was specified.
1205         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1206         file type.
1207         * object.h (Sized_relobj_file::e_type): New function.
1208         (Sized_relobj_file::e_type_): New data member.
1209         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1210         base address for ET_EXEC files.
1211         * target.cc (Target::do_make_elf_object_implementation): Allow
1212         ET_EXEC files with --just-symbols option.
1213
1214 2011-07-28  Cary Coutant  <ccoutant@google.com>
1215
1216         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1217         Add thread_number parameter.
1218         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1219         * workqueue-threads.cc
1220         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1221         current thread if its thread number is greater than desired thread
1222         count.
1223         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1224         Add thread_number parameter.
1225         (Workqueue::should_cancel_thread): Likewise.
1226         (Workqueue::find_runnable_or_wait): Pass thread_number to
1227         should_cancel_thread.
1228         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1229         parameter.
1230
1231 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1232
1233         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1234         only after checking if it cannot be forced local.
1235         * symtab.h (is_externally_visible): Check if the symbol is not forced
1236         local.
1237
1238 2011-07-15  Ian Lance Taylor  <iant@google.com>
1239
1240         * options.h (class General_options): Add --print-output-format.
1241         Move -EL next to -EB, for  better --help output.
1242         * target-select.cc: Include <cstdio>, "options.h", and
1243         "parameters.h".
1244         (Target_selector::do_target_bfd_name): New function.
1245         (print_output_format): New function.
1246         * target-select.h (class Target_selector): Update declarations.
1247         (Target_selector::target_bfd_name): New function.
1248         (print_output_format): Declare.
1249         * main.cc: Include "target-select.h".
1250         (main): Handle --print-output-format.
1251         * gold.cc: Include "target-select.h".
1252         (queue_initial_tasks): Handle --print-output-format when there are
1253         no input files.
1254         * parameters.cc (parameters_force_valid_target): Give a better
1255         error message if -EB/-EL does not match target.
1256         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1257         function.
1258
1259 2011-07-15  Ian Lance Taylor  <iant@google.com>
1260
1261         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1262         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1263         (Output_data_plt_i386::do_write): Write address of .dynamic
1264         section to first entry in .got.plt section.
1265         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1266         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1267         Initialize layout_.
1268         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1269         section to first entry in .got.plt section.
1270         * layout.h (Layout::dynamic_section): New function.
1271
1272 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1273
1274         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1275         to claim_file call.
1276         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1277         input_section_position_, and input_section_glob_.
1278         (read_layout_from_file): Call function section_ordering_specified.
1279         * layout.h (is_section_ordering_specified): New function.
1280         (section_ordering_specified): New function.
1281         (section_ordering_specified_): New boolean member.
1282         * main.cc(main): Call load_plugins after layout object is defined.
1283         * output.cc (Output_section::add_input_section): Use
1284         function section_ordering_specified to check if section ordering is
1285         needed.
1286         * output.cc (Output_section::add_relaxed_input_section): Use
1287         function section_ordering_specified to check if section ordering is
1288         needed.
1289         (Output_section::update_section_layout): New function.
1290         (Output_section::sort_attached_input_sections): Check if input section
1291         must be reordered.
1292         * output.h (Output_section::update_section_layout): New function.
1293         * plugin.cc (get_section_count): New function.
1294         (get_section_type): New function.
1295         (get_section_name): New function.
1296         (get_section_contents): New function.
1297         (update_section_order): New function.
1298         (allow_section_ordering): New function.
1299         (Plugin::load): Add the new interfaces to the transfer vector.
1300         (Plugin_manager::load_plugins): New parameter.
1301         (Plugin_manager::all_symbols_read): New parameter.
1302         (Plugin_manager::claim_file): New parameter. Save the elf object for
1303         unclaimed objects.
1304         (Plugin_manager::get_elf_object): New function.
1305         (Plugin_manager::get_view): Change to directly use the bool to check
1306         if get_view is called from claim_file_hook.
1307         * plugin.h (input_objects): New function
1308         (Plugin__manager::load_plugins): New parameter.
1309         (Plugin_manager::claim_file): New parameter.
1310         (Plugin_manager::get_elf_object): New function.
1311         (Plugin_manager::in_claim_file_handler): New function.
1312         (Plugin_manager::in_claim_file_handler_): New member.
1313         (layout): New function.
1314         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1315         handler with an extra parameter. Make the elf object before calling
1316         claim_file handler.
1317         * testsuite/plugin_test.c (get_section_count): New function pointer.
1318         (get_section_type): New function pointer.
1319         (get_section_name): New function pointer.
1320         (get_section_contents): New function pointer.
1321         (update_section_order): New function pointer.
1322         (allow_section_ordering): New function pointer.
1323         (onload): Check if the new interfaces exist.
1324
1325 2011-07-13  Ian Lance Taylor  <iant@google.com>
1326
1327         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1328         relro section.
1329         * x86_64.cc (Target_x86_64::got_section): Likewise.
1330         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1331         (relro_now_test_SOURCES): New variable.
1332         (relro_now_test_DEPENDENCIES): New variable.
1333         (relro_now_test_LDFLAGS): New variable.
1334         (relro_now_test_LDADD): New variable.
1335         (relro_now_test.so): New target.
1336         * testsuite/Makefile.in: Rebuild.
1337
1338 2011-07-12  Ian Lance Taylor  <iant@google.com>
1339
1340         PR gold/12980
1341         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1342         GLOB_DAT relocation rather than a RELATIVE relocation for a
1343         protected symbol when creating a shared library.
1344         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1345         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1346         * testsuite/protected_main_1.cc (main): Test that protected
1347         function has same address.
1348
1349 2011-07-11  Ian Lance Taylor  <iant@google.com>
1350
1351         PR gold/12979
1352         * options.h (class General_options): Add -Bgroup.
1353         * options.cc (General_options::finalize): If -Bgroup is set,
1354         default to --unresolved-symbols=report-all.
1355         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1356         * target-reloc.h (issue_undefined_symbol_error): Handle
1357         --unresolved-symbols=report-all.
1358
1359 2011-07-08  Ian Lance Taylor  <iant@google.com>
1360
1361         PR gold/11985
1362         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1363         if linker script discards key sections.
1364         (Layout::create_dynamic_symtab): Likewise.
1365         (Layout::assign_local_dynsym_offsets): Likewise.
1366         (Layout::sized_create_version_sections): Likewise.
1367         (Layout::create_interp): Likewise.
1368         (Layout::finish_dynamic_section): Likewise.
1369         (Layout::set_dynamic_symbol_size): Likewise.
1370
1371 2011-07-08  Ian Lance Taylor  <iant@google.com>
1372
1373         PR gold/12386
1374         * options.h (class General_options): Add --unresolved-symbols.
1375         * target-reloc.h (issue_undefined_symbol_error): Check
1376         --unresolved-symbols.  Add comments.
1377
1378 2011-07-08  Ian Lance Taylor  <iant@google.com>
1379
1380         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1381         expression more complex.
1382
1383 2011-07-08  Ian Lance Taylor  <iant@google.com>
1384
1385         PR gold/11317
1386         * target-reloc.h (issue_undefined_symbol_error): New inline
1387         function, broken out of relocate_section.
1388         (relocate_section): Call issue_undefined_symbol_error.
1389         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1390         there is no TLS segment if we are about to issue an undefined
1391         symbol error.
1392         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1393
1394 2011-07-08  Ian Lance Taylor  <iant@google.com>
1395
1396         PR gold/12279
1397         * resolve.cc (Symbol_table::should_override): Add fromtype
1398         parameter.  Change all callers.  Give error when linking together
1399         TLS and non-TLS symbol.
1400         (Symbol_table::should_override_with_special): Add fromtype
1401         parameter.  Change all callers.
1402         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1403         there is no TLS segment if we have reported some errors.
1404         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1405
1406 2011-07-08  Ian Lance Taylor  <iant@google.com>
1407
1408         PR gold/12372
1409         * target.h (Target::plt_address_for_global): New function.
1410         (Target::plt_address_for_local): New function.
1411         (Target::plt_section_for_global): Remove.
1412         (Target::plt_section_for_local): Remove.
1413         (Target::do_plt_address_for_global): New virtual function.
1414         (Target::do_plt_address_for_local): New virtual function.
1415         (Target::do_plt_section_for_global): Remove.
1416         (Target::do_plt_section_for_local): Remove.
1417         (Target::register_global_plt_entry): Add Symbol_table and Layout
1418         parameters.
1419         * output.cc (Output_data_got::Got_entry::write): Use
1420         plt_address_for_global and plt_address_for_local.
1421         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1422         address of output section.
1423         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1424         got_irelative_, and irelative_count_ fields.  Update
1425         declarations.
1426         (Output_data_plt_i386::has_irelative_section): New function.
1427         (Output_data_plt_i386::entry_count): Add irelative_count_.
1428         (Output_data_plt_i386::set_final_data_size): Likewise.
1429         (class Target_i386): Add got_irelative_ and rel_irelative_
1430         fields.  Update declarations.
1431         (Target_i386::Target_i386): Initialize new fields.
1432         (Target_i386::do_plt_address_for_global): New function replacing
1433         do_plt_section_for_global.
1434         (Target_i386::do_plt_address_for_local): New function replacing
1435         do_plt_section_for_local.
1436         (Target_i386::got_section): Create got_irelative_.
1437         (Target_i386::rel_irelative_section): New function.
1438         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1439         fields.  Don't define __rel_iplt_{start,end}.
1440         (Output_data_plt_i386::add_entry): Add symtab and layout
1441         parameters.  Change all callers.  Use different PLT and GOT for
1442         IFUNC symbols.
1443         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1444         layout parameters.  Change all callers.  Use different PLT and
1445         GOT.
1446         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1447         (Output_data_plt_i386::rel_irelative): New function.
1448         (Output_data_plt_i386::address_for_global): New function.
1449         (Output_data_plt_i386::address_for_local): New function.
1450         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1451         IRELATIVE GOT when changing IFUNC GOT entries.
1452         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1453         reloc.
1454         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1455         if we didn't create an IRELATIVE GOT.
1456         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1457         plt_address_for_local.
1458         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1459         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1460         got_irelative_, and irelative_count_ fields.  Update
1461         declarations.
1462         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1463         Initialize new fields.  Remove symtab parameter.  Change all
1464         callers.
1465         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1466         irelative_count_.
1467         (Output_data_plt_x86_64::has_irelative_section): New function.
1468         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1469         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1470         fields.  Update declarations.
1471         (Target_x86_64::Target_x86_64): Initialize new fields.
1472         (Target_x86_64::do_plt_address_for_global): New function replacing
1473         do_plt_section_for_global.
1474         (Target_x86_64::do_plt_address_for_local): New function replacing
1475         do_plt_section_for_local.
1476         (Target_x86_64::got_section): Create got_irelative_.
1477         (Target_x86_64::rela_irelative_section): New function.
1478         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1479         all callers.  Don't create __rel_iplt_{start,end}.
1480         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1481         parameters.  Change all callers.  Use different PLT and GOT for
1482         IFUNC symbols.
1483         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1484         layout parameters.  Change all callers.  Use different PLT and
1485         GOT.
1486         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1487         parameters.  Change all callers.  Use different PLT and GOT for
1488         IFUNC symbols.
1489         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1490         (Output_data_plt_x86_64::rela_irelative): New function.
1491         (Output_data_plt_x86_64::address_for_global): New function.
1492         (Output_data_plt_x86_64::address_for_local): New function.
1493         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1494         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1495         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1496         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1497         parameters.
1498         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1499         reloc.
1500         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1501         symbols if we didn't create an IRELATIVE GOT.
1502         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1503         plt_address_for_local.
1504         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1505         * testsuite/ifuncvar1.c: New test file.
1506         * testsuite/ifuncvar2.c: New test file.
1507         * testsuite/ifuncvar3.c: New test file.
1508         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1509         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1510         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1511         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1512         * testsuite/Makefile.in: Rebuild.
1513
1514 2011-07-07  Cary Coutant  <ccoutant@google.com>
1515
1516         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1517         (two_file_test_1_ndebug.o): Likewise.
1518         (two_file_test_1b_ndebug.o): Likewise.
1519         (two_file_test_2_ndebug.o): Likewise.
1520         (two_file_test_main_ndebug.o): Likewise.
1521         (incremental_test_2): Link with no-debug versions.
1522
1523 2011-07-06  Cary Coutant  <ccoutant@google.com>
1524
1525         * gold/incremental.cc
1526         (Output_section_incremental_inputs::write_info_blocks): Check for
1527         hidden and internal symbols.
1528
1529 2011-07-06  Cary Coutant  <ccoutant@google.com>
1530
1531         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1532         Check disposition for startup file.
1533         (Incremental_inputs::report_command_line): Ignore
1534         --incremental-startup-unchanged option.
1535         * options.cc (General_options::parse_incremental_startup_unchanged):
1536         New function.
1537         (General_options::General_options): Initialize new data member.
1538         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1539         (General_options): Add --incremental-startup-unchanged option.
1540         (General_options::incremental_startup_disposition): New function.
1541         (General_options::incremental_startup_disposition_): New data member.
1542
1543 2011-07-06  Cary Coutant  <ccoutant@google.com>
1544
1545         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1546         input file index to Script_info ctor.
1547         (Sized_incremental_binary::do_file_has_changed): Find the
1548         command-line argument for files named in scripts.
1549         * incremental.h (Script_info::Script_info): New ctor
1550         with input file index.
1551         (Script_info::input_file_index): New function.
1552         (Script_info::input_file_index_): New data member.
1553         (Incremental_binary::get_library): Add const.
1554         (Incremental_binary::get_script_info): Add const.
1555         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1556         * testsuite/Makefile.am (incremental_test_5): New test case.
1557         (incremental_test_6): New test case.
1558         * testsuite/Makefile.in: Regenerate.
1559
1560 2011-07-06  Cary Coutant  <ccoutant@google.com>
1561
1562         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1563         debug output when command lines differ.
1564
1565 2011-07-06  Cary Coutant  <ccoutant@google.com>
1566
1567         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1568         --incremental-patch option.
1569         * layout.cc (Free_list::allocate): Extend allocation beyond original
1570         end if enabled.
1571         (Layout::make_output_section): Mark sections that should get
1572         patch space.
1573         * options.cc (parse_percent): New function.
1574         * options.h (parse_percent): New function.
1575         (DEFINE_percent): New macro.
1576         (General_options): Add --incremental-patch option.
1577         * output.cc (Output_section::Output_section): Initialize new data
1578         members.
1579         (Output_section::add_input_section): Print section name when out
1580         of patch space.
1581         (Output_section::add_output_section_data): Likewise.
1582         (Output_section::set_final_data_size): Add patch space when
1583         doing --incremental-full.
1584         (Output_section::do_reset_address_and_file_offset): Remove patch
1585         space.
1586         (Output_segment::set_section_list_addresses): Print debug output
1587         only if --incremental-update.
1588         * output.h (Output_section::set_is_patch_space_allowed): New function.
1589         (Output_section::is_patch_space_allowed_): New data member.
1590         (Output_section::patch_space_): New data member.
1591         * parameters.cc (Parameters::incremental_full): New function.
1592         * parameters.h (Parameters::incremental_full): New function
1593         * testsuite/Makefile.am (incremental_test_2): Add test for
1594         --incremental-patch option.
1595         * testsuite/Makefile.in: Regenerate.
1596         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1597         (t18): Remove function body.
1598
1599 2011-07-05  Doug Kwan  <dougkwan@google.com>
1600
1601         PR gold/12771
1602         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1603         Arm_Address type for relocation result.
1604         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1605         overflow check.
1606         (Arm_relocate_functions::abs32): Use unaligned access.
1607         (Arm_relocate_functions::rel32): Ditto.
1608         (Arm_relocate_functions::prel31): Ditto.
1609         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1610         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1611         static data relocations.
1612         * testsuite/Makefile.in: Regnerate.
1613         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1614
1615 2011-07-05  Ian Lance Taylor  <iant@google.com>
1616
1617         PR gold/12392
1618         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1619         symbols if necessary.
1620         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1621
1622 2011-07-05  Ian Lance Taylor  <iant@google.com>
1623
1624         PR gold/12952
1625         * resolve.cc (Symbol::override_base_with_special): Simply override
1626         version with special symbol version, ignoring previous version.
1627
1628 2011-07-05  Ian Lance Taylor  <iant@google.com>
1629
1630         * object.cc (Sized_relobj_file::include_section_group): Add
1631         information to comment about signature location.
1632
1633 2011-07-02  Ian Lance Taylor  <iant@google.com>
1634
1635         PR gold/12957
1636         * options.h (class General_options): Add -f and -F.
1637         * options.cc (General_options::finalize): Fatal error if -f/-F
1638         are used without -shared.
1639         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1640
1641 2011-07-02  Ian Lance Taylor  <iant@google.com>
1642
1643         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1644
1645 2011-07-01  Ian Lance Taylor  <iant@google.com>
1646
1647         PR gold/12525
1648         PR gold/12952
1649         * resolve.cc (Symbol::override_base_with_special): Don't override
1650         the version if the overriding symbol has a different name.
1651         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1652         all callers.  If we give an error about an undefined version,
1653         define the base version if necessary.
1654         * dynobj.h (class Versions): Update declaration.
1655         * testsuite/weak_alias_test_5.cc: New file.
1656         * testsuite/weak_alias_test.script: New file.
1657         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1658         and versioned_alias have the right value, and call t2.
1659         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1660         weak_alias_test_5.so.
1661         (weak_alias_test_LDADD): Likewise.
1662         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1663         * testsuite/Makefile.in: Rebuild.
1664
1665 2011-07-01  Ian Lance Taylor  <iant@google.com>
1666
1667         PR gold/12525
1668         * options.h (class General_options): Support -z notext.
1669         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1670         -Wl,-z,notext.
1671         (two_file_shared_nonpic.so): Likewise.
1672         (two_file_shared_mixed.so): Likewise.
1673         (two_file_shared_mixed_1.so): Likewise.
1674         (weak_undef_lib_nonpic.so): Likewise.
1675         (alt/weak_undef_lib_nonpic.so): Likewise.
1676         (tls_test_shared_nonpic.so): Likewise.
1677         * testsuite/Makefile.in: Rebuild.
1678
1679 2011-07-01  Ian Lance Taylor  <iant@google.com>
1680
1681         PR gold/12525
1682         * configure.ac: Test whether static linking works, setting
1683         the automake conditional HAVE_STATIC.
1684         * testsuite/Makefile.am: Disable tests using -static if
1685         HAVE_STATIC is not true.
1686         * configure, testsuite/Makefile.in: Rebuild.
1687
1688 2011-07-01  Ian Lance Taylor  <iant@google.com>
1689
1690         PR gold/12525
1691         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1692         Assert if we see DW_EH_PE_indirect.
1693         * target.h (Target::ehframe_datarel_base): New function.
1694         (Target::do_ehframe_datarel_base): New target function.
1695         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1696         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1697         function.
1698
1699 2011-07-01  Ian Lance Taylor  <iant@google.com>
1700
1701         PR gold/12571
1702         * options.h (class General_options): Add
1703         --ld-generated-unwind-info.
1704         * ehframe.cc (Fde::write): Add address parameter.  Change all
1705         callers.  If associated with PLT, fill in address and size.
1706         (Cie::set_output_offset): Only add merge mapping if there is an
1707         object.
1708         (Cie::write): Add address parameter.  Change all callers.
1709         (Eh_frame::add_ehframe_for_plt): New function.
1710         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1711         input_offset_ fields into union u_, with new plt field.
1712         (Fde::Fde): Adjust for new union field.
1713         (Fde::Fde) [Output_data version]: New constructor.
1714         (Fde::add_mapping): Only add merge mapping if there is an object.
1715         (class Cie): Update declarations.
1716         (class Eh_frame): Declare add_ehframe_for_plt.
1717         * layout.cc (Layout::layout_eh_frame): Break out code into
1718         make_eh_frame_section, and call it.
1719         (Layout::make_eh_frame_section): New function.
1720         (Layout::add_eh_frame_for_plt): New function.
1721         * layout.h (class Layout): Update declarations.
1722         * merge.cc (Merge_map::add_mapping): Add assertion.
1723         * i386.cc: Include "dwarf.h".
1724         (class Output_data_plt_i386): Make first_plt_entry,
1725         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1726         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1727         and plt_eh_frame_fde.
1728         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1729         boundary.  Call add_eh_frame_for_plt if appropriate.
1730         * x86_64.cc: Include "dwarf.h".
1731         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1732         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1733         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1734         and plt_eh_frame_fde.
1735         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1736         appropriate.
1737
1738 2011-06-29  Ian Lance Taylor  <iant@google.com>
1739
1740         PR gold/12629
1741         * object.cc (Sized_relobj_file::layout_section): Change shdr
1742         parameter to be const.
1743         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1744         out of do_layout.
1745         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1746         appropriate.  Call layout_eh_frame_section.
1747         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1748         sections.
1749         * object.h (class Sized_relobj_file): Update declarations.
1750
1751 2011-06-29  Ian Lance Taylor  <iant@google.com>
1752
1753         PR gold/12652
1754         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1755         modifier.
1756         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1757
1758 2011-06-29  Ian Lance Taylor  <iant@google.com>
1759
1760         PR gold/12675
1761         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1762         SHT_X86_64_UNWIND.
1763         * layout.cc (Layout::layout_eh_frame): Likewise.
1764
1765 2011-06-29  Ian Lance Taylor  <iant@google.com>
1766
1767         PR gold/12695
1768         * layout.cc (Layout::symtab_section_shndx): New function.
1769         * layout.h (class Layout): Declare symtab_section_shndx.
1770         * output.cc (Output_section::write_header): Call it.
1771
1772 2011-06-29  Ian Lance Taylor  <iant@google.com>
1773
1774         PR gold/12818
1775         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1776         symbols which are not used in a relocation.
1777
1778 2011-06-28  Ian Lance Taylor  <iant@google.com>
1779
1780         PR gold/12898
1781         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1782         script create indistinguishable segments.
1783         (Layout::set_segment_offsets): Use stable_sort when sorting
1784         segments.  Pass this to Compare_segments constructor.
1785         * layout.h (class Layout): Make segment_precedes non-static.
1786         (class Compare_segments): Change from struct to class.  Add
1787         layout_ field.  Add constructor.
1788         * script-sections.cc
1789         (Script_sections::attach_sections_using_phdrs_clause): Rename
1790         local orphan to is_orphan.  Don't report failure to put empty
1791         section in segment.  On attachment failure, report name of
1792         section, and attach to first PT_LOAD segment.
1793
1794 2011-06-28  Ian Lance Taylor  <iant@google.com>
1795
1796         PR gold/12934
1797         * target-select.cc (Target_selector::Target_selector): Add
1798         emulation parameter.  Change all callers.
1799         (select_target_by_bfd_name): Rename from select_target_by_name.
1800         Change all callers.
1801         (select_target_by_emulation): New function.
1802         (supported_emulation_names): New function.
1803         * target-select.h (class Target_selector): Add emulation_ field.
1804         Update declarations.
1805         (Target_selector::recognize_by_bfd_name): Rename from
1806         recognize_by_name.  Change all callers.
1807         (Target_selector::supported_bfd_names): Rename from
1808         supported_names.  Change all callers.
1809         (Target_selector::recognize_by_emulation): New function.
1810         (Target_selector::supported_emulations): New function.
1811         (Target_selector::emulation): New function.
1812         (Target_selector::do_recognize_by_bfd_name): Rename from
1813         do_recognize_by_name.  Change all callers.
1814         (Target_selector::do_supported_bfd_names): Rename from
1815         do_supported_names.  Change all callers.
1816         (Target_selector::do_recognize_by_emulation): New function.
1817         (Target_selector::do_supported_emulations): New function.
1818         (select_target_by_bfd_name): Change name in declaration.
1819         (select_target_by_emulation): Declare.
1820         (supported_emulation_names): Declare.
1821         * parameters.cc (parameters_force_valid_target): Try to find
1822         target based on emulation from -m option.
1823         * options.h (class General_options): Change doc string for -m.
1824         * options.cc (help): Print emulations.
1825         (General_options::parse_V): Likewise.
1826         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1827         Add emulation parameter.  Change all callers.
1828
1829 2011-06-28  Ian Lance Taylor  <iant@google.com>
1830
1831         * target.h (class Target): Add osabi_ field.
1832         (Target::osabi): New function.
1833         (Target::set_osabi): New function.
1834         (Target::Target): Initialize osabi_.
1835         (Target::do_adjust_elf_header): Make pure virtual.
1836         (Sized_target::do_adjust_elf_header): Declare.
1837         * target.cc (Sized_target::do_adjust_elf_header): New function.
1838         (class Sized_target): Instantiate all versions.
1839         * freebsd.h (class Target_freebsd): Remove.
1840         (Target_selector_freebsd::do_recognize): Call set_osabi on
1841         Target.
1842         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1843         (Target_selector_freebsd::set_osabi): Remove.
1844         * i386.cc (class Target_i386): Inherit from Sized_target rather
1845         than Target_freebsd.
1846         * x86_64.cc (class Target_x86_64): Likewise.
1847
1848 2011-06-28  Ian Lance Taylor  <iant@google.com>
1849
1850         * target.h (Target::can_check_for_function_pointers): Rewrite.
1851         Make non-virtual.
1852         (Target::can_icf_inline_merge_sections): Likewise.
1853         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1854         (Target::Target_info): Add can_icf_inline_merge_sections field.
1855         (Target::do_can_check_for_function_pointers): New virtual
1856         function.
1857         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1858         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1859         from can_check_for_function_pointers, move in file.
1860         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1861         section_may_have_icf_unsafe_poineters, move in file.
1862         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1863         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1864         Rename from can_check_for_function_pointers, move in file.
1865         (Target_i386::can_icf_inline_merge_sections): Remove.
1866         (Target_i386::i386_info): Initialize
1867         can_icf_inline_merge_sections.
1868         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1869         Initialize can_icf_inline_merge_sections.
1870         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1871         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1872         Rename from can_check_for_function_pointers, move in file.
1873         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1874         (Target_x86_64::x86_64_info): Initialize
1875         can_icf_inline_merge_sections.
1876         * testsuite/testfile.cc (Target_test::test_target_info):
1877         Likewise.
1878         * icf.cc (get_section_contents): Correct formatting.
1879
1880 2011-06-27  Ian Lance Taylor  <iant@google.com>
1881
1882         * symtab.cc (Symbol::versioned_name): New function.
1883         (Symbol_table::add_to_final_symtab): Use versioned_name when
1884         appropriate.
1885         (Symbol_table::sized_write_symbol): Likewise.
1886         * symtab.h (class Symbol): Declare versioned_name.
1887         * stringpool.h (class Stringpool_template): Add variant of add
1888         which takes a std::basic_string.
1889         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1890         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1891         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1892         (ver_test_12.o): New target.
1893         * testsuite/Makefile.in: Rebuild.
1894
1895 2011-06-27  Doug Kwan  <dougkwan@google.com>
1896
1897         * arm.cc (Arm_relocate_functions::thm_jump8,
1898         Arm_relocate_functions::thm_jump11): Use a wider signed
1899         type to compute offset.
1900         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1901         arm_thm_jump8.
1902         * testsuite/Makefile.in: Regenerate.
1903         * testsuite/arm_branch_in_range.sh: Check test results of
1904         arm_thm_jump11 and arm_thm_jump8.
1905         * testsuite/arm_thm_jump11.s: New test source file.
1906         * testsuite/arm_thm_jump11.t: New linker script.
1907         * testsuite/arm_thm_jump8.s: New test source file.
1908         * testsuite/arm_thm_jump8.t: New linker script.
1909
1910 2011-06-24  Ian Lance Taylor  <iant@google.com>
1911
1912         * layout.cc: Include "object.h".
1913         (ctors_sections_in_init_array): New static variable.
1914         (Layout::is_ctors_in_init_array): New function.
1915         (Layout::layout): Add entry to ctors_sections_in_init_array if
1916         appropriate.
1917         * layout.h (class Layout): Declare is_ctors_in_init_array.
1918         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1919         is_ctors_reverse_view is set.
1920         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1921         all callers.  Set is_ctors_reverse_view field of View_size.
1922         (Sized_relobj_file::reverse_words): New function.
1923         * object.h (Sized_relobj_file::View_size): Add
1924         is_ctors_reverse_view field.
1925         (class Sized_relobj_file): Update declarations.
1926         * testsuite/initpri3.c: New test.
1927         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1928         initpri3b.
1929         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1930         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1931         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1932         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1933         * testsuite/Makefile.in: Rebuild.
1934
1935 2011-06-24  Cary Coutant  <ccoutant@google.com>
1936
1937         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1938         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1939         (debug_msg_cdebug.err): New targets.
1940         * testsuite/Makefile.in: Regenerate.
1941         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1942         Fix checks for link with shared library.
1943
1944 2011-06-24  Doug Kwan  <dougkwan@google.com>
1945
1946         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1947         skip empty text sections.
1948         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1949
1950 2011-06-22  Ian Lance Taylor  <iant@google.com>
1951
1952         PR gold/12910
1953         * options.h (class General_options): Add --ctors-in-init-array.
1954         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1955         friends as SHT_PROGBITS for merging sections.
1956         (Layout::layout): Remove special handling of .init_array and
1957         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1958         and .dtors if ctors_in_init_array.
1959         (Layout::make_output_section): Force correct section types for
1960         .init_array and friends.  Don't sort if doing relocatable link,
1961         Don't sort .ctors and .dtors if ctors_in_init_array.
1962         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1963         (Layout::output_section_name): Add relobj parameter.  Change all
1964         callers.  Handle .ctors. and .dtors. in code rather than table.
1965         Handle .ctors and .dtors if ctors_in_init_array.
1966         (Layout::match_file_name): New function, moved from output.cc.
1967         * layout.h (class Layout): Update declarations.
1968         * output.cc: Include "layout.h".
1969         (Input_section_sort_entry::get_priority): New function.
1970         (Input_section_sort_entry::match_file_name): Just call
1971         Layout::match_file_name.
1972         (Output_section::Input_section_sort_init_fini_compare::operator()):
1973         Handle .ctors and .dtors.  Sort by explicit priority rather than
1974         by name.
1975         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1976         * testsuite/initpri2.c: New test.
1977         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1978         (check_PROGRAMS): Add initpri2.
1979         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1980         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1981         * configure, testsuite/Makefile.in: Rebuild.
1982
1983 2011-06-19  Ian Lance Taylor  <iant@google.com>
1984
1985         PR gold/12880
1986         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1987         .interp section to a PT_INTERP segment even if we have seen a
1988         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1989         clause in a linker script.
1990         (Layout::finalize): Don't create a .interp section if we've
1991         already create a PT_INTERP segment.
1992         (Layout::create_interp): Always call choose_output_section (revert
1993         patch of 2011-06-17).  Don't create PT_INTERP segment.
1994         * script-sections.cc
1995         (Script_sections::create_note_and_tls_segments): Add a .interp
1996         section to a PT_INTERP segment even if we have seen a
1997         --dynamic-linker option.
1998
1999 2011-06-18  Ian Lance Taylor  <iant@google.com>
2000
2001         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2002         merely because a non-PT_LOAD segment has a dynamic reloc.
2003
2004 2011-06-18  Ian Lance Taylor  <iant@google.com>
2005
2006         * layout.cc (Layout::finish_dynamic_section): Don't create
2007         DT_FLAGS entry if not needed.
2008
2009 2011-06-18  Ian Lance Taylor  <iant@google.com>
2010
2011         PR gold/12745
2012         * layout.cc (Layout::layout_eh_frame): Correct handling of
2013         writable .eh_frame section.
2014
2015 2011-06-17  Ian Lance Taylor  <iant@google.com>
2016
2017         PR gold/12893
2018         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2019         symbol is redefined with the exact same object and value.
2020
2021 2011-06-17  Ian Lance Taylor  <iant@google.com>
2022
2023         PR gold/12880
2024         * layout.h (class Layout): Add interp_segment_ field.
2025         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2026         (Layout::attach_allocated_section_to_segment): If making shared
2027         library, put .interp section in PT_INTERP segment.
2028         (Layout::finalize): Also call create_interp if -dynamic-linker
2029         option was used.
2030         (Layout::create_interp): Assert that there is no PT_INTERP
2031         segment.  If not using a SECTIONS clause, use make_output_section.
2032         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2033         * script-sections.cc
2034         (Script_sections::create_note_and_tls_segments): If making shared
2035         library, put .interp section in PT_INTERP segment.
2036
2037 2011-06-17  Ian Lance Taylor  <iant@google.com>
2038
2039         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2040         when making a shared library.
2041
2042 2011-06-17  Ian Lance Taylor  <iant@google.com>
2043
2044         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2045         parameter.  Change all callers.  Don't issue warning about PC32
2046         against locally defined symbol.
2047
2048 2011-06-16  Ian Lance Taylor  <iant@google.com>
2049
2050         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2051         occurs in same object.
2052
2053 2011-06-14  Alan Modra  <amodra@gmail.com>
2054
2055         * po/POTFILES.in: Regenerate.
2056
2057 2011-06-09  Ian Lance Taylor  <iant@google.com>
2058
2059         * script-sections.cc
2060         (Orphan_output_section::set_section_addresses): For a relocatable
2061         link set address to 0.
2062
2063 2011-06-09  Cary Coutant  <ccoutant@google.com>
2064
2065         PR gold/12804
2066         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2067         used with --compress-debug-sections.
2068         * gold/object.cc (Sized_relobj_file::do_layout): Report
2069         uncompressed size of compressed input sections.
2070
2071 2011-06-08  Cary Coutant  <ccoutant@google.com>
2072
2073         PR gold/12804
2074         * testsuite/two_file_test_2_v1.cc: Change initialization of
2075         v2 to keep it in .data.
2076
2077 2011-06-07  Cary Coutant  <ccoutant@google.com>
2078
2079         * common.cc (Symbol_table::do_allocate_commons_list): Call
2080         gold_fallback.
2081         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2082         (Errors::fallback): New function.
2083         (gold_fallback): New function.
2084         * errors.h (Errors::fallback): New function.
2085         * gold.cc (gold_exit): Change status parameter to enum; adjust
2086         all callers.
2087         (queue_initial_tasks): Call gold_fallback.
2088         * gold.h: Include cstdlib.
2089         (Exit_status): New enum type.
2090         (gold_exit): Change status parameter to enum.
2091         (gold_fallback): New function.
2092         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2093         (Layout::create_symtab_sections): Likewise.
2094         (Layout::create_shdrs): Likewise.
2095         * main.cc (main): Adjust call to gold_exit.
2096         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2097         (Output_data_got::add_got_entry_pair): Likewise.
2098         (Output_section::add_input_section): Likewise.
2099         (Output_section::add_output_section_data): Likewise.
2100         (Output_segment::set_section_list_addresses): Likewise.
2101         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2102
2103 2011-06-07  Cary Coutant  <ccoutant@google.com>
2104
2105         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2106         for incremental links.
2107         * output.cc (Output_segment::set_section_list_addresses): Remove
2108         FIXME and test for TLS or BSS.
2109
2110 2011-06-07  Cary Coutant  <ccoutant@google.com>
2111
2112         * testsuite/Makefile.am: Add incremental_copy_test,
2113         incremental_common_test_1.
2114         * testsuite/Makefile.in: Regenerate.
2115         * testsuite/common_test_1_v1.c: New source file.
2116         * testsuite/common_test_1_v2.c: New source file.
2117         * testsuite/copy_test_v1.cc: New source file.
2118
2119 2011-06-07  Cary Coutant  <ccoutant@google.com>
2120
2121         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2122         update, allocate common from bss section's free list.
2123         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2124         linker-defined symbols.
2125         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2126         Skip GOT and PLT entries that are no longer referenced.
2127         (Output_section_incremental_inputs::write_info_blocks): Mark
2128         linker-defined symbols.
2129         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2130         * output.cc (Output_section::allocate): New function.
2131         * output.h (Output_section::allocate): New function.
2132         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2133         linker-defined symbols.
2134         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2135         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2136         (Symbol::init_base_output_data): Likewise.
2137         (Symbol::init_base_output_segment): Likewise.
2138         (Symbol::init_base_constant): Likewise.
2139         (Sized_symbol::init_output_data): Likewise.
2140         (Sized_symbol::init_output_segment): Likewise.
2141         (Sized_symbol::init_constant): Likewise.
2142         (Symbol_table::do_define_in_output_data): Likewise.
2143         (Symbol_table::do_define_in_output_segment): Likewise.
2144         (Symbol_table::do_define_as_constant): Likewise.
2145         * symtab.h (Symbol::is_predefined): New function.
2146         (Symbol::init_base_output_data): Add is_predefined parameter.
2147         (Symbol::init_base_output_segment): Likewise.
2148         (Symbol::init_base_constant): Likewise.
2149         (Symbol::is_predefined_): New data member.
2150         (Sized_symbol::init_output_data): Add is_predefined parameter.
2151         (Sized_symbol::init_output_segment): Likewise.
2152         (Sized_symbol::init_constant): Likewise.
2153         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2154
2155 2011-06-07  Cary Coutant  <ccoutant@google.com>
2156
2157         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2158         instead of emit_copy_reloc.
2159         (Copy_relocs::emit_copy_reloc): Refactor.
2160         (Copy_relocs::make_copy_reloc): New function.
2161         (Copy_relocs::add_copy_reloc): Remove.
2162         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2163         section.
2164         (Copy_relocs::make_copy_reloc): New function.
2165         (Copy_relocs::add_copy_reloc): Remove.
2166         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2167         unchanged input files.
2168         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2169         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2170         Reserve BSS space for COPY relocations.
2171         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2172         (Output_section_incremental_inputs::write_info_blocks): Record
2173         whether a symbol is copied from a shared object.
2174         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2175         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2176         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2177         (Incremental_input_entry_reader::get_output_symbol_index): Add
2178         is_copy parameter.
2179         (Incremental_binary::emit_copy_relocs): New function.
2180         (Incremental_binary::do_emit_copy_relocs): New function.
2181         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2182         new data member.
2183         (Sized_incremental_binary::add_copy_reloc): New function.
2184         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2185         (Sized_incremental_binary::Copy_reloc): New struct.
2186         (Sized_incremental_binary::Copy_relocs): New typedef.
2187         (Sized_incremental_binary::copy_relocs_): New data member.
2188         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2189         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2190         * target.h (Sized_target::emit_copy_reloc): New function.
2191         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2192
2193 2011-06-02  Cary Coutant  <ccoutant@google.com>
2194
2195         PR gold/12163
2196         * gold/archive.cc (Archive::Archive): Initialize new data member.
2197         (Archive::include_all_members): Return if archive has already been
2198         included.
2199         * gold/archive.h (Archive::include_all_members_): New data member.
2200
2201 2011-06-02  Nick Clifton  <nickc@redhat.com>
2202
2203         * dynobj.h: Fix spelling mistake in comment.
2204         * output.cc: Likewise.
2205
2206 2011-05-31  Doug Kwan  <dougkwan@google.com>
2207             Asier Llano
2208
2209         PR gold/12826
2210         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2211         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2212         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2213         redundant arm_exidx_test.so.
2214         * testsuite/Makefile.in: Regenerate.
2215         (check_SCRIPTS): Add pr12826.sh
2216         (check_DATA): Add pr12826.stdout
2217         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2218         * testsuite/pr12826.sh: New file.
2219         * testsuite/pr12826_1.s: Ditto.
2220         * testsuite/pr12826_1.s: Ditto.
2221
2222 2011-05-30  Ian Lance Taylor  <iant@google.com>
2223
2224         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2225         sections.
2226
2227 2011-05-29  Ian Lance Taylor  <iant@google.com>
2228
2229         PR gold/12804
2230         * testsuite/Makefile.am: Use different file name for two_file_test
2231         temporary file for each incremental test.
2232         * testsuite/Makefile.in: Rebuild.
2233
2234 2011-05-29  Ian Lance Taylor  <iant@google.com>
2235
2236         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2237         binary input file is empty.
2238
2239 2011-05-27  Ian Lance Taylor  <iant@google.com>
2240
2241         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2242         (ver_test_9.so): Likewise.
2243         * testsuite/Makefile.in: Rebuild.
2244
2245 2011-05-26 Cary Coutant  <ccoutant@google.com>
2246
2247         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2248         * incremental.cc (Incremental_inputs::report_input_section): Fix
2249         comment, indentation.
2250         (Incremental_inputs::report_comdat_group): New function.
2251         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2252         of data for incremental input file entry.
2253         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2254         group count, COMDAT group signatures.
2255         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2256         an unchanged input file.
2257         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2258         Initialize new data member.
2259         (Incremental_object_entry::add_comdat_group): New function.
2260         (Incremental_object_entry::get_comdat_group_count): New function.
2261         (Incremental_object_entry::get_comdat_signature_key): New function.
2262         (Incremental_object_entry::groups_): New data member.
2263         (Incremental_inputs::report_comdat_group): New function.
2264         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2265         data for incremental input file entry.
2266         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2267         (Incremental_input_entry_reader::get_input_section): Adjust size of
2268         data for incremental input file entry.
2269         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2270         (Incremental_input_entry_reader::get_comdat_group_signature): New
2271         function.
2272         * object.cc (Sized_relobj::include_section_group): Report kept
2273         COMDAT groups for incremental links.
2274
2275 2011-05-24  David Meyer  <pdox@google.com>
2276
2277         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2278         with name parameter.  Add found_name parameter.
2279         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2280         * dirsearch.h (class Dirsearch): Update declaration.
2281
2282 2011-05-24  Ian Lance Taylor  <iant@google.com>
2283
2284         * archive.cc (Library_base::should_include_member): Pull in object
2285         from archive if it defines the entry symbol.
2286         * parameters.cc (Parameters::entry): New function.
2287         * parameters.h (class Parameters): Declare entry.
2288         * output.h (class Output_file_header): Remove entry_ field.
2289         * output.cc (Output_file_header::Output_file_header): Remove entry
2290         parameter.  Change all callers.
2291         (Output_file_header::entry): Use parameters->entry.
2292         * gold.cc (queue_middle_tasks): Likewise.
2293         * plugin.cc (Plugin_hook::run): Likewise.
2294
2295 2011-05-24 Cary Coutant  <ccoutant@google.com>
2296
2297         * gold.cc (queue_initial_tasks): Pass incremental base filename
2298         to Output_file::open_base_file; don't print error message.
2299         * incremental-dump.cc (main): Adjust call to
2300         Output_file::open_for_modification.
2301         * incremental-dump.cc (main): Likewise.
2302         * incremental.cc (Incremental_inputs::report_command_line):
2303         Ignore --incremental-base option when comparing command lines.
2304         Ignore parameter when given as separate argument.
2305         * options.h (class General_options): Add --incremental-base.
2306         * output.cc (Output_file::Output_file):
2307         (Output_file::open_base_file): Add base_name and writable parameters;
2308         read base file into new file; print error message here.
2309         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2310         callers.
2311         * output.h (Output_file::open_for_modification): Rename to...
2312         (Output_file::open_base_file): ...this; add base_name and
2313         writable parameters; adjust all callers.
2314         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2315         callers.
2316         * testsuite/Makefile.am (incremental_test_4): Test
2317         --incremental-base.
2318         * testsuite/Makefile.in: Regenerate.
2319
2320 2011-05-24 Cary Coutant  <ccoutant@google.com>
2321
2322         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2323         incremental_test_4.
2324         * testsuite/Makefile.in: Regenerate.
2325         * testsuite/two_file_test_1_v1.cc: New test source file.
2326         * testsuite/two_file_test_1b_v1.cc: New test source file.
2327         * testsuite/two_file_test_2_v1.cc: New test source file.
2328
2329 2011-05-24 Cary Coutant  <ccoutant@google.com>
2330
2331         * dynobj.h (Dynobj::do_dynobj): New function.
2332         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2333         flag and soname for shared objects.
2334         * incremental.cc (Incremental_inputs::report_object): Make
2335         either Incremental_object_entry or Incremental_dynobj_entry; add
2336         soname to string table.
2337         (Incremental_inputs::report_input_section): Add assertion.
2338         (Output_section_incremental_inputs::set_final_data_size): Adjust
2339         type of input file entry for shared libraries; adjust size of
2340         shared library info entry.
2341         (Output_section_incremental_inputs::write_input_files): Write
2342         as_needed flag for shared libraries.
2343         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2344         of input file entry for shared libraries; write soname.
2345         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2346         soname from incremental info.
2347         * incremental.h (enum Incremental_input_flags): Add
2348         INCREMENTAL_INPUT_AS_NEEDED.
2349         (Incremental_input_entry::Incremental_input_entry): Initialize new
2350         data member.
2351         (Incremental_input_entry::set_as_needed): New function.
2352         (Incremental_input_entry::as_needed): New function.
2353         (Incremental_input_entry::do_dynobj_entry): New function.
2354         (Incremental_input_entry::as_needed_): New data member.
2355         (Incremental_object_entry::Incremental_object_entry): Don't check
2356         for shared library.
2357         (Incremental_object_entry::do_type): Likewise.
2358         (class Incremental_dynobj_entry): New class.
2359         (Incremental_input_entry_reader::as_needed): New function.
2360         (Incremental_input_entry_reader::get_soname): New function.
2361         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2362         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2363         size of shared library info entry.
2364         * layout.cc (Layout::finish_dynamic_section): Don't test for
2365         incremental link when adding DT_NEEDED entries.
2366         * object.h (Object::Object): Initialize new data member.
2367         (Object::dynobj): New function.
2368         (Object::set_as_needed): New function.
2369         (Object::as_needed): New function.
2370         (Object::do_dynobj): New function.
2371         (Object::as_needed_): New data member.
2372
2373 2011-05-24 Cary Coutant  <ccoutant@google.com>
2374
2375         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2376         info; adjust display of GOT entries.
2377         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2378         vector of input objects; remove file_status_.
2379         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2380         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2381         got_plt reader; call target hooks to reserve GOT entries.
2382         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2383         of input file info header and GOT info entry.
2384         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2385         relocation info.
2386         (Got_plt_view_info::got_descriptor): Remove.
2387         (Got_plt_view_info::sym_index): New data member.
2388         (Got_plt_view_info::input_index): New data member.
2389         (Local_got_offset_visitor::visit): Write input file index.
2390         (Global_got_offset_visitor::visit): Write 0 for input file index.
2391         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2392         with sym_index and input_index.
2393         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2394         incremental info GOT entry; replace got_descriptor with input_index.
2395         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2396         map from input file index to object.
2397         (Sized_relobj_incr::do_layout): Replace direct data member reference
2398         with accessor function.
2399         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2400         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2401         Adjust size of input file info header.
2402         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2403         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2404         (Incremental_input_entry_reader::get_input_section): Adjust size of
2405         input file info header.
2406         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2407         of incremental info GOT entry.
2408         (Incremental_got_plt_reader::get_got_desc): Remove.
2409         (Incremental_got_plt_reader::get_got_symndx): New function.
2410         (Incremental_got_plt_reader::get_got_input_index): New function.
2411         (Sized_incremental_binary::Sized_incremental_binary): Remove
2412         file_status_; add input_objects_.
2413         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2414         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2415         (Sized_incremental_binary::file_is_unchanged): Remove.
2416         (Sized_incremental_binary::set_input_object): New function.
2417         (Sized_incremental_binary::input_object): New function.
2418         (Sized_incremental_binary::file_status_): Remove.
2419         (Sized_incremental_binary::input_objects_): New data member.
2420         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2421         references.
2422         (Sized_relobj_incr::invalid_address): Move to base class.
2423         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2424         class.
2425         (Sized_relobj_incr::do_output_section_offset): Likewise.
2426         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2427         (Sized_relobj_incr::section_offsets_): Likewise.
2428         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2429         function.
2430         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2431         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2432         with accessor function.
2433         (Sized_relobj_file::do_layout): Likewise.
2434         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2435         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2436         (Sized_relobj_file::compute_final_local_value): Replace refs to
2437         section_offsets_ with accessor function.
2438         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2439         * object.h (Relobj::Relobj): Initialize new data members.
2440         (Relobj::add_dyn_reloc): New function.
2441         (Relobj::first_dyn_reloc): New function.
2442         (Relobj::dyn_reloc_count): New function.
2443         (Relobj::first_dyn_reloc_): New data member.
2444         (Relobj::dyn_reloc_count_): New data member.
2445         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2446         references.
2447         (Sized_relobj::Address): New typedef.
2448         (Sized_relobj::invalid_address): Move here from child class.
2449         (Sized_relobj::Sized_relobj): Initialize new data members.
2450         (Sized_relobj::sized_relobj): New function.
2451         (Sized_relobj::is_output_section_offset_invalid): Move here from
2452         child class.
2453         (Sized_relobj::get_output_section_offset): Likewise.
2454         (Sized_relobj::local_has_got_offset): Likewise.
2455         (Sized_relobj::local_got_offset): Likewise.
2456         (Sized_relobj::set_local_got_offset): Likewise.
2457         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2458         (Sized_relobj::clear_got_offsets): New function.
2459         (Sized_relobj::section_offsets): Move here from child class.
2460         (Sized_relobj::do_output_section_offset): Likewise.
2461         (Sized_relobj::do_set_section_offset): Likewise.
2462         (Sized_relobj::Local_got_offsets): Likewise.
2463         (Sized_relobj::local_got_offsets_): Likewise.
2464         (Sized_relobj::section_offsets_): Likewise.
2465         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2466         references.
2467         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2468         class.
2469         (Sized_relobj_file::sized_relobj): New function
2470         (Sized_relobj_file::local_has_got_offset): Move to base class.
2471         (Sized_relobj_file::local_got_offset): Likewise.
2472         (Sized_relobj_file::set_local_got_offset): Likewise.
2473         (Sized_relobj_file::get_output_section_offset): Likewise.
2474         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2475         (Sized_relobj_file::do_output_section_offset): Likewise.
2476         (Sized_relobj_file::do_set_section_offset): Likewise.
2477         (Sized_relobj_file::Local_got_offsets): Likewise.
2478         (Sized_relobj_file::local_got_offsets_): Likewise.
2479         (Sized_relobj_file::section_offsets_): Likewise.
2480         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2481         (all constructors).
2482         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2483         (Output_reloc::get_symbol_index): Likewise.
2484         (Output_reloc::local_section_offset): Likewise.
2485         (Output_reloc::get_address): Likewise.
2486         (Output_reloc::symbol_value): Likewise.
2487         (Output_data_got::reserve_slot): Move to class definition.
2488         (Output_data_got::reserve_local): New function.
2489         (Output_data_got::reserve_slot_for_global): Remove.
2490         (Output_data_got::reserve_global): New function.
2491         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2492         (all constructors, two instantiations).
2493         (Output_reloc::get_relobj): New function (two instantiations).
2494         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2495         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2496         (Output_data_reloc::add_global): Adjust type of relobj.
2497         (Output_data_reloc::add_global_relative): Likewise.
2498         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2499         (Output_data_reloc::add_local): Likewise.
2500         (Output_data_reloc::add_local_relative): Likewise.
2501         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2502         (Output_data_reloc::add_local_section): Likewise.
2503         (Output_data_reloc::add_output_section): Likewise.
2504         (Output_data_reloc::add_absolute): Likewise.
2505         (Output_data_reloc::add_target_specific): Likewise.
2506         (Output_data_got::reserve_slot): Move definition here.
2507         (Output_data_got::reserve_local): New function.
2508         (Output_data_got::reserve_global): New function.
2509         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2510         section_offsets_ with accessor function.
2511         (Sized_relobj_file::write_sections): Likewise.
2512         (Sized_relobj_file::do_relocate_sections): Likewise.
2513         * target.h (Sized_target::reserve_local_got_entry): New function.
2514         (Sized_target::reserve_global_got_entry): New function.
2515         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2516         (Target_x86_64::reserve_global_got_entry): New function.
2517         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2518
2519 2011-05-23 Cary Coutant  <ccoutant@google.com>
2520
2521         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2522         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2523         bit when checking got_type.
2524         * incremental.cc (Sized_incremental_binary::setup_readers):
2525         Store symbol table and string table locations; initialize bit vector
2526         of file status flags.
2527         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2528         unchanged files.
2529         (Sized_incremental_binary::do_process_got_plt): New function.
2530         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2531         (Output_section_incremental_inputs::set_final_data_size): Record
2532         file index for each input file.
2533         (Output_section_incremental_inputs::write_got_plt): Store file index
2534         instead of input entry offset for each GOT entry.
2535         * incremental.h
2536         (Incremental_input_entry::Incremental_input_entry): Initialize new
2537         data member.
2538         (Incremental_input_entry::set_offset): Store file index.
2539         (Incremental_input_entry::get_file_index): New function.
2540         (Incremental_input_entry::file_index_): New data member.
2541         (Incremental_binary::process_got_plt): New function.
2542         (Incremental_binary::do_process_got_plt): New function.
2543         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2544         data members.
2545         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2546         (Sized_incremental_binary::set_file_is_unchanged): New function.
2547         (Sized_incremental_binary::file_is_unchanged): New function.
2548         (Sized_incremental_binary::do_process_got_plt): New function.
2549         (Sized_incremental_binary::file_status_): New data member.
2550         (Sized_incremental_binary::main_symtab_loc_): New data member.
2551         (Sized_incremental_binary::main_strtab_loc_): New data member.
2552         * output.cc (Output_data_got::Got_entry::write): Add case
2553         RESERVED_CODE.
2554         (Output_data_got::add_global): Call add_got_entry.
2555         (Output_data_got::add_global_plt): Likewise.
2556         (Output_data_got::add_global_with_rel): Likewise.
2557         (Output_data_got::add_global_with_rela): Likewise.
2558         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2559         (Output_data_got::add_global_pair_with_rela): Likewise.
2560         (Output_data_got::add_local): Call add_got_entry.
2561         (Output_data_got::add_local_plt): Likewise.
2562         (Output_data_got::add_local_with_rel): Likewise.
2563         (Output_data_got::add_local_with_rela): Likewise.
2564         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2565         (Output_data_got::add_local_pair_with_rela): Likewise.
2566         (Output_data_got::reserve_slot): New function.
2567         (Output_data_got::reserve_slot_for_global): New function.
2568         (Output_data_got::add_got_entry): New function.
2569         (Output_data_got::add_got_entry_pair): New function.
2570         (Output_section::add_output_section_data): Edit FIXME.
2571         * output.h
2572         (Output_section_data_build::Output_section_data_build): New
2573         constructor with size parameter.
2574         (Output_data_space::Output_data_space): Likewise.
2575         (Output_data_got::Output_data_got): Initialize new data member; new
2576         constructor with size parameter.
2577         (Output_data_got::add_constant): Call add_got_entry.
2578         (Output_data_got::reserve_slot): New function.
2579         (Output_data_got::reserve_slot_for_global): New function.
2580         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2581         (Output_data_got::add_got_entry): New function.
2582         (Output_data_got::add_got_entry_pair): New function.
2583         (Output_data_got::free_list_): New data member.
2584         * target.h (Sized_target::init_got_plt_for_update): New function.
2585         (Sized_target::register_global_plt_entry): New function.
2586         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2587         Initialize new data member; call init; add constructor with PLT count.
2588         (Output_data_plt_x86_64::init): New function.
2589         (Output_data_plt_x86_64::add_relocation): New function.
2590         (Output_data_plt_x86_64::reserve_slot): New function.
2591         (Output_data_plt_x86_64::free_list_): New data member.
2592         (Target_x86_64::init_got_plt_for_update): New function.
2593         (Target_x86_64::register_global_plt_entry): New function.
2594         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2595         incremental updates.
2596         (Output_data_plt_x86_64::add_relocation): New function.
2597         * testsuite/object_unittest.cc (Object_test): Set default options.
2598
2599 2011-05-16  Ian Lance Taylor  <iant@google.com>
2600
2601         * options.h (class General_options): Make -i a synonym for -r.
2602
2603 2011-05-16  Ian Lance Taylor  <iant@google.com>
2604
2605         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2606
2607 2011-05-10 Cary Coutant  <ccoutant@google.com>
2608
2609         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2610         strip_all (-s).
2611
2612 2011-05-06  Ian Lance Taylor  <iant@google.com>
2613
2614         * layout.cc (Layout::layout): If the output section flags change,
2615         update the ordering.
2616
2617 2011-04-25 Cary Coutant  <ccoutant@google.com>
2618
2619         * incremental-dump.cc (dump_incremental_inputs): Print local
2620         symbol info for each input file.
2621         * incremental.cc
2622         (Output_section_incremental_inputs::set_final_data_size): Add local
2623         symbol info to input file entries in incremental info.
2624         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2625         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2626         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2627         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2628         implementation.
2629         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2630         (Sized_incr_relobj::do_relocate): Write the local symbols.
2631         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2632         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2633         Adjust size of input file header.
2634         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2635         (Incremental_inputs_reader::get_local_symbol_count): New function.
2636         (Incremental_inputs_reader::get_input_section): Adjust size of input
2637         file header.
2638         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2639         (Sized_incr_relobj::This): New typedef.
2640         (Sized_incr_relobj::sym_size): New const data member.
2641         (Sized_incr_relobj::Local_symbol): New struct.
2642         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2643         (Sized_incr_relobj::do_local_symbol_offset): New function.
2644         (Sized_incr_relobj::local_symbol_count_): New data member.
2645         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2646         (Sized_incr_relobj::local_symbol_index_): New data member.
2647         (Sized_incr_relobj::local_symbol_offset_): New data member.
2648         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2649         (Sized_incr_relobj::local_symbols_): New data member.
2650         * object.h (Relobj::output_local_symbol_count): New function.
2651         (Relobj::local_symbol_offset): New function.
2652         (Relobj::do_output_local_symbol_count): New function.
2653         (Relobj::do_local_symbol_offset): New function.
2654         (Sized_relobj::do_output_local_symbol_count): New function.
2655         (Sized_relobj::do_local_symbol_offset): New function.
2656
2657 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2658
2659         * descriptors.cc (set_close_on_exec): New function.
2660         (Descriptors::open): Use set_close_on_exec.
2661         * output.cc (S_ISLNK): Define if not defined.
2662
2663 2011-04-22 Cary Coutant  <ccoutant@google.com>
2664
2665         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2666         global symbol map.
2667         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2668         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2669         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2670         relocations.
2671         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2672         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2673         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2674         * incremental.h
2675         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2676         function.
2677         (Incremental_binary::apply_incremental_relocs): New function.
2678         (Incremental_binary::do_apply_incremental_relocs): New function.
2679         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2680         data member.
2681         (Sized_incremental_binary::add_global_symbol): New function.
2682         (Sized_incremental_binary::global_symbol): New function.
2683         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2684         (Sized_incremental_binary::symbol_map_): New data member.
2685         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2686         * target.h (Sized_target::apply_relocation): New function.
2687         * target-reloc.h (apply_relocation): New function.
2688         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2689
2690 2011-04-22  Doug Kwan  <dougkwan@google.com>
2691
2692         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2693         flag of a SHT_ARM_EXIDX section.
2694         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2695         * testsuite/Makefile.in: Regenerate.
2696         * testsuite/arm_exidx_test.s: New file.
2697         * testsuite/arm_exidx_test.sh: Same.
2698
2699 2011-04-20 Cary Coutant  <ccoutant@google.com>
2700
2701         PR gold/12689
2702         * archive.h (Incremental_archive_entry::Archive_member):
2703         Initialize arg_serial_ (second constructor).
2704
2705 2011-04-17  Ian Lance Taylor  <iant@google.com>
2706
2707         * object.cc (Relocate_info::location): Simplify location string.
2708         * errors.cc (Errors::error_at_location): Don't print program
2709         name.
2710         (Errors::warning_at_location): Likewise.
2711         (Errors::undefined_symbol): Likewise.
2712         * testsuite/debug_msg.sh: Update accordingly.
2713
2714 2011-04-14 Cary Coutant  <ccoutant@google.com>
2715
2716         * gold/layout.cc (Layout::symtab_section_offset): New function.
2717         * gold/layout.h (Layout::symtab_section_offset): New function.
2718         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2719
2720 2011-04-12  Ian Lance Taylor  <iant@google.com>
2721
2722         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2723         with MREMAP_MAYMOVE.
2724         * output.h (class Output_file): Add map_is_allocated_ field.
2725         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2726         not available, provide stubs.  If mremap is not available, #define
2727         it to gold_mremap.
2728         (MREMAP_MAYMOVE): Define if not defined.
2729         (Output_file::Output_file): Initialize map_is_allocated_.
2730         (Output_file::resize): Check map_is_allocated_.
2731         (Output_file::map_anonymous): If mmap fails, use malloc.
2732         (Output_file::unmap): Don't do anything for an anonymous map.
2733         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2734         is not available, provide stubs.
2735         (File_read::View::~View): Use free rather than delete[].
2736         (File_read::make_view): Use malloc rather than new[].  If mmap
2737         fails, use malloc.
2738         (File_read::find_or_make_view): Use malloc rather than new[].
2739         * gold.h: Remove HAVE_REMAP code.
2740         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2741         exists.  Rename mremap to gold_mremap.  If mmap is not available
2742         don't do anything.
2743         * configure, config.in: Rebuild.
2744
2745 2011-04-11  Ian Lance Taylor  <iant@google.com>
2746
2747         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2748         initialize local variable v.
2749
2750 2011-04-11  Cary Coutant  <ccoutant@google.com>
2751
2752         * archive.cc (Archive::include_member): Adjust call to
2753         report_object.
2754         (Add_archive_symbols::run): Track argument serial numbers.
2755         (Lib_group::include_member): Likewise.
2756         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2757         * archive.h (Incremental_archive_entry::Archive_member):
2758         Initialize arg_serial_.
2759         (Archive_member::arg_serial_): New data member.
2760         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2761         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2762         incremental link.
2763         (Sized_dynobj::do_for_all_local_got_entries): New function.
2764         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2765         function.
2766         * fileread.cc (get_mtime): New function.
2767         * fileread.h (get_mtime): New function.
2768         * gold.cc (queue_initial_tasks): Check for incremental update.
2769         (process_incremental_input): New function.
2770         (queue_middle_tasks): Don't force valid target for incremental
2771         update.
2772         * incremental-dump.cc (find_input_containing_global): Adjust
2773         size of symbol info entry.
2774         (dump_incremental_inputs): Dump argument serial number and
2775         in_system_directory flag; bias shndx by 1; print symbol names
2776         when dumping per-file symbol lists; use new symbol info readers.
2777         * incremental.cc
2778         (Output_section_incremental_inputs:update_data_size): New function.
2779         (Sized_incremental_binary::setup_readers): Setup input readers
2780         for each input file; build maps for files added from libraries
2781         and scripts.
2782         (Sized_incremental_binary::check_input_args): New function.
2783         (Sized_incremental_binary::do_check_inputs): Build map of argument
2784         serial numbers to input arguments.
2785         (Sized_incremental_binary::do_file_has_changed): Rename
2786         do_file_is_unchanged to this; compare file modification times.
2787         (Sized_incremental_binary::do_init_layout): New function.
2788         (Sized_incremental_binary::do_reserve_layout): New function.
2789         (Sized_incremental_binary::do_get_input_reader): Remove.
2790         (Sized_incremental_binary::get_symtab_view): New function.
2791         (Incremental_checker::can_incrementally_link_output_file): Remove.
2792         (Incremental_inputs::report_command_line): Exclude --debug options.
2793         (Incremental_inputs::report_archive_begin): Add parameter; track
2794         argument serial numbers; don't put input file entry for archive
2795         before archive members.
2796         (Incremental_inputs::report_archive_end): Put input file entry
2797         for archive after archive members.
2798         (Incremental_inputs::report_object): Add parameter; track argument
2799         serial numbers and in_system_directory flag.
2800         (Incremental_inputs::report_script): Add parameter; track argument
2801         serial numbers.
2802         (Output_section_incremental_inputs::set_final_data_size): Adjust
2803         size of symbol info entry; check for forwarding symbols.
2804         (Output_section_incremental_inputs::write_input_files): Write
2805         in_system_directory flag and argument serial number.
2806         (Output_section_incremental_inputs::write_info_blocks): Map section
2807         indices between incremental info and original input file; store
2808         input section index for each symbol.
2809         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2810         change operator() to visit().
2811         (class Global_got_offset_visitor): Likewise.
2812         (class Global_symbol_visitor_got_plt):
2813         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2814         classes.
2815         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2816         (Sized_incr_relobj::do_read_symbols): New function.
2817         (Sized_incr_relobj::do_layout): New function.
2818         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2819         (Sized_incr_relobj::do_add_symbols): New function.
2820         (Sized_incr_relobj::do_should_include_member): New function.
2821         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2822         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2823         (Sized_incr_relobj::do_section_size): New function.
2824         (Sized_incr_relobj::do_section_name): New function.
2825         (Sized_incr_relobj::do_section_contents): New function.
2826         (Sized_incr_relobj::do_section_flags): New function.
2827         (Sized_incr_relobj::do_section_entsize): New function.
2828         (Sized_incr_relobj::do_section_address): New function.
2829         (Sized_incr_relobj::do_section_type): New function.
2830         (Sized_incr_relobj::do_section_link): New function.
2831         (Sized_incr_relobj::do_section_info): New function.
2832         (Sized_incr_relobj::do_section_addralign): New function.
2833         (Sized_incr_relobj::do_initialize_xindex): New function.
2834         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2835         (Sized_incr_relobj::do_read_relocs): New function.
2836         (Sized_incr_relobj::do_gc_process_relocs): New function.
2837         (Sized_incr_relobj::do_scan_relocs): New function.
2838         (Sized_incr_relobj::do_count_local_symbols): New function.
2839         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2840         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2841         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2842         (Sized_incr_relobj::do_relocate): New function.
2843         (Sized_incr_relobj::do_set_section_offset): New function.
2844         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2845         (Sized_incr_dynobj::do_read_symbols): New function.
2846         (Sized_incr_dynobj::do_layout): New function.
2847         (Sized_incr_dynobj::do_add_symbols): New function.
2848         (Sized_incr_dynobj::do_should_include_member): New function.
2849         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2850         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2851         (Sized_incr_dynobj::do_section_size): New function.
2852         (Sized_incr_dynobj::do_section_name): New function.
2853         (Sized_incr_dynobj::do_section_contents): New function.
2854         (Sized_incr_dynobj::do_section_flags): New function.
2855         (Sized_incr_dynobj::do_section_entsize): New function.
2856         (Sized_incr_dynobj::do_section_address): New function.
2857         (Sized_incr_dynobj::do_section_type): New function.
2858         (Sized_incr_dynobj::do_section_link): New function.
2859         (Sized_incr_dynobj::do_section_info): New function.
2860         (Sized_incr_dynobj::do_section_addralign): New function.
2861         (Sized_incr_dynobj::do_initialize_xindex): New function.
2862         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2863         (make_sized_incremental_object): New function.
2864         (Incremental_library::copy_unused_symbols): New function.
2865         (Incremental_library::do_for_all_unused_symbols): New function.
2866         * incremental.h (enum Incremental_input_flags): New type.
2867         (class Incremental_checker): Remove.
2868         (Incremental_input_entry::Incremental_input_entry): Add argument
2869         serial number.
2870         (Incremental_input_entry::arg_serial): New function.
2871         (Incremental_input_entry::set_is_in_system_directory): New function.
2872         (Incremental_input_entry::is_in_system_directory): New function.
2873         (Incremental_input_entry::arg_serial_): New data member.
2874         (Incremental_input_entry::is_in_system_directory_): New data member.
2875         (class Script_info): Move here from script.h.
2876         (Script_info::Script_info): Add filename parameter.
2877         (Script_info::filename): New function.
2878         (Script_info::filename_): New data member.
2879         (Incremental_script_entry::Incremental_script_entry): Add argument
2880         serial number.
2881         (Incremental_object_entry::Incremental_object_entry): Likewise.
2882         (Incremental_object_entry::add_input_section): Build list of input
2883         sections with map to original shndx.
2884         (Incremental_object_entry::get_input_section_index): New function.
2885         (Incremental_object_entry::shndx_): New data member.
2886         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2887         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2888         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2889         serial number.
2890         (Incremental_inputs::report_archive_begin): Likewise.
2891         (Incremental_inputs::report_object): Likewise.
2892         (Incremental_inputs::report_script): Likewise.
2893         (class Incremental_global_symbol_reader): New class.
2894         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2895         and store flags and input file type.
2896         (Incremental_input_entry_reader::arg_serial): New function.
2897         (Incremental_input_entry_reader::type): Extract type from flags.
2898         (Incremental_input_entry_reader::is_in_system_directory): New function.
2899         (Incremental_input_entry_reader::get_input_section_count): Call
2900         accessor function for type.
2901         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2902         function for type; adjust size of global symbol entry.
2903         (Incremental_input_entry_reader::get_global_symbol_count): Call
2904         accessor function for type.
2905         (Incremental_input_entry_reader::get_object_count): Likewise.
2906         (Incremental_input_entry_reader::get_object_offset): Likewise.
2907         (Incremental_input_entry_reader::get_member_count): Likewise.
2908         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2909         (Incremental_input_entry_reader::get_member_offset): Likewise.
2910         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2911         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2912         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2913         (Incremental_input_entry_reader::get_global_symbol_reader): New
2914         function.
2915         (Incremental_input_entry_reader::get_output_symbol_index): New
2916         function.
2917         (Incremental_input_entry_reader::type_): Remove.
2918         (Incremental_input_entry_reader::flags_): New data member.
2919         (Incremental_inputs_reader::input_file_offset): New function.
2920         (Incremental_inputs_reader::input_file_index): New function.
2921         (Incremental_inputs_reader::input_file): Call input_file_offset.
2922         (Incremental_inputs_reader::input_file_at_offset): New function.
2923         (Incremental_relocs_reader::get_r_type): Reformat.
2924         (Incremental_relocs_reader::get_r_shndx): Reformat.
2925         (Incremental_relocs_reader::get_r_offset): Reformat.
2926         (Incremental_relocs_reader::data): New function.
2927         (Incremental_binary::Incremental_binary): Initialize new data members.
2928         (Incremental_binary::check_inputs): Add cmdline parameter.
2929         (Incremental_binary::file_is_unchanged): Remove.
2930         (Input_reader::arg_serial): New function.
2931         (Input_reader::get_unused_symbol_count): New function.
2932         (Input_reader::get_unused_symbol): New function.
2933         (Input_reader::do_arg_serial): New function.
2934         (Input_reader::do_get_unused_symbol_count): New function.
2935         (Input_reader::do_get_unused_symbol): New function.
2936         (Incremental_binary::input_file_count): New function.
2937         (Incremental_binary::get_input_reader): Change signature to use
2938         index instead of filename.
2939         (Incremental_binary::file_has_changed): New function.
2940         (Incremental_binary::get_input_argument): New function.
2941         (Incremental_binary::get_library): New function.
2942         (Incremental_binary::get_script_info): New function.
2943         (Incremental_binary::init_layout): New function.
2944         (Incremental_binary::reserve_layout): New function.
2945         (Incremental_binary::output_file): New function.
2946         (Incremental_binary::do_check_inputs): New function.
2947         (Incremental_binary::do_file_is_unchanged): Remove.
2948         (Incremental_binary::do_file_has_changed): New function.
2949         (Incremental_binary::do_init_layout): New function.
2950         (Incremental_binary::do_reserve_layout): New function.
2951         (Incremental_binary::do_input_file_count): New function.
2952         (Incremental_binary::do_get_input_reader): Change signature.
2953         (Incremental_binary::input_args_map_): New data member.
2954         (Incremental_binary::library_map_): New data member.
2955         (Incremental_binary::script_map_): New data member.
2956         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2957         new data members.
2958         (Sized_incremental_binary::output_section): New function.
2959         (Sized_incremental_binary::inputs_reader): Add const.
2960         (Sized_incremental_binary::symtab_reader): Add const.
2961         (Sized_incremental_binary::relocs_reader): Add const.
2962         (Sized_incremental_binary::got_plt_reader): Add const.
2963         (Sized_incremental_binary::get_symtab_view): New function.
2964         (Sized_incremental_binary::Inputs_reader): New typedef.
2965         (Sized_incremental_binary::Input_entry_reader): New typedef.
2966         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2967         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2968         (Sized_incremental_binary::do_file_has_changed): New function.
2969         (Sized_incremental_binary::do_init_layout): New function.
2970         (Sized_incremental_binary::do_reserve_layout): New function.
2971         (Sized_input_reader::Inputs_reader): Remove.
2972         (Sized_input_reader::Input_entry_reader): Remove.
2973         (Sized_input_reader::do_arg_serial): New function.
2974         (Sized_input_reader::do_get_unused_symbol_count): New function.
2975         (Sized_input_reader::do_get_unused_symbol): New function.
2976         (Sized_incremental_binary::do_input_file_count): New function.
2977         (Sized_incremental_binary::do_get_input_reader): Change signature;
2978         use index instead of filename.
2979         (Sized_incremental_binary::section_map_): New data member.
2980         (Sized_incremental_binary::input_entry_readers_): New data member.
2981         (class Sized_incr_relobj): New class.
2982         (class Sized_incr_dynobj): New class.
2983         (make_sized_incremental_object): New function.
2984         (class Incremental_library): New class.
2985         * layout.cc (Free_list::num_lists): New static data member.
2986         (Free_list::num_nodes): New static data member.
2987         (Free_list::num_removes): New static data member.
2988         (Free_list::num_remove_visits): New static data member.
2989         (Free_list::num_allocates): New static data member.
2990         (Free_list::num_allocate_visits): New static data member.
2991         (Free_list::init): New function.
2992         (Free_list::remove): New function.
2993         (Free_list::allocate): New function.
2994         (Free_list::dump): New function.
2995         (Free_list::print_stats): New function.
2996         (Layout_task_runner::run): Resize output file for incremental updates.
2997         (Layout::Layout): Initialize new data members.
2998         (Layout::set_incremental_base): New function.
2999         (Layout::init_fixed_output_section): New function.
3000         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3001         incremental updates.
3002         (Layout::create_gold_note): Do not create gold note section for
3003         incremental updates.
3004         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3005         for incremental updates.
3006         (Layout::set_section_offsets): For incremental updates, allocate space
3007         from free list.
3008         (Layout::create_symtab_sections): Layout with offsets relative to
3009         start of section; for incremental updates, allocate space from free
3010         list.
3011         (Layout::create_shdrs): For incremental updates, allocate space from
3012         free list.
3013         (Layout::finish_dynamic_section): For incremental updates, do not
3014         check --as-needed (fixed in subsequent patch).
3015         * layout.h (class Free_list): New class.
3016         (Layout::set_incremental_base): New function.
3017         (Layout::incremental_base): New function.
3018         (Layout::init_fixed_output_section): New function.
3019         (Layout::allocate): New function.
3020         (Layout::incremental_base_): New data member.
3021         (Layout::free_list_): New data member.
3022         * main.cc (main): Print Free_list statistics.
3023         * object.cc (Relobj::finalize_incremental_relocs): Add
3024         clear_counts parameter; clear counts only when clear_counts is set.
3025         (Sized_relobj::Sized_relobj): Initialize new base class.
3026         (Sized_relobj::do_layout): Don't report special sections.
3027         (Sized_relobj::do_for_all_local_got_entries): New function.
3028         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3029         symtab_off to all symbol table offsets.
3030         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3031         * object.h (class Got_offset_list): Move to top of file.
3032         (Object::Object): Allow case where input_file == NULL.
3033         (Object::~Object): Likewise.
3034         (Object::input_file): Assert that input_file != NULL.
3035         (Object::lock): Allow case where input_file == NULL.
3036         (Object::unlock): Likewise.
3037         (Object::is_locked): Likewise.
3038         (Object::token): Likewise.
3039         (Object::release): Likewise.
3040         (Object::is_incremental): New function.
3041         (Object::get_mtime): New function.
3042         (Object::for_all_local_got_entries): New function.
3043         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3044         (Object::set_is_in_system_directory): New function.
3045         (Object::is_in_system_directory): New function.
3046         (Object::do_is_incremental): New function.
3047         (Object::do_get_mtime): New function.
3048         (Object::do_for_all_local_got_entries): New function.
3049         (Object::is_in_system_directory_): New data member.
3050         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3051         (class Sized_relobj_base): New class.
3052         (class Sized_relobj): Derive from Sized_relobj_base.
3053         (class Sized_relobj::Symbols): Redeclare from base class.
3054         (class Sized_relobj::local_got_offset_list): Remove.
3055         (class Sized_relobj::Output_sections): Redeclare from base class.
3056         (class Sized_relobj::do_for_all_local_got_entries): New function.
3057         (class Sized_relobj::write_local_symbols): Add offset parameter.
3058         (class Sized_relobj::local_symbol_offset_): Update comment.
3059         (class Sized_relobj::local_dynsym_offset_): Update comment.
3060         * options.cc (Input_arguments::add_file): Remove const.
3061         * options.h (Input_file_argument::Input_file_argument):
3062         Initialize arg_serial_ (all constructors).
3063         (Input_file_argument::set_arg_serial): New function.
3064         (Input_file_argument::arg_serial): New function.
3065         (Input_file_argument::arg_serial_): New data member.
3066         (Input_arguments::Input_arguments): Initialize file_count_.
3067         (Input_arguments::add_file): Remove const.
3068         (Input_arguments::number_of_input_files): New function.
3069         (Input_arguments::file_count_): New data member.
3070         (Command_line::number_of_input_files): Call
3071         Input_arguments::number_of_input_files.
3072         * output.cc (Output_segment_headers::Output_segment_headers):
3073         Set current size.
3074         (Output_section::Input_section::current_data_size): New function.
3075         (Output_section::Output_section): Initialize new data members.
3076         (Output_section::add_input_section): Don't do merge sections for
3077         an incremental link; allocate space from free list for an
3078         incremental update.
3079         (Output_section::add_output_section_data): Allocate space from
3080         free list for an incremental update.
3081         (Output_section::update_data_size): New function.
3082         (Output_section::set_fixed_layout): New function.
3083         (Output_section::reserve): New function.
3084         (Output_segment::set_section_addresses): Remove const.
3085         (Output_segment::set_section_list_addresses): Remove const; allocate
3086         space from free list for an incremental update.
3087         (Output_segment::set_offset): Adjust size of RELRO segment for an
3088         incremental update.
3089         * output.h (Output_data::current_data_size): Move here from
3090         child classes.
3091         (Output_data::pre_finalize_data_size): New function.
3092         (Output_data::update_data_size): New function.
3093         (Output_section_headers::update_data_size): new function.
3094         (Output_section_data_build::current_data_size): Move to Output_data.
3095         (Output_data_strtab::update_data_size): New function.
3096         (Output_section::current_data_size): Move to Output_data.
3097         (Output_section::set_fixed_layout): New function.
3098         (Output_section::has_fixed_layout): New function.
3099         (Output_section::reserve): New function.
3100         (Output_section::update_data_size): New function.
3101         (Output_section::has_fixed_layout_): New data member.
3102         (Output_section::free_list_): New data member.
3103         (Output_segment::set_section_addresses): Remove const.
3104         (Output_segment::set_section_list_addresses): Remove const.
3105         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3106         New function.
3107         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3108         New function.
3109         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3110         parameter when calling Add_symbols constructor; store argument
3111         serial number for members of a lib group.
3112         (Add_symbols::locks): Allow case where token == NULL.
3113         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3114         (Read_member::~Read_member): New function.
3115         (Read_member::is_runnable): New function.
3116         (Read_member::locks): New function.
3117         (Read_member::run): New function.
3118         (Check_script::~Check_script): New function.
3119         (Check_script::is_runnable): New function.
3120         (Check_script::locks): New function.
3121         (Check_script::run): New function.
3122         (Check_library::~Check_library): New function.
3123         (Check_library::is_runnable): New function.
3124         (Check_library::locks): New function.
3125         (Check_library::run): New function.
3126         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3127         (Add_symbols::library_): New data member.
3128         (class Read_member): New class.
3129         (class Check_script): New class.
3130         (class Check_library): New class.
3131         * reloc.cc (Read_relocs::is_runnable): Allow case where
3132         token == NULL.
3133         (Read_relocs::locks): Likewise.
3134         (Scan_relocs::locks): Likewise.
3135         (Relocate_task::locks): Likewise.
3136         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3137         to clear counters.
3138         (Sized_relobj::incremental_relocs_scan): Fix comment.
3139         (Sized_relobj::do_relocate): Pass output file offset to
3140         write_local_symbols.
3141         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3142         from class declaration.
3143         * script.cc (read_input_script): Allocate Script_info; pass
3144         argument serial number to report_script.
3145         * script.h (class Script_info): Move to incremental.h.
3146         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3147         * symtab.h (Symbol_table::add_from_incrobj): New function.
3148         (Symbol_table::set_file_offset): New function.
3149
3150 2011-04-05  Cary Coutant  <ccoutant@google.com>
3151
3152         * incremental-dump.cc (dump_incremental_inputs): Change signature
3153         to take a Sized_incremental_binary; change caller.  Use readers
3154         in Sized_incremental_binary.
3155         * incremental.cc
3156         (Sized_incremental_binary::find_incremental_inputs_sections):
3157         Rename do_find_incremental_inputs_sections to this.
3158         (Sized_incremental_binary::setup_readers): New function.
3159         (Sized_incremental_binary::do_check_inputs): Check
3160         has_incremental_info_ flag; move setup code to setup_readers;
3161         use input readers.
3162         (Sized_incremental_binary::do_file_is_unchanged): New function.
3163         (Sized_incremental_binary::do_get_input_reader): New function.
3164         * incremental.h (class Incremental_binary): Move to end of file.
3165         (Incremental_binary::file_is_unchanged): New function.
3166         (Incremental_binary::do_file_is_unchanged): New function.
3167         (Incremental_binary::Input_reader): New class.
3168         (Incremental_binary::get_input_reader): New function.
3169         (class Sized_incremental_binary): Move to end of file.
3170         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3171         input section reader classes.
3172         (Sized_incremental_binary::has_incremental_info): New function.
3173         (Sized_incremental_binary::inputs_reader): New function.
3174         (Sized_incremental_binary::symtab_reader): New function.
3175         (Sized_incremental_binary::relocs_reader): New function.
3176         (Sized_incremental_binary::got_plt_reader): New function.
3177         (Sized_incremental_binary::do_file_is_unchanged): New function.
3178         (Sized_incremental_binary::Sized_input_reader): New class.
3179         (Sized_incremental_binary::get_input_reader): New function.
3180         (Sized_incremental_binary::find_incremental_inputs_sections):
3181         Rename do_find_incremental_inputs_sections to this.
3182         (Sized_incremental_binary::setup_readers): New function.
3183         (Sized_incremental_binary::has_incremental_info_): New data member.
3184         (Sized_incremental_binary::inputs_reader_): New data member.
3185         (Sized_incremental_binary::symtab_reader_): New data member.
3186         (Sized_incremental_binary::relocs_reader_): New data member.
3187         (Sized_incremental_binary::got_plt_reader_): New data member.
3188         (Sized_incremental_binary::current_input_file_): New data member.
3189
3190 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3191
3192         PR gold/12640
3193         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3194         violation.
3195
3196 2011-03-30  Cary Coutant  <ccoutant@google.com>
3197
3198         * archive.cc (Archive::include_member): Adjust call to report_object.
3199         (Add_archive_symbols::run): Add script_info to call to
3200         report_archive_begin.
3201         (Lib_group::include_member): Adjust call to report_object.
3202         (Add_lib_group_symbols::run): Adjust call to report_object.
3203         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3204         blocks.  Add object count for script input files.
3205         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3206         script_info parameter; change all callers.
3207         (Incremental_inputs::report_object): Add script_info parameter;
3208         change all callers.
3209         (Incremental_inputs::report_script): Store backpointer to
3210         incremental info entry.
3211         (Output_section_incremental_inputs::set_final_data_size): Record
3212         additional information for scripts.
3213         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3214         * incremental.h (Incremental_script_entry::add_object): New function.
3215         (Incremental_script_entry::get_object_count): New function.
3216         (Incremental_script_entry::get_object): New function.
3217         (Incremental_script_entry::objects_): New data member; adjust
3218         constructor.
3219         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3220         (Incremental_inputs::report_object): Add script_info parameter.
3221         (Incremental_inputs_reader::get_object_count): New function.
3222         (Incremental_inputs_reader::get_object_offset): New function.
3223         * options.cc (Input_arguments::add_file): Return reference to
3224         new input argument.
3225         * options.h (Input_argument::set_script_info): New function.
3226         (Input_argument::script_info): New function.
3227         (Input_argument::script_info_): New data member; adjust all
3228         constructors.
3229         (Input_file_group::add_file): Return reference to new input argument.
3230         (Input_file_lib::add_file): Likewise.
3231         (Input_arguments::add_file): Likewise.
3232         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3233         * script.cc (Parser_closure::Parser_closure): Add script_info
3234         parameter; adjust all callers.
3235         (Parser_closure::script_info): New function.
3236         (Parser_closure::script_info_): New data member.
3237         (read_input_script): Report scripts earlier to incremental info.
3238         (script_add_file): Set script_info in Input_argument.
3239         (script_add_library): Likewise.
3240         * script.h (Script_options::Script_info): Rewrite class.
3241
3242 2011-03-29  Cary Coutant  <ccoutant@google.com>
3243
3244         * archive.cc (Library_base::should_include_member): Move
3245         method here from class Archive.
3246         (Archive::Archive): Initialize base class.
3247         (Archive::should_include_member): Move to base class.
3248         (Archive::do_for_all_unused_symbols): New function.
3249         (Add_archive_symbols::run): Remove redundant access to
3250         incremental_inputs.
3251         (Lib_group::Lib_group): Initialize base class.
3252         (Lib_group::do_filename): New function.
3253         (Lib_group::include_member): Pass pointer to Lib_group to
3254         report_object.
3255         (Lib_group::do_for_all_unused_symbols): New function.
3256         (Add_lib_group_symbols::run): Report archive information for
3257         incremental links.
3258         * archive.h (class Library_base): New base class.
3259         (class Archive): Derive from Library_base.
3260         (Archive::filename): Move to base class.
3261         (Archive::set_incremental_info): Likewise.
3262         (Archive::incremental_info): Likewise.
3263         (Archive::Should_include): Likewise.
3264         (Archive::should_include_member): Likewise.
3265         (Archive::Armap_entry): Remove.
3266         (Archive::Unused_symbol_iterator): Remove.
3267         (Archive::unused_symbols_begin): Remove.
3268         (Archive::unused_symbols_end): Remove.
3269         (Archive::do_filename): New function.
3270         (Archive::do_get_mtime): New function.
3271         (Archive::do_for_all_unused_symbols): New function.
3272         (Archive::task_): Move to base class.
3273         (Archive::incremental_info_): Likewise.
3274         (class Lib_group): Derive from Library_base.
3275         (Lib_group::do_filename): New function.
3276         (Lib_group::do_get_mtime): New function.
3277         (Lib_group::do_for_all_unused_symbols): New function.
3278         (Lib_group::task_): Move to base class.
3279         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3280         function.
3281         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3282         function.
3283         * incremental.cc (Incremental_inputs::report_archive_begin):
3284         Use Library_base; call library's get_mtime; add incremental inputs
3285         entry before members.
3286         (class Unused_symbol_visitor): New class.
3287         (Incremental_inputs::report_archive_end): Use Library_base; use
3288         visitor class to record unused symbols; don't add incremental inputs
3289         entry after members.
3290         (Incremental_inputs::report_object): Use Library_base.
3291         * incremental.h
3292         (Incremental_archive_entry::Incremental_archive_entry): Remove
3293         unused Archive parameter.
3294         (Incremental_inputs::report_archive_begin): Use Library_base.
3295         (Incremental_inputs::report_archive_end): Likewise.
3296         (Incremental_inputs::report_object): Likewise.
3297         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3298         function.
3299         * object.h (Object::for_all_global_symbols): New function.
3300         (Object::do_for_all_global_symbols): New function.
3301         (Sized_relobj::do_for_all_global_symbols): New function.
3302         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3303         function.
3304         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3305         function.
3306
3307 2011-03-27  Ian Lance Taylor  <iant@google.com>
3308
3309         * archive.cc (Archive::interpret_header): Return -1 if something
3310         goes wrong.  Change callers accordingly.
3311
3312 2011-03-25  Cary Coutant  <ccoutant@google.com>
3313
3314         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3315         * testsuite/Makefile.in: Regenerate.
3316
3317 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3318
3319         * plugin.cc (get_view): New.
3320         (Plugin::load): Pass get_view to the plugin.
3321         (Plugin_manager::get_view): New.
3322
3323 2011-03-21  Ian Lance Taylor  <iant@google.com>
3324
3325         * testsuite/final_layout.sh: Rewrite to not use dc.
3326         * testsuite/relro_test.sh: Fail if dc is not present.
3327
3328 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3329
3330         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3331         Change == to -eq.
3332         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3333         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3334         Change == to -eq.
3335         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3336         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3337
3338 2011-03-14  Ian Lance Taylor  <iant@google.com>
3339
3340         * script-sections.cc (Sort_output_sections::script_compare):
3341         Rename from is_before, change return type.
3342         (Sort_output_sections::operator()): Adjust accordingly.
3343
3344 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3345
3346         PR gold/12572
3347         * testsuite/odr_violation2.cc: Add comment to make all error line
3348         numbers double digits.
3349         * testsuite/debug_msg.sh: Adjust expected errors.
3350
3351 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3352
3353         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3354         but mark earlier ones as non-canonical
3355         (offset_to_iterator): Update search target and example
3356         (do_addr2line): Return extra lines in a vector*
3357         (format_file_lineno): Extract from do_addr2line
3358         (one_addr2line): Add vector* out-param
3359         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3360         when a lineno entry appeared last for its instruction
3361         (Dwarf_line_info): Add vector* out-param
3362         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3363         * symtab.cc (Odr_violation_compare): Include the lineno in the
3364         comparison again.
3365         (linenos_from_loc): New. Combine the canonical line for an
3366         address with its other lines.
3367         (True_if_intersect): New. Helper functor to make
3368         std::set_intersection a query.
3369         (detect_odr_violations): Compare sets of lines instead of just
3370         one line for each function. This became less deterministic, but
3371         has fewer false positives.
3372         * symtab.h: Declarations.
3373         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3374         mix an optimized and non-optimized object in the same binary
3375         (odr_violation2.so): Same.
3376         * testsuite/Makefile.in: Regenerate from Makefile.am.
3377         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3378         * testsuite/debug_msg.sh: Update line numbers and add
3379         assertions.
3380         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3381         non-optimized context.
3382         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3383         isn't inlined, and use OdrDerived in an optimized context.
3384         * testsuite/odr_header1.h: Defines OdrDerived, where
3385         optimization will change the
3386         first-instruction-in-the-destructor's file and line number.
3387         * testsuite/odr_header2.h: Defines OdrBase.
3388
3389 2011-03-09  Ian Lance Taylor  <iant@google.com>
3390
3391         * fileread.cc (File_read::clear_views): Don't delete the whole
3392         file view.
3393
3394 2011-03-08  Ian Lance Taylor  <iant@google.com>
3395
3396         PR gold/12525
3397         * fileread.cc: #include <climits>.
3398         (GOLD_IOV_MAX): Define.
3399         (File_read::read_multiple): Limit number of entries by iov_max.
3400         * fileread.h (class File_read): Always set max_readv_entries to
3401         128.
3402
3403 2011-03-07  Ian Lance Taylor  <iant@google.com>
3404
3405         PR gold/12525
3406         * options.h (class General_options): Add -dy and -dn.
3407
3408 2011-03-02  Cary Coutant  <ccoutant@google.com>
3409
3410         * testsuite/script_test_9.t: Add TLS segment.
3411
3412 2011-03-02  Simon Baldwin  <simonb@google.com>
3413
3414         * configure.ac: Add check for gnu_indirect_function support in
3415         the toolchain building binutils.
3416         * configure: Rebuild.
3417
3418 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3419
3420         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3421         plugin only symbols.
3422         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3423         in plugin files as not needed in the symbol table.
3424
3425 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3426
3427         * output.cc (Output_section::add_input_section): Delay fill
3428         generation for section ordering.
3429
3430 2011-02-09  Ian Lance Taylor  <iant@google.com>
3431
3432         PR gold/12316
3433         * object.h (class Sized_relobj): Remove clear_local_symbols.
3434         * reloc.cc (Sized_relobj::do_relocate): Don't call
3435         clear_local_symbols.
3436
3437 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3438
3439         * plugin.cc (is_visible_from_outside): Return true for symbols
3440         in the -u option.
3441
3442 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3443
3444         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3445         filename.
3446
3447 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3448
3449         * icf.h (is_section_foldable_candidate): Change type of parameter
3450         to std::string.
3451         * icf.cc (Icf::find_identical_sections): Change type of local variable
3452         section_name to be std::string.
3453         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3454
3455 2011-01-25  Ian Lance Taylor  <iant@google.com>
3456
3457         * script.cc (script_add_extern): Rewrite to use
3458         add_symbol_reference.
3459
3460 2011-01-25  Doug Kwan  <dougkwan@google.com>
3461
3462         * icf.cc (get_section_contents): Always lock section's object.
3463
3464 2011-01-24  Ian Lance Taylor  <iant@google.com>
3465
3466         * options.h (class General_options): Accept
3467         --no-detect-odr-violations.
3468
3469 2011-01-24  Ian Lance Taylor  <iant@google.com>
3470
3471         * version.cc (version_string): Bump to 1.11.
3472
3473 2011-01-24  Ian Lance Taylor  <iant@google.com>
3474
3475         * plugin.cc (class Plugin_rescan): Define new class.
3476         (Plugin_manager::claim_file): Set any_claimed_.
3477         (Plugin_manager::save_archive): New function.
3478         (Plugin_manager::save_input_group): New function.
3479         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3480         necessary.
3481         (Plugin_manager::new_undefined_symbol): New function.
3482         (Plugin_manager::rescan): New function.
3483         (Plugin_manager::rescannable_defines): New function.
3484         (Plugin_manager::add_input_file): Set any_added_.
3485         * plugin.h (class Plugin_manager): define new fields rescannable_,
3486         undefined_symbols_, any_claimed_, and any_added_.  Declare
3487         Plugin_rescan as friend.  Declare new functions.
3488         (Plugin_manager::Rescannable): Define type.
3489         (Plugin_manager::Rescannable_list): Define type.
3490         (Plugin_manager::Undefined_symbol_list): Define type.
3491         (Plugin_manager::Plugin_manager): Initialize new fields.
3492         * archive.cc (Archive::defines_symbol): New function.
3493         (Add_archive_symbols::run): Pass archive to plugins if any.
3494         * archive.h (class Archive): Declare defines_symbol.
3495         * readsyms.cc (Input_group::~Input_group): New function.
3496         (Finish_group::run): Pass input_group to plugins if any.
3497         * readsyms.h (class Input_group): Declare destructor.
3498         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3499         any.
3500
3501 2011-01-10  Ian Lance Taylor  <iant@google.com>
3502
3503         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3504         section as relro.
3505         (Layout::set_segment_offsets): Reset increase_relro before calling
3506         set_section_addresses a second time.
3507
3508 2011-01-04  Cary Coutant  <ccoutant@google.com>
3509
3510         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3511         sections before NOBITS sections.
3512
3513 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3514
3515         * version.cc (print_version): Update copyright to 2011.
3516
3517 2010-12-23  Cary Coutant  <ccoutant@google.com>
3518
3519         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3520         of OS to this->add.  Add OD parameter to second form of the function.
3521
3522 2010-12-20  Ian Lance Taylor  <iant@google.com>
3523
3524         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3525         second of two consecutive entries with same offset.
3526
3527 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3528
3529         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3530         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3531         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3532         to avoid unneeded links against $(LDADD).
3533         * testsuite/Makefile.in: Regenerate.
3534
3535 2010-12-15  Ian Lance Taylor  <iant@google.com>
3536
3537         PR gold/12324
3538         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3539         for R_X86_64_32 and R_X86_64_PC32.
3540         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3541         ver_matching_def_pic.o.
3542         (ver_matching_def_pic.o): New target.
3543
3544 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3545
3546         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3547         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3548         Move definition before File_read::View member definitions.
3549         (File_read::View::~View): Initialize and hold lock before
3550         updating current_mapped_bytes.
3551
3552 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3553
3554         * dwarf_reader.cc: Remove outdated comment.
3555         * gold-threads.cc: Fix typo in error message.
3556         * archive.cc: Fix typos in comments.
3557         * archive.h: Likewise.
3558         * arm-reloc-property.cc: Likewise.
3559         * arm-reloc-property.h: Likewise.
3560         * arm-reloc.def: Likewise.
3561         * arm.cc: Likewise.
3562         * attributes.h: Likewise.
3563         * cref.cc: Likewise.
3564         * ehframe.cc: Likewise.
3565         * fileread.h: Likewise.
3566         * gold.h: Likewise.
3567         * i386.cc: Likewise.
3568         * icf.cc: Likewise.
3569         * incremental.h: Likewise.
3570         * int_encoding.cc: Likewise.
3571         * layout.h: Likewise.
3572         * main.cc: Likewise.
3573         * merge.h: Likewise.
3574         * object.cc: Likewise.
3575         * object.h: Likewise.
3576         * options.cc: Likewise.
3577         * readsyms.cc: Likewise.
3578         * reduced_debug_output.cc: Likewise.
3579         * reloc.cc: Likewise.
3580         * script-sections.cc: Likewise.
3581         * sparc.cc: Likewise.
3582         * symtab.h: Likewise.
3583         * target-reloc.h: Likewise.
3584         * target.cc: Likewise.
3585         * target.h: Likewise.
3586         * timer.cc: Likewise.
3587         * timer.h: Likewise.
3588         * x86_64.cc: Likewise.
3589
3590 2010-12-09  Cary Coutant  <ccoutant@google.com>
3591
3592         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3593         stack.
3594         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3595         parameter; change all callers.
3596         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3597         * options.h (warn_execstack): New option.
3598
3599 2010-12-07  Doug Kwan  <dougkwan@google.com>
3600
3601         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3602         like function call relocations.
3603
3604 2010-12-07  Ian Lance Taylor  <iant@google.com>
3605
3606         * archive.cc (Archive::get_elf_object_for_member): Permit
3607         punconfigured to be NULL.
3608         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3609         (Archive::include_member): Pass NULL to get_elf_object_for_member
3610         if we searched for the archive and this is the first included
3611         object.
3612
3613 2010-12-01  Ian Lance Taylor  <iant@google.com>
3614
3615         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3616         track_relocs_type_ field.
3617         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3618         Set track_relocs_type_.
3619         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3620         contents when using RELA relocs.
3621         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3622         reloc_map_.
3623         * reloc.cc (Track_relocs::next_addend): New function.
3624         * reloc.h (class Track_relocs): Declare next_addend.
3625
3626 2010-12-01  Ian Lance Taylor  <iant@google.com>
3627
3628         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3629         virtual destructor.
3630
3631 2010-12-01  Ian Lance Taylor  <iant@google.com>
3632
3633         * README: Update compilers known to work and fail.
3634
3635 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3636
3637         * configure.in: For --enable-gold, handle value `default' instead of
3638         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3639         not the default.
3640         * configure: Regenerate.
3641
3642 2010-11-18  Doug Kwan  <dougkwan@google.com>
3643
3644         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3645         and right_alignment to be zero.  Store result alignment only if it is
3646         greater than existing alignment.
3647
3648 2010-11-16  Cary Coutant  <ccoutant@google.com>
3649
3650         PR gold/12220
3651         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3652         Check for ".zdebug_line".
3653
3654 2010-11-16  Doug Kwan  <dougkwan@google.com>
3655             Cary Coutant  <ccoutant@google.com>
3656
3657         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3658         by reference; adjust all callers.
3659         * output.cc (Output_segment::set_section_addresses): Adjust references
3660         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3661         list is empty.
3662         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3663         end at page boundary.
3664
3665 2010-11-16  Cary Coutant  <ccoutant@google.com>
3666
3667         PR gold/12220
3668         * layout.cc (Layout::choose_output_section): Transform names of
3669         compressed sections even when using a script with a SECTIONS clause.
3670         (Layout::output_section_name): Remove code to transform
3671         compressed debug section names.
3672         * output.cc (Output_section::add_input_section): Use uncompressed
3673         section size when tracking input sections.
3674
3675 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3676
3677         * symtab.h (Symbol::NON_PIC_REF): Remove.
3678         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3679         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3680         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3681         (Symbol::use_plt_offset): Take a flags argument and pass it
3682         directly to needs_dynamic_reloc.  Restrict check for undefined
3683         weak symbols to function calls.
3684         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3685         (Target_arm::Scan::global): Use it.
3686         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3687         (Target_arm::Relocate::relocate): Likewise.
3688         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3689         parameter with an r_type parameter.  Use get_reference_flags
3690         to get the flags.
3691         (Target_arm::Relocate::relocate): Update accordingly.
3692         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3693         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3694         (Target_i386::Scan::global): Likewise.
3695         (Target_i386::Relocate::relocate): Likewise.
3696         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3697         parameter with an r_type parameter.  Use get_reference_flags
3698         to get the flags.
3699         (Target_i386::Relocate::relocate): Update accordingly.
3700         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3701         (Target_powerpc::Scan::global): Use it.
3702         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3703         (Target_powerpc::Relocate::relocate): Likewise.
3704         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3705         (Target_sparc::Scan::global): Use it.
3706         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3707         (Target_sparc::Relocate::relocate): Likewise.
3708         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3709         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3710         (Target_x86_64::Scan::global): Likewise.
3711         (Target_x86_64::Relocate::relocate): Likewise.
3712
3713 2010-11-08  Doug Kwan  <dougkwan@google.com>
3714             Cary Coutant  <ccoutant@google.com>
3715
3716         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3717         (Arm_exidx_merge_section::section_contents_): New data member.
3718         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3719         (Arm_input_section::~Arm_input_section): De-allocate memory.
3720         (Arm_input_section::original_contents_): New data member.
3721         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3722         in parameters instead of calling Object::section_contents without
3723         locking.
3724         (Arm_output_section::group_section): New parameter TASK.  Pass it
3725         to callees that need locking objects.
3726         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3727         to lock EXIDX input sections.  Fix a formatting issue.  Call
3728         Arm_exidx_merged_section::build_contents to create merged section
3729         contents.
3730         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3731         to lock object of stub table owner.
3732         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3733         TEXT_SIZE to initialize data member TEXT_SIZE_.
3734         (Arm_exidx_input_section::addralign): Fix typo in comment.
3735         (Arm_exidx_input_section::text_size): New method.
3736         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3737         that require locking objects.  Lock objects before scanning for stubs
3738         and updating local symbols.
3739         (Arm_input_section<big_endian>::init): Copy contents of original
3740         input section.
3741         (Arm_input_section<big_endian>::do_write): Use saved contents of
3742         original input section instead of calling Object::section_contents
3743         without locking.
3744         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3745         size without calling Object::section_size().
3746         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3747         for size.  Allocate a buffer for merged EXIDX entries.
3748         (Arm_exidx_merged_section::build_contents): New method.
3749         (Arm_exidx_merged_section::do_write): Move merge section contents
3750         building code to Arm_exidx_merged_section::build_contetns.  Write
3751         out contetns in buffer instead of building it on the fly.
3752         (Arm_relobj::make_exidx_input_section): Also pass text section size
3753         to Arm_exidx_input_section constructor.
3754         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3755         (Arm_dynobj::do_read_symbols): Fix memory leak.
3756         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3757         * target.h: (class Task): Add forward declaration.
3758         (Target::relax): Add new parameter TASK and pass it to
3759         Target::do_relax().
3760         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3761
3762 2010-11-05  Cary Coutant  <ccoutant@google.com>
3763
3764         PR gold/10708
3765         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3766         object when reading from the file.
3767         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3768         second layout pass.
3769         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3770         when reading section contents.
3771         (get_section_contents): Likewise.
3772         (icf::find_identical_sections): Likewise.
3773         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3774         object when reading from the file.
3775         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3776         the object when doing deferred section layout.
3777
3778 2010-11-03  Nick Clifton  <nickc@redhat.com>
3779
3780         PR gold/12001
3781         * script.h (class Symbol_assignment: name): New member.  Returns
3782         the name of the symbol.
3783         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3784         Returns true if the given symbol name is on the list of
3785         assignments wating to be processed.
3786         * archive.cc (should_incldue_member): If the symbol is undefined,
3787         check to see if it is on the list of symbols pending assignment.
3788
3789 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3790
3791         * script-sections.cc (Script_sections::find_memory_region): Check
3792         for a NULL output section pointer.
3793
3794 2010-10-29  Doug Kwan  <dougkwan@google.com>
3795
3796         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3797         Output_section::add_relaxed_input_section.
3798         * output.cc (Output_section::add_relaxed_input_section): Add new
3799         arguments LAYOUT and NAME.  Set section order index.
3800         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3801         Copy section order index.
3802         * output.h (Output_section::add_relaxed_input_section): Add new
3803         arguments LAYOUT and NAME.
3804
3805 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3806
3807         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3808         NATIVE_OR_CROSS_LINKER.
3809         * testsuite/Makefile.in: Regenerate.
3810
3811 2010-10-20  Doug Kwan  <dougkwan@google.com>
3812
3813         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3814         without SHF_LINK_ORDER flags.
3815         * layout.cc (Layout::choose_output_section): Do not filter
3816         SHF_LINK_ORDER flag in a relocatable link.
3817
3818 2010-10-17  Cary Coutant  <ccoutant@google.com>
3819
3820         * output.h (Output_segment::set_section_addresses): Change function
3821         signature.  Update all callers.
3822         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3823         sections.
3824         (Output_segment::set_section_addresses): Align after last TLS
3825         section.  Add padding before last relro section instead of after.
3826
3827 2010-10-17  Doug Kwan  <dougkwan@google.com>
3828
3829         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3830         GOT output section to be writable.
3831
3832 2010-10-14  Cary Coutant  <ccoutant@google.com>
3833
3834         * debug.h (DEBUG_INCREMENTAL): New flag.
3835         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3836         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3837         mode.
3838         * incremental.cc (report_command_line): Ignore all forms of
3839         --incremental.
3840         * layout.cc (Layout::Layout): Check parameters for incremental link
3841         mode.
3842         * options.cc (General_options::parse_incremental): New function.
3843         (General_options::parse_no_incremental): New function.
3844         (General_options::parse_incremental_full): New function.
3845         (General_options::parse_incremental_update): New function.
3846         (General_options::incremental_mode_): New data member.
3847         (General_options::finalize): Check incremental_mode_.
3848         * options.h (General_options): Update help text for --incremental.
3849         Add --no-incremental, --incremental-full, --incremental-update.
3850         (General_options::Incremental_mode): New enum type.
3851         (General_options::incremental_mode): New function.
3852         (General_options::incremental_mode_): New data member.
3853         * parameters.cc (Parameters::incremental_mode_): New data member.
3854         (Parameters::set_options): Set incremental_mode_.
3855         (Parameters::set_incremental_full): New function.
3856         (Parameters::incremental): New function.
3857         (Parameters::incremental_update): New function.
3858         (set_parameters_incremental_full): New function.
3859         * parameters.h (Parameters::set_incremental_full): New function.
3860         (Parameters::incremental): New function.
3861         (Parameters::incremental_update): New function.
3862         (Parameters::incremental_mode_): New data member.
3863         (set_parameters_incremental_full): New function.
3864         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3865         incremental link mode.
3866         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3867         (Sized_relobj::do_relocate_sections): Likewise.
3868         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3869         option.
3870         * testsuite/Makefile.in: Regenerate.
3871         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3872
3873 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3874
3875         * script-sections.h (class Script_sections): Make
3876         Sections_elements typedef public.
3877         * script-sections.cc (class Sort_output_sections): Add elements_
3878         field.  Add constructor which sets it; change all callers.
3879         (Sort_output_sections::is_before): New function.
3880         (Sort_output_sections::operator()): Call is_before.
3881         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3882         conditional.
3883         * testsuite/script_test_10.sh: New test. Test script section
3884         order.
3885         * testsuite/script_test_10.t: Likewise.
3886         * testsuite/script_test_10.s: Likewise.
3887         * testsuite/Makefile.am: Wrap the cross linker tests and the
3888         common tests into NATIVE_OR_CROSS_LINKER.
3889         (check_SCRIPTS): Add script_test_10.sh.
3890         (check_DATA): Add script_test_10.stdout.
3891         (script_test_10.o, script_test_10): New targets.
3892         (script_test_10.stdout): New target.
3893         * configure, testsuite/Makefile.in: Regenerate.
3894
3895 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3896
3897         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3898         error for the deprecated relocations.
3899         (Target_arm::Scan::global): Likewise.
3900         (Target_arm::Relocate::relocate): Likewise.
3901
3902 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3903
3904         * fileread.cc (Input_file::find_file): Initialize *found_name
3905         and *namep when using the fallback search for case 4.
3906
3907 2010-10-11  Cary Coutant  <ccoutant@google.com>
3908
3909         * options.h (class General_options): Redefine -z lazy as an alias for
3910         the negation of -z now.
3911
3912 2010-10-11  Ian Lance Taylor  <iant@google.com>
3913
3914         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3915         binding.
3916
3917 2010-10-06  Nick Clifton  <nickc@redhat.com>
3918
3919         * script-sections.cc(class Memory_region): Remove
3920         current_lma_offset_ field.  Rename current_vma_offset_ to
3921         current_offset_.  Add last_section_ field.
3922         (Memory_region::get_current_vma_address): Rename to
3923         get_current_address.
3924         (Memory_region::get_current_lma_address): Delete.
3925         (Memory_region::increment_vma_offset): Rename to
3926         increment_offset.
3927         (Memory_region::increment_lma_offset): Delete.
3928         (Memory_region::attributes_compatible): New method.  Returns
3929         true if the provided section is compatible with the region.
3930         (Memory_region::get_last_section): New method.  Returns the last
3931         section to use the region.
3932         (Memory_region::set_last_section): New method.  Stores the last
3933         section to use the region.
3934         (Script_sections::block_in_region): New method.  Returns true if
3935         a block of memory is contained within a region.
3936         (Script_sections::find_memory_region): New method.  Locates a
3937         memory region to be used to set a VMA or LMA address.
3938         (Output_section_definition::set_section_addresses): Add code to
3939         check for addresses set by memory regions.
3940         (Output_segment::set_section_addresses): Remove memory region
3941         walking code.
3942         (Script_sections::create_segment): Add a warning if a header
3943         segment is created outside of any region.
3944         * script-sections.h (class Script_sections): Add prototypes for
3945         find_memory_region and block_in_region methods.
3946         * testsuite/memory_test.s: Use .long instead of .word.
3947         * testsuite/memory_test.t: Add some more output sections.
3948         * testsuite/memory_test.sh: Update expected output.
3949
3950 2010-10-02  Doug Kwan  <dougkwan@google.com>
3951
3952         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3953         defintion to symtab.h
3954         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3955         declaration to defintion.
3956
3957 2010-10-01  Nick Clifton  <nickc@redhat.com>
3958
3959         * expression.cc (eval): Replace dummy argument with NULL.
3960         (eval_maybe_dot): Check for a NULL result section pointer.
3961         (Symbol_expression::value): Likewise.
3962         (Dot_expression::value): Likewise.
3963         (BINARY_EXPRESSION): Likewise.
3964         (Max_expression::value): Likewise.
3965         (Min_expression::value): Likewise.
3966         (Absolute_expression::value): Likewise.
3967         (Addr_expression::value_from_output_section): Likewise.
3968         (Loaddddr_expression::value_from_output_section): Likewise.
3969         (Segment_start_expression::value): Likewise.
3970         * script-sections.cc
3971         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3972         argument with NULL.
3973         (Sections_elememt_dot_assignment::set_section_addresses):
3974         Likewise.
3975         (Output_data_expression::do_write_to_buffer): Likewise.
3976         (Output_section_definition::finalize_symbols): Likewise.
3977         (Output_section_definition::set_section_addresses): Likewise.
3978
3979 2010-09-30  Doug Kwan  <dougkwan@google.com>
3980
3981         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3982
3983 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3984
3985         * target.h (Target::can_icf_inline_merge_sections): New virtual
3986         function.
3987         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3988         virtual function.
3989         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3990         virtual function.
3991         * icf.cc (get_section_contents): Inline merge sections only when
3992         target allows it.
3993
3994 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3995
3996         * configure: Regenerate.
3997
3998 2010-09-17  Ian Lance Taylor  <iant@google.com>
3999
4000         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4001         * testsuite/Makefile.am (memory_test.o): New target.
4002         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4003         memory_test.t.
4004         * testsuite/Makefile.in: Rebuild.
4005
4006 2010-09-17  Doug Kwan  <dougkwan@google.com>
4007
4008         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4009         defintion if relocation uses GOT entries of the symbol.
4010         * testsuite/icf_safe_test.sh: Fix test.
4011         * testsuite/icf_safe_so_test.sh: Fix test.
4012
4013 2010-09-16  Cary Coutant  <ccoutant@google.com>
4014
4015         * script_sections.cc (class Memory_region): Remove "NULL" from
4016         vector initializations.
4017
4018 2010-09-15  Cary Coutant  <ccoutant@google.com>
4019
4020         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4021         Resolve forwarding symbols.
4022
4023 2010-09-15  Doug Kwan  <dougkwan@google.com>
4024
4025         * gold/testsuite/script_test_3.t: Add ARM special sections.
4026         * gold/testsuite/script_test_4.t: Same.
4027         * gold/testsuite/script_test_5.t: Same.
4028         * gold/testsuite/script_test_6.t: Same.
4029         * gold/testsuite/script_test_7.t: Same.
4030         * gold/testsuite/script_test_7.t: Same.
4031         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4032
4033 2010-09-14  Cary Coutant  <ccoutant@google.com>
4034
4035         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4036         (Target_x86_64::Relocate::relocate_tls): Replace check for
4037         saw_tls_block_reloc_ with test for executable section.
4038
4039 2010-09-12  Cary Coutant  <ccoutant@google.com>
4040
4041         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4042         position-independent executables to shared libraries need dynamic
4043         relocations.
4044         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4045         position-independent executables.
4046         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4047         * testsuite/Makefile.in: Regenerate.
4048
4049 2010-09-10  Nick Clifton  <nickc@redhat.com>
4050
4051         PR gold/11997
4052         * testsuite/memory_test.t: Discard any sections that are not
4053         needed.
4054
4055 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4056
4057         PR gold/11996
4058         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4059         "This::" to work around a bug in gcc 4.2.
4060
4061         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4062
4063 2010-09-09  Rafael Espindola  <espindola@google.com>
4064
4065         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4066         sections with different PF_X flags in the same segment.
4067         (Layout::find_first_load_seg): Search all segments to find the first
4068         one.
4069         * options.h (rosegment): New.
4070
4071 2010-09-08  Rafael Espindola  <espindola@google.com>
4072
4073         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4074
4075 2010-09-08  Doug Kwan  <dougkwan@google.com>
4076
4077         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4078         (Arm_relobj::do_relocate_sections): Add new parameter for output
4079         file to match the parent.
4080         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4081         of local symbols instead of input values.  Update code to track
4082         changes in gold::relocate_section.
4083         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4084         (Sized_relobj::compute_final_local_value_internal): New methods.
4085         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4086         body into private version of Sized_relobj::compute_final_local_value.
4087         Call the inline method.
4088         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4089         merged symbol value if there is one.
4090         (Symbol_value::has_output_value): New method defintiion.
4091         (Sized_relobj::Compute_final_local_value_status): New enum type.
4092         (Sized_relobj::compute_final_local_value): New methods.
4093         (Sized_relobj::compute_final_local_value_internal): New methods.
4094         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4095         and arm_cortex_a8.sh.
4096         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4097         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4098         New tests.
4099         * Makefile.in: Regenerate.
4100         * testsuite/arm_bl_out_of_range.s: Update test.
4101         * testsuite/thumb_bl_out_of_range.s: Ditto.
4102         * testsuite/thumb_blx_out_of_range.s: Ditto.
4103         * testsuite/arm_branch_out_of_range.sh: New file.
4104         * testsuite/arm_cortex_a8.sh: Ditto.
4105         * testsuite/arm_cortex_a8_b.s: Ditto.
4106         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4107         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4108         * testsuite/arm_cortex_a8_bl.s: Ditto.
4109         * testsuite/arm_cortex_a8_blx.s: Ditto.
4110         * testsuite/arm_cortex_a8_local.s: Ditto.
4111         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4112         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4113
4114 2010-09-08  Rafael Espindola  <espindola@google.com>
4115
4116         * Makefile.am (memory_test.stdout): Run readelf with -W.
4117         * Makefile.in: Regenerate.
4118         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4119         64 bit output.
4120
4121 2010-09-08  Rafael Espindola  <espindola@google.com>
4122
4123         * script-sections.cc (Script_sections::add_memory_region): Convert
4124         field precision to int.
4125         * script.cc (script_set_section_region, script_set_section_region):
4126         Convert field precision to int.
4127
4128 2010-09-08  Rafael Espindola  <espindola@google.com>
4129
4130         * arm.cc (do_finalize_sections): Create the __exidx_start and
4131         __exdix_end symbols even when the section is missing.
4132
4133 2010-09-08  Nick Clifton  <nickc@redhat.com>
4134
4135         * README: Remove claim that MEMORY is not supported.
4136         * expression.cc (script_exp_function_origin)
4137         (script_exp_function_length): Move from here to ...
4138         * script.cc: ... here.
4139         (script_set_section_region, script_add_memory)
4140         (script_parse_memory_attr, script_include_directive): New
4141         functions.
4142         * script-sections.cc
4143         (class Memory_region): New class.
4144         (class Output_section_definition): Add set_memory_region,
4145         set_section_vma, set_section_lma and get_section_name methods.
4146         (class Script_Sections): Add add_memory_region,
4147         find_memory_region, find_memory_region_origin,
4148         find_memory_region_length and set_memory_region methods.
4149         Have set_section_addresses method walk the list of set memory
4150         regions.
4151         Extend the print methos to display memory regions.
4152         * script-sections.h: Add prototypes for new methods.
4153         Add enum for MEMORY region attributes.
4154         * yyscript.y: Add support for parsing MEMORY regions.
4155         * script-c.h: Add prototypes for new functions.
4156         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4157         * testsuite/Makefile.in: Regenerate.
4158         * testsuite/memory_test.sh: New script.
4159         * testsuite/memory_test.s: New assembler source file.
4160         * testsuite/memory_test.t: New linker script.
4161
4162 2010-08-27  Doug Kwan  <dougkwan@google.com>
4163
4164         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4165         reference override an existing dynamic weak reference.
4166         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4167         * testsuite/Makefile.in: Regenerate.
4168         * testsuite/dyn_weak_ref.sh: New file.
4169         * testsuite/dyn_weak_ref_1.c: Ditto.
4170         * testsuite/dyn_weak_ref_2.c: Ditto.
4171
4172 2010-08-27  Ian Lance Taylor  <iant@google.com>
4173
4174         * incremental.h (class Incremental_input_entry): Add virtual
4175         destructor.
4176
4177 2010-08-27  Ian Lance Taylor  <iant@google.com>
4178
4179         * testsuite/start_lib_test_3.c: Mark t3 as used.
4180
4181 2010-08-27  Nick Clifton  <nickc@redhat.com>
4182
4183         * options.cc (version_script): Fix small typo in previous
4184         whitespace tidyup.
4185
4186 2010-08-25  Nick Clifton  <nickc@redhat.com>
4187
4188         * archive.cc: Formatting fixes: Remove whitespace between
4189         typename and following asterisk.  Remove whitespace between
4190         function name and opening parenthesis.
4191         * archive.h: Likewise.
4192         * arm.cc: Likewise.
4193         * attributes.cc: Likewise.
4194         * attributes.h: Likewise.
4195         * common.cc: Likewise.
4196         * copy-relocs.cc: Likewise.
4197         * dirsearch.h: Likewise.
4198         * dynobj.cc: Likewise.
4199         * ehframe.cc: Likewise.
4200         * ehframe.h: Likewise.
4201         * expression.cc: Likewise.
4202         * fileread.cc: Likewise.
4203         * fileread.h: Likewise.
4204         * gc.h: Likewise.
4205         * gold-threads.cc: Likewise.
4206         * gold.cc: Likewise.
4207         * i386.cc: Likewise.
4208         * icf.h: Likewise.
4209         * incremental-dump.cc: Likewise.
4210         * incremental.cc: Likewise.
4211         * layout.cc: Likewise.
4212         * layout.h: Likewise.
4213         * main.cc: Likewise.
4214         * merge.cc: Likewise.
4215         * merge.h: Likewise.
4216         * object.cc: Likewise.
4217         * object.h: Likewise.
4218         * options.cc: Likewise.
4219         * options.h: Likewise.
4220         * output.cc: Likewise.
4221         * output.h: Likewise.
4222         * plugin.cc: Likewise.
4223         * plugin.h: Likewise.
4224         * powerpc.cc: Likewise.
4225         * reloc.cc: Likewise.
4226         * script-c.h: Likewise.
4227         * script-sections.cc: Likewise.
4228         * script.cc: Likewise.
4229         * stringpool.cc: Likewise.
4230         * symtab.cc: Likewise.
4231         * symtab.h: Likewise.
4232         * target.cc: Likewise.
4233         * timer.cc: Likewise.
4234         * timer.h: Likewise.
4235         * version.cc: Likewise.
4236         * x86_64.cc: Likewise.
4237
4238 2010-08-24  Nick Clifton  <nickc@redhat.com>
4239
4240         PR 11899
4241         * layout.cc (segment_precedes): Sort segments by their physical
4242         addresses, if they have been set.
4243
4244 2010-08-23  Cary Coutant  <ccoutant@google.com>
4245
4246         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4247         symbols data.
4248         (Lib_group::include_member): Unlock object after deleting its
4249         symbols data.
4250         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4251         the bug fixed here.
4252
4253 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4254             Cary Coutant  <ccoutant@google.com>
4255
4256         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4257         constructor, and set_blocker.
4258         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4259         readsyms_blocker_.
4260         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4261         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4262         * testsuite/Makefile.am (start_lib_test): New test case.
4263         * testsuite/Makefile.in: Regenerate.
4264         * testsuite/start_lib_test_main.c: New file.
4265         * testsuite/start_lib_test_1.c: New file.
4266         * testsuite/start_lib_test_2.c: New file.
4267         * testsuite/start_lib_test_3.c: New file.
4268
4269 2010-08-19  Ian Lance Taylor  <iant@google.com>
4270
4271         * Makefile.in: Rebuild with automake 1.11.1.
4272         * aclocal.m4: Likewise.
4273         * testsuite/Makefile.in: Likewise.
4274
4275 2010-08-19  Ian Lance Taylor  <iant@google.com>
4276
4277         PR 10893
4278         * i386.cc (class Output_data_plt_i386): Update declarations.
4279         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4280         local_ifuncs_ fields.
4281         (Target_i386::do_plt_section_for_global): New function.
4282         (Target_i386::do_plt_section_for_local): New function.
4283         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4284         parameter; change all callers.  Initialize global_ifuncs_ and
4285         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4286         __rel_iplt_end.
4287         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4288         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4289         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4290         symbols.
4291         (Target_i386::make_plt_section): New function, broken out of
4292         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4293         (Target_i386::make_plt_entry): Call make_plt_section.
4294         (Target_i386::make_local_ifunc_plt_entry): New function.
4295         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4296         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4297         R_386_IRELATIVE to switch.
4298         (Target_i386::Scan::global): Likewise.
4299         (Target_i386::Relocate::relocate): Likewise.
4300         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4301         switch.
4302         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4303         (Target_x86_64::do_plt_section_for_global): New function.
4304         (Target_x86_64::do_plt_section_for_local): New function.
4305         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4306         parameter; change all callers.  If doing a static link define
4307         __rela_iplt_start and __rela_iplt_end.
4308         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4309         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4310         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4311         to point to .plt.
4312         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4313         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4314         switch.
4315         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4316         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4317         R_X86_64_IRELATIVE to switch.
4318         (Target_x86_64::Scan::global): Likewise.
4319         (Target_x86_64::Relocate::relocate): Likewise.
4320         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4321         switch.
4322         * target.h (class Target): Add plt_section_for_global and
4323         plt_section_for_local functions.  Add do_plt_section_for_global
4324         and do_plt_section_for_local virtual functions.
4325         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4326         clarifying comments.
4327         (Symbol::use_plt_offset): Handle IFUNC symbol.
4328         * object.cc (Sized_relobj::Sized_relobj): Initialize
4329         local_plt_offsets_.
4330         (Sized_relobj::local_has_plt_offset): New function.
4331         (Sized_relobj::local_plt_offset): New function.
4332         (Sized_relobj::set_local_plt_offset): New function.
4333         (Sized_relobj::do_count): Handle IFUNC symbol.
4334         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4335         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4336         is_ifunc_symbol functions.
4337         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4338         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4339         local_plt_offsets_ field.
4340         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4341         * output.h (class Output_section_data): Add non-const
4342         output_section function.
4343         (class Output_data_got): Update declarations.
4344         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4345         Add use_plt_offset parameter to global and local constructors.
4346         Change all callers.  Change local_sym_index_ field to 31 bits.
4347         Change GSYM_CODE and CONSTANT_CODE accordingly.
4348         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4349         doing a static link don't set sh_link field.
4350         (Output_data_got::Got_entry::write): Use PLT offset if
4351         appropriate.
4352         (Output_data_got::add_global_plt): New function.
4353         (Output_data_got::add_local_plt): New function.
4354         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4355         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4356         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4357         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4358         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4359         IFUNC conditional.
4360         * testsuite/ifunc-sel.h: New file.
4361         * testsuite/ifuncmain1.c: New file.
4362         * testsuite/ifuncmain1vis.c: New file.
4363         * testsuite/ifuncmod1.c: New file.
4364         * testsuite/ifuncdep2.c: New file.
4365         * testsuite/ifuncmain2.c: New file.
4366         * testsuite/ifuncmain3.c: New file.
4367         * testsuite/ifuncmod3.c: New file.
4368         * testsuite/ifuncmain4.c: New file.
4369         * testsuite/ifuncmain5.c: New file.
4370         * testsuite/ifuncmod5.c: New file.
4371         * testsuite/ifuncmain6pie.c: New file.
4372         * testsuite/ifuncmod6.c: New file.
4373         * testsuite/ifuncmain7.c: New file.
4374         * configure, testsuite/Makefile.in: Rebuild.
4375
4376 2010-08-18  Ian Lance Taylor  <iant@google.com>
4377
4378         * incremental.cc
4379         (Output_section_incremental_inputs::write_input_files): Add cast
4380         to avoid signed/unsigned comparison warning.
4381         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4382
4383 2010-08-12  Cary Coutant  <ccoutant@google.com>
4384
4385         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4386
4387 2010-08-13  Ian Lance Taylor  <iant@google.com>
4388
4389         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4390
4391 2010-08-12  Cary Coutant  <ccoutant@google.com>
4392             Doug Kwan  <dougkwan@google.com>
4393
4394         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4395         defintion overrides non-weak undef, remember that the original undef
4396         is not weak.
4397         * symtab.cc (Symbol_table::sized_write_global): For undef without
4398         an original weak binding, set binding to global in output.
4399         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4400         * testsuite/Makefile.in: Regenerate.
4401         * testsuite/strong_ref_weak_def.sh: New file.
4402         * testsuite/strong_ref_weak_def_1.c: Ditto.
4403         * testsuite/strong_ref_weak_def_2.c: Ditto.
4404
4405 2010-08-12  Cary Coutant  <ccoutant@google.com>
4406
4407         * testsuite/incremental_test.sh: Rewrite.
4408         * testsuite/incremental_test_1.c: Rewrite.
4409         * testsuite/incremental_test_2.c: Rewrite.
4410
4411 2010-08-12  Cary Coutant  <ccoutant@google.com>
4412
4413         * arm.cc (Target_arm::got_size): Add const.
4414         (Target_arm::got_entry_count): New function.
4415         (Target_arm::plt_entry_count): New function.
4416         (Target_arm::first_plt_entry_offset): New function.
4417         (Target_arm::plt_entry_size): New function.
4418         (Output_data_plt_arm::entry_count): New function.
4419         (Output_data_plt_arm::first_plt_entry_offset): New function.
4420         (Output_data_plt_arm::get_plt_entry_size): New function.
4421         * i386.cc (Target_i386::got_size): Add const.
4422         (Target_i386::got_entry_count): New function.
4423         (Target_i386::plt_entry_count): New function.
4424         (Target_i386::first_plt_entry_offset): New function.
4425         (Target_i386::plt_entry_size): New function.
4426         (Output_data_plt_i386::entry_count): New function.
4427         (Output_data_plt_i386::first_plt_entry_offset): New function.
4428         (Output_data_plt_i386::get_plt_entry_size): New function.
4429         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4430         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4431         * incremental.cc: Include target.h.
4432         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4433         parameter.  Adjust all callers.  Find incremental_got_plt section.
4434         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4435         section.
4436         (Output_section_incremental_inputs::set_final_data_size): Calculate
4437         size of incremental_got_plt section.
4438         (Output_section_incremental_inputs::do_write): Write the
4439         incremental_got_plt section.
4440         (Got_plt_view_info): New struct.
4441         (Local_got_offset_visitor): New class.
4442         (Global_got_offset_visitor): New class.
4443         (Global_symbol_visitor_got_plt): New class.
4444         (Output_section_incremental_inputs::write_got_plt): New function.
4445         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4446         Add parameter.  Adjust all callers.
4447         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4448         (Incremental_inputs::got_plt_section): New function.
4449         (Incremental_inputs::got_plt_section_): New data member.
4450         (Incremental_got_plt_reader): New class.
4451         * layout.cc (Layout::create_incremental_info_sections): Add the
4452         incremental_got_plt section.
4453         * object.h (Got_offset_list::get_list): New function.
4454         (Got offset_list::for_all_got_offsets): New function.
4455         (Sized_relobj::local_got_offset_list): New function.
4456         * powerpc.cc (Target_powerpc::got_size): Add const.
4457         (Target_powerpc::got_entry_count): New function.
4458         (Target_powerpc::plt_entry_count): New function.
4459         (Target_powerpc::first_plt_entry_offset): New function.
4460         (Target_powerpc::plt_entry_size): New function.
4461         (Output_data_plt_powerpc::entry_count): New function.
4462         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4463         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4464         * sparc.cc (Target_sparc::got_size): Add const.
4465         (Target_sparc::got_entry_count): New function.
4466         (Target_sparc::plt_entry_count): New function.
4467         (Target_sparc::first_plt_entry_offset): New function.
4468         (Target_sparc::plt_entry_size): New function.
4469         (Output_data_plt_sparc::entry_count): New function.
4470         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4471         (Output_data_plt_sparc::get_plt_entry_size): New function.
4472         * symtab.h (Symbol::got_offset_list): New function.
4473         (Symbol_table::for_all_symbols): New function.
4474         * target.h (Sized_target::got_entry_count): New function.
4475         (Sized_target::plt_entry_count): New function.
4476         (Sized_target::plt_entry_size): New function.
4477         * x86_64.cc (Target_x86_64::got_size): Add const.
4478         (Target_x86_64::got_entry_count): New function.
4479         (Target_x86_64::plt_entry_count): New function.
4480         (Target_x86_64::first_plt_entry_offset): New function.
4481         (Target_x86_64::plt_entry_size): New function.
4482         (Output_data_plt_x86_64::entry_count): New function.
4483         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4484         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4485
4486 2010-08-12  Cary Coutant  <ccoutant@google.com>
4487
4488         * archive.cc: Include incremental.h.
4489         (Archive::Archive): Initialize incremental_info_.
4490         (Archive::include_member): Record archive members in incremental info.
4491         (Add_archive_symbols::run): Record begin and end of an archive in
4492         incremental info.
4493         (Lib_group::include_member): Record objects in incremental info.
4494         * archive.h (Incremental_archive_entry): Forward declaration.
4495         (Archive::set_incremental_info): New member function.
4496         (Archive::incremental_info): New member function.
4497         (Archive::Unused_symbol_iterator): New class.
4498         (Archive::unused_symbols_begin): New member function.
4499         (Archive::unused_symbols_end): New member function.
4500         (Archive::incremental_info_): New data member.
4501         * incremental-dump.cc (find_input_containing_global): New function.
4502         (dump_incremental_inputs): Dump new incremental info sections.
4503         * incremental.cc: Include symtab.h.
4504         (Output_section_incremental_inputs): New class.
4505         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4506         new incremental info sections.
4507         (Sized_incremental_binary::do_check_inputs): Likewise.
4508         (Incremental_inputs::report_archive): Remove.
4509         (Incremental_inputs::report_archive_begin): New function.
4510         (Incremental_inputs::report_archive_end): New function.
4511         (Incremental_inputs::report_object): New function.
4512         (Incremental_inputs::finalize_inputs): Remove.
4513         (Incremental_inputs::report_input_section): New function.
4514         (Incremental_inputs::report_script): Rewrite.
4515         (Incremental_inputs::finalize): Do nothing but finalize string table.
4516         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4517         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4518         (Incremental_inputs::create_data_sections): New function.
4519         (Incremental_inputs::relocs_entsize): New function.
4520         (Output_section_incremental_inputs::set_final_data_size): New function.
4521         (Output_section_incremental_inputs::do_write): New function.
4522         (Output_section_incremental_inputs::write_header): New function.
4523         (Output_section_incremental_inputs::write_input_files): New function.
4524         (Output_section_incremental_inputs::write_info_blocks): New function.
4525         (Output_section_incremental_inputs::write_symtab): New function.
4526         * incremental.h (Incremental_script_entry): Forward declaration.
4527         (Incremental_object_entry): Forward declaration.
4528         (Incremental_archive_entry): Forward declaration.
4529         (Incremental_inputs): Forward declaration.
4530         (Incremental_inputs_header_data): Remove.
4531         (Incremental_inputs_header): Remove.
4532         (Incremental_inputs_header_write): Remove.
4533         (Incremental_inputs_entry_data): Remove.
4534         (Incremental_inputs_entry): Remove.
4535         (Incremental_inputs_entry_write): Remove.
4536         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4537         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4538         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4539         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4540         Likewise.
4541         (Incremental_input_entry): New class.
4542         (Incremental_script_entry): New class.
4543         (Incremental_object_entry): New class.
4544         (Incremental_archive_entry): New class.
4545         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4546         (Incremental_inputs::report_inputs): Remove.
4547         (Incremental_inputs::report_archive): Remove.
4548         (Incremental_inputs::report_archive_begin): New function.
4549         (Incremental_inputs::report_archive_end): New function.
4550         (Incremental_inputs::report_object): Change prototype.
4551         (Incremental_inputs::report_input_section): New function.
4552         (Incremental_inputs::report_script): Change prototype.
4553         (Incremental_inputs::get_reloc_count): New function.
4554         (Incremental_inputs::set_reloc_count): New function.
4555         (Incremental_inputs::create_data_sections): New function.
4556         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4557         (Incremental_inputs::inputs_section): New function.
4558         (Incremental_inputs::symtab_section): New function.
4559         (Incremental_inputs::relocs_section): New function.
4560         (Incremental_inputs::get_stringpool): Add const.
4561         (Incremental_inputs::command_line): Add const.
4562         (Incremental_inputs::inputs): Remove.
4563         (Incremental_inputs::command_line_key): New function.
4564         (Incremental_inputs::input_file_count): New function.
4565         (Incremental_inputs::input_files): New function.
4566         (Incremental_inputs::relocs_entsize): New function.
4567         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4568         (Incremental_inputs::finalize_inputs): Remove.
4569         (Incremental_inputs::Input_info): Remove.
4570         (Incremental_inputs::lock_): Remove.
4571         (Incremental_inputs::inputs_): Change type.
4572         (Incremental_inputs::inputs_map_): Remove.
4573         (Incremental_inputs::current_object_entry_): New data member.
4574         (Incremental_inputs::inputs_section_): New data member.
4575         (Incremental_inputs::symtab_section_): New data member.
4576         (Incremental_inputs::relocs_section_): New data member.
4577         (Incremental_inputs::reloc_count_): New data member.
4578         (Incremental_inputs_reader): New class.
4579         (Incremental_symtab_reader): New class.
4580         (Incremental_relocs_reader): New class.
4581         * layout.cc (Layout::finalize): Move finalization of incremental info
4582         and creation of incremental info sections to follow finalization of
4583         symbol table.  Set offsets for postprocessing sections.
4584         (Layout::create_incremental_info_sections): Call
4585         Incremental_inputs::create_data_sections.  Add incremental symtab
4586         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4587         sections to layout after input sections.
4588         * layout.h (struct Timespec): Forward declaration.
4589         (Layout::incremental_inputs): Add const.
4590         (Layout::create_incremental_info_sections): Add parameter.
4591         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4592         * object.cc: Include incremental.h.
4593         (Relobj::finalize_incremental_relocs): New function.
4594         (Sized_relobj::do_layout): Record input sections in incremental info.
4595         * object.h (Object::output_section): New function.
4596         (Object::output_section_offset): Moved from Relobj.
4597         (Object::get_incremental_reloc_base): New function.
4598         (Object::get_incremental_reloc_count): New function.
4599         (Object::do_output_section): New function.
4600         (Object::do_output_section_offset): Moved from Relobj.
4601         (Object::do_get_incremental_reloc_base): New function.
4602         (Object::do_get_incremental_reloc_count): New function.
4603         (Object::Object): Initialize new data members.
4604         (Relobj::output_section): Renamed do_output_section and moved to
4605         protected.
4606         (Relobj::output_section_offset): Moved to Object.
4607         (Relobj::do_get_incremental_reloc_base): New function.
4608         (Relobj::do_get_incremental_reloc_count): New function.
4609         (Relobj::allocate_incremental_reloc_counts): New function.
4610         (Relobj::count_incremental_reloc): New function.
4611         (Relobj::finalize_incremental_relocs): New function.
4612         (Relobj::next_incremental_reloc_index): New function.
4613         (Relobj::reloc_counts_): New data member.
4614         (Relobj::reloc_bases_): New data member.
4615         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4616         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4617         (Sized_relobj::incremental_relocs_scan): New function.
4618         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4619         (Sized_relobj::incremental_relocs_write): New function.
4620         (Sized_relobj::incremental_relocs_write_reltype): New function.
4621         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4622         incremental link.
4623         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4624         archives and object files elsewhere.
4625         (Add_symbols::run): Report object files here.
4626         (Finish_group::run): Report end of archive at end of group.
4627         * reloc.cc: Include layout.h, incremental.h.
4628         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4629         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4630         (Sized_relobj::incremental_relocs_scan): New function.
4631         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4632         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4633         (Sized_relobj::incremental_relocs_write): New function.
4634         (Sized_relobj::incremental_relocs_write_reltype): New function.
4635         * script.cc (read_input_script): Rewrite test for incremental link.
4636         Change call to Incremental_inputs::report_script.
4637         * symtab.h (Symbol_table::first_global_index): New function.
4638         (Symbol_table::output_count): New function.
4639
4640 2010-08-12  Doug Kwan  <dougkwan@google.com>
4641
4642         * arm.cc (Target_arm::merge_object_attributes): Check command line
4643         options --no-wchar-size-warning and --no-enum-size-warning.
4644         * options.h (General_options): Add ld-compatible options
4645         --no-enum-size-warning and --no-wchar-size-warning.
4646
4647 2010-08-04  Ian Lance Taylor  <iant@google.com>
4648
4649         * x86_64.cc (Target_x86_64::Scan::local): Use
4650         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4651         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4652         (Target_x86_64::Scan::global): Likewise.
4653         (Target_x86_64::Relocate::relocate): Likewise.
4654         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4655         Likewise.
4656
4657 2010-08-03  Cary Coutant  <ccoutant@google.com>
4658
4659         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4660         to reserve space in merged_strings vector. Keep total input size
4661         for stats.
4662         (Output_merge_string::do_print_merge_stats): Print total input size.
4663         * merge.h (Output_merge_string): Add input_size_ field.
4664         * stringpool.cc (Stringpool_template::string_length): Move
4665         implementations out of Stringpool_template class and place in
4666         stringpool.h.
4667         * stringpool.h (string_length): Move out of Stringpool_template.
4668
4669 2010-08-03  Ian Lance Taylor  <iant@google.com>
4670
4671         PR 11712
4672         * layout.cc (relaxation_loop_body): If address of load segment is
4673         set, adjust address to include headers if possible.
4674
4675 2010-08-03  Ian Lance Taylor  <iant@google.com>
4676
4677         * version.cc (version_string): Bump to 1.10.
4678
4679 2010-08-03  Ian Lance Taylor  <iant@google.com>
4680
4681         PR 11805
4682         * layout.h (enum Output_section_order): Define.
4683         (class Layout): Update declarations.
4684         * layout.cc (Layout::get_output_section): Add order parameter.
4685         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4686         is_first_non_relro parameters.  Change all callers.
4687         (Layout::choose_output_section): Likewise.
4688         (Layout::add_output_section_data): Likewise.
4689         (Layout::make_output_section): Likewise.  Set order.
4690         (Layout::default_section_order): New function.
4691         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4692         * output.cc (Output_section::Output_section): Initialize order_.
4693         Don't initialize deleted fields.
4694         (Output_segment::Output_segment): Don't initialize deleted
4695         fields.
4696         (Output_segment::add_output_section_to_load): New function
4697         replacing add_output_section.  Change all callers to call this or
4698         add_output_section_to_nonload.
4699         (Output_segment::add_output_section_to_nonload): New function.
4700         (Output_segment::remove_output_section): Rewrite.
4701         (Output_segment::add_initial_output_data): Likewise.
4702         (Output_segment::has_any_data_sections): Likewise.
4703         (Output_segment::is_first_section_relro): Likewise.
4704         (Output_segment::maximum_alignment): Likewise.
4705         (Output_segment::has_dynamic_reloc): New function replacing
4706         dynamic_reloc_count.  Change all callers.
4707         (Output_segment::has_dynamic_reloc_list): New function replacing
4708         dynamic_reloc_count_list.  Change all callers.
4709         (Output_segment::set_section_addresses): Rewrite.
4710         (Output_segment::set_offset): Rewrite.
4711         (Output_segment::find_first_and_last_list): Remove.
4712         (Output_segment::set_tls_offsets): Rewrite.
4713         (Output_segment::first_section_load_address): Likewise.
4714         (Output_segment::output_section_count): Likewise.
4715         (Output_segment::section_with_lowest_load_address): Likewise.
4716         (Output_segment::write_section_headers): Likewise.
4717         (Output_segment::print_sections_to_map): Likewise.
4718         * output.h (class Output_data): Remove dynamic_reloc_count_
4719         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4720         (Output_data::add_dynamic_reloc): Rewrite.
4721         (Output_data::has_dynamic_reloc): New function.
4722         (Output_data::dynamic_reloc_count): Remove.
4723         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4724         is_last_relro_, is_first_non_relro_, is_interp_,
4725         is_dynamic_linker_section_ fields.  Add order and set_order
4726         functions.  Remove is_relro_local, set_is_relro_local,
4727         is_last_relro, set_is_last_relro, is_first_non_relro,
4728         set_is_first_non_relro functions, is_interp, set_is_interp,
4729         is_dynamic_linker_section, and set_is_dynamic_linker_section
4730         functions.
4731         (class Output_segment): Change Output_data_list from std::list to
4732         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4733         output_bss_ fields.  Update declarations.
4734
4735 2010-08-02  Ian Lance Taylor  <iant@google.com>
4736
4737         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4738         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4739         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4740
4741 2010-08-02  Ian Lance Taylor  <iant@google.com>
4742
4743         PR 11855
4744         * script.cc (Script_options::Script_options): Initialize
4745         symbol_definitions_ and symbol_references_.
4746         (Script_options::add_symbol_assignment): Update
4747         symbol_definitions_ and symbol_references_.
4748         (Script_options::add_symbol_reference): New function.
4749         (script_symbol): New function.
4750         * script.h (class Script_options): Add symbol_definitions_ and
4751         symbol_references_ fields.
4752         (Script_options::referenced_const_iterator): New type.
4753         (Script_options::referenced_begin): New function.
4754         (Script_options::referenced_end): New function.
4755         (Script_options::is_referenced): New function.
4756         (Script_options::any_unreferenced): New function.
4757         * script-c.h (script_symbol): Declare.
4758         * yyscript.y (exp): Call script_symbol.
4759         * symtab.cc: Include "script.h".
4760         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4761         Change all callers.  Check symbols referenced by scripts.
4762         (Symbol_table::add_undefined_symbols_from_command_line): Add
4763         layout parameter.  Change all callers.
4764         (Symbol_table::do_add_undefined_symbols_from_command_line):
4765         Likewise.  Break out loop body.  Check symbols referenced by
4766         scripts.
4767         (Symbol_table::add_undefined_symbol_from_command_line): New
4768         function broken out of
4769         do_add_undefined_symbols_from_command_line.
4770         * symtab.h (class Symbol_table): Update declarations.
4771         * archive.cc: Include "layout.h".
4772         (Archive::should_include_member): Add layout parameter.  Change
4773         all callers.  Check for symbol mentioned in expression.
4774         * archive.h (class Archive): Update declaration.
4775         * object.cc (Sized_relobj::do_should_include_member): Add layout
4776         parameter.
4777         * object.h (Object::should_include_member): Add layout parameter.
4778         Change all callers.
4779         (Object::do_should_include_member): Add layout parameter.
4780         (class Sized_relobj): Update declaration.
4781         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4782         parameter.
4783         * dynobj.h (class Sized_dynobj): Update declaration.
4784         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4785         layout parameter.
4786         * plugin.h (class Sized_pluginobj): Update declaration.
4787
4788 2010-08-02  Ian Lance Taylor  <iant@google.com>
4789
4790         PR 11866
4791         * output.cc (Output_segment::set_offset): Search for the first and
4792         last sections rather than assuming that the list is in order.
4793         (Output_segment::find_first_and_last_list): New function.
4794         * output.h (class Output_segment): Update declarations.
4795         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4796         (relro_strip_test_SOURCES): New variable.
4797         (relro_strip_test_DEPENDENCIES): New variable.
4798         (relro_strip_test_LDFLAGS): New variable.
4799         (relro_strip_test_LDADD): New variable.
4800         (relro_strip_test.so): New target.
4801
4802 2010-08-02  Ian Lance Taylor  <iant@google.com>
4803
4804         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4805         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4806         (Target_i386::got_tlsdesc_section): New function.
4807         (Target_i386::got_section): Create space for GOT entries for
4808         TLSDESC relocations.
4809         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4810         R_386_TLS_GOTDESC.
4811         (Target_i386::Scan::global): Likewise.
4812         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4813         using TLSDESC GOT.
4814         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4815         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4816         (Target_x86_64::got_tlsdesc_section): New function.
4817         (Target_x86_64::got_section): Create space for GOT entries for
4818         TLSDESC relocations.
4819         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4820         R_386_TLS_GOTDESC.
4821         (Target_x86_64::Scan::global): Likewise.
4822         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4823         using TLSDESC GOT.
4824
4825 2010-08-02  Ian Lance Taylor  <iant@google.com>
4826
4827         * testsuite/final_layout.sh: Use dc to convert from hex to
4828         decimal.
4829
4830 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4831
4832         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4833         paramter to the call to gold::gc_process_relocs.
4834         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4835         paramter to the call to gold::gc_process_relocs.
4836         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4837         parameter to the call to gold::gc_process_relocs.
4838         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4839         template parameter to the call to gold::gc_process_relocs.
4840         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4841         paramter to the call to gold::gc_process_relocs.
4842         * gc.h (get_embedded_addend_size): New function.
4843         (gc_process_relocs): Save the size of the reloc for use by ICF.
4844         * icf.cc (get_section_contents): Get the addend from the text section
4845         for SHT_REL relocation sections.
4846         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4847         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4848         * int_encoding.h (read_from_pointer): New overloaded function.
4849         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4850         * testsuite/icf_sht_rel_addend_test.sh: New file.
4851         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4852         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4853
4854 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4855
4856         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4857         * Makefile.in: Regenerate.
4858         * testsuite/Makefile.in: Regenerate.
4859
4860 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4861
4862         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4863         * gold/testsuite/debug_msg.cc: Likewise.
4864         * gold/testsuite/odr_violation1.cc
4865         * gold/testsuite/odr_violation2.cc
4866
4867 2010-07-21  Cary Coutant  <ccoutant@google.com>
4868
4869         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4870         string, and length fields.
4871         (Output_merge_string::Merged_strings_list): New type.
4872         (Output_merge_string::Merged_strings_lists): New typedef.
4873         (Output_merge_string): Replace merged_strings_ with
4874         merged_strings_lists_.
4875         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4876         Merged_strings_list per input object and section.  Don't store pointer
4877         to the string.  Don't store length with each merged string entry.
4878         (Output_merge_string::finalize_merged_data): Loop over list of merged
4879         strings lists.  Recompute length of each merged string.
4880
4881 2010-07-15  Cary Coutant  <ccoutant@google.com>
4882
4883         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4884         here.
4885
4886 2010-07-14  Ian Lance Taylor  <iant@google.com>
4887
4888         * descriptors.cc (Descriptors::open): Report correct name in error
4889         message.
4890
4891 2010-07-13  Doug Kwan  <dougkwan@google.com>
4892
4893         * arm.cc (Arm_input_section::Arm_input_section): For a
4894         SHT_ARM_EXIDX section, always keeps the input sections.
4895         (Arm_input_section::set_exidx_section_link): New method.
4896         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4897         has_errors_ to false.
4898         (Arm_exidx_input_section::has_errors,
4899         Arm_exidx_input_section::set_has_errors): New methods.
4900         (Arm_exidx_input_section::has_errors_): New data member.
4901         (Arm_relobj::get_exidx_shndx_list): New method.
4902         (Arm_output_section::append_text_sections_to_list): Do not skip
4903         section without SHF_EXECINSTR.
4904         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4905         errors.
4906         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4907         section header.  Make error messages more verbose.  Check for
4908         a non-executable section linked to an EXIDX section.
4909         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4910         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4911         check that there is no deferred EXIDX section if we exit early.
4912         Instead of not making an EXIDX section in case of an error, make one
4913         and set the has_errors flag of it.
4914         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4915         in a relocatable link.
4916         (Target_arm::do_relax): Look for the EXIDX output section instead of
4917         assuming that it is called .ARM.exidx.
4918         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4919         section list.  Do not check for SHF_EXECINSTR section flags but
4920         skip any input section with errors.
4921         * output.cc (Output_section::Output_section): Initialize
4922         always_keeps_input_sections_ to false.
4923         (Output_section::add_input_section): Check for
4924         always_keeps_input_sections_.
4925         *  output.h (Output_section::always_keeps_input_sections,
4926         Output_section::set_always_keeps_input_sections): New methods.
4927         (Output_section::always_keeps_input_sections): New data member.
4928
4929 2010-07-13  Rafael Espindola  <espindola@google.com>
4930
4931         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4932         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4933
4934 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4935             Ian Lance Taylor  <iant@google.com>
4936
4937         * output.h (Output_section_lookup_maps::add_merge_section):
4938         Correct check of whether value was inserted.
4939         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4940         (Output_section_lookup_maps::add_relaxed_input_section):
4941         Likewise.
4942         * arm.cc (Target_arm::got_section): Remove used local os.
4943         * i386.cc (Target_i386::got_section): Likewise.
4944         * x86_64.cc (Target_x86_64::got_section): Likewise.
4945         * sparc.cc (Target_sparc::got_section): Likewise.
4946         (Target_sparc::relocate): Remove unused local have_got_offset.
4947         * powerpc.cc (Target_powerpc::relocate): Likewise.
4948
4949 2010-07-13  Ian Lance Taylor  <iant@google.com>
4950
4951         * compressed_output.cc (zlib_decompress): Fix signature in
4952         !HAVE_ZLIB_H case.
4953
4954         * archive.cc (Archive::include_member): Unlock an external member
4955         of a thin archive.  Don't bother to delete an object we know is
4956         NULL.
4957
4958 2010-07-12  Cary Coutant  <ccoutant@google.com>
4959
4960         * compressed_output.cc (zlib_decompress): New function.
4961         (get_uncompressed_size): New function.
4962         (decompress_input_section): New function.
4963         * compressed_output.h (get_uncompressed_size): New function.
4964         (decompress_input_section): New function.
4965         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4966         Handle compressed debug sections.
4967         * layout.cc (is_compressed_debug_section): New function.
4968         (Layout::output_section_name): Map compressed section names to
4969         canonical names.
4970         * layout.h (is_compressed_debug_section): New function.
4971         (is_debug_info_section): Recognize compressed debug sections.
4972         * merge.cc: Include compressed_output.h.
4973         (Output_merge_data::do_add_input_section): Handle compressed
4974         debug sections.
4975         (Output_merge_string::do_add_input_section): Handle compressed
4976         debug sections.
4977         * object.cc: Include compressed_output.h.
4978         (Sized_relobj::Sized_relobj): Initialize new data members.
4979         (build_compressed_section_map): New function.
4980         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4981         * object.h (Object::section_is_compressed): New method.
4982         (Object::do_section_is_compressed): New method.
4983         (Sized_relobj::Compressed_section_map): New type.
4984         (Sized_relobj::do_section_is_compressed): New method.
4985         (Sized_relobj::compressed_sections_): New data member.
4986         * output.cc (Output_section::add_input_section): Handle compressed
4987         debug sections.
4988         * reloc.cc: Include compressed_output.h.
4989         (Sized_relobj::write_sections): Handle compressed debug sections.
4990
4991 2010-07-08  Cary Coutant  <ccoutant@google.com>
4992
4993         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4994         weak when resolving to a dynamic def.
4995         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4996         for weak undef/dynamic def cases. Adjust callers.
4997         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4998         undef_binding_weak_.
4999         (Symbol_table::sized_write_globals): Adjust symbol binding.
5000         (Symbol_table::sized_write_symbol): Add binding parameter.
5001         * symtab.h (Symbol::set_undef_binding): New method.
5002         (Symbol::is_undef_binding_weak): New method.
5003         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5004         (Symbol_table::should_override): Add new parameter.
5005         (Symbol_table::sized_write_symbol): Add new parameter.
5006
5007         * testsuite/weak_undef_file1.cc: Add new test case.
5008         * testsuite/weak_undef_file2.cc: Fix header comment.
5009         * testsuite/weak_undef_test.cc: Add new test case.
5010
5011 2010-06-29  Doug Kwan  <dougkwan@google.com>
5012
5013         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5014         Initialize USE_SYMBOL_.
5015         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5016         definition.
5017         (Arm_reloc_property::uses_symbol_): New data member declaration.
5018         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5019         uses symbol value and symbol is undefined but not weakly undefined.
5020
5021 2010-06-28  Rafael Espindola  <espindola@google.com>
5022
5023         * plugin.cc (Plugin::load): Use dlerror.
5024
5025 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5026
5027         * symtab.cc (detect_odr_violations): When reporting an ODR
5028         violation, report an object where the symbol is defined.
5029
5030 2010-06-25  Doug Kwan  <dougkwan@google.com>
5031
5032         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5033         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5034         definition.
5035         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5036         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5037         target hook to detect function points.
5038         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5039         * icf.h (Icf::check_section_for_function_pointers): Change type of
5040         parameter SECTION_NAME to const reference to std::string.  Use
5041         target hook to determine if section may have unsafe pointers.
5042         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5043         method definition.
5044
5045 2010-06-21  Rafael Espindola  <espindola@google.com>
5046
5047         * fileread.cc (Input_file::find_fie): New
5048         (Input_file::open): Use Input_file::find_fie.
5049         * fileread.h (Input_file::find_fie): New
5050         * plugin.cc (set_extra_library_path): New.
5051         (Plugin::load): Add set_extra_library_path to the transfer vector.
5052         (Plugin_manager::set_extra_library_path): New.
5053         (Plugin_manager::add_input_file): Use the extra search path if set.
5054         (set_extra_library_path(): New.
5055         * plugin.h (Plugin_manager): Add set_extra_library_path and
5056         extra_search_path_.
5057
5058 2010-06-19  Cary Coutant  <ccoutant@google.com>
5059
5060         * layout.cc (gdb_sections): Add .debug_types.
5061         (lines_only_debug_sections): Likewise.
5062
5063 2010-06-18  Rafael Espindola  <espindola@google.com>
5064
5065         * plugin.cc (add_input_file,add_input_library)
5066         (Plugin_manager::add_input_file): Make filename arguments const.
5067         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5068         const.
5069
5070 2010-06-16  Doug Kwan  <dougkwan@google.com>
5071
5072         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5073         .ARM.attributes section if we have not merged any input
5074         attributes sections.
5075
5076 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5077
5078         * arm.cc: Allow combining objects with no EABI version
5079         information.
5080
5081 2010-06-15  Rafael Espindola  <espindola@google.com>
5082
5083         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5084
5085 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5086
5087         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5088         (struct iovec): Correct !HAVE_READV definition.
5089
5090 2010-06-10  Cary Coutant  <ccoutant@google.com>
5091
5092         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5093         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5094         reloc sections.
5095         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5096
5097         PR 11683
5098         * symtab.h (Symbol::is_placeholder): New member function.
5099         * target-reloc.h (relocate_section): Check for placeholder symbols.
5100
5101         * testsuite/Makefile.am (plugin_test_8): New test.
5102         (plugin_test_9): New test.
5103         * testsuite/Makefile.in: Regenerate.
5104
5105 2010-06-09  Nick Clifton  <nickc@redhat.com>
5106
5107         * yyscript.y (input_list_element): Allow strings prefixed with
5108         the '-' character.  Treat these as libraries.
5109         * script.cc (script_add_library): New function.  Adds a library
5110         specified by "-l<name>" found in an input script.
5111         * script-c.h: Add prototype for script_add_library.
5112
5113 2010-06-07  Doug Kwan  <dougkwan@google.com>
5114
5115         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5116         Restrict stub-group size to be within long conditional branch
5117         range when working around cortex-A8 erratum.
5118
5119 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5120
5121         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5122         #ifdef typo.
5123
5124 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5125
5126         PR gold/11658
5127         * output.cc
5128         (Output_section::Input_section_sort_entry::compare_section_ordering):
5129         Change to return non-zero correctly.
5130         (Output_section::Input_section_sort_section_order_index_compare
5131         ::operator()): Change to fix ambiguity in comparisons.
5132
5133 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5134
5135         * gold.h (is_wildcard_string): New function.
5136         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5137         (Layout::layout_eh_frame): Ditto.
5138         (Layout::find_section_order_index): New method.
5139         (Layout::read_layout_from_file): New method.
5140         * layout.h (Layout::find_section_order_index): New method.
5141         (Layout::read_layout_from_file): New method.
5142         (Layout::input_section_position_): New private member.
5143         (Layout::input_section_glob_): New private member.
5144         * main.cc (main): Call read_layout_from_file here.
5145         * options.h (--section-ordering-file): New option.
5146         * output.cc (Output_section::input_section_order_specified_): New
5147         member.
5148         (Output_section::Output_section): Initialize new member.
5149         (Output_section::add_input_section): Add new parameter.
5150         Keep input sections when --section-ordering-file is used.
5151         (Output_section::set_final_data_size): Sort input sections when
5152         section ordering file is specified.
5153         (Output_section::Input_section_sort_entry): Add new parameter.
5154         Check sorting type.
5155         (Output_section::Input_section_sort_entry::compare_section_ordering):
5156         New method.
5157         (Output_section::Input_section_sort_compare::operator()): Change to
5158         consider section_order_index.
5159         (Output_section::Input_section_sort_init_fini_compare::operator()):
5160         Change to consider section_order_index.
5161         (Output_section::Input_section_sort_section_order_index_compare
5162         ::operator()): New method.
5163         (Output_section::sort_attached_input_sections): Change to sort
5164         according to section order when specified.
5165         (Output_section::add_input_section<32, true>): Add new parameter.
5166         (Output_section::add_input_section<64, true>): Add new parameter.
5167         (Output_section::add_input_section<32, false>): Add new parameter.
5168         (Output_section::add_input_section<64, false>): Add new parameter.
5169         * output.h (Output_section::add_input_section): Add new parameter.
5170         (Output_section::input_section_order_specified): New
5171         method.
5172         (Output_section::set_input_section_order_specified): New method.
5173         (Input_section::Input_section): Initialize section_order_index_.
5174         (Input_section::section_order_index): New method.
5175         (Input_section::set_section_order_index): New method.
5176         (Input_section::section_order_index_): New member.
5177         (Input_section::Input_section_sort_section_order_index_compare): New
5178         struct.
5179         (Output_section::input_section_order_specified_): New member.
5180         * script-sections.cc (is_wildcard_string): Delete and move modified
5181         method to gold.h.
5182         (Output_section_element_input::Output_section_element_input): Modify
5183         call to is_wildcard_string.
5184         (Output_section_element_input::Input_section_pattern
5185         ::Input_section_pattern): Ditto.
5186         (Output_section_element_input::Output_section_element_input): Ditto.
5187         * testsuite/Makefile.am (final_layout): New test case.
5188         * testsuite/Makefile.in: Regenerate.
5189         * testsuite/final_layout.cc: New file.
5190         * testsuite/final_layout.sh: New file.
5191
5192 2010-06-01  Rafael Espindola  <espindola@google.com>
5193
5194         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5195
5196 2010-06-01  Rafael Espindola  <espindola@google.com>
5197
5198         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5199         visibility of symbols.
5200
5201 2010-05-27  Doug Kwan  <dougkwan@google.com>
5202
5203         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5204         from start of output section instead of address for a local symbol
5205         in a merged or relaxed section when doing a relocatable link.
5206
5207 2010-05-26  Rafael Espindola  <espindola@google.com>
5208
5209        PR 11604
5210         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5211         adding sections the garbage collector removed.
5212         * gold/testsuite/Makefile.am: Add test.
5213         * gold/testsuite/Makefile.in: Regenerate.
5214         * gold/testsuite/plugin_test_7.sh: New.
5215         * gold/testsuite/plugin_test_7_1.c: New.
5216         * gold/testsuite/plugin_test_7_2.c: New.
5217
5218 2010-05-26  Rafael Espindola  <espindola@google.com>
5219
5220         * script-sections.cc (Output_section_definition::set_section_addresses):
5221         Check for --section-start.
5222
5223 2010-05-26  Doug Kwan  <dougkwan@google.com>
5224
5225         * arm.cc (Arm_scan_relocatable_relocs): New class.
5226         (Target_arm::relocate_special_relocatable): New method.
5227         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5228         (Arm_relocate_functions::thumb_branch_common): Same.
5229         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5230         instead of Default_scan_relocatable_relocs.
5231         * target-reloc.h (relocate_for_relocatable): Let target handle
5232         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5233         * target.h (Sized_target::relocate_special_relocatable): New method.
5234
5235 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5236
5237         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5238
5239 2010-05-23  Doug Kwan  <dougkwan@google.com>
5240
5241         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5242         instead of a cast.
5243         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5244         with a direct branch, not a conditional branch, to a stub.
5245         * merge.cc (Output_merge_base::record_input_section): New method
5246         defintion.
5247         (Output_merge_data::do_add_input_section): Record input section if
5248         keeps-input-sections flag is set.
5249         (Output_merge_string::do_add_input_section): Ditto.
5250         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5251         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5252         INPUT_SECTIONS_.
5253         (Output_merge_base::keeps_input_sections,
5254         Output_merge_base::set_keeps_input_sections,
5255         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5256         method definitions.
5257         (Output_merge_base::Input_sections): New type declaration.
5258         (Output_merge_base::input_sections_begin,
5259         Output_merge_base::input_sections_end,
5260         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5261         (Output_merge_base::bool keeps_input_sections_,
5262         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5263         Output_merge_base::input_sections_): New data members.
5264         (Output_merge_data::do_set_keeps_input_sections): New method
5265         defintion.
5266         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5267         * output.cc (Output_section::Input_section::relobj): Move method
5268         defintion from class declaration to here and handle merge sections.
5269         (Output_section::Input_section::shndx): Ditto.
5270         (Output_section::Output_section): Remove initializations of removed
5271         data members and initialize new data member LOOKUP_MAPS_.
5272         (Output_section::add_input_section): Set keeps-input-sections flag
5273         for a newly created merge output section as appropriate.  Adjust code
5274         to use Output_section_lookup_maps class.
5275         (Output_section::add_relaxed_input_section): Adjst code for lookup
5276         maps code refactoring.
5277         (Output_section::add_merge_input_section): Add a new parameter
5278         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5279         class.  If adding input section to a newly created merge output
5280         section fails, remove the new merge section.
5281         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5282         Adjust code for use of the Output_section_lookup_maps class.
5283         (Output_section::find_merge_section): Ditto.
5284         (Output_section::build_lookup_maps): New method defintion.
5285         (Output_section::find_relaxed_input_section): Adjust code to use
5286         Output_section_lookup_maps class.
5287         (Output_section::get_input_sections): Export merge sections.  Adjust
5288         code to use Output_section_lookup_maps class.
5289         (Output_section:::add_script_input_section): Adjust code to use
5290         Output_section_lookup_maps class.  Update lookup maps for merge
5291         sections also.
5292         (Output_section::discard_states): Use Output_section_lookup_maps.
5293         (Output_section::restore_states): Same.
5294         * output.h (Merge_section_properties): Move class defintion out of
5295         Output_section.
5296         (Output_section_lookup_maps): New class.
5297         (Output_section::Input_section::is_merge_section): New method
5298         defintion.
5299         (Output_section::Input_section::relobj): Move defintion out of class
5300         defintion.  Declare method only.
5301         (Output_section::Input_section::shndx): Ditto.
5302         (Output_section::Input_section::output_merge_base): New method defintion.
5303         (Output_section::Input_section::u2_.pomb): New union field.
5304         (Output_section::Merge_section_by_properties_map,
5305         Output_section::Output_section_data_by_input_section_map,
5306         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5307         Remove types.
5308         (Output_section::add_merge_input_section): Add new parameter
5309         KEEPS_INPUT_SECTIONS.
5310         (Output_section::build_lookup_maps): New method declaration.
5311         (Output_section::merge_section_map_,
5312         Output_section::merge_section_by_properties_map_,
5313         Output_section::relaxed_input_section_map_,
5314         Output_section::is_relaxed_input_section_map_valid_): Remove data
5315         members.
5316         (Output_section::lookup_maps_): New data member.
5317
5318 2010-05-21  Doug Kwan  <dougkwan@google.com>
5319
5320         PR gold/11619
5321         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5322         avoid a compilation error.
5323
5324 2010-05-19  Rafael Espindola  <espindola@google.com>
5325
5326         * script-sections.cc (Output_section_definition::allocate_to_segment):
5327         Update the phdrs_list even when the output section is NULL.
5328         * testsuite/Makefile.am: Add test.
5329         * testsuite/Makefile.in: Regenerate.
5330         * testsuite/script_test_9.cc: New.
5331         * testsuite/script_test_9.sh: New.
5332         * testsuite/script_test_9.t: New.
5333
5334 2010-05-19  Doug Kwan  <dougkwan@google.com>
5335
5336         * arm.cc (Arm_input_section::original_size): New method.
5337         (Arm_input_section::do_addralign): Add a cast.
5338         (Arm_input_section::do_output_offset): Remove static cast.
5339         (Arm_input_section::original_addralign,
5340          Arm_input_section::original_size_): Change type to uint32_t.
5341         (Arm_input_section::init): Add safe casts for section alignment
5342         and size.
5343         (Arm_input_section::set_final_data_size): Do not set address and
5344         offset of stub table.
5345         (Arm_output_section::fix_exidx_coverage): Change use of of
5346         Output_section::Simple_input_section to that of
5347         Output_section::Input_section.
5348         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5349         except for the first pass.
5350         * output.cc (Output_section::get_input_sections): Change type of
5351         input_sections to std::list<Input_section>.
5352         (Output_section::add_script_input_section): Rename from
5353         Output_section::add_simple_input_section.  Change type of SIS
5354         parameter from Simple_input_section to Input_section.
5355         * output.h (Output_section::Simple_input_section): Remove class.
5356         (Output_section::Input_section): Change class visibility to public.
5357         (Output_section::Input_section::addralign): Use stored alignments
5358         for special input sections if set.
5359         (Output_section::Input_section::set_addralign): New method.
5360         (Output_section::get_input_sections): Change parameter type from
5361         list of Simple_input_section to list of Input_section.
5362         (Output_section::add_script_input_section): Rename from
5363         Output_section::add_simple_input_section. Change first parameter's
5364         type from Simple_input_section to Input_section and remove the
5365         second and third parameters.
5366         * script-sections.cc (Input_section::Input_section_list): Change
5367         type to list of Output_section::Input_section/
5368         (Input_section_info::Input_section_info): Change parameter type of
5369         INPUT_SECTION to Output_section::Input_section.
5370         (Input_section_info::input_section): Change return type.
5371         (Input_section_info::input_section_): Change type to
5372         Output_section::Input_section.
5373         (Output_section_element_input::set_section_addresses): Adjust code
5374         to use Output_section::Input_section instead of
5375         Output_section::Simple_input_section.  Adjust code for renaming
5376         of Output_section::add_simple_input_section.
5377         (Orphan_output_section::set_section_addresses): Ditto.
5378
5379 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5380
5381         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5382         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5383
5384 2010-05-18  Rafael Espindola  <espindola@google.com>
5385
5386         * options.cc (General_options::finalize): Handle -nostdlib.
5387         * options.h (nostdlib): New option.
5388         * script.cc (script_add_search_dir): Handle -nostdlib.
5389
5390 2010-05-12  Doug Kwan  <dougkwan@google.com>
5391
5392         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5393         attributes section only if there no attributes section after merging.
5394         (Target_arm::merge_object_attributes): Move value of
5395         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5396         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5397         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5398         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5399         and arm_attr_merge_7.stdout.
5400         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5401         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5402         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5403         arm_attr_merge_7b.o): New rules.
5404         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5405         arm_attr_merge_7
5406         * testsuite/Makefile.in: Regenerate.
5407         * testsuite/arm_attr_merge.sh: New file.
5408         * testsuite/arm_attr_merge_[67][ab].s: Same.
5409
5410 2010-05-05  Nick Clifton  <nickc@redhat.com>
5411
5412         * po/es.po: Updated Spanish translation.
5413
5414 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5415
5416         * Makefile.am (install-exec-local): Properly install gold as
5417         default cross linker.
5418         * Makefile.in: Regenerated.
5419
5420 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5421             Nick Clifton  <nickc@redhat.com>
5422
5423         * configure.ac (install_as_default): Define and set to false
5424         unless --enable-gold or --enable-gold=both/gold has been
5425         specified.
5426         * configure: Regenerate.
5427
5428         * Makefile.am (install-exec-local): Install the executable as
5429         'ld.gold'.  If install_as_default is true then also install it as
5430         'ld'.
5431         * Makefile.in: Regenerated.
5432
5433 2010-04-24  Ian Lance Taylor  <iant@google.com>
5434
5435         * layout.cc (Layout::layout_reloc): In relocatable link don't
5436         combine reloc sections for grouped sections.
5437
5438 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5439
5440         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5441         sections that are not ordinary to icf.
5442         * icf.cc (get_section_contents): Handle relocation pointing to section
5443         with no object or shndx information.
5444         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5445         * testsuite/Makefile.in: Regenerate.
5446         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5447         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5448
5449 2010-04-22  Ian Lance Taylor  <iant@google.com>
5450
5451         * expression.cc (Expression::Expression_eval_info): Add
5452         result_alignment_pointer field.
5453         (Expression::eval_with_dot): Add result_alignment_pointer
5454         parameter.  Change all callers.
5455         (Expression::eval_maybe_dot): Likewise.
5456         (class Binary_expression): Add alignment_pointer parameter to
5457         left_value and right_value.  Change all callers.
5458         (BINARY_EXPRESSION): Set result alignment.
5459         (class Trinary_expression): Add alignment_pointer parameter to
5460         arg2_value and arg3_value.  Change all callers.
5461         (Trinary_cond::value): Set result alignment.
5462         (Max_expression::value, Min_expression::value): Likewise.
5463         (Align_expression::value): Likewise.
5464         * script-sections.cc (class Sections_element): Add dot_alignment
5465         parameter to set_section_addresses virtual function.  Update
5466         instantiations.
5467         (class Output_section_element): Likewise.
5468         (Script_sections::create_segments): Add dot_alignment parameter.
5469         Change all callers.
5470         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5471         (Script_sections::set_phdrs_clause_addresses): Likewise.
5472         * script-sections.h: Update declarations.
5473         * script.h: Update declarations.
5474         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5475         min_p_align.
5476         * testsuite/script_test_3.t: Set large alignment.
5477         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5478         segment has expected alignment.
5479
5480 2010-04-22  Nick Clifton  <nickc@redhat.com>
5481
5482         * po/gold.pot: Updated by the Translation project.
5483         * po/vi.po: Updated Vietnamese translation.
5484
5485 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5486
5487         * testsuite/Makefile.am (check_PROGRAMS): Add
5488         icf_virtual_function_folding_test.
5489         * testsuite/Makefile.in: Regenerated.
5490
5491 2010-04-15  Andrew Haley  <aph@redhat.com>
5492
5493         * options.h (merge_exidx_entries): New option.
5494         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5495         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5496         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5497         (Target_arm::merge_exidx_entries): New function.
5498         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5499         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5500         to Arm_exidx_fixup constructor.
5501         Add new arg, merge_exidx_entries.
5502         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5503         Arm_output_section::fix_exidx_coverage.
5504
5505 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5506
5507         * icf.cc (get_section_contents): Check for preemptible functions.
5508         Ignore addend when appropriate.
5509         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5510         section folded.
5511         (add_from_relobj): Check for section folded.
5512         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5513         * symtab.h (should_add_dynsym_entry): Add new parameter.
5514         * target-reloc.h (scan_relocs): Check for section folded.
5515         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5516         Check reloc types for function pointers in shared objects.
5517         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5518         case.
5519         (icf_preemptible_functions_test): New test case.
5520         (icf_string_merge_test): New test case.
5521         * testsuite.Makefile.in: Regenerate.
5522         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5523         bar_glob.  Refactor code.
5524         * testsuite/icf_preemptible_functions_test.cc: New file.
5525         * testsuite/icf_preemptible_functions_test.sh: New file.
5526         * testsuite/icf_string_merge_test.cc: New file.
5527         * testsuite/icf_string_merge_test.sh: New file.
5528         * testsuite/icf_virtual_function_folding_test.cc: New file.
5529         * testsuite/icf_virtual_function_folding_test.sh: New file.
5530
5531 2010-04-14  Doug Kwan  <dougkwan@google.com>
5532
5533         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5534         for local symbol recounting if we remove a section due to ICF.
5535         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5536         there are no regular objects in input.
5537
5538 2010-04-13  Doug Kwan  <dougkwan@google.com>
5539
5540         * arm.cc (Arm_input_section::set_final_data_size): Compute
5541         accurate final data size instead of using current data size.
5542
5543 2010-04-09  Doug Kwan  <dougkwan@google.com>
5544
5545         * layout.cc (Layout::choose_output_section): Handle script section
5546         types.
5547         (Layout::make_output_section_for_script): Add section type parameter.
5548         Handle script section types.
5549         * layout.h (Layout::make_output_section_for_script): Add section
5550         type parameter.
5551         * output.cc (Output_section::Output_section): Initialize data member
5552         is_noload_.
5553         (Output_section::do_reset_address_and_file_offset): Do not set address
5554         to 0 if section is a NOLOAD section.
5555         * output.h (Output_section::is_noload): New method.
5556         (Output_section::set_is_noload): Ditto.
5557         (Output_section::is_noload_): New data member.
5558         * script-c.h (Script_section_type): New enum type.
5559         (struct Parser_output_section_header): Add new file section_type.
5560         * script-sections.cc (Sections_element::output_section_name): Add
5561         parameter for returning script section type.
5562         (Output_section_definition::output_section_name): Ditto.
5563         (Output_section_definition::section_type)P; New method.
5564         (Output_section_definiton::script_section_type_name): Ditto.
5565         (Output_section_definition::script_section_type_): New data member.
5566         (Output_section_definition::Output_section_definition): Initialize
5567         data member Output_section_definition::script_section_type_.
5568         (Output_section_definition::create_sections): Pass script section type
5569         to Layout::make_output_section_for_script.
5570         (Output_section_definition::output_section_name): Return script
5571         section type to caller.
5572         (Output_section_definition::set_section_address): Do not advance
5573         dot value and load address if section type is NOLOAD.  Set address
5574         of NOLOAD sections regardless of section flags.
5575         (Output_section_definition::print): Print section type if it is
5576         not SCRIPT_SECTION_TYPE_NONE.
5577         (Output_section_definition::section_type): New method.
5578         (Output_section_definition::script_section_type_name): Ditto.
5579         (Script_sections::output_section_name): Add new parameter
5580         PSECTION_TYPE for returning script section type.  Pass it to
5581         section elements.  Handle discard sections.
5582         (Sort_output_sections::operator()): Handle NOLOAD sections.
5583         * script-sections.h (Script_sections::Section_type): New enum type.
5584         (Script_sections::output_section_name): Add a new parameter for
5585         returning script section type.
5586         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5587         INFO and NOLOAD.
5588         * yyscript.y (union): Add new field SECTION_TYPE.
5589         (COPY, DSECT, INFO, NOLOAD): New tokens.
5590         (opt_address_and_section_type): Change type to output_section_header.
5591         (section_type): New non-terminal
5592         (section_header): Handle section type.
5593         (opt_address_and_section_type): Return section type value.
5594
5595 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5596
5597         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5598         * testsuite/plugin_common_test_2.c (foo): Likewise.
5599
5600 2010-04-08  Doug Kwan  <dougkwan@google.com>
5601
5602         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5603         Output_merge_data.
5604         * output.cc (Output_section::add_merge_input_section): Simplify
5605         code and return status of Output_merge_base::add_input_section.
5606         Update merge section map only if Output_merge_base::add_input_section
5607         returns true.
5608
5609 2010-04-07  Doug Kwan  <dougkwan@google.com>
5610
5611         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5612         if section is marked as containing instructions but has no mapping
5613         symbols.
5614         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5615         correct section index.
5616         (Arm_relobj::find_linked_text_section): Ditto.
5617
5618 2010-04-07  Cary Coutant  <ccoutant@google.com>
5619
5620         * archive.cc (include_member): Destroy Read_symbols_data object before
5621         releasing file.
5622         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5623         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5624         (Read_symbols_data::~Read_symbols_data) New destructor.
5625         (Section_relocs::Section_relocs) New constructor.
5626         (Section_relocs::~Section_relocs) New destructor.
5627         (Read_relocs_data::Read_relocs_data) New constructor.
5628         (Read_relocs_data::~Read_relocs_data) New destructor.
5629         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5630         pointers to NULL after deleting.
5631
5632 2010-04-07  Doug Kwan  <dougkwan@google.com>
5633
5634         * arm.cc: Replace "endianity" with "endianness" in comments.
5635         (Arm_exidx_cantunwind): Ditto.
5636         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5637         (Arm_relobj::merge_flags_and_attributes): New method.
5638         (Arm_relobj::merge_flags_and_attributes_): New data member.
5639         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5640         (Arm_relobj::scan_sections_for_stubs): Ditto.
5641         (Arm_relobj::do_read_symbols): Check to see if we really want to
5642         merge processor-specific flags and attributes.  Exit early if
5643         an object is empty except for section names and the undefined symbol.
5644         (Target_arm::do_finalize_sections): Move check for ELF format to
5645         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5646         attributes from a regular object only when we have determined that
5647         it is aapropriate.  Do not create an .ARM.attributes section in
5648         output if there is no regular input object.
5649         (Target_arm::merge_processor_specific_flags): Check
5650         --warn-mismatch before printing any error.
5651         (Target_arm::merge_object_attributes): Ditto.
5652         * gold.cc (queue_middle_tasks): Handle the case in which there is
5653         no regular object in input.
5654         * options.cc (General_options::parse_EB): New method.
5655         (General_options::parse_EL): Same.
5656         (General_options::General_options): Initialize endianness_.
5657         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5658         New options.
5659         (General_options::Endianness): New enum.
5660         (General_options::endianness): New method.
5661         (General_options::endianness_): New data member.
5662         * parameters.cc (Parameters::set_options): Check target endianness.
5663         (Parameters::set_target_once): Ditto.
5664         (Parameters::check_target_endianness): New method.
5665         (parameters_force_valid_target): If either -EL or -EB is specified,
5666         use it to define endianness of default target.
5667         * parameters.h (Parameters::check_target_endianness): New method
5668         declaration.
5669         * target.h (class Target): Change "endianity" to "endianness"
5670         in comments.
5671
5672 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5673
5674         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5675         * configure: Regenerate.
5676         * Makefile.in: Regenerate.
5677         * testsuite/Makefile.in: Regenerate.
5678
5679 2010-04-06  Cary Coutant  <ccoutant@google.com>
5680
5681         gcc PR lto/42757
5682         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5683         prevailing definitions of common symbols.
5684         * testsuite/plugin_test_6.sh: New test case.
5685         * testsuite/plugin_common_test_1.c: New test case.
5686         * testsuite/plugin_common_test_2.c: New test case.
5687         * testsuite/Makefile.am (plugin_test_6): New test case.
5688         * testsuite/Makefile.in: Regenerate.
5689
5690 2010-04-06  Nick Clifton  <nickc@redhat.com>
5691
5692         * po/vi.po: New Vietnamese translation.
5693
5694 2010-03-30  Doug Kwan  <dougkwan@google.com>
5695
5696         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5697
5698 2010-03-25  Doug Kwan  <dougkwan@google.com>
5699
5700         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5701         to avoid a conversion warning on a 32-bit host.
5702
5703 2010-03-24  Ian Lance Taylor  <iant@google.com>
5704
5705         * testsuite/script_test_3.t: Add a TLS segment.
5706         * testsuite/Makefile.am (check_PROGRAMS): Add
5707         tls_phdrs_script_test.
5708         (tls_phdrs_script_test_SOURCES): Define.
5709         (tls_phdrs_script_test_DEPENDENCIES): Define.
5710         (tls_phdrs_script_test_LDFLAGS): Define.
5711         (tls_phdrs_script_test_LDADD): Define.
5712         * testsuite/Makefile.in: Rebuild.
5713
5714 2010-03-23  Cary Coutant  <ccoutant@google.com>
5715
5716         * fileread.cc (find_or_make_view): Fix comment.
5717
5718 2010-03-23  Ian Lance Taylor  <iant@google.com>
5719
5720         * script-sections.cc (class Orphan_section_placement): Define
5721         PLACE_TLS and PLACE_TLS_BSS.
5722         (Orphan_section_placement::Orphan_section_placement): Initialize
5723         new places.
5724         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5725         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5726         (tls_script_test_SOURCES): Define.
5727         (tls_script_test_DEPENDENCIES): Define.
5728         (tls_script_test_LDFLAGS): Define.
5729         (tls_script_test_LDADD): Define.
5730         * testsuite/Makefile.in: Rebuild.
5731
5732 2010-03-22  Doug Kwan  <dougkwan@google.com>
5733
5734         * arm.cc (Arm_relocate_functions::abs8,
5735         Arm_relocate_functions::abs16): Use correct check for overflow
5736         specified in the ARM ELF specs.
5737         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5738         target of a BLX instruction specially.
5739         (Reloc_stub::stub_type_for_reloc): Ditto.
5740         (Relocate::relocate): Use symbolic names instead of numeric relocation
5741         codes to report error.
5742         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5743         workaround.
5744         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5745         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5746         thumb2_blx_out_of_range.stdout
5747         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5748         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5749         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5750         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5751         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5752         thumb2_blx_in_range, thumb2_blx_in_range.o,
5753         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5754         thumb2_blx_out_of_range.o): New rules.
5755         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5756         thumb2_blx_in_range and thumb2_blx_out_of_range.
5757         * testsuite/Makefile.in: Regenerate.
5758         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5759         * testsuite/thumb_blx_in_range.s: New file.
5760         * testsuite/thumb_blx_out_of_range.s: New file.
5761
5762 2010-03-22  Rafael Espindola  <espindola@google.com>
5763
5764         * archive.cc (Should_include): Move to archive.h.
5765         (should_include_member): Make it a member of Archive.
5766         (Lib_group): New.
5767         (Add_lib_group_symbols): New.
5768         * archive.h: Include options.h.
5769         (Archive_member): Moved from Archive.
5770         (Should_include): Moved from archive.cc.
5771         (Lib_group): New.
5772         (Add_lib_group_symbols): New.
5773         * dynobj.cc (do_should_include_member): New.
5774         * dynobj.h (do_should_include_member): New.
5775         * gold.cc (queue_initial_tasks): Update call to queue.
5776         * main.cc (main): Print lib group stats.
5777         * object.cc (do_should_include_member): New.
5778         * object.h: Include archive.h.
5779         (Object::should_include_member): New.
5780         (Object::do_should_include_member): New.
5781         (Sized_relobj::do_should_include_member): New.
5782         * options.cc (General_options::parse_start_lib): New.
5783         (General_options::parse_end_lib): New.
5784         (Input_arguments::add_file): Handle lib groups.
5785         (Input_arguments::start_group): Check we are not in a lib.
5786         (Input_arguments::start_lib): New.
5787         (Input_arguments::end_lib): New.
5788         * options.h (General_options): Add start_lib and end_lib.
5789         (Input_argument::lib_): New.
5790         (Input_argument::lib): New.
5791         (Input_argument::is_lib): New.
5792         (Input_file_lib): New.
5793         (Input_arguments::in_lib_): New.
5794         (Input_arguments::in_lib): New.
5795         (Input_arguments::start_lib): New.
5796         (Input_arguments::end_lib_): New.
5797         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5798         in unused members as preempted.
5799         (Sized_pluginobj::do_should_include_member): New.
5800         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5801         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5802         return the blocker.
5803         (Read_symbols::do_whole_lib_group): New.
5804         (Read_symbols::do_lib_group): New.
5805         (Read_symbols::do_read_symbols): Handle lib groups.
5806         (Read_symbols::get_name): Handle lib groups.
5807         * readsyms.h (Read_symbols): Add an archive member pointer.
5808         (Read_symbols::do_whole_lib_group): New.
5809         (Read_symbols::do_lib_group): New.
5810         (Read_symbols::member_): New.
5811         * script.cc (read_input_script): Update call to queue_soon.
5812
5813 2010-03-19  Doug Kwan  <dougkwan@google.com>
5814
5815         * arm.cc (Stub_table::Stub_table): Initialize new data members
5816         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5817         (Stub_table::add_reloc_stub): Assign stub offset and update
5818         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5819         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5820         New data members.
5821         (Stub_table::update_data_size_and_addralign): Use
5822         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5823         instead of going over all reloc stubs.
5824         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5825         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5826         Stringpool_template::offset_ to size of Stringpool_char.
5827         (Stringpool_template::new_key_offset): Remove code to initialize
5828         Stringpool_template::offset_.
5829         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5830         Stringpool_template::offset_ to zero.
5831
5832 2010-03-15  Doug Kwan  <dougkwan@google.com>
5833
5834         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5835         offset_.
5836         (Stringpool_template::new_key_offset): New method.
5837         (Stringpool_template::add_string): Assign offsets when adding new
5838         strings.
5839         (Stringpool_template::set_string_offsets): Do not set string offsets
5840         when not optimizing.
5841         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5842         member size_.
5843         (Chunked_vector::clear): Clear size_.
5844         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5845         (Chunked_vector::size): Return size_.
5846         (Chunked_vector::push_back): Use size_ to find insert position.
5847         (Chunked_vector::size_): New data member.
5848         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5849         (Stringpool_template::new_key_offset): New method declaration.
5850         (Stringpool_template::offset_): New data member.
5851
5852 2010-03-15   Rafael Espindola  <espindola@google.com>
5853
5854         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5855         Add_symbols' constructor.
5856         * readsyms.h (Add_symbols): Remove the input_group member.
5857
5858 2010-03-10  Ian Lance Taylor  <iant@google.com>
5859
5860         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5861         target to ask whether a reference to a symbol requires a stack
5862         split.
5863         * target.h (Target::is_call_to_non_split): New function.
5864         (Target::do_is_call_to_non_split): Declare virtual function.
5865         * target.cc: Include "symtab.h".
5866         (Target::do_is_call_to_non_split): New function.
5867         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5868
5869 2010-03-10  Cary Coutant  <ccoutant@google.com>
5870
5871         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5872         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5873         (File_read::open[2]): Add whole_file_view_ to list of views.
5874         (File_read::make_view): Remove test of whole_file_view_.
5875         (File_read::find_or_make_view): Create whole_file_view_ if
5876         necessary.
5877         (File_read::clear_views): Replace bool parameter with enum;
5878         adjust all callers.  Don't delete views with permanent data;
5879         do delete cached views and views from archives if
5880         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5881         if clearing the corresponding view.
5882         * fileread.h (File_read::Clear_views_mode): New enum.
5883         (File_read::View::is_permanent_view): New method.
5884         (File_read::clear_views): Replace bool parameter
5885         with enum; adjust all callers.
5886         * options.h (General_options): Change keep_files_mapped option;
5887         add map_whole_files.
5888         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5889         releasing the file.
5890         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5891         the file.
5892
5893 2010-03-10  David S. Miller  <davem@davemloft.net>
5894
5895         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5896
5897 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5898
5899         * icf.cc (get_section_contents): Add '@' marker after processing the
5900         merge reloc.
5901
5902 2010-03-08  Doug Kwan  <dougkwan@google.com>
5903
5904         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5905         due to a conversion warning.
5906         (Arm_relobj::update_output_local_symbol_count): Check for local
5907         symbol with unset output index.
5908
5909 2010-03-05  Ian Lance Taylor  <iant@google.com>
5910
5911         * options.h (class General_options): Add --spare-dynamic-tags.
5912         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5913         --spare-dynamic-tags.
5914
5915 2010-03-05  Ian Lance Taylor  <iant@google.com>
5916
5917         * incremental.cc: Include "libiberty.h".
5918
5919 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5920
5921         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5922         function, is_info_ member.
5923         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5924         (Versions::Versions): Update caller.
5925         (Versions::define_base_version): Likewise.
5926         (Versions::add_def): Likewise.
5927
5928 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5929
5930         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5931         (Scan::possible_function_pointer_reloc): New function.
5932         (Scan::local_reloc_may_be_function_pointer): Change to call
5933         possible_function_pointer_reloc.
5934         (Scan::global_reloc_may_be_function_pointer): Ditto.
5935         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5936         relocations in ".data.rel.ro._ZTV" section.
5937         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5938         * testsuite/icf_safe_so_test.cc: Ditto.
5939         * testsuite/icf_safe_test.cc: Ditto.
5940         * testsuite/icf_safe_test.sh: Ditto.
5941
5942 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5943             Ian Lance Taylor  <iant@google.com>
5944
5945         * target-reloc.h (relocate_section): Check the symbol table index
5946         for -1U before setting the local symbol index.
5947         (scan_relocatable_relocs): If copying the relocation, record that
5948         the local symbol is required.
5949         * object.h (Symbol_value::is_output_symtab_index_set): New
5950         function.
5951         (Symbol_value::may_be_discarded_from_output_symtab): New
5952         function.
5953         (Symbol_value::has_output_symtab_entry): New function.
5954         (Symbol_value::needs_output_symtab_entry): Remove.
5955         (Symbol_value::output_symtab_index): Make sure the symbol index is
5956         set.
5957         (Symbol_value::set_output_symtab_index): Make sure the symbol
5958         index is not set.  Make sure the new index is valid.
5959         (Symbol_value::set_must_have_output_symtab_entry): New function.
5960         (Symbol_value::has_output_dynsym_entry): New function.
5961         (Symbol_value::set_output_dynsym_index): Make sure the new index
5962         is valid.
5963         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5964         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5965         local symbol if permitted.
5966         (Sized_relobj::do_finalize_local_symbols): Call
5967         is_output_symtab_index_set rather than needs_output_symtab_entry.
5968         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5969         rather than needs_output_symtab_entry.  Call
5970         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5971         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5972         is_output_symtab_index_set rather than needs_output_symtab_entry.
5973         * testsuite/discard_locals_relocatable_test.c: New file.
5974         * testsuite/discard_locals_test.sh: Test -r.
5975         * testsuite/Makefile.am (check_DATA): Add
5976         discard_locals_relocatable_test1.syms,
5977         discard_local_relocatable_test2.syms.
5978         (MOSTLYCLEANFILES): Likewise.  Also add
5979         discard_locals_relocatable_test1.lout and
5980         discard_locals_relocatable_test2.out.
5981         (discard_locals_relocatable_test1.syms): New target.
5982         (discard_locals_relocatable_test.o): New target.
5983         (discard_locals_relocatable_test1.out): New target.
5984         (discard_locals_relocatable_test2.syms): New target.
5985         (discard_locals_relocatable_test2.out): New target.
5986         (various): Add missing ../ld-new dependencies.
5987         * testsuite/Makefile.in: Rebuild.
5988
5989 2010-03-03  Nick Clifton  <nickc@redhat.com>
5990
5991         * po/fi.po: New Finnish translation.
5992
5993 2010-03-01  Doug Kwan  <dougkwan@google.com>
5994
5995         * layout.cc (Layout::Layout): Force section types of .init_array*,
5996         .preinit_array* and .fini_array* sections.
5997         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5998         Fix check of return value of std::string::find.().
5999         (Output_section::Input_section_sort_compare::operator()): Remove
6000         comment about .init_array.
6001         (Output_section::Input_section_sort_init_fini_compare::operator()):
6002         New method.
6003         (Output_section::sort_attached_input_sections): Handle .init_array
6004         and .fini_array specially.
6005         * output.h (Output_section::Inut_section_sort_compare): Update
6006         comment.
6007         (Output_section::Input_section_sort_init_fini_compare): New struct.
6008
6009 2010-02-26  Doug Kwan  <dougkwan@google.com>
6010
6011         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6012         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6013         * testsuite/debug_msg.sh: Avoid matching source line number for
6014         use of global variable undef_int.
6015
6016 2010-02-26  Doug Kwan  <dougkwan@google.com>
6017
6018         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6019         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6020         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6021         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6022         * options.cc (General_options::General_options): Initialize member
6023         fix_v4bx_.
6024         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6025         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6026         and rm_no_fix_v4bx.stdout
6027         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6028         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6029         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6030         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6031         and arm_no_fix_v4bx.
6032         * Makefile.in: Regenerate.
6033         * testsuite/arm_fix_v4bx.s: New file.
6034         * testsuite/arm_fix_v4bx.sh: Ditto.
6035
6036 2010-02-24  Doug Kwan  <dougkwan@google.com>
6037
6038         * arm.cc (Target_arm::got_section): Make the .got section the first
6039         non RELRO section in the data segment.
6040         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6041         suffixes of section names.
6042
6043 2010-02-24  Doug Kwan  <dougkwan@google.com>
6044
6045         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6046         flags and attributes merging if an input file is a binary file.
6047         * fileread.cc (Input_file::open): Record format of original file.
6048         * fileread.h (Input_file::Format): New enum type.
6049         (Input_file::Input_file): Initialize data member format_.
6050         (Input_file::format): New method definition.
6051         (Input_file::format_):: New data member.
6052
6053 2010-02-24  Doug Kwan  <dougkwan@google.com>
6054
6055         * arm.cc (Arm_output_data_got): New class.
6056         (ARM_TCB_SIZE): New constant
6057         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6058         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6059         If user uses a script with a SECTIONS clause, issue only a warning
6060         for a misplaced EXIDX input section.  Otherwise, issue an error.
6061         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6062         garbage collection.
6063         (Target_arm::got_mode_index_entry): Handle static linking.
6064         (Target_arm::Scan::local): Ditto.
6065         (Target_arm::Scan::global): Ditto.
6066         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6067         all incorrectly implemented relocations.
6068         (Target_arm::fix_exidx_coverage): Pass layout to
6069         Arm_output_section::fix_exidx_coverage.
6070         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6071         from ".ARM.exidx." and ".ARM.extab.".
6072
6073 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6074
6075         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6076         section if it does not already exist.
6077         * attributes.cc (Attributes_section_data::Attributes_section_data):
6078         Don't crash if size is zero.
6079
6080 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6081             Ian Lance Taylor  <iant@google.com>
6082
6083         * gold.cc (queue_middle_tasks): If no input files were opened,
6084         exit.
6085         * workqueue.h (Task_function::Task_function): Assert that there is
6086         a blocker.
6087
6088 2010-02-22  Doug Kwan  <dougkwan@google.com>
6089
6090         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6091         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6092         types to avoid warnings due to different uint64_t implementations
6093         on different hosts.
6094
6095 2010-02-21  Doug Kwan  <dougkwan@google.com>
6096
6097         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6098         handling of the maximum backward branch offset.
6099         (Arm_relocate_functions::thumb_branch_common): Ditto.
6100         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6101         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6102         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6103         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6104         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6105         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6106         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6107         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6108         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6109         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6110         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6111         thumb2_bl_out_of_range.o): New rules.
6112         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6113         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6114         thumb2_bl_out_of_range
6115         * testsuite/Makefile.in: Regenerate.
6116         * testsuite/arm_bl_in_range.s: New file.
6117         * testsuite/arm_bl_out_of_range.s: Ditto.
6118         * testsuite/arm_branch_in_range.sh: Ditto.
6119         * testsuite/arm_branch_range.t: Ditto.
6120         * testsuite/thumb2_branch_range.t: Ditto.
6121         * testsuite/thumb_bl_in_range.s: Ditto.
6122         * testsuite/thumb_bl_out_of_range.s: Ditto.
6123         * testsuite/thumb_branch_range.t: Ditto.
6124
6125 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6126
6127         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6128         Add reloc offset information.
6129         * icf.cc (get_section_contents): Change iterators to point to the new
6130         vectors. Add reloc offset information to the contents.
6131         * icf.h (Icf::Sections_reachable_info): New typedef.
6132         (Icf::Sections_reachable_list): New typedef.
6133         (Icf::Offset_info): New typedef.
6134         (Icf::Reloc_info): New struct typedef.
6135         (Icf::Reloc_info_list): New typedef.
6136         (Icf::symbol_reloc_list): Delete method.
6137         (Icf::addend_reloc_list): Delete method.
6138         (Icf::section_reloc_list): Delete method.
6139         (Icf::reloc_info_list): New method.
6140         (Icf::reloc_info_list_): New member.
6141
6142 2010-02-19  Doug Kwan  <dougkwan@google.com>
6143
6144         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6145         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6146         * arm.cc (Arm_relocation_functions): New forward declaration.
6147         (Target_arm::Target_arm): Initialize new data members
6148         got_mod_index_offset_ and tls_base_symbol_defined_.
6149         (Target_arm::Relocate::relocate_tls): New method.
6150         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6151          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6152         New methods.
6153         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6154         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6155         (Target_arm::got_mod_index_offset_,
6156         Target_arm::tls_base_symbol_defined_): New data members.
6157         (Target_arm::Scan::local, Target::Scan::global,
6158         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6159         relocations.
6160
6161 2010-02-18  Doug Kwan  <dougkwan@google.com>
6162
6163         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6164         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6165         text section as a parameter becuase some broken tools may not set
6166         the link in section header.
6167         (Target_arm::has_got_section): New method.
6168         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6169         without any mapping symbol as data only.  Remove warning.
6170         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6171         link in its section header, try to discover the link by inspecting the
6172         REL31 relocation at the beginning of the section.
6173         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6174         in error message.
6175         (Target_arm::Scan::global): Treat any reference to the symbol
6176         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6177
6178 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6179
6180         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6181         (Scan::global_reloc_may_be_function_pointer): New function.
6182         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6183         (Scan::global_reloc_may_be_function_pointer): New function.
6184         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6185         (Scan::global_reloc_may_be_function_pointer): New function.
6186         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6187         (Scan::global_reloc_may_be_function_pointer): New function.
6188         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6189         (Scan::global_reloc_may_be_function_pointer): New function.
6190         (Scan::possible_function_pointer_reloc): New function.
6191         (Target_x86_64::can_check_for_function_pointers): New function.
6192         * gc.h (gc_process_relocs): Scan relocation types to determine if
6193         function pointers were taken for targets that support it.
6194         * icf.cc (Icf::find_identical_sections): Include functions for
6195         folding in safe ICF whose pointer is not taken.
6196         * icf.h (Secn_fptr_taken_set): New typedef.
6197         (fptr_section_id_): New member.
6198         (section_has_function_pointers): New function.
6199         (set_section_has_function_pointers): New function.
6200         (check_section_for_function_pointers): New function.
6201         * options.h: Fix comment for safe ICF option.
6202         * target.h (can_check_for_function_pointers): New function.
6203         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6204         Modify icf_safe_test for X86-64.
6205         * testsuite/Makefile.in: Regenerate.
6206         * testsuite/icf_safe_so_test.cc: New file.
6207         * testsuite/icf_safe_so_test.sh: New file.
6208         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6209         (main): Change to take pointer to function kept_func_3.
6210         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6211         folding is done correctly for X86-64.
6212
6213 2010-02-12  David S. Miller  <davem@davemloft.net>
6214
6215         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6216         is_symbolless parameter.
6217         (Output_reloc<SHT_REL>::is_symbolless): New.
6218         (Output_reloc<SHT_REL>::is_symbolless_): New.
6219         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6220         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6221         (Output_reloc<SHT_RELA>::is_symbolless): New.
6222         (Output_data_reloc::add_global): Handle is_symbolless.
6223         (Output_data_reloc::add_global_relative): Likewise.
6224         (Output_data_reloc::add_local): Likewise.
6225         (Output_data_reloc::add_local_relative): Likewise.
6226         (Output_data_reloc::add_symbolless_global_addend): New.
6227         (Output_data_reloc::add_symbolless_local_addend): New.
6228         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6229         is_symbolless.
6230         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6231         instead of ->is_relative_
6232         (Output_reloc::write): Likewise.
6233         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6234         (Output_reloc::write_rel): Simplify.
6235
6236         * sparc.cc (Target_sparc::Scan::local): Use
6237         ->add_symbolless_local_addend as needed.
6238         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6239         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6240         based upon relocation offset.
6241
6242 2010-02-11  Doug Kwan  <dougkwan@google.com>
6243
6244         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6245         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6246         beginning of function.
6247         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6248         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6249         parameter is_32bit in calls to should_apply_static_reloc.
6250         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6251         (check_DATA): Add arm_abs_global.stdout.
6252         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6253         arm_abs_global.stdout): New rules.
6254         (MOSTLLYCLEANFILES): Add arm_abs_global
6255         * Makefile.in: Regenerate.
6256         * testsuite/arm_abs_global.s: New file.
6257         * testsuite/arm_abs_global.sh: Ditto.
6258         * testsuite/arm_abs_lib.s: Ditto.
6259
6260 2010-02-11  Ian Lance Taylor  <iant@google.com>
6261
6262         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6263         Read_relocs task.
6264         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6265         Allocate_commons_task first.
6266         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6267         task, rather than symtab_lock_.
6268         (Gc_process_relocs::~Gc_process_relocs): New function.
6269         (Gc_process_relocs::is_runnable): Check this_blocker_.
6270         (Gc_process_relocs::locks): Use next_blocker_ rather than
6271         blocker_.
6272         (Scan_relocs::~Scan_relocs): New function.
6273         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6274         symtab_lock_.
6275         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6276         next_blocker_.
6277         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6278         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6279         constructor accordingly.
6280         (class Gc_process_relocs): Likewise.
6281         (class Scan_relocs): Likewise.
6282         * common.h (class Allocate_commons_task): Remove symtab_lock_
6283         field, and corresponding constructor parameter.
6284         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6285         symtab_lock_.
6286         (Allocate_commons_task::locks): Likewise.
6287
6288 2010-02-11  Ian Lance Taylor  <iant@google.com>
6289
6290         * gold-threads.h (class Once): Define.
6291         (class Initialize_lock): Rewrite as child of Once.
6292         * gold-threads.cc (class Once_initialize): Define.
6293         (once_pointer_control): New static variable.
6294         (once_pointer, once_arg): New static variables.
6295         (c_run_once): New static function.
6296         (Once::Once, Once::run_once, Once::internal_run): New functions.
6297         (class Initialize_lock_once): Remove.
6298         (initialize_lock_control): Remove.
6299         (initialize_lock_pointer): Remove.
6300         (initialize_lock_once): Remove.
6301         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6302         (Initialize_lock::initialize): Rewrite.
6303         (Initialize_lock::do_run_once): New function.
6304         * archive.cc (Archive::interpret_header): Only clear name if it is
6305         not already empty.
6306         * fileread.cc: Include "gold-threads.h"
6307         (file_counts_lock): New static variable.
6308         (file_counts_initialize_lock): Likewise.
6309         (File_read::release): Only increment counts when using --stats.
6310         Use a lock around the increment.
6311         * parameters.cc (class Set_parameters_target_once): Define.
6312         (set_parameters_target_once): New static variable.
6313         (Parameters::Parameters): Move here from parameters.h.
6314         (Parameters::set_target): Rewrite.
6315         (Parameters::set_target_once): New function.
6316         (Parameters::clear_target): Move here and rewrite.
6317         * parameters.h (class Parameters): Update declarations.  Add
6318         set_parameters_target_once_ field.
6319         (Parameters::Parameters): Move to parameters.cc.
6320         (Parameters::clear_target): Likewise.
6321         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6322         task.
6323         (Start_group::~Start_group): New function.
6324         (Start_group::is_runnable): New function.
6325         (Start_group::locks, Start_group::run): New functions.
6326         (Finish_group::run): Change saw_undefined to size_t.
6327         * readsyms.h (class Start_group): Define.
6328         (class Finish_group): Change saw_undefined_ field to size_t.
6329         (Finish_group::Finish_group): Remove saw_undefined and
6330         this_blocker parameters.  Change all callers.
6331         (Finish_group::set_saw_undefined): New function.
6332         (Finish_group::set_blocker): New function.
6333         * symtab.h (class Symbol_table): Change saw_undefined to return
6334         size_t.  Change saw_undefined_ field to size_t.
6335         * target-select.cc (Set_target_once::do_run_once): New function.
6336         (Target_selector::Target_selector): Initialize set_target_once_
6337         field.  Don't initialize lock_ and initialize_lock_ fields.
6338         (Target_selector::instantiate_target): Rewrite.
6339         (Target_selector::set_target): New function.
6340         * target-select.h (class Set_target_once): Define.
6341         (class Target_selector): Update declarations.  Make
6342         Set_target_once a friend.  Remove lock_ and initialize_lock_
6343         fields.  Add set_target_once_ field.
6344
6345 2010-02-10  Ian Lance Taylor  <iant@google.com>
6346
6347         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6348         queueing any tasks.
6349         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6350         (queue_middle_tasks): Add all blockers before queueing any tasks.
6351         (queue_final_tasks): Likewise.
6352         * token.h (Task_token::add_blockers): New function.
6353         * object.h (Input_objects::number_of_relobjs): New function.
6354
6355 2010-02-10  Ian Lance Taylor  <iant@google.com>
6356
6357         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6358         shared, not if not position independent.
6359         * x86_64.cc (Relocate::relocate_tls): Likewise.
6360         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6361         (tls_pie_pic_test): New target.
6362         * testsuite/Makefile.in: Rebuild.
6363
6364         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6365         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6366         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6367         * testsuite/Makefile.in: Rebuild.
6368
6369 2010-02-09  David S. Miller  <davem@davemloft.net>
6370
6371         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6372         R_SPARC_RELATIVE using ->add_local_relative().
6373         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6374
6375         * output.h (Output_data_dynamic::add_section_size): New method
6376         that takes two Output_data objects.
6377         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6378         entry param.  Handle it in initializers.
6379         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6380         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6381         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6382         arg.
6383         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6384         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6385         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6386         for dynrel_includes_plt.
6387         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6388         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6389         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6390         before .rela.plt
6391         (Target_sparc::do_finalize_sections): Update to pass true for
6392         dynrel_includes_plt.
6393         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6394         output before .rela.plt
6395         (Target_powerpc::do_finalize_sections): Update to pass true for
6396         dynrel_includes_plt when 32-bit.
6397
6398 2010-02-08  Doug Kwan  <dougkwan@google.com>
6399
6400         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6401         method.
6402         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6403         Arm_relobj::scan_section_for_cortex_a8_stubs,
6404         Arm_relobj::do_relocation_section): Instead of calling
6405         Output_section::output_address, use faster
6406         Arm_relobj::simple_input_section_output_address.
6407
6408 2010-02-08  David S. Miller  <davem@davemloft.net>
6409
6410         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6411         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6412         relocation helper function.
6413
6414         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6415         just like R_SPARC_GOT{10,13,22}.
6416         (Target_sparc::Scan::local): Likewise.
6417         (Target_sparc::Relocate:relocate): Likewise.
6418
6419 2010-02-06  Ian Lance Taylor  <iant@google.com>
6420
6421         * configure.ac: Rewrite targetobjs duplicate removal code to use
6422         only shell constructs.
6423         * configure: Rebuild.
6424
6425 2010-02-05  Doug Kwan  <dougkwan@google.com>
6426
6427         PR 11247
6428         * arm.cc (Arm_relobj::section_is_scannable): New method.
6429         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6430         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6431
6432 2010-02-04  Doug Kwan  <dougkwan@google.com>
6433
6434         PR 11247
6435         * arm-reloc-property.cc (cstdio): Include.
6436         * configure.ac (targetobjs): Remove duplicates.
6437         * configure: Regenerate.
6438         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6439         big and little endian version for a given address size.
6440
6441 2010-02-03  Doug Kwan  <dougkwan@google.com>
6442
6443         * arm-reloc-property.cc
6444         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6445         definition.
6446         * arm-reloc-property.h
6447         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6448         New method definition.
6449         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6450         declaration.
6451         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6452         overflow to N.
6453         (GOT_PREL): Change implemented to Y.
6454         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6455         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6456         (Arm_relocate_functions::movw_abs_nc): Remove method.
6457         (Arm_relocate_functions::movt_abs): Ditto.
6458         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6459         (Arm_relocate_functions::thm_movt_abs): Ditto.
6460         (Arm_relocate_functions::movw_rel_nc): Ditto.
6461         (Arm_relocate_functions::movw_rel): Ditto.
6462         (Arm_relocate_functions::movt_rel): Ditto.
6463         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6464         (Arm_relocate_functions:thm_movw_rel): Ditto.
6465         (Arm_relocate_functions:thm_movt_rel): Ditto.
6466         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6467         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6468         New method definitions.
6469         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6470         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6471         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6472         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6473         (Target_arm::Relocate::relocate): Check for non-static or
6474         unimplemented relocation code and exit early.  Change calls to
6475         Target_arm::reloc_uses_thumb_bit and
6476         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6477         instead.  Refactor code to handle similar relocations to increase
6478         code sharing.  Remove check for unsupported relocation code in switch
6479         statement.
6480         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6481         relocation property table to find out size.  Change error message to
6482         print out the name of a relocation code instead of the numeric value.
6483         (Target_arm::scan_reloc_for_stub): Use relocation property table
6484         instead of calling Target_arm::reloc_uses_thumb_bit().
6485
6486 2010-02-02  Doug Kwan  <dougkwan@google.com>
6487
6488         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6489         types of relaxed input section.
6490
6491 2010-02-02  Doug Kwan  <dougkwan@google.com>
6492
6493         * Makefile.am (HFILES): Add arm-reloc-property.h.
6494         (DEFFILES): New.
6495         (TARGETSOURCES): Add arm-reloc-property.cc
6496         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6497         (libgold_a_SOURCES): $(DEFFILES)
6498         * Makefile.in: Regenerate.
6499         * arm-reloc-property.cc: New file.
6500         * arm-reloc-property.h: New file.
6501         * arm-reloc.def: New file.
6502         * arm.cc: Update comments.
6503         (arm-reloc-property.h): New included header.
6504         (arm_reloc_property_table): New global variable.
6505         (Target_arm::do_select_as_default_target): New method definition.
6506         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6507         arm-reloc-property to targ_extra_obj.
6508         * parameters.cc (set_parameters_target): Call
6509         Target::select_as_default_target().
6510         * target.h (Target::select_as_default_target): New method definition.
6511         (Target::do_select_as_default_target): Same.
6512
6513 2010-02-01  Doug Kwan  <dougkwan@google.com>
6514
6515         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6516         first_output_text_section_.
6517         (Arm_exidx_fixup::first_output_text_section): New method definition.
6518         (Arm_exidx_fixup::first_output_text_section_): New data member.
6519         (Arm_exidx_fixup::process_exidx_section): Record the first text
6520         output section seen.
6521         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6522         and entsize in output section header.
6523
6524 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6525
6526         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6527         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6528         (Arm_relocate_functions::thm_alu11): New Method.
6529         (Arm_relocate_functions::thm_pc8): New Method.
6530         (Arm_relocate_functions::thm_pc12): New Method.
6531         (Target_arm::Scan::local): Handle the relocations.
6532         (Target_arm::Scan::global): Likewise.
6533         (Target_arm::Relocate::relocate): Likewise.
6534         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6535
6536 2010-01-29  Doug Kwan  <dougkwan@google.com>
6537
6538         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6539         of relocation types as ld.
6540
6541 2010-01-29  Doug Kwan  <dougkwan@google.com>
6542
6543         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6544         to public.
6545         (Arm_relocate_functions::thumb_branch_common): Ditto.
6546         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6547         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6548         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6549         Arm_relocate_functions::jump24): Remove.
6550         (Target_arm::Relocate::relocate): Adjust code to call
6551         Arm_relocation_functions::arm_branch_common and
6552         Arm_relocation_functions::thumb_branch_common instead of their removed
6553         wrappers.  Merge switch-cases together to reduce source code size.
6554
6555 2010-01-29  Doug Kwan  <dougkwan@google.com>
6556
6557         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6558         output_local_symbol_count_needs_update_.
6559         (Arm_relobj::output_local_symbol_count_needs_update,
6560          Arm_relobj::set_output_local_symbol_count_needs_update,
6561          Arm_relobj::update_output_local_symbol_count): New methods.
6562         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6563         member.
6564         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6565         of pointed function as in a R_ARM_PREL31 relocation.
6566         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6567         for output local symbol count updating.
6568         (Target_arm::do_relax): Update output local symbol counts in objects
6569         if necessary.
6570         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6571
6572 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6573
6574         * arm.cc: Added support for the ARM relocations:
6575         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6576         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6577         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6578         movw_prel_nc).
6579         (Arm_relocate_functions::movw_rel): New method.
6580         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6581         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6582         thm_movw_prel_nc).
6583         (Arm_relocate_functions::thm_movw_rel): New method.
6584         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6585         thm_movt_prel).
6586         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6587         relocations.
6588         (Target_arm::Scan::global): Likewise.
6589         (Target_arm::Relocate::relocate): Likewise.
6590         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6591         Likewise.
6592
6593 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6594
6595         * arm.cc: Added support for ARM group relocations.
6596         (Target_arm::reloc_needs_sym_origin): New method.
6597         (Arm_relocate_functions::calc_grp_kn): New method.
6598         (Arm_relocate_functions::calc_grp_residual): New method.
6599         (Arm_relocate_functions::calc_grp_gn): New method.
6600         (Arm_relocate_functions::arm_grp_alu): New Method.
6601         (Arm_relocate_functions::arm_grp_ldr): New Method.
6602         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6603         (Arm_relocate_functions::arm_grp_ldc): New Method.
6604         (Target_arm::Scan::local): Handle the ARM group relocations.
6605         (Target_arm::Scan::global): Likewise.
6606         (Target_arm::Relocate::relocate): Likewise.
6607         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6608         Likewise.
6609
6610 2010-01-26  Doug Kwan  <dougkwan@google.com>
6611
6612         * arm.cc (set): Include.
6613         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6614         pointer type.
6615         (Arm_output_section::Text_section_list): New type.
6616         (Arm_output_section::append_text_sections_to_list): New method.
6617         (Arm_output_section::fix_exidx_coverage): Ditto.
6618         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6619         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6620         Relobj::set_section_offset() instead of
6621         Sized_relobj::invalidate_section_offset().
6622         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6623         parameter for section headers. Ignore relocation sections for
6624         unallocated sections and EXIDX sections.
6625         (Target_arm::fix_exidx_coverage): New method.
6626         (Target_arm::output_section_address_less_than): New type.
6627         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6628         linked text section instead of the EXIDX section.
6629         (Arm_output_section::create_stub_group): Add an assertion to check
6630         that this is not an EXIDX output section.
6631         (Arm_output_section::append_text_sections_to_list): New method.
6632         (Arm_output_section::fix_exidx_coverage): Ditto.
6633         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6634         Arm_relobj::section_needs_reloc_stub_scanning.
6635         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6636         first pass.
6637         (Target_arm::fix_exidx_coverage): New method.
6638         * object.h (Relobj::set_output_section): New method.
6639         (Sized_relobj::invalidate_section_offset): Remove method.
6640         (Sized_relobj::do_invalidate_section_offset): Remove method.
6641         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6642
6643 2010-01-25  Doug Kwan  <dougkwan@google.com>
6644
6645         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6646         Fix warning due to signed and unsigned comparison on a 32-bit host.
6647
6648 2010-01-22  Doug Kwan  <dougkwan@google.com>
6649
6650         * arm.cc (Target_arm::do_relax): Record an output section for section
6651         offset adjustment it contains any stub table that has changed.
6652         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6653         offsets in an output section if necessary.
6654         * output.cc (Output_section::Output_section): Initialize
6655         section_offsets_need_adjustments_.
6656         (Output_section::add_input_section_for_script): Renamed to
6657         Output_section::add_simple_input_section.
6658         (Output_section::save_states): Add a comment.
6659         (Output_section::discard_states): New method defintion.
6660         (Output_section::adjust_section_offsets): Same.
6661         * output.h (Output_section::add_input_section_for_script): Renamed to
6662         Output_section::add_simple_input_section.
6663         (Output_section::discard_states): New method declaration.
6664         (Output_section::adjust_section_offsets): Same.
6665         (Output_section::section_offsets_need_adjustment,
6666         Output_section::set_section_offsets_need_adjustment): New method
6667         definitions.
6668         (Output_section::section_offsets_need_adjustment_): New data member.
6669         * script-sections.cc
6670         (Output_section_element_input::set_section_address): Adjust code for
6671         renaming of Output_section::add_input_section_for_script.
6672         (Orphan_output_section::set_section_address): Same.
6673
6674 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6675
6676         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6677         Fix_v4bx enum values .
6678         * gold/options.h (General_options): New option definitions.
6679         (General_options::fix_v4bx): New method.
6680         (General_options::Fix_v4bx): New enum.
6681         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6682         (General_options::parse_fix_v4bx_interworking): New method.
6683
6684 2010-01-22  Doug Kwan  <dougkwan@google.com>
6685
6686         * arm.cc (Arm_exidx_fixup): New class.
6687
6688 2010-01-21  Doug Kwan  <dougkwan@google.com>
6689
6690         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6691         classes.
6692         (Arm_exidx_section_offset_map): New type.
6693
6694 2010-01-21  Doug Kwan  <dougkwan@google.com>
6695
6696         * arm.cc (Arm_exidx_input_section): New class.
6697         (Arm_relobj::exidx_input_section_by_link,
6698         Arm_relobj::exidx_input_section_by_shndx,
6699         Arm_relobj::make_exidx_input_section): New methods.
6700         (read_arm_attributes_section): Remove.
6701         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6702         information about them.
6703         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6704         to here.
6705
6706 2010-01-20  Doug Kwan  <dougkwan@google.com>
6707
6708         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6709         Input_section_specifier to Section_id.
6710         (Target_arm::new_arm_input_section: Adjust code for change of key
6711         type.
6712         (Target_arm::find_arm_input_section): Ditto.
6713         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6714         (Section_id): Remove.
6715         (Garbage_collection::Section_id_hash): Remove.
6716         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6717         (Section_id): Remove.
6718         (Icf::Section_id_hash): Remove.
6719         * object.h (Section_id, Const_section_id, Section_id_hash,
6720         Const_section_id_hash): New type definitions.
6721         * output.cc (Output_section::add_relaxed_input_section): Change to
6722         use Const_section_id instead of Input_section_specifier as key type.
6723         (Output_section::add_merge_input_section): Ditto.
6724         (Output_section::build_relaxation_map): Change to use Section_id
6725         instead of Input_section_specifier as key type.
6726         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6727         Ditto.
6728         (Output_section::convert_input_sections_to_relaxed_sections): Change
6729         to use Const_section_id instead of Input_section_specifier as key type.
6730         (Output_section::find_merge_section): Ditto.
6731         (Output_section::find_relaxed_input_section): Ditto.
6732         * output.h (Input_section_specifier): Remove class.
6733         (Output_section::Output_section_data_by_input_section_map): Change
6734         key type to Const_section_id.
6735         (Output_section::Output_relaxed_input_section_by_input_section_map):
6736         Ditto.
6737         (Output_section::Relaxation_map): Change key type to Section_id.
6738
6739 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6740
6741         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6742         (class Arm_v4bx_stub): New class.
6743         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6744         (Stub_factory::make_arm_v4bx_stub): New method.
6745         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6746         (Stub_table::empty): Handle v4bx stubs.
6747         (Stub_table::add_arm_v4bx_stub): New method.
6748         (Stub_table::find_arm_v4bx_stub): New method.
6749         (Arm_relocate_functions::v4bx): New method.
6750         (Target_arm::fix_v4bx): New method.
6751         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6752         (Stub_table::relocate_stubs): Likewise.
6753         (Stub_table::do_write): Likewise.
6754         (Stub_table::update_data_size_and_addralign): Likewise.
6755         (Stub_table::finalize_stubs):  Likewise.
6756         (Target_arm::Scan::local): Likewise.
6757         (Target_arm::Scan::global): Likewise.
6758         (Target_arm::do_finalize_sections): Likewise.
6759         (Target_arm::Relocate::relocate): Likewise.
6760         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6761         Likewise.
6762         (Target_arm::scan_reloc_for_stub): Likewise.
6763         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6764
6765 2010-01-19  Ian Lance Taylor  <iant@google.com>
6766
6767         * output.cc (Output_section_headers::do_sized_write): Write large
6768         segment count to sh_info field.
6769         (Output_file_header::do_sized_write): For large segment count,
6770         write PN_XNUM to e_phnum field.
6771
6772 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6773
6774         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6775         (Arm_relocate_functions::thm_jump8): New function.
6776         (Arm_relocate_functions::thm_jump11): New function.
6777         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6778         R_ARM_THM_JUMP11.
6779         (Target_arm::Scan::global): Likewise.
6780         (Target_arm::Relocate::relocate): Likewise.
6781         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6782         Likewise.
6783
6784 2010-01-14  Doug Kwan  <dougkwan@google.com>
6785
6786         * arm.cc (map, utility): Include headers.
6787         (Target_arm::apply_cortex_a8_workaround): New method.
6788         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6789         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6790         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6791         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6792         the --[no-]fix-cortex-a8 command line options.
6793         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6794         (Target_arm::relocate_stub): Use addend in instruction template.
6795         * options.h (DEFINE_bool): Set the user-set flag.
6796         (General_options): Add --[no-]-fix-cortex options.
6797         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6798         : Update fast look-up map after conversion.
6799
6800 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6801
6802         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6803         in the first pass of do_layout.
6804
6805 2010-01-13  Doug Kwan  <dougkwan@google.com>
6806
6807         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6808         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6809         apparent compiler problem of not folding static constant integral
6810         data members of elfcpp::Elf_sizes<32>.
6811
6812 2010-01-13  Doug Kwan  <dougkwan@google.com>
6813
6814         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6815         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6816         Arm_relobj::scan_section_for_cortex_a8_erratum,
6817         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6818         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6819         sections to scan for relocation stubs into a new method
6820         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6821         relocation and Cortex-A8 stub scanning.
6822         (Target_arm::do_relax): Force stubs to be after stubbed sections
6823         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6824         the beginning of a new relaxation pass.  Update a comment.
6825         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6826
6827 2010-01-12  Ian Lance Taylor  <iant@google.com>
6828
6829         * target-reloc.h (visibility_error): New inline function.
6830         (relocate_section): Call visibility_error.
6831         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6832         (MOSTLYCLEANFILES): Likewise.
6833         (protected_4_pic.o, protected_3.err): New targets.
6834         * testsuite/protected_4.cc: New file.
6835
6836 2010-01-12  Doug Kwan  <dougkwan@google.com>
6837
6838         * arm.cc (Cortex_a8_reloc): New class.
6839         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6840         and cortex_a8_relocs_info_.
6841         (Target_arm::fix_cortex_a8): New method definition.
6842         (Target_arm::Cortex_a8_relocs_info): New type.
6843         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6844         New data member declarations.
6845         (Target_arm::scan_reloc_for_stub): Record information about
6846         relocations for THUMB branches that might be exempted from the
6847         Cortex-A8 workaround.
6848         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6849         at the beginning of a relaxation pass.
6850
6851 2010-01-12  Doug Kwan  <dougkwan@google.com>
6852
6853         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6854         (Arm_relobj::Mapping_symbol_position,
6855          Arm_reloj::Mapping_symbol_position_less,
6856          Arm_relobj::Mapping_symbols_info): New types.
6857         (Target_arm::is_mapping_symbol_name): New method definition.
6858         (Arm_relobj::do_count_local_symbols): Save information about mapping
6859         symbols.
6860
6861 2010-01-11  Doug Kwan  <dougkwan@google.com>
6862
6863         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6864         Arm_relocate_functions::thumb32_branch_upper,
6865         Arm_relocate_functions::thumb32_branch_lower,
6866         Arm_relocate_functions::thumb32_cond_branch_offset,
6867         Arm_relocate_functions::thumb32_cond_branch_upper,
6868         Arm_relocate_functions::thumb32_cond_branch_lower,
6869         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6870         branch offset encoding.
6871         (Arm_relocate_functions::thumb_branch_common): Use new branch
6872         offset encoding methods to avoid code duplication.
6873         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6874         (Stub_addend_reader::operator()): Use new branch encoding method
6875         to avoid code duplication.
6876
6877 2010-01-11  Doug Kwan  <dougkwan@google.com>
6878
6879         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6880         (Target_arm::do_finalize_sections): Define special EXIDX section
6881         symbols only if referenced.
6882         * gc.h (Garbage_collection::add_reference): New method.
6883         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6884         code duplication.
6885
6886 2010-01-11  Ian Lance Taylor  <iant@google.com>
6887
6888         * script.cc (Version_script_info::build_expression_list_lookup):
6889         Change complaing about duplicate wildcard match from error to
6890         warning.
6891
6892         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6893         of 2009-12-30.
6894         (Version_script_info::Version_script_info): Initialize globs_,
6895         default_version_, default_is_global_, and exact_.  Don't
6896         initialize globals_ or locals_.
6897         (Version_script_info::build_lookup_tables): Build local symbols
6898         first.
6899         (Version_script_info::unquote): New function.
6900         (Version_script_info::add_exact_match): New function.
6901         (Version_script_info::build_expression_list_lookup): Remove lookup
6902         parameter.  Add is_global parameter.  Change all callers.  Handle
6903         wildcard pattern specially.  Unquote pattern.  Call
6904         add_exact_match.
6905         (Version_script_info::get_name_to_match): New function.
6906         (Version_script_info::get_symbol_version): New function.
6907         (Version_script_info::get_symbol_version_helper): Remove.
6908         (Version_script_info::check_unmatched_names): Call unquote.
6909         * script.h (class Version_script_info): Change get_symbol_version
6910         to be non-inline and add is_global parameter; change all callers.
6911         Rewrite symbol_is_local.  Update declarations.  Define struct
6912         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6913         Remove globals_ and locals_ members.  Add exact_, globs_,
6914         default_version_, is_global_.
6915         (Version_script_info::Glob): Remove pattern, add expression and
6916         is_global.  Update constructor.  Change all callers.
6917         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6918         default version.
6919         (Versions::symbol_section_contents): If a symbol is undefined, or
6920         defined in a dynamic object, set the version index to
6921         VER_NDX_LOCAL.
6922         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6923         symbol_is_local.
6924         (Symbol_table::add_from_pluginobj): Likewise.
6925         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6926
6927 2010-01-11  Doug Kwan  <dougkwan@google.com>
6928
6929         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6930         (incremental_dump_LDADD): Add linking option for libintl.
6931         * Makefile.in: Regenerate.
6932
6933 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6934
6935         PR gold/11144
6936         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6937         instead of -Ds.
6938         * testsuite/Makefile.in: Regenerated.
6939
6940 2010-01-10  Doug Kwan  <dougkwan@google.com>
6941
6942         * options.h (DEFINE_var): Use parentheses around argument varname__
6943         in macro body to avoid any unintended subsequent substitutions.
6944
6945 2010-01-10  Ian Lance Taylor  <iant@google.com>
6946
6947         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6948         candidates before doing symbol resolution.
6949
6950         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6951         ODR candidates if only one is weak.
6952
6953 2010-01-08  Ian Lance Taylor  <iant@google.com>
6954
6955         * script.cc (Version_script_info::build_expression_list_lookup):
6956         Don't warn about ambiguous version, just record the ambiguity.
6957         (Version_script_info::get_symbol_version_helper): Give error if
6958         version is ambiguous.
6959
6960 2010-01-08  Doug Kwan  <dougkwan@google.com>
6961
6962         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6963           prev_data_size_ and prev_addralign_.  Remove initializer for
6964           deleted data member has_been_changed_.
6965           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6966           to determine if the table is empty.
6967           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6968           Remove.
6969           (Stub_table::add_reloc_stub): Define method in class definition
6970           instead of just declaring it there.
6971           (Stub_table::add_cortex_a8_stub): New method definition.
6972           (Stub_table::update_data_size_and_addralign): Ditto.
6973           (Stub_table::finalize_stubs): Ditto.
6974           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6975           (Stub_table::do_addralign_): Return address alignment in the
6976           (Stub_table::do_reset_address_and_file_offset): Define method in
6977           class definition instead of declaring it there.  Set current data
6978           size to be the data size of the previous pass.
6979           (Stub_table::set_final_data_size): Use current data size as the
6980           final data size.
6981           (Stub_table::relocate_stub): Change parameter type of stub from
6982           Reloc_stub pointer to Stub pointer.
6983           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6984           (Stub_table::Cortex_a8_stub_list): New typedef.
6985           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6986            Stub_table::prev_addralign_): New data member.
6987           (Arm_relobj::Arm_relobj): Initialize data member
6988           section_has_cortex_a8_workaround_.
6989           (Arm_relobj::section_has_cortex_a8_workaround,
6990            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6991            definitions.
6992           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6993           declarations.
6994           (Target_arm::relocate_stub): Change parameter type of stub from
6995           Reloc_stub pointer to Stub pointer.
6996           (Insn_template::size, Insn_template::alignment): Handle
6997           THUMB16_SPECIAL_TYPE.
6998           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6999            Stub_table::update_data_size_and_addralign,
7000            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7001           definitions.
7002           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7003           (Stub_table::do_write): Ditto.
7004           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7005
7006 2010-01-08  Ian Lance Taylor  <iant@google.com>
7007
7008         PR 11108
7009         * symtab.h (class Symbol): Remove fields is_target_special_ and
7010         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7011         (Symbol::is_defined_in_discarded_section): New function.
7012         (Symbol::set_is_defined_in_discarded_section): New function.
7013         (Symbol::has_plt_offset): Rewrite.
7014         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7015         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7016         Don't initialize is_target_special_ or has_plt_offset_.
7017         Initialize is_defined_in_discarded_section_.
7018         (Symbol_table::add_from_relobj): If appropriate, set
7019         is_defined_in_discarded_section.
7020         * resolve.cc (Symbol::override_base_with_special): Don't test
7021         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7022         * target-reloc.h (relocate_section): Do special handling for
7023         symbols defined in discarded sections for global symbols as well
7024         as local symbols.
7025
7026 2010-01-08  Ian Lance Taylor  <iant@google.com>
7027
7028         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7029         the SHT_SYMTAB case.
7030
7031 2010-01-08  Ian Lance Taylor  <iant@google.com>
7032
7033         * object.cc (Sized_relobj::do_layout): Don't get confused if
7034         layout_eh_frame returns NULL.
7035
7036 2010-01-08  Ian Lance Taylor  <iant@google.com>
7037
7038         PR 11084
7039         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7040         dynamic symbol table, use the normal symbol table.
7041         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7042         symbol table.
7043
7044 2010-01-08  Ian Lance Taylor  <iant@google.com>
7045
7046         PR 11072
7047         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7048         sections.
7049
7050 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7051
7052         * version.cc (print_version): Change to "Copyright 2010".
7053
7054 2010-01-08  Ian Lance Taylor  <iant@google.com>
7055
7056         PR 10287
7057         PR 11063
7058         * i386.cc (class Target_i386): Change return type of plt_section
7059         to be non-const.
7060         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7061         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7062         tls_desc_rel_ field.
7063         (Output_data_plt_i386::rel_tls_desc): New function.
7064         (Target_i386::rel_tls_desc_section): New function.
7065         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7066         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7067         R_386_TLS_DESC reloc in rel_tls_desc_section.
7068         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7069         Define struct Tlsdesc_info.
7070         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7071         (Target_x86_64::do_reloc_symbol_index): New function.
7072         (Target_x86_64::add_tlsdesc_info): New function.
7073         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7074         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7075         tlsdesc_rel_ field.
7076         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7077         all callers.
7078         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7079         (Target_x86_64::rela_tlsdesc_section): New function.
7080         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7081         handling.
7082         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7083         (Target_x86_64::do_reloc_addend): New function.
7084         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7085         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7086         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7087         (Output_reloc::type): New function.
7088         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7089         (Output_reloc::is_target_specific): New function.
7090         (Output_reloc::target_arg): New function.
7091         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7092         absolute relocs and target specific relocs.
7093         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7094         add_target_specific.
7095         (class Output_data_reloc) [SHT_RELA]: Likewise.
7096         * output.cc (Output_reloc::Output_reloc): Add four new versions
7097         for absolute relocs and target specific relocs.
7098         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7099         (Output_reloc::get_symbol_index): Likewise.
7100         (Output_reloc::local_section_offset): Check that local_sym_index_
7101         is not TARGET_CODE or 0.
7102         (Output_reloc::symbol_value): Likewise.
7103         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7104         reloc.
7105         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7106         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7107         functions.
7108         * layout.cc (add_target_dynamic_tags): Use output section for
7109         DT_PLTRELSZ and DT_JMPREL.
7110
7111 2010-01-07  Ian Lance Taylor  <iant@google.com>
7112
7113         PR 11061
7114         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7115         function.
7116         (class Output_data_reloc_generic): Define.
7117         (class Output_data_reloc_base): Change base class to
7118         Output_data_reloc_generic.  Change add() method to call
7119         bump_relative_reloc_count for a relative reloc.  Remove
7120         sort_relocs_ field.
7121         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7122         to sort_relocs().
7123         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7124         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7125         appropriate.
7126         * layout.h (class Layout): Update declaration.
7127
7128 2010-01-07  Ian Lance Taylor  <iant@google.com>
7129
7130         * output.h (class Output_data): Add const version of
7131         output_section and do_output_section.
7132         (class Output_section_data): Add const version of
7133         do_output_section.
7134         (class Output_section): Likewise.
7135         * layout.cc (Layout::add_target_dynamic_tags): New function.
7136         * layout.h (class Layout): Update declarations.
7137         * arm.cc (Target_arm::do_finalize_sections): Use
7138         add_target_dynamic_tags.
7139         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7140         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7141         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7142         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7143
7144 2010-01-07  Ian Lance Taylor  <iant@google.com>
7145
7146         PR 11042
7147         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7148         object as needed.
7149
7150 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7151             Ian Lance Taylor  <iant@google.com>
7152
7153         PR 11019
7154         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7155         Xindex::read_symtab_xindex.
7156
7157 2010-01-07  Doug Kwan  <dougkwan@google.com>
7158
7159         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7160         (Insn_template::thumb16_bcond_insn): New method declaration.
7161         (Insn_template): Fix spelling.
7162         (Stub::thumb16_special): New method declaration.
7163         (Stub::do_write): Define virtual method which was previously pure
7164         virtual.
7165         (Stub::do_thumb16_special): New method declaration.
7166         (Stub::do_fixed_endian_write): New template member.
7167         (Reloc_stub::do_write): Remove.
7168         (Reloc_stub::do_fixed_endian_write): Remove.
7169         (Cortex_a8_stub): New class definition.
7170         (Stub_factory::make_cortex_a8_stub): New method definition.
7171         (Stub_factory::Stub_factory): Add missing static storage class
7172         qualifier for elf32_arm_stub_a8_veneer_blx.
7173
7174 2010-01-07  Ian Lance Taylor  <iant@google.com>
7175
7176         PR 10980
7177         * options.h (class General_options): Add --warn-unresolved-symbols
7178         and --error-unresolved-symbols.
7179         * errors.cc (Errors::undefined_symbol): Implement
7180         --warn-unresolved-symbols.
7181
7182         * options.h (class General_options): Add -z text and -z textoff.
7183         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7184
7185 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7186
7187         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7188         (Garbage_collection::cident_sections): New function.
7189         (Garbage_collection::add_cident_section): New function.
7190         (Garbage_collection::cident_sections_): New member.
7191         (gc_process_relocs): Add references to sections whose names are C
7192         identifiers.
7193         * gold.h (cident_section_start_prefix): New constant.
7194         (cident_section_stop_prefix): New constant.
7195         (is_cident): New function.
7196         * layout.cc (Layout::define_section_symbols): Replace string constants
7197         with the newly defined constants.
7198         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7199         C identifiers.
7200         * testsuite/Makefile.am: Add gc_orphan_section_test.
7201         * testsuite/Makefile.in: Regenerate.
7202         * testsuite/gc_orphan_section_test.cc: New file.
7203         * testsuite/gc_orphan_section_test.sh: New file.
7204
7205 2010-01-06  Ian Lance Taylor  <iant@google.com>
7206
7207         PR 10980
7208         * options.h (class General_options): Add --warn-shared-textrel.
7209         * layout.cc (Layout::finish_dynamic_section): Implement
7210         --warn-shared-textrel.
7211
7212         PR 10980
7213         * options.h (class General_options): Add --warn-multiple-gp.
7214
7215 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7216
7217         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7218         $(THREADSLIB) and $(LIBDL).
7219         * Makefile.in: Rebuild.
7220
7221 2010-01-06  Ian Lance Taylor  <iant@google.com>
7222
7223         PR 10980
7224         * options.cc (General_options::parse_section_start): New function.
7225         (General_options::section_start): New function.
7226         (General_options::General_options): Initialize all members.
7227         * options.h: Include <map>
7228         (class General_options): Add --section-start.  Add section_starts_
7229         member.
7230         * layout.cc (Layout::attach_allocated_section_to_segment): If
7231         --section-start was used, set the address of the segment.  Remove
7232         local sort_sections.
7233         (Layout::relaxation_loop_body): If the address of the load segment
7234         has been set by --section-start, don't use it.
7235         * output.h (Output_segment::update_flags_for_output_section): New
7236         function.
7237         * output.cc (Output_segment::add_output_section): Call
7238         update_flags_for_output_section.
7239
7240 2010-01-05  Ian Lance Taylor  <iant@google.com>
7241
7242         PR 10980
7243         * options.h (class General_options): Add --undefined-version.
7244         * script.cc (struct Version_expression): Add was_matched_by_symbol
7245         field.
7246         (Version_script_info::matched_symbol): New function.
7247         (Version_script_info::get_symbol_version_helper): Call
7248         matched_symbol.
7249         (Version_script_info::check_unmatched_names): New function.
7250         * script.h (class Version_script_info): Update declarations.
7251         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7252
7253         * options.h (class General_options): Use DEFINE_bool_alias for
7254         allow_multiple_definition.
7255         * resolve.cc (Symbol_table::should_override): Don't test
7256         allow_multiple_definition.
7257
7258         PR 10980
7259         * options.h (class General_options): Add --cref.
7260         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7261         until after printing cref table.
7262         * cref.cc: Include "symtab.h".
7263         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7264         (Cref_table_compare::operator()): New function.
7265         (Cref_inputs::gather_cref): New function.
7266         (filecol): New static const.
7267         (Cref_inputs::print_cref): New function.
7268         (Cref::print_cref): New function.
7269         * cref.h: Include <cstdio>.
7270         (class Cref): Update declarations.
7271         * mapfile.h (Mapfile::file): New function.
7272         * object.h (class Object): Define Symbols.  Declare virtual
7273         do_get_global_symbols.
7274         (Object::get_global_symbols): New function.
7275         * object.cc (Input_objects::add_object): Pass object to cref_ if
7276         --cref.
7277         (Input_objects::archive_start): Likewise.
7278         (Input_objects::archive_stop): Likewise.
7279         (Input_objects::print_cref): New function.
7280         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7281         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7282         --cref.
7283         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7284         function.
7285         * plugin.h (class Sized_pluginobj): Update declarations.
7286
7287 2010-01-05  Ian Lance Taylor  <iant@google.com>
7288
7289         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7290         to is_default_version.  Rename insdef to insdefault.
7291         (Symbol_table::add_from_relobj): Rename def to is_default_version
7292         and local to is_forced_local.
7293         (Symbol_table::add_from_pluginobj): Likewise.
7294         (Symbol_table::add_from_dynobj): Likewise.
7295         (Symbol_table::define_special_symbol): Rename insdef to
7296         insdefault.
7297
7298 2010-01-04  Ian Lance Taylor  <iant@google.com>
7299
7300         PR 10980
7301         * options.h (class General_options): Add
7302         --allow-multiple-definition and -z muldefs.
7303         * resolve.cc (Symbol_table::should_override): Don't warn about a
7304         multiple symbol definition if --allow-multiple-definition or -z
7305         muldefs.
7306
7307         PR 10980
7308         * options.h (class General_options): Add --add-needed and
7309         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7310         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7311         error if --copy-dt-needed-entries aka --add-needed is used and
7312         would cause a change in behaviour.
7313
7314         PR 10980
7315         * options.h (class General_options): Add -G as a short version of
7316         --shared.  Add no-op options -assert, -g, and -i.
7317
7318 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7319
7320         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7321         check for .text or .gnu.linkonce.t sections.
7322         * icf.cc (Icf::find_identical_sections): Ditto.
7323         Change the detection for mangled function name within the section
7324         name.
7325         * icf.h (is_section_foldable_candidate): New function.
7326
7327 2009-12-30  Ian Lance Taylor  <iant@google.com>
7328
7329         PR 10980
7330         * options.h (class General_options): Permit two dashes with
7331         --retain-symbols-file.
7332
7333 2009-12-30  Ian Lance Taylor  <iant@google.com>
7334
7335         PR 10979
7336         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7337         don't put the file header and segment headers in the text
7338         segment.
7339
7340         PR 10979
7341         * common.cc (Sort_commons::operator()): Stabilize sort when both
7342         entries are NULL.
7343         (Symbol_table::do_allocate_commons_list): When allocating common
7344         symbols, skip a symbol which is no longer common.
7345         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7346         an object before checking its type.
7347         * testsuite/common_test_2.c: New file.
7348         * testsuite/common_test_3.c: New file.
7349         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7350         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7351         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7352         (common_test_2_pic.o, common_test_2.so): New targets.
7353         (common_test_3_pic.o, common_test_3.so): New targets.
7354         * testsuite/Makefile.in: Rebuild.
7355
7356         PR 10979
7357         * script.cc (read_input_script): If we see a new SECTIONS clause,
7358         and we have added an input section, give an error.
7359         * layout.h (class Layout): Add have_added_input_section function.
7360         Add have_added_input_section_ field.
7361         * layout.cc (Layout::Layout): Initialize
7362         have_added_input_section_.
7363         (Layout::layout): Set have_added_input_section_.
7364         (Layout::layout_eh_frame): Likewise.
7365
7366 2009-12-30  Ian Lance Taylor  <iant@google.com>
7367
7368         PR 10931
7369         * options.h (class General_options): Add --sort-common option.
7370         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7371         * common.cc (Sort_common): Add sort_order parameter to
7372         constructor.  Add sort_order_ field.
7373         (Sort_commons::operator): Check sort_order_.
7374         (Symbol_table::allocate_commons): Determine the sort order.
7375         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7376         Change all callers.
7377         (Symbol_table::do_allocate_commons_list): Likewise.
7378
7379 2009-12-30  Ian Lance Taylor  <iant@google.com>
7380
7381         PR 10916
7382         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7383         symbols from this object, don't change the visibility of an
7384         undefined symbol.
7385         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7386
7387 2009-12-30  Ian Lance Taylor  <iant@google.com>
7388
7389         PR 10861
7390         * script.h (class Version_script_info): Define Language enum.
7391         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7392         new fields globals_, locals_, and is_finalized_.
7393         * script.cc: Various formatting fixes.
7394         (class Parser_closure): Change language_stack_ from a vector of
7395         std::string to one of Version_script_info::Language.  Adjust all
7396         uses accordingly.
7397         (class Lazy_demangler): Remove.
7398         (struct Version_expression): Change language from std::string to
7399         Version_script_info::Language.
7400         (Version_script_info::Version_script_info): New function.
7401         (Version_script_info::~Version_script_info): Don't call clear.
7402         (Version_script_info::finalize): New function.
7403         (Version_script_info::build_lookup_tables): New function.
7404         (Version_script_info::build_expression_list_lookup): New
7405         function.
7406         (Version_script_info::get_symbol_version_helper): Rewrite to use
7407         lookup tables.
7408         (Version_script_info::print_expression_list): Adjust to use
7409         Version_script_info::Language.
7410         (script_push_lex_into_version_mode): Check that the version script
7411         has not been finalized.
7412         (version_script_push_lang): Change language string to
7413         Version_script_info::Language.
7414         * options.cc (Command_line::version_script): New function.
7415         * options.h (class General_options): Add finalize_dynamic_list
7416         function.  Change version_script from declaration to definition.
7417         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7418         * testsuite/version_script.map: Remove duplicate def of foo.
7419         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7420         version_script.map.
7421         * testsuite/Makefile.in: Rebuild.
7422
7423 2009-12-30  Ian Lance Taylor  <iant@google.com>
7424
7425         PR 10843
7426         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7427         if the input symbol index is 0, make the output symbol index 0.
7428
7429 2009-12-30  Ian Lance Taylor  <iant@google.com>
7430
7431         PR 10670
7432         * options.h (class General_options): Add -x/--discard-all.
7433         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7434         --discard-all.  If the local symbol needs a dynamic entry, check
7435         that before handling --discard-locals.
7436
7437 2009-12-30  Ian Lance Taylor  <iant@google.com>
7438
7439         PR 10450
7440         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7441         flags to PF_R.
7442         (Output_segment::add_output_section): Don't change the flags if
7443         the type is PT_TLS.
7444
7445         PR 10450
7446         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7447         GNU hash table if they need a dynamic value.  Otherwise, don't add
7448         them if they are defined in a dynamic object or are forced local.
7449
7450 2009-12-29  Ian Lance Taylor  <iant@google.com>
7451
7452         PR 10450
7453         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7454         .gnu.hash table for a 32-bit target.
7455
7456         PR 10450
7457         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7458         regular and a dynamic object only needs a dynamic symbol table
7459         entry if it is externally visible.
7460
7461         PR 10450
7462         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7463         constructor.  Add global_offset_table_ field.
7464         (Target_i386::got_section): Set global_offset_table_.
7465         (Target_i386::do_finalize_sections): Set global_offset_table_
7466         size.
7467         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7468         in constructor.  Add global_offset_table_ field.
7469         (Target_x86_64::got_section): Set global_offset_table_.
7470         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7471         size.
7472
7473         * layout.cc (Layout::Layout): Initialize increase_relro_.
7474         (Layout::get_output_section): Add is_relro, is_last_relro, and
7475         is_first_non_relro parameters.  Change all callers.
7476         (Layout::choose_output_section): Likewise.
7477         (Layout::add_output_section_data): Likewise.
7478         (Layout::make_output_section): Likewise.
7479         (Layout::set_segment_offsets): Clear increase_relro when using a
7480         linker script.
7481         * layout.h (class Layout): Add increase_relro method.  Add
7482         increase_relro_ field.  Update declarations.
7483         * output.cc (Output_section::Output_section): Initialize
7484         is_last_relro_ and is_first_non_relro_.
7485         (Output_segment::add_output_section): Group relro sections is
7486         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7487         (Output_segment::maximum_alignment): Remove relro handling.
7488         (Output_segment::set_section_addresses): Add increase_relro
7489         parameter.  Change all callers.  Add initial alignment to align
7490         relro sections on separate page.  Remove old relro handling.
7491         (Output_segment::set_section_list_addresses): Remove in_relro
7492         parameter.  Change all callers.
7493         (Output_segment::set_offset): Add increase parameter.  Change all
7494         callers.  Remove old relro handling.
7495         * output.h (class Output_section): Add new methods: is_last_relro,
7496         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7497         Add is_last_relro_ and is_first_non_relro_ fields.
7498         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7499         Create separate .got.plt section.  Call increase_relro.
7500         * x86_64.cc (Target_x86_64::got_section): Likewise.
7501         * testsuite/relro_script_test.t: Add .got.plt.
7502
7503         PR 10450
7504         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7505         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7506         (Layout::finalize): Call set_dynamic_symbol_size.
7507         (Layout::set_dynamic_symbol_size): New function.
7508         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7509         set_dynamic_symbol_size.
7510
7511         PR 10450
7512         * output.h (class Output_section): Add is_entsize_zero_ field.
7513         * output.cc (Output_section::Output_section): Initialize
7514         is_entsize_zero_.
7515         (Output_section::set_entsize): If two different entsizes are
7516         requested, force it to zero.
7517         (Output_section::add_input_section): Set flags for .debug_str
7518         before updating section flags.  Set entsize.
7519         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7520         and SHF_STRING if all input sections have those flags.
7521
7522 2009-12-29   Rafael Espindola  <espindola@google.com>
7523
7524         * main.cc (main): Fix the sys time reporting.
7525         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7526         reporting.
7527
7528 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7529
7530         * options.cc (General_options::parse_version): Allow -v to exit
7531         without an error if there is nothing to link.
7532
7533 2009-12-29  Ian Lance Taylor  <iant@google.com>
7534
7535         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7536         using a version of gcc before 4.1.
7537         * configure: Rebuild.
7538
7539 2009-12-28  Chris Demetriou  <cgd@google.com>
7540
7541         * attributes.cc (Output_attributes_section_data::do_write): Use
7542         std::vector::front rather than std::vector::data.
7543
7544 2009-12-28  Ian Lance Taylor  <iant@google.com>
7545
7546         * symtab.h (class Symbol_table): Add enum Defined.
7547         * resolve.cc (Symbol_table::should_override): Add defined
7548         parameter.  Change all callers.  Test whether object is NULL
7549         before calling a method on it.
7550         (Symbol_table::report_resolve_problem): Add defined parameter.
7551         Change all callers.
7552         (Symbol_table::should_override_with_special): Likewise.
7553         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7554         parameter.  Change all callers.
7555         (Symbol_table::do_define_in_output_data): Likewise.
7556         (Symbol_table::define_in_output_segment): Likewise.
7557         (Symbol_table::do_define_in_output_segment): Likewise.
7558         (Symbol_table::define_as_constant): Likewise.
7559         (Symbol_table::do_define_as_constant): Likewise.
7560         * script.h (class Symbol_assignment): Add is_defsym parameter to
7561         constructor; change all callers.
7562         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7563         parameter.  Change all callers.  Add is_defsym_ field.
7564         (class Parser_closure): Add parsing_defsym parameter to
7565         constructor; change all callers.  Add parsing_defsym accessor
7566         function.  Add parsing_defsym_ field.
7567
7568 2009-12-28  Ian Lance Taylor  <iant@google.com>
7569
7570         * gold.cc (queue_middle_tasks): Fix formatting.
7571         * object.cc (Relobj::is_section_name_included): Likewise.
7572
7573 2009-12-23  Ian Lance Taylor  <iant@google.com>
7574
7575         * i386.cc (Target_i386::do_calls_non_split): Recognize
7576         -fsplit-stack prologue for a function with a static chain.
7577         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7578         -fsplit-stack prologue when using %r11.
7579
7580 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7581
7582         * options.cc (General_options::parse_version): Make -v continue and do
7583         the link like GNU ld does.
7584
7585 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7586
7587         * Makefile.am (CCFILES): Add timer.cc.
7588         (HFILES): Add timer.h.
7589         * configure.ac: Check for sysconf and times.
7590         * main.cc: include timer.h.
7591         (main): Use Timer instead of get_run_time.
7592         * timer.cc: New.
7593         * timer.h: New.
7594         * workqueue.cc: include timer.h.
7595         (Workqueue::find_and_run_task):
7596         Report user, sys and wall time.
7597         * Makefile.in: Regenerate.
7598         * config.in: Regenerate.
7599         * configure: Regenerate.
7600
7601 2009-12-16  Doug Kwan  <dougkwan@google.com>
7602
7603         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7604         sections.
7605         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7606         relaxed input sections.
7607         * output.cc (Output_section::find_relaxed_input_section): Change
7608         return type to Output_relaxed_input_section pointer.  Adjust code
7609         for new type of relaxed_input_section_map_.
7610         * output.h (Output_section::find_relaxed_input_section): Change
7611         return type to Output_relaxed_input_section pointer.
7612         (Output_section::Output_relaxed_input_section_by_input_section_map):
7613         New type.
7614         (Output_section::relaxed_input_section_map_): Change type to
7615         Output_section::Output_relaxed_input_section_by_input_section_map.
7616         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7617         input section.
7618
7619 2009-12-15  Ian Lance Taylor  <iant@google.com>
7620
7621         * layout.cc (Layout::create_shstrtab): Only write out after input
7622         sections if we are compressing debug sections.
7623
7624 2009-12-15  Ian Lance Taylor  <iant@google.com>
7625
7626         * archive.cc (Archive::add_symbols): Only look up a symbol without
7627         a version if there is, in fact, a version.
7628
7629 2009-12-14  Ian Lance Taylor  <iant@google.com>
7630
7631         Revert -Wshadow changes, all changes from:
7632         2009-12-11  Doug Kwan  <dougkwan@google.com>
7633         2009-12-11  Nick Clifton  <nickc@redhat.com>
7634         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7635
7636 2009-12-11  Doug Kwan  <dougkwan@google.com>
7637
7638         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7639         due to -Wshadow.
7640         * attributes.cc (Object_attribute::size): Ditto.
7641         (Attributes_section_data::size): Ditto.
7642         (Attributes_section_data::Attributes_section_data): Ditto.
7643         (Output_attributes_section_data::do_write): Ditto.
7644         * attributes.h (Object_attribute::set_type): Ditto.
7645         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7646
7647 2009-12-11  Nick Clifton  <nickc@redhat.com>
7648
7649         * archive.cc: Fix shadowed variable warnings.
7650         * arm.cc: Likewise.
7651         * compressed_output.cc: Likewise.
7652         * compressed_output.h: Likewise.
7653         * configure: Likewise.
7654         * dwarf_reader.cc: Likewise.
7655         * dynobj.cc: Likewise.
7656         * dynobj.h: Likewise.
7657         * ehframe.cc: Likewise.
7658         * ehframe.h: Likewise.
7659         * errors.cc: Likewise.
7660         * expression.cc: Likewise.
7661         * fileread.cc: Likewise.
7662         * fileread.h: Likewise.
7663         * freebsd.h: Likewise.
7664         * i386.cc: Likewise.
7665         * icf.cc: Likewise.
7666         * incremental.h: Likewise.
7667         * layout.cc: Likewise.
7668         * layout.h: Likewise.
7669         * mapfile.cc: Likewise.
7670         * merge.cc: Likewise.
7671         * merge.h: Likewise.
7672         * object.cc: Likewise.
7673         * object.h: Likewise.
7674         * options.h: Likewise.
7675         * output.cc: Likewise.
7676         * output.h: Likewise.
7677         * parameters.cc: Likewise.
7678         * plugin.cc: Likewise.
7679         * powerpc.cc: Likewise.
7680         * reduced_debug_output.cc: Likewise.
7681         * reduced_debug_output.h: Likewise.
7682         * reloc.cc: Likewise.
7683         * reloc.h: Likewise.
7684         * resolve.cc: Likewise.
7685         * script-sections.cc: Likewise.
7686         * script.cc: Likewise.
7687         * script.h: Likewise.
7688         * sparc.cc: Likewise.
7689         * symtab.cc: Likewise.
7690         * symtab.h: Likewise.
7691         * target-select.cc: Likewise.
7692         * target-select.h: Likewise.
7693         * token.h: Likewise.
7694         * workqueue.cc: Likewise.
7695         * workqueue.h: Likewise.
7696         * x86_64.cc: Likewise.
7697
7698 2009-12-10  Doug Kwan  <dougkwan@google.com>
7699
7700         * arm.cc (attributes.h): New include.
7701         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7702         (Arm_relobj::~Arm_relobj): Delete object pointed by
7703         attributes_section_data_.
7704         (Arm_relobj::attributes_section_data): New method definition.
7705         (Arm_relobj::attributes_section_data_): New data member declaration.
7706         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7707         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7708         attributes_section_data_.
7709         (Arm_dynobj::attributes_section_data): New method definition.
7710         (Arm_dynobj::attributes_section_data_): New data member declaration.
7711         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7712         initialization value of may_use_blx_ to false.
7713         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7714         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7715         object attributes to compute results instead of hard-coding.
7716         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7717         Target_arm::get_secondary_compatible_arch,
7718         Target_arm::set_secondary_compatible_arch
7719         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7720         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7721         New method declarations.
7722         (Target_arm::get_aeabi_object_attribute): New method definition.
7723         (Target_arm::attributes_section_data_): New data member declaration.
7724         (read_arm_attributes_section): New template definition.
7725         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7726         (Arm_dynobj::do_read_symbols): Ditto.
7727         (Target_arm::do_finalize_sections): Merge attributes sections from
7728         input.  Check for BLX use after attributes section merging.
7729         Fix __exidx_start and __exidx_end visibility.  Create an
7730         .ARM.attributes section if necessary.
7731         (Target_arm::get_secondary_compatible_arch,
7732         Target_arm::set_secondary_compatible_arch,
7733         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7734         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7735         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7736         New method definitions.
7737
7738 2009-12-09  Ian Lance Taylor  <iant@google.com>
7739
7740         * plugin.cc (Plugin::load): Don't cast from void* to a function
7741         pointer.
7742
7743 2009-12-09  Ian Lance Taylor  <iant@google.com>
7744
7745         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7746         information fields.
7747
7748 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7749
7750         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7751         Replace two_file_shared_1.so with two_file_shared_2.so.
7752         * testsuite/Makefile.in: Regenerated.
7753
7754 2009-12-08  Doug Kwan  <dougkwan@google.com>
7755
7756         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7757         (HFILES): Add attributes.h and int_encoding.h.
7758         * Makefile.in: Regenerate.
7759         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7760         function definitions to int_encoding.cc
7761         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7762         prototypes to int_encoding.h
7763         * reduced_debug_output.cc (int_encoding.h): New include.
7764         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7765         function definitions to int_encoding.cc
7766         (insert_into_vector, read_from_pointer): Move template definitions to
7767         int_encoding.h
7768         * attributes.cc: New file.
7769         * attributes.h: New file.
7770         * int_encoding.cc: New file.
7771         * int_encoding.h: New file.
7772
7773 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7774
7775         PR gold/11055
7776         * incremental-dump.cc (dump_incremental_inputs): New.
7777         (main): Use dump_incremental_inputs.
7778
7779 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7780
7781         PR gold/10893
7782         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7783         checking elfcpp::STT_FUNC.
7784         (Target_i386::Relocate::relocate): Likewise.
7785         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7786
7787         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7788         symbols from shared libraries into normal FUNC symbols.
7789
7790         * symtab.h (Symbol): Add is_func and use it.
7791
7792 2009-12-05  Doug Kwan  <dougkwan@google.com>
7793
7794         * arm.cc (Target_arm::arm_info): Initialize new fields
7795         attributes_section and attributes_vendor.
7796         * i386.cc (Target_i386::i386_info): Same.
7797         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7798         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7799         fields attributes_section and attributes_vendor.
7800         * sparc.cc (Target_sparc::sparc_info): Same.
7801         * target.h (Target::attributes_section, Target::attributes_vendor,
7802         Target::is_attributes_section, Target::attribute_arg_type,
7803         Target::attributes_order): New method definitions.
7804         (Target::Target_info::attributes_section,
7805         Target::Target_info::attributes_vendor): New fields.
7806         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7807         virtual method definitions.
7808         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7809         attributes_section and attributes_vendor.
7810         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7811
7812 2009-12-05  Doug Kwan  <dougkwan@google.com>
7813
7814         * arm.cc: Update comments about interworking and stub generation.
7815         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7816         considered as non-PIC.
7817         (Arm_relocate_functions::base_abs): Fix formatting.
7818         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7819         of function to use GOT entry address instead of offset.
7820         (Target_arm::Scan::global): Issue an error if a symbol would need a
7821         PLT does not get one because it is untyped.  Remove code to create
7822         dynamic symbols for relative branches.
7823         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7824         takes unsigned integer instead of boolean.
7825
7826 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7827
7828         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7829         (two_file_test_LDADD): Likewise.
7830         (common_test_1_LDADD): Likewise.
7831         (exception_test_LDADD) Likewise.
7832         (weak_test_LDADD): Likewise.
7833         (many_sections_test_LDADD): Likewise.
7834         (initpri1_LDADD): Likewise.
7835         (script_test_1_LDADD): Likewise.
7836         (script_test_2_LDADD): Likewise.
7837         (justsyms_LDADD): Likewise.
7838         (binary_test_LDADD): Likewise.
7839         (large_LDADD): Likewise.
7840         * testsuite/Makefile.in: Regenerated.
7841
7842 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7843
7844         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7845         (Symbol_table::override_with_special): Likewise.
7846         (Symbol_table::add_from_object): Likewise.
7847
7848 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7849
7850         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7851         Don't set the data_offset twice.
7852
7853 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7854
7855         * testsuite/Makefile.in: Regenerate.
7856
7857 2009-12-03  Doug Kwan  <dougkwan@google.com>
7858
7859         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7860         (Target_arm::do_finalize_sections): Add parameter for symbol table
7861         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7862         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7863         parameter for symbol table pointer.
7864         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7865         an additional parameter for a pointer to symbol table.
7866         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7867         parameter for a symbol table pointer.
7868         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7869         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7870         Ditto.
7871         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7872         parameter for a symbol table pointer.
7873
7874 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7875
7876         * incremental.cc (Incremental_inputs_header)
7877         (Incremental_inputs_header_write, Incremental_inputs_entry)
7878         (Incremental_inputs_entry_write): Move ...
7879         * incremental.h (Incremental_inputs_header)
7880         (Incremental_inputs_header_write, Incremental_inputs_entry)
7881         (Incremental_inputs_entry_write): here.
7882
7883 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7884
7885         * incremental.cc (make_sized_incremental_binary): Set the target.
7886         Error if it is incompatible.
7887         * output.h (Output_file): Add filename method.
7888
7889 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7890
7891         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7892         from the get_* methods.
7893
7894 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7895
7896         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7897         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7898         Write 0 for the data_offset of scripts.
7899
7900 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7901
7902         * testsuite/Makefile.am: Add the incremental_test.sh test.
7903         * testsuite/incremental_test.sh: New.
7904         * testsuite/incremental_test_1.c: New.
7905         * testsuite/incremental_test_2.c: New.
7906
7907 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7908
7909        * incremental-dump.cc (main): Fix typos.
7910
7911 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7912
7913         PR gold/11025
7914         * incremental-dump.cc (main): Use llu to print 64 bit values.
7915
7916 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7917             H.J. Lu  <hongjiu.lu@intel.com>
7918
7919         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7920         $(LIBDL).
7921         (incremental_dump_LDADD): Likewise.
7922         * Makefile.in: Regenerated.
7923
7924 2009-11-25  Doug Kwan  <dougkwan@google.com>
7925
7926         Revert:
7927
7928         2009-11-25  Doug Kwan  <dougkwan@google.com>
7929
7930                 * arm.cc (Target_arm::Target_arm): Move method definition
7931                 outside of class definition.  Add code to handle
7932                 --target1-rel, --target1-abs and --target2= options.
7933                 (Target_arm::get_reloc_reloc_type): Change method to be
7934                 non-static and const.
7935                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7936                 New data member declaration.
7937                 (Target_arm::Scan::local, Target_arm::Scan::global,
7938                 Target_arm::Relocate::relocate,
7939                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7940                 Adjust call to Target_arm::get_real_reloc_type.
7941                 (Target_arm::get_real_reloc_type): Use command line options
7942                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7943                 * options.h (--target1-rel, --target1-abs, --target2): New
7944                 ARM-only options.
7945
7946 2009-11-25  Doug Kwan  <dougkwan@google.com>
7947
7948         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7949         class definition.  Add code to handle --target1-rel, --target1-abs
7950         and --target2= options.
7951         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7952         and const.
7953         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7954         member declaration.
7955         (Target_arm::Scan::local, Target_arm::Scan::global,
7956         Target_arm::Relocate::relocate,
7957         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7958         call to Target_arm::get_real_reloc_type.
7959         (Target_arm::get_real_reloc_type): Use command line options to
7960         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7961         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7962         options.
7963
7964 2009-11-25  Doug Kwan  <dougkwan@google.com>
7965
7966         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7967         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7968         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7969         formatting.
7970         (Arm_relocate_functions::thm_call): Replace body with a call to
7971         Arm_relocate_functions::thumb_branch_common.
7972         (Arm_relocate_functions::thm_jump24,
7973         Arm_relocate_functions::thm_xpc22): New method definitions.
7974         (Arm_relocate_functions::thumb_branch_common): New method definition.
7975         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7976         operator.
7977         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7978         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7979
7980 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7981
7982         * Makefile.am: Build incremental-dump
7983         * Makefile.in: Regenerate.
7984         * incremental-dump.cc: New.
7985         * incremental.cc (Incremental_inputs_header_data,
7986         Incremental_inputs_entry_data): Move to incremental.h
7987         * incremental.h: (Incremental_inputs_header_data,
7988         Incremental_inputs_entry_data): Move from incremental.cc
7989
7990 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7991
7992         * incremental.cc (Incremental_inputs_header,
7993         Incremental_inputs_header_write, Incremental_inputs_entry,
7994         Incremental_inputs_entry_write): Add a typedef with the data type.
7995
7996 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7997
7998         * incremental.cc (Incremental_inputs_header,
7999         Incremental_inputs_header_write, Incremental_inputs_entry,
8000         Incremental_inputs_entry_write): Update comment about which
8001         type has the filed descriptions.
8002
8003 2009-11-15  Doug Kwan  <dougkwan@google.com>
8004
8005         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8006         (Arm_relocate_functions::arm_branch_common): Change method defintion
8007         in class definition to a method declaration and update list of formal
8008         parameters.
8009         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8010         Arm_relocation_functions::jump24): Adjust call to
8011         Arm_relocate_functions::arm_branch_common.  Update list of formal
8012         parameters.
8013         (Arm_relocate_functions::xpc25): New method definition.
8014         (Arm_relocate_functions::arm_branch_common): Move method defintion
8015         out from class definition.  Use stubs for mode-switching and extending
8016         branch ranges.
8017         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8018         specially.  Change code to enable use of stubs in ARM branches.
8019
8020 2009-11-10  Doug Kwan  <dougkwan@google.com>
8021
8022         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8023         in method declaration.
8024         (Target_arm::relocate_stub): New method declaration.
8025         (Target_arm::default_target): Change to return a pointer instead of
8026         a const reference.
8027         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8028         Target_arm::default_target.
8029         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8030         method definition.
8031         (Target_arm::relocate_section): Adjust view.
8032         (Target_arm::relocate_stub): New method definition.
8033
8034 2009-11-10  Doug Kwan  <dougkwan@google.com>
8035
8036         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8037         a format warning.
8038         * incremental.cc (open_incremental_binary): Initialized local
8039         variables to avoid warnings.
8040         * object.cc (make_elf_object): Ditto.
8041         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8042         a format warning.
8043
8044 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8045
8046         PR gold/10930
8047         * testsuite/plugin_test.c: Include "config.h".
8048
8049 2009-11-09  Doug Kwan  <dougkwan@google.com>
8050
8051         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8052         (arm_symbol_value): Remove.
8053         (Arm_relocate_functions::arm_branch_common,
8054         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8055         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8056         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8057         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8058         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8059         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8060         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8061         Arm_relocate_functions::thm_mobw_abs_nc,
8062         Arm_relocate_functions::thm_mov_abs,
8063         Arm_relocate_functions::movw_prel_nc,
8064         Arm_relocate_functions::thm_movt_abs,
8065         Arm_relocate_functions::movt_prel,
8066         Arm_relocate_functions::thm_movw_prel_nc,
8067         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8068         (Target_arm::Relocate::relocate): Only decompose address into two
8069         parts if relocation type uses the thumb-bit and pass the actual
8070         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8071         calls to methods in Arm_relocate_functions for this change.
8072
8073 2009-11-08  Ian Lance Taylor  <iant@google.com>
8074
8075         PR 10925
8076         * reloc.cc: Instantiate
8077         Sized_relobj::initialize_input_to_output_maps and
8078         Sized_relobj:free_input_to_output_maps.
8079
8080 2009-11-06  Ian Lance Taylor  <iant@google.com>
8081
8082         PR 10876
8083         * defstd.cc (in_segment): Set only_if_ref true for "end".
8084
8085 2009-11-06  Doug Kwan  <dougkwan@google.com>
8086
8087         * arm.cc (class Reloc_stub): Correct a comment.
8088         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8089         (Target_arm::scan_section_for_stubs): New method declaration.
8090         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8091         Change methods from private to protected.
8092         (Target_arm::do_may_relax): New method definition.
8093         (Target_arm::do_relax, Target_arm::group_sections,
8094         Target_arm::scan_reloc_for_stub,
8095         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8096         (Target_arm::arm_input_section_map_): New data member declaration.
8097         (Target_arm::scan_reloc_for_stub,
8098         Target_arm::scan_reloc_section_for_stubs,
8099         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8100         Target_arm::do_relax): New method definitions.
8101
8102 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8103
8104         * configure.ac: Check for (struct stat)::st_mtim
8105         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8106         * config.in: Regenerate.
8107         * configure: Regenerate.
8108
8109 2009-11-05  Ian Lance Taylor  <iant@google.com>
8110
8111         PR 10910
8112         * output.cc (Output_segment::add_output_section): Add missing
8113         return statement.
8114
8115 2009-11-04  Ian Lance Taylor  <iant@google.com>
8116
8117         PR 10880
8118         * object.h (class Object): Add is_needed and set_is_needed
8119         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8120         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8121         defined in a dynamic object and referenced by a regular object,
8122         set is_needed for the dynamic object.
8123         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8124         if the file is marked with as_needed and it is not needed.
8125
8126 2009-11-04  Ian Lance Taylor  <iant@google.com>
8127
8128         PR 10887
8129         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8130         tags if data is discarded by linker script.
8131         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8132         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8133         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8134         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8135
8136 2009-11-04  Ian Lance Taylor  <iant@google.com>
8137
8138         * layout.cc (Layout::get_output_section): Add is_interp and
8139         is_dynamic_linker_section parameters.  Change all callers.
8140         (Layout::choose_output_section): Likewise.
8141         (Layout::make_output_section): Likewise.
8142         (Layout::add_output_section_data): Add is_dynamic_linker_section
8143         parameter.  Change all callers.
8144         * layout.h (class Layout): Update declarations.
8145         * output.h (class Output_section): Add is_interp, set_is_interp,
8146         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8147         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8148         generate_code_fills_at_write_ to a bitfield.
8149         * output.cc (Output_section::Output_sections): Initialize new
8150         fields.
8151         (Output_segment::add_output_section): Add do_sort parameter.
8152         Change all callers.
8153
8154 2009-11-03  Ian Lance Taylor  <iant@google.com>
8155
8156         PR 10860
8157         * options.h (class General_options): Add --warn-common.
8158         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8159         merging two common symbols.
8160         (Symbol_table::should_override): Handle --warn-common when merging
8161         a common symbol with a defined symbol.  Use report_resolve_problem
8162         for multiple definitions.
8163         (Symbol_table::report_resolve_problem): New function.
8164         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8165
8166 2009-11-03  Doug Kwan  <dougkwan@google.com>
8167
8168         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8169         stub_factory_.
8170         (Target_arm::stub_factory): New method definition.
8171         (Target_arm::new_arm_input_section,
8172         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8173         Target_arm::reloc_uses_thumb_bit): New method declarations.
8174         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8175         New type definitions.
8176         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8177         member declarations.
8178         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8179         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8180         New method definitions.
8181
8182 2009-11-03  Ian Lance Taylor  <iant@google.com>
8183
8184         * options.h (class General_options): Add --warn_constructors.
8185
8186 2009-11-03  Ian Lance Taylor  <iant@google.com>
8187
8188         PR 10893
8189         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8190         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8191
8192 2009-11-03  Ian Lance Taylor  <iant@google.com>
8193
8194         PR 10895
8195         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8196         --msgid-bugs-address.
8197         (install-pdf): New target.
8198         (install-data_yes): Look up one directory to find mkinstalldirs.
8199
8200 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8201
8202         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8203         tree.
8204
8205 2009-10-30  Doug Kwan  <dougkwan@google.com>
8206
8207         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8208
8209 2009-10-30  Doug Kwan  <dougkwan@google.com>
8210
8211         * arm.cc (Stub_addend_reader): New struct template definition
8212         and partial specializations.
8213         (Stub_addend_reader::operator()): New method definition for a
8214         partially specialized template.
8215
8216 2009-10-30  Doug Kwan  <dougkwan@google.com>
8217
8218         * arm.cc (Arm_relobj::processor_specific_flags): New method
8219         definition.
8220         (Arm_relobj::do_read_symbols): New method declaration.
8221         (Arm_relobj::processor_specific_flags_): New data member declaration.
8222         (Arm_dynobj): New class definition.
8223         (Target_arm::do_finalize_sections): Add input_objects parameter.
8224         (Target_arm::do_adjust_elf_header): New method declaration.
8225         (Target_arm::are_eabi_versions_compatible,
8226         (Target_arm::merge_processor_specific_flags): New method declaration.
8227         (Target_arm::do_make_elf_object): New overloaded method definitions
8228         and declaration.
8229         (Arm_relobj::do_read_symbols): New method definition.
8230         (Arm_dynobj::do_read_symbols): Ditto.
8231         (Target_arm::do_finalize_sections): Add input_objects parameters.
8232         Merge processor-specific flags from all input objects.
8233         (Target_arm::are_eabi_versions_compatible,
8234         Target_arm::merge_processor_specific_flags,
8235         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8236         New method definitions.
8237         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8238         Input_objects pointer type parameter.
8239         * layout.cc (Layout::finalize): Pass input objects to target's.
8240         finalize_sections function.
8241         * output.cc (Output_file_header::do_sized_write): Set ELF file
8242         header's processor-specific flags.
8243         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8244         Input_objects pointer type parameter.
8245         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8246         * target.h (Input_objects): New forward class declaration.
8247         (Target::processor_specific_flags,
8248         Target::are_processor_specific_flags_sect): New method definitions.
8249         (Target::finalize_sections): Add input_objects parameter.
8250         (Target::Target): Initialize processor_specific_flags_ and
8251         are_processor_specific_flags_set_.
8252         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8253         parameter.
8254         (Target::set_processor_specific_flags): New method definition.
8255         (Target::processor_specific_flags_,
8256         Target::are_processor_specific_flags_set_): New data member
8257         declarations.
8258         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8259         Input_objects pointer type parameter.
8260
8261 2009-10-30  Doug Kwan  <dougkwan@google.com>
8262
8263         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8264
8265 2009-10-28  Ian Lance Taylor  <iant@google.com>
8266
8267         * object.h (class Relobj): Drop options parameter from
8268         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8269         do_scan_relocs, do_relocate.  Change all callers.
8270         (class Sized_relobj): Drop options parameters from
8271         do_gc_process_relocs, do_scan_relocs, do_relocate,
8272         do_relocate_sections, relocate_sections, emit_relocs_scan,
8273         emit_relocs_scan_reltype.  Change all callers.
8274         (struct Relocate_info): Remove options field and all references to
8275         it.
8276         * reloc.h (class Read_relocs): Remove options constructor
8277         parameter and options_ field.  Change all callers.
8278         (class Gc_process_relocs, class Scan_relocs): Likewise.
8279         (class Relocate_task): Likewise.
8280         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8281         all callers.
8282         (scan_relocatable_relocs): Likewise.
8283         * target.h (class Sized_target): Remove options parameter from
8284         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8285         all callers.
8286         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8287         callers.
8288         * arm.cc: Update functions to remove options parameters.
8289         * i386.cc: Likewise.
8290         * powerpc.cc: Likewise.
8291         * sparc.cc: Likewise.
8292         * x86_64.cc: Likewise.
8293         * testsuite/testfile.cc: Likewise.
8294
8295 2009-10-28  Doug Kwan  <dougkwan@google.com>
8296
8297         * arm.cc (Arm_relobj): New class definition.
8298         (Arm_relobj::scan_sections_for_stubs,
8299         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8300         New method definitions.
8301
8302 2009-10-28  Cary Coutant  <ccoutant@google.com>
8303
8304         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8305         (Plugin::cleanup_done_): New member.
8306         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8307         (Plugin_manager::cleanup_done_): Remove.
8308         (Plugin_manager::add_input_file): Edit error message.
8309         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8310         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8311
8312 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8313
8314         * fileread.cc: (File_read::View::~View): Use the new
8315         data_ownership_ filed.
8316         (File_read::~File_read): Dispose the new whole_file_view_.
8317         (File_read::open): Mmap the whole file if needed.
8318         (File_read::open): Use whole_file_view_ instead of contents_.
8319         (File_read::find_view): Use whole_file_view_ if applicable.
8320         (File_read::do_read): Use whole_file_view_ instead of contents_.
8321         (File_read::make_view): Use whole_file_view_ instead of contents_,
8322         update File_read::View::View call.
8323         (File_read::find_or_make_view): Update File_read::View::View
8324         call.
8325         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8326         remove contents_
8327         (File_read::View::Data_ownership): New enum.
8328         (File_read::View::View): Replace bool mapped_ with Data_ownership
8329         argument.
8330         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8331         (File_read::View::data_ownership_): New field.
8332         (File_read::contents_): Remove (replaced by whole_file_view_).
8333         (File_read::whole_file_view_): New field.
8334         * options.h (class General_options): Add --keep-files-mapped.
8335
8336 2009-10-27  Cary Coutant  <ccoutant@google.com>
8337
8338         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8339         * testsuite/Makefile.am (plugin_test_5): New test case.
8340         * testsuite/Makefile.in: Regenerate.
8341
8342 2009-10-25  Doug Kwan  <dougkwan@google.com>
8343
8344         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8345         from private to protected to allow access by child class.
8346         (Sized_relobj::do_relocate_sections): New method declaration.
8347         (Sized_relobj::relocate_sections): Virtualize.
8348         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8349         Sized_relobj::relocate_sections.  Instantiate template explicitly
8350         for different target sizes and endianity.
8351
8352 2009-10-24  Doug Kwan  <dougkwan@google.com>
8353
8354         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8355         (Arm_input_section::as_arm_input_section): New method.
8356         (Arm_output_section): New class definition.
8357         (Arm_output_section::create_stub_group,
8358         Arm_output_section::group_sections): New method definitions.
8359
8360 2009-10-22  Doug Kwan  <dougkwan@google.com>
8361
8362         * arm.cc (Arm_input_section): New class definition.
8363         (Arm_input_section::init, Arm_input_section:do_write,
8364         Arm_input_section::set_final_data_size,
8365         Arm_input_section::do_reset_address_and_file_offset): New method
8366         definitions.
8367
8368 2009-10-21  Doug Kwan  <dougkwan@google.com>
8369
8370         * arm.cc (Stub_table, Arm_input_section): New forward class
8371         declarations.
8372         (Stub_table): New class defintion.
8373         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8374         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8375         New method definition.
8376
8377 2009-10-21  Doug Kwan  <dougkwan@google.com>
8378
8379         * arm.cc: Update copyright comments.
8380         (Target_arm): New forward class template declaration.
8381         (Arm_address): New type.
8382         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8383         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8384         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8385         constants.
8386         (Insn_template): Same.
8387         (DEF_STUBS): New macro.
8388         (Stub_type): New enum type.
8389         (Stub_template): New class definition.
8390         (Stub): Same.
8391         (Reloc_stub): Same.
8392         (Stub_factory): Same.
8393         (Target_arm::Target_arm): Initialize may_use_blx_ and
8394         should_force_pic_veneer_.
8395         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8396         Target_arm::should_force_pic_veneer,
8397         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8398         Target_arm::using_thumb_only, Target_arm:;default_target): New
8399         method defintions.
8400         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8401         New data member declarations.
8402         (Insn_template::size, Insn_template::alignment): New method defintions.
8403         (Stub_template::Stub_template): New method definition.
8404         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8405         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8406         (Stub_factory::Stub_factory): New method definition.
8407         * gold.h (string_hash): New template.
8408         * output.h (Input_section_specifier::hash_value): Use
8409         gold::string_hash.
8410         (Input_section_specifier::string_hash): Remove.
8411         * stringpool.cc (Stringpool_template::string_hash): Use
8412         gold::string_hash.
8413
8414 2009-10-20  Doug Kwan  <dougkwan@google.com>
8415
8416         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8417         symbols of relaxed input sections.
8418         * output.h (Output_section::find_relaxed_input_section): Make
8419         method public.
8420
8421 2009-10-16  Doug Kwan  <dougkwan@google.com>
8422
8423         * dynobj.cc (Versions::Versions): Initialize version_script_.
8424         Only insert base version symbol definition for a shared object
8425         if version script defines any version versions.
8426         (Versions::define_base_version): New method definition.
8427         (Versions::add_def): Check that base version is not needed.
8428         (Versions::add_need): Define base version lazily.
8429         * dynobj.h (Versions::define_base_version): New method declaration.
8430         (Versions::needs_base_version_): New data member declaration.
8431         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8432         (check_DATA): Add no_version_test.stdout.
8433         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8434         New make rules.
8435         * testsuite/Makefile.in: Regenerate.
8436         * testsuite/no_version_test.c: New file.
8437         * testsuite/no_version_test.sh: Ditto.
8438
8439 2009-10-16  Doug Kwan  <dougkwan@google.com>
8440
8441         * expression.cc (class Segment_start_expression): New class definition.
8442         (Segment_start_expression::value): New method definition.
8443         (script_exp_function_segment_start): Return a new
8444         Segment_start_expression.
8445         * gold/script-c.h (script_saw_segment_start_expression): New function
8446         prototype.
8447         * script-sections.cc (Script_sections::Script_sections): Initialize
8448         SAW_SEGMENT_START_EXPRESSION_ to false.
8449         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8450         and -Tbbs options to specify section addresses if given in
8451         command line and no SEGMENT_START expression is seen in a script.
8452         * script-sections.h (Script_sections::saw_segment_start_expression,
8453         Script_sections::set_saw_segment_start_expression): New method
8454         definition.
8455         (Script_sections::saw_segment_start_expression_): New data member
8456         declaration.
8457         * script.cc (script_saw_segment_start_expression): New function.
8458         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8459         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8460         script_test_7.sh and script_test_8.sh.
8461         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8462         script_test_8.stdout.
8463         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8464         (script_test_6, script_test_6.stdout, script_test_7,
8465         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8466         * Makefile.in: Regenerate.
8467         * testsuite/script_test_6.sh: New file.
8468         * testsuite/script_test_6.t: Same.
8469         * testsuite/script_test_7.sh: Same.
8470         * testsuite/script_test_7.t: Same.
8471         * testsuite/script_test_8.sh: Same.
8472
8473 2009-10-16  Doug Kwan  <dougkwan@google.com>
8474
8475         * output.cc (Output_segment::set_section_list_address): Cast
8476         expressions to unsigned long long type to avoid format warnings.
8477
8478 2009-10-15  Ian Lance Taylor  <iant@google.com>
8479
8480         * script.cc (Script_options::add_symbol_assignment): Always add a
8481         dot assignment to script_sections_.
8482         * script-sections.cc (Script_sections::add_dot_assignment):
8483         Initialize if necessary.
8484
8485         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8486         program headers with no load segment if there is a linker script.
8487
8488         * layout.cc (Layout::set_segment_offsets): Align the file offset
8489         to the segment aligment for -N or -n with no load segment.
8490         * output.cc (Output_segment::add_output_section): Don't crash if
8491         the first section is a TLS section.
8492         (Output_segment::set_section_list_addresses): Print an error
8493         message if the address moves backward in a linker script.
8494         * script-sections.cc
8495         (Output_section_element_input::set_section_addresses): Don't
8496         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8497         (Orphan_output_section::set_section_addresses): Likewise.
8498
8499 2009-10-15  Doug Kwan  <dougkwan@google.com>
8500
8501         * layout.cc (Layout::finish_dynamic_section): Generate tags
8502         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8503         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8504         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8505
8506 2009-10-14  Ian Lance Taylor  <iant@google.com>
8507
8508         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8509         fields.
8510         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8511         data_shdr fields of relinfo.
8512         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8513         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8514         R_386_TLS_LDO_32, adjust based on section flags.
8515         (Target_i386::Relocate::fix_up_ldo): Remove.
8516
8517 2009-10-13  Ian Lance Taylor  <iant@google.com>
8518
8519         Add support for -pie.
8520         * options.h (class General_options): Add -pie and
8521         --pic-executable.
8522         (General_options::output_is_position_independent): Test -pie.
8523         (General_options::output_is_executable): Return true if not shared
8524         and not relocatable.
8525         (General_options::output_is_pie): Remove.
8526         * options.cc (General_options::finalize): Reject incompatible uses
8527         of -pie.
8528         * gold.cc (queue_middle_tasks): A -pie link is not static.
8529         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8530         * symtab.cc (Symbol::final_value_is_known): Return false if
8531         output_is_position_independent.
8532         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8533         output_is_position_independent.
8534         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8535         output_is_position_independent.
8536         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8537         output_is_position_independent.
8538         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8539         two_file_pie_test.
8540         (basic_pie_test.o, basic_pie_test): New targets.
8541         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8542         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8543         (two_file_pie_test): New target.
8544         * testsuite/Makefile.in: Rebuild.
8545         * README: Remove note saying that -pie is not supported.
8546
8547 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8548
8549         * options.h (class General_options): Add -init and -fini.
8550         * layout.cc (Layout::finish_dynamic_section): Emit
8551         given init and fini functions.
8552
8553 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8554
8555         * gc.h (gc_process_relocs): Check if icf is enabled using new
8556         function.
8557         * gold.cc (queue_initial_tasks): Likewise.
8558         (queue_middle_tasks): Likewise.
8559         * object.cc (do_layout): Likewise.
8560         * symtab.cc (is_section_folded): Likewise.
8561         * main.cc (main): Likewise.
8562         * reloc.cc (Read_relocs::run): Likewise.
8563         (Sized_relobj::do_scan_relocs): Likewise.
8564         * icf.cc (is_function_ctor_or_dtor): New function.
8565         (Icf::find_identical_sections): Check if function is ctor or dtor when
8566         safe icf is chosen.
8567         * options.h (General_options::icf): Change option to be an enum.
8568         (Icf_status): New enum.
8569         (icf_enabled): New method.
8570         (icf_safe_folding): New method.
8571         (set_icf_status): New method.
8572         (icf_status_): New variable.
8573         * (options.cc) (General_options::finalize): Set icf_status_.
8574         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8575         icf_test and icf_keep_unique_test to use the --icf enum flag.
8576         * testsuite/icf_safe_test.sh: New file.
8577         * testsuite/icf_safe_test.cc: New file.
8578
8579 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8580
8581         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8582         includes to gc.h and icf.h.
8583         * arm.cc: Include gc.h.
8584         * gold.cc: Likewise.
8585         * i386.cc: Likewise.
8586         * powerpc.cc: Likewise.
8587         * sparc.cc: Likewise.
8588         * x86_64.cc: Likewise.
8589         * gc.h: Include icf.h.
8590
8591 2009-10-11  Ian Lance Taylor  <iant@google.com>
8592
8593         * plugin.cc: Include "gold.h" before other header files.
8594
8595 2009-10-10  Chris Demetriou  <cgd@google.com>
8596
8597         * options.h (Input_file_argument::Input_file_type): New enum.
8598         (Input_file_argument::is_lib_): Replace with...
8599         (Input_file_argument::type_): New member.
8600         (Input_file_argument::Input_file_argument): Take Input_file_type
8601         'type' rather than boolean 'is_lib' as second argument.
8602         (Input_file_argument::is_lib): Use type_.
8603         (Input_file_argument::is_searched_file): New function.
8604         (Input_file_argument::may_need_search): Handle is_searched_file.
8605         * options.cc (General_options::parse_library): Support -l:filename.
8606         (General_options::parse_just_symbols): Update for Input_file_argument
8607         changes.
8608         (Command_line::process): Likewise.
8609         * archive.cc (Archive::get_file_and_offset): Likewise.
8610         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8611         * script.cc (read_script_file, script_add_file): Likewise.
8612         * fileread.cc (Input_file::Input_file): Likewise.
8613         (Input_file::will_search_for): Handle is_searched_file.
8614         (Input_file::open): Likewise.
8615         * readsyms.cc (Read_symbols::get_name): Likewise.
8616         * testsuite/Makefile.am (searched_file_test): New test.
8617         * testsuite/Makefile.in: Regenerate.
8618         * testsuite/searched_file_test.cc: New file.
8619         * testsuite/searched_file_test_lib.cc: New file.
8620
8621 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8622             Ian Lance Taylor  <iant@google.com>
8623
8624         * descriptor.cc: Include <cstdio> and "binary-io.h".
8625         (Descriptors::open): Open the files in binary mode always.
8626         * script.cc (Lex::get_token): Treat \r as whitespace.
8627
8628 2009-10-09  Ian Lance Taylor  <iant@google.com>
8629
8630         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8631
8632 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8633             Ian Lance Taylor  <iant@google.com>
8634
8635         * configure.ac: Check for readv function also.
8636         * fileread.cc (readv): Define if not HAVE_READV.
8637         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8638         does not exist.
8639         * config.in: Regenerate.
8640         * configure: Regenerate.
8641
8642 2009-10-09  Doug Kwan  <dougkwan@google.com>
8643
8644         * layout.cc (Layout::make_output_section): Call target hook to make
8645         ordinary output section.
8646         (Layout::finalize): Adjust parameter list of call the
8647         Target::may_relax().
8648         * layout.h (class Layout::section_list): New method.
8649         * merge.h (Output_merge_base::entsize): Change visibility to public.
8650         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8651         New methods.
8652         (Output_merge_string::do_is_string): New method.
8653         * object.cc (Sized_relobj::do_setup): renamed from
8654         Sized_relobj::set_up.
8655         * object.h (Sized_relobj::adjust_shndx,
8656         Sized_relobj::initializ_input_to_output_maps,
8657         Sized_relobj::free_input_to_output_maps): Change visibilities to
8658         protected.
8659         (Sized_relobj::setup): Virtualize.
8660         (Sized_relobj::do_setup): New method declaration.
8661         (Sized_relobj::invalidate_section_offset,
8662         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8663         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8664         * options.cc (parse_int): New function.
8665         * options.h (parse_int): New declaration.
8666         (DEFINE_int): New macro.
8667         (stub_group_size): New option.
8668         * output.cc (Output_section::Output_section): Initialize memebers
8669         merge_section_map_, merge_section_by_properties_map_,
8670         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8671         (Output_section::add_input_section): Handled deferred code-fill
8672         generation and remove an old comment.
8673         (Output_section::add_relaxed_input_section): New method definition.
8674         (Output_section::add_merge_input_section): Use merge section by
8675         properties map to speed to search.  Update merge section maps
8676         as appropriate.
8677         (Output_section::build_relaxation_map): New method definition.
8678         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8679         Same.
8680         (Output_section::relax_input_section): Renamed to
8681         Output_section::convert_input_sections_to_relaxed_sections and change
8682         interface to take a vector of pointers to relaxed sections.
8683         (Output_section::find_merge_section,
8684         Output_section::find_relaxed_input_section): New method definitions.
8685         (Output_section::is_input_address_mapped,
8686         Output_section::output_offset, Output_section::output_address):
8687         Use output section data maps to speed up searching.
8688         (Output_section::find_starting_output_address): Add comments.
8689         (Output_section::do_write,
8690         Output_section::write_to_postprocessing_buffer): Do code-fill
8691         generation as appropriate.
8692         (Output_section::get_input_sections): Invalidate relaxed input section
8693         map.
8694         (Output_section::restore_states): Adjust type of checkpoint .
8695         Invalidate relaxed input section map.
8696         * output.h (Output_merge_base): New class declaration.
8697         (Input_section_specifier): New class defintion.
8698         (class Output_relaxed_input_section) Change base class to
8699         Output_section_data_build.
8700         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8701         base class initializer.
8702         (Output_section::add_relaxed_input_section): New method declaration.
8703         (Output_section::Input_section): Change visibility to protected.
8704         (Output_section::Input_section::relobj,
8705         Output_section::Input_section::shndx): Handle relaxed input sections.
8706         Output_section::input_sections) Change visibility to protected.  Also
8707         define overload to return a non-const pointer.
8708         (Output_section::Merge_section_properties): New class defintion.
8709         (Output_section::Merge_section_by_properties_map,
8710         Output_section::Output_section_data_by_input_section_map,
8711         Output_section::Relaxation_map): New types.
8712         (Output_section::relax_input_section): Rename method to
8713         Output_section::convert_input_sections_to_relaxed_sections and change
8714         interface to take a vector of relaxed section pointers.
8715         (Output_section::find_merge_section,
8716         Output_section::find_relaxed_input_section,
8717         Output_section::build_relaxation_map,
8718         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8719         New method declarations.
8720         (Output_section::merge_section_map_
8721         Output_section::merge_section_by_properties_map_,
8722         Output_section::relaxed_input_section_map_,
8723         Output_section::is_relaxed_input_section_map_valid_,
8724         Output_section::generate_code_fills_at_write_): New data members.
8725         * script-sections.cc
8726         (Output_section_element_input::set_section_addresses): Call
8727         current_data_size and addralign methods of relaxed input sections.
8728         (Orphan_output_section::set_section_addresses): Call current_data_size
8729         and addralign methods of relaxed input sections.
8730         * symtab.cc (Symbol_table::compute_final_value): Extract template
8731         from the body of Symbol_table::sized_finalize_symbol.
8732         (Symbol_table::sized_finalized_symbol): Call
8733         Symbol_table::compute_final_value.
8734         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8735         (Symbol_table::compute_final_value): New templated method declaration.
8736         * target.cc (Target::do_make_output_section): New method defintion.
8737         * target.h (Target::make_output_section): New method declaration.
8738         (Target::relax): Add more parameters for input objects, symbol table
8739         and layout.  Adjust call to do_relax.
8740         (Target::do_make_output_section): New method declaration.
8741         (Target::do_relax): Add parameters for input objects, symbol table
8742         and layout.
8743
8744 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8745
8746         * pread.c: Include stdio.h.
8747
8748 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8749
8750         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8751         defined.
8752
8753 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8754
8755         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8756         Change read_shndx type to unsigned int.
8757         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8758         int.
8759         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8760         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8761         Change read_shndx type to unsigned int.
8762         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8763         int.
8764         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8765         * layout.cc (Layout::create_symtab_sections): Cast the result of
8766         local_symcount * symsize to off_t in the gold_assert.
8767
8768 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8769
8770         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8771         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8772         R_ARM_BASE_ABS.
8773         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8774         (Arm_relocate_functions::thm_abs5): New function.
8775         (Arm_relocate_functions::abs12): New function.
8776         (Arm_relocate_functions::abs16): New function.
8777         (Arm_relocate_functions::base_abs): New function.
8778         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8779         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8780         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8781         R_ARM_BASE_ABS.
8782         (Scan::global): Likewise.
8783         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8784         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8785         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8786         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8787         R_ARM_BASE_ABS.
8788
8789 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8790
8791         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8792         (Arm_relocate_functions::movt_prel): New function.
8793         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8794         (Arm_relocate_functions::thm_movt_prel): New function.
8795         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8796         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8797         (Scan::global, Relocate::relocate): Likewise.
8798         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8799
8800 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8801
8802         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8803         Incremental_checker.
8804         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8805         unsigned int.
8806         (class Incremental_inputs_header): New class.
8807         (Incremental_inputs_header_writer): Edit comment.
8808         (Incremental_inputs_entry): New class.
8809         (Incremental_inputs_entry_writer): Edit comment.
8810         (Sized_incremental_binary::do_find_incremental_inputs_section):
8811         Add *strtab_shndx parameter, fill it.
8812         (Sized_incremental_binary::do_check_inputs): New method.
8813         (Incremental_checker::can_incrementally_link_output_file): Use
8814         Sized_incremental_binary::check_inputs.
8815         (Incremental_inputs::report_command_line): Save command line in
8816         command_line_.
8817         * incremental.h:
8818         (Incremental_binary::find_incremental_inputs_section): New
8819         method.
8820         (Incremental_binary::do_find_incremental_inputs_section): Add
8821         strtab_shndx parameter.
8822         (Incremental_binary::do_check_inputs): New pure virtual method.
8823         (Sized_incremental_binary::do_check_inputs): Declare.
8824         (Incremental_checker::Incremental_checker): Add incremental_inputs
8825         parameter, use it to initialize incremental_inputs_.
8826         (Incremental_checker::incremental_inputs_): New field.
8827         (Incremental_checker::command_line): New method.
8828         (Incremental_checker::inputs): New method.
8829         (Incremental_checker::command_line_): New field.
8830
8831 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8832
8833         * incremental.cc: Include <cstdarg> and "target-select.h".
8834         (vexplain_no_incremental): New function.
8835         (explain_no_incremental): New function.
8836         (Incremental_binary::error): New method.
8837         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8838         method.
8839         (make_sized_incremental_binary): New function.
8840         (open_incremental_binary): New function.
8841         (can_incrementally_link_file): Add checks if output is ELF and has
8842         inputs section.
8843         * incremental.h: Include "elfcpp_file.h" and "output.h".
8844         (Incremental_binary): New class.
8845         (Sized_incremental_binary): New class.
8846         (open_incremental_binary): Declare.
8847         * object.cc (is_elf_object): Use
8848         elfcpp::Elf_recognizer::is_elf_file.
8849         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8850         * output.h (Output_file::filesize): New method.
8851
8852 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8853
8854         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8855         New function.
8856         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8857         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8858         function.
8859         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8860         function.
8861         (Arm_relocate_functions::movw_abs_nc): New function.
8862         (Arm_relocate_functions::movt_abs): New function.
8863         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8864         (Arm_relocate_functions::thm_movt_abs): New function.
8865         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8866         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8867         (Scan::global): Likewise.
8868         (Relocate::relocate): Likewise.
8869         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8870
8871 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8872
8873         * arm.cc (Arm_relocate_functions::got_prel) New function.
8874         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8875         (Relocate::relocate): Likewise.
8876         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8877
8878 2009-10-06  Ian Lance Taylor  <iant@google.com>
8879
8880         * options.h (class General_options): Define
8881         split_stack_adjust_size parameter.
8882         * object.h (class Object): Add uses_split_stack_ and
8883         has_no_split_stack_ fields.  Add uses_split_stack and
8884         has_no_split_stack accessor functions.  Declare
8885         handle_split_stack_section.
8886         (class Reloc_symbol_changes): Define.
8887         (class Sized_relobj): Define Function_offsets.  Declare
8888         split_stack_adjust, split_stack_adjust_reltype, and
8889         find_functions.
8890         * object.cc (Object::handle_split_stack_section): New function.
8891         (Sized_relobj::do_layout): Call handle_split_stack_section.
8892         * dynobj.cc (Sized_dynobj::do_layout): Call
8893         handle_split_stack_section.
8894         * reloc.cc (Sized_relobj::relocate_sections): Call
8895         split_stack_adjust for executable sections in split_stack
8896         objects.  Pass reloc_map to relocate_section.
8897         (Sized_relobj::split_stack_adjust): New function.
8898         (Sized_relobj::split_stack_adjust_reltype): New function.
8899         (Sized_relobj::find_functions): New function.
8900         * target-reloc.h: Include "object.h".
8901         (relocate_section): Add reloc_symbol_changes parameter.  Change
8902         all callers.
8903         * target.h (class Target): Add calls_non_split method.  Declare
8904         do_calls_non_split virtual method.  Declare match_view and
8905         set_view_to_nop.
8906         * target.cc: Include "elfcpp.h".
8907         (Target::do_calls_non_split): New function.
8908         (Target::match_view): New function.
8909         (Target::set_view_to_nop): New function.
8910         * gold.cc (queue_middle_tasks): Give an error if mixing
8911         split-stack and non-split-stack objects with -r.
8912         * i386.cc (Target_i386::relocate_section): Add
8913         reloc_symbol_changes parameter.
8914         (Target_i386::do_calls_non_split): New function.
8915         * x86_64.cc (Target_x86_64::relocate_section): Add
8916         reloc_symbol_changes parameter.
8917         (Target_x86_64::do_calls_non_split): New function.
8918         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8919         parameter.
8920         * powerpc.cc (Target_powerpc::relocate_section): Add
8921         reloc_symbol_changes parameter.
8922         * sparc.cc (Target_sparc::relocate_section): Add
8923         reloc_symbol_changes parameter.
8924         * configure.ac: Call AM_CONDITIONAL for the default target.
8925         * configure: Rebuild.
8926         * testsuite/Makefile.am (TEST_AS): New variable.
8927         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8928         (check_DATA): Add split_i386 and split_x86_64 files.
8929         (SPLIT_DEFSYMS): Define.
8930         (split_i386_[1234n].o): New targets.
8931         (split_i386_[124]): New targets.
8932         (split_i386_[1234r].stdout): New targets.
8933         (split_x86_64_[1234n].o): New targets.
8934         (split_x86_64_[124]): New targets.
8935         (split_x86_64_[1234r].stdout): New targets.
8936         (MOSTLYCLEANFILES): Add new executables.
8937         * testsuite/split_i386.sh: New file.
8938         * testsuite/split_x86_64.sh: New file.
8939         * testsuite/split_i386_1.s: New file.
8940         * testsuite/split_i386_2.s: New file.
8941         * testsuite/split_i386_3.s: New file.
8942         * testsuite/split_i386_4.s: New file.
8943         * testsuite/split_i386_n.s: New file.
8944         * testsuite/split_x86_64_1.s: New file.
8945         * testsuite/split_x86_64_2.s: New file.
8946         * testsuite/split_x86_64_3.s: New file.
8947         * testsuite/split_x86_64_4.s: New file.
8948         * testsuite/split_x86_64_n.s: New file.
8949         * testsuite/testfile.cc (Target_test): Update relocation_section
8950         function.
8951         * testsuite/Makefile.in: Rebuild.
8952
8953 2009-10-06  Ian Lance Taylor  <iant@google.com>
8954
8955         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8956         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8957         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8958         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8959         the address on ldo_addrs_.
8960         (Target_i386::Relocate::fix_up_ldo): New function.
8961
8962 2009-10-06   Rafael Espindola  <espindola@google.com>
8963
8964         * plugin.cc (add_input_library): New.
8965         (Plugin::load): Add add_input_library to tv.
8966         (Plugin_manager::add_input_file): Add the is_lib argument.
8967         (add_input_file): Update call to Plugin_manager::add_input_file.
8968         (add_input_library): New.
8969         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8970
8971 2009-09-30  Doug Kwan  <dougkwan@google.com>
8972
8973         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8974         symbol and call Symbol::may_need_copy_reloc to determine if
8975         a copy reloc is needed.
8976         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8977         nocopyreloc is given in command line.
8978         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8979         given in command line.
8980         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8981         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8982         of the removed Target_i386::may_need_copy_reloc.
8983         * options.h (copyreloc): New option with default value false.
8984         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8985         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8986         instead of the removed Target_powerpc::may_need_copy_reloc.
8987         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8988         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8989         instead of the removed Target_sparc::may_need_copy_reloc.
8990         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8991         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8992         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8993         instead of the removed Target_x86_64::may_need_copy_reloc.
8994
8995 2009-09-30  Ian Lance Taylor  <iant@google.com>
8996
8997         * object.h (class Object): Remove target_ field, and target,
8998         sized_target, and set_target methods.
8999         (Object::sized_target): Remove.
9000         (class Sized_relobj): Update declarations.  Remove sized_target.
9001         * object.cc (Sized_relobj::setup): Remove target parameter.
9002         Change all callers.
9003         (Input_objects::add_object): Don't do anything with the target.
9004         (make_elf_sized_object): Add punconfigured parameter.  Change all
9005         callers.  Set or test parameter target.
9006         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9007         Change all callers.
9008         * parameters.cc (Parameters::set_target): Change parameter type to
9009         be non-const.
9010         (Parameters::default_target): Remove.
9011         (set_parameters_target): Change parameter type to be non-const.
9012         (parameters_force_valid_target): New function.
9013         (parameters_clear_target): New function.
9014         * parameters.h (class Parameters): Update declarations.  Remove
9015         default_target method.  Add sized_target and clear_target
9016         methods.  Change target_ to be non-const.
9017         (set_parameters_target): Update declaration.
9018         (parameters_force_valid_target): Declare.
9019         (parameters_clear_target): Declare.
9020         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9021         as NULL if we aren't searching.
9022         (Add_symbols::run): Don't check for compatible target.
9023         * fileread.cc (Input_file::open_binary): Call
9024         parameters_force_valid_target.
9025         * gold.cc (queue_middle_tasks): Likewise.
9026         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9027         set_target on object.
9028         * dynobj.h (class Sized_dynobj): Update declarations.
9029         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9030         make_elf_object returns NULL.
9031         (Archive::include_member): Don't check whether object target is
9032         compatible.
9033         * output.cc (Output_section::add_input_section): Get target from
9034         parameters.
9035         (Output_section::relax_input_section): Likewise.
9036         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9037         parameters.
9038         (Sized_relobj::do_scan_relocs): Likewise.
9039         (Sized_relobj::relocate_sections): Likewise.
9040         * resolve.cc (Symbol_table::resolve): Likewise.
9041         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9042         parameter.  Change all callers.
9043         (Symbol_table::add_from_object): Get target from parameters.
9044         (Symbol_table::add_from_relobj): Don't check object target.
9045         (Symbol_table::add_from_dynobj): Likewise.
9046         (Symbol_table::define_special_symbol): Get target from
9047         parameters.
9048         * symtab.h (class Symbol_table): Update declaration.
9049         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9050         parameter.  Change all callers.  Clear parameter target.
9051         (Binary_test): Test target here.
9052         * testsuite/object_unittest.cc (gold_testsuite): Remove
9053         target_test_pointer parameter.  Change all callers.
9054         (Object_test): Test target here.
9055
9056 2009-09-26  Ian Lance Taylor  <iant@google.com>
9057
9058         * testsuite/initpri1.c: Don't try to use constructor priorities if
9059         compiling with gcc before 4.3.
9060
9061 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9062
9063         * testsuite/retain_symbols_file_test.sh (check_present): Change
9064         output file name to retain_symbols_file_test.stdout.
9065         (check_absent): Likewise.
9066
9067 2009-09-18  Craig Silverstein  <csilvers@google.com>
9068
9069         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9070         * options.cc: Include <cerrno> and <fstream>.
9071         (General_options::finalize): Parse -retain-symbols-file tag.
9072         * options.h: New flag.
9073         (General_options): New method should_retain_symbol, new
9074         variable symbols_to_retain.
9075         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9076         should_retain_symbol map.
9077         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9078         * testsuite/Makefile.in: Regenerate.
9079         * testsuite/retain_symbols_file_test.sh: New file.
9080
9081 2009-09-18  Nick Clifton  <nickc@redhat.com>
9082
9083         * po/es.po: Updated Spanish translation.
9084
9085 2009-09-17  Doug Kwan  <dougkwan@google.com>
9086
9087         * debug.h (DEBUG_RELAXATION): New constant.
9088         (DEBUG_ALL): Add DEBUG_RELAXATION.
9089         (debug_string_to_enum): Add relaxation debug option.
9090         * layout.cc
9091         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9092         Layout::Relaxation_debug_check::read_sections,
9093         Layout::Relaxation_debug_check::read_sections): New method definitions.
9094         (Layout::Layout): Initialize data members
9095         record_output_section_data_from_scrips_,
9096         script_output_section_data_list_ and relaxation_debug_check_.
9097         (Layout::save_segments, Layout::restore_segments,
9098         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9099         Layout::relaxation_loop_body): New method definitions.
9100         (Layout::finalize): Support relaxation.  Move section layout code to
9101         Layout::relaxation_loop_body.
9102         (Layout::set_asection_address_from_script): Move code for orphan
9103         section placement out.
9104         (Layout::place_orphan_sections_in_script): New method definition.
9105         * layout.h (Output_segment_headers, Output_file_header):
9106         New forward class declarations.
9107         (Layout::~Layout): Define.
9108         (Layout::new_output_section_data_from_script): New method definition.
9109         (Layout::place_orphan_sections_in_script): New method declaration.
9110         (Layout::Segment_states): New type declaration.
9111         (Layout::save_segments, Layout::restore_segments,
9112         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9113         Layout::relaxation_loop_body): New method declarations.
9114         (Layout::Output_section_data_list): New type declaration.
9115         (Layout::Relaxation_debug_check): New class definition.
9116         (Layout::record_output_section_data_from_script_,
9117         Layout::script_output_section_data_list_, Layout::segment_states_,
9118         Layout::relaxation_debug_check_): New data members.
9119         * output.cc: (Output_section_headers::do_size): New method definition.
9120         (Output_section_headers::Output_section_headers): Move size
9121         computation to Output_section_headers::do_size.
9122         (Output_segment_headers::do_size): New method definition.
9123         (Output_file_header::Output_file_header): Move size computation to
9124         Output_file_header::do_size and call it.
9125         (Output_file_header::do_size): New method definition.
9126         (Output_data_group::Output_data_group): Adjust call to
9127         Output_section_data.
9128         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9129         (Output_symtab_xindex::do_write): Add array bound check.
9130         (Output_section::Input_section::print_to_mapfile): Handle
9131         RELAXED_INPUT_SECTION_CODE.
9132         (Output_section::Output_section): Initialize data member checkpoint_.
9133         (Output_section::~Output_section): Delete checkpoint object pointed
9134         by checkpoint_.
9135         (Output_section::add_input_section): Always add an Input_section if
9136         relaxing.
9137         (Output_section::add_merge_input_section): Add assert.
9138         (Output_section::relax_input_section): New method definition.
9139         (Output_section::set_final_data_size): Set load address to zero for
9140         an unallocated section.
9141         (Output_section::do_address_and_file_offset_have_reset_values):
9142         New method definition.
9143         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9144         Handle relaxed input section.
9145         (Output_section::sort_attached_input_sections): Checkpoint input
9146         section list lazily.
9147         (Output_section::get_input_sections): Change type of input_sections to
9148         list of Simple_input_section pointers.  Checkpoint input section list
9149         lazily.  Also handle relaxed input sections.
9150         (Output_section::add_input_section_for_script): Take a reference to
9151         a Simple_input_section object instead of Relobj pointer and section
9152         index as parameter.  Handle relaxed input sections.
9153         (Output_section::save_states, Output_section::restore_states): New
9154         method definitions.
9155         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9156         (Output_data::is_data_size_fixed): New method definition.
9157         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9158         if it is fixed.
9159         (Output_data::address_and_file_offset_have_reset_values): New method
9160         definition.
9161         (Output_data::do_address_and_file_offset_have_reset_values): New method
9162         definition.
9163         (Output_data::set_data_size): Check that data size is not fixed.
9164         (Output_data::fix_data_size): New method definition.
9165         (Output_data::is_data_size_fixed_): New data member.
9166         (Output_section_headers::set_final_data_size): New method definition.
9167         (Output_section_headers::do_size): New method declaration.
9168         (Output_segment_headers::set_final_data_size): New method definition.
9169         (Output_segment_headers::do_size): New method declaration.
9170         (Output_file_header::set_final_data_size)::New method definition.
9171         (Output_file_header::do_size)::New method declaration.
9172         (Output_section_data::Output_section_data): Add new parameter
9173         is_data_size_fixed and use it to fix data size.
9174         (Output_data_const::Output_data_const): Adjust call to base class
9175         constructor and fix data size.
9176         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9177         base class constructor and fix data size.
9178         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9179         base class constructor and fix data size.
9180         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9181         class constructor and fix data size.
9182         (Output_data_group::set_final_data_size): New method definition.
9183         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9184         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9185         class constructor and fix data size.
9186         (Output_relaxed_input_section): New class definition.
9187         (Output_section::Simple_input_section): New class definition.
9188         (Output_section::get_input_sections): Adjust parameter list.
9189         (Output_section::add_input_section_for_script): Same.
9190         (Output_section::save_states, Output_section::restore_states,
9191         Output_section::do_address_and_file_offset_have_reset_values,
9192         (Output_section::Input_section::Input_section): Handle
9193         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9194         Output_relaxed_input_section.
9195         (Output_section::Input_section::is_input_section,
9196         Output_section::Input_section::set_output_section): Handle relaxed
9197         input section.
9198         (Output_section::Input_section::is_relaxed_input_section,
9199         Output_section::Input_section::output_section_data,
9200         Output_section::Input_section::relaxed_input_section): New method
9201         definitions.
9202         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9203         value.
9204         (Output_section::Input_section::u1_): Update comments.
9205         (Output_section::Input_section::u2_): Add new union member poris.
9206         (Output_section::Checkpoint_output_section): New classs definition.
9207         (Output_section::relax_input_section): New method declaration.
9208         (Output_section::checkpoint_): New data member.
9209         (Output_segment): Update comments.
9210         (Output_segment::Output_segment): Un-privatize copy constructor.
9211         (Output_segment::operator=): Un-privatize.
9212         * script-sections.cc (Output_section_element::Input_section_list):
9213         Change element type to Output_section::Simple_input_section.
9214         (Output_section_element_dot_assignment::set_section_addresses):
9215         Register output section data for relaxation clean up.
9216         (Output_data_exression::Output_data_expression): Adjust call to base
9217         constructor to fix data size.
9218         (Output_section_element_data::set_section_addresses): Register
9219         Output_data_expression object for relaxation clean up.
9220         (struct Input_section_info): Replace Relobj pointer and section index
9221         pair with Output_section::Simple_input_section and Convert struct to a
9222         class.
9223         (Input_section_sorter::operator()): Adjust access to
9224         Input_section_info data member to use accessors.
9225         (Output_section_element_input::set_section_addresses): Use layout
9226         parameter.  Adjust code to use Output_section::Simple_input_section
9227         and Input_secction_info classes.  Register filler for relaxation
9228         clean up.
9229         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9230         and section index pair with Output_section::Simple_input_section
9231         class.  Adjust code accordingly.
9232         (Phdrs_element::release_segment): New method definition.
9233         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9234         segment list.
9235         (Script_sections::release_segments): New method definition.
9236         * gold/script-sections.h (Script_sections::release_segments): New
9237         method declaration.
9238         * gold/target.h (Target::may_relax, Target::relax,
9239         Target::do_may_relax, Target::do_relax): New method definitions.
9240
9241 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9242
9243         * arm.cc (has_signed_unsigned_overflow): New function.
9244         (Arm_relocate_functions::abs8): New function.
9245         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9246         (Target_arm::Scan::global): Likewise.
9247         (Target_arm::relocate::relocate): Likewise.
9248         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9249         Likewise.
9250
9251 2009-09-16  Cary Coutant  <ccoutant@google.com>
9252
9253         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9254         * testsuite/Makefile.in: Regenerate.
9255
9256 2009-09-11  Nick Clifton  <nickc@redhat.com>
9257
9258         * po/gold.pot: Updated by the Translation project.
9259
9260 2009-09-08  Cary Coutant  <ccoutant@google.com>
9261
9262         * output.cc (Output_file::open): Add execute permission to empty file.
9263         * testsuite/Makefile.am (permission_test): New test.
9264         * testsuite/Makefile.in: Regenerate.
9265
9266 2009-09-02  Ian Lance Taylor  <iant@google.com>
9267
9268         * output.cc (Output_file::resize): Call map_no_anonymous rather
9269         than map.
9270
9271 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9272
9273         * gold.cc: Include "incremental.h".
9274         (queue_initial_tasks): Call Incremental_checker methods.
9275         * incremental.cc: Include "output.h".
9276         (Incremental_checker::can_incrementally_link_output_file): New
9277         method.
9278         * incremental.h (Incremental_checker): New class.
9279
9280         * output.cc (Output_file::open_for_modification): New method.
9281         (Output_file::map_anonymous): Changed return type to bool.  Record
9282         map in base_ field.
9283         (Output_file::map_no_anonymous): New method, broken out of map.
9284         (Output_file::map): Use map_no_anonymous and map_anonymous.
9285         * output.h (class Output_file): Update declarations.
9286
9287 2009-08-24  Cary Coutant  <ccoutant@google.com>
9288
9289         * options.h (Command_line::Pre_options): New class.
9290         (Command_line::pre_options): New member.
9291         * options.cc (gold::options::ready_to_register): New variable.
9292         (One_option::register_option): Do nothing if not registering options.
9293         Assert if same short option registered twice.
9294         (General_options::General_options): Turn off option registration when
9295         done constructing.
9296         (Command_line::Pre_options::Pre_options): New constructor.
9297
9298 2009-08-24  Cary Coutant  <ccoutant@google.com>
9299
9300         * options.h (General_options::no_keep_memory): Remove incorrect
9301         short option.
9302
9303 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9304
9305         * Makefile.am (am__skiplex, am__skipyacc): New.
9306         * Makefile.in: Regenerate.
9307
9308 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9309
9310         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9311         (INCLUDES): ... this.
9312         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9313         (AM_CPPFLAGS): Renamed from ...
9314         (INCLUDE): ... this.
9315         * Makefile.in, testsuite/Makefile.in: Regenerate.
9316
9317         * Makefile.in: Regenerate.
9318         * aclocal.m4: Likewise.
9319         * config.in: Likewise.
9320         * configure: Likewise.
9321         * testsuite/Makefile.in: Likewise.
9322
9323         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9324         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9325         * Makefile.in: Regenerate.
9326         * testsuite/Makefile.in: Regenerate.
9327
9328 2009-08-19  Cary Coutant  <ccoutant@google.com>
9329
9330         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9331         symbols in shared libraries overridden by hidden or internal symbols
9332         in the main program.
9333
9334 2009-08-19  Chris Demetriou  <cgd@google.com>
9335
9336         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9337         checking source file names in error messages.
9338
9339 2009-08-18  Doug Kwan  <dougkwan@google.com>
9340
9341         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9342         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9343         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9344         an elfcpp::Ehdr as parameter.
9345         * object.cc (Object::set_target): Remove the version that looks up
9346         a target and sets it.
9347         (Sized_relobj::setup): Take a Target object instead of
9348         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9349         (make_elf_sized_object): Find target and ask target to
9350         make an ELF object.
9351         * object.h: (Object::set_target): Remove the version that looks up
9352         a target and sets it.
9353         (Sized_relobj::setup): Take a Target object instead of
9354         an elfcpp:Ehdr as parameter.
9355         * target.cc: Include dynobj.h.
9356         (Target::do_make_elf_object_implementation): New.
9357         (Target::do_make_elf_object): New.
9358         * target.h (Target::make_elf_object): New template declaration.
9359         (Target::do_make_elf_object): New method declarations.
9360         (Target::do_make_elf_object_implementation): New template declaration.
9361
9362 2009-08-14  Ian Lance Taylor  <iant@google.com>
9363
9364         * gold.h (FUNCTION_NAME): Define.
9365         (gold_unreachable): Use FUNCTION_NAME.
9366
9367 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9368
9369         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9370         symbol in the --keep-unique list is not found.
9371
9372 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9373
9374         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9375         been maked as --keep-unique.
9376         (Icf::unfold_section): New function.
9377         * icf.h (Icf::unfold_section): New function.
9378         * options.h (General_options::keep_unique): New option.
9379         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9380         * testsuite/Makefile.in: Regenerate.
9381         * testsuite/icf_keep_unique_test.sh: New file.
9382         * testsuite/icf_keep_unique_test.cc: New file.
9383
9384 2009-08-12  Cary Coutant  <ccoutant@google.com>
9385
9386         PR 10471
9387         * resolve.cc (Symbol_table::resolve): Check for references from
9388         dynamic objects to hidden and internal symbols.
9389         * testsuite/Makefile.am (hidden_test.sh): New test.
9390         * testsuite/Makefile.in: Regenerate.
9391         * testsuite/hidden_test.sh: New script.
9392         * testsuite/hidden_test_1.c: New test source.
9393         * testsuite/hidden_test_main.c: New test source.
9394
9395 2009-08-11  Doug Kwan  <dougkwan@google.com>
9396
9397         * arm.cc: Update comments.
9398         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9399         segment to locate the .ARM.exidx section if present.
9400
9401 2009-08-09  Doug Kwan  <dougkwan@google.com>
9402
9403         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9404         patch.
9405
9406 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9407         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9408         compiler warnings.
9409
9410 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9411
9412         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9413         valid tls_segment only for non-debug-section relocations.
9414         * testsuite/Makefile.am: Add gc_tls_test.
9415         * testsuite/Makefile.in: Regenerate.
9416         * testsuite/gc_tls_test.cc: New file.
9417         * testsuite/gc_tls_test.sh: New file.
9418
9419 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9420
9421         * icf.cc: New file.
9422         * icf.h: New file.
9423         * Makefile.am (CCFILES): Add icf.cc.
9424         (HFILES): Add icf.h
9425         * Makefile.in: Regenerate.
9426         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9427         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9428         section, symbol and addend information for the relocs.
9429         * gold.cc (queue_middle_tasks): Call identical code folding.
9430         * gold.h: Add defines for multimap.
9431         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9432         to the call of finalize_local_symbols.
9433         * main.cc (main): Create object of class Icf.
9434         * object.cc (Sized_relobj::do_layout): Allow this function to be
9435         called twice during icf.
9436         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9437         to sections marked as identical by icf.
9438         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9439         when available.
9440         (Sized_relobj::do_section_entsize): New function.
9441         * object.h (Object::section_entsize): New function.
9442         (Object::do_section_entsize): New pure virtual function.
9443         (Relobj::finalize_local_symbols): Add new parameter.
9444         (Relobj::do_section_entsize): New function.
9445         * options.h (General_options::icf): New option.
9446         (General_options::icf_iterations): New option.
9447         (General_options::print_icf_sections): New option.
9448         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9449         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9450         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9451         icf.
9452         * symtab.cc (Symbol_table::is_section_folded): New function.
9453         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9454         to sections marked as identical by icf.
9455         * symtab.h (Symbol_table::set_icf): New function.
9456         (Symbol_table::icf): New function.
9457         (Symbol_table::is_section_folded): New function.
9458         (Symbol_table::icf_): New data member.
9459         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9460         * testsuite/Makefile.am: Add commands to build icf_test.
9461         * testsuite/Makefile.in: Regenerate.
9462         * testsuite/icf_test.sh: New file.
9463         * testsuite/icf_test.cc: New file.
9464
9465 2009-07-24  Chris Demetriou  <cgd@google.com>
9466
9467         * layout.cc (is_compressible_debug_section): Fix incorrect
9468         comment about compressed section names.
9469
9470 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9471
9472         PR 10419
9473         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9474
9475 2009-07-16  Ian Lance Taylor  <iant@google.com>
9476
9477         PR 10400
9478         * layout.h: #include <map>.
9479         (class Kept_section): Change from struct to class.  Add accessors
9480         and setters.  Add section size to Comdat_group mapping.  Change
9481         Comdat_group to std::map.  Add is_comdat_ field.  Add
9482         linkonce_size field in union.
9483         (class Layout): Update declaration of find_or_add_kept_section.
9484         Don't declare find_kept_object.
9485         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9486         parameter.  Add object, shndx, is_comdat, and is_group_name
9487         parameters.  Change all callers.  Adjust for new Kept_section.
9488         (Layout::find_kept_object): Remove.
9489         * object.cc (Sized_relobj::include_section_group): Update use of
9490         Kept_section.  Rename secnum to shndx.  Only record
9491         Kept_comdat_section if sections are the same size.
9492         (Sized_relobj::include_linkonce_section): Update use of
9493         Kept_section.  Only record Kept_comdat_section if sections are the
9494         same size.  Set size of linkonce section.
9495         (Sized_relobj::map_to_kept_section): Update call to
9496         get_kept_comdat_section.
9497         * object.h (class Sized_relobj): Rename fields in
9498         Kept_comdat_section to drop trailing underscores; change object
9499         field to Relobj*.  Change Kept_comdat_section_table to store
9500         struct rather than pointer.
9501         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9502         Add kept_object and kept_shndx parameters.  Change all callers.
9503         (Sized_relobj::get_kept_comdat_section): Change return type to
9504         bool.  Add kept_object and kept_shndx parameters.  Change all
9505         callers.
9506         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9507         Layout::find_or_add_kept_section.
9508
9509 2009-07-09  Ian Lance Taylor  <iant@google.com>
9510
9511         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9512         Reserve space in the hash table.
9513
9514 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9515
9516         * fileread.cc (File_read::get_mtime): New method.
9517         * fileread.h (Timespec): New structure.
9518         (File_read::get_mtime): New method.
9519         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9520         Renamed from timestamp_nsec.
9521         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9522         Elf_Xword.
9523         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9524         timestamp_nsec.
9525         (Incremental_inputs::report_archive): Save mtime; style fix.
9526         (Incremental_inputs::report_obejct): Save mtime; style fix.
9527         (Incremental_inputs::report_script): Save mtime; style fix.
9528         (Incremental_inputs::finalize_inputs): Style fix.
9529         (Incremental_inputs::finalize): Style fix.
9530         (Incremental_inputs::create_input_section_data): Store inputs
9531         mtime.
9532         * incremental.h (Incremental_inputs::report_script): Add mtime
9533         argument.
9534         (Incremental_inputs::Input_info::Input_info): Intialize only one
9535         union member.
9536         (Incremental_inputs::Input_info::archive): Move to nameless
9537         union.
9538         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9539         (Incremental_inputs::Input_info::script): Move to nameless union.
9540         (Incremental_inputs::mtime): New field.
9541         * script.cc (read_input_script): Pass file mtime to
9542         Incremental_input.
9543         * script.h (Script_info::inputs): Style fix.
9544
9545 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9546
9547         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9548         instead of 32.
9549
9550 2009-06-24  Ian Lance Taylor  <iant@google.com>
9551
9552         PR 10156
9553         * layout.cc (Layout::choose_output_section): If we find an
9554         existing section, update the flags.
9555         (Layout::create_notes): New function, broken out of
9556         Layout::finalize.
9557         (Layout::finalize): Don't create note sections.
9558         (Layout::create_note): Don't crash if linker script discards
9559         section.
9560         (Layout::create_gold_note): Likewise.
9561         (Layout::create_build_id): Likewise.  Don't set
9562         after_input_sections on the section.
9563         (Layout::create_executable_stack_info): Remove target parameter.
9564         Change caller.
9565         * layout.h (class Layout): Declare create_notes.  Update
9566         declaration of create_executable_stack_info.
9567         * gold.cc (queue_middle_tasks): Call create_notes.
9568         * output.cc (Output_section::update_flags_for_input_section): Move
9569         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9570         invalid.
9571         * output.h (Output_data::mark_address_invalid): New function.
9572         (class Output_section): Only declare, not define,
9573         update_flags_for_input_section.  Remove set_flags.
9574
9575 2009-06-24  Ian Lance Taylor  <iant@google.com>
9576
9577         * script-sections.cc (Output_section_definition::
9578         set_section_addresses): Rename shadowing local load_address to
9579         laddr.
9580
9581 2009-06-24  Ian Lance Taylor  <iant@google.com>
9582
9583         PR 10244
9584         * reloc.cc (relocate_sections): Skip empty relocation sections.
9585
9586 2009-06-23  Ian Lance Taylor  <iant@google.com>
9587
9588         PR 10156
9589         * layout.cc (Layout::create_note): Use choose_output_section
9590         rather than make_output_section.
9591
9592 2009-06-23  Ian Lance Taylor  <iant@google.com>
9593
9594         PR 10237
9595         * options.cc (General_options::parse_V): Set printed_version_.
9596         (General_options::General_options): Initialize printed_version_.
9597         * options.h (class General_options): Add printed_version_ field.
9598         * gold.cc (queue_initial_tasks): If there are no input files,
9599         don't give a fatal error if we printed the version information.
9600         (queue_middle_tasks): If using -r with a shared object, give a
9601         fatal error rather than an ordinary error.
9602
9603 2009-06-23  Ian Lance Taylor  <iant@google.com>
9604
9605         PR 10219
9606         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9607         (Layout::make_output_section): Set have_stabstr_section_ if we see
9608         a .stab*str section.
9609         (Layout::finalize): Call link_stabs_sections.
9610         (Layout::link_stabs_sections): New file.
9611         * layout.h (class Layout): Add have_stabstr_section_ field.
9612         Declare link_stabs_sections.
9613
9614 2009-06-23  Doug Kwan  <dougkwan@google.com>
9615
9616         * Makefile.am (libgold_a_LIBADD): New.
9617         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9618         * Makefile.in: Regenerate.
9619         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9620         * configure: Regenerate.
9621         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9622         * fileread.cc: Include sys/state.h
9623         * gold.h: Declare memmem and strndup if found missing.
9624         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9625
9626 2009-06-23  Ian Lance Taylor  <iant@google.com>
9627
9628         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9629         * configure: Rebuild.
9630
9631 2009-06-23  Ian Lance Taylor  <iant@google.com>
9632
9633         PR 10147
9634         * object.cc (Object::section_contents): Don't try to get a view if
9635         the section has length zero.
9636         (Object::handle_gnu_warning_section): If the section is empty, use
9637         the name of the section as the warning.
9638
9639 2009-06-23  Ian Lance Taylor  <iant@google.com>
9640
9641         PR 10133
9642         * stringpool.h (class Stringpool_template): Add optimize_ field.
9643         (Stringpool_template::set_optimize): New function.
9644         * stringpool.cc (Stringpool_template::Stringpool_template):
9645         Initialize optimize_ field.
9646         (Stringpool_template::set_string_offsets): Test local optimize
9647         fild rather than parameter.
9648         * layout.cc (Layout::Layout): Call set_optimize on the section
9649         name stringpool.
9650
9651 2009-06-22  Ian Lance Taylor  <iant@google.com>
9652
9653         PR 10030
9654         * yyscript.y: Parse TARGET.
9655         * script.cc (script_set_target): New function.
9656         * script-c.h (script_set_target): Declare.
9657         * options.cc (General_options::string_to_object_format): Rename
9658         from string_to_object_format in anonymous namespace.  Change
9659         callers.
9660         * options.h (class General_options): Declare
9661         string_to_object_format.
9662
9663 2009-06-22  Ian Lance Taylor  <iant@google.com>
9664
9665         * script-sections.cc (Script_sections::create_segments): Don't put
9666         program headers in a PT_LOAD segment if -n or -N.
9667
9668 2009-06-22  Ian Lance Taylor  <iant@google.com>
9669
9670         PR 10141
9671         * options.h (class General_options): Add -z lazy and -z now.  Sort
9672         -z options into alphabetical order.
9673         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9674
9675 2009-06-21  Ian Lance Taylor  <iant@google.com>
9676
9677         * layout.cc (Layout::make_output_section): Call
9678         Target::new_output_section.
9679         (Layout::attach_allocated_section_to_segment): Put large section
9680         sections in a separate load segment with the large segment flag
9681         set.
9682         (Layout::segment_precedes): Sort large data segments after other
9683         load segments.
9684         (align_file_offset): New static function.
9685         (Layout::set_segment_offsets): Use align_file_offset.
9686         * output.h (class Output_section): Add is_small_section_ and
9687         is_large_section_ fields.
9688         (Output_section::is_small_section): New function.
9689         (Output_section::set_is_small_section):  New function.
9690         (Output_section::is_large_section): New function.
9691         (Output_section::set_is_large_section): New function.
9692         (Output_section::is_large_data_section): New function.
9693         (class Output_segment): Add is_large_data_segment_ field.
9694         (Output_segment::is_large_data_segment): New function.
9695         (Output_segment::set_is_large_data_segment): New function.
9696         * output.cc (Output_section::Output_section): Initialize new
9697         fields.
9698         (Output_segment::Output_segment): Likewise.
9699         (Output_segment::add_output_section): Add assertion that large
9700         data sections always go in large data segments.  Force small data
9701         sections to the end of the list of data sections.  Force small BSS
9702         sections to the start of the list of BSS sections.  For large BSS
9703         sections to the end of the list of BSS sections.
9704         * symtab.h (class Symbol): Declare is_common_shndx.
9705         (Symbol::is_defined): Check Symbol::is_common_shndx.
9706         (Symbol::is_common): Likewise.
9707         (class Symbol_table): Define enum Commons_section_type.  Update
9708         declarations.  Add small_commons_ and large_commons_ fields.
9709         * symtab.cc (Symbol::is_common_shndx): New function.
9710         (Symbol_table::Symbol_table): Initialize new fields.
9711         (Symbol_table::add_from_object): Put small and large common
9712         symbols in the right list.
9713         (Symbol_table::sized_finalized_symbol): Check
9714         Symbol::is_common_shndx.
9715         (Symbol_table::sized_write_globals): Likewise.
9716         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9717         common symbol lists.  Don't call do_allocate_commons_list if the
9718         list is empty.
9719         (Symbol_table::do_allocate_commons_list): Remove is_tls
9720         parameter.  Add comons_section_type parameter.  Change all
9721         callers.  Handle small and large common symbols.
9722         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9723         Symbol::is_common_shndx.
9724         * resolve.cc (symbol_to_bits): Likewise.
9725         * target.h (Target::small_common_shndx): New function.
9726         (Target::small_common_section_flags): New function.
9727         (Target::large_common_shndx): New function.
9728         (Target::large_common_section_flags): New function.
9729         (Target::new_output_section): New function.
9730         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9731         small_common_section_flags, and large_common_section_flags
9732         fields.
9733         (Target::do_new_output_section): New virtual function.
9734         * arm.cc (Target_arm::arm_info): Initialize new fields.
9735         * i386.cc (Target_i386::i386_info): Likewise.
9736         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9737         Likewise.
9738         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9739         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9740         (Target_x86_64::do_new_output_section): New function.
9741         * configure.ac: Define conditional MCMODEL_MEDIUM.
9742         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9743         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9744         (large_LDFLAGS): Define.
9745         * testsuite/large.c: New file.
9746         * testsuite/testfile.cc (Target_test::test_target_info):
9747         Initialize new fields.
9748         * configure, testsuite/Makefile.in: Rebuild.
9749
9750 2009-06-05  Doug Kwan  <dougkwan@google.com>
9751
9752         * Makefile.am (CCFILES): Add target.cc.
9753         * Makefile.in: Regenerate.
9754         * i386.cc (class Target_i386): Define new virtual method to
9755         override do_is_local_label_name in parent.
9756         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9757         local symbols if --discard-locals or -X is given.
9758         * options.h (class General_options): Declare new options
9759         '--discard-locals' and '-X' for discarding locals.
9760         * target.h (class Target): Define new methods is_local_label_name.
9761         Declare new virtual method do_is_local_label_name.
9762         * target.cc: New file.
9763         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9764         (check_SCRIPTS): Add discard_locals_test.sh.
9765         (check_DATA): Add discard_local_tests.syms.
9766         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9767         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9768         * testsuite/Makefile.in: Regenerate.
9769         * testsuite/discard_locals_test.c: New file.
9770         * testsuite/discard_locals_test.sh: Same.
9771
9772 2009-06-05  Doug Kwan  <dougkwan@google.com>
9773
9774         * object.cc (Sized_relobj::Sized_relobj): Initialize
9775         discarded_eh_frame_shndx_ to -1U.
9776         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9777         section.
9778         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9779         a discarded .eh_frame section.
9780         (Sized_relobj::do_finalize_local_symbols): Ditto.
9781         * object.h (class Sized_relobj): Declare new member
9782         discarded_eh_frame_shndx_.
9783         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9784         (local_labels_test.o, local_labels_test): New rules.
9785         * testsuite/Makefile.in: Regenerate.
9786
9787 2009-06-04  Doug Kwan  <dougkwan@google.com>
9788
9789         * layout.cc (Layout::section_name_mapping): Add mapping for
9790         special ARM sections.
9791
9792 2009-06-03  Doug Kwan  <dougkwan@google.com>
9793
9794         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9795         (utils::has_overflow): Same.
9796
9797 2009-06-03  Ian Lance Taylor  <iant@google.com>
9798
9799         * layout.cc (Layout::section_name_mapping): New array, replacing
9800         Layout::linkonce_mapping.
9801         (Layout::section_name_mapping_count): New variable, replacing
9802         Layout::linkonce_mapping_count.
9803         (Layout::linkonce_output_name): Remove.
9804         (Layout::output_section_name): Rewrite.
9805         * layout.h (class Layout): Rename Linkonce_mapping to
9806         Section_name_mapping, linkonce_mapping to section_name_mapping,
9807         linkonce_mapping_count to section_name_mapping_count.  Don't
9808         declare linkonce_output_name.
9809
9810 2009-06-03  Doug Kwan  <dougkwan@google.com>
9811
9812         * gold/arm.cc (namespace utils): New.
9813         (Target_arm::reloc_is_non_pic): Define new method.
9814         (class Arm_relocate_functions): New.
9815         (Target_arm::Relocate::relocate): Handle relocation types used by
9816         Android.
9817
9818 2009-06-03  Ian Lance Taylor  <iant@google.com>
9819
9820         * arm.cc (Target_arm::scan::global): Use || instead of |.
9821
9822 2009-06-02  Doug Kwan  <dougkwan@google.com>
9823
9824         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9825         issued_non_pic_error_.
9826         (class Target_arm::Scan): Declare new method check_non_pic.
9827         Define new method symbol_needs_plt_entry.
9828         Declare new data member issued_non_pic_error_.
9829         (class Target_arm::Relocate): Declare new method
9830         should_apply_static_reloc.
9831         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9832         (Target_arm::Scan::check_non_pic): Define new method.
9833         (Target_arm::Scan::local): Handle a small subset of reloc types used
9834         by Android.
9835         (Target_arm::Scan::local): Same.
9836         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9837
9838 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9839
9840         * incremental.cc (Incremental_inputs::report_command_line): Filter
9841         out --incremental-* options.
9842
9843 2009-05-29  Doug Kwan  <dougkwan@google.com>
9844
9845         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9846         template class.
9847         (class Target_arm): Update comment.
9848         (Target_arm::Target_arm): Initialize new data members GOT_,
9849         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9850         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9851         and Target_arm::rel_dyn_section.
9852         Declare new_enum Target_arm::Got_type.
9853         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9854         and DYNBSS_.
9855         Update commments for member do_dynsym_value.
9856         (Target_arm::got_size, Target_arm::plt_section,
9857         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9858         new methods inside class defintion.
9859         (Target_arm::got_section): Define new method.
9860         (Target_arm::rel_dyn_section): Same.
9861         (Output_data_plt_arm): New template class.
9862         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9863         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9864         (Output_data_plt_arm::add_entry): Same.
9865         (Output_data_plt_arm::first_plt_entry): Define new
9866         static data member for PLT instruction template.
9867         (Output_data_plt_arm::plt_entry): Same.
9868         (Output_data_plt_arm::do_write): Define new method.
9869         (Target_arm::make_plt_entry): Same.
9870         (Target_arm::do_finalize_sections): Same.
9871         (Target_arm::do_dynsym_value): Same.
9872
9873 2009-05-28  Doug Kwan  <dougkwan@google.com>
9874
9875         * Makefile.am (TARGETSOURCES): Add arm.cc.
9876         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9877         * Makefile.in: Regenerate.
9878         * arm.cc: New file.
9879         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9880
9881 2009-05-26  Doug Kwan  <dougkwan@google.com>
9882
9883         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9884         (General_options::check_excluded_libs): Strip off directories in
9885         archive name before matching like GNU ld does.
9886         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9887         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9888         (exclude_libs_test_LDFLAGS): Add linker option
9889         -Wl,--exclude-libs,libexclude_libs_test_3
9890         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9891         an explicit archive without using -l.
9892         (alt/libexclude_libs_test_3.a): New make rule.
9893         * testsuite/Makefile.in: Regenerate.
9894         * testsuite/exclude_libs_test.c : Declare lib3_default().
9895         (main): Call it.
9896         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9897         * exclude_libs_test_3.c: New file.
9898
9899 2009-05-26  Nick Clifton  <nickc@redhat.com>
9900
9901         * po/id.po: New Indonesian translation.
9902         * po/gold.pot: Updated template file.
9903
9904 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9905
9906         * testsuite/Makefile.am: Add -ffunction-sections to compile
9907         gc_comdat_test files.  Add -Wl,--gc-sections to build
9908         gc_comdat_test.
9909         * testsuite/Makefile.in: Regenerate.
9910         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9911
9912 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9913
9914         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9915         kept comdat section was garbage collected.
9916         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9917         * testsuite/Makefile.in: Regenerate.
9918         * testsuite/gc_comdat_test.sh: New file.
9919         * testsuite/gc_comdat_test_1.cc: New file.
9920         * testsuite/gc_comdat_test_2.cc: New file.
9921
9922 2009-05-19  Doug Kwan  <dougkwan@google.com>
9923
9924         * archive.cc (Archive::Archive): Move constructor from archive.h
9925         to here.  Initialize no_export_.
9926         (Archive::get_elf_object_for_member): Set no_export flag of object.
9927         * archive.h (Archive::Archive): Move constructor body to
9928         archive.cc.
9929         (Archive::no_export): New method.
9930         (Archive::no_export_): New field.
9931         * object.h (Object::Object): Initialize no_export_ to false.
9932         (Object::no_export, Object::set_no_export): New methods.
9933         (Object::no_export_): New field.
9934         * options.cc (General_options::parse_exclude_libs): New method.
9935         (General_options::check_excluded_libs) Same.
9936         * options.h (exclude_libs): New option.
9937         (General_options::check_excluded_libs): New method declaration.
9938         (General_options::excluded_libs_): New field.
9939         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9940         default or protected visibility if an object has no-export flag set.
9941         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9942         (check_SCRIPTS): Add exclude_libs_test.sh.
9943         (check_DATA): Add exclude_libs_test.syms.
9944         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9945         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9946         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9947         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9948         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9949         libexclude_libs_test_2.a): New rules.
9950         * testsuite/Makefile.in: Regenerate.
9951         * testsuite/exclude_libs_test.c: New file.
9952         * testsuite/exclude_libs_test.sh: Ditto.
9953         * testsuite/exclude_libs_test_1.c: Ditto.
9954         * testsuite/exclude_libs_test_2.c: Ditto.
9955
9956 2009-05-15  Ian Lance Taylor  <iant@google.com>
9957
9958         * configure.ac: Check for declarations for cases where libiberty.h
9959         checks HAVE_DECL_xxx.
9960         * configure, config.in: Rebuild.
9961
9962 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9963
9964         * gold.h (Incremental_argument_list): Remove (invalid) forward
9965         declaration.
9966         * incremental.cc (Incremental_inputs::report_achive): New method.
9967         (Incremental_inputs::report_object): New method.
9968         (Incremental_inputs::report_script): New method.
9969         (Incremental_inputs::finalize_inputs): New method.
9970         (Incremental_inputs::finalize): Call finalize_inputs().
9971         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9972         Create inputs entries.
9973         * incremental.h (Incremental_input_type): New enum.
9974         (Incremental_inputs::Incremental_input): Initialize new fields.
9975         (Incremental_inputs::report_inputs): New method.
9976         (Incremental_inputs::report_achive): New method.
9977         (Incremental_inputs::report_object): New method.
9978         (Incremental_inputs::report_script): New method.
9979         (Incremental_inputs::finalize_inputs): New method.
9980         (Incremental_inputs::Input_info): New struct.
9981         (Incremental_inputs::Input_info_map): New typedef.
9982         (Incremental_inputs::lock_): New field.
9983         (Incremental_inputs::Inputs_): New field.
9984         (Incremental_inputs::Inputs_map): New field.
9985         * main.cc (main): Call Incremental_input::report_inputs.
9986         * options.h (Input_argument_list): Typedef moved from
9987         Input_arguments.
9988         (Input_file_group::Files): Remove, use ::Input_argument_list.
9989         (Input_file_group::Input_argument_list): Remove, use
9990         ::Input_argument_list.
9991         * plugin.cc (Plugin_manager::add_input_file): Add error in
9992         incremental build.
9993         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9994         functions.
9995         * script.cc (read_input_script): Call
9996         Incremental_input::report_script.
9997         * script.h (Script_info): New class.
9998
9999 2009-04-27  Ian Lance Taylor  <iant@google.com>
10000
10001         * x86_64.cc (do_adjust_output_section): Set entsize to
10002         plt_entry_size.
10003
10004 2009-04-23  Elliott Hughes  <enh@google.com>
10005
10006         * output.cc (Output_file::close): After short writes, continue
10007         writing from the correct offset in the buffer being written.
10008
10009 2009-04-23  Chris Demetriou  <cgd@google.com>
10010
10011         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10012         * configure: Regenerate.
10013         * config.in: Regenerate.
10014         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10015         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10016
10017 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10018
10019         * incremental.cc (Incremental_inputs_header_data): Renamed from
10020         Incremental_input_header_data.
10021         (Incremental_inputs_header_data::data_size): New field.
10022         (Incremental_inputs_header_data::put_input_file_count): Renamed
10023         from input_file_count.
10024         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10025         from command_line_offset.
10026         (Incremental_inputs_header_data::put_reserved): Renamed from
10027         put_reserved.
10028         (Incremental_inputs_entry_data): Renamed from
10029         Incremental_input_entry_data.
10030         (Incremental_inputs_entry_data::data_size): New field.
10031         (Incremental_inputs::report_command_line): New method.
10032         (Incremental_inputs::finalize): New method.
10033         (Incremental_inputs::create_incremental_inputs_data): New method.
10034         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10035         * incremental.h: New file.
10036         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10037        (Layout::finalize): Create incremental inputs section in
10038         incremental builds.
10039        (Layout::create_incremental_info_sections): New method.
10040         * layout.h (Layout::incremental_inputs): New method.
10041        (Layout::create_incremental_info_sections): New method.
10042        (Layout::incremental_inputs_): New field.
10043         * main.cc (main): Notify Incremental_input of the command line.
10044
10045 2009-04-01  Ian Lance Taylor  <iant@google.com>
10046             Mikolaj Zalewski  <mikolajz@google.com>
10047
10048         * gold.h (reserve_unordered_map): Define, three versions, one for
10049         each version of Unordered_map.
10050         * layout.cc (Layout::Layout): Remove options parameter.  Add
10051         number_of_input_files parameter.  Don't initialize options_.
10052         Initialize number_of_input_files_ and resized_signatures_.  Move
10053         sections_are_attached_.
10054         (Layout::layout_group): Reserve space for group_signatures_.
10055         (Layout::find_or_add_kept_section): Change name parameter to be a
10056         reference.  Resize signatures_ map when it gets large enough.
10057         (Layout::layout_eh_frame): Use parameters->options() instead of
10058         this->options_.
10059         (Layout::make_output_section): Likewise.
10060         (Layout::attach_allocated_section_to_segment): Likewise.
10061         (Layout::finalize, Layout::create_executable_stack): Likewise.
10062         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10063         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10064         * layout.h (class Layout): Update declarations.  Remove options_
10065         field.  Add number_of_input_files_ and resized_signatures_
10066         fields.  Move sections_are_attached_ field.
10067         * main.cc (main): Pass number of input files to Layout
10068         constructor.  Don't pass options.
10069
10070 2009-03-30  Ian Lance Taylor  <iant@google.com>
10071
10072         * ffsll.c (ffsll): Correct implementation.
10073
10074 2009-03-27  Ian Lance Taylor  <iant@google.com>
10075
10076         * ffsll.c: New file.
10077         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10078         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10079         * ftruncate.c (ftruncate): Declare before definition.
10080         * mremap.c (mremap): Likewise.
10081         * pread.c (pread): Likewise.
10082         * configure, Makefile.in, config.in: Rebuild.
10083
10084         * mremap.c: New file.
10085         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10086         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10087         (mremap): Declare if HAVE_MREMAP is not defined.
10088         * configure, Makefile.in, config.in: Rebuild.
10089
10090 2009-03-27  Cary Coutant  <ccoutant@google.com>
10091
10092         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10093         position independent.
10094         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10095         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10096
10097 2009-03-24  Cary Coutant  <ccoutant@google.com>
10098
10099         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10100         an executable.
10101         (needs_dynamic_reloc): Likewise.
10102
10103 2009-03-24  Ian Lance Taylor  <iant@google.com>
10104
10105         * yyscript.y (file_cmd): Recognize EXTERN.
10106         (extern_name_list, extern_name_list_body): New nonterminals.
10107         * script.cc (script_add_extern): Define.
10108         * script-c.h (script_add_extern): Declare.
10109
10110 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10111
10112         * object.cc (is_elf_object): Define.
10113         * object.h (is_elf_object): Declare.
10114         * archive.cc (Archive::get_elf_object_for_member): Call
10115         is_elf_object.
10116         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10117
10118 2009-03-24  Elliott Hughes  <enh@google.com>
10119
10120         * output.cc (Output_file::map_anonymous): Define.
10121         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10122         try an anonymous one.  Report the size if the mmap fails.
10123         * output.h (class Output_file): Declare map_anonymous.
10124
10125 2009-03-24  Ian Lance Taylor  <iant@google.com>
10126
10127         * target-select.cc (instantiate_target): Don't acquire the lock if
10128         the instantiated_target_ field has already been set.
10129
10130 2009-03-23  Ian Lance Taylor  <iant@google.com>
10131
10132         * gold-threads.h (class Initialize_lock): Define.
10133         * gold-threads.cc (class Initialize_lock_once): Define.
10134         (initialize_lock_control): New static variable.
10135         (initialize_lock_pointer): New static variable.
10136         (initialize_lock_once): New static function.
10137         (Initialize_lock::Initialize_lock): Define.
10138         (Initialize_lock::initialize): Define.
10139         * target-select.h: Include "gold-threads.h".
10140         (class Target_selector): Add lock_ and initialize_lock_ fields.
10141         Don't define instantiate_target, just declare it.
10142         * target-select.cc (Target_selector::Target_selector): Initialize
10143         new fields.
10144         (Target_selector::instantiate_target): Define.
10145         * descriptors.h: Include "gold-threads.h".
10146         (class Descriptors): Add initialize_lock_ field.
10147         * descriptors.cc (Descriptors::Descriptors): Initialize new
10148         field.
10149         (Descriptors::open): Use initialize_lock_ field
10150         * errors.h (class Errors): Add initialize_lock_ field.
10151         * errors.cc (Errors::Errors): Initialize new field.
10152         (Errors::initialize_lock): Use initialize_lock_ field.
10153         * powerpc.cc (class Target_selector_powerpc): Remove
10154         instantiated_target_ field.  In do_recognize call
10155         instantiate_target rather than do_instantiate_target.  In
10156         do_instantiate_target just allocate a new target.
10157         * sparc.cc (class Target_selector_sparc): Likewise.
10158
10159         * freebsd.h: New file.
10160         * i386.cc: Include "freebsd.h".
10161         (Target_i386): Derive from Target_freebsd rather than
10162         Sized_target.
10163         (Target_selector_i386): Derive from Target_selector_freebsd rather
10164         than Target_selector.
10165         * x86_64.cc: Include "freebsd.h".
10166         (Target_x86_64): Derive from Target_freebsd rather than
10167         Sized_target.
10168         (Target_selector_x86_64): Derive from Target_selector_freebsd
10169         rather than Target_selector.
10170         * target.h (class Target): Add adjust_elf_header and
10171         do_adjust_elf_header.
10172         * output.cc (Output_file_header:: do_sized_write): Call target
10173         adjust_elf_header routine.
10174         * configure.tgt: Set targ_osabi.
10175         * configure.ac: Define GOLD_DEFAULT_OSABI.
10176         * parameters.cc (Parameters::default_target): Pass
10177         GOLD_DEFAULT_OSABI to select_target.
10178         * target-select.h (class Target_selector): Make instantiate_target
10179         protected rather than private.
10180         * Makefile.am (HFILES): Add freebsd.h.
10181         * configure, Makefile.in, config.in: Rebuild.
10182
10183         * merge.cc (do_add_input_section): Correct pend value.  Change
10184         message about last entry not being null terminated from error to
10185         warning.
10186
10187 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10188
10189         * incremental.cc: New file.
10190         * Makefile.am (CCFILES): Add incremental.cc.
10191         * Makefile.in: Rebuild.
10192
10193 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10194
10195         * layout.cc (Layout::output_section_name): Preserve names
10196         of '.note.' sections.
10197
10198 2009-03-19  Ian Lance Taylor  <iant@google.com>
10199
10200         * descriptors.cc (Descriptors::open): Check that the options are
10201         valid before using them.
10202
10203 2009-03-18  Ian Lance Taylor  <iant@google.com>
10204
10205         * script-sections.h: Include <list>.
10206         (class Script_sections): Change Sections_elements from std::vector
10207         to std::list.  Typedef public Elements_iterator.  Add
10208         orphan_section_placement_, data_segment_align_start_, and
10209         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10210         field.
10211         * script-sections.cc (class Orphan_section_placement): New class.
10212         (class Sections_element): Add virtual functions is_relro and
10213         orphan_section_init.  Remove virtual function place_orphan_here.
10214         (class Output_section_definition): Add is_relro and
10215         orphan_section_init.  Remove place_orphan_here.
10216         (class Orphan_output_section): Likewise.
10217         (Script_sections::Script_sections): Update for field changes.
10218         (Script_sections::data_segment_align): Set saw_data_segment_align_
10219         and data_segment_align_start_, not data_segment_align_index.
10220         (Script_sections::data_segment_relro_end): Check
10221         saw_data_segment_align_.  Use data_segment_align_start_ rather
10222         than data_segment_align_index_.
10223         (Script_sections::place_orphan): Rewrite to use
10224         Orphan_section_placement.
10225
10226 2009-03-17  Ian Lance Taylor  <iant@google.com>
10227
10228         * archive.cc (Archive::add_symbols): Check for a version attached
10229         to the symbol name in the archive map.
10230         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10231         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10232         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10233         (ver_test_11.a): New target.
10234         * testsuite/Makefile.in: Rebuild.
10235
10236         * configure.ac: Check for chsize and posix_fallocate.  Replace
10237         ftruncate.
10238         * ftruncate.c: New file, from gnulib.
10239         * output.cc (posix_fallocate): Define dummy version if not
10240         HAVE_POSIX_FALLOCATE.
10241         (Output_file::map): Call posix_fallocate rather than lseek and
10242         write.
10243         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10244         * configure, Makefile.in, config.in: Rebuild.
10245
10246 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10247
10248         * layout.h (Layout::create_note): Add section_name parameter.
10249         * layout.cc (Layout::create_note): Likewise.
10250         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10251
10252 2009-03-17  Ian Lance Taylor  <iant@google.com>
10253
10254         * descriptors.cc: Include "options.h".
10255         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10256         (Descriptors::open): Always use O_CLOEXEC when opening a new
10257         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10258         then set FD_CLOEXEC.
10259
10260         * sparc.cc (class Target_sparc): Add has_got_section.
10261         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10262         make sure we have a GOT section.
10263
10264         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10265         (Target_sparc::Scan::local): Likewise.
10266         (Target_sparc::Scan::global): Likewise.
10267         (Target_sparc::Relocate::relocate): Likewise.
10268         (Target_sparc::Relocate::relocate_tls): Likewise.
10269
10270         * symtab.cc (Symbol_table::define_default_version): New function,
10271         broken out of add_from_object.
10272         (Symbol_table::add_from_object): Call define_default_version.
10273         (Symbol_table::define_special_symbol): Add resolve_oldsym
10274         parameter.  Change all callers.  If the version for a symbol comes
10275         from a version script, resolve it with the symbol with the same
10276         name with no version.  Also add the symbol without a version if
10277         appropriate.
10278         (do_define_in_output_data): If resolving with oldsym, don't delete
10279         sym.
10280         (do_define_in_output_segment): Likewise.
10281         (do_define_as_constant): Likewise.
10282         * symtab.h (class Symbol_table): Update declarations.
10283
10284 2009-03-13  Ian Lance Taylor  <iant@google.com>
10285
10286         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10287         (Read_symbols::requeue): New function.
10288         (Read_symbols::do_read_symbols): If make_elf_object fails because
10289         the target type is not configured, and the file was searched for,
10290         issue a warning and retry with the next directory.
10291         (Add_symbols::run): If the file has an incompatible format, and
10292         it was searched for, requeue the Read_symbols task.  On error,
10293         release the object.
10294         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10295         dirindex parameter to constructor.  Change all callers.  Declare
10296         incompatible_warning and requeue.
10297         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10298         input_argument_ and input_group_ fields.  Add them to
10299         constructor.  Change all callers.
10300         (class Read_script): Add dirindex_ field.  Add it to constructor.
10301         Change all callers.
10302         * archive.cc (Archive::setup): Remove input_objects parameter.
10303         Change all callers.
10304         (Archive::get_file_and_offset): Likewise.
10305         (Archive::read_all_symbols): Likewise.
10306         (Archive::read_symbols): Likewise.
10307         (Archive::get_elf_object_for_member): Remove input_objects
10308         parameter.  Add punconfigured parameter.  Change all callers.
10309         (Archive::add_symbols): Change return type to bool.  Check return
10310         value of include_member.
10311         (Archive::include_all_members): Likewise.
10312         (Archive::include_member): Change return type to bool.  Return
10313         false if first included object has incompatible target.  Set
10314         included_member_ field.
10315         (Add_archive_symbols::run): If add_symbols returns false, requeue
10316         Read_symbols task.
10317         * archive.h (class Archive): Add included_member_ field.
10318         Initialize it in constructor.  Add input_file and searched_for
10319         methods.  Update declarations.
10320         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10321         input_argument_ fields.  Add them to constructor.  Change all
10322         callers.
10323         * script.cc: Include "target-select.h".
10324         (class Parser_closure): Add skip_on_incompatible_target_ and
10325         found_incompatible_target_ fields.  Add
10326         skip_on_incompatible_target parameter to constructor.  Change all
10327         callers.  Add methods skip_on_incompatible_target,
10328         clear_skip_on_incompatible_target, found_incompatible_target, and
10329         set_found_incompatible_target.
10330         (read_input_script): Add dirindex parameter.  Change all callers.
10331         If parser finds an incompatible target, requeue Read_symbols
10332         task.
10333         (script_set_symbol): Clear skip_on_incompatible_target in
10334         closure.
10335         (script_add_assertion, script_parse_option): Likewise.
10336         (script_start_sections, script_add_phdr): Likewise.
10337         (script_check_output_format): New function.
10338         * script.h (read_input_script): Update declaration.
10339         * script-c.h (script_check_output_format): Declare.
10340         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10341         (ignore_cmd): Remove OUTPUT_FORMAT.
10342         * fileread.cc (Input_file::Input_file): Add explicit this.
10343         (Input_file::will_search_for): New function.
10344         (Input_file::open): Add pindex parameter.  Change all callers.
10345         * fileread.h (class Input_file): Add input_file_argument method.
10346         Declare will_search_for.  Update declarations.
10347         * object.cc (make_elf_object): Add punconfigured parameter.
10348         Change all callers.
10349         * object.h (class Object): Make input_file public.  Add
10350         searched_for method.
10351         (make_elf_object): Update declaration.
10352         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10353         restart search.
10354         * dirsearch.h (class Dirsearch): Update declaration.
10355         * options.h (class General_options): Add --warn-search-mismatch.
10356         * parameters.cc (Parameters::is_compatible_target): New function.
10357         * parameters.h (class Parameters): Declare is_compatible_target.
10358         * workqueue.cc (Workqueue::add_blocker): New function.
10359         * workqueue.h (class Workqueue): Declare add_blocker.
10360
10361         * fileread.cc (Input_file::open): Remove options parameter.
10362         Change all callers.
10363         (Input_file::open_binary): Likewise.
10364         * script.cc (read_input_script): Likewise.
10365         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10366         options parameter from constructor.  Change all callers.
10367         (class Read_script): Likewise.
10368         * fileread.h (class Input_file): Update declarations.
10369         * script.h (read_input_script): Update declaration.
10370
10371 2009-03-10  Nick Clifton  <nickc@redhat.com>
10372
10373         * po/es.po: New Spanish translation.
10374
10375 2009-03-06  Cary Coutant  <ccoutant@google.com>
10376
10377         * options.cc (parse_short_option): Keep dash_z from registering itself.
10378
10379 2009-03-03  Ian Lance Taylor  <iant@google.com>
10380
10381         PR 9918
10382         * target-reloc.h (relocate_section): Pass output_section to
10383         relocate.
10384         * i386.cc (Target_i386::should_apply_static_reloc): Add
10385         output_section parameter.  Change all callers.
10386         (Target_i386::Relocate::relocate): Add output_section parameter.
10387         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10388         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10389         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10390         * testsuite/two_file_shared.sh: New script.
10391         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10392         (check_DATA): Add two_file_shared.dbg.
10393         (two_file_shared.dbg): New target.
10394         * testsuite/Makefile.in: Rebuild.
10395
10396 2009-03-01  Ian Lance Taylor  <iant@google.com>
10397
10398         * configure.ac: Check for byteswap.h.
10399         * configure: Rebuild.
10400         * config.in: Rebuild.
10401
10402 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10403
10404         * layout.cc (Layout::find_or_add_kept_section): New function.
10405         (Layout::add_comdat): Removed.
10406         * layout.h (struct Kept_section): Move out of class Layout.
10407         Remove trailing underscores from field names.  Add group_sections
10408         field.  Rename group_ field to is_group.  Change all uses.
10409         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10410         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10411         comdat_groups_ field.
10412         (Sized_relobj::include_section_group): Use
10413         find_or_add_kept_section and Kept_section::group_sections.
10414         (Sized_relobj::include_linkonce_section): Likewise.
10415         * object.cc (class Sized_relobj): Don't define Comdat_group or
10416         Comdat_group_table.  Remove find_comdat_group and
10417         add_comdat_group.  Remove comdat_groups_ field.
10418         * plugin.cc (include_comdat_group): Use
10419         Layout::find_or_add_kept_section.
10420
10421 2009-02-28  Ian Lance Taylor  <iant@google.com>
10422
10423         * README: --gc-sections and map files are now supported.  Document
10424         some build requirements.
10425
10426         PR 6992
10427         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10428         relocatable link set the value of the section symbol to zero.
10429         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10430         relocatable link don't include the section address in the local
10431         symbol value.
10432
10433 2009-02-27  Ian Lance Taylor  <iant@google.com>
10434
10435         PR 6811
10436         * options.h (class Search_directory): Add is_system_directory.
10437         (class General_options): Declare is_in_system_directory.
10438         * options.cc (get_relative_sysroot): Make static.
10439         (get_default_sysroot): Make static.
10440         (General_optoins::is_in_system_directory): New function.
10441         * fileread.cc (Input_file::is_in_system_directory): New function.
10442         * fileread.h (class Input_file): Declare is_in_system_directory.
10443         * object.h (class Object): Add is_in_system_directory.
10444         (class Input_objects): Remove system_library_directory_ field.
10445         * object.cc (Input_objects::add_object): Don't set
10446         system_library_directory_.
10447         (input_objects::found_in_system_library_directory): Remove.
10448         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10449         parameter.  Change all callers.
10450         (Symbol_table::sized_write_globals): Likewise.
10451         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10452         Call Object::is_in_system_directory.
10453         * symtab.h (class Symbol_table): Update declarations.
10454
10455         PR 5990
10456         * descriptors.h (Open_descriptor): Add is_on_stack field.
10457         * descriptors.cc (Descriptors::open): If the descriptor is on the
10458         top of the stack, remove it.  Initialize is_on_stack field.
10459         (Descriptors::release): Only add pod to stack if it is not on the
10460         stack already.
10461         (Descriptors::close_some_descriptor): Clear stack_next and
10462         is_on_stack fields.
10463
10464         PR 7091
10465         * output.cc (Output_section::find_starting_output_address): Rename
10466         from starting_output_address; add PADDR parameter; change return
10467         type.
10468         * output.h (class Output_section): Declare
10469         find_starting_output_address instead of starting_output_address.
10470         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10471         section symbol for which we can't find a merge section.
10472
10473         PR 9836
10474         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10475         hidden or internal, force the symbol to be local.
10476         * resolve.cc (Symbol::override_visibility): Define.
10477         (Symbol::override_base): Use override_visibility.
10478         (Symbol_table::resolve): Likewise.
10479         (Symbol::override_base_with_special): Likewise.
10480         (Symbol_table::override_with_special): If the visibility is hidden
10481         or internal, force the symbol to be local.
10482         * symtab.h (class Symbol): Add set_visibility and
10483         override_visibility.
10484         * testsuite/ver_test_1.sh: New file.
10485         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10486         (check_DATA): Add ver_test_1.syms.
10487         (ver_test_1.syms): New target.
10488         * testsuite/Makefile.in: Rebuild.
10489
10490 2009-02-25  Cary Coutant  <ccoutant@google.com>
10491
10492         * layout.cc (Layout::choose_output_section): Don't rename sections
10493         when using a linker script that has a SECTIONS clause.
10494         * Makefile.in: Regenerate.
10495
10496         * testsuite/Makefile.am (script_test_5.sh): New test case.
10497         * testsuite/Makefile.in: Regenerate.
10498         * testsuite/script_test_5.cc: New file.
10499         * testsuite/script_test_5.sh: New file.
10500         * testsuite/script_test_5.t: New file.
10501
10502 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10503
10504         * archive.cc (Archive::include_member): Update calls to add_symbols.
10505         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10506         the Layout argument.
10507         * dynobj.h (do_add_symbols): Add the Layout argument.
10508         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10509         Layout argument.
10510         * object.h (Object::add_symbols): Add the Layout argument.
10511         (Object::do_add_symbols): Add the Layout argument.
10512         (Sized_relobj::do_add_symbols): Add the Layout argument.
10513         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10514         Unify the two versions.
10515         (Add_plugin_symbols): Remove.
10516         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10517         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10518         (Add_plugin_symbols): Remove.
10519         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10520         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10521         (Add_symbols::run): Make it work with Pulginobj.
10522
10523 2009-02-06  Ian Lance Taylor  <iant@google.com>
10524
10525         * object.cc (Sized_relobj::do_layout): Make info message start
10526         with lower case letter.
10527
10528 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10529
10530         * binary.cc: Fix file comment.
10531
10532         * options.h (enum Incremental_disposition): Define.
10533         (class General_options): Add new options: --incremental,
10534         --incremental_changed, --incremental_unchanged,
10535         --incremental_unknown.  Add incremental_disposition_ and
10536         implicit_incremental_ fields.
10537         (General_options::incremental_disposition): New function.
10538         (class Position_dependent_options): Add incremental_disposition
10539         option.
10540         (Position_dependent_options::copy_from_options): Set incremental
10541         dispositions.
10542         * options.cc (General_options::parse_incremental_changed): New
10543         function.
10544         (General_options::parse_incremental_unchanged): New function.
10545         (General_options::parse_incremental_unknown): New function.
10546         (General_options::General_options): Initialize new fields
10547         incremental_disposition_ and implicit_incremental_.
10548         (General_options::finalize): Check for uasge of --incremental-*
10549         without --incremental.
10550
10551 2009-02-06  Chris Demetriou  <cgd@google.com>
10552
10553         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10554         pointer and to report location as the file name associated with
10555         the symbol.
10556         (gold_undefined_symbol_at_location): New function to replace the
10557         old gold_undefined_symbol functionality.
10558         * target-reloc.h (relocate_section): Update to use
10559         gold_undefined_symbol_at_location.
10560         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10561         Call gold_undefined_symbol function rather than gold_error.
10562         * errors.h (Errors::undefined_symbol): Take location as a
10563         string, rather than calculating it from a relocation.
10564         * errors.cc (Errors::fatal): Print "fatal error:" before the
10565         formatted message.
10566         (Errors::error, Errors::error_at_location): Print "error: "
10567         before the formatted message.
10568         (Errors::undefined_symbol): Take location as a string, rather
10569         than calculating it from a relocation.
10570         (gold_undefined_symbol_at_location): New function akin to
10571         old gold_undefined_symbol, calculates location from relocation.
10572         (gold_undefined_symbol): Change to take only a Symbol pointer
10573         and to report location as the file name associated with the symbol.
10574         * testsuite/debug_msg.sh: Update for changed error messages.
10575         * testsuite/undef_symbol.sh: Likewise.
10576
10577 2009-02-04  Duncan Sands  <baldrick@free.fr>
10578
10579         PR 9812
10580         * reduced_debug_output.h
10581         (Output_reduced_debug_abbrev_section::failed): Use format for
10582         gold_warning.
10583         (Output_reduced_debug_info_section::faild): Likewise.
10584
10585 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10586
10587         * script.cc (Lazy_demangler): New class.
10588         (Version_script_info::get_symbol_version_helper): Demangle a
10589         symbol only once.
10590
10591 2009-01-29  Cary Coutant  <ccoutant@google.com>
10592
10593         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10594         to __tls_get_addr.
10595         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10596
10597 2009-01-28  Ian Lance Taylor  <iant@google.com>
10598
10599         * version.cc (version_string): Bump to 1.9.
10600
10601         * gold.h: Include <cstring> and <stdint.h>.
10602         * version.cc: Include <cstdio>.
10603         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10604         warning.
10605         * reduced_debug_output.cc (insert_into_vector): Rename from
10606         Insert_into_vector; change all callers.  Use Swap_unaligned to
10607         avoid aliasing issue; remove union since it is unnecessary.
10608
10609 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10610
10611         * Makefile.am (CCFILES): Add gc.cc.
10612         (HFILES): Add gc.h.
10613         * Makefile.in: Regenerate.
10614         * gold.cc (Gc_runner): New class.
10615         (queue_initial_tasks): Call garbage collection related tasks
10616         when corresponding options are invoked.
10617         (queue_middle_gc_tasks): New function.
10618         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10619         processed early before laying out sections during garbage collection.
10620         * gold.h (queue_middle_gc_tasks): New function.
10621         (is_prefix_of): Move from "layout.cc".
10622         * i386.cc (Target_i386::gc_process_relocs): New function.
10623         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10624         * main.cc (main): Create object of class "Garbage_collection".
10625         * object.cc (Relobj::copy_symbols_data): New function.
10626         (Relobj::is_section_name_included): New function.
10627         (Sized_relobj::do_layout): Allow this function to be called twice
10628         during garbage collection and defer layout of section during the
10629         first call.
10630         * object.h (Relobj::get_symbols_data): New function.
10631         (Relobj::is_section_name_included): New function.
10632         (Relobj::copy_symbols_data): New function.
10633         (Relobj::set_symbols_data): New function.
10634         (Relobj::get_relocs_data): New function.
10635         (Relobj::set_relocs_data): New function.
10636         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10637         (Relobj::gc_process_relocs): New function.
10638         (Relobj::do_gc_process_relocs): New pure virtual function.
10639         (Relobj::sd_): New data member.
10640         (Sized_relobj::is_output_section_offset_invalid): New function.
10641         (Sized_relobj::do_gc_process_relocs): New function.
10642         * options.h (General_options::gc_sections): Modify to not be a no-op.
10643         (General_options::print_gc_sections): New option.
10644         * plugin.cc (Plugin_finish::run): Remove function call to
10645         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10646         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10647         * reloc.cc (Read_relocs::run): Add task to process relocs and
10648         determine unreferenced sections when doing garbage collection.
10649         (Gc_process_relocs): New class.
10650         (Sized_relobj::do_gc_process_relocs): New function.
10651         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10652         sections that are garbage collected.
10653         * reloc.h (Gc_process_relocs): New class.
10654         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10655         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10656         symbols whose corresponding sections are garbage collected.
10657         (Symbol_table::Symbol_table): Add new parameter for the garbage
10658         collection object.
10659         (Symbol_table::gc_mark_undef_symbols): New function.
10660         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10661         (Symbol_table::gc_mark_dyn_syms): New function.
10662         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10663         as garbage.
10664         (Symbol_table::add_from_object): Likewise.
10665         (Symbol_table::add_from_relobj): When building shared objects, do not
10666         treat externally visible symbols as garbage.
10667         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10668         table information for static and relocatable links.
10669         * symtab.h (Symbol_table::set_gc): New function.
10670         (Symbol_table::gc): New function.
10671         (Symbol_table::gc_mark_undef_symbols): New function.
10672         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10673         (Symbol_table::gc_mark_dyn_syms): New function.
10674         (Symbol_table::gc_): New data member.
10675         * target.h (Sized_target::gc_process_relocs): New pure virtual
10676         function.
10677         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10678         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10679
10680 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10681
10682         * options.h (General_options::gc_sections): Define as a no-op for now.
10683         (General_options::no_keep_memory): Ditto.
10684         (General_options::Bshareable): Define.
10685         * options.cc (General_options::finalize): Honor -Bshareable.
10686
10687 2009-01-20  Andreas Schwab  <schwab@suse.de>
10688
10689         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10690         read the value in the contents, since we don't use it.  Use the
10691         template endianness when writing.
10692         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10693
10694 2009-01-19  Andreas Schwab  <schwab@suse.de>
10695
10696         * configure.tgt (powerpc64-*): Fix targ_obj.
10697
10698 2009-01-15  Ian Lance Taylor  <iant@google.com>
10699
10700         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10701         local symbols when stripping all symbols.
10702
10703 2009-01-14  Cary Coutant  <ccoutant@google.com>
10704
10705         * output.cc (Output_reloc): Add explicit instantiations.
10706
10707 2009-01-14  Cary Coutant  <ccoutant@google.com>
10708
10709         * archive.cc (Archive::get_elf_object_for_member): Remove call
10710         to File_read::claim_for_plugin.
10711         * descriptors.cc (Descriptors::open): Remove reference to
10712         is_claimed.
10713         (Descriptors::claim_for_plugin): Remove.
10714         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10715         (Descriptors::is_claimed): Remove.
10716         (claim_descriptor_for_plugin): Remove.
10717         * fileread.cc (File_read::claim_for_plugin): Remove.
10718         * fileread.h (File_read::claim_for_plugin): Remove.
10719         (File_read::descriptor): Reopen descriptor if necessary.
10720         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10721         (Plugin_manager::all_symbols_read): Add task parameter. Change
10722         all callers.
10723         (Plugin_manager::get_input_file): New function.
10724         (Plugin_manager::release_input_file): New function.
10725         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10726         corresponding data member.
10727         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10728         and pass to base constructor. Change all callers.
10729         (get_input_file, release_input_file): New functions.
10730         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10731         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10732         (Plugin_manager::all_symbols_read): Add task parameter.
10733         (Plugin_manager::get_input_file): New function.
10734         (Plugin_manager::release_input_file): New function.
10735         (Plugin_manager::task_): New data member.
10736         (Pluginobj::Pluginobj): Add filesize parameter.
10737         (Pluginobj::filename): New function.
10738         (Pluginobj::descriptor): New function.
10739         (Pluginobj::filesize): New function.
10740         (Pluginobj::filesize_): New data member.
10741         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10742         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10743         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10744
10745         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10746         with archive libraries.
10747         * testsuite/Makefile.in: Regenerate.
10748         * testsuite/plugin_test.c (struct sym_info): New type.
10749         (get_input_file, release_input_file): New static variables.
10750         (onload): Capture new transfer vector entries.
10751         (claim_file_hook): Stop reading at end of file according to filesize.
10752         Factor out parsing of readelf output into separate function.
10753         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10754         APIs and get the source file name from the symbol table.  Convert
10755         source file name to corresponding object file name.  Print info
10756         message when adding new input files.
10757         (parse_readelf_line): New function.
10758         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10759         * testsuite/plugin_test_2.sh: Likewise.
10760         * testsuite/plugin_test_3.sh: Likewise.
10761         * testsuite/plugin_test_4.sh: New test case.
10762
10763 2009-01-07  Ian Lance Taylor  <iant@google.com>
10764
10765         * version.cc (version_string): Bump to 1.8.
10766
10767 2008-12-23  Cary Coutant  <ccoutant@google.com>
10768
10769         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10770         * plugin.cc (Plugin_manager::finish): Rename as
10771         layout_deferred_objects.  Move cleanup to separate function.
10772         (Plugin_manager::cleanup): New function.
10773         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10774         separately.
10775         * plugin.h (Plugin_manager::finish): Rename as
10776         layout_deferred_objects.
10777         (Plugin_manager::cleanup): New function.
10778         (Plugin_manager::cleanup_done): New field.
10779
10780 2008-12-23  Cary Coutant  <ccoutant@google.com>
10781
10782         * plugin.cc (is_visible_from_outside): New function.
10783         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10784         so we don't return "IR only" status for exported symbols or -r links.
10785
10786         * testsuite/Makefile.am (plugin_test_3): New test case.
10787         * testsuite/Makefile.in: Regenerate.
10788         * testsuite/plugin_test_3.sh: New file.
10789
10790 2008-12-22  Cary Coutant  <ccoutant@google.com>
10791
10792         * object.cc (Sized_relobj::layout_section): New function.
10793         (Sized_relobj::do_layout): Defer layout of input sections until after
10794         plugin has provided replacement files.
10795         (Sized_relobj::do_layout_deferred_sections): New function.
10796         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10797         (Relobj::layout_deferred_sections): New function.
10798         (Relobj::do_layout_deferred_sections): New function.
10799         (Sized_relobj::do_layout_deferred_sections): New function.
10800         (Sized_relobj::layout_section): New function.
10801         (Sized_relobj::Deferred_layout): New structure.
10802         (Sized_relobj::deferred_layout_): New field.
10803         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10804         Change all callers.  Layout deferred sections.
10805         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10806         references.
10807         (Plugin_hook::run): Move code from do_plugin_hook inline.
10808         (Plugin_hook::do_plugin_hook): Remove.
10809         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10810         (Plugin_manager::finish): Renamed, was cleanup.
10811         (Plugin_manager::should_defer_layout): New function.
10812         (Plugin_manager::add_deferred_layout_object): New function.
10813         (Plugin_manager::Deferred_layout_list): New type.
10814         (Plugin_manager::deferred_layout_objects_): New field.
10815         (Plugin_hook::do_plugin_hook): Remove.
10816
10817 2008-12-17  Ian Lance Taylor  <iant@google.com>
10818
10819         * options.h (class General_options): Add --no case for
10820         --export-dynamic.
10821
10822 2008-12-16  Cary Coutant  <ccoutant@google.com>
10823
10824         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10825         vector.
10826         (Plugin_manager::claim_file): Create plugin object even if
10827         plugin did not call the add_symbols callback.
10828         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10829         asking for more symbols than were added.
10830         * testsuite/Makefile.am (plugin_test_1): Add test case with
10831         no global symbols.
10832         (empty.syms): New target.
10833         * testsuite/Makefile.in: Regenerate.
10834         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10835         message. Don't call add_symbols if no globals.
10836         (all_symbols_read_hook): Don't provide replacement for empty
10837         claimed file.
10838
10839 2008-12-12  Ian Lance Taylor  <iant@google.com>
10840
10841         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10842         r_type == 0 for a local symbol with r_sym == 0.
10843         (scan_relocatable_relocs): Pass r_sym to
10844         local_non_section_strategy.
10845         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10846         r_sym parameter.
10847
10848         * configure.ac: Update test for TLS descriptors: they are
10849         supported as of glibc 2.9.
10850         * configure: Rebuild.
10851
10852 2008-12-11  Ian Lance Taylor  <iant@google.com>
10853
10854         PR 7091
10855         * target-reloc.h (Default_scan_relocatable_relocs): For each
10856         function, map r_type == 0 to RELOC_DISCARD.
10857
10858 2008-12-10  Cary Coutant  <ccoutant@google.com>
10859
10860         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10861         object to override a kept COMDAT group from a plugin object.
10862
10863 2008-12-09  Ian Lance Taylor  <iant@google.com>
10864
10865         PR 7088
10866         * yyscript.y (file_cmd): Handle INPUT.
10867
10868         * testsuite/initpri1.c: Change all declarations to be full
10869         prototypes by adding void, to avoid compiler warnings.
10870
10871 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10872
10873         * options.cc (General_options::parse_plugin_opt): New.
10874         (General_options::add_plugin): The argument now is just the filename.
10875         (General_options::add_plugin_option): New.
10876         * options.h (plugin_opt): New.
10877         (add_plugin): Change argument name.
10878         (add_plugin_option): New.
10879         * plugin.cc (Plugin::load): Don't parse the plugin option.
10880         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10881         (Plugin::add_option): New.
10882         (Plugin::args_): Change type.
10883         (Plugin::filename_): New.
10884         (Plugin_manager::add_plugin_option): New.
10885         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10886         * testsuite/Makefile.in: Regenerate.
10887
10888 2008-12-05  Cary Coutant  <ccoutant@google.com>
10889
10890         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10891         Handle --strip-lto-sections option.
10892         * options.h (strip_lto_sections): New option.
10893
10894 2008-12-01  Cary Coutant  <ccoutant@google.com>
10895
10896         * plugin.cc (ld_plugin_message): Change format parameter to const.
10897         Fix mismatch between new[] and delete.
10898
10899 2008-11-14  Cary Coutant  <ccoutant@google.com>
10900
10901         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10902         instead of -1U.
10903
10904 2008-11-05  Craig Silverstein  <csilvers@google.com>
10905
10906         * options.cc (General_options::parse_dynamic_list): New function.
10907         * options.h (General_options): New flags dynamic_list,
10908         dynamic_list_data, dynamic_list_cpp_new, and
10909         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10910         (General_options::in_dynamic_list): New function.
10911         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10912         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10913         (Lex::can_continue_name): Likewise.
10914         (yylex): Likewise.
10915         (read_script_file): New parameter script_options.
10916         (read_dynamic_list): New function.
10917         (Script_options::define_dynamic_list): New function.
10918         (dynamic_list_keyword_parsecodes): New variable.
10919         (dynamic_list_keywords): New variable.
10920         * script.h (Script_options::define_dynamic_list): New function
10921         prototype.
10922         (read_dynamic_list): New function prototype.
10923         * symtab.cc (strprefix): New macro.
10924         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10925         dynamic_list_data, dynamic_list_cpp_new, and
10926         dynamic_list_cpp_typeinfo.
10927         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10928         (dynamic_list_expr): New rule.
10929         (dynamic_list_nodes): Likewise.
10930         (dynamic_list_node): Likewise.
10931         * testsuite/Makefile.am (dynamic_list): New test.
10932         * testsuite/Makefile.in: Regenerated.
10933         * testsuite/dynamic_list.t: New file.
10934         * testsuite/dynamic_list.sh: New file.
10935
10936 2008-11-05  Craig Silverstein  <csilvers@google.com>
10937
10938         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10939         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10940         (t11_last): Likewise.
10941         * testsuite/ver_test_6.c (main): Likewise.
10942
10943 2008-10-07  Cary Coutant  <ccoutant@google.com>
10944
10945         * options.c (General_options::finalize): Add check for -static and
10946         -shared.
10947         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10948         is not empty.
10949
10950 2008-10-02  Cary Coutant  <ccoutant@google.com>
10951
10952         * plugin.cc (make_sized_plugin_object): Fix conditional
10953         compilation to work when not all targets are enabled.
10954
10955 2008-09-29  Cary Coutant  <ccoutant@google.com>
10956
10957         * archive.cc (Archive::get_file_and_offset): Use filename instead
10958         of name to get library path.
10959         (Archive::include_member): Unlock external member of a thin archive.
10960
10961         * testsuite/Makefile.am (TEST_AR): New variable.
10962         (thin_archive_test_1): New test.
10963         (thin_archive_test_2): New test.
10964         * testsuite/Makefile.in: Regenerate.
10965         * testsuite/thin_archive_main.cc: New file.
10966         * testsuite/thin_archive_test_1.cc: New file.
10967         * testsuite/thin_archive_test_2.cc: New file.
10968         * testsuite/thin_archive_test_3.cc: New file.
10969         * testsuite/thin_archive_test_4.cc: New file.
10970
10971 2008-09-29  Cary Coutant  <ccoutant@google.com>
10972
10973         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10974         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10975         instead of -1U.
10976         (Sized_relobj::do_finalize_local_symbols): Likewise.
10977         (Sized_relobj::map_to_kept_section): Likewise.
10978         * object.h (Sized_relobj::invalid_address): New constant.
10979         (Sized_relobj::do_output_section_offset): Check for invalid_address
10980         and return -1ULL.
10981         * output.cc (Output_reloc::local_section_offset): Use constant
10982         invalid_address instead of -1U.
10983         (Output_reloc::get_address): Likewise.
10984         (Output_section::output_address): Change -1U to -1ULL.
10985         * output.h (Output_reloc::invalid_address): New constant.
10986         * reloc.cc (Sized_relobj::write_sections): Use constant
10987         invalid_address instead of -1U.
10988         (Sized_relobj::relocate_sections): Likewise.
10989         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10990         values for merge sections.
10991         * target-reloc.h (relocate_for_relocatable): Use constant
10992         invalid_address instead of -1U.
10993
10994 2008-09-19  Cary Coutant  <ccoutant@google.com>
10995
10996         Add plugin functionality for link-time optimization (LTO).
10997         * configure.ac (plugins): Add --enable-plugins option.
10998         * configure: Regenerate.
10999         * config.in: Regenerate.
11000         * Makefile.am (LIBDL): New variable.
11001         (CCFILES): Add plugin.cc.
11002         (HFILES): Add plugin.h.
11003         (ldadd_var): Add LIBDL.
11004         * Makefile.in: Regenerate.
11005
11006         * archive.cc: Include "plugin.h".
11007         (Archive::setup): Don't preread archive symbols when using a plugin.
11008         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11009         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11010         files.
11011         (Archive::include_member): Add symbols from plugin objects.
11012         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11013         * descriptors.cc (Descriptors::open): Check for file descriptors
11014         abandoned by plugins.
11015         (Descriptors::claim_for_plugin): New function.
11016         * descriptors.h (Descriptors::claim_for_plugin): New function.
11017         (Open_descriptor::is_claimed): New field.
11018         (claim_descriptor_for_plugin): New function.
11019         * fileread.cc (File_read::claim_for_plugin): New function.
11020         * fileread.h (File_read::claim_for_plugin): New function.
11021         (File_read::descriptor): New function.
11022         * gold.cc: Include "plugin.h".
11023         (queue_initial_tasks): Add task to call plugin hooks for generating
11024         new object files.
11025         * main.cc: Include "plugin.h".
11026         (main): Load plugin libraries.
11027         * object.h (Pluginobj): Declare.
11028         (Object::pluginobj): New function.
11029         (Object::do_pluginobj): New function.
11030         (Object::set_target): New function.
11031         * options.cc: Include "plugin.h".
11032         (General_options::parse_plugin): New function.
11033         (General_options::General_options): Initialize plugins_ field.
11034         (General_options::add_plugin): New function.
11035         * options.h (Plugin_manager): Declare.
11036         (General_options): Add --plugin option.
11037         (General_options::has_plugins): New function.
11038         (General_options::plugins): New function.
11039         (General_options::add_plugin): New function.
11040         (General_options::plugins_): New field.
11041         * plugin.cc: New file.
11042         * plugin.h: New file.
11043         * readsyms.cc: Include "plugin.h".
11044         (Read_symbols::do_read_symbols): Check for archive before checking
11045         for ELF file.  Call plugin hooks to claim files.
11046         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11047         from a real object file; force override when processing replacement
11048         files.
11049         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11050         (Symbol::init_base_object): Likewise.
11051         (Symbol::init_base_output_data): Likewise.
11052         (Symbol::init_base_output_segment): Likewise.
11053         (Symbol::init_base_constant): Likewise.
11054         (Symbol::init_base_undefined): Likewise.
11055         (Symbol::output_section): Assert that object is not a plugin.
11056         (Symbol_table::add_from_pluginobj): New function.
11057         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11058         undefined.
11059         (Symbol_table::sized_write_globals): Likewise.
11060         (Symbol_table::add_from_pluginobj): Instantiate template.
11061         * symtab.h (Sized_pluginobj): Declare.
11062         (Symbol::in_real_elf): New function.
11063         (Symbol::set_in_real_elf): New function.
11064         (Symbol::in_real_elf_): New field.
11065         (Symbol_table::add_from_pluginobj): New function.
11066
11067         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11068         (LIBDL): New variable.
11069         (LDADD): Add LIBDL.
11070         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11071         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11072         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11073         (MOSTLYCLEANFILES): Likewise.
11074         * testsuite/Makefile.in: Regenerate.
11075         * testsuite/plugin_test.c: New file.
11076         * testsuite/plugin_test_1.sh: New file.
11077         * testsuite/plugin_test_2.sh: New file.
11078
11079 2008-09-16  Ian Lance Taylor  <iant@google.com>
11080
11081         * target-reloc.h (relocate_section): Check whether a symbol is
11082         defined by the ABI before reporting an undefined symbol error.
11083         * target.h (Target::is_defined_by_abi): Make parameter const.
11084         (Target::do_is_defined_by_abi): Likewise.
11085         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11086         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11087         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11088         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11089         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11090         * testsuite/Makefile.in: Rebuild.
11091
11092         * fileread.cc (make_view): Add casts to avoid warning.
11093
11094 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11095
11096         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11097         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11098
11099 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11100
11101         * options.h (General_options::output_is_executable): New.
11102         (General_options::output_is_pie): New.
11103         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11104         for shared libraries.
11105         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11106
11107 2008-09-11  Chris Demetriou  <cgd@google.com>
11108
11109         * options.h (origin): New -z option.
11110         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11111         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11112         in DT_FLAGS_1.
11113
11114 2008-09-05  Cary Coutant  <ccoutant@google.com>
11115
11116         * fileread.cc (File_read::make_view): Add check for attempt to map
11117         beyond end of file.
11118
11119 2008-09-05  Cary Coutant  <ccoutant@google.com>
11120
11121         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11122         explicit instantiations.
11123
11124 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11125
11126         PR gold/6858
11127         * options.cc (General_options::finalize): Allow undefined symbols
11128         in shlibs if linking -shared.
11129
11130         PR gold/6859
11131         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11132         symbols as not needing a dynsym entry.
11133
11134 2008-08-20  Craig Silverstein  <csilvers@google.com>
11135
11136         * fileread.cc (File_read::open): Do not lock the file unless it
11137         was successfully opened.
11138
11139 2008-08-14  Cary Coutant  <ccoutant@google.com>
11140
11141         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11142         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11143         * testsuite/tls_test.cc (struct int128): 128-bit struct
11144         for testing TLS relocs with non-zero addend.
11145         (v12): New TLS variable.
11146         (t12): New test.
11147         (t_last): Add check for v12.
11148         * testsuite/tls_test.h (t12): New function.
11149         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11150
11151 2008-08-13  Ian Lance Taylor  <iant@google.com>
11152
11153         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11154         set tls_segment_ or relro_segment_.
11155         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11156         when appropriate.
11157         * output.h (Output_section::clear_is_relro): New function.
11158         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11159         sections specially even when output_data_ is empty.
11160         (Output_segment::maximum_alignment): When first section is relro,
11161         only force alignment for PT_LOAD segments.
11162         * script.cc (script_data_segment_align): New function.
11163         (script_data_segment_relro_end): New function.
11164         * script-c.h (script_data_segment_align): Declare.
11165         (script_data_segment_relro_end): Declare.
11166         * script-sections.h (class Script_sections): Declare
11167         data_segment_align and data_segment_relro_end.  Add fields
11168         segment_align_index_ and saw_relro_end_.
11169         * script-sections.cc (class Sections_element): Add set_is_relro
11170         virtual function.  Add new bool* parameter to place_orphan_here.
11171         Add get_output_section virtual function.
11172         (class Output_section_definition): Add set_is_relro.  Add new
11173         bool* parameter to place_orphan_here.  Add get_output_section.
11174         Add is_relro_ field.
11175         (Output_section_definition::Output_section_definition): Initialize
11176         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11177         and is_relro_ fields.
11178         (Output_section_definition::place_orphan_here): Add is_relro
11179         parameter.
11180         (Output_section_definition::set_section_addresses): Set relro for
11181         output section.
11182         (Output_section_definition::alternate_constraint): Likewise.
11183         (class Orphan_output_section): Add new bool* parameter to
11184         place_orphan_here.  Add get_output_section.
11185         (Orphan_output_section::place_orphan_here): Add is_relro
11186         parameter.
11187         (Script_sections::Script_sections): Initialize
11188         data_segment_align_index_ and saw_relro_end_.
11189         (Script_sections::data_segment_align): New function.
11190         (Script_sections::data_segment_relro_end): New function.
11191         (Script_sections::place_orphan): Set or clear is_relro.
11192         (Script_sections::set_section_addresses): Force alignment of first
11193         TLS section.
11194         * yyscript.y (exp): Call script_data_segment_align and
11195         script_data_segment_relro_end.
11196         * testsuite/relro_script_test.t: New file.
11197         * testsuite/relro_test.cc (using_script): Declare.
11198         (t1, t2): Test using_script.
11199         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11200         (relro_script_test_SOURCES): Define.
11201         (relro_script_test_DEPENDENCIES): Define.
11202         (relro_script_test_LDFLAGS): Define.
11203         (relro_script_test_LDADD): Define.
11204         (relro_script_test.so): New target.
11205         * testsuite/Makefile.in: Rebuild.
11206
11207 2008-08-06  Cary Coutant <ccoutant@google.com>
11208
11209         * archive.cc (Archive::total_archives, Archive::total_members)
11210         (Archive::total_members_loaded): New variables.
11211         (Archive::setup): Add parameter.  Add option to preread
11212         archive symbols.
11213         (Archive::read_armap): Add counter.
11214         (Archive::get_file_and_offset): New function.
11215         (Archive::get_elf_object_for_member): New function.
11216         (Archive::read_all_symbols): New function.
11217         (Archive::read_symbols): New function.
11218         (Archive::add_symbols): Add counters.
11219         (Archive::include_all_members): Use armap to find members if it's
11220         already built.
11221         (Archive::include_member): Skip reading symbols if already read.
11222         Factored code into Archive::get_file_and_offset and
11223         Archive::get_elf_object_for_member.  Changed call to
11224         Mapfile::report_include_archive_member.
11225         (Archive::print_stats): New function.
11226         * archive.h: Declare Object and Read_symbols_data classes.
11227         (Archive::Archive): Add initializers for new members.
11228         (Archive::setup): Add parameter.
11229         (Archive::print_stats): New function.
11230         (Archive::total_archives, Archive::total_members)
11231         (Archive::total_members_loaded): New variables.
11232         (Archive::get_file_and_offset): New function.
11233         (Archive::get_elf_object_for_member): New function.
11234         (Archive::read_all_symbols): New function.
11235         (Archive::read_symbols): New function.
11236         (Archive::Archive_member): New class.
11237         (Archive::members_): New member.
11238         (Archive::num_members_): New member.
11239         * main.cc: Include archive.h.
11240         (main): Call Archive::print_stats.
11241         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11242         archive parameter; member_name is now the fully-decorated name.
11243         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11244         * options.h: (General_options): Add --preread-archive-symbols option.
11245         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11246         Archive::setup.
11247
11248 2008-08-04  Ian Lance Taylor  <iant@google.com>
11249
11250         * symtab.h (Symbol::use_plt_offset): New function.
11251         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11252         * powerpc.cc (Relocate::relocate): Likewise.
11253         * sparc.cc (Relocate::relocate): Likewise.
11254         * x86_64.cc (Relocate::relocate): Likewise.
11255         * testsuite/weak_plt.sh: New test.
11256         * testsuite/weak_plt_main.cc: New test.
11257         * testsuite/weak_plt_shared.cc: New test.
11258         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11259         (check_PROGRAMS): Add weak_plt.
11260         (check_DATA): Add weak_plt_shared.so.
11261         (weak_plt_main_pic.o, weak_plt): New targets.
11262         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11263         * testsuite/Makefile.in: Rebuild.
11264
11265         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11266         gcctestdir/ld.
11267         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11268         * testsuite/Makefile.in: Rebuild.
11269
11270 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11271
11272         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11273         * Makefile.in: Regenerate.
11274         * po/POTFILES.in: Regenerate.
11275
11276 2008-07-29  Ian Lance Taylor  <iant@google.com>
11277
11278         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11279         symbols before other symbols.
11280         * testsuite/script_test_2.cc (test_addr): Declare.
11281         (test_addr_alias): Declare.
11282         (main): Check that test_addr and test_addr_alias have the right
11283         values.
11284         * testsuite/script_test_2.t: Define test_addr_alias and
11285         test_addr.
11286
11287 2008-07-24  Ian Lance Taylor  <iant@google.com>
11288
11289         PR 5990
11290         * descriptors.cc: New file.
11291         * descriptors.h: New file.
11292         * gold-threads.h (class Hold_optional_lock): New class.
11293         * fileread.cc: Include "descriptors.h".
11294         (File_read::~File_read): Release descriptor rather than closing
11295         it.
11296         (File_read::open) [file]: Call open_descriptor rather than open.
11297         Set is_descriptor_opened_.
11298         (File_read::open) [memory]: Assert that descriptor is not open.
11299         (File_read::reopen_descriptor): New function.
11300         (File_read::release): Release descriptor.
11301         (File_read::do_read): Make non-const.  Reopen descriptor.
11302         (File_read::read): Make non-const.
11303         (File_read::make_view): Reopen descriptor.
11304         (File_read::do_readv): Likewise.
11305         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11306         Update declarations.
11307         * layout.cc: Include "descriptors.h".
11308         (Layout::create_build_id): Use open_descriptor rather than open.
11309         * output.cc: Include "descriptors.h".
11310         (Output_file::open): Use open_descriptor rather than open.
11311         * archive.cc (Archive::const_iterator): Change Archive to be
11312         non-const.
11313         (Archive::begin, Archive::end): Make non-const.
11314         (Archive::count_members): Likewise.
11315         * archive.h (class Archive): Update declarations.
11316         * object.h (Object::read): Make non-const.
11317         * Makefile.am (CCFILES): Add descriptors.cc.
11318         (HFILES): Add descriptors.h.
11319         * Makefile.in: Rebuild.
11320
11321         PR 6716
11322         * gold.h: Always include <clocale>.  Add Solaris workarounds
11323         following code in binutils/sysdep.h.
11324
11325         PR 6048
11326         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11327         this->eh_frame_hdr_ is NULL before using it.
11328
11329         * dynobj.cc (Versions::Versions): Update comment.
11330
11331         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11332         the base version name.
11333
11334         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11335         array size plus one.
11336         (Stringpool_template::set_string_offsets): Subtract one from key
11337         before using it as an array index.
11338         (Stringpool_template::get_offset_with_length): Likewise.
11339         (Stringpool_template::write_to_buffer): Likewise.
11340         * stringpool.h (Stringpool_template::get_offset_from_key):
11341         Likewise.
11342
11343 2008-07-23  Ian Lance Taylor  <iant@google.com>
11344
11345         PR 6658
11346         * object.h (Merged_symbol_value::value): Do our best to handle a
11347         negative addend.
11348
11349         PR 6647
11350         * script.cc (Version_script_info::get_versions): Don't add empty
11351         version tag to return value.
11352         (Version_script_info::get_symbol_version_helper): Change return
11353         type to bool.  Add pversion parameter.  Change all callers.
11354         (script_register_vers_node): Don't require a non-NULL tag.
11355         * script.h (class Version_script_info): Update declarations.
11356         (Version_script_info::get_symbol_version): Change return type to
11357         bool.  Add version parameter.  Change all callers.
11358         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11359         handling.  Handle an empty version from a version script.
11360         (Symbol_table::define_special_symbol): Likewise.
11361         * testsuite/ver_test_10.script: New file.
11362         * testsuite/ver_test_10.sh: New file.
11363         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11364         (check_DATA): Add ver_test_10.syms.
11365         (ver_test_10.syms, ver_test_10.so): New target.
11366         * testsuite/Makefile.in: Rebuild.
11367
11368 2008-07-23  Simon Baldwin  <simonb@google.com>
11369
11370         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11371         to zero for undefined symbols from dynamic libraries.
11372
11373 2008-07-23  Ian Lance Taylor  <iant@google.com>
11374
11375         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11376         Change all callers.
11377         * symtab.h (class Symbol_table): Update declaration.
11378         * testsuite/ver_test_9.cc: New file.
11379         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11380         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11381         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11382         (ver_test_9.so, ver_test_9.o): New targets.
11383         * testsuite/Makefile.in: Rebuild.
11384
11385 2008-07-22  Ian Lance Taylor  <iant@google.com>
11386
11387         * options.h (class General_options): Define --check-sections.
11388         * layout.cc (Layout::set_segment_offsets): Handle
11389         --check-sections.
11390
11391         * options.h (class General_options): Define -n/--nmagic and
11392         -N/--omagic.
11393         * options.cc (General_options::finalize): For -n/--nmagic or
11394         -N/--omagic, set -static.
11395         * layout.cc (Layout::attach_allocated_section_to_segment): If
11396         -N/--omagic, don't put read-only and read-write sections in
11397         different segments.
11398         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11399         finding a read-only segment.
11400         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11401         don't set the minimum segment alignment to the common page size,
11402         and don't set the file offset to the address modulo the page size.
11403         * script-sections.cc (Script_sections::create_segments): If
11404         -n/--omagic, don't put read-only and read-write sections in
11405         different segments.
11406
11407         * cref.cc: New file.
11408         * cref.h: New file.
11409         * options.h (class General_options): Add --print-symbol-counts.
11410         * main.cc (main): Issue defined symbol report if requested.
11411         * archive.cc (Archive::interpret_header): Make into a const member
11412         function.
11413         (Archive::add_symbols): Call Input_objects::archive_start and
11414         archive_stop.
11415         (Archive::const_iterator): Define new class.
11416         (Archive::begin, Archive::end): New functions.
11417         (Archive::include_all_members): Rewrite to use iterator.
11418         (Archive::count_members): New function.
11419         * archive.h (class Archive): Update declarations.
11420         (Archive::filename): New function.
11421         * object.cc: Include "cref.h".
11422         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11423         (Sized_relobj::do_get_global_symbol_counts): New function.
11424         (Input_objects::add_object): Add object to cross-referencer.
11425         (Input_objects::archive_start): New function.
11426         (Input_objects::archive_stop): New function.
11427         (Input_objects::print_symbol_counts): New function.
11428         * object.h: Declare Cref and Archive.
11429         (Object::get_global_symbol_counts): New function.
11430         (Object::do_get_global_symbol_counts): New pure virtual function.
11431         (class Sized_relobj): Add defined_count_ field.  Update
11432         declarations.
11433         (class Input_objects): Add cref_ field.  Update constructor.
11434         Update declarations.
11435         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11436         defined_count_.
11437         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11438         symbol counts.
11439         (Sized_dynobj::do_get_global_symbol_counts): New function.
11440         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11441         defined_count_.  Update declarations.  Define Symbols typedef.
11442         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11443         parameter.  Change all callers.
11444         (Symbol_table::add_from_dynobj): Add sympointers and defined
11445         parameters.  Change all callers.
11446         * symtab.h (class Symbol_table): Update declarations.
11447         * Makefile.am (CCFILES): Add cref.cc.
11448         (HFILES): Add cref.h.
11449         * Makefile.in: Rebuild.
11450
11451 2008-07-22  Simon Baldwin  <simonb@google.com>
11452
11453         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11454         to zero when writing undefined symbols.
11455
11456 2008-07-22  Ian Lance Taylor  <iant@google.com>
11457
11458         * output.cc (Output_section::add_input_section): Don't try to
11459         merge empty merge sections.
11460
11461 2008-07-21  Craig Silverstein  <csilvers@google.com>
11462
11463         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11464         Include symbol version in error message.
11465
11466 2008-07-20  Chris Demetriou  <cgd@google.com>
11467
11468         * configure.ac (gold_cv_c_random_seed): New configured variable.
11469         (RANDOM_SEED_CFLAGS): New substituted variable.
11470         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11471         * configure: Rebuild.
11472         * Makefile.in: Likewise.
11473         * testsuite/Makefile.in: Likewise.
11474
11475 2008-07-18  Ian Lance Taylor  <iant@google.com>
11476
11477         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11478         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11479         * testsuite/ver_test_main.cc (main): Call t4.
11480         (t4, t4_2a): Define.
11481         * testsuite/ver_test_2.cc (t4_2): Define.
11482         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11483         * testsuite/ver_test_4.cc (t4_2a): Define.
11484         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11485         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11486
11487 2008-07-17  Ian Lance Taylor  <iant@google.com>
11488
11489         * dynobj.cc (Versions::add_def): If we give an error about a
11490         missing version, go ahead and create the version anyhow.
11491
11492 2008-07-10  Ian Lance Taylor  <iant@google.com>
11493
11494         Handle output sections with more than 0x7fffffff bytes.
11495         * object.h (class Relobj): Change map_to_output_ to
11496         output_sections_, and just keep a section pointer.  Change all
11497         uses.  Move comdat group support to Sized_relobj.
11498         (Relobj::is_section_specially_mapped): Remove.
11499         (Relobj::output_section): Remove poff parameter.  Change all
11500         callers.
11501         (Relobj::output_section_offset): New function.
11502         (Relobj::set_section_offset): Rewrite.
11503         (Relobj::map_to_output): Remove.
11504         (Relobj::output_sections): New function.
11505         (Relobj::do_output_section_offset): New pure virtual function.
11506         (Relobj::do_set_section_offset): Likewise.
11507         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11508         group support from Relobj.  Update declarations.
11509         (Sized_relobj::get_output_section_offset): New function.
11510         (Sized_relobj::do_output_section_offset): New function.
11511         (Sized_relobj::do_set_section_offset): New function.
11512         * object.cc (Relobj::output_section_address): Remove.
11513         (Sized_relobj::Sized_relobj): Initialize new fields.
11514         (Sized_relobj::include_section_group): Cast find_kept_object to
11515         Sized_relobj.
11516         (Sized_relobj::include_linkonce_section): Likewise.
11517         (Sized_relobj::do_layout): Use separate arrays for output section
11518         and output offset.
11519         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11520         output_sections.
11521         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11522         output_sections and section_offsets.
11523         (Sized_relobj::write_local_symbols): Likewise.
11524         (map_to_kept_section): Compute output address directly.
11525         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11526         output_sections and section_offsets.
11527         (Sized_relobj::write_sections): Likewise.
11528         (Sized_relobj::relocate_sections): Likewise.
11529         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11530         * output.h (class Output_reloc): Update declarations.  Change
11531         u2_.relobj to Sized_relobj*.
11532         (class Output_data_reloc): Change add functions to use
11533         Sized_relobj*.
11534         * output.cc (Output_reloc::Output_reloc): Change relobj to
11535         Sized_relobj*.
11536         (Output_reloc::local_section_offset): Change return type to
11537         Elf_Addr.  Use get_output_section_offset.
11538         (Output_reloc::get_address): Likewise.
11539         (Output_section::is_input_address_mapped): Don't call
11540         is_section_specially_mapped.
11541         (Output_section::output_offset): Likewise.
11542         (Output_section::output_address): Likewise.
11543         (Output_section::starting_output_address): Likewise.
11544         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11545         parameter to Sized_relobj*.
11546         (Copy_relocs::need_copy_reloc): Likewise.
11547         (Copy_relocs::save): Likewise.
11548         * copy-relocs.h (class Copy_relocs): Update declarations.
11549         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11550         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11551         * target-reloc.h (relocate_for_relocatable): Change
11552         offset_in_output_section type to Elf_Addr.  Change code that uses
11553         it as well.
11554         * layout.cc (Layout::layout): Always set *off.
11555         * mapfile.cc (Mapfile::print_input_section): Use
11556         output_section_offset.
11557         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11558         Sized_relobj*.
11559         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11560         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11561         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11562
11563 2008-07-03  Ian Lance Taylor  <iant@google.com>
11564
11565         * layout.cc (Layout::include_section): Do not discard unrecognized
11566         SHT_STRTAB sections.
11567
11568 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11569
11570         * script.cc (Lex::can_continue_name): Make '?' allowable in
11571         version-script names.
11572         * testsuite/version_script.map: Change glob pattern to use '?'
11573
11574 2008-06-30  Manish Singh  <yosh@gimp.org>
11575
11576         PR 6585
11577         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11578         Correct typo.
11579
11580 2008-06-30  Ian Lance Taylor  <iant@google.com>
11581
11582         PR 6660
11583         PR 6682
11584         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11585         versions]: Don't try to read the value in the contents, since we
11586         don't use it.  Use the template endianness when writing.
11587
11588 2008-06-25  Cary Coutant  <ccoutant@google.com>
11589
11590         * fileread.cc (File_read::make_view): Assert on zero-length view.
11591         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11592         symbol table when there are no symbols to read.
11593
11594 2008-06-23  Craig Silverstein  <csilvers@google.com>
11595
11596         * version.cc (version_string): Bump to 1.7
11597
11598 2008-06-18  Craig Silverstein  <csilvers@google.com>
11599
11600         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11601         constant 0xFFFF to type Valtype.
11602         (Powerpc_relocate_functions::rel16_ha): Likewise.
11603
11604 2008-06-17  Ian Lance Taylor  <iant@google.com>
11605
11606         * output.h (Output_section::Input_section): Initialize p2align_ to
11607         zero for Output_section_data constructors.
11608         (Output_section::Input_section::addralign): If not an input
11609         section, return the alignment of the Output_section_data.
11610         * testsuite/copy_test.cc: New file.
11611         * testsuite/copy_test_1.cc: New file.
11612         * testsuite/copy_test_2.cc: New file.
11613         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11614         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11615         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11616         (copy_test_1_pic.o, copy_test_1.so): New targets.
11617         (copy_test_2_pic.o, copy_test_2.so): New targets.
11618         * testsuite/Makefile.in: Rebuild.
11619
11620         * script-sections.cc (Script_sections::place_orphan): Initialize
11621         local variable exact.
11622
11623 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11624
11625         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11626
11627 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11628             David S. Miller  <davem@davemloft.net>
11629
11630         * powerpc.cc: New file.
11631         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11632         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11633         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11634         * Makefile.in: Rebuild.
11635
11636 2008-06-09  Ian Lance Taylor  <iant@google.com>
11637
11638         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11639         <exception>.
11640         (throwing, orig_terminate): New static variables.
11641         (terminate_handler): New static function.
11642         (t2): Set terminate handler.
11643
11644 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11645
11646         PR 6584
11647         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11648         alignment.
11649
11650 2008-05-30  Cary Coutant  <ccoutant@google.com>
11651
11652         * archive.cc (Archive::include_all_members) Correct to step
11653         over symbol table and extended name table in thin archives.
11654
11655 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11656
11657         PR 6407
11658         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11659         calculation.
11660
11661 2008-05-28  Caleb Howe  <cshowe@google.com>
11662
11663         * reduced_debug_output.cc: New file.
11664         * reduced_debug_output.h: New file.
11665         * options.h (class General_options): Add --strip-debug-non-line.
11666         * options.cc (General_options::finalize): Add strip_debug_non_line
11667         to the strip heirarchy.
11668         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11669         fields.
11670         * layout.cc: Include "reduced_debug_output.h".
11671         (Layout::Layout): Initialize new fields.
11672         (line_only_debug_sections): New static array.
11673         (is_lines_only_debug_sections): New static inline function.
11674         (Layout::include_section): Handle --strip-debug-non-line.
11675         (Layout::make_output_section): If --strip-debug-non-line, build
11676         new output sections for .debug_abbrev and .debug_info.
11677         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11678         gold.  Warn about possible overflow.
11679         (read_signed_LEB_128): Likewise.
11680         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11681         (read_signed_LEB_128): Declare.
11682         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11683         (HFILES): Add reduced_debug_output.h.
11684         * Makefile.in: Rebuild.
11685
11686 2008-05-21  Ian Lance Taylor  <iant@google.com>
11687
11688         * mapfile.cc: New file.
11689         * mapfile.h: New file.
11690         * options.h (class General_options): Add -M/--print-map and -Map.
11691         * options.cc (General_options::finalize): Make -M equivalent to
11692         -Map -.
11693         * main.cc: Include <cstdio> and "mapfile.h".
11694         (main): Open mapfile if requested.
11695         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11696         constructor.  Change caller.
11697         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11698         (queue_middle_tasks): Likewise.
11699         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11700         declarations.
11701         * archive.cc: Include "mapfile.h".
11702         (Archive::add_symbols): Add mapfile parameter.  Change all
11703         callers.  Pass mapfile, symbol, and reason to include_member.
11704         (Archive::include_all_members): Add mapfile parameter.  Change all
11705         callers.
11706         (Archive::include_member): Add mapfile, sym, and why parameters.
11707         Change all callers.  Report inclusion to map file.
11708         * archive.h: Include "fileread.h".
11709         (class Archive): Update declarations.
11710         (Archive::file): New const method.
11711         (class Add_archive_symbols): Add mapfile_ field.  Update
11712         constructor.  Change all callers.
11713         * readsyms.h (class Read_symbols): Likewise.
11714         (class Finish_group): Likewise.
11715         (class Read_script): Likewise.
11716         * common.cc: Include "mapfile.h".
11717         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11718         all callers.
11719         (Symbol_table::do_allocate_commons): Likewise.
11720         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11721         symbol allocation to mapfile.
11722         * common.h (class Allocate_commons_task): Add mapfile_ field.
11723         Update constructor.  Change all callers.
11724         * symtab.h (class Symbol_table): Update declarations.
11725         * layout.cc: Include "mapfile.h".
11726         (Layout_task_runner::run): Print information to mapfile.
11727         (Layout::create_gold_note): Change Output_data_fixed_space to
11728         Output_data_zero_fill.
11729         (Layout::create_build_id): Likewise.
11730         (Layout::print_to_mapfile): New function.
11731         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11732         constructor.  Change caller.
11733         (class Layout): Declare print_to_mapfile.
11734         * output.cc (Output_section::Input_section::print_to_mapfile): New
11735         function.
11736         (Output_section::add_input_section): If producing a map, always
11737         add to input_sections_ list.
11738         (Output_section::do_print_to_mapfile): New function.
11739         (Output_segment::print_sections_to_mapfile): New function.
11740         (Output_segment::print_section_list_to_mapfile): New function.
11741         * output.h: Include "mapfile.h".
11742         (Output_data::print_to_mapfile): New function.
11743         (Output_data::do_print_to_mapfile): New virtual function.
11744         (Output_segment_headers::do_print_to_mapfile): New function.
11745         (Output_file_header::do_print_to_mapfile): New function.
11746         (Output_data_const::do_print_to_mapfile): New function.
11747         (class Output_data_const_buffer): Add map_name_ field.  Update
11748         constructor.  Change all callers.  Add do_print_to_mapfile
11749         function.
11750         (class Output_data_fixed_space): Likewise.
11751         (class Output_data_space): Likewise.
11752         (class Output_data_zero_fill): New class.
11753         (Output_data_strtab::do_print_to_mapfile): New function.
11754         (Output_data_reloc_base::do_print_to_mapfile): New function.
11755         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11756         (Output_data_group::do_print_to_mapfile): New function.
11757         (Output_data_got::do_print_to_mapfile): New function.
11758         (Output_data_dynamic::do_print_to_mapfile): New function.
11759         (Output_symtab_xindex::do_print_to_mapfile): New function.
11760         (class Output_section): Declare do_print_to_mapflie.  Declare
11761         print_to_mapfile in Input_section.
11762         (class Output_segment): Declare new functions.
11763         * object.h (Sized_relobj::symbol_count): New function.
11764         * script-sections.cc
11765         (Output_section_element_dot_assignment::set_section_addresses):
11766         Change Output_data_fixed_space to Output_data_zero_fill.
11767         (Output_data_expression::do_print_to_mapfile): New function.
11768         * script.cc (read_input_script): Add mapfile parameter.  Change
11769         all callers.
11770         * script.h (read_input_script): Update declaration.
11771         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11772         (Eh_frame::do_print_to_mapfile): New function.
11773         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11774         (Output_merge_string::do_print_to_mapfile): New function.
11775         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11776         function.
11777         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11778         function.
11779         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11780         function.
11781         * Makefile.am (CCFILES): Add mapfile.cc.
11782         (HFILES): Add mapfile.h.
11783         * Makefile.in: Rebuild.
11784
11785 2008-05-19  Ian Lance Taylor  <iant@google.com>
11786
11787         * options.h (class General_options): Add -z relro.
11788         * layout.cc (Layout::Layout): Initialize relro_segment_.
11789         (Layout::add_output_section_data): Return the output section.
11790         (Layout::make_output_section): Rcognize relro sections and mark
11791         them appropriately.
11792         (Layout::attach_allocated_section_to_segment): Put relro sections
11793         in a PT_GNU_RELRO segment.
11794         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11795         section as relro.
11796         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11797         PT_TLS segments.
11798         (Layout::linkonce_mapping): Map d.rel.ro.local to
11799         .data.rel.ro.local.
11800         (Layout::output_section_name): Us .data.rel.ro.local for any
11801         section which begins with that.
11802         * layout.h (class Layout): Update add_output_section_data
11803         declaration.  Add relro_segment_ field.
11804         * output.cc (Output_section::Output_section): Initialize is_relro_
11805         and is_relro_local_ fields.
11806         (Output_segment::add_output_section): Group relro sections.
11807         (Output_segment::is_first_section_relro): New function.
11808         (Output_segment::maximum_alignment): If there is a relro section,
11809         align the segment to the common page size.
11810         (Output_segment::set_section_addresses): Track whether we are
11811         looking at relro sections.  If the last section is a relro
11812         section, align to the common page size.
11813         (Output_segment::set_section_list_addresses): Add in_relro
11814         parameter.  Change all callers.  Align to the page size when
11815         moving from relro to non-relro section.
11816         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11817         segment.
11818         * output.h (class Output_section): Add is_relro_ and
11819         is_relro_local_ fields.
11820         (Output_section::is_relro): New function.
11821         (Output_section::set_is_relro): New function.
11822         (Output_section::is_relro_local): New function.
11823         (Output_section::set_is_relro_local): New function.
11824         (class Output_segment): Update declarations.
11825         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11826         * sparc.cc (Target_sparc::got_section): Likewise.
11827         * x86_64.cc (Target_x86_64::got_section): Likewise.
11828         * testsuite/relro_test_main.cc: New file.
11829         * testsuite/relro_test.cc: New file.
11830         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11831         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11832         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11833         (relro_test.so, relro_test_pic.o): New targets.
11834         * testsuite/Makefile.in: Rebuild.
11835
11836 2008-05-16  Ian Lance Taylor  <iant@google.com>
11837
11838         * output.cc (Output_segment::add_output_section): Remove front
11839         parameter.
11840         * output.h (class Output_segment): Remove
11841         add_initial_output_section and overloaded add_output_section.
11842         Update declaration of remaining add_output_section.
11843         * layout.cc (Layout::create_interp): Call add_output_section
11844         rather than add_initial_output_section.
11845         (Layout::finish_dynamic_section): Likewise.
11846
11847         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11848         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11849         know the dynamic type.
11850         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11851         field.  Initialize it in constructor.
11852         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11853         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11854         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11855         reloc.
11856
11857         * output.cc (Output_reloc::get_address): Change return type to
11858         Elf_Addr.
11859         * output.h (class Output_reloc): Update get_address declaration.
11860         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11861         for section addresses.
11862
11863 2008-05-09  Ian Lance Taylor  <iant@google.com>
11864
11865         PR 6493
11866         * gold.cc (gold_nomem): Use return value of write.
11867
11868 2008-05-08  Ian Lance Taylor  <iant@google.com>
11869
11870         * symtab.c (Symbol::init_base_output_data): Add version
11871         parameter.  Change all callers.
11872         (Symbol::init_base_output_segment): Likewise.
11873         (Symbol::init_base_constant): Likewise.
11874         (Symbol::init_base_undefined): Likewise.
11875         (Sized_symbol::init_output_data): Likewise.
11876         (Sized_symbol::init_output_segment): Likewise.
11877         (Sized_symbol::init_constant): Likewise.
11878         (Sized_symbol::init_undefined): Likewise.
11879         (Symbol_table::do_define_in_output_data): If the new symbol has a
11880         version, mark it as the default.
11881         (Symbol_table::do_define_in_output_segment): Likewise.
11882         (Symbol_table::do_define_as_constant): Likewise.
11883         * symtab.h (class Symbol): Update declarations.
11884         (class Sized_symbol): Likewise.
11885         * resolve.cc (Symbol::override_version): New function.
11886         (Symbol::override_base): Call override_version.
11887         (Symbol::override_base_with_special): Likewise.
11888         * testsuite/ver_script_8.script: New file.
11889         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11890         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11891         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11892         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11893
11894 2008-05-06  Ian Lance Taylor  <iant@google.com>
11895
11896         PR 6049
11897         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11898         functions.
11899         (class General_options): Remove existing --undefined, and add
11900         --no-undefined instead.  Add new --undefined as synonym for -u.
11901         * archive.cc (Archive::add_symbols): Check whether symbol was
11902         named with -u.
11903         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11904         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11905         all uses.  Add IS_UNDEFINED.  Update declarations to split
11906         different versions of init_base.  Declare init_base_undefined.
11907         (Symbol::is_defined): Handle IS_UNDEFINED.
11908         (Symbol::is_undefined): Likewise.
11909         (Symbol::is_weak_undefined): Call is_undefined.
11910         (Symbol::is_absolute): Handle IS_CONSTANT.
11911         (class Sized_symbol): Update declarations to split different
11912         versions of init.  Declare init_undefined.
11913         (class Symbol_table): Declare new functions.
11914         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11915         Change all callers.
11916         (Symbol::init_base_output_data): Likewise.
11917         (Symbol::init_base_output_segment): Likewise.
11918         (Symbol::init_base_constant): Likewise.
11919         (Symbol::init_base_undefined): New function.
11920         (Sized_symbol::init_object): Rename from init.  Change all
11921         callers.
11922         (Sized_symbol::init_output_data): Likewise.
11923         (Sized_symbol::init_output_segment): Likewise.
11924         (Sized_symbol::init_constant): Likewise.
11925         (Sized_symbol::init_undefined): New function.
11926         (Symbol_table::add_undefined_symbols_from_command_line): New
11927         function.
11928         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11929         function.
11930         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11931         (Symbol::output_section): Likewise.
11932         (Symbol::set_output_section): Likewise.
11933         (Symbol_table::sized_finalize_symbol): Likewise.
11934         (Symbol_table::sized_write_globals): Likewise.
11935         * resolve.cc (Symbol_table::should_override): Likewise.
11936         (Symbol::override_base_with_special): Likewise.
11937
11938         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11939         symbol, change it to have default visibility.
11940         * testsuite/protected_1.cc: New file.
11941         * testsuite/protected_2.cc: New file.
11942         * testsuite/protected_3.cc: New file.
11943         * testsuite/protected_main_1.cc: New file.
11944         * testsuite/protected_main_2.cc: New file.
11945         * testsuite/protected_main_3.cc: New file.
11946         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11947         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11948         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11949         (protected_1.so): New target.
11950         (protected_1_pic.o, protected_2_pic.o): New targets.
11951         (protected_3_pic.o): New target.
11952         (check_PROGRAMS): Add protected_2.
11953         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11954         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11955         * testsuite/Makefile.in: Rebuild.
11956
11957         * options.h (DEFINE_var): Add set_user_set_##varname__.
11958         (DEFINE_bool_alias): New macro.
11959         (class General_options): Define -Bstatic using DEFINE_bool_alias
11960         rather than DEFINE_special.  Add --undefined as an alias for -z
11961         defs.
11962         * options.cc (General_options::parse_Bstatic): Remove.
11963
11964         * options.h (class General_options): Add --fatal-warnings.
11965         * main.cc (main): Implement --fatal-warnings.
11966         * errors.h (Errors::warning_count): New function.
11967
11968         * options.h (class General_options): Add -Bsymbolic-functions.
11969         * symtab.h (Symbol::is_preemptible): Check for
11970         -Bsymbolic-functions.
11971
11972 2008-05-05  Ian Lance Taylor  <iant@google.com>
11973
11974         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11975         as noVARNAME rather than no-VARNAME.
11976         (class General_options): Add option -z combreloc.
11977         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11978         get_address.
11979         (Output_reloc::sort_before) [SHT_REL]: New function.
11980         (Output_reloc::sort_before) [SHT_RELA]: New function.
11981         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11982         Sort_relocs_comparison.
11983         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11984         parameter.  Change all callers.
11985         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11986         sort_relocs parameter.  Change all callers.
11987         * output.cc (Output_reloc::get_address): New function, broken out
11988         of write_rel.
11989         (Output_reloc::write_rel): Call it.
11990         (Output_reloc::compare): New function.
11991         (Output_data_reloc_base::do_write): Optionally sort relocs.
11992
11993         * configure.ac: If targ_extra_obj is set, link it in.
11994         * configure.tgt: Initialize all variables.
11995         (x86_64*): Set targ_extra_obj and targ_extra_size.
11996         * configure: Rebuild.
11997
11998         * object.cc (Sized_relobj::include_section_group): Adjust section
11999         indexes read from group data.  Build vector to pass to
12000         layout_group.
12001         * layout.cc (Layout::layout_group): Add flags and shndxes
12002         parameters.  Remove contents parameter.  Change caller.  Update
12003         explicit instantiations.
12004         * layout.h (class Layout): Update layout_group declaration.
12005         * output.cc (Output_data_group::Output_data_group): Add flags and
12006         input_shndxes parameters.  Remove contents parameter.  Change
12007         caller.
12008         (Output_data_group::do_write): Change input_sections_ to
12009         input_shndxes_.
12010         * output.h (class Output_data_group): Update constructor
12011         declaration.  Rename input_sections_ to input_shndxes_.
12012         * testsuite/many_sections_test.cc: Add template.
12013
12014 2008-04-30  Cary Coutant  <ccoutant@google.com>
12015
12016         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12017
12018         * layout.cc (Layout::include_section): Refactored check for debug
12019         info section.
12020         (Layout::add_comdat): Add new parameters.  Change type
12021         of signature parameter.  Add object and shndx to signatures table.
12022         (Layout::find_kept_object): New function.
12023         * layout.h: Include <cstring>.
12024         (Layout::is_debug_info_section): New function.
12025         (Layout::add_comdat): Add new parameters.
12026         (Layout::find_kept_object): New function.
12027         (Layout::Kept_section): New struct.
12028         (Layout::Signatures): Change type of map range.
12029         * object.cc (Relobj::output_section_address): New function.
12030         (Sized_relobj::include_section_group): Add new parameters.  Change
12031         calls to Layout::add_comdat.  Change to build table of kept comdat
12032         groups and table mapping discarded sections to kept sections.
12033         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12034         (Sized_relobj::do_layout): Change calls to include_section_group and
12035         include_linkonce_section.
12036         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12037         value to zero when section is discarded.
12038         (Sized_relobj::map_to_kept_section): New function.
12039         * object.h (Relobj::output_section_address): New function.
12040         (Relobj::Comdat_group): New type.
12041         (Relobj::find_comdat_group): New function.
12042         (Relobj::Comdat_group_table): New type.
12043         (Relobj::Kept_comdat_section): New type.
12044         (Relobj::Kept_comdat_section_table): New type.
12045         (Relobj::add_comdat_group): New function.
12046         (Relobj::set_kept_comdat_section): New function.
12047         (Relobj::get_kept_comdat_section): New function.
12048         (Relobj::comdat_groups_): New field.
12049         (Relobj::kept_comdat_sections_): New field.
12050         (Symbol_value::input_value): Update comment.
12051         (Sized_relobj::map_to_kept_section) New function.
12052         (Sized_relobj::include_linkonce_section): Add new parameter.
12053         * target-reloc.h (Comdat_behavior): New type.
12054         (get_comdat_behavior): New function.
12055         (relocate_section): Add code to map a discarded section to the
12056         corresponding kept section when applying a relocation.
12057
12058 2008-04-30  Craig Silverstein  <csilvers@google.com>
12059
12060         * dwarf_reader.cc (next_generation_count): New static var.
12061         (Addr2line_cache_entry): New struct.
12062         (addr2line_cache): New static var.
12063         (Dwarf_line_info::one_addr2line): Added caching.
12064         (Dwarf_line_info::clear_addr2line_cache): New function.
12065         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12066         cache-size parameter.
12067         (Dwarf_line_info::one_addr2line_cache): New function.
12068         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12069         new cache-size argument to one_addr2line(), and clear cache.
12070
12071 2008-04-28  Cary Coutant  <ccoutant@google.com>
12072
12073         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12074         R_386_PC8 relocations.
12075
12076 2008-04-23  Ian Lance Taylor  <iant@google.com>
12077
12078         * object.cc (Sized_relobj::include_section_group): Check for
12079         invalid section group.
12080
12081         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12082         header size.
12083
12084         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12085         than read for file header.
12086         * archive.cc (Archive::include_member): Likewise.
12087
12088 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12089
12090         * aclocal.m4: Regenerate.
12091         * configure: Regenerate.
12092
12093 2008-04-19  Ian Lance Taylor  <iant@google.com>
12094
12095         * version.cc (version_string): Bump to 1.6.
12096
12097         * testsuite/Makefile.am (many_sections_r_test): New target.
12098         (many_sections_r_test_SOURCES): Remove.
12099         (many_sections_r_test_DEPENDENCIES): Remove.
12100         (many_sections_r_test_LDFLAGS): Remove.
12101         (many_sections_r_test_LDADD): Remove.
12102
12103         * object.cc (Sized_relobj::do_add_symbols): Always pass
12104         local_symbol_count_ to add_from_relobj.
12105
12106         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12107         every thousand variables.
12108         * testsuite/Makefile.in: Rebuild.
12109
12110         * object.cc (Xindex::initialize_symtab_xindex): New function.
12111         (Xindex::read_symtab_xindex): New function.
12112         (Xindex::sym_xindex_to_shndx): New function.
12113         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12114         available.
12115         (Sized_relobj::do_initialize_xindex): New function.
12116         (Sized_relobj::do_read_symbols): Adjust section links.
12117         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12118         parameter.  Change all callers.
12119         (Sized_relobj::include_section_group): Adjust section links and
12120         symbol section indexes.
12121         (Sized_relobj::do_layout): Adjust section links.
12122         (Sized_relobj::do_count_local_symbols): Adjust section links and
12123         symbol section indexes.
12124         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12125         ordinary and special symbols.
12126         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12127         dynsym_xindex parameters.  Change all callers.  Adjust section
12128         links.  Use SHN_XINDEX when needed.
12129         (Sized_relobj::get_symbol_location_info): Adjust section links.
12130         Don't get fooled by special symbols.
12131         * object.h (class Xindex): Define.
12132         (class Object): Add xindex_ parameter.  Declare virtual functoin
12133         do_initialize_xindex.
12134         (Object::adjust_sym_shndx): New function.
12135         (Object::set_xindex): New protected function.
12136         (class Symbol_value): Add is_ordinary_shndx_ field.
12137         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12138         (Symbol_value::value): Assert ordinary section.
12139         (Symbol_value::initialize_input_to_output_map): Likewise.
12140         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12141         Change all callers.
12142         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12143         all callers.
12144         (class Sized_relobj): Update declarations.
12145         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12146         parameter.  Change all callers.
12147         (Sized_relobj::adjust_shndx): New function.
12148         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12149         field.
12150         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12151         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12152         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12153         (Sized_dynobj::read_dynsym_section): Adjust section links.
12154         (Sized_dynobj::read_dynamic): Likewise.
12155         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12156         section links.
12157         (Sized_dynobj::do_initialize_xindex): New function.
12158         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12159         do_initialize_xindex.
12160         (Sized_dynobj::adjust_shndx): New function.
12161         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12162         dynsym_xindex_ fields.
12163         (Layout::finalize): Add a call to set_section_indexes before
12164         creating the symtab sections.
12165         (Layout::set_section_indexes): Don't do anything if the section
12166         already has a section index.
12167         (Layout::create_symtab_sections): Add shnum parameter.  Change
12168         caller.  Create .symtab_shndx section if needed.
12169         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12170         caller.
12171         (Layout::allocated_output_section_count): New function.
12172         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12173         needed.
12174         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12175         fields.  Update declarations.
12176         (Layout::symtab_xindex): New function.
12177         (Layout::dynsym_xindex): New function.
12178         (class Write_symbols_task): Add layout_ field.
12179         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12180         Change caller.
12181         * output.cc (Output_section_headers::Output_section_headers): Add
12182         shstrtab_section parameter.  Change all callers.
12183         (Output_section_headers::do_sized_write): Store overflow values
12184         for section count and section string table section index in
12185         section header zero.
12186         (Output_file_header::do_sized_write): Check for overflow of
12187         section count and section string table section index.
12188         (Output_symtab_xindex::do_write): New function.
12189         (Output_symtab_xindex::endian_do_write): New function.
12190         * output.h (class Output_section_headers): Add shstrtab_section_.
12191         Update declarations.
12192         (class Output_symtab_xindex): Define.
12193         (Output_section::has_out_shndx): New function.
12194         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12195         field.
12196         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12197         Change all callers.
12198         (Sized_symbol::init): Likewise.
12199         (Symbol::output_section): Check for ordinary symbol.
12200         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12201         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12202         callers.
12203         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12204         Change all callers.  Simplify handling of symbols from sections
12205         not included in the link.
12206         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12207         distinction.
12208         (Weak_alias_sorter::operator()): Assert that symbols are
12209         ordinary.
12210         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12211         distinction.
12212         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12213         parameters.  Change all callers.
12214         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12215         symbol distinction.  Use SHN_XINDEX when needed.
12216         (Symbol_table::write_section_symbol): Add symtab_xindex
12217         parameter.  Change all callers.
12218         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12219         SHN_XINDEX when needed.
12220         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12221         declarations.
12222         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12223         (Symbol::is_defined): Check is_ordinary.
12224         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12225         (Symbol::is_absolute, Symbol::is_common): Likewise.
12226         (class Sized_symbol): Update declarations.
12227         (class Symbol_table): Update declarations.
12228         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12229         parameters.  Change all callers.
12230         (Sized_symbol::override): Likewise.
12231         (Symbol_table::override): Likewise.
12232         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12233         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12234         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12235         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12236         to be in an ordinary section.
12237         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12238         object and is_ordinary parameters.  Change all callers.
12239         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12240         Change all callers.  Don't add undefined or non-ordinary symbols
12241         to reloc_map_.
12242         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12243         Change all callers.
12244         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12245         declarations.
12246         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12247         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12248         (Sized_relobj::relocate_sections): Likewise.
12249         * target-reloc.h (scan_relocs): Adjust section symbol index.
12250         (scan_relocatable_relocs): Likewise.
12251         * i386.cc (Scan::local): Check for ordinary symbols.
12252         * sparc.cc (Scan::local): Likewise.
12253         * x86_64.cc (Scan::local): Likewise.
12254         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12255         to symbol_section_and_value.
12256         * testsuite/many_sections_test.cc: New file.
12257         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12258         (check_PROGRAMS): Add many_sections_test.
12259         (many_sections_test_SOURCES): Define.
12260         (many_sections_test_DEPENDENCIES): Define.
12261         (many_sections_test_LDFLAGS): Define.
12262         (BUILT_SOURCES): Add many_sections_define.h.
12263         (many_sections_define.h): New target.
12264         (BUILT_SOURCES): Add many_sections_check.h.
12265         (many_sections_check.h): New target.
12266         (check_PROGRAMS): Add many_sections_r_test.
12267         (many_sections_r_test_SOURCES): Define.
12268         (many_sections_r_test_DEPENDENCIES): Define.
12269         (many_sections_r_test_LDFLAGS): Define.
12270         (many_sections_r_test_LDADD): Define.
12271         (many_sections_r_test.o): New target.
12272         * testsuite/Makefile.in: Rebuild.
12273
12274 2008-04-17  Cary Coutant  <ccoutant@google.com>
12275
12276         * errors.cc (Errors::info): New function.
12277         (gold_info): New function.
12278         * errors.h (Errors::info): New function.
12279         * gold.h (gold_info): New function.
12280         * object.cc (Input_objects::add_object): Print trace output.
12281         * options.cc (options::parse_set): New function.
12282         (General_options::parse_wrap): Deleted.
12283         (General_options::General_options): Deleted initializer.
12284         * options.h (options::String_set): New typedef.
12285         (options::parse_set): New function.
12286         (DEFINE_set): New macro.
12287         (General_options::wrap): Changed to use DEFINE_set. Changed
12288         callers of any_wrap_symbols and is_wrap_symbol.
12289         (General_options::trace, General_options::trace_symbol):
12290         New options.
12291         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12292         (General_options::wrap_symbols_): Deleted.
12293         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12294
12295 2008-04-17  David S. Miller  <davem@davemloft.net>
12296
12297         * options.cc (General_options::parse_V): New function.
12298         * options.h: Add entries for -V and -Qy.
12299
12300 2008-04-17  Ian Lance Taylor  <iant@google.com>
12301
12302         * common.cc (Symbol_table::allocate_commons): Remove options
12303         parameter.  Change caller.
12304         (Symbol_table::do_allocate_commons): Remove options parameter.
12305         Change caller.  Just call do_allocate_commons_list twice.
12306         (Symbol_table::do_allocate_commons_list): New function, broken out
12307         of do_allocate_commons.
12308         * common.h (class Allocate_commons_task): Remove options_ field.
12309         Update constructor.
12310         * symtab.cc (Symbol_table::Symbol_table): Initialize
12311         tls_commons_.
12312         (Symbol_table::add_from_object): Put TLS common symbols on
12313         tls_commons_ list.
12314         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12315         which are IN_OUTPUT_DATA.
12316         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12317         allocate_commons and do_allocate_commons declarations.  Declare
12318         do_allocate_commons_list.
12319         * gold.cc (queue_middle_tasks): Update creation of
12320         Allocate_commons_task to not pass options.
12321         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12322         (TLS_TEST_C_FLAGS): New variable.
12323         (tls_test_c_pic.o): New target.
12324         (tls_test_shared.so): Link in tls_test_c_pic.o.
12325         (tls_test_c_pic_ie.o): New target.
12326         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12327         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12328         (tls_test_c.o): New target.
12329         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12330         (tls_pic_test_LDADD): Likewise.
12331         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12332         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12333         (tls_test_c_gnu2.o): New target.
12334         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12335         tls_test_c_gnu2.o.
12336         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12337         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12338         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12339         * testsuite/tls_test.cc: Include "config.h".
12340         (t_last): Call t11_last.
12341         * testsuite/tls_test.h (t11, t11_last): Declare.
12342         * testsuite/tls_test_c.c: New file.
12343         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12344         * configure.ac: Check for OpenMP support.
12345         * configure, config.in, Makefile.in: Rebuild.
12346         * testsuite/Makefile.in: Rebuild.
12347
12348 2008-04-16  Cary Coutant  <ccoutant@google.com>
12349
12350         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12351         (Target_i386::tls_base_symbol_defined_): New field.
12352         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12353         (Target_i386::Scan::global): Likewise.
12354         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12355         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12356         (Target_x86_64::tls_base_symbol_defined_): New field.
12357         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12358         (Target_x86_64::Scan::global): Likewise.
12359
12360 2008-04-16  Cary Coutant  <ccoutant@google.com>
12361
12362         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12363         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12364         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12365         building shared libraries.
12366         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12367         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12368         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12369         * testsuite/Makefile.in: Rebuild.
12370         * testsuite/weak_undef.h: New file.
12371         * testsuite/weak_undef_file1.cc: Add extra test cases.
12372         * testsuite/weak_undef_file2.cc: Likewise.
12373         * testsuite/weak_undef_test.cc: Likewise.
12374
12375 2008-04-16  David S. Miller  <davem@davemloft.net>
12376
12377         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12378         Add issued_non_pic_error_ field.  Declare check_non_pic.
12379         (Target_sparc::Scan::check_non_pic): New function.
12380         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12381         (Target_sparc::Scan::global): Likewise.
12382
12383         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12384         * configure: Rebuild.
12385
12386         * options.h (DEFINE_enable): New macro.
12387         (new_dtags): New enable option.
12388         (initfirst, interpose, loadfltr, nodefaultlib,
12389         nodelete, nodlopen, nodump): New -z options.
12390         * layout.cc (Layout:finish_dynamic_section): If new
12391         dtags enabled, emit DT_RUNPATH.  Also, emit a
12392         DT_FLAGS_1 containing any specified -z flags.
12393
12394 2008-04-16  Ian Lance Taylor  <iant@google.com>
12395
12396         * copy-relocs.cc: New file.
12397         * copy-relocs.h: New file.
12398         * reloc.cc: Remove Copy_relocs code.
12399         * reloc.h: Likewise.
12400         * reloc-types.h (struct Reloc_types) [both versions]: Add
12401         get_reloc_addend_noerror.
12402         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12403         variants of add_global which take an addend which must be zero.
12404         * i386.cc: Include "copy-relocs.h".
12405         (class Target_i386): Change type of copy_relocs_ to variable,
12406         update initializer.
12407         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12408         Change all callers.
12409         (Target_i386::do_finalize_sections): Change handling of
12410         copy_relocs_.
12411         * sparc.cc: Include "copy-relocs.h".
12412         (class Target_sparc): Change type of copy_relocs_ to variable,
12413         update initializer.
12414         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12415         Change all callers.
12416         (Target_sparc::do_finalize_sections): Change handling of
12417         copy_relocs_.
12418         * x86_64.cc: Include "copy-relocs.h".
12419         (class Target_x86_64): Change type of copy_relocs_ to variable,
12420         update initializer.
12421         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12422         class.  Change all callers.
12423         (Target_x86_64::do_finalize_sections): Change handling of
12424         copy_relocs_.
12425         * Makefile.am (CCFILES): Add copy-relocs.cc.
12426         (HFILES): Add copy-relocs.h.
12427
12428         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12429
12430         * testsuite/script_test_4.sh: Permit leading zeroes.
12431
12432 2008-04-15  Ian Lance Taylor  <iant@google.com>
12433
12434         * script-sections.cc (Script_sections::create_segments): Use
12435         header_size_adjustment even when there is enough room for the
12436         headers.
12437         * testsuite/script_test_4.sh: New file.
12438         * testsuite/script_test_4.t: New file.
12439         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12440         (check_DATA): Add script_test_4.stdout.
12441         (MOSTLYCLEANFILES): Likewise.
12442         (script_test_4): New target.
12443         (script_test_4.stdout): New target.
12444         * testsuite/Makefile.in: Rebuild.
12445
12446         * sparc.cc: Add definitions for Output_data_plt_sparc class
12447         constants.
12448
12449 2008-04-14  David S. Miller  <davem@davemloft.net>
12450
12451         * sparc.cc: New file.
12452         * Makefile.am (TARGETSOURCES): Add sparc.cc
12453         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12454         * configure.tgt: Document targ_extra_size and
12455         targ_extra_big_endian.  Add entries for sparc-* and
12456         sparc64-*.
12457         * configure.ac: Handle targ_extra_size and
12458         targ_extra_big_endian.
12459         * Makefile.in: Rebuild.
12460         * configure: Likewise.
12461         * po/POTFILES.in: Likewise.
12462         * po/gold.pot: Likewise.
12463
12464 2008-04-14  Ian Lance Taylor  <iant@google.com>
12465
12466         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12467         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12468         in the name/type/flags to section mapping.  Don't call
12469         allocate_output_section.
12470         (Layout::choose_output_section): Change parameter from adjust_name
12471         to is_input_section.  Don't permit input sections after sections
12472         are attached to segments.  Don't call allocate_output_section.
12473         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12474         not write_enable_output_section.
12475         (Layout::make_output_section): Don't push to
12476         unattached_section_list_ nor call attach_to_segment.  Call
12477         attach_section_to_segment if sections are attached.
12478         (Layout::attach_sections_to_segments): New function.
12479         (Layout::attach_section_to_segment): New function.
12480         (Layout::attach_allocated_section_to_segment): Rename from
12481         attach_to_segment.  Remove flags parameter.
12482         (Layout::allocate_output_section): Remove function.
12483         (Layout::write_enable_output_section): Remove function.
12484         * layout.h (class Layout): Update for above changes.  Add new
12485         field sections_are_attached_.
12486         * output.h (Output_section::update_flags_for_input_section): New
12487         function.
12488         * output.cc (Output_section::add_input_section): Call
12489         update_flags_for_input_section.
12490         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12491
12492 2008-04-11  Cary Coutant  <ccoutant@google.com>
12493
12494         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12495         thought unnecessary.
12496         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12497
12498 2008-04-11  Ian Lance Taylor  <iant@google.com>
12499
12500         * output.h (class Output_section_data): Remove inline definition
12501         of set_addralign.
12502         * output.cc (Output_section_data::set_addralign): New function.
12503
12504 2008-04-11  Cary Coutant  <ccoutant@google.com>
12505
12506         Add support for TLS descriptors for i386 and x86_64.
12507         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12508         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12509         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12510         GOT_TYPE_TLS_DESC.
12511         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12512         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12513         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12514         relocations.
12515         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12516         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12517         Fix problem with initial-exec relocations.
12518         (Target_i386::Relocate::relocate_tls): Likewise.
12519         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12520         relaxation.
12521         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12522         support for section-plus-offset dynamic table entries.
12523         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12524         (Output_data_dynamic::Dynamic_entry): Add support for
12525         section-plus-offset dynamic table entries.
12526         (Output_data_dynamic::Classification): Likewise.
12527         (Output_data_dynamic::classification_): Renamed offset_.
12528         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12529         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12530         (Target_x86_64::make_plt_section): New function.
12531         (Target_x86_64::reserve_tlsdesc_entries): New function.
12532         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12533         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12534         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12535         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12536         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12537         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12538         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12539         add extra PLT entry for TLS descriptors.
12540         (Output_data_plt_x86_64::got_): New field.
12541         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12542         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12543         fields.
12544         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12545         descriptors.
12546         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12547         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12548         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12549         R_386_TLS_DESC_CALL relocations.
12550         (Target_x86_64::Scan::global): Likewise.
12551         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12552         for TLS descriptors.
12553         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12554         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12555         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12556         GD-to-IE relaxation.
12557         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12558         and TLS_DESCRIPTORS.
12559         * Makefile.in: Rebuild.
12560         * configure: Rebuild.
12561         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12562         (tls_test_shared2.so): New target.
12563         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12564         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12565         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12566         (tls_shared_gd_to_ie_test_LDADD): New variable.
12567         (tls_shared_gnu2_gd_to_ie_test): New target.
12568         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12569         New targets.
12570         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12571         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12572         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12573         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12574         (tls_shared_gnu2_test): New target.
12575         (tls_test_gnu2_shared.so): New target.
12576         (tls_shared_gnu2_test_SOURCES): New variable.
12577         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12578         (tls_shared_gnu2_test_LDFLAGS): New variable.
12579         (tls_shared_gnu2_test_LDADD): New variable.
12580         * testsuite/Makefile.in: Rebuild.
12581         * testsuite/Makefile.
12582
12583 2008-04-11  Ian Lance Taylor  <iant@google.com>
12584
12585         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12586         justsyms.t.
12587         * testsuite/Makefile.in: Rebuild.
12588
12589         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12590         long.
12591         * testsuite/script_test_2.cc (main): Adjust test.
12592
12593 2008-04-11  David S. Miller  <davem@davemloft.net>
12594             Ian Lance Taylor  <iant@google.com>
12595
12596         * options.h (General_options): Add entries for '-Y' and
12597         '-relax'.
12598         * options.cc (General_options:finalize): If -Y was used, add those
12599         entries to the library path instead of the default "/lib" and
12600         "/usr/lib".
12601
12602 2008-04-11  David S. Miller  <davem@davemloft.net>
12603
12604         * testsuite/justsyms.t: Start at 0x100.
12605         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12606         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12607         long.
12608         * testsuite/script_test_2.cc: Adjust string and section length
12609         checks.
12610
12611 2008-04-09  Ian Lance Taylor  <iant@google.com>
12612
12613         PR gold/5996
12614         * script-sections.cc (Sections_element::allocate_to_segment): Add
12615         orphan parameter.
12616         (Output_section_definition::allocate_to_segment): Likewise.
12617         (Orphan_output_section::allocate_to_segment): Likewise.
12618         (Script_sections::attach_sections_using_phdrs_clause): Don't
12619         propagate non-PT_LOAD segments to orphan sections.
12620         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12621         readelf rather than objdump.
12622         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12623         .interp section and PT_INTERP segment are the same size.
12624         * testsuite/Makefile.in: Rebuild.
12625
12626         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12627         aliases for symbols defined in the same object.
12628         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12629         (weak_alias_test_SOURCES): New variable.
12630         (weak_alias_test_DEPENDENCIES): New variable.
12631         (weak_alias_test_LDFLAGS): New variable.
12632         (weak_alias_test_LDADD): New variable.
12633         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12634         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12635         (weak_alias_test_3.o): New target.
12636         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12637         * testsuite/weak_alias_test_main.cc: New file.
12638         * testsuite/weak_alias_test_1.cc: New file.
12639         * testsuite/weak_alias_test_2.cc: New file.
12640         * testsuite/weak_alias_test_3.cc: New file.
12641
12642 2008-04-08  Ian Lance Taylor  <iant@google.com>
12643
12644         * options.h (class General_options): Add --noinhibit-exec option.
12645         * main.cc (main): Check --noinhibit-exec.
12646
12647         * options.h (class General_options): Define --wrap as a special
12648         option.  Add wrap_symbols_ field.
12649         (General_options::any_wrap_symbols): New function.
12650         (General_options::is_wrap_symbol): New function.
12651         * options.cc (General_options::parse_wrap): New function.
12652         (General_options::General_options): Initialize wrap_symbols_.
12653         * symtab.cc (Symbol_table::wrap_symbol): New function.
12654         (Symbol_table::add_from_object): Handle --wrap.
12655         * symtab.h (class Symbol_table): Declare wrap_symbol.
12656         * target.h (Target::wrap_char): New function.
12657         (Target::Target_info): Add wrap_char field.
12658         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12659         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12660         * testsuite/testfile.cc (Target_test::test_target_info):
12661         Likewise.
12662
12663         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12664         there is one.
12665
12666         * layout.h (class Layout): Add added_eh_frame_data_ field.
12667         * layout.cc (Layout::Layout): Initialize new field.
12668         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12669         output section until we find a section we merged successfully.
12670         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12671         that the size be non-zero.
12672
12673         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12674         qualifier.
12675
12676 2008-04-08  Craig Silverstein  <csilvers@google.com>
12677
12678         * configure.ac: Export new conditional variable HAVE_ZLIB.
12679         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12680         on HAVE_ZLIB.
12681         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12682         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12683
12684 2008-04-07  Ian Lance Taylor  <iant@google.com>
12685
12686         * version.cc (version_string): Set to "1.5".
12687
12688         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12689         Add issued_non_pic_error_ field.  Declare check_non_pic.
12690         (Target_x86_64::Scan::check_non_pic): New function.
12691         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12692         (Target_x86_64::Scan::global): Likewise.
12693
12694         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12695         addend parameter.  Change caller.  Handle merge sections.
12696         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12697         Address to Addend.  Don't add in the result of
12698         local_section_offset, pass down the addend and use the returned
12699         value.
12700         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12701         Update declarations of local_section_offset and symbol_value.
12702         * testsuite/two_file_test_1.cc (t18): New function.
12703         * testsuite/two_file_test_2.cc (f18): New function.
12704         * testsuite/two_file_test_main.cc (main): Call t18.
12705         * testsuite/two_file_test.h (t18, f18): Declare.
12706
12707         * configure.ac: Don't test for objdump, c++filt, or readelf.
12708         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12709         conditionals.
12710         (TEST_READELF): New variable.
12711         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12712         (check_PROGRAMS): Add two_file_strip_test.
12713         (two_file_strip_test): New target.
12714         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12715         (two_file_same_shared_strip_test_SOURCES): New variable.
12716         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12717         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12718         (two_file_same_shared_strip_test_LDADD): New variable.
12719         (two_file_shared_strip.so): New target.
12720         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12721         (ver_test_5.syms, ver_test_7.syms): Likewise.
12722         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12723         (strip_test_3.stdout): Use TEST_OBJDUMP.
12724         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12725
12726 2008-04-04  Cary Coutant  <ccoutant@google.com>
12727
12728         * symtab.h (Symbol::is_weak_undefined): New function.
12729         (Symbol::is_strong_undefined): New function.
12730         (Symbol::is_absolute): New function.
12731         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12732         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12733         absolute symbols.
12734         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12735         (weak_undef_test): New target.
12736         * testsuite/Makefile.in: Rebuild.
12737         * testsuite/weak_undef_file1.cc: New file.
12738         * testsuite/weak_undef_file2.cc: New file.
12739         * testsuite/weak_undef_test.cc: New file.
12740
12741 2008-04-03  Craig Silverstein  <csilvers@google.com>
12742
12743         * compressed_output.h (class Output_compressed_section): Use
12744         unsigned buffer.
12745         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12746         add zlib header.
12747         (zlib_compressed_suffix): Removed.
12748         (Output_compressed_section::set_final_data_size): Use unsigned
12749         buffers.
12750         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12751         Fix linker invocation.
12752         (flagstest_o_specialfile_and_compress_debug_sections):
12753         Likewise.
12754         * testsuite/Makefile.in: Regenerated.
12755
12756 2008-04-02  David S. Miller  <davem@davemloft.net>
12757
12758         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12759         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12760
12761 2008-04-02  Craig Silverstein  <csilvers@google.com>
12762
12763         * TODO: New file.
12764
12765 2008-04-02  Ian Lance Taylor  <iant@google.com>
12766
12767         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12768         parameters.  Update for new key type to views_.  Change all
12769         callers.
12770         (File_read::read): Adjust for byteshift in returned view.
12771         (File_read::add_view): New function, broken out of
12772         find_and_make_view.
12773         (File_read::make_view): New function, broken out of
12774         find_and_make_view.
12775         (File_read::find_or_make_view): Add offset and aligned
12776         parameters.  Rewrite accordingly.  Change all callers.
12777         (File_read::get_view): Add offset and aligned parameters.  Adjust
12778         for byteshift in return value.
12779         (File_read::get_lasting_view): Likewise.
12780         * fileread.h (class File_read): Update declarations.
12781         (class File_read::View): Add byteshift_ field.  Add byteshift to
12782         constructor.  Add byteshift method.
12783         * archive.h (Archive::clear_uncached_views): New function.
12784         (Archive::get_view): Add aligned parameter.  Change all callers.
12785         * object.h (Object::get_view): Add aligned parameter.  Change all
12786         callers.
12787         (Object::get_lasting_view): Likewise.
12788
12789         * fileread.cc (File_read::release): Don't call clear_views if
12790         there are multiple objects.
12791         * fileread.h (File_read::clear_uncached_views): New function.
12792         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12793         on the archive.
12794
12795 2008-03-31  Cary Coutant  <ccoutant@google.com>
12796
12797         Add thin archive support.
12798         * archive.cc (Archive::armagt): New const.
12799         (Archive::setup): Remove task parameter and calls to unlock.
12800         (Archive::unlock_nested_archives): New function.
12801         (Archive::read_header): Add nested_off parameter. Change
12802         all callers.
12803         (Archive::interpret_header): Likewise.
12804         (Archive::include_all_members): Change to handle thin
12805         archives.
12806         (Archive::include_member): Likewise.
12807         * archive.h (Archive::Archive): Add new parameters and
12808         initializers.
12809         (Archive::armagt): New const.
12810         (Archive::setup): Remove task parameter.
12811         (Archive::unlock_nested_archives): New function.
12812         (Archive::read_header): Add nested_off parameter.
12813         (Archive::interpret_header): Likewise.
12814         (Archive::Nested_archive_table): New typedef.
12815         (Archive::is_thin_archive_): New field.
12816         (Archive::nested_archives_): New field.
12817         (Archive::options_): New field.
12818         (Archive::dirpath_): New field.
12819         (Archive::task_): New field.
12820         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12821         for thin archives.  Pass additional parameters to
12822         Archive::Archive.  Unlock the archive file after calling
12823         Archive::setup.
12824
12825 2008-03-29  Ian Lance Taylor  <iant@google.com>
12826
12827         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12828         version symbol to be local.
12829         * testsuite/ver_test_4.sh: New file.
12830         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12831         (check_DATA): Add ver_test_4.syms.
12832         (ver_test_4.syms): New target.
12833         * testsuite/Makefile.in: Rebuild.
12834
12835         * output.cc
12836         (Output_section::Input_section_sort_entry::has_priority): New
12837         function.
12838         (Output_section::Input_section_sort_entry::match_file_name): New
12839         function.
12840         (Output_section::Input_section_sort_entry::match_section_name):
12841         Remove.
12842         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12843         Remove.
12844         (Output_section::Input_section_sort_entry::match_section_file):
12845         Remove.
12846         (Output_section::Input_section_sort_compare::operator()): Rewrite
12847         using new Input_section_sort_entry functions.  Sort crtbegin and
12848         crtend first.  Sort sections with no priority before sections with
12849         a priority.
12850         * testsuite/initpri1.c (d3): Check j != 4.
12851         (cd5): New constructor/destructor function.
12852         (main): Check j != 2.
12853
12854         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12855         new symbol when resolving, don't call set_is_default.
12856         * testsuite/ver_test_7.cc: New file.
12857         * testsuite/ver_test_7.sh: New file.
12858         * testsuite/Makefile.am (ver_test_7.so): New target.
12859         (ver_test_7.o): New target.
12860         (check_SCRIPTS): Add ver_test_7.sh.
12861         (check_DATA): Add ver_test_7.syms.
12862         (ver_test_7.syms): New target.
12863
12864 2008-03-28  Ian Lance Taylor  <iant@google.com>
12865
12866         * layout.cc (Layout::layout): If we see an input section with a
12867         name that needs sorting, set the must_sort flag for the output
12868         section.
12869         (Layout::make_output_section): If the name of the output section
12870         indicates that it might require sorting, set the may_sort flag.
12871         * output.h (Output_section::may_sort_attached_input_sections): New
12872         function.
12873         (Output_section::set_may_sort_attached_input_sections): New
12874         function.
12875         (Output_section::must_sort_attached_input_sections): New
12876         function.
12877         (Output_section::set_must_sort_attached_input_sections): New
12878         function.
12879         (class Output_section): Declare Input_section_sort_entry.  Define
12880         Input_section_sort_compare.  Declare
12881         sort_attached_input_sections.  Add new fields:
12882         may_sort_attached_input_sections_,
12883         must_sort_attached_input_sections_,
12884         attached_input_sections_are_sorted_.
12885         * output.cc (Output_section::Output_section): Initialize new
12886         fields.
12887         (Output_section::add_input_section): Add an entry to
12888         input_sections_ if may_sort or must_sort are true.
12889         (Output_section::set_final_data_size): Call
12890         sort_attached_input_sections if necessary.
12891         (Output_section::Input_section_sort_entry): Define new class.
12892         (Output_section::Input_section_sort_compare::operator()): New
12893         function.
12894         (Output_section::sort_attached_input_sections): New function.
12895         * configure.ac: Check whether the compiler supports constructor
12896         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12897         * testsuite/initpri1.c: New file.
12898         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12899         CONSTRUCTOR_PRIORITY.
12900         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12901         (initpri1_LDFLAGS): New variable.
12902         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12903
12904 2008-03-27  Ian Lance Taylor  <iant@google.com>
12905
12906         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12907         * testsuite/common_test_1.c: New file.
12908         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12909         (common_test_1_SOURCES): New variable.
12910         (common_test_1_DEPENDENCIES): New variable.
12911         (common_test_1_LDFLAGS): New variable.
12912
12913         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12914         and commons_ correctly when NAME/VERSION does not override
12915         NAME/NULL.
12916         * testsuite/ver_test_6.c: New file.
12917         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12918         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12919         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12920
12921 2008-03-26  Ian Lance Taylor  <iant@google.com>
12922
12923         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12924         of an undefined symbol from a version script.
12925         * testsuite/Makefile.am (ver_test_5.so): New target.
12926         (ver_test_5.o): New target.
12927         (check_SCRIPTS): Add ver_test_5.sh.
12928         (check_DATA): Add ver_test_5.syms.
12929         (ver_test_5.syms): New target.
12930         * testsuite/ver_test_5.cc: New file.
12931         * testsuite/ver_test_5.script: New file.
12932         * testsuite/ver_test_5.sh: New file.
12933         * Makefile.in, testsuite/Makefile.in: Rebuild.
12934
12935         PR gold/5986
12936         Fix problems building gold with gcc 4.3.0.
12937         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12938         (gold_error_at_location, gold_warning_at_location): Use it.
12939         * configure.ac: Check whether we can compile and use a template
12940         function with a printf attribute.
12941         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12942         when jumping over bytes.
12943         * object.cc: Instantiate Object::read_section_data.
12944         * debug.h: Include <cstring>
12945         * dwarf_reader.cc: Include <algorithm>
12946         * main.cc: Include <cstring>.
12947         * options.cc: Include <cstring>.
12948         * output.cc: Include <cstring>.
12949         * script.cc: Include <cstring>.
12950         * script.h: Include <string>.
12951         * symtab.cc: Include <cstring> and <algorithm>.
12952         * target-select.cc: Include <cstring>.
12953         * version.cc: Include <string>.
12954         * testsuite/testmain.cc: Include <cstdlib>.
12955         * configure, config.in: Rebuild.
12956
12957 2008-03-25  Ian Lance Taylor  <iant@google.com>
12958
12959         * options.cc: Include "../bfd/bfdver.h".
12960         (options::help): Print bug reporting address.
12961
12962         * version.cc (print_version): Adjust output for current value of
12963         BFD_VERSION_STRING.
12964
12965         * NEWS: New file.
12966
12967         * options.cc (options::help): Print list of supported targets.
12968         * target-select.h: Include <vector>.
12969         (class Target_selector): Make machine_, size_, and is_big_endian_
12970         fields const.  Add bfd_name_ and instantiated_target_ fields.
12971         (Target_selector::Target_selector): Add bfd_name parameter.
12972         (Target_selector::recognize): Make non-virtual, call
12973         do_recognize.
12974         (Target_selector::recognize_by_name): Make non-virtual, call
12975         do_recognize_by_name.
12976         (Target_selector::supported_names): New function.
12977         (Target_selector::bfd_name): New function.
12978         (Target_selector::do_instantiate_target): New pure virtual
12979         function.
12980         (Target_selector::do_recognize): New virtual function.
12981         (Target_selector::do_recognize_by_name): New virtual function.
12982         (Target_selector::instantiate_target): New private function.
12983         (supported_target_names): Declare.
12984         * target-select.cc (Target_selector::Target_selector): Update for
12985         new parameter and fields.
12986         (select_target_by_name): Check that the name matches before
12987         calling recognize_by_name.
12988         (supported_target_names): New function.
12989         * i386.cc (class Target_selector_i386): Update Target_selector
12990         constructor call.  Remove recognize and recognize_by_name.  Add
12991         do_instantiate_target.
12992         * x86_64.cc (class Target_selector_x86_64): Likewise.
12993         * testsuite/testfile.cc (class Target_selector_test): Update for
12994         changes to Target_selector.
12995
12996         * README: Rewrite, with some notes on unsupported features.
12997
12998 2008-03-24  Cary Coutant  <ccoutant@google.com>
12999
13000         * i386.cc (Target_i386::Got_type): New enum declaration.
13001         (Target_i386::Scan::local): Updated callers of Output_data_got
13002         member functions.
13003         (Target_i386::Scan::global): Likewise.
13004         (Target_i386::Relocate::relocate): Likewise.
13005         (Target_i386::Relocate::relocate_tls): Likewise.
13006         * object.h (Got_offset_list): New class.
13007         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13008         (Sized_relobj::local_got_offset): Likewise.
13009         (Sized_relobj::set_local_got_offset): Likewise.
13010         (Sized_relobj::local_has_tls_got_offset): Removed.
13011         (Sized_relobj::local_tls_got_offset): Removed.
13012         (Sized_relobj::set_local_tls_got_offset): Removed.
13013         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13014         * output.cc (Output_data_got::add_global): Added got_type parameter.
13015         (Output_data_got::add_global_with_rel): Likewise.
13016         (Output_data_got::add_global_with_rela): Likewise.
13017         (Output_data_got::add_global_pair_with_rel): New function.
13018         (Output_data_got::add_global_pair_with_rela): New function.
13019         (Output_data_got::add_local): Added got_type parameter.
13020         (Output_data_got::add_local_with_rel): Likewise.
13021         (Output_data_got::add_local_with_rela): Likewise.
13022         (Output_data_got::add_local_pair_with_rel): New function.
13023         (Output_data_got::add_local_pair_with_rela): New function.
13024         (Output_data_got::add_global_tls): Removed.
13025         (Output_data_got::add_global_tls_with_rel): Removed.
13026         (Output_data_got::add_global_tls_with_rela): Removed.
13027         (Output_data_got::add_local_tls): Removed.
13028         (Output_data_got::add_local_tls_with_rel): Removed.
13029         (Output_data_got::add_local_tls_with_rela): Removed.
13030         * output.h (Output_data_got::add_global): Added got_type parameter.
13031         (Output_data_got::add_global_with_rel): Likewise.
13032         (Output_data_got::add_global_with_rela): Likewise.
13033         (Output_data_got::add_global_pair_with_rel): New function.
13034         (Output_data_got::add_global_pair_with_rela): New function.
13035         (Output_data_got::add_local): Added got_type parameter.
13036         (Output_data_got::add_local_with_rel): Likewise.
13037         (Output_data_got::add_local_with_rela): Likewise.
13038         (Output_data_got::add_local_pair_with_rel): New function.
13039         (Output_data_got::add_local_pair_with_rela): New function.
13040         (Output_data_got::add_global_tls): Removed.
13041         (Output_data_got::add_global_tls_with_rel): Removed.
13042         (Output_data_got::add_global_tls_with_rela): Removed.
13043         (Output_data_got::add_local_tls): Removed.
13044         (Output_data_got::add_local_tls_with_rel): Removed.
13045         (Output_data_got::add_local_tls_with_rela): Removed.
13046         * resolve.cc (Symbol::override_base_with_special): Removed
13047         reference to has_got_offset_ field.
13048         * symtab.cc (Symbol::init_fields): Replaced initialization
13049         of got_offset_ with got_offsets_.  Removed initialization
13050         of has_got_offset_
13051         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13052         (Symbol::got_offset): Likewise.
13053         (Symbol::set_got_offset): Likewise.
13054         (Symbol::has_tls_got_offset): Removed.
13055         (Symbol::tls_got_offset): Removed.
13056         (Symbol::set_tls_got_offset): Removed.
13057         (Symbol::got_offset_): Removed.
13058         (Symbol::tls_mod_got_offset_): Removed.
13059         (Symbol::tls_pair_got_offset_): Removed.
13060         (Symbol::got_offsets_): New field.
13061         (Symbol::has_got_offset): Removed.
13062         (Symbol::has_tls_mod_got_offset): Removed.
13063         (Symbol::has_tls_pair_got_offset): Removed.
13064         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13065         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13066         member functions.
13067         (Target_x86_64::Scan::global): Likewise.
13068         (Target_x86_64::Relocate::relocate): Likewise.
13069         (Target_x86_64::Relocate::relocate_tls): Likewise.
13070
13071 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13072
13073         * yyscript.y: Fix spelling error in comment.
13074
13075 2008-03-24  Ian Lance Taylor  <iant@google.com>
13076
13077         * options.h (class General_options): Define build_id option.
13078         * layout.h (class Layout): Declare write_build_id, create_note,
13079         create_build_id.  Add build_id_note_ member.
13080         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13081         "libiberty.h", "md5.h", "sha1.h".
13082         (Layout::Layout): Initialize eh_frame_data_,
13083         eh_frame_hdr_section_, and build_id_note_.
13084         (Layout::finalize): Call create_build_id.
13085         (Layout::create_note): New function, broken out of
13086         Layout::create_gold_note.
13087         (Layout::create_gold_note): Call create_note.
13088         (Layout::create_build_id): New function.
13089         (Layout::write_build_id): New function.
13090         (Close_task_runner::run): Call write_build_id.
13091
13092         * x86_64.cc: Correct license to GPLv3.
13093
13094 2008-03-23  Ian Lance Taylor  <iant@google.com>
13095
13096         * options.cc: Include "demangle.h".
13097         (parse_optional_string): New function.
13098         (parse_long_option): Handle takes_optional_argument.
13099         (parse_short_option): Update dash_z initializer.  Handle
13100         takes_optional_argument.
13101         (General_options::General_options): Initialize do_demangle_.
13102         (General_options::finalize): Set do_demangle_.  Handle demangling
13103         style.
13104         * options.h (parse_optional_string): Declare.
13105         (struct One_option): Add optional_arg field.  Update constructor.
13106         Update call constructor calls.  Add takes_optional_argument
13107         function.
13108         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13109         (DEFINE_optional_string): Define.
13110         (General_options::demangle): Change from DEFINE_bool to
13111         DEFINE_optional_string.
13112         (General_options::no_demangle): New function.
13113         (General_options::do_demangle): New function.
13114         (General_options::set_do_demangle): New function.
13115         (General_options::execstack_status_): Move definition to end of
13116         class definition.
13117         (General_options::static_): Likewise.
13118         (General_options::do_demangle_): New field.
13119         * object.cc (big_endian>::get_symbol_location_info): Call
13120         Options::do_demangle, not Options::demangle.
13121         * symtab.cc (demangle): Likewise.
13122
13123 2008-03-22  Ian Lance Taylor  <iant@google.com>
13124
13125         * gold.h: Include <cstddef> and <sys/types.h>
13126         * options.h: Include <cstring>.
13127
13128 2008-03-21  Ian Lance Taylor  <iant@google.com>
13129
13130         * Added source code to GNU binutils.